1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
var gpx= viewer.getMap().addLayer("GPX",
{
'track.gpx.name':
{
'de':"Reise",
'en':"Trip",
'es':"Viaje",
'fr':"Ballade",
'it':"Viaggio"
}
},
"../data/Campomoro-Tizzano-Sartene_3029.gpx",
{
visibility:true,
minZoomLevel:10,
maxZoomLevel:13,
originators:[{
pictureUrl:'./img/tracegps.gif',
url:'http://www.tracegps.com/'
}],
styleMap:new OpenLayers.StyleMap({
"default": new OpenLayers.Style(
OpenLayers.Util.applyDefaults({
fillColor: "#FFFF00",
fillOpacity: 0.6,
strokeColor: "#FF9900",
strokeWidth: 2,
graphicName: "triangle",
pointRadius: 8,
label:"${getName}",
labelAlign: "rb",
labelXOffset: -20,
labelYOffset: -20,
labelBackgroundColor: "yellow",
labelBorderColor: "black",
labelBorderSize: "1px",
fontColor: "black",
fontWeight: "bold",
fontSize: "12px",
fontFamily: "Courier New, monospace"
},OpenLayers.Feature.Vector.style["default"]),{
context:{
getName: function(f) {
if (f.attributes['typeName']=='wpt') {
return f.attributes['name'];
}
return '';
}
}
}),
}),
"select": new OpenLayers.Style(
OpenLayers.Util.applyDefaults({
fillColor: "#FF9900",
fillOpacity: 0.6,
strokeColor: "#FFFF00",
strokeWidth: 4,
pointRadius: 12
},OpenLayers.Feature.Vector.style["select"]))
}),
eventListeners:{
"loadend" : function() {
if (this.maxExtent) {
this.map.zoomToExtent(this.maxExtent);
}
},
"beforefeatureselected": changeRenderIntent,
"featureunselected" : changeRenderIntent
}
},
{
}
); |
Partager