[OpenLayers-Users] relocate an point feature?
ulao
S_K_U_N_X at yahoo.com
Tue Apr 5 10:26:50 EDT 2011
I have used the function for some time now to relocate features. It seem it
does not work right for points? I'm not sure this is the best way to
relocate a feature ( kind of silly IMO ) but it was the only example I had.
Is there a better way, or is there a reason it does not work with points?
The problem is the drawFeature. I see the x and y data changing so I know
that part is good, the item just does not relocate. If I use destroyFeature
it does in fact destroy it.
{
var objF = this;
var geomType =
objF.geometry.CLASS_NAME.replace(/OpenLayers.Geometry./,"");
if(geomType=="Point") //icon and points
{
var newPts = ProjLatLon(inPts.lat,inPts.lon);
objF.geometry.x = newPts.lon;
objF.geometry.y = newPts.lat;
}
else if(geomType=="LineString")
{ for(var j=0;j<objF.geometry.components.length;j++)
{
var newPts = ProjLatLon(inPts[j].lat,inPts[j].lon);
objF.geometry.components[j].x = newPts.lon;
objF.geometry.components[j].y = newPts.lat;
}
}
else if(geomType=="Polygon")
{
var objFpt = objF.geometry.components[0].components;
for(var i=0;i<objFpt.length-1;i++)
{
var newPts = ProjLatLon(inPts[i].lat,inPts[i].lon);
objFpt[i].x = newPts.lon;
objFpt[i].y = newPts.lat;
}
}
objF.layer.drawFeature(this);
}
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/relocate-an-point-feature-tp6242472p6242472.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list