예제 #1
0
        private static void DrawNormalStyle(this Style style, PlatformGeoCanvas canvas, DrawingRectangleF drawingRectangleF)
        {
            if (style is LineStyle)
            {
                LineStyle lineStyle = (LineStyle)style;

                if (lineStyle.CenterPen.Width <= 2 && lineStyle.InnerPen.Width <= 2 && lineStyle.OuterPen.Width <= 2)
                {
                    lineStyle = (LineStyle)lineStyle.CloneDeep();

                    lineStyle.CenterPen.Width += 1;
                    lineStyle.InnerPen.Width  += 1;
                    lineStyle.OuterPen.Width  += 1;

                    LineShape line = GenerateStraightHorizontalLineShape(canvas.CurrentWorldExtent);
                    line.Rotate(line.GetCenterPoint(), 270);
                    lineStyle.Draw(new BaseShape[] { line }, canvas, new Collection <SimpleCandidate>(), new Collection <SimpleCandidate>());
                }
                else
                {
                    lineStyle.DrawSample(canvas, drawingRectangleF);
                }
            }
            else if (style is FontPointStyle)
            {
                var fontStyle = (FontPointStyle)style;
                var tmpsize   = fontStyle.CharacterFont.Size;
                if (tmpsize > 26)
                {
                    fontStyle.CharacterFont = new GeoFont(fontStyle.CharacterFont.FontName, 26, fontStyle.CharacterFont.Style);
                }
                fontStyle.DrawSample(canvas, drawingRectangleF);
                if (tmpsize > 26)
                {
                    fontStyle.CharacterFont = new GeoFont(fontStyle.CharacterFont.FontName, tmpsize, fontStyle.CharacterFont.Style);
                }
            }
            else if (style is PointStyle)
            {
                var pointStyle    = (PointStyle)style;
                var tmpSymbolSize = pointStyle.SymbolSize;
                if (tmpSymbolSize > 22)
                {
                    pointStyle.SymbolSize = 22;
                }
                pointStyle.DrawSample(canvas, drawingRectangleF);
                if (tmpSymbolSize > 22)
                {
                    pointStyle.SymbolSize = tmpSymbolSize;
                }
            }
            else if (style != null)
            {
                style.DrawSample(canvas, drawingRectangleF);
            }
        }
        private List <Vertex> GetAllVertices(Collection <Vertex> vertices)
        {
            List <Vertex> allVertices = new List <Vertex>(vertices);

            for (int i = 0; i < vertices.Count; i++)
            {
                if (i != vertices.Count - 1)
                {
                    LineShape lineShape = new LineShape();
                    lineShape.Vertices.Add(vertices[i]);
                    lineShape.Vertices.Add(vertices[i + 1]);
                    PointShape lineCenterPoint = lineShape.GetCenterPoint();
                    allVertices.Add(new Vertex(lineCenterPoint.X, lineCenterPoint.Y));
                }
            }
            return(allVertices);
        }