[OpenLayers-Users] Drag, Resize and draw point does not work
koveras vehcna
silver_fox2006 at hotmail.com
Mon Aug 9 03:04:56 EDT 2010
Hello there, I have written an OpenLayers app in which I can change the
colors of any shape I can draw onto the map -by selecting the color from a
box menu- but when I try to drag or resize these shapes, the program does
nothing. Also I cannot draw points as if there is some incompatibility with
the color function and the vector layer. How can I solve this ? The color
change code along with vector layer initialization is as below:
//color change function
function describeFeature(feature){
var tehcolor = document.getElementById("colors").value;//get value of
selected color -name etc.-
feature.attributes = {color: tehcolor};//assign value to attributes of
feature -drawing stuff-
vector.drawFeature(feature);//opacity: tehopacity attribute
}
//styling
var myStyleMap = new OpenLayers.StyleMap(
new OpenLayers.Style({
fillColor: '${color}',
strokeColor: '${color}', strokeOpacity: 0.5,
fillOpacity: 0.5}
));
var vector = new OpenLayers.Layer.Vector("Vector Layer", {styleMap:
myStyleMap});//vector
also , the color change function is initialized in the drawFeature as below:
(point, polygon, line etc. but I only include point here since it is one of
the problems mentioned above)
drawControls = {//drawing - modifying - selection controls to be added to
the map
point: new OpenLayers.Control.DrawFeature(
vector, OpenLayers.Handler.Point
//{featureAdded: describeFeature}
)
So, any ideas ? Thanks.
Koveras
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Drag-Resize-and-draw-point-does-not-work-tp5388025p5388025.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list