I looked at the airplane bitmap example but could not translate it to get a polygon created in a layer to move over time.
I created a POLYGON on a layer. It shows up fine.
inMemoryLayer.InternalFeatures.Add(vehicleid + "M1", new Feature(BaseShape.CreateShapeFromWellKnownData("POLYGON(" ...... ")));
Now I want to move the polygon over time.. I used the AirPlane example to start with but the polygons dont move. How do I get these to move???
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];
InMemoryFeatureLayer VehicleOverlay = (InMemoryFeatureLayer)winformsMap1.FindFeatureLayer("InMemoryFeatureLayer");
int cnt = VehicleOverlay.InternalFeatures.Count;
VehicleOverlay.Open();
VehicleOverlay.EditTools.BeginTransaction();
for(int zz = 0; zz < cnt; zz++)
{
BaseShape bs = VehicleOverlay.InternalFeatures[zz].GetShape();
String s = bs.GetType().Name;
if (s == "PolygonShape")
{
bs.TranslateByOffset(10.0,0.0);
VehicleOverlay.EditTools.Update(bs);
}
}
VehicleOverlay.EditTools.CommitTransaction();
VehicleOverlay.Close();
//index += 30;
//if (index < airLine.Vertices.Count)
//{
// Vertex newPosition = airLine.Vertices[index];
// pointShape.X = newPosition.X;
// pointShape.Y = newPosition.Y;
// pointShape.Id = "Plane";
// bitmapLayer.Open();
// bitmapLayer.EditTools.BeginTransaction();
// bitmapLayer.EditTools.Update(pointShape);
// bitmapLayer.EditTools.CommitTransaction();
// bitmapLayer.Close();
//}
//else
//{
// index = 0;
//}
winformsMap1.Refresh(winformsMap1.Overlays["VehicleOverlay"]);
winformsMap1.Refresh();
}