Ticket #736: vectorimages.diff
| File vectorimages.diff, 3.4 kB (added by openlayers, 1 year ago) |
|---|
-
/mnt/d/eclipse/workspace/openlayers/examples/vector-features.html
old new 21 21 var style_blue = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']); 22 22 style_blue.strokeColor = "blue"; 23 23 style_blue.fillColor = "blue"; 24 style_blue.externalGraphic = "../img/marker.png"; 25 style_blue.pointRadius = 12; 24 26 var style_green = { 25 27 strokeColor: "#00FF00", 26 28 strokeOpacity: 1, … … 34 36 // create a point feature 35 37 var point = new OpenLayers.Geometry.Point(-111.04, 45.68); 36 38 var pointFeature = new OpenLayers.Feature.Vector(point,null,style_blue); 39 var point2 = new OpenLayers.Geometry.Point(-110.04, 44.68); 40 var pointFeature2 = new OpenLayers.Feature.Vector(point2,null,style_green); 37 41 38 42 // create a line feature from a list of points 39 43 var pointList = []; … … 64 68 65 69 map.addLayer(vectorLayer); 66 70 map.setCenter(new OpenLayers.LonLat(point.x, point.y), 5); 67 vectorLayer.addFeatures([pointFeature, lineFeature, polygonFeature]);71 vectorLayer.addFeatures([pointFeature, pointFeature2, lineFeature, polygonFeature]); 68 72 } 69 73 // --> 70 74 </script> -
/mnt/d/eclipse/workspace/openlayers/lib/OpenLayers/Renderer/SVG.js
old new 165 165 options = options || node._options; 166 166 167 167 if (node._geometryClass == "OpenLayers.Geometry.Point") { 168 node.setAttributeNS(null, "r", style.pointRadius); 168 alert(node.getAttributeNS(null, "id")); 169 if (style.externalGraphic) { 170 // remove old node 171 var id = node.getAttributeNS(null, "id"); 172 var x = node.getAttributeNS(null, "cx"); 173 var y = node.getAttributeNS(null, "cy"); 174 var _featureId = node._featureId; 175 var _geometryClass = node._geometryClass; 176 var _style = node._style; 177 this.root.removeChild(node); 178 179 // create new image node 180 var node = this.createNode("image", id); 181 node._featureId = _featureId; 182 node._geometryClass = _geometryClass; 183 node._style = _style; 184 this.root.appendChild(node); 185 186 // now style the new node 187 node.setAttributeNS(null, "x", x-style.pointRadius); 188 node.setAttributeNS(null, "y", y-style.pointRadius); 189 node.setAttributeNS(null, "width", 2*style.pointRadius); 190 node.setAttributeNS(null, "height", 2*style.pointRadius); 191 node.setAttributeNS("http://www.w3.org/1999/xlink", "href", style.externalGraphic); 192 } else { 193 node.setAttributeNS(null, "r", style.pointRadius); 194 } 169 195 } 170 196 171 197 if (options.isFilled) {
