Inheritance: System.Item
Esempio n. 1
0
        public TracingData(PartData firstPartData, PartData secondPartData)
            : this()
        {
            if (firstPartData != null)
            {
                FirstPartNumber = firstPartData.Number;
                FirstPartTypeDescription = firstPartData.PartTypeDescription;
                FirstPartLength = firstPartData.Length;
            }

            if (secondPartData != null)
            {
                SecondPartNumber = secondPartData.Number;
                SecondPartTypeDescription = secondPartData.PartTypeDescription;
                SecondPartLength = secondPartData.Length;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Bild the ConnectorsCount string according
        /// to format: "free connectors count = N"("diameter_1", "diameter_2", ... "diameter_N")
        /// </summary>
        /// <param name="partData"></param>
        private void SetConnectorsCountString(PartData partData)
        {
            string diameterList = string.Empty;

            foreach (var c in partData.Connectors)
            {
                if (diameterList == string.Empty)
                {
                    diameterList = Convert.ToString(c.Diameter);
                }
                else
                {
                    diameterList = string.Concat(diameterList, ", ", Convert.ToString(c.Diameter));
                }
            }

            partData.ConnectorsCount = string.Concat(partData.Connectors.Count, "(", diameterList, ")");
        }
Esempio n. 3
0
      public PartDataObject(PartData part)
      {
         this.Id = part.Id;
         this.PartType = part.PartType;
         this.Number = part.Number;
         this.PartTypeDescription = part.PartTypeDescription;
         this.Length = part.Length;
         this.Diameter = part.Diameter;
         this.WallThickness = part.WallThickness;
         this.ConstructionStatus = part.ConstructionStatus;
         this.ConnectorsCount = part.ConnectorsCount;

         if (part.Connectors != null)
         {
            Connectors = new List<ConnectorObject>();
            foreach (var c in part.Connectors)
            {
               Connectors.Add(new ConnectorObject(c));
            }
         }
      }
Esempio n. 4
0
        public List <List <PipelineVertex> > Pathfinder(
            construct.PartData startPartData,
            construct.PartData endPartData)
        {
            List <List <PipelineVertex> > paths = new List <List <PipelineVertex> >();
            Stack <PipelineVertex>        stack = new Stack <PipelineVertex>();

            try
            {
                var startPiece = piecesVertex[startPartData.Id];
                var endPiece   = piecesVertex[endPartData.Id];

                stack.Push(startPiece);

                List <JointEdge> joints = stack.Peek().JointsEdge;

                int[] path = new int[this.piecesVertex.Count];

                int k = 0;

                while (stack.Count > 0 && paths.Count < maximumPathsNumber)
                {
                    while (k < joints.Count)
                    {
                        for (int i = 0; i < jointPartVertexCount; ++i)
                        {
                            if (!stack.Contains(joints[k].PartsVertex[i]))
                            {
                                path[stack.Count - 1] = k;
                                stack.Push(joints[k].PartsVertex[i]);
                                joints = stack.Peek().JointsEdge;
                                k      = 0;
                                break;
                            }
                            else if (i == 1)
                            {
                                ++k;
                            }
                        }
                        if (stack.Peek() == endPiece)
                        {
                            paths.Add(stack.ToList <PipelineVertex>());
                            break;
                        }
                    }

                    if (stack.Count > 1)
                    {
                        stack.Pop();
                        joints = stack.Peek().JointsEdge;

                        path[stack.Count - 1]++;

                        k = path[stack.Count - 1];
                    }
                    else
                    {
                        break;
                    }
                }
            }
            catch (KeyNotFoundException e)
            {
                log.Error(
                    string.Format(
                        "The one of requested keys is not in the dictionary of welded parts: start Part #{0}, id:{1}; end Part #{2}, id:{3}",
                        startPartData.Number, startPartData.Id,
                        endPartData.Number, endPartData.Id));

                throw e;
            }
            return(paths);
        }
Esempio n. 5
0
 public void AddPipelineVertex(construct.PartData partData)
 {
     piecesVertex.Add(partData.Id, new PipelineVertex(partData));
 }
Esempio n. 6
0
 public PipelineVertex(construct.PartData data)
 {
     Data       = data;
     JointsEdge = new List <JointEdge>();
 }
Esempio n. 7
0
        /// <summary>
        /// Bild the ConnectorsCount string according 
        /// to format: "free connectors count = N"("diameter_1", "diameter_2", ... "diameter_N")
        /// </summary>
        /// <param name="partData"></param>
        private void SetConnectorsCountString(PartData partData)
        {
            string diameterList = string.Empty;

            foreach (var c in partData.Connectors)
            {
                if (diameterList == string.Empty)
                {
                    diameterList = Convert.ToString(c.Diameter);
                }
                else
                {
                    diameterList = string.Concat(diameterList, ", ", Convert.ToString(c.Diameter));
                }
            }

            partData.ConnectorsCount = string.Concat(partData.Connectors.Count, "(", diameterList, ")");
        }
Esempio n. 8
0
        private IList<PartData> FormWeldedParts(DataTable dataTable)
        {
            List<PartData> list = new List<PartData>();

            dataTable.Columns.Add("typeTranslated", typeof(String));

            foreach (DataRow row in dataTable.Rows)
            {
                if (row.Field<string>("type") != "Component")
                {
                    PartType result = (PartType)Enum.Parse(typeof(PartType), row.Field<string>("type"));
                    row.SetField(
                        "typeTranslated",
                        viewModel.localizedPartType[(int)((object)result) - 1]);
                }
                else
                {
                    row.SetField(
                        "typeTranslated",
                        row.Field<string>("componentTypeName"));
                }

                PartData p = new PartData()
                {
                    Id = row.Field<Guid>("id"),
                    Number = row.Field<string>("number"),
                    PartType = (PartType)Enum.Parse(typeof(PartType), row.Field<string>("type")),
                    Length = row.Field<int>("length"),
                    PartTypeDescription = row.Field<string>("typeTranslated")
                };

                list.Add(p);
            }

            return list;
        }