コード例 #1
0
ファイル: GViewer.cs プロジェクト: mrkcass/SuffixTreeExplorer
        static Core.Geometry.Rectangle BBoxOfObjs(IEnumerable<object> objs)
        {
            var bb = new Core.Geometry.Rectangle(0, 0, 0, 0);
            bool boxIsEmpty = true;

            foreach (object o in objs) {
                var node = o as DrawingNode;
                Core.Geometry.Rectangle objectBb;
                if (node != null)
                    objectBb = node.BoundingBox;
                else {
                    var edge = o as DrawingEdge;
                    if (edge != null)
                        objectBb = edge.BoundingBox;
                    else
                        continue;
                }

                if (boxIsEmpty) {
                    bb = objectBb;
                    boxIsEmpty = false;
                }
                else
                    bb.Add(objectBb);
            }

            return bb;
        }
コード例 #2
0
ファイル: GViewer.cs プロジェクト: mrkcass/SuffixTreeExplorer
        /// <summary>
        /// creates the port visual if it does not exist, and sets the port location
        /// </summary>
        /// <param name="portLocation"></param>
        public void SetSourcePortForEdgeRouting(Point portLocation)
        {
            var box = new Core.Geometry.Rectangle(portLocation);
            box.Pad(UnderlyingPolylineCircleRadius);

            if (SourcePortIsPresent) {
                var prevBox = new Core.Geometry.Rectangle(SourcePortLocation);
                prevBox.Pad(UnderlyingPolylineCircleRadius);
                box.Add(prevBox);
            }

            SourcePortIsPresent = true;
            SourcePortLocation = portLocation;

            panel.Invalidate(MapSourceRectangleToScreenRectangle(box));
        }