I would like to animate an icon on web edition.
Following code is been used in Desktop edition, which is working fine.......
How can I do the same in web Edition.
timer.Interval = 100;
timer.Tick += new EventHandler(timer_Tick);
winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
InMemoryFeatureLayer bitmapLayer = new InMemoryFeatureLayer();
bitmapLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.PointType = PointType.Bitmap;
bitmapLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.Image = new GeoImage(Application.StartupPath + @"\A090.png");
bitmapLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.ContestedBorder2;
bitmapLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
PointShape planeShape = new PointShape(55.3899993896484, 25.2433338165283);
PointShape destinationPoint = new PointShape(77.0950012207031, 28.5666675567627);
MultilineShape airLineShape = planeShape.GreatCircle(destinationPoint);
bitmapLayer.InternalFeatures.Add("Plane", new Feature(planeShape));
bitmapLayer.InternalFeatures.Add("AirLine", new Feature(airLineShape));
LayerOverlay planeOverlay = new LayerOverlay();
planeOverlay.Layers.Add("BitmapLayer", bitmapLayer);
winformsMap1.Overlays.Add("PlaneOverlay", planeOverlay);
//winformsMap1.CurrentExtent = new RectangleShape(-139.2, 92.4, 120.9, -93.2);
winformsMap1.Refresh();
timer.Start();
private void timer_Tick(object sender, EventArgs e)
{
InMemoryFeatureLayer bitmapLayer = (InMemoryFeatureLayer)winformsMap1.FindFeatureLayer("BitmapLayer");
PointShape pointShape = bitmapLayer.InternalFeatures[0].GetShape() as PointShape;
LineShape airLine = ((MultilineShape)bitmapLayer.InternalFeatures[1].GetShape()).Lines[0];
PointShape pointShape1 = bitmapLayer.InternalFeatures[2].GetShape() as PointShape;
LineShape airLine1 = ((MultilineShape)bitmapLayer.InternalFeatures[3].GetShape()).Lines[0];
PointShape pointShape2 = bitmapLayer.InternalFeatures[4].GetShape() as PointShape;
LineShape airLine2 = ((MultilineShape)bitmapLayer.InternalFeatures[5].GetShape()).Lines[0];
bitmapLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.RotationAngle = index;
//pointShape.Rotate(pointShape,359);
index += 1;
index1 += 1;
index2 += 1;
if (index < airLine.Vertices.Count)
{
Vertex newPosition = airLine.Vertices[index];
pointShape.X = newPosition.X;
pointShape.Y = newPosition.Y;
pointShape.Id = "Plane";
if (pointShape.CanRotate)
{
//bitmapLayer
pointShape.Rotate(pointShape,180);
}
bitmapLayer.Open();
bitmapLayer.EditTools.BeginTransaction();
bitmapLayer.EditTools.Update(pointShape);
bitmapLayer.EditTools.CommitTransaction();
bitmapLayer.Close();
}
else
{
index = 0;
}
if (index1 < airLine1.Vertices.Count)
{
Vertex newPosition = airLine1.Vertices[index1];
pointShape1.X = newPosition.X;
pointShape1.Y = newPosition.Y;
pointShape1.Id = "Plane1";
bitmapLayer.Open();
bitmapLayer.EditTools.BeginTransaction();
bitmapLayer.EditTools.Update(pointShape1);
bitmapLayer.EditTools.CommitTransaction();
bitmapLayer.Close();
}
else
{
index1 = 0;
}
if (index2 < airLine2.Vertices.Count)
{
Vertex newPosition = airLine2.Vertices[index2];
pointShape2.X = newPosition.X;
pointShape2.Y = newPosition.Y;
pointShape2.Id = "Plane2";
bitmapLayer.Open();
bitmapLayer.EditTools.BeginTransaction();
bitmapLayer.EditTools.Update(pointShape2);
bitmapLayer.EditTools.CommitTransaction();
bitmapLayer.Close();
}
else
{
index2 = 0;
}
winformsMap1.Refresh(winformsMap1.Overlays["PlaneOverlay"]);
}
Thanks in advance.
Robinson C P