示例#1
0
        void SetAlias(Arrow arrow)
        {
            BlockPort bs = arrow.Source;
            BlockPort bt = arrow.Target;
            string    sn = bs.Block;
            string    tn = bt.Block;
            object    so = desktop.GetObject(sn);

            if (!(so is IMeasurements))
            {
                return;
            }
            IMeasurements m = so as IMeasurements;

            if (!(so is ISetFeedback))
            {
                return;
            }
            ISetFeedback sf = so as ISetFeedback;
            object       ta = desktop.GetObject(tn);

            if (!(ta is IAlias))
            {
                return;
            }
            IAlias al = ta as IAlias;

            sf.AddFeedback(m[0], al, al.AliasNames[0]);
        }
示例#2
0
        void ProcessArrow(IDataConsumer dc, IObjectLabel label, Arrow arrow, List <Arrow> absc)
        {
            BlockPort    bp = arrow.Source;
            string       to = bp.Block;
            IObjectLabel l  = desktop[to] as IObjectLabel;

            if (l == null)
            {
                return;
            }
            DataLink dl = new DataLink();

            try
            {
                if (desktop is PureDesktopPeer)
                {
                    PureDesktopPeer pdp = desktop as PureDesktopPeer;
                    if (label.Ord < l.Ord)
                    {
                        absc.Add(arrow);
                        return;
                    }
                    pdp.AddArrowWithExistingLabels(dl, label, l, "", "");
                }
            }
            catch (Exception)
            {
                absc.Add(arrow);
            }
        }
示例#3
0
 static void SetInterop(List <Arrow> inter)
 {
     foreach (Arrow ar in inter)
     {
         Block[]     bl = new Block[] { ar.SourceBlock, ar.TargetBlock };
         BlockPort[] bp = new BlockPort[] { ar.Source, ar.Target };
         for (int i = 0; i < bl.Length; i++)
         {
             bool  inp = (i == 0);
             Block c   = bl[i];
             if (c is SimulinkSubsystem)
             {
                 SimulinkSubsystem ss = c as SimulinkSubsystem;
                 Block             br = GetIOBlock(ss, (1 - i), bp[i].Port + "");
                 if (br == null)
                 {
                     continue;
                 }
                 if (inp)
                 {
                     ar.TargetBlock           = br;
                     br.Input[ar.Target.Port] = ar;
                 }
                 else
                 {
                     ar.SourceBlock            = br;
                     br.Output[ar.Source.Port] = ar;
                 }
             }
         }
     }
 }
        private BlockPort AddMultiConduitPort(LineBlock lineBlock, BlockSideEnum side, List <ConduitClosureTerminalInfo> terminals, string outerConduitColor, double spaceBetweenTerminals = -1, double terminalSize = -1, double portMargin = -1)
        {
            BlockPort port = new BlockPort(side, "MultiConduit" + outerConduitColor, null, spaceBetweenTerminals, terminalSize, portMargin);

            foreach (var terminal in terminals)
            {
                if (terminal.LineSegment is ConduitSegmentInfo)
                {
                    ConduitSegmentInfo conduitSegment = terminal.LineSegment as ConduitSegmentInfo;
                    bool visible = false;

                    if (terminal.ConnectionKind == ConduitClosureInternalConnectionKindEnum.NotConnected)
                    {
                        visible = true;
                    }

                    var blockTerminal = new BlockPortTerminal(visible, "InnerConduit" + conduitSegment.Conduit.Color.ToString());
                    blockTerminal.SetReference(conduitSegment.Id, "InnerConduitSegment");
                    port.AddTerminal(blockTerminal);
                }
            }

            lineBlock.AddPort(port);

            return(port);
        }
示例#5
0
 private void AddTerminalsToPort(BlockPort port, int nTerminals)
 {
     for (int i = 0; i < nTerminals; i++)
     {
         new BlockPortTerminal(port)
         {
             IsVisible = false
         };
     }
 }
        private BlockPort AddMultiConduitPort(LineBlock lineBlock, BlockSideEnum side, int nTerminals, string outerConduitColor, double spaceBetweenTerminals = -1, double terminalSize = -1, double portMargin = -1)
        {
            BlockPort port = new BlockPort(side, "MultiConduit" + outerConduitColor, null, spaceBetweenTerminals, terminalSize, portMargin);

            for (int i = 0; i < nTerminals; i++)
            {
                port.AddTerminal(new BlockPortTerminal(true, "InnerConduit" + MockupHelper.GetColorStringFromConduitNumber(i + 1)));
            }

            lineBlock.AddPort(port);

            return(port);
        }
        private BlockPort AddBigConduitPort(LineBlock lineBlock, BlockSideEnum side, int nTerminals, string outerConduitColor = null, double spaceBetweenTerminals = -1, double terminalSize = -1, double portMargin = -1)
        {
            BlockPort port = new BlockPort(side, outerConduitColor != null ? "BigConduit" + outerConduitColor : null, null, spaceBetweenTerminals, terminalSize, portMargin);

            for (int i = 0; i < nTerminals; i++)
            {
                port.AddTerminal(new BlockPortTerminal(false));
            }

            lineBlock.AddPort(port);

            return(port);
        }
示例#8
0
        public void LineBlockWithLabeledLinesTest()
        {
            Diagram diagram = new Diagram();

            var lineBlock = new LineBlock()
            {
                MinHeight = 200,
                MinWidth  = 300,
                Margin    = 20,
                IsVisible = false
            };

            // Vest
            var vestPort1 = new BlockPort(BlockSideEnum.West)
            {
                IsVisible = false
            };

            lineBlock.AddPort(vestPort1);
            AddTerminalsToPort(vestPort1, 3);

            // East
            var eastPort1 = new BlockPort(BlockSideEnum.East)
            {
                IsVisible = false
            };

            lineBlock.AddPort(eastPort1);
            AddTerminalsToPort(eastPort1, 3);

            lineBlock.AddTerminalConnection(BlockSideEnum.West, 1, 1, BlockSideEnum.East, 1, 1, "This is a label text", "This should be a polyline", LineShapeTypeEnum.Line);

            // Act
            lineBlock.CreateDiagramObjects(diagram, 0, 0);

            if (System.Environment.OSVersion.Platform.ToString() == "Win32NT")
            {
                new GeoJsonExporter(diagram).Export("c:/temp/diagram/test.geojson");
            }

            // Assert
            diagram.DiagramObjects.Count.Should().Be(1);
            diagram.DiagramObjects.First().Geometry.IsValid.Should().BeTrue();
            diagram.DiagramObjects.First().Geometry.Length.Should().Be(0.03);
            diagram.DiagramObjects.First().Label.Should().Be("This is a label text");
            diagram.DiagramObjects.First().Style.Should().Be("This should be a polyline");
        }
示例#9
0
        private BlockPort CreatePortForOuterConduitEnd(SpanEquipmentViewModel viewModel, BlockSideEnum blockSide)
        {
            var routeSpanDiagramInfo = viewModel.RootSpanDiagramInfo("OuterConduit");

            var port = new BlockPort(blockSide)
            {
                IsVisible  = viewModel.IsSingleSpan ? false : true,
                Margin     = viewModel.IsSingleSpan ? _portMargin / 2 : _portMargin,
                Style      = routeSpanDiagramInfo.StyleName,
                PointStyle = blockSide.ToString() + "TerminalLabel",
                PointLabel = viewModel.GetConduitEquipmentLabel(),
            };

            port.DrawingOrder = 420;

            port.SetReference(routeSpanDiagramInfo.SegmentId, "SpanSegment");

            return(port);
        }
示例#10
0
        public void SouthEastPostDrawingTest_ShouldSucceed()
        {
            Diagram diagram = new Diagram();

            var lineBlock = new LineBlock()
            {
                MinHeight = 200,
                MinWidth  = 300,
                Margin    = 20,
                IsVisible = false
            };

            // East
            var eastPort = new BlockPort(BlockSideEnum.East)
            {
                IsVisible = false
            };

            lineBlock.AddPort(eastPort);
            AddTerminalsToPort(eastPort, 4);

            // South
            var southPort = new BlockPort(BlockSideEnum.South)
            {
                IsVisible = false
            };

            lineBlock.AddPort(southPort);
            AddTerminalsToPort(southPort, 4);

            // East South connections
            lineBlock.AddTerminalConnection(BlockSideEnum.South, 1, 1, BlockSideEnum.East, 1, 1, "This is a label text", "This should be a polyline", LineShapeTypeEnum.Polygon);

            lineBlock.CreateDiagramObjects(diagram, 0, 0);

            if (System.Environment.OSVersion.Platform.ToString() == "Win32NT")
            {
                new GeoJsonExporter(diagram).Export("c:/temp/diagram/test.geojson");
            }
        }
示例#11
0
        private void ProcessArrow(XElement element)
        {
            List <BlockPort> l = new List <BlockPort>();

            for (int i = 0; i < 2; i++)
            {
                string b = element.GetAttribute(SimulinkXmlParser.SourceTarget[i]);
                string p = element.GetAttribute(SimulinkXmlParser.SourceTargetPorts[i]);
                if (b.Length == 0)
                {
                    break;
                }
                BlockPort bp = new BlockPort(b, p);
                l.Add(bp);
            }
            if (l.Count == 2)
            {
                Arrow arrow = new Arrow(this, l[0], l[1]);
                Add(arrow);
                return;
            }
            List <XElement> lch = new List <XElement>();

            GetChildernBranches(element, lch);
            XElement[] children = lch.ToArray();
            foreach (XElement c in children)
            {
                string type = c.Name.LocalName;
                if (!type.Equals(SimulinkXmlParser.Branch))
                {
                    continue;
                }
                string    b  = c.GetAttribute(SimulinkXmlParser.SourceTarget[1]);
                string    p  = c.GetAttribute(SimulinkXmlParser.SourceTargetPorts[1]);
                BlockPort bp = new BlockPort(b, p);
                Arrow     ar = new Arrow(this, l[0], bp);
                Add(ar);
            }
        }
示例#12
0
        public void AllDirectionsTerminalLineDrawingTest_ShouldSucceed()
        {
            Diagram diagram = new Diagram();

            var lineBlock = new LineBlock()
            {
                MinHeight = 200,
                MinWidth  = 300,
                Margin    = 20,
                IsVisible = false
            };

            // Vest
            var vestPort = new BlockPort(BlockSideEnum.West)
            {
                IsVisible = false
            };

            lineBlock.AddPort(vestPort);
            AddTerminalsToPort(vestPort, 4);

            // North
            var northPort = new BlockPort(BlockSideEnum.North)
            {
                IsVisible = false
            };

            lineBlock.AddPort(northPort);
            AddTerminalsToPort(northPort, 4);

            // East
            var eastPort = new BlockPort(BlockSideEnum.East)
            {
                IsVisible = false
            };

            lineBlock.AddPort(eastPort);
            AddTerminalsToPort(eastPort, 4);

            // South
            var southPort = new BlockPort(BlockSideEnum.South)
            {
                IsVisible = false
            };

            lineBlock.AddPort(southPort);
            AddTerminalsToPort(southPort, 4);

            // West connections
            lineBlock.AddTerminalConnection(BlockSideEnum.West, 1, 1, BlockSideEnum.North, 1, 1, "This is a label text", "This should be a polyline", LineShapeTypeEnum.Line);
            lineBlock.AddTerminalConnection(BlockSideEnum.West, 1, 2, BlockSideEnum.East, 1, 1, "This is a label text", "This should be a polyline", LineShapeTypeEnum.Line);
            lineBlock.AddTerminalConnection(BlockSideEnum.West, 1, 3, BlockSideEnum.South, 1, 1, "This is a label text", "This should be a polyline", LineShapeTypeEnum.Line);

            // North connections
            lineBlock.AddTerminalConnection(BlockSideEnum.North, 1, 2, BlockSideEnum.East, 1, 2, "This is a label text", "This should be a polyline", LineShapeTypeEnum.Line);
            lineBlock.AddTerminalConnection(BlockSideEnum.North, 1, 3, BlockSideEnum.South, 1, 2, "This is a label text", "This should be a polyline", LineShapeTypeEnum.Line);

            // East connections
            lineBlock.AddTerminalConnection(BlockSideEnum.East, 1, 3, BlockSideEnum.South, 1, 3, "This is a label text", "This should be a polyline", LineShapeTypeEnum.Line);

            // Act
            lineBlock.CreateDiagramObjects(diagram, 0, 0);

            if (System.Environment.OSVersion.Platform.ToString() == "Win32NT")
            {
                new GeoJsonExporter(diagram).Export("c:/temp/diagram/test.geojson");
            }

            // Assert
            diagram.DiagramObjects.Count(d => d.Style == "This should be a polyline").Should().Be(6);
        }
示例#13
0
        private void AffixPassThroughConduit(LineBlock nodeContainerBlock, SpanEquipmentViewModel viewModel)
        {
            var spanDiagramInfo = viewModel.RootSpanDiagramInfo("OuterConduit");

            BlockSideEnum fromSide = viewModel.BlockSideWhereSpanEquipmentShouldBeAffixed();
            BlockSideEnum toSide   = viewModel.OppositeBlockSideWhereSpanEquipmentShouldBeAffixed();

            bool portsVisible = true;

            // If cut we want to draw the port polygons, because otherwise the outer conduit cannot be seen on the diagram (due to missing connection between the two sides)
            if (spanDiagramInfo.IsPassThrough)
            {
                portsVisible = false;
            }

            // Create outer conduit as port
            var fromPort = new BlockPort(fromSide)
            {
                IsVisible  = portsVisible,
                Margin     = _portMargin,
                Style      = spanDiagramInfo.StyleName,
                PointStyle = fromSide.ToString() + "TerminalLabel",
                PointLabel = viewModel.GetConduitEquipmentLabel()
            };

            fromPort.DrawingOrder = 420;
            fromPort.SetReference(viewModel.RootSpanDiagramInfo("OuterConduit").IngoingSegmentId, "SpanSegment");
            nodeContainerBlock.AddPort(fromPort);

            var toPort = new BlockPort(toSide)
            {
                IsVisible  = portsVisible,
                Margin     = _portMargin,
                Style      = spanDiagramInfo.StyleName,
                PointStyle = toSide.ToString() + "TerminalLabel",
                PointLabel = viewModel.GetConduitEquipmentLabel()
            };

            toPort.DrawingOrder = 420;
            toPort.SetReference(viewModel.RootSpanDiagramInfo("OuterConduit").OutgoingSegmentId, "SpanSegment");

            nodeContainerBlock.AddPort(toPort);

            if (spanDiagramInfo.IsPassThrough)
            {
                var portConnection = nodeContainerBlock.AddPortConnection(fromSide, fromPort.Index, toSide, toPort.Index, null, spanDiagramInfo.StyleName);
                portConnection.SetReference(spanDiagramInfo.SegmentId, "SpanSegment");
                portConnection.DrawingOrder = 410;
            }

            List <SpanDiagramInfo> innerSpanData = viewModel.GetInnerSpanDiagramInfos("InnerConduit");

            bool innerSpansFound = false;

            int terminalNo = 1;

            if (innerSpanData.Count == 6)
            {
            }

            foreach (var innerSpan in innerSpanData)
            {
                TerminalShapeTypeEnum terminalShapeType = TerminalShapeTypeEnum.Point;

                // If cut we want to draw the terminal polygon, because otherwise the conduit cannot be seen on the diagram (due to missing connection between the two sides)
                if (!innerSpan.IsPassThrough)
                {
                    terminalShapeType = TerminalShapeTypeEnum.PointAndPolygon;
                }


                string fromNodeName = "NA";
                string toNodeName   = "NA";

                if (innerSpan.IsPassThrough)
                {
                    fromNodeName = viewModel.GetIngoingRouteNodeName(innerSpan.SegmentId);
                    toNodeName   = viewModel.GetOutgoingRouteNodeName(innerSpan.SegmentId);
                }
                else
                {
                    fromNodeName = viewModel.GetIngoingRouteNodeName(innerSpan.IngoingSpanSegment.Id);
                    toNodeName   = viewModel.GetOutgoingRouteNodeName(innerSpan.OutgoingSpanSegment.Id);
                }

                var fromTerminal = new BlockPortTerminal(fromPort)
                {
                    IsVisible    = true,
                    ShapeType    = terminalShapeType,
                    PointStyle   = fromSide.ToString() + "TerminalLabel",
                    PointLabel   = fromNodeName,
                    PolygonStyle = innerSpan.StyleName
                };

                fromTerminal.SetReference(innerSpan.IngoingSegmentId, "SpanSegment");
                fromTerminal.DrawingOrder = 620;

                var toTerminal = new BlockPortTerminal(toPort)
                {
                    IsVisible    = true,
                    ShapeType    = terminalShapeType,
                    PointStyle   = toSide.ToString() + "TerminalLabel",
                    PointLabel   = toNodeName,
                    PolygonStyle = innerSpan.StyleName
                };

                toTerminal.SetReference(innerSpan.OutgoingSegmentId, "SpanSegment");
                toTerminal.DrawingOrder = 620;

                // Connect the two sides, if the inner conduit is not cut / passing through
                if (innerSpan.IsPassThrough)
                {
                    var terminalConnection = nodeContainerBlock.AddTerminalConnection(fromSide, fromPort.Index, terminalNo, toSide, toPort.Index, terminalNo, null, innerSpan.StyleName, LineShapeTypeEnum.Polygon);
                    terminalConnection.SetReference(innerSpan.IngoingSegmentId, "SpanSegment");
                    terminalConnection.DrawingOrder = 510;

                    // Add eventually cable running through inner conduit
                    if (_nodeContainerViewModel.Data.ConduitSegmentToCableChildRelations.ContainsKey(innerSpan.IngoingSegmentId))
                    {
                        var cableId             = _nodeContainerViewModel.Data.ConduitSegmentToCableChildRelations[innerSpan.IngoingSegmentId].First();
                        var fiberCableLineLabel = _nodeContainerViewModel.Data.GetCableEquipmentLineLabel(cableId);


                        var cableTerminalConnection = nodeContainerBlock.AddTerminalConnection(BlockSideEnum.West, 1, terminalNo, BlockSideEnum.East, 1, terminalNo, fiberCableLineLabel, "FiberCable", LineShapeTypeEnum.Line);
                        cableTerminalConnection.DrawingOrder = 600;
                        cableTerminalConnection.SetReference(cableId, "SpanSegment");
                    }
                }
                else
                {
                    // Add from terminal / ingoing segment to ends
                    AddToTerminalEnds(innerSpan.IngoingTerminalId, innerSpan.IngoingSpanSegment, fromTerminal, innerSpan.StyleName);

                    // Add to terminal / outgoing segment to ends
                    AddToTerminalEnds(innerSpan.OutgoingTerminalId, innerSpan.OutgoingSpanSegment, toTerminal, innerSpan.StyleName);
                }

                terminalNo++;
                innerSpansFound = true;
            }

            // Create fake inner terminals used to display where the empty multi conduit is heading
            if (!innerSpansFound)
            {
                var fromTerminal = new BlockPortTerminal(fromPort)
                {
                    IsVisible    = true,
                    ShapeType    = TerminalShapeTypeEnum.Point,
                    PointStyle   = fromSide.ToString() + "TerminalLabel",
                    PointLabel   = viewModel.GetIngoingRouteNodeName(spanDiagramInfo.IngoingSegmentId),
                    DrawingOrder = 520
                };

                fromTerminal.SetReference(spanDiagramInfo.IngoingSegmentId, "SpanSegment");

                var toTerminal = new BlockPortTerminal(toPort)
                {
                    IsVisible    = true,
                    ShapeType    = TerminalShapeTypeEnum.Point,
                    PointStyle   = toSide.ToString() + "TerminalLabel",
                    PointLabel   = viewModel.GetOutgoingRouteNodeName(spanDiagramInfo.IngoingSegmentId),
                    DrawingOrder = 520
                };

                toTerminal.SetReference(spanDiagramInfo.OutgoingSegmentId, "SpanSegment");

                terminalNo++;
            }
        }
示例#14
0
        private BlockPortTerminal CreateTerminalForInnerConduitEnd(SpanEquipmentViewModel viewModel, BlockPort outerConduitPort, SpanDiagramInfo innerSpanDiagramInfo)
        {
            var terminal = new BlockPortTerminal(outerConduitPort)
            {
                IsVisible    = true,
                ShapeType    = TerminalShapeTypeEnum.PointAndPolygon,
                PointStyle   = outerConduitPort.Side.ToString() + "TerminalLabel",
                PointLabel   = viewModel.InterestRelationKind() == RouteNetworkInterestRelationKindEnum.End ? viewModel.GetIngoingRouteNodeName(innerSpanDiagramInfo.SegmentId) : viewModel.GetOutgoingRouteNodeName(innerSpanDiagramInfo.SegmentId),
                PolygonStyle = innerSpanDiagramInfo.StyleName
            };

            terminal.DrawingOrder = 620;

            terminal.SetReference(innerSpanDiagramInfo.SegmentId, "SpanSegment");

            AddToTerminalEnds(innerSpanDiagramInfo.TerminalId, innerSpanDiagramInfo.SpanSegment, terminal, innerSpanDiagramInfo.StyleName);

            return(terminal);
        }
示例#15
0
        private void CreateTerminalForSingleConduitEnd(SpanEquipmentViewModel viewModel, BlockPort outerConduitPort)
        {
            var routeSpanDiagramInfo = viewModel.RootSpanDiagramInfo("OuterConduit");

            var terminal = new BlockPortTerminal(outerConduitPort)
            {
                IsVisible    = true,
                ShapeType    = viewModel.IsSingleSpan ? TerminalShapeTypeEnum.PointAndPolygon : TerminalShapeTypeEnum.Point,
                PointStyle   = outerConduitPort.Side.ToString() + "TerminalLabel",
                PointLabel   = viewModel.InterestRelationKind() == RouteNetworkInterestRelationKindEnum.End ? viewModel.GetIngoingRouteNodeName(routeSpanDiagramInfo.SegmentId) : viewModel.GetOutgoingRouteNodeName(routeSpanDiagramInfo.SegmentId),
                PolygonStyle = routeSpanDiagramInfo.StyleName,
                DrawingOrder = 620
            };

            terminal.SetReference(routeSpanDiagramInfo.SegmentId, "SpanSegment");

            AddToTerminalEnds(routeSpanDiagramInfo.TerminalId, routeSpanDiagramInfo.SpanSegment, terminal, routeSpanDiagramInfo.StyleName);

            // Check if cables are related to the conduit
            if (_nodeContainerViewModel.Data.ConduitSegmentToCableChildRelations.ContainsKey(routeSpanDiagramInfo.SegmentId))
            {
                var cableRelations = _nodeContainerViewModel.Data.ConduitSegmentToCableChildRelations[routeSpanDiagramInfo.SegmentId];

                foreach (var cableId in cableRelations)
                {
                    // Add cable to terminal end relation
                    AddToTerminalEnds(cableId, routeSpanDiagramInfo.SpanSegment, terminal, routeSpanDiagramInfo.StyleName);
                }
            }
        }
示例#16
0
        private void CreateTerminalsForCablesRelatedToSingleConduitEnd(SpanEquipmentViewModel viewModel, BlockPort outerConduitPort)
        {
            var routeSpanDiagramInfo = viewModel.RootSpanDiagramInfo("OuterConduit");

            var cableRelations = _nodeContainerViewModel.Data.ConduitSegmentToCableChildRelations[routeSpanDiagramInfo.SegmentId];

            foreach (var cableId in cableRelations)
            {
                var terminal = new BlockPortTerminal(outerConduitPort)
                {
                    IsVisible    = viewModel.IsSingleSpan && viewModel.SpanEquipment.SpanStructures.Length == 1,
                    ShapeType    = TerminalShapeTypeEnum.Point,
                    PointStyle   = outerConduitPort.Side + "TerminalLabel",
                    PointLabel   = viewModel.InterestRelationKind() == RouteNetworkInterestRelationKindEnum.End ? viewModel.GetIngoingRouteNodeName(routeSpanDiagramInfo.SegmentId) : viewModel.GetOutgoingRouteNodeName(routeSpanDiagramInfo.SegmentId),
                    PolygonStyle = routeSpanDiagramInfo.StyleName,
                    DrawingOrder = 620
                };

                terminal.SetReference(routeSpanDiagramInfo.SegmentId, "SpanSegment");

                // Create a fake terminal for the cable
                AddToTerminalEnds(cableId, routeSpanDiagramInfo.SpanSegment, terminal, routeSpanDiagramInfo.StyleName);
            }
        }
示例#17
0
        private void CreateTerminalForShowingWhereEmptySingleConduitIsHeading(SpanEquipmentViewModel viewModel, BlockPort outerConduitPort)
        {
            var routeSpanDiagramInfo = viewModel.RootSpanDiagramInfo("OuterConduit");

            var terminal = new BlockPortTerminal(outerConduitPort)
            {
                IsVisible    = true,
                ShapeType    = viewModel.IsSingleSpan ? TerminalShapeTypeEnum.PointAndPolygon : TerminalShapeTypeEnum.Point,
                PointStyle   = outerConduitPort.Side.ToString() + "TerminalLabel",
                PointLabel   = viewModel.InterestRelationKind() == RouteNetworkInterestRelationKindEnum.End ? viewModel.GetIngoingRouteNodeName(routeSpanDiagramInfo.SegmentId) : viewModel.GetOutgoingRouteNodeName(routeSpanDiagramInfo.SegmentId),
                PolygonStyle = routeSpanDiagramInfo.StyleName,
                DrawingOrder = 620
            };

            terminal.SetReference(routeSpanDiagramInfo.SegmentId, "SpanSegment");
        }
示例#18
0
        public void LabelTest2()
        {
            Diagram diagram = new Diagram();

            var lineBlock = new LineBlock()
            {
                MinHeight = 200,
                MinWidth  = 300,
                Margin    = 20
            };


            // Vest
            var vestPort1 = new BlockPort(BlockSideEnum.West);

            lineBlock.AddPort(vestPort1);
            AddTerminalsToPort(vestPort1, 3);

            var vestPort2 = new BlockPort(BlockSideEnum.West);

            lineBlock.AddPort(vestPort2);
            AddTerminalsToPort(vestPort2, 3);

            // East
            var eastPort1 = new BlockPort(BlockSideEnum.East);

            lineBlock.AddPort(eastPort1);
            AddTerminalsToPort(eastPort1, 3);

            var eastPort2 = new BlockPort(BlockSideEnum.East);

            lineBlock.AddPort(eastPort2);
            AddTerminalsToPort(eastPort2, 3);


            // North
            var northPort1 = new BlockPort(BlockSideEnum.North);

            lineBlock.AddPort(northPort1);
            AddTerminalsToPort(northPort1, 3);

            var northPort2 = new BlockPort(BlockSideEnum.North);

            lineBlock.AddPort(northPort2);
            AddTerminalsToPort(northPort2, 3);

            lineBlock.SetSideCenterAlignment(BlockSideEnum.North);


            // South
            var southPort1 = new BlockPort(BlockSideEnum.South, "SouthPortStyle1", "SouthPortLabel1");

            lineBlock.AddPort(southPort1);
            AddTerminalsToPort(southPort1, 3);

            var southPort2 = new BlockPort(BlockSideEnum.South, "SouthPortStyle2", "SouthPortLabel2");

            lineBlock.AddPort(southPort2);
            AddTerminalsToPort(southPort2, 3);


            //lineBlock.AddPortConnection(BlockSideEnum.Vest, 1, BlockSideEnum.East, 2);
            lineBlock.AddTerminalConnection(BlockSideEnum.West, 1, 1, BlockSideEnum.North, 2, 1, "Hest", "Cable", LineShapeTypeEnum.Polygon);

            var diagramObjects = lineBlock.CreateDiagramObjects(diagram, 0, 0);

            if (System.Environment.OSVersion.Platform.ToString() == "Win32NT")
            {
                new GeoJsonExporter(diagram).Export("c:/temp/diagram/test.geojson");
            }
        }
示例#19
0
        private LineBlock CreateCableOutsideConduitPassThroughBlock()
        {
            // Create outer conduits
            var rootSpanInfo = _spanEquipmentViewModel.RootSpanDiagramInfo("OuterConduit");

            var spanEquipmentBlock = new LineBlock()
            {
                MinWidth     = _spanEquipmentAreaWidth,
                IsVisible    = false,
                Style        = rootSpanInfo.StyleName,
                Margin       = _spanEquipmentViewModel.IsSingleSpan ? 0 : _spanEquipmentBlockMargin,
                DrawingOrder = 400
            };

            spanEquipmentBlock.SetReference(rootSpanInfo.IngoingSegmentId, "SpanSegment");


            var fromPort = new BlockPort(BlockSideEnum.West, null, null, 0, -1, 0)
            {
                IsVisible = false, DrawingOrder = 420
            };

            spanEquipmentBlock.AddPort(fromPort);

            var toPort = new BlockPort(BlockSideEnum.East, null, null, 0, -1, 0)
            {
                IsVisible = false, DrawingOrder = 420
            };

            spanEquipmentBlock.AddPort(toPort);

            int terminalNo = 1;


            var fromTerminal = new BlockPortTerminal(fromPort)
            {
                IsVisible    = true,
                ShapeType    = TerminalShapeTypeEnum.Point,
                PointStyle   = "WestTerminalLabel",
                PointLabel   = _spanEquipmentViewModel.GetIngoingRouteNodeName(rootSpanInfo.SegmentId),
                DrawingOrder = 520
            };

            fromTerminal.SetReference(rootSpanInfo.IngoingSegmentId, "SpanSegment");

            var toTerminal = new BlockPortTerminal(toPort)
            {
                IsVisible    = true,
                ShapeType    = TerminalShapeTypeEnum.Point,
                PointStyle   = "EastTerminalLabel",
                PointLabel   = _spanEquipmentViewModel.GetOutgoingRouteNodeName(rootSpanInfo.SegmentId),
                DrawingOrder = 520
            };

            toTerminal.SetReference(rootSpanInfo.OutgoingSegmentId, "SpanSegment");

            var fiberCableLineLabel = _spanEquipmentViewModel.Data.GetCableEquipmentLineLabel(_spanEquipmentViewModel.SpanEquipment.Id);

            var terminalConnection = spanEquipmentBlock.AddTerminalConnection(BlockSideEnum.West, 1, terminalNo, BlockSideEnum.East, 1, terminalNo, fiberCableLineLabel, "FiberCable", LineShapeTypeEnum.Line);

            terminalConnection.DrawingOrder = 600;
            terminalConnection.SetReference(rootSpanInfo.SegmentId, "SpanSegment");

            return(spanEquipmentBlock);
        }