Commit 309a2de73503c991961ea59f1488039972f43337
Annotations with no names should not be rendered, or should be treated as incomplete ones
| | | | 197 | selectControl = new OpenLayers.Control.SelectFeature(box3, | 197 | selectControl = new OpenLayers.Control.SelectFeature(box3, |
---|
198 | {onSelect: onFeatureSelect}); | 198 | {onSelect: onFeatureSelect}); |
---|
199 | | 199 | |
---|
200 | MapselectControl = new OpenLayers.Control.SelectFeature(map, | | MapselectControl = new OpenLayers.Control.SelectFeature(map, |
---|
201 | {onSelect: onMyFeatureSelect}); | | {onSelect: onMyFeatureSelect}); |
---|
202 | | | |
---|
203 | drawControls = { | 200 | drawControls = { |
---|
204 | box : new OpenLayers.Control.DrawFeature(boxes, | 201 | box : new OpenLayers.Control.DrawFeature(boxes, |
---|
205 | OpenLayers.Handler.RegularPolygon, { | 202 | OpenLayers.Handler.RegularPolygon, { |
---|
… | | … | |
---|
206 | } | 206 | } |
---|
207 | } | 207 | } |
---|
208 | ), | 208 | ), |
---|
209 | select: selectControl, | | select: selectControl, |
---|
210 | mySelect: MapselectControl | | mySelect: MapselectControl |
---|
| | 209 | select: selectControl | 211 | }; | 210 | }; |
---|
212 | map.zoomToExtent( mapBounds ); | 211 | map.zoomToExtent( mapBounds ); |
---|
213 | for(var key in drawControls){ | 212 | for(var key in drawControls){ |
---|
214 | map.addControl(drawControls[key]); | 213 | map.addControl(drawControls[key]); |
---|
215 | } | 214 | } |
---|
216 | drawControls['select'].activate(); | 215 | drawControls['select'].activate(); |
---|
217 | drawControls['mySelect'].activate(); | | drawControls['mySelect'].activate(); |
---|
218 | addLabel('3759.0000','-1274.33337','Face'); | 216 | addLabel('3759.0000','-1274.33337','Face'); |
---|
219 | addLabel('3719','-1771','Jewelery'); | 217 | addLabel('3719','-1771','Jewelery'); |
---|
220 | addLabel('4263.0000','-1630.33337', 'Video') | 218 | addLabel('4263.0000','-1630.33337', 'Video') |
---|
… | | … | |
---|
306 | favColor: 'blue', | 306 | favColor: 'blue', |
---|
307 | }; | 307 | }; |
---|
308 | labelFeature.attributes['name'] = prompt("Enter a name"); | 308 | labelFeature.attributes['name'] = prompt("Enter a name"); |
---|
309 | map.addLayer(vectorLayer); | | map.addLayer(vectorLayer); |
---|
310 | vectorLayer.drawFeature(labelFeature); | | vectorLayer.drawFeature(labelFeature); |
---|
311 | vectorLayer.addFeatures([labelFeature]); | | vectorLayer.addFeatures([labelFeature]); |
---|
| | 309 | console.log(labelFeature.attributes['name']); | | | 310 | if(labelFeature.attributes['name']) |
---|
| | 311 | { |
---|
| | 312 | console.log("here"); |
---|
| | 313 | map.addLayer(vectorLayer); |
---|
| | 314 | vectorLayer.drawFeature(labelFeature); |
---|
| | 315 | vectorLayer.addFeatures([labelFeature]); |
---|
| | 316 | } |
---|
| | 317 | else |
---|
| | 318 | myObj.feature.destroy(); |
---|
312 | } | 319 | } |
---|
313 | function toggleControl(element) { | 320 | function toggleControl(element) { |
---|
314 | for(key in drawControls) { | 321 | for(key in drawControls) { |
---|