當前位置: 首頁>>代碼示例>>C#>>正文


C# Geometry.Rectangle類代碼示例

本文整理匯總了C#中Microsoft.Msagl.Core.Geometry.Rectangle的典型用法代碼示例。如果您正苦於以下問題:C# Rectangle類的具體用法?C# Rectangle怎麽用?C# Rectangle使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Rectangle類屬於Microsoft.Msagl.Core.Geometry命名空間,在下文中一共展示了Rectangle類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: MinimumSizeIsRespected

        public void MinimumSizeIsRespected()
        {
            // Setup
            string filePath = Path.Combine(this.TestContext.TestDir, "Out\\Dots", "chat.dot");
            GeometryGraph graph = this.LoadGraph(filePath);

            const double DesiredHeight = 100000;
            const double DesiredWidth = 100000;

            SugiyamaLayoutSettings settings = new SugiyamaLayoutSettings();
            settings.MinimalHeight = DesiredHeight;
            settings.MinimalWidth = DesiredWidth;
            
            // Execute
            LayeredLayout layeredLayout = new LayeredLayout(graph, settings);
            layeredLayout.Run();

            // Verify the graph is the correct size
            Assert.IsTrue(DesiredHeight < graph.Height, "Graph height should be the minimal height.");
            Assert.IsTrue(DesiredWidth < graph.Width, "Graph width should be the minimal width.");

            // Verify the nodes were spread apart to fill the space
            Rectangle nodeBounds = new Rectangle(graph.Nodes.Select(n => n.BoundingBox));
            Assert.IsTrue(DesiredWidth < nodeBounds.Height, "The graph nodes weren't scaled vertically to fill the space.");
            Assert.IsTrue(DesiredWidth < nodeBounds.Width, "The graph nodes weren't scaled horizontally to fill the space.");
        }
開發者ID:WenzCao,項目名稱:automatic-graph-layout,代碼行數:26,代碼來源:MinimumWidthHeightTests.cs

示例2: PreGraph

 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);
 }
開發者ID:danielskowronski,項目名稱:network-max-flow-demo,代碼行數:7,代碼來源:PreGraph.cs

示例3: AddToAdjacentVertex

 internal void AddToAdjacentVertex(TransientGraphUtility transUtil
             , VisibilityVertex targetVertex, Directions dirToExtend, Rectangle limitRect) {
     if (!PointComparer.Equal(this.Point, targetVertex.Point)) {
         transUtil.FindOrAddEdge(this.Vertex, targetVertex, InitialWeight);
     }
     ExtendEdgeChain(transUtil, targetVertex, dirToExtend, limitRect);
 }
開發者ID:danielskowronski,項目名稱:network-max-flow-demo,代碼行數:7,代碼來源:FreePoint.cs

示例4: InteriorEdgeCrossesObstacle

 private bool InteriorEdgeCrossesObstacle(ObstacleTree obstacleTree) {
     // File Test: Nudger_Overlap4
     // Use the VisibilityBoundingBox for groups because those are what the tree consists of.
     var rect = new Rectangle(this.UnpaddedBorderIntersect, this.VisibilityBorderIntersect);
     return InteriorEdgeCrossesObstacle(rect, obs => obs.VisibilityPolyline,
             obstacleTree.Root.GetLeafRectangleNodesIntersectingRectangle(rect)
                 .Where(node => !node.UserData.IsGroup && (node.UserData != this.Obstacle)).Select(node => node.UserData));
 }
開發者ID:danielskowronski,項目名稱:network-max-flow-demo,代碼行數:8,代碼來源:ObstaclePortEntrance.cs

示例5: GridTraversal

 public GridTraversal(Rectangle boundingBox, int iLevel)
 {
     _boundingBox = boundingBox;
     _iLevel = iLevel;
     _numberOfTilesOnSide = (ulong)Math.Pow(2, iLevel);
     TileWidth = boundingBox.Width / _numberOfTilesOnSide;
     TileHeight = boundingBox.Height / _numberOfTilesOnSide;
 }
開發者ID:danielskowronski,項目名稱:network-max-flow-demo,代碼行數:8,代碼來源:GridTraversal.cs

示例6: CommonArea

 static double CommonArea(ref Rectangle a, ref Rectangle b)
 {
     double l = Math.Min(a.Left, b.Left);
     double r = Math.Max(a.Right, b.Right);
     double t = Math.Max(a.Top, b.Top);
     double bt = Math.Min(a.Bottom, b.Bottom);
     return (r - l) * (t - bt);
 }
開發者ID:mrkcass,項目名稱:SuffixTreeExplorer,代碼行數:8,代碼來源:LocationLabeler.cs

示例7: IntersectsOnY

        internal bool IntersectsOnY(Rectangle r){
            if (r.Bottom > top + ApproximateComparer.DistanceEpsilon)
                return false;

            if (r.Top < bottom - ApproximateComparer.DistanceEpsilon)
                return false;

            return true;
            //return ApproximateComparer.Compare(r.bottom, top) <= 0 && ApproximateComparer.Compare(bottom, r.top) <= 0;
        }
開發者ID:danielskowronski,項目名稱:network-max-flow-demo,代碼行數:10,代碼來源:Rectangle.cs

示例8: Area

        /// <summary>
        /// Additionally needed area of nodes compared to the optimal packing of the nodes.
        /// </summary>
        /// <param name="graphOriginal"></param>
        /// <param name="graphNew"></param>
        /// <returns></returns>
        public static Tuple<String, double> Area(GeometryGraph graph)
        {
            double minimalArea = graph.Nodes.Sum(v => v.BoundingBox.Area);

            Rectangle boundingBoxNew=new Rectangle(graph.Nodes.Select(v=>v.BoundingBox));
            double areaNew = boundingBoxNew.Area;

            double ratio = areaNew/minimalArea;
            //            return Tuple.Create("AreaIncreaseToMinPacking",ratio - 1);//we are interested in increase compared to optimal packing.
            return Tuple.Create("AreaAbsolute/(1E6)", areaNew / (1E6));//we are interested in increase compared to optimal packing.
        }
開發者ID:mrkcass,項目名稱:SuffixTreeExplorer,代碼行數:17,代碼來源:Statistics.cs

示例9: GetInitialBoundingBox

 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;
 }
開發者ID:danielskowronski,項目名稱:network-max-flow-demo,代碼行數:11,代碼來源:OverlapRemovalFixedSegmentsBitmap.cs

示例10: IntersectsOnX

        internal bool IntersectsOnX(Rectangle r){
            //return ApproximateComparer.Compare(r.left, right) <= 0 && ApproximateComparer.Compare(left, r.right) <= 0;
            if (r.Left > right + ApproximateComparer.DistanceEpsilon)
                return false;

            if (r.Right < left - ApproximateComparer.DistanceEpsilon)
                return false;

            return true;

            //return ApproximateComparer.Compare(r.left, right) <= 0 && ApproximateComparer.Compare(left, r.right) <= 0;
        }
開發者ID:danielskowronski,項目名稱:network-max-flow-demo,代碼行數:12,代碼來源:Rectangle.cs

示例11: AddEdgeToAdjacentEdge

 // Adds an edge from this.Vertex to a (possibly new) vertex at an intersection with an
 // existing Edge that adjoins the point.  We take 'dir' as an input parameter for edge
 // extension because we may be on the edge so can't calculate the direction.
 internal VisibilityVertex AddEdgeToAdjacentEdge(TransientGraphUtility transUtil
             , VisibilityEdge targetEdge, Directions dirToExtend, Rectangle limitRect) {
     Point targetIntersect = StaticGraphUtility.SegmentIntersection(targetEdge, this.Point);
     VisibilityVertex targetVertex = transUtil.VisGraph.FindVertex(targetIntersect);
     if (null != targetVertex) {
         AddToAdjacentVertex(transUtil, targetVertex, dirToExtend, limitRect);
     }
     else {
         targetVertex = transUtil.AddEdgeToTargetEdge(this.Vertex, targetEdge, targetIntersect);
     }
     ExtendEdgeChain(transUtil, targetVertex, dirToExtend, limitRect);
     return targetVertex;
 }
開發者ID:danielskowronski,項目名稱:network-max-flow-demo,代碼行數:16,代碼來源:FreePoint.cs

示例12: OverlapRemovalFixedSegmentsBitmap

        public OverlapRemovalFixedSegmentsBitmap(Rectangle[] moveableRectangles, Rectangle[] fixedRectangles,
            SymmetricSegment[] fixedSegments) {
            _moveableRectangles = moveableRectangles;
            _fixedRectangles = fixedRectangles;
            _fixedSegments = fixedSegments;

            _bbox = GetInitialBoundingBox();
            _bbox.ScaleAroundCenter(1.25);

            InitBitmap();
            InitTransform();
            
            movedRectangles = new Rectangle[moveableRectangles.Length];
        }
開發者ID:danielskowronski,項目名稱:network-max-flow-demo,代碼行數:14,代碼來源:OverlapRemovalFixedSegmentsBitmap.cs

示例13: Intersection

 /// <summary>
 /// intersection (possibly empty) of rectangles
 /// </summary>
 /// <param name="rectangle"></param>
 /// <returns></returns>
 public Rectangle Intersection(Rectangle rectangle)
 {
     Rectangle intersection = new Rectangle();
     if (!Intersects(rectangle))
     {
         intersection.SetToEmpty();
         return intersection;
     }
     double l = Math.Max(Left, rectangle.Left);
     double r = Math.Min(Right, rectangle.Right);
     double b = Math.Max(Bottom, rectangle.Bottom);
     double t = Math.Min(Top, rectangle.Top);
     return new Rectangle(l,b,r,t);
 }
開發者ID:danielskowronski,項目名稱:network-max-flow-demo,代碼行數:19,代碼來源:Rectangle.cs

示例14: PlaceNodesOnly

        public void PlaceNodesOnly(Rectangle bbox)
        {
            BoundingBox = bbox;
            int numInserted = 0;
            int level = 1;
            int iLevel = 0;

            while (numInserted < SortedLgNodeInfos.Count && level <= MaxLevel) {
                numInserted = DrawNodesOnlyOnLevel(level, numInserted);
                AddAllToNodeLevel(iLevel);
                level *= 2;
                iLevel++;
            }
        }
開發者ID:danielskowronski,項目名稱:network-max-flow-demo,代碼行數:14,代碼來源:GreedyNodeRailLevelCalculator.cs

示例15: AddVoronoiCite

        void AddVoronoiCite(CdtTriangle triangle)
        {
            Point p;
            var goodTriangle = GetCenterOfDescribedCircle(triangle, out p);
            if (!goodTriangle)
                return;
            if (!BoundingBox.Contains(p))
                return;
            var rect=new Rectangle(p);
            rect.Pad(eps);
            if (voronoiSiteTree.GetAllIntersecting(rect).Count() > 0)
                return;

            voronoiSiteTree.Add(rect, p);
        }
開發者ID:WenzCao,項目名稱:automatic-graph-layout,代碼行數:15,代碼來源:Program.cs


注:本文中的Microsoft.Msagl.Core.Geometry.Rectangle類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。