Exemplo n.º 1
0
        // This draws a point at a specific location
        override public bool DrawPointAt(Vector2D pos, bool stitch, bool stitchline)
        {
            if (pos.x < General.Map.Config.LeftBoundary || pos.x > General.Map.Config.RightBoundary ||
                pos.y > General.Map.Config.TopBoundary || pos.y < General.Map.Config.BottomBoundary)
            {
                return(false);
            }

            DrawnVertex newpoint = new DrawnVertex {
                pos = pos, stitch = true, stitchline = stitchline
            };

            points.Add(newpoint);

            if (points.Count == 1)
            {
                // Add labels
                labels.AddRange(new[] { new LineLengthLabel(false, true), new LineLengthLabel(false, true), new LineLengthLabel(false, true), new LineLengthLabel(false, true) });
                hintlabel = new HintLabel(General.Colors.InfoLine);
                Update();
            }
            else if (points[0].pos == points[1].pos)
            {
                // Nothing is drawn
                FinishDraw();
            }
            else
            {
                // Handle the case when start point is not on current grid.
                Vector2D gridoffset = General.Map.Grid.SnappedToGrid(points[0].pos) - points[0].pos;
                newpoint = GetCurrentPosition(mousemappos + gridoffset, snaptonearest, snaptogrid, snaptocardinaldirection, usefourcardinaldirections, renderer, new List <DrawnVertex> {
                    points[0]
                });
                newpoint.pos -= gridoffset;

                // Create vertices for final shape.
                UpdateReferencePoints(points[0], newpoint);
                List <Vector2D[]> shapes = GetShapes(start, end);

                foreach (Vector2D[] shape in shapes)
                {
                    DrawnVertex[] verts = new DrawnVertex[shape.Length];
                    for (int i = 0; i < shape.Length; i++)
                    {
                        newpoint = new DrawnVertex {
                            pos = shape[i], stitch = true, stitchline = stitchline
                        };
                        verts[i] = newpoint;
                    }

                    gridpoints.Add(verts);
                }

                FinishDraw();
            }
            return(true);
        }
Exemplo n.º 2
0
        // Constructor
        public CurveLinedefsMode()
        {
            // Make collections by selection
            selectedlines   = General.Map.Map.GetSelectedLinedefs(true);
            unselectedlines = General.Map.Map.GetSelectedLinedefs(false);
            curves          = new Dictionary <Linedef, List <Vector2D> >(selectedlines.Count); //mxd

            //mxd. UI
            panel     = new CurveLinedefsOptionsPanel();
            hintlabel = new HintLabel(General.Colors.InfoLine);
        }
Exemplo n.º 3
0
        // This draws a point at a specific location
        override public bool DrawPointAt(Vector2D pos, bool stitch, bool stitchline)
        {
            if (pos.x < General.Map.Config.LeftBoundary || pos.x > General.Map.Config.RightBoundary ||
                pos.y > General.Map.Config.TopBoundary || pos.y < General.Map.Config.BottomBoundary)
            {
                return(false);
            }

            DrawnVertex newpoint = new DrawnVertex();

            newpoint.pos        = pos.GetRotated(-General.Map.Grid.GridRotate);
            newpoint.stitch     = true;         //stitch
            newpoint.stitchline = stitchline;
            points.Add(newpoint);

            if (points.Count == 1)
            {
                // Add labels
                labels.AddRange(new[] { new LineLengthLabel(false, true), new LineLengthLabel(false, true), new LineLengthLabel(false, true), new LineLengthLabel(false, true) });
                hintlabel = new HintLabel(General.Colors.InfoLine);
                Update();
            }
            else if (points[0].pos == points[1].pos)
            {
                // Nothing is drawn
                FinishDraw();
            }
            else
            {
                // Create vertices for final shape.
                UpdateReferencePoints(points[0], newpoint);
                List <Vector2D[]> shapes = GetShapes(start, end);

                foreach (Vector2D[] shape in shapes)
                {
                    DrawnVertex[] verts = new DrawnVertex[shape.Length];
                    for (int i = 0; i < shape.Length; i++)
                    {
                        newpoint = new DrawnVertex {
                            pos        = shape[i].GetRotated(General.Map.Grid.GridRotate),                      // Take grid rotation into account
                            stitch     = true,
                            stitchline = stitchline
                        };
                        verts[i] = newpoint;
                    }

                    gridpoints.Add(verts);
                }

                FinishDraw();
            }
            return(true);
        }
        // This draws a point at a specific location
        override public bool DrawPointAt(Vector2D pos, bool stitch, bool stitchline)
        {
            if (pos.x < General.Map.Config.LeftBoundary || pos.x > General.Map.Config.RightBoundary ||
                pos.y > General.Map.Config.TopBoundary || pos.y < General.Map.Config.BottomBoundary)
            {
                return(false);
            }

            DrawnVertex newpoint = new DrawnVertex();

            newpoint.pos        = pos.GetRotated(-General.Map.Grid.GridRotate);
            newpoint.stitch     = true;         //stitch
            newpoint.stitchline = stitchline;
            points.Add(newpoint);

            if (points.Count == 1)             //add point and labels
            {
                labels.AddRange(new[] { new LineLengthLabel(false, true), new LineLengthLabel(false, true), new LineLengthLabel(false, true), new LineLengthLabel(false, true) });
                hintlabel = new HintLabel(General.Colors.InfoLine);
                Update();
            }
            else if (points[0].pos == points[1].pos)            //nothing is drawn
            {
                points = new List <DrawnVertex>();
                FinishDraw();
            }
            else
            {
                //create vertices for final shape.
                UpdateReferencePoints(points[0], newpoint);
                points = new List <DrawnVertex>();                //clear points
                Vector2D[] shape = GetShape(start, end);

                // Rotate the shape to fit the grid rotation
                for (int i = 0; i < shape.Length; i++)
                {
                    shape[i] = shape[i].GetRotated(General.Map.Grid.GridRotate);
                }

                // We don't want base.DrawPointAt to call Update() here, because it will mess labels[]
                // and trigger shape.Count number of display redraws...
                blockupdate = true;
                foreach (Vector2D t in shape)
                {
                    base.DrawPointAt(t, true, true);
                }
                blockupdate = false;

                FinishDraw();
            }
            return(true);
        }
Exemplo n.º 5
0
        // This draws a point at a specific location
        override public bool DrawPointAt(Vector2D pos, bool stitch, bool stitchline)
        {
            if (pos.x < General.Map.Config.LeftBoundary || pos.x > General.Map.Config.RightBoundary ||
                pos.y > General.Map.Config.TopBoundary || pos.y < General.Map.Config.BottomBoundary)
            {
                return(false);
            }

            DrawnVertex newpoint = new DrawnVertex();

            newpoint.pos        = pos;
            newpoint.stitch     = true;         //stitch
            newpoint.stitchline = stitchline;
            points.Add(newpoint);

            if (points.Count == 1)            //add point and labels
            {
                labels.AddRange(new[] { new LineLengthLabel(false, true), new LineLengthLabel(false, true), new LineLengthLabel(false, true), new LineLengthLabel(false, true) });
                hintlabel = new HintLabel(General.Colors.InfoLine);
                Update();
            }
            else if (points[0].pos == points[1].pos)            //nothing is drawn
            {
                points = new List <DrawnVertex>();
                FinishDraw();
            }
            else
            {
                //create vertices for final shape.
                UpdateReferencePoints(points[0], newpoint);
                points = new List <DrawnVertex>();                //clear points
                Vector2D[] shape = GetShape(start, end);

                foreach (Vector2D t in shape)
                {
                    base.DrawPointAt(t, true, true);
                }

                FinishDraw();
            }
            return(true);
        }
Exemplo n.º 6
0
 public DrawCurveMode()
 {
     hintlabel      = new HintLabel(General.Colors.InfoLine);
     labeluseoffset = false;
 }