Commit 309a2de73503c991961ea59f1488039972f43337
- Diff rendering mode:
- inline
- side by side
myVector.js
(11 / 9)
  | |||
197 | 197 | selectControl = new OpenLayers.Control.SelectFeature(box3, | |
198 | 198 | {onSelect: onFeatureSelect}); | |
199 | 199 | ||
200 | MapselectControl = new OpenLayers.Control.SelectFeature(map, | ||
201 | {onSelect: onMyFeatureSelect}); | ||
202 | |||
203 | 200 | drawControls = { | |
204 | 201 | box : new OpenLayers.Control.DrawFeature(boxes, | |
205 | 202 | OpenLayers.Handler.RegularPolygon, { | |
… | … | ||
206 | 206 | } | |
207 | 207 | } | |
208 | 208 | ), | |
209 | select: selectControl, | ||
210 | mySelect: MapselectControl | ||
209 | select: selectControl | ||
211 | 210 | }; | |
212 | 211 | map.zoomToExtent( mapBounds ); | |
213 | 212 | for(var key in drawControls){ | |
214 | 213 | map.addControl(drawControls[key]); | |
215 | 214 | } | |
216 | 215 | drawControls['select'].activate(); | |
217 | drawControls['mySelect'].activate(); | ||
218 | 216 | addLabel('3759.0000','-1274.33337','Face'); | |
219 | 217 | addLabel('3719','-1771','Jewelery'); | |
220 | 218 | addLabel('4263.0000','-1630.33337', 'Video') | |
… | … | ||
306 | 306 | favColor: 'blue', | |
307 | 307 | }; | |
308 | 308 | labelFeature.attributes['name'] = prompt("Enter a name"); | |
309 | map.addLayer(vectorLayer); | ||
310 | vectorLayer.drawFeature(labelFeature); | ||
311 | 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 | 320 | function toggleControl(element) { | |
314 | 321 | for(key in drawControls) { |