Hi all,
I took the example Refreshing points dynamically , and i was able to plot diffrent points. What i did was i need to put different colors for the points based on their status.
I tried the below code, it is working but the problem is I have to create different point layers with different colors. Can i have only one layers where points with different color are shown
public FormLoadShape()
{
LoadMap();
DrawPoints();
DrawPointG();
}
public void DrawPoints()
{
InMemoryFeatureLayer pointsLayer = new InMemoryFeatureLayer();
pointsLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.GetRandomGeoColor(RandomColorType.All)), 5);
pointsLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
for (int i = 0; i < 10; i++)
{
PointShape pointShape = GetRandomPoint(pointsBoundary);
string id = GetRandomDirection().ToString();
Feature feature = new Feature(pointShape.X, pointShape.Y, id);
pointsLayer.InternalFeatures.Add(feature);
}
LayerOverlay pointsOverlay = new LayerOverlay();
pointsOverlay.Layers.Add("PointsLayer", pointsLayer);
winformsMap1.Overlays.Add("PointsOverlay", pointsOverlay);
winformsMap1.Refresh(pointsOverlay);
}
public void DrawPointG()
{
InMemoryFeatureLayer pointsLayer1 = new InMemoryFeatureLayer();
pointsLayer1.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.StandardColors.Blue), 5);
pointsLayer1.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
for (int i = 0; i < 10; i++)
{
PointShape pointShape = GetRandomPoint(pointsBoundary);
string id = GetRandomDirection().ToString();
Feature feature = new Feature(pointShape.X, pointShape.Y, id);
pointsLayer1.InternalFeatures.Add(feature);
}
LayerOverlay pointsOverlay = new LayerOverlay();
pointsOverlay.Layers.Add("PointsLayer1", pointsLayer1);
winformsMap1.Overlays.Add("PointsOverlay1", pointsOverlay);
winformsMap1.Refresh(pointsOverlay);
}
public static PointShape GetRandomPoint(RectangleShape currentExtent)
{
double x = random.Next((int)currentExtent.UpperLeftPoint.X, (int)currentExtent.LowerRightPoint.X);
double y = random.Next((int)currentExtent.LowerRightPoint.Y, (int)currentExtent.UpperLeftPoint.Y);
PointShape pointShape = new PointShape(x, y);
return pointShape;
}
public static PanDirection GetRandomDirection()
{
int i = random.Next(8);
PanDirection panDirection = (PanDirection)i;
return panDirection;
}