After changed the geometry of the feature, you should redraw the feature.<br><br clear="all">Li XinGang<br>EMail: <a href="mailto:slinavlee@gmail.com">slinavlee@gmail.com</a><br>Blog: <a href="http://avlee.cnblogs.com">avlee.cnblogs.com</a><br>
Site: <a href="http://www.mapboost.org">www.mapboost.org</a><br>
<br><br><div class="gmail_quote">On Fri, Apr 2, 2010 at 6:43 AM, Cúmar Cueva <span dir="ltr"><<a href="mailto:qmarqeva@gmail.com">qmarqeva@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi guys,<br>
<br>
Please I need your help. I want to move a Marker (that was colocate using a<br>
VectorLayer, that works ok), but I can't do that, yet... Here is the code:<br>
<br>
For create the Map:<br>
<br>
//Map<br>
map = new OpenLayers.Map("map", {<br>
controls:[<br>
new OpenLayers.Control.Navigation(),<br>
new OpenLayers.Control.MousePosition(),<br>
new OpenLayers.Control.Attribution(),<br>
new OpenLayers.Control.Permalink(),<br>
new OpenLayers.Control.PanZoomBar(),<br>
new OpenLayers.Control.KeyboardDefaults(),<br>
new OpenLayers.Control.LayerSwitcher()<br>
],<br>
maxExtent: new<br>
OpenLayers.Bounds(-79.23381,-3.96749,-79.17630,-4.00457),<br>
displayProjection: new OpenLayers.Projection("EPSG:4326"),<br>
projection: new OpenLayers.Projection("EPSG:900913"),<br>
units: 'm',<br>
<br>
numZoomLevels: 19,<br>
maxResolution: 'auto'<br>
} );<br>
map.addLayer(new OpenLayers.Layer.OSM.Mapnik("Mapnik"));<br>
<br>
And a function for move:<br>
<br>
<br>
function moveFeatures(vectorLayer1){<br>
<br>
var features = vectorLayer1.features, selectedPlane = null;<br>
for (var i=features.length-1;i>=0;i--) {<br>
var feature = features[i];<br>
var poppedup = feature.attributes.poppedup;<br>
var x = feature.geometry.x + Math.cos(15 * Math.PI / 180) / 5;<br>
var y = feature.geometry.y + Math.sin(15 * Math.PI / 180) / 5;<br>
<br>
if (poppedup == true) {<br>
selectControl.unselect(feature);<br>
}<br>
<br>
if (vectorLayer.map.getExtent().contains(x, y)) {<br>
<br>
var newPoint = new OpenLayers.LonLat(x, y);<br>
feature.move(newPoint);<br>
if (poppedup == true) {<br>
selectControl.select(feature);<br>
}<br>
}<br>
else {<br>
vectorLayer.destroyFeatures([feature]);<br>
feature.destroy();<br>
feature = null;<br>
}<br>
}<br>
//only for simulate moved<br>
setTimeout(function(){moveFeatures(vectorLayer, vectorLayer.features ||<br>
[])}, 1000);<br>
}<br>
<br>
I put some "alerts" in javascript for view lat and lon values, and these<br>
change correctly... but the Marker in the map don't move !!!! please help<br>
me....<br>
<font color="#888888"><br>
<br>
--<br>
Atte,<br>
<br>
Cúmar Cueva<br>
_______________________________________________<br>
Dev mailing list<br>
<a href="mailto:Dev@openlayers.org">Dev@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/dev" target="_blank">http://openlayers.org/mailman/listinfo/dev</a><br>
</font></blockquote></div><br>