Beispiel #1
0
        private static void DrawPolygon(Geometry.Polygon polygon, Geometry.Box box, Graphics graphics, Settings settings, Geometry.Traits traits)
        {
            LocalCS cs     = new LocalCS(box, graphics);
            Drawer  drawer = new Drawer(graphics, settings.color);

            if (traits.Unit == Geometry.Unit.None)
            {
                PointF[] dst_outer_points = cs.Convert(polygon.Outer);
                if (dst_outer_points != null)
                {
                    GraphicsPath gp = new GraphicsPath();
                    gp.AddPolygon(dst_outer_points);

                    if (settings.showDir)
                    {
                        drawer.DrawDirs(dst_outer_points, true);
                        drawer.DrawPoint(dst_outer_points[0]);
                    }

                    foreach (Ring inner in polygon.Inners)
                    {
                        PointF[] dst_inner_points = cs.Convert(inner);
                        if (dst_inner_points != null)
                        {
                            gp.AddPolygon(dst_inner_points);

                            if (settings.showDir)
                            {
                                drawer.DrawDirs(dst_inner_points, true);
                                drawer.DrawPoint(dst_inner_points[0]);
                            }
                        }
                    }

                    drawer.FillPath(gp);
                    drawer.DrawPath(gp);
                }
            }
            else
            {
                Drawer.PeriodicDrawablePolygon pd = new Drawer.PeriodicDrawablePolygon(cs, polygon.Outer, polygon.Inners, traits.Unit, settings.densify);
                Geometry.Interval interval        = RelativeEnvelopeLon(polygon.Outer, polygon.Inners, traits.Unit);
                drawer.DrawPeriodic(cs, box, interval, traits.Unit, pd, true, settings.showDir, settings.showDots);

                if (settings.showDir)
                {
                    if (settings.showDir && polygon.Outer.Count > 0)
                    {
                        drawer.DrawPeriodicPoint(cs, polygon.Outer[0], box, traits.Unit, settings.showDots);
                    }

                    foreach (Ring inner in polygon.Inners)
                    {
                        if (inner.Count > 0)
                        {
                            drawer.DrawPeriodicPoint(cs, inner[0], box, traits.Unit, settings.showDots);
                        }
                    }
                }
            }
        }