Changeset ce387de in osmose-frontend


Ignore:
Timestamp:
Oct 31, 2012 8:07:08 PM (5 years ago)
Author:
Frédéric Rodrigo <frodrigo@…>
Branches:
master
Children:
c4fe22d
Parents:
3274bb2
Message:

Remove useless data from marker list

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • map.py

    r80fc4e5 rce387de  
    211211    results = db.fetchall() 
    212212 
    213     out = ["\t".join(["lat", "lon", "marker_id", "icon", "iconSize", "iconOffset", "html"])] 
     213    out = ["\t".join(["lat", "lon", "marker_id", "item"])] 
    214214    for res in results: 
    215215        lat       = str(float(res["lat"])/1000000) 
     
    217217        error_id  = res["id"] 
    218218        item      = res["item"] or 0 
    219         marker = "../images/markers/marker-b-%d.png" % (res["item"]) 
    220         out.append("\t".join([lat, lon, str(error_id), marker, "17,33", "-8,-33", "plop"]).encode("utf8")) 
     219        out.append("\t".join([lat, lon, str(error_id), str(item)])) 
    221220 
    222221    response.content_type = "text/plain; charset=utf-8" 
  • static/map/DynPoi.js

    rc537e71 rce387de  
    4646                            attributes['lon'] = geometry.x; 
    4747                            set = true; 
    48                         } else if (columns[valIndex] == 'image' || columns[valIndex] == 'icon') style['externalGraphic'] = vals[valIndex]; 
    49                         else if (columns[valIndex] == 'iconSize') { 
    50                             var size = vals[valIndex].split(','); 
    51                             style['graphicWidth'] = parseFloat(size[0]); 
    52                             style['graphicHeight'] = parseFloat(size[1]); 
    53                         } else if (columns[valIndex] == 'iconOffset') { 
    54                             var offset = vals[valIndex].split(','); 
    55                             style['graphicXOffset'] = parseFloat(offset[0]); 
    56                             style['graphicYOffset'] = parseFloat(offset[1]); 
    57                         } else if (columns[valIndex] == 'marker_id') attributes['marker_id'] = vals[valIndex]; 
    58                         else if (columns[valIndex] == 'html') attributes['html'] = vals[valIndex]; 
     48                        } else if (columns[valIndex] == 'item') { 
     49                            style['item'] = vals[valIndex]; 
     50                        } else if (columns[valIndex] == 'marker_id') { 
     51                            attributes['marker_id'] = vals[valIndex]; 
     52                        } 
    5953                    } 
    6054                } 
     
    204198 
    205199            location = new OpenLayers.LonLat(feature.geometry.x, feature.geometry.y); 
    206  
    207             if (feature.style.graphicWidth && feature.style.graphicHeight) { 
    208                 iconSize = new OpenLayers.Size(feature.style.graphicWidth, feature.style.graphicHeight); 
    209             } 
    210  
    211             // FIXME: At the moment, we only use this if we have an 
    212             // externalGraphic, because icon has no setOffset API Method. 
    213             /** 
    214              * FIXME FIRST!! 
    215              * The Text format does all sorts of parseFloating 
    216              * The result of a parseFloat for a bogus string is NaN. That 
    217              * means the three possible values here are undefined, NaN, or a 
    218              * number. The previous check was an identity check for null. This 
    219              * means it was failing for all undefined or NaN. A slightly better 
    220              * check is for undefined. An even better check is to see if the 
    221              * value is a number (see #1441). 
    222              */ 
    223             if (feature.style.graphicXOffset !== undefined && feature.style.graphicYOffset !== undefined) { 
    224                 iconOffset = new OpenLayers.Pixel(feature.style.graphicXOffset, feature.style.graphicYOffset); 
    225             } 
    226  
    227             if (feature.style.externalGraphic != null) { 
    228                 data.icon = new OpenLayers.Icon(feature.style.externalGraphic, iconSize, iconOffset); 
    229             } else { 
    230                 data.icon = OpenLayers.Marker.defaultIcon(); 
    231                 // allows for the case where the image url is not 
    232                 // specified but the size is. use a default icon 
    233                 // but change the size 
    234                 if (iconSize != null) { 
    235                     data.icon.setSize(iconSize); 
    236                 } 
    237             } 
    238  
    239             if (feature.attributes.comment == null) feature.attributes.comment = ""; 
    240             if (feature.attributes.marker_id != null) { 
    241                 data['popupContentHTML'] = feature.attributes.html; 
    242             } 
     200            iconSize = new OpenLayers.Size(17,33); 
     201            iconOffset = new OpenLayers.Pixel(-8,-33); 
     202            data.icon = new OpenLayers.Icon("../images/markers/marker-b-"+feature.style.item+".png", iconSize, iconOffset); 
    243203 
    244204            data['overflow'] = feature.attributes.overflow || "auto"; 
Note: See TracChangeset for help on using the changeset viewer.