I am converting v2 code to v4. I am trying to display the current position (supplied via GPS) and zoom in to display it. Previously I used MapShape to do this so the code needs a complete re-write.
I have come up with this to display the position:
InMemoryFeatureLayer inMemoryLayer = new InMemoryFeatureLayer();
PointShape currentPos = new PointShape(gpsPosition.Easting, gpsPosition.Northing);
inMemoryLayer.InternalFeatures.Add("Position", new Feature(currentPos));
inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle =
new PointStyle(PointSymbolType.Star, new GeoSolidBrush(GeoColor.StandardColors.Red), new GeoPen(GeoColor.StandardColors.Black), 14);
LayerOverlay gpsOverlay = GetOverlay("GpsOverlay");
gpsOverlay.Layers.Add(inMemoryLayer);
Is this the way to do it?
Next I want to zoom in. Previously I used this code:
Dim ell As Ellipse = currentPos.Buffer(100, MapLengthUnits.metres, MapLengthUnits.metres)
Dim rect As StraightRectangle = ell.Envelope
rect.ScaleUp(100)
Map1.CurrentExtent = rect.ToRectangleR
But .Buffer now returns a MultipolygonShape not an ellipse. What is the best way to do this?
Cheers
Steve