コード例 #1
0
        /// <summary>
        /// calculates the restore data
        /// </summary>
        /// <returns></returns>
        public static RestoreData GetRestoreData(GeometryObject geometryObject)
        {
            Node node = geometryObject as Node;
            if (node != null)
            {
                return GetRestoreData(node);
            }

            Edge edge = geometryObject as Edge;
            if (edge != null)
            {
                return GetRestoreData(edge);
            }

            Label label = geometryObject as Label;
            if (label != null)
            {
                return GetRestoreData(label);
            }

            GeometryGraph graph = geometryObject as GeometryGraph;
            if (graph != null)
            {
                return GetRestoreData(graph);
            }

            return null;
        }
コード例 #2
0
ファイル: Label.cs プロジェクト: Caliper/MSAGL
        /// <summary>
        /// Constructor
        /// </summary>
        ///<param name="labelWidth">width</param>
        ///<param name="labelHeight">height</param>
        ///<param name="parentP">the corresponding edge</param>

        public Label(double labelWidth, double labelHeight, GeometryObject parentP)
        {
            Width                     = labelWidth;
            Height                    = labelHeight;
            GeometryParent            = parentP;
            PlacementStrategyPriority = new[] { PlacementStrategy.AlongCurve, PlacementStrategy.Horizontal };
        }
コード例 #3
0
 internal Label(GeometryObject parentPar) {
     GeometryParent = parentPar;
 }
コード例 #4
0
        /// <summary>
        /// Constructor
        /// </summary>
        ///<param name="labelWidth">width</param>
        ///<param name="labelHeight">height</param>
        ///<param name="parentP">the corresponding edge</param>

        public Label(double labelWidth, double labelHeight, GeometryObject parentP) {
            Width = labelWidth;
            Height = labelHeight;
            GeometryParent = parentP;
            PlacementStrategyPriority = new[] {PlacementStrategy.AlongCurve, PlacementStrategy.Horizontal};
        }
コード例 #5
0
ファイル: Label.cs プロジェクト: Caliper/MSAGL
 internal Label(GeometryObject parentPar)
 {
     GeometryParent = parentPar;
 }
コード例 #6
0
 static EdgeGeometry CreateEdgeGeometryForSelfEdge(GeometryObject geometryGraph, GeometryNode node) {
     var tempEdge = new Core.Layout.Edge(node, node)
     {
         GeometryParent = geometryGraph,
         SourcePort =
             new FloatingPort(node.BoundaryCurve, node.Center),
         TargetPort =
             new FloatingPort(node.BoundaryCurve, node.Center),
         EdgeGeometry = { TargetArrowhead = new Arrowhead() }
     };
     StraightLineEdges.CreateSimpleEdgeCurveWithUnderlyingPolyline(tempEdge);
     return tempEdge.EdgeGeometry;
 }
コード例 #7
0
        void UpdateGraphBoundingBoxWithCheck(GeometryObject geomObj) {
            var cl = geomObj as Cluster;
            Rectangle bBox = cl != null ? cl.BoundaryCurve.BoundingBox : geomObj.BoundingBox;
            {
                var edge = geomObj as GeomEdge;
                if (edge != null && edge.Label != null)
                    bBox.Add(edge.Label.BoundingBox);
            }
            var p = new Point(-Graph.Margins, Graph.Margins);

            Rectangle bounds = Graph.BoundingBox;
            GraphBoundingBoxGetsExtended |= bounds.AddWithCheck(bBox.LeftTop + p);
            GraphBoundingBoxGetsExtended |= bounds.AddWithCheck(bBox.RightBottom - p);
            Graph.BoundingBox = bounds;
        }
コード例 #8
0
 static void ShiftDragEdge(Point delta, GeometryObject geomObj) {
     var edge = geomObj as GeomEdge;
     if (edge != null)
         edge.Translate(delta);
     else {
         var label = geomObj as GeomLabel;
         if (label != null)
             DragLabel(label, delta);
         else
             throw new NotImplementedException();
     }
 }
コード例 #9
0
        void ReadLabelFromAttribute(GeometryObject geomObj) {
            string str;
            if (!TryGetAttribute(GeometryToken.Label, out str)) return;
            var label = new Label(geomObj);
            Point center;
            double width, height;
            ParseLabel(str, out center, out width, out height);
            label.Center = center;
            label.Width = width;
            label.Height = height;

            var edge = geomObj as Edge;
            if (edge != null) {
                edge.Label = label;
            }
        }
コード例 #10
0
        internal void AddRestoreData(GeometryObject msaglObject, RestoreData restoreData) {
            lock (restoreData)
                restoreDataDictionary[msaglObject] = restoreData;

        }
コード例 #11
0
 internal RestoreData GetRestoreData(GeometryObject msaglObject) {
     return restoreDataDictionary[msaglObject];
 }
コード例 #12
0
 internal static GeometryGraph GetParentGraph(GeometryObject geomObj) {
     do {
         GeometryGraph graph = geomObj.GeometryParent as GeometryGraph;
         if (graph != null)
             return graph;
         geomObj = geomObj.GeometryParent;
     } while (true);
 }