Rectangle GetUpdatedRegionAndCleanUpAffectedObjects()
        {
            Rectangle rect = Rectangle.CreateAnEmptyBox();
            var       affectedObjectList = new List <IViewerObject>(CurrentUndoAction.AffectedObjects);

            foreach (var ivObj in affectedObjectList)
            {
                var inode = ivObj as IViewerNode;
                if (inode == null)
                {
                    continue;
                }
                var             node           = (GeomNode)inode.DrawingObject.GeometryObject;
                NodeRestoreData nrd            = (NodeRestoreData)CurrentUndoAction.GetRestoreData(node);
                var             oldBoundingBox = nrd.BoundaryCurve.BoundingBox;
                if (!oldBoundingBox.Equals(node.BoundingBox))
                {
                    rect.Add(node.BoundingBox);
                    rect.Add(oldBoundingBox);
                }
                else
                {
                    CurrentUndoAction.RemoveAffectedObject(ivObj);
                }
            }

            foreach (var e in edgesDraggedWithSource.Concat(edgesDraggedWithTarget))
            {
                rect.Add(e.BoundingBox);
            }

            rect.Pad(layoutSettings.EdgeRoutingSettings.Padding);
            return(rect);
        }
        /// <summary>
        /// creates a "tight" bounding box
        /// </summary>
        /// <param name="affectedEntity">the object corresponding to the graph</param>
        /// <param name="geometryGraph"></param>
        public void FitGraphBoundingBox(object affectedEntity, GeometryGraph geometryGraph)
        {
            if (geometryGraph != null)
            {
                UndoRedoAction uAction = new UndoRedoAction(geometryGraph);
                uAction.Graph = geometryGraph;
                undoRedoActionsList.AddAction(uAction);
                Rectangle r = new Rectangle();
                foreach (GeomNode n in geometryGraph.NodeMap.Values)
                {
                    r = n.BoundingBox; break;
                }
                foreach (GeomNode n in geometryGraph.NodeMap.Values)
                {
                    r.Add(n.BoundingBox);
                }
                foreach (GeomEdge e in geometryGraph.Edges)
                {
                    r.Add(e.BoundingBox);
                    if (e.Label != null)
                    {
                        r.Add(e.Label.BoundingBox);
                    }
                }


                r.Left   -= geometryGraph.Margins;
                r.Top    += geometryGraph.Margins;
                r.Bottom -= geometryGraph.Margins;
                r.Right  += geometryGraph.Margins;
                uAction.AffectedObjects = new Set <object>();
                uAction.AffectedObjects.Insert(affectedEntity);
                uAction.GraphBoundingBoxAfter = geometryGraph.BoundingBox = r;
            }
        }
        /// <summary>
        /// displays the database
        /// </summary>
        /// <param name="db"></param>
        /// <param name="curves"></param>
        public static void ShowDataBase(Database db, params ICurve[] curves)
        {
            var g = new Graph("");

            AllocateDebugCurves(g);

            var graphBox = new Rectangle(db.Anchors[0].LeftTop);

            var cl = new List <ICurve>(curves);

            foreach (Anchor a in db.Anchors)
            {
                graphBox.Add(a.LeftTop);
                graphBox.Add(a.RightBottom);
                cl.Add(a.PolygonalBoundary);
            }

            AddCurvesToGraph(cl, g);

            Point del = (graphBox.LeftBottom - graphBox.RightTop) / 10;

            graphBox.Add(graphBox.LeftBottom + del);
            graphBox.Add(graphBox.RightTop - del);
            var gg = new GeometryGraph {
                BoundingBox = graphBox
            };

            g.DataBase      = db;
            g.GeometryGraph = gg;

            DisplayGraph(g, new Form());
            db.nodesToShow = null;
        }
示例#4
0
        static void Main(string[] args)
        {
            // used for announcements from top to bottom or drawing
            // check it visually, shows Composite pattern really well
            IComponent page = new Component(new Position(0, 0));

            page.Add(new Rectangle(new Position(0, 1), 7));
            //page.Add(new Rectangle(new Position(5, 10), 6));
            IComponent rec = new Rectangle(new Position(5, 10), 3);

            rec.Add(new Text(new Position(12, 0), 0, "I cannot lie"));
            rec.Add(new Text(new Position(13, 6), 1, "Rigmarole"));
            rec.Add(new Text(new Position(22, 9), 3, "Hodgepodge"));
            page.Add(rec);

            page.Draw();

            while (true)
            {
                Position movePosition = new Position(3, 1);
                Console.Clear();
                rec.Move(movePosition);
                //rec.Draw();
                page.Draw();
                Thread.Sleep(500);
            }

            //Rectangle rec = new Rectangle(new Position(8, 1), 5);
            //rec.Draw();
        }
示例#5
0
        /// <summary>
        /// enlarge the rectangle to contain the graph
        /// </summary>
        /// <param name="b"></param>
        void PumpTheBoxToTheGraph(ref Rectangle b)
        {
            foreach (Edge e in Edges)
            {
                if (e.UnderCollapsedCluster())
                {
                    continue;
                }
                if (e.Curve != null)
                {
#if SHARPKIT //https://code.google.com/p/sharpkit/issues/detail?id=369 there are no structs in js
                    var cb = e.Curve.BoundingBox.Clone();
#else
                    var cb = e.Curve.BoundingBox;
#endif
                    cb.Pad(e.LineWidth);
                    b.Add(cb);
                }

                foreach (var l in e.Labels.Where(lbl => lbl != null))
                {
                    b.Add(l.BoundingBox);
                }
            }

            foreach (Node n in Nodes)
            {
                if (n.UnderCollapsedCluster())
                {
                    continue;
                }
                b.Add(n.BoundingBox);
            }


            foreach (var c in RootCluster.Clusters)
            {
                if (c.BoundaryCurve == null)
                {
                    if (c.RectangularBoundary != null)
                    {
                        c.BoundaryCurve = c.RectangularBoundary.RectangularHull();
                    }
                }
                if (c.BoundaryCurve != null)
                {
                    b.Add(c.BoundaryCurve.BoundingBox);
                }
            }
#if DEBUG && TEST_MSAGL
            if (DebugCurves != null)
            {
                foreach (var debugCurve in DebugCurves.Where(d => d.Curve != null))
                {
                    b.Add(debugCurve.Curve.BoundingBox);
                }
            }
            #endif
        }
        Rectangle TriangleRectangle(ThreeArray <CdtSite> sites)
        {
            var rect = new Rectangle(sites[0].Point);

            rect.Add(sites[1].Point);
            rect.Add(sites[2].Point);
            return(rect);
        }
示例#7
0
        /// <summary>
        /// enlarge the rectangle to contain the graph
        /// </summary>
        /// <param name="b"></param>
        void PumpTheBoxToTheGraph(ref Rectangle b)
        {
            foreach (Edge e in Edges)
            {
                if (e.UnderCollapsedCluster())
                {
                    continue;
                }
                if (e.Curve != null)
                {
                    var cb = e.Curve.BoundingBox;
                    cb.Pad(e.LineWidth);
                    b.Add(cb);
                }

                foreach (var l in e.Labels.Where(lbl => lbl != null))
                {
                    b.Add(l.BoundingBox);
                }
            }

            foreach (Node n in Nodes)
            {
                if (n.UnderCollapsedCluster())
                {
                    continue;
                }
                b.Add(n.BoundingBox);
            }


            foreach (var c in RootCluster.Clusters)
            {
                if (c.BoundaryCurve == null)
                {
                    if (c.RectangularBoundary != null)
                    {
                        c.BoundaryCurve = c.RectangularBoundary.RectangularHull();
                    }
                }
                if (c.BoundaryCurve != null)
                {
                    b.Add(c.BoundaryCurve.BoundingBox);
                }
            }
#if DEBUG && TEST_MSAGL
            if (DebugCurves != null)
            {
                foreach (var debugCurve in DebugCurves.Where(d => d.Curve != null))
                {
                    b.Add(debugCurve.Curve.BoundingBox);
                }
            }
#endif
        }
示例#8
0
        public override void Enlarge(Rectangle r)
        {
            r.Add((int)(_x0 + 0.5), (int)(_y0 + 0.5));
            double t = -_xcoeff1 / (2 * _xcoeff2);

            if (t > 0 && t < 1)
            {
                r.Add((int)(XforT(t) + .5), (int)(YforT(t) + .5));
            }
            r.Add((int)(_x1 + 0.5), (int)(_y1 + 0.5));
        }
示例#9
0
        public void TestVoidFunctions()
        {
            Shape myRectangle = new Rectangle("Rectangle1", "Fusion Blue", 0, 0, 0, 1, 1, 1, 1, 0);
            Shape p1          = new Point("Point1", "Red", 1, 2);
            Shape p2          = new Point("Point2", "Blue", 3, 4);

            myRectangle.Add(p1);
            myRectangle.Add(p2);
            myRectangle.Remove(p1);
            myRectangle.Remove(p2);
        }
示例#10
0
 internal void AddEntry(Rectangle r, int id)
 {
     ids[entryCount]     = id;
     entries[entryCount] = r.Copy();
     entryCount++;
     if (mbr == null)
     {
         mbr = r.Copy();
     }
     else
     {
         mbr.Add(r);
     }
 }
示例#11
0
        void AddArrowToBox(Point start, Point end, double width, ref Rectangle box)
        {
            //it does not hurt to add a larger piece
            Point dir = (end - start).Rotate(Math.PI / 2);

            box.Add(end + dir);
            box.Add(end - dir);
            box.Add(start + dir);
            box.Add(start - dir);

            box.Left   -= width;
            box.Top    += width;
            box.Right  += width;
            box.Bottom -= width;
        }
        public Rectangle GetInitialBoundingBox()
        {
            Rectangle bbox = new Rectangle();

            bbox.SetToEmpty();
            foreach (var rect in fixedRectangles)
            {
                bbox.Add(rect);
            }
            foreach (var rect in moveableRectangles)
            {
                bbox.Add(rect);
            }
            return(bbox);
        }
示例#13
0
        public ProgramGrid Analyze()
        {
            var rect = new Rectangle(InstructionGridLeft, Capture.Rect.Height - InstructionGridHeight - InstructionGridBottomMargin,
                                     Capture.Rect.Width - InstructionGridLeft - InstructionGridRightMargin, InstructionGridHeight);

            return(new ProgramGrid(rect.Add(Capture.Rect.Location)));
        }
示例#14
0
 public override void ModifyDamageHitbox(ref Rectangle hitbox)
 {
     if (projectile.aiStyle == 0)
     {
         hitbox = hitbox.Add(new Vector2(0, -1.5f).RotatedBy(projectile.rotation) * (-34 - drawOffsetY));
     }
 }
示例#15
0
 void AddLabelBox(ref Rectangle box)
 {
     if (Label != null && DGraph.DLabelIsValid(Label))
     {
         box.Add(Label.DrawingLabel.BoundingBox);
     }
 }
示例#16
0
    /// <summary>
    /// Entry point: execution starts here
    /// </summary>
    static void xMain()
    {
        // instantiate a new Rectangle struct
        // where Width is set to 1 and Height is set to 3
        Rectangle rect1 = new Rectangle();

        rect1.Width  = 1;
        rect1.Height = 3;

        // show the value of Width and Height for rect1
        Console.WriteLine("rect1: {0}:{1}", rect1.Width, rect1.Height);

        // instantiate a new Rectangle struct
        // where Width is set to 5 and Height is set to 7
        Rectangle rect2 = new Rectangle(5, 7);

        // show the value of Width and Height for rect2
        Console.WriteLine("rect2: {0}:{1}", rect2.Width, rect2.Height);


        // invoke the Add method on the rect1 Rectangle struct instance,
        // passing the rect2 Rectangle struct instance as an argument
        // and assigning the new copy of the value returned by the
        // Add method to the rect3 Rectangle struct.
        Rectangle rect3 = rect1.Add(rect2);

        // show the value of Width and Height for rect3
        Console.WriteLine("rect3: {0}:{1}", rect3.Width, rect3.Height);

        Console.ReadKey();
    }
示例#17
0
        public UserInterlfaceContainer CreateInfoPannel(Selector selector, Shape bounds)
        {
            UserInterlfaceContainer ui = new UserInterlfaceContainer(selector, true);

            GameObject pannel = CreatePanel(bounds);

            ui.Add(pannel);

            Point2D   startLocation = bounds.Copy().Add(Settings.PORTRAT_SPACING);
            Rectangle portratBounds = new Rectangle(startLocation, Settings.PORTRAT_SIZE, Settings.PORTRAT_SIZE);

            foreach (GameObject i in selector.GameObjects)
            {
                ui.Add(CreatePortart(selector, i, portratBounds.Copy()));

                portratBounds.Add(new Point2D(portratBounds.Size + Settings.PORTRAT_SPACING, 0));

                if (!CollsionDetector.Inside(portratBounds, bounds.HitBox))
                {
                    portratBounds.X  = startLocation.X;
                    portratBounds.Y += portratBounds.Height + Settings.PORTRAT_SPACING;
                }

                if (!CollsionDetector.Inside(portratBounds, bounds.HitBox))
                {
                    break;
                }
            }

            return(ui);
        }
示例#18
0
        public HexGrid Analyze()
        {
            var rect      = new Rectangle(ScreenLayout.SidebarWidth, 0, Capture.Bitmap.Width - ScreenLayout.SidebarWidth, Capture.Bitmap.Height - InstructionAreaOuterHeight);
            var centerHex = FindApproximateCenterHex(rect);

            return(new HexGrid(rect.Add(Capture.Rect.Location), centerHex.Add(Capture.Rect.Location)));
        }
        internal Rectangle BoundingBox()
        {
            Rectangle rect = new Rectangle(Sites[0].Point, Sites[1].Point);

            rect.Add(Sites[2].Point);
            return(rect);
        }
示例#20
0
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                var applicationView = ApplicationView.GetForCurrentView();
                applicationView.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
                var statusbar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
                statusbar.BackgroundColor   = Colors.Beige;
                statusbar.BackgroundOpacity = 0.2;
                statusbar.ForegroundColor   = Colors.Black;
                applicationView.TryEnterFullScreenMode();
            }

            var s = ViewModel.Solid;
            var c = 0;
            var r = 0;
            var w = ViewModel.Width;

            foreach (var temp in s)
            {
                Rectangle.Add(new Rect()
                {
                    X      = w * c,
                    Y      = w * r,
                    Width  = w,
                    Height = w,
                });
                c++;
                if (c == ViewModel.Col)
                {
                    c = 0;
                    r++;
                }
            }
        }
示例#21
0
        public void FullScanWindow()
        {
            using (var integerMap = new IntegerMap(windowBitmap))
            {
                var gridIcons     = gridScanner.FullScan(integerMap).ToArray();
                var gridLeft      = gridIcons.Min(t => t.Item1.X);
                var gridRight     = gridIcons.Max(t => t.Item1.X + t.Item2.IntegerMap.Size.Width - 1);
                var gridTop       = gridIcons.Min(t => t.Item1.Y);
                var gridBottom    = gridIcons.Max(t => t.Item1.Y + t.Item2.IntegerMap.Size.Height - 1);
                var gridRectangle = new Rectangle(gridLeft, gridTop, gridRight - gridLeft + 1, gridBottom - gridTop + 1);
                GridRectangle = gridRectangle.Add(WindowRectangle.Location);

                var gridCountX = GridRectangle.Width / Icons.Icon.RawGrid.IntegerMap.Size.Width;
                var gridCountY = GridRectangle.Height / Icons.Icon.RawGrid.IntegerMap.Size.Height;
                Grids = new Grid[gridCountX, gridCountY];
                QuickScanGrids();

                var faceIcons     = faceScanner.FullScan(integerMap).ToArray();
                var faceIcon      = faceIcons.Single();
                var faceRectangle = new Rectangle(faceIcon.Item1, faceIcon.Item2.IntegerMap.Size);
                FaceRectangle = faceRectangle.Add(WindowRectangle.Location);
                QuickScanFace();

                var scoreIcons          = bombCountScanner.FullScan(integerMap).ToArray();
                var bombCountIcons      = scoreIcons.Where(t => t.Item1.X < integerMap.Size.Width / 2).OrderBy(t => t.Item1.X);
                var bombCountRectangles = bombCountIcons.Select(t => new Rectangle(t.Item1, t.Item2.IntegerMap.Size));
                BombCountRectangles = bombCountRectangles.Select(t => t.Add(WindowRectangle.Location)).ToArray();
                QuickScanBombCount();
            }
        }
示例#22
0
        protected override void Paint(SpriteBatch spriteBatch, Rectangle bounds)
        {
            var tooltipBack = Content.GetTexture("tooltip");

            spriteBatch.Draw(tooltipBack, bounds.Add(0, 0, -3, -3), new Rectangle(0, 0, this.Width - 3, this.Height - 3), Color.White);
            spriteBatch.Draw(tooltipBack, new Rectangle(bounds.Right - 3, bounds.Top, 3, bounds.Height), new Rectangle(0, 3, 3, this.Height - 3), Color.White);
            spriteBatch.Draw(tooltipBack, new Rectangle(bounds.Left, bounds.Bottom - 3, bounds.Width, 3), new Rectangle(3, 0, this.Width - 6, 3), Color.White);
        }
示例#23
0
        public override void Enlarge(Rectangle r)
        {
            r.Add((int)(_x0 + .5),
                  (int)(_y0 + .5));
            double[] eqn      = { _xcoeff1, 2 * _xcoeff2, 3 * _xcoeff3 };
            int      numroots = QuadCurve.SolveQuadratic(eqn, eqn);

            for (int i = 0; i < numroots; i++)
            {
                double t = eqn[i];
                if (t > 0 && t < 1)
                {
                    r.Add((int)(XforT(t) + .5), (int)(YforT(t) + .5));
                }
            }
            r.Add((int)(_x1 + .5), (int)(_y1 + .5));
        }
示例#24
0
 internal PreGraph(EdgeGeometry[] egs, Set <ICurve> nodeBoundaries)
 {
     edgeGeometries      = new List <EdgeGeometry>(egs);
     this.nodeBoundaries = new Set <ICurve>(nodeBoundaries);
     boundingBox         = Rectangle.CreateAnEmptyBox();
     foreach (var curve in nodeBoundaries)
     {
         boundingBox.Add(curve.BoundingBox);
     }
 }
示例#25
0
        /// <summary>
        /// Metoda vrátí absolutní souřadnice prostoru, který je zadán jako relativní souřadnice v daném containeru.
        /// Pokud tedy například daný container je umístěn na (absolutní) souřadnici Bounds = { 100,20,200,50 }, a dané relativní souřadnice jsou { 5,5,10,10 },
        /// pak výsledné absolutní souřadnice jsou { 105,25,10,10 }.
        /// </summary>
        /// <param name="container"></param>
        /// <param name="relativeBounds"></param>
        /// <param name="currentLayer">Vrstva, jejíž souřadnice řešíme. Každý prvek může mít souřadnice různé podle toho, o kterou vrstvu se jedná.
        /// To je důsledek procesu Drag and Drop, kdy ve standardní vrstvě se prvek nachází na výchozích souřadnicích Bounds,
        /// ale ve vrstvě <see cref="GInteractiveDrawLayer.Interactive"/> je na souřadnicích Drag.</param>
        /// <returns></returns>
        public static Rectangle GetAbsoluteBoundsInContainer(IInteractiveParent container, Rectangle relativeBounds, GInteractiveDrawLayer currentLayer)
        {
            if (container == null)
            {
                return(relativeBounds);
            }
            BoundsInfo boundsInfo = BoundsInfo.CreateForContainer(container, currentLayer);

            return(relativeBounds.Add(boundsInfo.AbsolutePhysicalOriginPoint));
        }
示例#26
0
        protected override void Paint(SpriteBatch spriteBatch, Rectangle bounds)
        {
            int VertOffset = 0;
            int HorzOffset = 0;

            if (this.HasDropdown)
            {
                if (this.Direction == SkillBoxDirection.Up)
                {
                    VertOffset = this.BoxScale == SkillBoxSize.Normal ? ARROW_DIMENSIONATSCALE_NORMAL : ARROW_DIMENSIONATSCALE_SMALL;
                }
                else if (this.Direction == SkillBoxDirection.Left)
                {
                    HorzOffset = this.BoxScale == SkillBoxSize.Normal ? ARROW_DIMENSIONATSCALE_NORMAL : ARROW_DIMENSIONATSCALE_SMALL;
                }
            }

            var primaryTileBounds = new Rectangle(HorzOffset, VertOffset, BOX_DIMENSIONSATSCALE_NORMAL, BOX_DIMENSIONSATSCALE_NORMAL).OffsetBy(bounds.Location);

            if (!animPulseLoad.Active)
            {
                spriteBatch.Draw(ControlAtlas.GetRegion("skillbox/sb-blank"), primaryTileBounds.OffsetBy(bounds.Location), Color.White);
            }

            if (this.Icon != null)
            {
                if (animFlipIcon == null)
                {
                    spriteBatch.Draw(this.Icon, primaryTileBounds.OffsetBy(bounds.Location), new Rectangle(16, 16, 96, 96), Color.White);
                }
                else
                {
                    spriteBatch.Draw(this.Icon, primaryTileBounds.Add(0, animFlipIcon.CurrentValueInt / 2, 0, Math.Max(-animFlipIcon.CurrentValueInt, -primaryTileBounds.Height + 1)).OffsetBy(bounds.Location), new Rectangle(16, 16, 96, 96), Color.White);
                }
            }
            else
            {
                spriteBatch.Draw(ControlAtlas.GetRegion("skillbox/sb-blank"), primaryTileBounds.OffsetBy(bounds.Location), Color.White);
            }

            if (animPulseLoad.Active)
            {
                spriteBatch.Draw(ControlAtlas.GetRegion($"skillbox/sb-anim1-f{animPulseLoad.CurrentValueInt}"), primaryTileBounds.OffsetBy(bounds.Location), Color.White);
            }

            spriteBatch.Draw(ControlAtlas.GetRegion("skillbox/sb-outline"), primaryTileBounds.OffsetBy(bounds.Location), Color.White);

            if (this.MouseOver)
            {
                spriteBatch.Draw(ControlAtlas.GetRegion("skillbox/sb-hover"), primaryTileBounds.OffsetBy(bounds.Location), Color.White);
            }

            //if (this.Dropped && Items.Count == 0)
            //    spriteBatch.Draw(controlAtlas.GetRegion("skillbox/sb-close"), primaryTileBounds, Color.White * (this.MouseOver ? 0.8f : 1f));
        }
        public Rectangle GetBoundingBox(IEnumerable <TreeNode> nodes)
        {
            Rectangle bbox = new Rectangle();

            bbox.SetToEmpty();
            foreach (var node in nodes)
            {
                bbox.Add(node.rect);
            }
            return(bbox);
        }
        /// <summary>
        ///     creates a "tight" bounding box
        /// </summary>
        /// <param name="affectedEntity">the object corresponding to the graph</param>
        /// <param name="geometryGraph"></param>
        public void FitGraphBoundingBox(IViewerObject affectedEntity, GeometryGraph geometryGraph)
        {
            if (geometryGraph != null)
            {
                var uAction = new UndoRedoAction(geometryGraph)
                {
                    Graph = geometryGraph
                };
                UndoRedoActionsList.AddAction(uAction);
                var r = new Rectangle();
                foreach (GeomNode n in geometryGraph.Nodes)
                {
                    r = n.BoundingBox;
                    break;
                }
                foreach (GeomNode n in geometryGraph.Nodes)
                {
                    r.Add(n.BoundingBox);
                }
                foreach (GeomEdge e in geometryGraph.Edges)
                {
                    r.Add(e.BoundingBox);
                    if (e.Label != null)
                    {
                        r.Add(e.Label.BoundingBox);
                    }
                }


                r.Left   -= geometryGraph.Margins;
                r.Top    += geometryGraph.Margins;
                r.Bottom -= geometryGraph.Margins;
                r.Right  += geometryGraph.Margins;
                uAction.ClearAffectedObjects();
                uAction.AddAffectedObject(affectedEntity);
                uAction.GraphBoundingBoxAfter = geometryGraph.BoundingBox = r;
            }
        }
示例#29
0
        void Init()
        {
            boundingBox = new Rectangle(StartPoint.Point);
            count       = 1;
            foreach (Point p in this.Skip(1))
            {
                boundingBox.Add(p);
                count++;
            }

            CalculatePbNode();

            NeedToInit = false;
        }
示例#30
0
 void CreateAndIndexBoundingBox()
 {
     _boundingBox = Rectangle.CreateAnEmptyBox();
     foreach (var p in _pointsToIndices.Keys)
     {
         _boundingBox.Add(p);
     }
     _boundingBox.Pad(1);
     IndexAPoint(_boundingBox.LeftBottom);
     IndexAPoint(_boundingBox.RightBottom);
     IndexAPoint(_boundingBox.LeftTop);
     IndexAPoint(_boundingBox.RightTop);
     //SplineRouter.ShowVisGraph(_visGraph, null, new[] { _boundingBox.Perimeter() }, null);
 }
示例#31
0
 public override void Enlarge(Rectangle r)
 {
     r.Add((int)(_x + 0.5), (int)(_y + 0.5));
 }
        void SetBoundingBox() {
            if (ApproximateComparer.Close(ParStart, 0) && ApproximateComparer.Close(ParEnd, Math.PI * 2))
                box = FullBox();
            else {
                //the idea is that the box of an arc staying in one quadrant is just the box of the start and the end point of the arc
                box = new Rectangle(Start, End);
                //now Start and End are in the box, we need just add all k*P/2 that are in between
                double t;
                for (int i = (int)Math.Ceiling(ParStart / (Math.PI / 2)); (t = i * Math.PI / 2) < ParEnd; i++)
                    if (t > parStart) 
                        box.Add(this[t]);

            }
        }