Hello,
in my Application I create doughnut polygons (one outer ring, one inner ring). But my polygons are completely filled, i can not see a hole for the inner ring. Hints are very wellcome...
Torsten
public Form1()
{
InitializeComponent();
this.winformsMap1.MapUnit = GeographyUnit.Meter;
}
static string fn_polyError = "polygon.txt";
private void button1_Click(object sender, EventArgs e)
{
string ff = fn_polyError;
string fn = Path.Combine(@"d:\", ff);
if (!File.Exists(fn)) return;
StreamReader sr = new StreamReader(fn, Encoding.UTF8);
var koordString = sr.ReadToEnd();
PolygonShape poly = new PolygonShape();
poly.LoadFromWellKnownData(koordString);
PolygonShape outer = null;
PolygonShape inner = null;
if (string.Compare(ff, fn_polyError, true) == 0)
{
outer = new PolygonShape(poly.OuterRing.CloneDeep() as RingShape);
outer.TranslateByOffset(1400, 1400, GeographyUnit.Meter, DistanceUnit.Meter);
inner = new PolygonShape(poly.InnerRings[0].CloneDeep() as RingShape);
inner.TranslateByOffset(-1400, 1400, GeographyUnit.Meter, DistanceUnit.Meter);
}
InMemoryFeatureLayer inMemoryFeatureLayer = new InMemoryFeatureLayer();
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(100, GeoColor.StandardColors.DarkBlue));
inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay ovl = new LayerOverlay();
ovl.Layers.Add(inMemoryFeatureLayer);
ovl.IsVisible = true;
inMemoryFeatureLayer.IsVisible = true;
this.winformsMap1.Overlays.Add(ovl);
inMemoryFeatureLayer.Open();
inMemoryFeatureLayer.EditTools.BeginTransaction();
inMemoryFeatureLayer.EditTools.Add(new Feature(poly));
if (null != outer) inMemoryFeatureLayer.EditTools.Add(new Feature(outer));
if (null != inner) inMemoryFeatureLayer.EditTools.Add(new Feature(inner));
inMemoryFeatureLayer.EditTools.CommitTransaction();
var ext = inMemoryFeatureLayer.GetBoundingBox();
inMemoryFeatureLayer.Close();
this.winformsMap1.CurrentExtent = ext;
this.winformsMap1.Refresh(ovl);
}