void CalcSrcRect(double w, double h)
        {
            var m   = Transform.Inverse;
            var rec = new  Core.Geometry.Rectangle(m * (new Point(0, 0)), m * new Point(w, h));

            rec     = Core.Geometry.Rectangle.Intersect(originalGraph.BoundingBox, rec);
            srcRect = new RectangleF((float)rec.Left, (float)rec.Bottom, (float)rec.Width, (float)rec.Height);

//            if (scaledDown == false){
//                double k = OriginalGraph.Width/ScrollMaxF;
//
//                srcRect.Width = (float) Math.Min(OriginalGraph.Width, k*HLargeChangeF);
//                srcRect.X = (float) (k*HValF) + (float) OriginalGraph.Left;
//
//                k = OriginalGraph.Height/ScrollMaxF;
//                srcRect.Y = (float) OriginalGraph.Height + (float) ScaleFromScrollToSrcY(VVal + VLargeChange) +
//                            (float) OriginalGraph.Bottom;
//                srcRect.Height = (float) Math.Min(OriginalGraph.Height, k*VLargeChangeF);
//            }
//            else{
//                srcRect.X = (float) OriginalGraph.Left;
//                srcRect.Y = (float) OriginalGraph.Height + (float) ScaleFromScrollToSrcY(vScrollBar.Maximum) +
//                            (float) OriginalGraph.Bottom;
//                srcRect.Width = (float) GraphWidth;
//                srcRect.Height = (float) GraphHeight;
//            }
        }
        void CalcSrcRect(double w, double h) {
            var m = Transform.Inverse;
            var rec=new  Core.Geometry.Rectangle(m*(new Point(0, 0)), m*new Point(w, h));
            rec = Core.Geometry.Rectangle.Intersect(originalGraph.BoundingBox,rec);
            srcRect = new RectangleF((float)rec.Left, (float)rec.Bottom, (float)rec.Width, (float)rec.Height);

//            if (scaledDown == false){
//                double k = OriginalGraph.Width/ScrollMaxF;
//
//                srcRect.Width = (float) Math.Min(OriginalGraph.Width, k*HLargeChangeF);
//                srcRect.X = (float) (k*HValF) + (float) OriginalGraph.Left;
//
//                k = OriginalGraph.Height/ScrollMaxF;
//                srcRect.Y = (float) OriginalGraph.Height + (float) ScaleFromScrollToSrcY(VVal + VLargeChange) +
//                            (float) OriginalGraph.Bottom;
//                srcRect.Height = (float) Math.Min(OriginalGraph.Height, k*VLargeChangeF);
//            }
//            else{
//                srcRect.X = (float) OriginalGraph.Left;
//                srcRect.Y = (float) OriginalGraph.Height + (float) ScaleFromScrollToSrcY(vScrollBar.Maximum) +
//                            (float) OriginalGraph.Bottom;
//                srcRect.Width = (float) GraphWidth;
//                srcRect.Height = (float) GraphHeight;
//            }
        }
Example #3
0
        /// <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));
        }
Example #4
0
        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;
        }
Example #5
0
 /// <summary>
 /// 
 /// </summary>
 public void RemoveSourcePortEdgeRouting()
 {
     if (SourcePortIsPresent) {
         var prevBox = new Core.Geometry.Rectangle(SourcePortLocation);
         prevBox.Pad(UnderlyingPolylineCircleRadius);
         panel.Invalidate(MapSourceRectangleToScreenRectangle(prevBox));
         SourcePortIsPresent = false;
     }
 }