コード例 #1
0
        private LineBlock CreateSpanEquipmentBlock(double extraHeightTop = 0)
        {
            var nodeEquipmentBlock = new LineBlock()
            {
                MinWidth                 = _initialMinWidth,
                ExtraHeightTop           = extraHeightTop,
                IsVisible                = true,
                Style                    = "NodeContainer",
                Margin                   = _nodeContainerBlockMargin,
                DrawingOrder             = 100,
                VerticalContentAlignment = GetContainerVerticalAlignment()
            };

            nodeEquipmentBlock.SetReference(_nodeContainerViewModel.NodeContainer.Id, "NodeContainer");

            AffixConduits(nodeEquipmentBlock);

            ConnectEnds(nodeEquipmentBlock);

            nodeEquipmentBlock.SetSideCenterAlignment(BlockSideEnum.North);
            nodeEquipmentBlock.SetSideCenterAlignment(BlockSideEnum.South);

            return(nodeEquipmentBlock);
        }
コード例 #2
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");
            }
        }