Пример #1
0
        List <object> calcOuterBoundary(CContour ccontour)
        {
            if (ccontour.isClosed)
            {
                return(null);
            }
            int           loopCount      = 0;
            List <object> resultBoundary = new List <object>();
            CPoint        startp         = ccontour.StartP;
            CBoundary     cb             = startp.Boundary;
            CContour      ccontour2      = ccontour;

            while (loopCount++ > 10)
            {
                CPoint greaterCPoint = cb.getGreaterCPoint(startp);
                if (greaterCPoint == null)
                {
                    return(null);
                }
                resultBoundary.Add(ccontour2);
                resultBoundary.Add(startp);
                resultBoundary.Add(greaterCPoint);
                if (greaterCPoint == ccontour.endP)
                {
                    return(resultBoundary);
                }
                ccontour2 = greaterCPoint.contour;
                if (ccontour2.StartP == greaterCPoint)
                {
                    startp = ccontour2.endP;
                }
                else if (ccontour2.endP == greaterCPoint)
                {
                    startp = ccontour2.StartP;
                }
                else
                {
                    throw new System.Exception("ContourColorize 116");
                }

                cb = startp.Boundary;
            }
            return(null);
        }
Пример #2
0
        public void calcIntersection()
        {
            ObjectId[]       boundary = Selection.getBoundarys();
            List <CBoundary> cbs      = new List <CBoundary>();
            Database         db       = HostApplicationServices.WorkingDatabase;

            using (Transaction trans = db.TransactionManager.StartTransaction()){
                for (int n = 0; n < boundary.Length; n++)
                {
                    Polyline3d pl = trans.GetObject(boundary[n], OpenMode.ForRead) as Polyline3d;
                    if (pl == null)
                    {
                        continue;
                    }
                    CBoundary cb = new CBoundary(pl);
                }
                for (int i = 0; i < this.ccontours.Count; i++)
                {
                    CContour cc = this.ccontours[i];
                    if (cc.isClosed)
                    {
                        continue;
                    }
                    for (int j = 0; j < cbs.Count; j++)
                    {
                        CBoundary  cb = cbs[j];
                        Polyline3d pl = cb.pl3d;
                        double     p  = pl.GetParameterAtPoint(cc.StartP.point);
                        if (p >= 0)
                        {
                            cc.StartP.param    = p;
                            cc.StartP.Boundary = cb;
                        }
                        p = pl.GetParameterAtPoint(cc.endP.point);
                        if (p >= 0)
                        {
                            cc.endP.param    = p;
                            cc.endP.Boundary = cb;
                        }
                    }
                }
            }
        }
Пример #3
0
 public void addContour(List <PLine> plines, double elevation)
 {
     for (int i = 0; i < plines.Count; i++)
     {
         CContour cc = new CContour();
         cc.elevation = elevation;
         PLine pl = plines[i];
         cc.isClosed = pl.IsClosed;
         cc.pline    = pl;
         if (!cc.isClosed)
         {
             cc.StartP           = MyConvert.toCPoint(pl.GetVertices()[0]);
             cc.StartP.elevation = elevation;
             cc.endP             = MyConvert.toCPoint(pl.GetVertices()[pl.GetVertices().Count - 1]);
             cc.endP.elevation   = elevation;
         }
         ccontours.Add(cc);
     }
 }