Ejemplo n.º 1
0
 public LineShape(Collection <Vertex> vertexes, int width, RGBColor color)
     : base(DAIShapeType.Line, width, color)
 {
     this.vertexes = vertexes;
 }
Ejemplo n.º 2
0
 public AreaShape(Collection <RingShape> outerRings, Collection <RingShape> innerRings, int width, RGBColor color, int transparency, AreaShapeFillPattern fillPattern)
     : base(DAIShapeType.Area, width, color)
 {
     this.outerRings   = outerRings;
     this.innerRings   = outerRings;
     this.transparency = transparency;
     this.fillPattern  = fillPattern;
 }
Ejemplo n.º 3
0
 public RingShape(Collection <DAIShape> ring, int width, RGBColor color)
     : base(DAIShapeType.Ring, width, color)
 {
     this.ring = ring;
 }
Ejemplo n.º 4
0
        public Collection <DAIShape> GetShapes(Dictionary <string, RGBColor> colorRef)
        {
            Collection <DAIShape> shapes = new Collection <DAIShape>();

            RGBColor color = colorSymbol.GetColor(colorRef);
            int      width = widthSymbol.GetWidth();

            Vertex startVertex             = GetVertex();
            Collection <Vertex> lineBuffer = new Collection <Vertex>();

            lineBuffer.Insert(0, new Vertex(startVertex.X, startVertex.Y));

            foreach (S52BaseSymbol drawingSymbol in drawingSymbols)
            {
                if (drawingSymbol is PDSymbol)
                {
                    // line or point shape
                    Collection <Vertex> vertexes = (drawingSymbol as PDSymbol).GetVertexes();

                    if (vertexes.Count == 0)
                    {
                        // it's a point shape
                        PointShape shape = new PointShape(startVertex.X, startVertex.Y, width, color);
                        shapes.Add(shape);

                        // the next start vertex is the same as the current
                        // clean line buffer, and start next buffer
                        lineBuffer.Clear();
                        lineBuffer.Add(new Vertex(startVertex.X, startVertex.Y));
                    }
                    else
                    {
                        // it's a line shape
                        foreach (Vertex vertex in vertexes)
                        {
                            lineBuffer.Add(vertex);
                        }

                        // the next start vertex is the end of the line vertex
                        startVertex = vertexes[vertexes.Count - 1];
                    }
                }
                else if (drawingSymbol is CISymbol)
                {
                    // circle shape
                    // the next start vertex is the same as the current
                    int         radius = (drawingSymbol as CISymbol).GetRadius();
                    CircleShape shape  = new CircleShape(new Vertex(startVertex.X, startVertex.Y), radius, width, color);

                    // clean line buffer, then start next buffer
                    if (lineBuffer.Count > 1)
                    {
                        // add previous line shape
                        LineShape lineShape = new LineShape(new Collection <Vertex>(lineBuffer), width, color);
                        shapes.Add(lineShape);

                        lineBuffer.Clear();
                        lineBuffer.Add(new Vertex(startVertex.X, startVertex.Y));
                    }

                    // add circle shape
                    shapes.Add(shape);
                }
                else if (drawingSymbol is AASymbol)
                {
                    // ara angle shape
                    Vertex        centerVertex = (drawingSymbol as AASymbol).GetCenterVertex();
                    int           angle        = (drawingSymbol as AASymbol).GetAngle();
                    ArcAngleShape shape        = new ArcAngleShape(centerVertex, new Vertex(startVertex.X, startVertex.Y), angle, width, color);

                    // the next start vertex is the end of the ara angle vertex
                    startVertex = shape.GetEndofVertex();

                    // clean line buffer, then start next buffer
                    if (lineBuffer.Count > 1)
                    {
                        // add previous line shape
                        LineShape lineShape = new LineShape(new Collection <Vertex>(lineBuffer), width, color);
                        shapes.Add(lineShape);

                        lineBuffer.Clear();
                        lineBuffer.Add(new Vertex(startVertex.X, startVertex.Y));
                    }

                    // add angle shape
                    shapes.Add(shape);
                }
            }

            // clean line buffer, then start next buffer
            if (lineBuffer.Count > 1)
            {
                // add last line shape
                LineShape lineShape = new LineShape(new Collection <Vertex>(lineBuffer), width, color);
                shapes.Add(lineShape);
            }

            return(shapes);
        }
        public void Clear(RGBColor backgroundColor)
        {
            Color color = Color.FromArgb(backgroundColor.R, backgroundColor.G, backgroundColor.B);

            graphics.Clear(color);
        }