OpenLayers OpenLayers

Ticket #1135: Text_with_id.diff

File Text_with_id.diff, 1.9 kB (added by jachym, 1 year ago)

OpenLayers.Layer.Text with new attribute "id"

  • lib/OpenLayers/Layer/Text.js

    old new  
    9191                    var vals = currLine.split('\t'); 
    9292                    var location = new OpenLayers.LonLat(0,0); 
    9393                    var title, url, description; 
     94                    var featureId = null; 
    9495                    var icon, iconSize, iconOffset, overflow; 
    9596                    var set = false; 
    9697                    for (var valIndex = 0; valIndex < vals.length; valIndex++) { 
     
    125126                                description = vals[valIndex]; 
    126127                            } else if (columns[valIndex] == 'overflow') { 
    127128                                overflow = vals[valIndex]; 
    128                             }     
     129                            } else if (columns[valIndex] == 'id') { 
     130                                featureId = vals[valIndex]; 
     131                            } 
    129132                        } 
    130133                    } 
    131134                    if (set) { 
     
    150153                      } 
    151154                       
    152155                      data['overflow'] = overflow || "auto";  
     156                      data.id = featureId;  
    153157                       
    154158                      var feature = new OpenLayers.Feature(this, location, data); 
    155159                      this.features.push(feature); 
  • tests/data_Layer_Text_textfile.txt

    old new  
    1 point   image 
    2 10,20   http://boston.openguides.org/markers/ORANGE.png 
    3 15,25   http://boston.openguides.org/markers/ORANGE.png 
     1point   id image 
     210,20   http://boston.openguides.org/markers/ORANGE.png 
     315,25   http://boston.openguides.org/markers/ORANGE.png