Ejemplo n.º 1
0
        internal static void DrawLabel(Canvas g, DLabel label)
        {
            if (label == null)
            {
                return;
            }

            throw new NotImplementedException();

            /*
             * try
             * {
             *  DrawStringInRectCenter(g, new SolidBrush(MsaglColorToDrawingColor(label.DrawingLabel.FontColor)),
             *                         label.Font, label.DrawingLabel.Text,
             *                         new RectangleF((float)label.DrawingLabel.Left, (float)label.DrawingLabel.Bottom,
             *                                        (float)label.DrawingLabel.Size.Width,
             *                                        (float)label.DrawingLabel.Size.Height));
             * }
             * catch
             * {
             * }
             * if (label.MarkedForDragging)
             * {
             *  var pen = new Pen(MsaglColorToDrawingColor(label.DrawingLabel.FontColor));
             *  pen.DashStyle = DashStyle.Dot;
             *  DrawLine(g, pen, label.DrawingLabel.GeometryLabel.AttachmentSegmentStart,
             *           label.DrawingLabel.GeometryLabel.AttachmentSegmentEnd);
             * } //*/
        }
        internal Geometry(DObject dObject)
        {
            this.dObject = dObject;

            DNode dNode = dObject as DNode;

            if (dNode != null)
            {
                bBox = dNode.DrawingNode.BoundingBox;
            }
            else
            {
                DLabel dLabel = dObject as DLabel;
                if (dLabel != null)
                {
                    bBox = dLabel.Label.BoundingBox;
                }
            }
        }
Ejemplo n.º 3
0
        internal static void SetNodeBoundaryCurve(DrawingGraph drawingGraph, DrawingNode drawingNode, DLabel existingLabel)
        {
            // Create the boundary curve. Note that a delegate may be allowed to create the curve (or replace it, if it already exists).
            GeometryNode geomNode = drawingNode.GeometryNode;
            if (geomNode == null)
                return;
            ICurve curve;
            if (drawingNode.NodeBoundaryDelegate == null || (curve = drawingNode.NodeBoundaryDelegate(drawingNode)) == null)
            {
                // I need to know the node size, which may depend on a label.
                double width = 0.0;
                double height = 0.0;
                if (existingLabel != null)
                {
                    //existingLabel.MakeVisual();
                    width = existingLabel.Label.Width;
                    height = existingLabel.Label.Height;
                    width += 2 * drawingNode.Attr.LabelMargin;
                    height += 2 * drawingNode.Attr.LabelMargin;
                }
                else if (drawingNode.Label != null && drawingNode.Label.GeometryLabel != null)
                {
                    // Measure the label's size (the only safe way is to instantiate it).
                    var dLabel = new DTextLabel(null, drawingNode.Label);
                    dLabel.MakeVisual();
                    width = dLabel.Label.Width;
                    height = dLabel.Label.Height;

                    // Add node label margin.
                    width += 2 * drawingNode.Attr.LabelMargin;
                    height += 2 * drawingNode.Attr.LabelMargin;
                }
                // Apply lower cap to node size
                if (width < drawingGraph.Attr.MinNodeWidth)
                    width = drawingGraph.Attr.MinNodeWidth;
                if (height < drawingGraph.Attr.MinNodeHeight)
                    height = drawingGraph.Attr.MinNodeHeight;

                curve = NodeBoundaryCurves.GetNodeBoundaryCurve(drawingNode, width, height);
            }
            if (geomNode.BoundaryCurve != null)
                curve.Translate(geomNode.BoundingBox.Center);
            geomNode.BoundaryCurve = curve;
        }
Ejemplo n.º 4
0
        internal static void DrawLabel(Canvas g, DLabel label)
        {
            if (label == null)
                return;

            throw new NotImplementedException();
            /*
            try
            {
                DrawStringInRectCenter(g, new SolidBrush(MsaglColorToDrawingColor(label.DrawingLabel.FontColor)),
                                       label.Font, label.DrawingLabel.Text,
                                       new RectangleF((float)label.DrawingLabel.Left, (float)label.DrawingLabel.Bottom,
                                                      (float)label.DrawingLabel.Size.Width,
                                                      (float)label.DrawingLabel.Size.Height));
            }
            catch
            {
            }
            if (label.MarkedForDragging)
            {
                var pen = new Pen(MsaglColorToDrawingColor(label.DrawingLabel.FontColor));
                pen.DashStyle = DashStyle.Dot;
                DrawLine(g, pen, label.DrawingLabel.GeometryLabel.AttachmentSegmentStart,
                         label.DrawingLabel.GeometryLabel.AttachmentSegmentEnd);
            } //*/
        }
Ejemplo n.º 5
0
 static BBNode BuildBBHierarchyUnderDLabel(DLabel dLabel)
 {
     var bbNode = new BBNode();
     bbNode.geometry = new Geometry(dLabel);
     bbNode.bBox = dLabel.Label.BoundingBox;
     return bbNode;
 }