Exemplo n.º 1
0
        public ValidateViewModel(JCHVRF.Model.Project project, ref AddFlow addFlow)
        {
            this.ProjectLegacy = project;
            this.addFlowPiping = addFlow;
            if (ProjectLegacy.SystemListNextGen[0] == null)
            {
                return;
            }
            if (curSystemItem == null && ProjectLegacy.SystemListNextGen[0] != null)
            {
                if (ProjectLegacy.SystemListNextGen.Count == 0)
                {
                    return;
                }
                curSystemItem = ProjectLegacy.SystemListNextGen[0];
            }

            utilPiping     = new UtilPiping();
            ut_length      = SystemSetting.UserSetting.unitsSetting.settingLENGTH;
            ut_power       = SystemSetting.UserSetting.unitsSetting.settingPOWER;
            ut_temperature = SystemSetting.UserSetting.unitsSetting.settingTEMPERATURE;
            ut_airflow     = SystemSetting.UserSetting.unitsSetting.settingAIRFLOW;
            ut_weight      = SystemSetting.UserSetting.unitsSetting.settingWEIGHT;

            DoPipingFinalVerification();
            addFlow = this.addFlowPiping;
        }
Exemplo n.º 2
0
        Link AddLink(AddFlow addflow, Node org, Node dst)
        {
            Link link = new Link(org, dst, null, addflow);

            addflow.AddLink(link);
            return(link);
        }
Exemplo n.º 3
0
 public AutoControlWiring(bool isAutoWiringComplete, Project project, ControlSystem controlSystem, AddFlow addflowWiring)
 {
     //_addflowWiring = new AddFlow();
     thisProject    = project;
     _addflowWiring = addflowWiring;
     DoAutoWiring(isAutoWiringComplete, thisProject, controlSystem);
 }
Exemplo n.º 4
0
 private void InitWiringNodes(AddFlow addflowWiring)
 {
     addflowWiring.Clear();
     addflowWiring.LinkModel.LineStyle = LineStyle.Polyline;
     addflowWiring.CanDrawLink         = false;
     addflowWiring.ScrollIncrement     = new Size(0, 0);
 }
Exemplo n.º 5
0
 public Wiring(JCHVRF.Model.Project project, ng.SystemVRF systemVRF, AddFlow AddFlowWiring)
 {
     thisProject   = project;
     sysItem       = systemVRF;
     addFlowWiring = AddFlowWiring;
     DoDrawingWiring(thisProject, sysItem);
     utilWiring = new UtilityWiring(thisProject);
 }
Exemplo n.º 6
0
        private static void RemoveOldLinks(List <Link> oldLinks, AddFlow addflow)
        {
            var linkCount = oldLinks.Count;

            for (int i = 0; i < linkCount; i++)
            {
                addflow.RemoveLink(oldLinks[i]);
            }
        }
Exemplo n.º 7
0
 public override void OnNavigatedTo(NavigationContext navigationContext)
 {
     base.OnNavigatedTo(navigationContext);
     _addFlow           = navigationContext.Parameters["AddFlow"] as AddFlow;
     _selectedNodeIndex = (int)navigationContext.Parameters["Index"];
     RaisePropertyChanged("SelectedNode");
     RaisePropertyChanged("IsSingle");
     SelectedPositionIndex = (SelectedNode == null || SelectedNode.HeightDiff == 0) ? 1 : SelectedNode.HeightDiff > 0 ? 0 : 2;
 }
Exemplo n.º 8
0
 public void setNode_wiring(Node node, System.Windows.Size size, AddFlow addFlowWiring)
 {
     node.Geometry        = new RectangleGeometry(new System.Windows.Rect(0, 0, size.Width, size.Height));
     node.Stroke          = System.Windows.Media.Brushes.DarkGray;
     node.StrokeThickness = 1.6;
     node.Size            = size;
     node.BackMode        = BackMode.Transparent;
     node.IsSelectable    = false;
     addFlowWiring.AddNode(node);
 }
Exemplo n.º 9
0
        public static List <Node> Nodes(this AddFlow addflow, bool returnReversed = false)
        {
            List <Node> listOfNodes = addflow.Items.OfType <Node>().ToList();

            if (returnReversed)
            {
                listOfNodes.Reverse();
            }
            return(listOfNodes);
        }
Exemplo n.º 10
0
        private void InitWiringNodes(AddFlow addFlowWiring)
        {
            //addFlowWiring.Controls.Clear();
            addFlowWiring.Clear();

            //addFlowWiring.Nodes.Clear();

            //addFlowWiring.AutoScrollPosition = new Point(0, 0);
            addFlowWiring.ScrollIncrement = new Size(0, 0);
        }
Exemplo n.º 11
0
 public UtilityValidation(old.Project project, ref AddFlow addFlow)
 {
     thisProject      = project;
     addFlowPiping    = addFlow;
     bmpMeasureString = new Bitmap(500, 100);
     gMeasureString   = Graphics.FromImage(this.bmpMeasureString);
     if (SystemSetting.UserSetting.unitsSetting.settingDimension == Unit.ut_Dimension_inch)
     {
         isInch = true;
     }
 }
Exemplo n.º 12
0
        public Link createLine(Node src, Node dst, string linkText, AddFlow flowWiring)
        {
            Link lnk = new Link(src, dst, linkText, flowWiring);

            lnk.StrokeThickness = 1.8;
            lnk.Stroke          = System.Windows.Media.Brushes.DarkGray;
            lnk.IsStretchable   = false;
            lnk.IsSelectable    = false;
            lnk.LineStyle       = LineStyle.Polyline;
            return(lnk);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 绘制各个工位
        /// </summary>
        /// <param name="addflow"></param>
        public List <Node> DrawStation(AddFlow addflow)
        {
            List <Node> list = new List <Node>();
            Node        node = null;
            DataTable   dt   = AsmStation_BLL.GetAllStation();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                node           = new Node(10 + (60 * i), 580, 50, 85, dt.Rows[i]["STATION_NAME"].ToString(), addflow);
                node.Text      = dt.Rows[i]["STATION_NAME"].ToString();
                node.FillColor = Color.White;
                list.Add(node);
            }
            return(list);
        }
Exemplo n.º 14
0
        public void setNode_wiring(Node node, string imgFile, AddFlow addFlowWiring)
        {
            BitmapImage img    = new BitmapImage(new Uri("pack://application:,,," + imgFile, UriKind.RelativeOrAbsolute));
            ImageSource imgSrc = img;

            node.Image = imgSrc;
            var imgWidth  = img.PixelWidth;
            var imgHeight = img.PixelHeight;

            node.Size = new System.Windows.Size(imgWidth, imgHeight);
            node.IsImageSizeFitContentArea = true;
            node.ImagePosition             = ImagePosition.CenterBottom;
            node.Geometry     = new RectangleGeometry(new System.Windows.Rect(0, 0, 0, 0));
            node.BackMode     = BackMode.Transparent;
            node.IsSelectable = false;
            addFlowWiring.AddNode(node);
        }
Exemplo n.º 15
0
        private static void AddNewLinks(MyNodeYP ypNode, List <Link> oldLinks, AddFlow addflow, int pinCount)
        {
            if (oldLinks.Count > 0)
            {
                foreach (var oldLink in oldLinks)
                {
                    var org = oldLink.Org == ypNode ? oldLink.Org : oldLink.Dst;
                    var dst = oldLink.Org == ypNode ? oldLink.Dst : oldLink.Org;

                    var orgIndex = oldLink.Org == ypNode ? oldLink.PinOrgIndex : oldLink.PinDstIndex;
                    var dstIndex = oldLink.Org == ypNode ? oldLink.PinDstIndex : oldLink.PinOrgIndex;

                    Link newLink = new Link(org, dst, orgIndex == 0 ? 0 : pinCount - orgIndex, dstIndex, "", addflow);

                    addflow.AddLink(newLink);
                }
            }
        }
Exemplo n.º 16
0
        private void Form2_Load(object sender, EventArgs e)
        {
            addFlow1 = new AddFlow();
            this.addFlow1.BackColor     = SystemColors.Window;
            this.addFlow1.CursorSetting = Lassalle.Flow.CursorSetting.All;
            //            this.addFlow1.MouseAction = MouseAction.
            this.addFlow1.DefNodeProp.Shape.Style = ShapeStyle.RectEdgeRaised;
            this.addFlow1.DefNodeProp.FillColor   = SystemColors.Control;
            this.addFlow1.DefLinkProp.Jump        = Jump.Arc;
            //this.addFlow1.DefLinkProp.MaxPointsCount = 3;

            GDIDrawFlow.DrawFlowGroup drawFlowGroup1 = new DrawFlowGroup();
            drawFlowGroup1.Dock     = System.Windows.Forms.DockStyle.Fill;
            drawFlowGroup1.Location = new System.Drawing.Point(0, 0);
            drawFlowGroup1.Name     = "drawFlowGroup1";
            drawFlowGroup1.Size     = new System.Drawing.Size(704, 502);
            drawFlowGroup1.TabIndex = 0;

            //this.Controls.Add(drawFlowGroup1);
        }
Exemplo n.º 17
0
        /// <summary>
        /// 创建图
        /// </summary>
        /// <param name="addflow"></param>
        public void CreateDiagram(AddFlow addflow)
        {
            try
            {
                AssemblyCopyrightAttribute aca = new AssemblyCopyrightAttribute("");
                addflow.Dock           = DockStyle.Fill;
                addflow.BorderStyle    = BorderStyle.FixedSingle;
                addflow.BackColor      = Color.AliceBlue;
                addflow.CanStretchLink = false;
                addFlow.CanDrawNode    = false;


                addflow.NodeModel.ShapeFamily   = ShapeFamily.Rectangle;
                addflow.NodeModel.FillColor     = Color.Transparent;
                addflow.NodeModel.GradientColor = Color.Transparent;
                addflow.NodeModel.DrawColor     = Color.Transparent;
                addflow.NodeModel.TextPosition  = TextPosition.CenterBottom;
                addflow.NodeModel.TextColor     = Color.Black;
                addflow.NodeModel.ImagePosition = ImagePosition.CenterTop;
                addflow.NodeModel.IsEditable    = false;
                addflow.NodeModel.IsXSizeable   = false;
                addflow.NodeModel.IsYSizeable   = false;

                addflow.LinkModel.FillColor   = Color.Black;
                addflow.LinkModel.Thickness   = 3;
                addflow.LinkModel.IsAdjustOrg = true;
                addflow.LinkModel.IsAdjustDst = true;

                List <Node> list_station = DrawStation(addflow);
                for (int i = 0; i < list_station.Count; i++)
                {
                    Image img = new Bitmap(System.Environment.CurrentDirectory.Substring(0, System.Environment.CurrentDirectory.Length - 10) + "\\Resources\\station.png");
                    list_station[i].Image = img;
                    addflow.AddNode(list_station[i]);
                }
                var nodes = addflow.Items.OfType <Node>().ToArray();
            }
            catch (Exception e1)
            {
            }
        }
Exemplo n.º 18
0
 /// <summary>
 /// Constructor for PlottingScaleHandler
 /// </summary>
 public PlottingScaleHandler(AddFlow addFlowControl)
 {
     addFlow    = addFlowControl;
     meterValue = 0;
     plottingScaleColorToUse = Colors.Black;
 }
Exemplo n.º 19
0
 public static List <Node> Nodes(this AddFlow addflow)
 {
     return(addflow.Items.OfType <Node>().ToList());
 }
Exemplo n.º 20
0
        public static void RotateYpNode(this MyNodeYP ypNode, double angle, AddFlow addflow)
        {
            if (ypNode == null)
            {
                return;
            }

            if (ypNode.Tooltip.ToString().Equals(JCHVRF.Model.NodeType.YP.ToString()))
            {
                return;
            }

            var pinCount = ypNode.PinsLayout.Count;

            var is8HeaderBranch = pinCount == 9?true:false;

            ypNode.PinsLayout.Clear();

            if (angle == -90)
            {
                var oldLinks = new List <Link>(ypNode.Links);
                RemoveOldLinks(oldLinks, addflow);

                var oldCenterLocation = new Point(ypNode.Location.X + ypNode.Size.Width / 2, ypNode.Location.Y + ypNode.Size.Height / 2);

                ypNode.Size = is8HeaderBranch? new Size(30, 120):new Size(24, 45);

                if (is8HeaderBranch)
                {
                    ypNode.Geometry =
                        Geometry.Parse(
                            "M8.75 2.17H4.09v2.52h4.66v2.17H4.09v2.52h4.66v2.17H4.09v2.52h4.66v2.17H4.09v2.52h4.66v2.17H4.09v2.52h4.66v2.17H4.09v2.52h4.66v2.17H4.09v2.52h4.66V35h-6.7V0h6.7zm-6.7 16.7H0v-2.74h2.05z");

                    var q = 100 / 8;
                    ypNode.PinsLayout.Add(new Point(0, 50));
                    ypNode.PinsLayout.Add(new Point(100, q - 10));
                    ypNode.PinsLayout.Add(new Point(100, (2 * q) - 9));
                    ypNode.PinsLayout.Add(new Point(100, (3 * q) - 8));
                    ypNode.PinsLayout.Add(new Point(100, (4 * q) - 6));
                    ypNode.PinsLayout.Add(new Point(100, (5 * q) - 4));
                    ypNode.PinsLayout.Add(new Point(100, (6 * q) - 3));
                    ypNode.PinsLayout.Add(new Point(100, 7 * q));
                    ypNode.PinsLayout.Add(new Point(100, 8 * q));
                }
                else
                {
                    ypNode.Geometry =
                        Geometry.Parse(
                            "M13.33 25.08H3.15v-9.89H0v-4.07h3.15V.08h10.18v3.49H6.74v3.48h6.59v4.07H6.88v3.49h6.45v3.49H6.74v3.49h6.59v3.49z");
                    var q = 100 / 4;
                    ypNode.PinsLayout.Add(new Point(0, 45));
                    ypNode.PinsLayout.Add(new Point(100, q - 15));
                    ypNode.PinsLayout.Add(new Point(100, (2 * q) - 15));
                    ypNode.PinsLayout.Add(new Point(100, (3 * q) - 10));
                    ypNode.PinsLayout.Add(new Point(100, (4 * q) - 10));
                }

                var newLocation = new Point(oldCenterLocation.X - ypNode.Size.Width / 2,
                                            oldCenterLocation.Y - ypNode.Size.Height / 2);
                ypNode.Location = newLocation;

                AddNewLinks(ypNode, oldLinks, addflow, pinCount);
            }
            else if (angle == 0)
            {
                var oldLinks = new List <Link>(ypNode.Links);
                RemoveOldLinks(oldLinks, addflow);

                var oldCenterLocation = new Point(ypNode.Location.X + ypNode.Size.Width / 2, ypNode.Location.Y + ypNode.Size.Height / 2);

                ypNode.Size = is8HeaderBranch? new Size(120, 30):new Size(45, 24);
                if (is8HeaderBranch)
                {
                    ypNode.Geometry =
                        Geometry.Parse(
                            "M56.274 15V7.013H51.96V15h-3.725V7.013h-4.314V15H40.2V7.013h-4.314V15h-3.725V7.013h-4.314V15h-3.725V7.013H19.8V15h-3.726V7.013H11.76V15H8.035V7.013H3.721V15H0V3.507h60V15zM27.647 3.507V0h4.706v3.507z");
                    var q = 100 / 8;
                    ypNode.PinsLayout.Add(new Point(50, 0));
                    ypNode.PinsLayout.Add(new Point(q - 10, 100));
                    ypNode.PinsLayout.Add(new Point((2 * q) - 9, 100));
                    ypNode.PinsLayout.Add(new Point((3 * q) - 8, 100));
                    ypNode.PinsLayout.Add(new Point((4 * q) - 6, 100));
                    ypNode.PinsLayout.Add(new Point((5 * q) - 4, 100));
                    ypNode.PinsLayout.Add(new Point((6 * q) - 3, 100));
                    ypNode.PinsLayout.Add(new Point(7 * q, 100));
                    ypNode.PinsLayout.Add(new Point(8 * q, 100));
                }
                else
                {
                    ypNode.Geometry =
                        Geometry.Parse(
                            "M-.138 24V5.677h17.791V0h7.325v5.677h19.884V24h-6.279V12.13h-6.28V24h-7.326V12.387h-6.279V24h-6.279V12.13h-6.28V24H-.138z");
                    var q = 100 / 4;
                    ypNode.PinsLayout.Add(new Point(45, 0));
                    ypNode.PinsLayout.Add(new Point(q - 15, 100));
                    ypNode.PinsLayout.Add(new Point((2 * q) - 15, 100));
                    ypNode.PinsLayout.Add(new Point((3 * q) - 10, 100));
                    ypNode.PinsLayout.Add(new Point((4 * q) - 10, 100));
                }

                var newLocation = new Point(oldCenterLocation.X - ypNode.Size.Width / 2,
                                            oldCenterLocation.Y - ypNode.Size.Height / 2);
                ypNode.Location = newLocation;

                AddNewLinks(ypNode, oldLinks, addflow, pinCount);
            }
        }