Esempio n. 1
0
        public PipeLine GenerateFromSimpleJoint(SimplePipeJoint pipeJoint, Point3d ePoint, double width)
        {
            //

            this.CenterPoint = pipeJoint.CenterPoint;
            PipeLine pipeline1 = pipeJoint.GetConnectedPipeLine(0);
            PipeLine pipeline2 = pipeJoint.GetConnectedPipeLine(1);
            Point3d  p1        = CenterPoint + (pipeline1.Point(0) - CenterPoint).GetNormal() * Length;
            Point3d  p2        = CenterPoint + (pipeline2.Point(0) - CenterPoint).GetNormal() * Length;
            Point3d  p3        = CenterPoint + (ePoint - CenterPoint).GetNormal() * Length;

            if (pipeline1.HeadConnectedObject == pipeJoint)
            {
                pipeline1.HeadConnectedObject = this;
                pipeline1.UpdateStartPoint(p1);
            }
            if (pipeline1.TailConnectedObject == pipeJoint)
            {
                pipeline1.TailConnectedObject = this;
                pipeline1.UpdateEndPoint(p1);
            }
            if (pipeline2.HeadConnectedObject == pipeJoint)
            {
                pipeline2.HeadConnectedObject = this;
                pipeline2.UpdateStartPoint(p2);
            }
            if (pipeline2.TailConnectedObject == pipeJoint)
            {
                pipeline2.TailConnectedObject = this;
                pipeline2.UpdateEndPoint(p2);
            }
            PipeLine        pipeline3 = new PipeLine(p3, ePoint, false, OwnSolution, true);
            List <PipeLine> lists     = new List <PipeLine>();

            lists.Add(pipeline1);
            lists.Add(pipeline2);
            lists.Add(pipeline3);
            this.SetPipeLines(lists);
            this.GenerateFromConnectedPipes();
            pipeJoint.RemoveEntity();
            return(pipeline3);
        }
        /// <summary>
        /// 将要删除管道
        /// 删除管道的时候要对其相邻的结头进行处理
        /// </summary>
        /// <param name="id"></param>
        /// <returns>同上</returns>
        public bool WillDeletePipeLine(ObjectId id)
        {
            if (this.PipeLines.ContainsKey(id))
            {
                //

                PipeLine pLine = this.PipeLines[id];
                this.CurrentLineStyle = pLine.Style;
                this.PipeLines.Remove(id);
                if (pLine.HeadConnectedObject is SimplePipeJoint)
                {
                    SimplePipeJoint jo = (SimplePipeJoint)pLine.HeadConnectedObject;
                    foreach (var item in jo.ConnectedPipes)
                    {
                        item.RemoveJoint(jo);
                    }
                    jo.RemoveEntity();
                }
                else if (pLine.HeadConnectedObject is MultiPipeJoint)
                {
                    MultiPipeJoint jo = (MultiPipeJoint)pLine.HeadConnectedObject;
                    jo.DownGrade(pLine);
                }
                if (pLine.TailConnectedObject is SimplePipeJoint)
                {
                    SimplePipeJoint jo = (SimplePipeJoint)pLine.TailConnectedObject;
                    foreach (var item in jo.ConnectedPipes)
                    {
                        item.RemoveJoint(jo);
                    }
                    jo.RemoveEntity();
                }
                else if (pLine.TailConnectedObject is MultiPipeJoint)
                {
                    MultiPipeJoint jo = (MultiPipeJoint)pLine.TailConnectedObject;
                    jo.DownGrade(pLine);
                }
                return(true);
            }
            return(false);
        }