[mapserver-users] Create 2 Feature Object Animation (Openlayers)
Vivaldi Al Barado
vivaldi_albarado at yahoo.com
Tue Jun 5 19:48:04 PDT 2012
Dear All..
I want to create a circle object using the feature. I hope the object to change position every 2 seconds from the coordinates of A to B.
The question is, why two objects that have been created does not change the location, but even more thickened at the same location.
Here is the function that I created, please its support:
var map;
var c = 0;
ShowPoint function ()
{
c = c +1;
setTimeout ("ShowPoint ()", 2000);
var point1 = new OpenLayers.Geometry.Point (-72, 42);
var point2 = new OpenLayers.Geometry.Point (-85, 45);
feature_point1 var = new OpenLayers.Feature.Vector (point1);
feature_point2 var = new OpenLayers.Feature.Vector (point2);
if (c% 2! = 0)
{
map.layers [1]. addFeatures ([feature_point1]);
map.layers [1]. removeFeatures ([feature_point2]);
Else {}
map.layers [1]. addFeatures ([feature_point2]);
map.layers [1]. removeFeatures ([feature_point1]);
}
}
function init () {
/ / Create a folder with an empty array of controls
map = new OpenLayers.Map ('map_element', {
controls: [
OpenLayers.Control.Navigation new (),
OpenLayers.Control.PanZoomBar new (),
OpenLayers.Control.LayerSwitcher new ()
],
maxScale: 27683990.15625,
minScale: 221471921.25
});
wms_layer var = new OpenLayers.Layer.WMS (
"OpenLayers WMS",
'http://vmap0.tiles.osgeo.org/wms/vmap0',
{layers: 'basic'},
{});
vector_layer var = new OpenLayers.Layer.Vector ('Basic Vector Layer');
map.addControl (new OpenLayers.Control.EditingToolbar (vector_layer));
map.addLayers ([wms_layer, vector_layer]);
map.render ('map_element');
if (! map.getCenter ()) {
map.zoomToMaxExtent ();
}
ShowPoint ();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120606/af45844f/attachment.htm>
More information about the MapServer-users
mailing list