Changeset b1506f0 in osmose-frontend


Ignore:
Timestamp:
Mar 1, 2014 11:08:40 AM (6 years ago)
Author:
Frédéric Rodrigo <fred.rodrigo@…>
Branches:
master
Children:
4bfd029
Parents:
92b26d3
git-author:
Frédéric Rodrigo <fred.rodrigo@…> (15/02/2014 19:52:48)
git-committer:
Frédéric Rodrigo <fred.rodrigo@…> (01/03/2014 11:08:40)
Message:

Redesign markers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/make-markers.py

    rf6a2ac9 rb1506f0  
    120120 
    121121def get_marker(contour, symbole, couleur): 
    122     if contour == "M": # marqueur 
    123         h = 32 
    124         l = 20 
    125         g = "translate(2,3) scale(1,1)" 
    126         c = "<path style='fill:" + couleur + ";stroke:#000000;stroke-width:.5px' d='M 10,1 L 19,10 L 10,31, L 1,10, L 10,1 z' />" 
    127         m = get_symb(symbole) 
     122    dark_color = "#%0.2X%0.2X%0.2X" % (int(couleur[1:3], 16)*0.5, int(couleur[3:5], 16)*0.5, int(couleur[5:7], 16)*0.5) 
     123    mid_color = "#%0.2X%0.2X%0.2X" % (int(couleur[1:3], 16)*0.75, int(couleur[3:5], 16)*0.75, int(couleur[5:7], 16)*0.75) 
    128124    if contour == "L": # légende 
    129125        h = 12 
    130126        l = h 
    131127        g = "translate(-2,-2) scale(1,1)" 
    132         c = "<path style='fill:" + couleur + ";stroke:#000000;stroke-width:1px' d='M 0.5,0.5 L 0.5,11.5 L 11.5,11.5 L 11.5,0.5 L 0.5,0.5 z' />" 
     128        c = "<defs id='defs'><linearGradient id='gradient' x1='6' y1='12' x2='6' y2='0' gradientUnits='userSpaceOnUse'>" 
     129        c += "<stop style='stop-color:" + mid_color + "' offset='0' />" 
     130        c += "<stop style='stop-color:" + couleur + "' offset='1' />" 
     131        c += "</linearGradient></defs>" 
     132        c += "<path style='fill:url(#gradient);' d='M 0.5,0.5 L 0.5,11.5 L 11.5,11.5 L 11.5,0.5 L 0.5,0.5 z' />" 
     133        c += "<path style='fill:none;stroke:" + mid_color + ";stroke-width:1px' d='M 1.5,1.5 L 1.5,10.5 L 10.5,10.5 L 10.5,1.5 L 1.5,1.5 z' />" 
     134        c += "<path style='fill:none;stroke:#000000;stroke-width:1px' d='M 0.5,0.5 L 0.5,11.5 L 11.5,11.5 L 11.5,0.5 L 0.5,0.5 z' />" 
    133135        m = get_symb(symbole) 
    134136    if contour == "B": # bubble 
     
    136138        l = 16 
    137139        g = "translate(0,1) scale(1,1)" 
    138         c = "<path style='fill:" + couleur + ";stroke:#000000;stroke-width:.5px' d='m 8,31.75 c 2,-12 7.75,-18 7.75,-23.5 0,-4 -3.5,-8 -7.75,-8 -4.25,0 -7.75,4 -7.75,8 0,5.5 5.75,11.5 7.75,23.5 z' />" 
     140        c = "<defs id='defs'><linearGradient id='gradient' x1='8' y1='32' x2='8' y2='0' gradientUnits='userSpaceOnUse'>" 
     141        c += "<stop style='stop-color:" + dark_color + "' offset='0' />" 
     142        c += "<stop style='stop-color:" + couleur + "' offset='1' />" 
     143        c += "</linearGradient></defs>" 
     144        c += "<path style='fill:url(#gradient)' d='m 8,31.75 c 2,-12 7.75,-18 7.75,-23.5 0,-4 -3.5,-8 -7.75,-8 -4.25,0 -7.75,4 -7.75,8 0,5.5 5.75,11.5 7.75,23.5 z' />" 
     145        c += "<path style='fill:none;stroke:" + mid_color + ";stroke-width:.75px' d='m 8,0.5 c -4.0986579,0 -7.5,3.8907009 -7.5,7.75 0,2.665945 1.4044222,5.527256 3.09375,9.21875 1.5774956,3.44712 3.3559017,7.676923 4.40625,13.125 1.0503483,-5.448077 2.828754,-9.67788 4.40625,-13.125 C 14.095578,13.777256 15.5,10.915945 15.5,8.25 15.5,4.3907009 12.098658,0.5 8,0.5 z' />" 
     146        c += "<path style='fill:none;stroke:#000000;stroke-width:.5px' d='m 8,31.75 c 2,-12 7.75,-18 7.75,-23.5 0,-4 -3.5,-8 -7.75,-8 -4.25,0 -7.75,4 -7.75,8 0,5.5 5.75,11.5 7.75,23.5 z' />" 
    139147        m = get_symb(symbole) 
    140148    head  = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" 
     
    149157for i in all_items: 
    150158    print i 
    151     for m in "MLB": 
     159    for m in "LB": 
    152160        file_svg = os.path.join(marker_folder, "marker-%s-%d.svg"%(m.lower(), i["item"])) 
    153161        file_png = os.path.join(marker_folder, "marker-%s-%d.png"%(m.lower(), i["item"])) 
Note: See TracChangeset for help on using the changeset viewer.