Example #1
0
        checkBegAndEndDesc(ObjectId idAlign, ref List <POI> varpoi)
        {
            Alignment objAlign = (Alignment)idAlign.getEnt();

            double dblStaBeg = Math.roundDown3((objAlign.StartingStation));
            double dblStaEnd = Math.roundDown3((objAlign.EndingStation));

            POI vpoi = varpoi[0];

            if (vpoi.Station == dblStaBeg)
            {
                vpoi.Desc0 = vpoi.Desc0.Replace("AP", "BEG");
                vpoi.Desc0 = vpoi.Desc0.Replace("HC", "BEG");
                vpoi.Desc0 = vpoi.Desc0.Replace("HE", "BEG");
                vpoi.DescX = vpoi.Desc0;
                varpoi[0]  = vpoi;
            }

            int j = varpoi.Count - 1;

            vpoi = varpoi[j];

            if (vpoi.Station == dblStaEnd)
            {
                vpoi.Desc0 = vpoi.Desc0.Replace("AP", "END");
                vpoi.Desc0 = vpoi.Desc0.Replace("HC", "END");
                vpoi.Desc0 = vpoi.Desc0.Replace("HE", "END");
                vpoi.DescX = vpoi.Desc0;
                varpoi[j]  = vpoi;
            }
        }
Example #2
0
        getPVI(ObjectId idAlign, double dblStation, ref List <POI> varpoi, double dblHeightCurb, ref bool boolNewPVI)
        {
            bool boolFound = false;

            Profile objProfileFLOWLINE          = Prof.getProfile(idAlign, "FLOWLINE");
            Profile objProfileSTAKE             = Prof.getProfile(idAlign, "STAKE");
            ProfilePVICollection objProfilePVIs = objProfileSTAKE.PVIs;

            double dblProfileElev = System.Math.Round(objProfileFLOWLINE.ElevationAt(dblStation) + dblHeightCurb / 12, 3);

            for (int i = 0; i <= objProfilePVIs.Count - 1; i++)
            {
                ProfilePVI objProfilePVI = objProfilePVIs[i];

                if (Math.roundDown1((objProfilePVI.Station)) == Math.roundDown1(dblStation))
                {
                    objProfilePVI.Elevation = dblProfileElev;
                    boolFound = true;

                    break;
                }
            }

            if (boolFound)
            {
                for (int k = 0; k < varpoi.Count; k++)
                {
                    if (varpoi[k].Station == Math.roundDown3(dblStation))
                    {
                        check4GradeBreak(k, varpoi);
                    }
                }

                boolFound = false;
            }
            else
            {
                boolNewPVI = true;
                ProfilePVI objProfilePVI = objProfilePVIs.AddPVI(dblStation, dblProfileElev);

                varpoi.Add(new POI {
                    Station = Math.roundDown3(dblStation), Elevation = dblProfileElev, ClassObj = fStake.ClassObj
                });

                var sortSta = from p in varpoi
                              orderby p.Station
                              select p;
                int j = 0;
                foreach (var p in sortSta)
                {
                    j += 1;
                    if (Math.roundDown3(dblStation) == p.Station)
                    {
                        check4GradeBreak(j, varpoi);
                        break;
                    }
                }
            }
        }
Example #3
0
        getStationsOnTangent(ref int i, List <POI> varpoi, double dblInterval0, double dblTolerance)
        {
            bool   boolAddRemain = false;
            double dblDistance   = (varpoi[i + 0].Station - varpoi[i - 1].Station);

            int intSEGs = (int)System.Math.Truncate(dblDistance / dblInterval0);

            if (dblDistance % dblInterval0 != 0)
            {
                if (dblDistance - (intSEGs * dblInterval0) < dblTolerance)
                {
                    boolAddRemain = true;
                }
                else
                {
                    boolAddRemain = false;
                }
            }

            switch (intSEGs)
            {
            case 0:
                break;                   //do nothing

            case 1:
                if (!boolAddRemain)
                {
                    varpoi.Add(new POI {
                        Station = Math.roundDown3(varpoi[i - 1].Station + dblInterval0), Desc0 = "", ClassObj = fStake.ClassObj
                    });
                }
                break;

            default:
                varpoi.Add(new POI {
                    Station = Math.roundDown3(varpoi[i - 1].Station + dblInterval0), Desc0 = "", ClassObj = fStake.ClassObj
                });

                for (int j = 2; j < intSEGs; j++)
                {
                    varpoi.Add(new POI {
                        Station = Math.roundDown3(varpoi[varpoi.Count - 1].Station + dblInterval0), Desc0 = "", ClassObj = fStake.ClassObj
                    });
                }

                if (!boolAddRemain)    //if booAddRemain is true then skip adding last point
                {
                    varpoi.Add(new POI {
                        Station = Math.roundDown3(varpoi[varpoi.Count - 1].Station + dblInterval0), Desc0 = "", ClassObj = fStake.ClassObj
                    });
                }

                break;
            }
        }
Example #4
0
        checkBegAndEndStations(ObjectId idAlign, ref List <POI> varpoi)
        {
            Alignment objAlign = (Alignment)idAlign.getEnt();

            double dblStaBeg = Math.roundDown3((objAlign.StartingStation));
            double dblStaEnd = Math.roundDown3((objAlign.EndingStation));

            if (varpoi.Count == 0)
            {
                return;
            }
            double dblEasting = 0, dblNorthing = 0;

            varpoi = varpoi.sortPOIbyStation();
            int j    = varpoi.Count - 1;
            POI vpoi = varpoi[j];

            if (vpoi.Station != dblStaEnd)
            {
                idAlign.getAlignPointLoc(dblStaEnd - 0.001, 0.0, ref dblEasting, ref dblNorthing);

                vpoi.Station  = Math.roundDown3(dblStaEnd);
                vpoi.Desc0    = "END";
                vpoi.ClassObj = fStake.ClassObj;

                varpoi.Add(vpoi);
            }
            else
            {
                vpoi.DescX = "END";
                varpoi[j]  = vpoi;
            }

            if (System.Math.Round(varpoi[0].Station, 3) != dblStaBeg)
            {
                idAlign.getAlignPointLoc(dblStaBeg, 0.0, ref dblEasting, ref dblNorthing);

                vpoi          = new POI();
                vpoi.Station  = dblStaBeg;
                vpoi.Desc0    = "BEG";
                vpoi.ClassObj = fStake.ClassObj;

                varpoi.Add(vpoi);
            }
            else
            {
                vpoi       = varpoi[0];
                vpoi.DescX = "BEG";
                varpoi[0]  = vpoi;
            }

            varpoi = varpoi.sortPOIbyStation();
        }
Example #5
0
        getElev(Point3d pnt3dInt, ObjectId id3dBoundary)
        {
            double         dblElev = 0;
            List <Point3d> pnts3d  = id3dBoundary.getCoordinates3dList();

            for (int i = 0; i < pnts3d.Count; i++)
            {
                if (Math.roundDown2(pnt3dInt.X) == Math.roundDown2(pnts3d[i].X) &&
                    Math.roundDown2(pnt3dInt.Y) == Math.roundDown2(pnts3d[i].Y))
                {
                    dblElev = pnts3d[i].Z;
                    break;
                }
            }
            return(dblElev);
        }
Example #6
0
        getCurbTransitions()
        {
            Alignment objAlign = fStake.ACTIVEALIGN;
            ObjectId  idAlign  = objAlign.ObjectId;

            if (idAlign == ObjectId.Null)
            {
                Point3d pnt3dPicked = Pub.pnt3dO;
                string  nameAlign   = "";
                idAlign  = Align.selectAlign("\nSelect Curb Alignment: ", "\nAlignment selection failed.", out pnt3dPicked, out nameAlign);
                objAlign = (Alignment)idAlign.getEnt();
            }

            ObjectId idTable = Stake_Table.getTableId(idAlign);

            List <POI>   varpoi        = fStake.POI_CALC;
            string       strResponse   = "";
            bool         escape        = UserInput.getUserInput("\nEnter Curb Height in INCHES: ", out strResponse);
            double       dblHeightCurb = Double.Parse(strResponse);
            Point3d      varPntPick    = Pub.pnt3dO;
            PromptStatus ps;
            double       dblStation = 0, dblOffset = 0;
            bool         boolNewPVI = false;

            do
            {
                try
                {
                    varPntPick = UserInput.getPoint("\nSelect Location to Adjust: ", out ps, osMode: 8);
                }
                catch (System.Exception)
                {
                    break;
                }

                objAlign.StationOffset(varPntPick.X, varPntPick.Y, ref dblStation, ref dblOffset);
                getPVI(idAlign, Math.roundDown3(dblStation), ref varpoi, dblHeightCurb, ref boolNewPVI);
            }while (true);

            fStake.POI_CALC = varpoi;

            if (boolNewPVI)
            {
                Stake_Table.updateTableData(idTable, varpoi);
            }
        }
Example #7
0
        getStationsOnTangentEVENS(ref int i, List <POI> varpoi, double dblInterval0, double dblTolerance)
        {
            double dblDistance = (varpoi[i + 0].Station - varpoi[i - 1].Station);

            int j         = 1;
            int intervalX = 0;

            do
            {
                if (dblDistance / j < dblInterval0 + dblTolerance)
                {
                    intervalX = j;
                    break;
                }
                else
                {
                    j += 1;
                }
            } while (true);

            switch (intervalX)
            {
            case 0:
            case 1:
                break;                    //do nothing

            default:
                varpoi.Add(new POI {
                    Station = Math.roundDown3(varpoi[i - 1].Station + dblDistance / intervalX), Desc0 = "", ClassObj = fStake.ClassObj
                });

                for (j = 2; j <= intervalX - 1; j++)
                {
                    varpoi.Add(new POI {
                        Station = Math.roundDown3(varpoi[varpoi.Count - 1].Station + dblDistance / intervalX), Desc0 = "", ClassObj = fStake.ClassObj
                    });
                }
                break;
            }
        }
Example #8
0
        getBldgElev(ObjectId idAlign, ref List <POI> varpoi)
        {
            ResultBuffer rb = idAlign.getXData("BLDG");

            if (rb == null)
            {
                return;
            }
            TypedValue[] tvs = rb.AsArray();

            Point3d pnt3dCen = new Point3d(double.Parse(tvs[1].Value.ToString()),
                                           double.Parse(tvs[2].Value.ToString()),
                                           double.Parse(tvs[3].Value.ToString()));

            double dblAngTar = double.Parse(tvs[4].Value.ToString());
            double dblSlope  = double.Parse(tvs[5].Value.ToString());

            Point3d pnt3dTar = pnt3dCen.traverse(dblAngTar, 100, dblSlope);

            Debug.Print("BEGIN GET BLDG ELEV");
            double    dblEasting = 0, dblNorthing = 0;
            Alignment objAlign = (Alignment)idAlign.getEnt();

            for (int i = 0; i < varpoi.Count; i++)
            {
                objAlign.PointLocation(varpoi[i].Station, varpoi[i].OFFSET, ref dblEasting, ref dblNorthing);
                Point3d pnt3dX = new Point3d(dblEasting, dblNorthing, 0);
                double  elev   = pnt3dTar.Z + Geom.getCosineComponent(pnt3dCen, pnt3dTar, pnt3dX) * (dblSlope * -1);
                pnt3dX = pnt3dX.addElevation(elev);
                POI vpoi = varpoi[i];
                vpoi.Elevation = Math.roundDown2(pnt3dX.Z);
                varpoi[i]      = vpoi;

                Debug.Print(varpoi[i].Station + " " + varpoi[i].Elevation + " " + varpoi[i].Desc0);
            }

            Debug.Print("END GET BLDG ELEV");
        }
Example #9
0
        getSurfaceElev(double dblX, double dblY, TinSurface objSurface)
        {
            double dblElev = 0;
            double dblXX   = 0;
            double dblYY   = 0;

            dblElev = objSurface.FindElevationAtXY(dblX, dblY);

            if (dblElev > 0)
            {
                dblXX   = Math.roundDown2(dblX);
                dblYY   = Math.roundDown2(dblY);
                dblElev = objSurface.FindElevationAtXY(dblXX, dblYY);
            }

            if (dblElev < 0)
            {
                dblXX   = Math.roundUP2(dblX);
                dblYY   = Math.roundUP2(dblY);
                dblElev = objSurface.FindElevationAtXY(dblXX, dblYY);
            }

            return(dblElev);
        }
Example #10
0
        resolveDuplicateStationsGrid(List <POI> varpoi)
        {
            //BEGIN RESOLVE DUPLICATE STATIONS GRID

            List <POI> varPOI_LIM = new List <POI>();
            List <POI> varPOI_IN  = new List <POI>();
            int        k          = -1;

            for (int i = 0; i < varpoi.Count; i++)
            {
                if (varpoi[i].OFFSET == 0)
                {
                    varPOI_LIM.Add(varpoi[i]);
                }
                else
                {
                    varPOI_IN.Add(varpoi[i]);
                    k++;
                }
            }

            Debug.Print("BEGIN RESOLVE DUPLICATE STATIONS GRID");

            int        j           = -1;
            List <POI> varPOI_Temp = new List <POI>();

            varPOI_Temp.Add(varPOI_LIM[0]);
            j++;

            Debug.Print("0" + " " + varPOI_Temp[0].Station + " " + varPOI_Temp[0].Elevation + " " + varPOI_Temp[0].Desc0 + "   " + varPOI_Temp[0].DescX);

            for (int i = 1; i < varPOI_LIM.Count; i++)
            {
                if (System.Math.Abs(Math.roundDown2(varPOI_LIM[i - 1].Station) - Math.roundDown2(varPOI_LIM[i - 0].Station)) > 0.1)
                {
                    varPOI_Temp.Add(varPOI_LIM[i - 0]);
                    j++;
                }
                else if (varPOI_LIM[i - 1].Desc0.Substring(0, 2) == "AP")
                {
                    varPOI_LIM[i - 1].DescX = varPOI_LIM[i - 0].DescX;
                    varPOI_Temp[j]          = varPOI_LIM[i - 1];
                }
                else if (varPOI_LIM[i - 0].Desc0.Substring(0, 2) == "AP")
                {
                    varPOI_LIM[i - 0].DescX = varPOI_LIM[i - 1].DescX;
                    varPOI_Temp[j]          = varPOI_LIM[i - 0];
                }

                Debug.Print(j + " " + varPOI_Temp[j].Station + " " + varPOI_Temp[j].Elevation + " " + varPOI_Temp[j].Desc0 + "   " + varPOI_Temp[j].DescX);
            }

            varPOI_Temp[j].DescX = varPOI_Temp[0].DescX;

            varpoi = new List <POI>();

            for (int i = 0; i <= j; i++)
            {
                varpoi.Add(varPOI_Temp[i]);
            }

            for (int i = j + 1; i <= j + k + 1; i++)
            {
                varpoi[i] = varPOI_IN[i - j - 1];
            }

            Debug.Print("END RESOLVE DUPLICATE STATIONS GRID");
            //END RESOLVE DUPLICATE STATIONS GRID
        }
Example #11
0
        resolveDuplicateStations(ref List <POI> varpoi)
        {
            var sortSta = from p in varpoi
                          orderby p.Station ascending
                          select p;

            List <POI> poiTmp = new List <POI>();

            foreach (var p in sortSta)
            {
                poiTmp.Add(p);
            }

            varpoi = poiTmp;

            //BEGIN RESOLVE DUPLICATE STATIONS
            Debug.Print("BEGIN RESOLVE DUPLICATE STATIONS");

            int        j           = -1;
            List <POI> varPOI_Temp = new List <POI>();

            varPOI_Temp.Add(varpoi[0]);
            j++;

            Debug.Print("0" + " " + varpoi[0].Station + " " + varpoi[0].Elevation + " " + varpoi[0].Desc0 + "   " + varpoi[0].DescX);
            string strDesc = ""; int intLen = 0;

            for (int i = 1; i < varpoi.Count; i++)
            {
                if (System.Math.Abs(Math.roundDown2(varpoi[i - 1].Station) - Math.roundDown2(varpoi[i - 0].Station)) > 0.1)
                {
                    if (varpoi[i - 0].Desc0.Substring(0, 2) != "HE")
                    {
                        string descx = string.Format("{0} {1}", varpoi[i - 0].Desc0, varpoi[i - 0].DescX.Replace("HC", "").Trim());
                        varpoi[i - 0].DescX = descx;
                    }

                    varPOI_Temp.Add(varpoi[i - 0]);
                    j++;
                }
                else
                {
                    switch (varpoi[i - 1].Desc0.Substring(0, 2)) //(i-1) PREVIOUS
                    {
                    case "AP":                                   //(i-1) PREVIOUS
                        switch (varpoi[i - 0].Desc0)
                        {
                        case "TEE":        //(i-0) CURRENT
                            varpoi[i - 1].DescX = "AP/TEE";
                            varPOI_Temp[j]      = varpoi[i - 1];
                            break;

                        case "BEG":
                        case "END":        //(i-0) CURRENT
                            varpoi[i - 0].DescX = varpoi[i - 0].Desc0;
                            varPOI_Temp[j]      = varpoi[i - 0];
                            break;

                        case "GB":
                        case "GB LP":
                        case "GB HP":        //(i-0) CURRENT

                            //CHECK NEXT
                            varpoi[i - 0].DescX       = varpoi[i - 1].Desc0 + " " + varpoi[i - 0].Desc0;
                            varpoi[i - 0].Desc0       = varpoi[i - 1].Desc0;
                            varpoi[i - 0].AngDelta    = varpoi[i - 1].AngDelta;
                            varpoi[i - 0].AngDir      = varpoi[i - 1].AngDir;
                            varpoi[i - 0].isRightHand = varpoi[i - 1].isRightHand;

                            varPOI_Temp[j] = varpoi[i - 0];

                            break;
                        }

                        break;

                    case "BE":    //BEG         '(i-1) PREVIOUS

                        switch (varpoi[i - 0].Desc0)
                        {
                        case "TEE":        //(i-0) CURRENT

                            varpoi[i - 0].DescX    = "BEG/TEE";
                            varpoi[i - 0].isClosed = varpoi[i - 1].isClosed;
                            varPOI_Temp[j]         = varpoi[i - 0];

                            break;

                        case "GB":
                        case "GB LP":
                        case "GB HP":        //(i-0) CURRENT

                            varpoi[i - 0].DescX    = varpoi[i - 1].Desc0 + " " + varpoi[i - 0].Desc0;
                            varpoi[i - 0].isClosed = varpoi[i - 1].isClosed;
                            varPOI_Temp[j]         = varpoi[i - 0];

                            break;
                        }

                        break;

                    case "BC":    //(i-1) PREVIOUS

                        switch (varpoi[i - 0].Desc0)
                        {
                        case "GB":
                        case "GB LP":
                        case "GB HP":        //(i-0) CURRENT

                            varpoi[i - 0].DescX     = varpoi[i - 1].Desc0 + " " + varpoi[i - 0].Desc0;
                            varpoi[i - 0].Desc0     = varpoi[i - 1].Desc0;
                            varpoi[i - 0].Radius    = varpoi[i - 1].Radius;
                            varpoi[i - 0].CenterPnt = varpoi[i - 1].CenterPnt;
                            varPOI_Temp[j]          = varpoi[i - 0];
                            break;
                        }

                        break;

                    case "EC":    //(i-1) PREVIOUS

                        switch (varpoi[i - 0].Desc0)
                        {
                        case "GB":
                        case "GB LP":
                        case "GB HP":        //(i-0) CURRENT

                            varpoi[i - 0].DescX = varpoi[i - 1].Desc0 + " " + varpoi[i - 0].Desc0;
                            varpoi[i - 0].Desc0 = varpoi[i - 1].Desc0;

                            varPOI_Temp[j] = varpoi[i - 0];

                            break;

                        case "BC":        //(i-0) CURRENT

                            switch (varpoi[i - 1].isRightHand)
                            {
                            case true:

                                switch (varpoi[i - 0].isRightHand)
                                {
                                case true:

                                    strDesc             = varpoi[i - 1].DescX;
                                    intLen              = strDesc.Length;
                                    varpoi[i - 0].DescX = strDesc.Substring(0, intLen - 2) + "/PCC";

                                    break;

                                case false:

                                    strDesc             = varpoi[i - 1].DescX;
                                    intLen              = strDesc.Length;
                                    varpoi[i - 0].DescX = strDesc.Substring(0, intLen - 2) + "/PRC";

                                    break;
                                }

                                break;

                            case false:

                                switch (varpoi[i - 0].isRightHand)
                                {
                                case true:

                                    strDesc             = varpoi[i - 1].DescX;
                                    intLen              = strDesc.Length;
                                    varpoi[i - 0].DescX = strDesc.Substring(0, intLen - 2) + "/PRC";

                                    break;

                                case false:

                                    strDesc             = varpoi[i - 1].DescX;
                                    intLen              = strDesc.Length;
                                    varpoi[i - 0].DescX = strDesc.Substring(0, intLen - 2) + " PCC";

                                    break;
                                }

                                break;
                            }

                            varPOI_Temp[j] = varpoi[i - 0];

                            break;
                        }

                        break;

                    case "GB":    //(i-1) PREVIOUS     "GB LP", "GB HP" is covered

                        switch (varpoi[i - 0].Desc0)
                        {
                        case "BC":
                            varpoi[i - 1].DescX       = varpoi[i - 0].Desc0 + " " + varpoi[i - 1].Desc0;
                            varpoi[i - 1].Desc0       = varpoi[i - 0].Desc0;
                            varpoi[i - 1].Radius      = varpoi[i - 0].Radius;
                            varpoi[i - 1].isRightHand = varpoi[i - 0].isRightHand;
                            varpoi[i - 1].CenterPnt   = varpoi[i - 0].CenterPnt;
                            varPOI_Temp[j]            = varpoi[i - 1];

                            break;

                        case "EC":        //(i-0) CURRENT
                            varpoi[i - 1].DescX = varpoi[i - 0].Desc0 + " " + varpoi[i - 1].Desc0;
                            varpoi[i - 1].Desc0 = varpoi[i - 0].Desc0;
                            varPOI_Temp[j]      = varpoi[i - 1];
                            break;

                        case "AP":        //(i-0) CURRENT

                            varpoi[i - 0].DescX = varpoi[i - 0].Desc0 + " " + varpoi[i - 1].Desc0;
                            varPOI_Temp[j]      = varpoi[i - 0];
                            break;
                        }
                        break;

                    case "HC":    //(i-1) PREVIOUS HORIZONTAL CONTROL

                        switch (varpoi[i - 0].Desc0)
                        {
                        case "AP":        //(i-0) CURRENT
                            string descX = string.Format("{0} {1}", varpoi[i - 0].Desc0, varpoi[i - 1].DescX.Replace("HC", "").Trim());
                            varpoi[i - 0].DescX = descX;
                            varPOI_Temp[j]      = varpoi[i - 0];

                            break;

                        case "BEG":
                        case "END":        //(i-0) CURRENT

                            varpoi[i - 0].DescX    = varpoi[i - 0].Desc0;
                            varpoi[i - 0].isClosed = varpoi[i - 1].isClosed;
                            varPOI_Temp[j]         = varpoi[i - 0];

                            break;

                        case "BC":
                        case "EC":        //(i-0) CURRENT

                            varpoi[i - 0].DescX    = varpoi[i - 0].Desc0;
                            varpoi[i - 0].isClosed = varpoi[i - 1].isClosed;
                            varPOI_Temp[j]         = varpoi[i - 0];

                            break;

                        case "GB":
                        case "GB LP":
                        case "GB HP":        //(i-0) CURRENT

                            varpoi[i - 0].DescX    = varpoi[i - 0].Desc0;
                            varpoi[i - 0].isClosed = varpoi[i - 1].isClosed;
                            varPOI_Temp[j]         = varpoi[i - 0];

                            break;
                        }

                        break;

                    case "HE":
                    case "H0":    //(i-1) PREVIOUS   HORIZONTAL CONTROL WITH INTERPOLATED ELEVATION

                        switch (varpoi[i - 0].Desc0)
                        {
                        case "AP":        //(i-0) CURRENT

                            varpoi[i - 0].DescX = varpoi[i - 0].Desc0;

                            varPOI_Temp[j] = varpoi[i - 0];

                            break;

                        case "BEG":
                        case "END":        //(i-0) CURRENT

                            varpoi[i - 0].DescX    = varpoi[i - 0].Desc0;
                            varpoi[i - 0].isClosed = varpoi[i - 1].isClosed;

                            varPOI_Temp[j] = varpoi[i - 0];

                            break;

                        case "BC":
                        case "EC":        //(i-0) CURRENT

                            varpoi[i - 0].DescX    = varpoi[i - 0].Desc0 + " " + varpoi[i - 1].DescX.Replace("HE", "").Trim();
                            varpoi[i - 0].isClosed = varpoi[i - 1].isClosed;

                            varPOI_Temp[j] = varpoi[i - 0];

                            break;

                        case "GB":
                        case "GB LP":
                        case "GB HP":        //(i-0) CURRENT

                            varpoi[i - 0].DescX    = varpoi[i - 0].Desc0;
                            varpoi[i - 0].isClosed = varpoi[i - 1].isClosed;

                            varPOI_Temp[j] = varpoi[i - 0];

                            break;
                        }

                        break;

                    case "TE":
                        //(i-1) PREVIOUS   TEE

                        switch (varpoi[i - 0].Desc0)
                        {
                        case "AP":
                            //(i-0) CURRENT

                            varpoi[i - 0].DescX = "AP/TEE";

                            varPOI_Temp[j] = varpoi[i - 0];

                            break;

                        case "BEG":
                        case "END":
                            //(i-0) CURRENT

                            varpoi[i - 0].DescX = varpoi[i - 0].Desc0 + "/TEE";

                            varPOI_Temp[j] = varpoi[i - 0];

                            break;
                        }

                        break;

                    default:

                        varpoi[i - 0].DescX = varpoi[i - 0].Desc0;

                        varPOI_Temp[j] = varpoi[i - 0];

                        break;
                    }
                }

                Debug.Print(j + " " + varPOI_Temp[j].Station + " " + varPOI_Temp[j].Elevation + " " + varPOI_Temp[j].Desc0 + "   " + varPOI_Temp[j].DescX);
            }

            varpoi = varPOI_Temp;

            Debug.Print("END RESOLVE DUPLICATE STATIONS");
            //END RESOLVE DUPLICATE STATIONS
        }
Example #12
0
        resolveDuplicateStationsWall(ref List <POI> varpoi)
        {
            List <POI> varPOI_IN = null;

            //BEGIN RESOLVE DUPLICATE STATIONS WALL

            int        j           = -1;
            List <POI> varPOI_Temp = null;

            varPOI_Temp.Add(varpoi[0]);
            j++;

            int k = -1;

            Debug.Print("BEGIN RESOLVE DUPLICATE STATIONS WALL");
            Debug.Print("0" + " " + varpoi[0].Station + " " + varpoi[0].Elevation + " " + varpoi[0].Desc0 + "   " + varpoi[0].DescX);

            for (int i = 1; i < varpoi.Count; i++)
            {
                if (System.Math.Abs(Math.roundDown2(varpoi[i - 1].Station) - Math.roundDown2(varpoi[i - 0].Station)) > 0.1)
                {
                    varPOI_Temp.Add(varpoi[i - 0]);
                    j++;
                }
                else
                {
                    string strDescPrev = varpoi[i - 1].Desc0.Substring(0, 2);
                    string strDescCurr = varpoi[i - 0].Desc0.Substring(0, 2);

                    switch (strDescPrev)
                    {
                    case "HC":
                        switch (strDescCurr)
                        {
                        case "BE":
                        case "EN":

                            varpoi[i - 0].DescX = varpoi[i - 0].Desc0;
                            varPOI_Temp[j]      = varpoi[i - 0];

                            break;

                        case "AP":

                            varpoi[i - 0].DescX = varpoi[i - 1].DescX;
                            varPOI_Temp[j]      = varpoi[i - 0];

                            break;

                        default:

                            varpoi[i - 0].DescX = varpoi[i - 0].Desc0;
                            varPOI_Temp[j]      = varpoi[i - 0];

                            break;
                        }

                        break;

                    case "AP":

                        switch (strDescCurr)
                        {
                        case "TOF":

                            varpoi[i - 1].DescX     = varpoi[i - 1].Desc0 + " " + varpoi[i - 0].Desc0;
                            varpoi[i - 1].Elevation = varpoi[i - 0].Elevation;
                            varPOI_Temp[j]          = varpoi[i - 1];

                            break;

                        case "TOW":

                            varpoi[i - 1].DescX = varpoi[i - 0].DescX;
                            varPOI_Temp[j]      = varpoi[i - 1];

                            break;
                        }

                        break;

                    case "TOF":

                        switch (strDescCurr)
                        {
                        case "AP":

                            varpoi[i - 1].DescX = varpoi[i - 0].DescX;
                            varPOI_Temp[j]      = varpoi[i - 1];

                            break;

                        case "TOW":

                            varpoi[i - 1].DescX = varpoi[i - 0].DescX;
                            varPOI_Temp[j]      = varpoi[i - 1];

                            break;
                        }

                        break;

                    case "TOW":

                        switch (strDescCurr)
                        {
                        case "AP":

                            varpoi[i - 1].DescX = varpoi[i - 0].DescX;
                            varPOI_Temp[j]      = varpoi[i - 1];

                            break;

                        case "TOF":

                            varpoi[i - 1].DescX = varpoi[i - 0].DescX;
                            varPOI_Temp[j]      = varpoi[i - 1];

                            break;
                        }

                        break;
                    }

                    Debug.Print(j + " " + varPOI_Temp[j].Station + " " + varPOI_Temp[j].Elevation + " " + varPOI_Temp[j].Desc0 + "   " + varPOI_Temp[j].DescX);
                }
            }

            varPOI_Temp[j].DescX = varPOI_Temp[0].DescX;

            varpoi = new List <POI>();

            for (int i = 0; i <= j; i++)
            {
                varpoi.Add(varPOI_Temp[i]);
            }

            for (int i = j + 1; i <= j + k + 1; i++)
            {
                varpoi.Add(varPOI_IN[i - j - 1]);
            }

            Debug.Print("END RESOLVE DUPLICATE STATIONS WALL");
            //END RESOLVE DUPLICATE STATIONS WALL
        }
Example #13
0
        getBC_EC(ObjectId idAlign, ref List <POI> varpoi)
        {
            bool      boolExists = false;
            Profile   objProfile = null;
            Alignment objAlign   = (Alignment)idAlign.getEnt();

            try
            {
                objProfile = Prof.getProfile(idAlign, "FLOWLINE");
            }
            catch (System.Exception)
            {
                objProfile = Prof.getProfile(idAlign, "STAKE");
            }

            string strClass = fStake.ClassObj;

            AlignmentEntityCollection objAlignEnts = objAlign.Entities;
            bool isRightHand = false;

            if (objAlignEnts.Count > 1)
            {
                for (int i = 0; i < objAlignEnts.Count; i++)
                {
                    AlignmentEntity objAlignEnt = objAlignEnts[i];

                    if (objAlignEnt.EntityType == AlignmentEntityType.Arc)
                    {
                        boolExists = false;

                        AlignmentArc objAlignEntArc = (AlignmentArc)objAlignEnt;

                        isRightHand = !(objAlignEntArc.Clockwise);
                        double dblStationBC = System.Math.Round(objAlignEntArc.StartStation, 3);

                        int x = 0;
                        for (int j = 0; j < varpoi.Count; j++)
                        {
                            if (System.Math.Abs(varpoi[j].Station - dblStationBC) < 0.05)
                            {
                                boolExists = true;
                                x          = j;
                                break;
                            }
                        }

                        double  dblBulge     = 0;
                        double  dblAngDirCen = objAlignEntArc.StartPoint.getDirection(objAlignEntArc.CenterPoint);//direction to center of arc
                        double  dblAngDelta  = objAlignEntArc.Delta;
                        double  dblRadius    = System.Math.Round(objAlignEntArc.Radius, 2);
                        Point2d dblPntCen    = objAlignEntArc.CenterPoint;

                        if (boolExists)
                        {
                            dblBulge = System.Math.Tan(objAlignEntArc.Delta / 4);

                            if (objAlignEntArc.Clockwise)
                            {
                                dblBulge = dblBulge * -1.0;
                            }

                            POI vpoi = varpoi[x];

                            vpoi.Station = Math.roundDown3(dblStationBC);
                            if (vpoi.Desc0 == "EC")
                            {
                                vpoi.Desc0 = "PCC";
                            }
                            else
                            {
                                vpoi.Desc0 = "BC";
                            }
                            vpoi.AngDir      = dblAngDirCen;
                            vpoi.isRightHand = isRightHand;
                            vpoi.Bulge       = dblBulge;
                            vpoi.Radius      = dblRadius;
                            vpoi.CenterPnt   = new Point3d(dblPntCen.X, dblPntCen.Y, 0);

                            varpoi[x] = vpoi;
                        }
                        else
                        {
                            string strDesc = "BC";
                            double dblElev = 0;

                            try
                            {
                                dblElev = objProfile.ElevationAt(dblStationBC);
                            }
                            catch (System.Exception)
                            {
                                try
                                {
                                    dblElev = objProfile.ElevationAt(dblStationBC + 0.05);
                                }
                                catch (System.Exception)
                                {
                                    idAlign.delete();
                                    Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog(string.Format("Design Point not found at beginning of Arc @ {0:###+00.00} - revise and retry - exiting", dblStationBC));
                                    return(false);
                                }
                            }

                            if (dblElev != 0)
                            {
                                dblBulge = System.Math.Tan(objAlignEntArc.Delta / 4);
                                if (objAlignEntArc.Clockwise)
                                {
                                    dblBulge = dblBulge * -1.0;
                                }
                                dblRadius = System.Math.Round(objAlignEntArc.Radius, 2);

                                POI vpoi = new POI();
                                vpoi.Station     = dblStationBC;
                                vpoi.Desc0       = strDesc;
                                vpoi.ClassObj    = strClass;
                                vpoi.AngDelta    = dblAngDelta;
                                vpoi.AngDir      = dblAngDirCen;
                                vpoi.isRightHand = isRightHand;
                                vpoi.Elevation   = dblElev;
                                vpoi.Bulge       = dblBulge;
                                vpoi.Radius      = dblRadius;
                                vpoi.CenterPnt   = new Point3d(dblPntCen.X, dblPntCen.Y, 0);

                                varpoi.Add(vpoi);
                                varpoi = varpoi.sortPOIbyStation();
                            }
                        }

                        boolExists = false;

                        double dblStationEC = System.Math.Round(objAlignEntArc.EndStation, 3);

                        x = 0;
                        for (int j = 0; j < varpoi.Count; j++)
                        {
                            if (System.Math.Abs(varpoi[j].Station - dblStationEC) < 0.05)
                            {
                                boolExists = true;
                                x          = j;
                                break;
                            }
                        }

                        dblAngDirCen = objAlignEntArc.EndPoint.getDirection(objAlignEntArc.CenterPoint);

                        if (boolExists)
                        {
                            POI vpoi = varpoi[x];
                            vpoi.Station     = Math.roundDown3(dblStationEC);
                            vpoi.Desc0       = "EC";
                            vpoi.AngDir      = dblAngDirCen;
                            vpoi.isRightHand = isRightHand;
                            vpoi.Bulge       = dblBulge;
                            vpoi.Radius      = dblRadius;
                            varpoi[x]        = vpoi;
                        }
                        else
                        {
                            string strDesc = "EC";
                            double dblElev = 0;

                            try
                            {
                                dblElev = objProfile.ElevationAt(dblStationEC);
                            }
                            catch (System.Exception)
                            {
                                dblElev = objProfile.ElevationAt(dblStationBC - 0.05);
                            }

                            POI vpoi = new POI();
                            vpoi.Station     = dblStationEC;
                            vpoi.Desc0       = strDesc;
                            vpoi.ClassObj    = strClass;
                            vpoi.AngDelta    = dblAngDelta;
                            vpoi.AngDir      = dblAngDirCen;
                            vpoi.isRightHand = isRightHand;
                            vpoi.Elevation   = dblElev;
                            vpoi.Bulge       = dblBulge;
                            vpoi.Radius      = dblRadius;

                            varpoi.Add(vpoi);

                            varpoi = varpoi.sortPOIbyStation();
                        }
                    }
                }
            }

            return(true);
        }
Example #14
0
        syncTableWithProfile()
        {
            List <POI> varPOIcur = fStake.POI_CALC;

            Alignment    objAlign = fStake.ACTIVEALIGN;
            ObjectId     idAlign  = objAlign.ObjectId;
            ResultBuffer rb       = idAlign.getXData("CLASS");

            if (rb == null)
            {
                return;
            }

            TypedValue[] tvs = rb.AsArray();
            fStake.ClassObj = tvs[1].Value.ToString();

            Profile objProfile = null;

            try
            {
                objProfile = Prof.getProfile(idAlign, "STAKE");
            }
            catch (System.Exception)
            {
            }

            ProfilePVICollection objProfilePVIs = objProfile.PVIs;
            Table    objTable = null;
            ObjectId idTable  = ObjectId.Null;

            try
            {
                idTable = Stake_Table.getTableId(idAlign);
            }
            catch (System.Exception)
            {
                try
                {
                    SelectionSet ss  = Select.buildSSet(typeof(Table));
                    ObjectId[]   ids = ss.GetObjectIds();

                    if (ids.Length > 0)
                    {
                        for (int i = 0; i < ids.Length; i++)
                        {
                            idTable  = ids[i];
                            objTable = (Table)idTable.getEnt();
                            if (objTable.Cells[1, 1].TextString == objAlign.Name)
                            {
                                break;
                            }
                        }
                    }
                }
                catch (System.Exception)
                {
                    Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Select Table Failed");
                    return;
                }
            }

            fStake.POI_CALC = resetPOI(idTable);
            List <POI> varPOITmp = fStake.POI_CALC;

            List <POI> varpoi    = new List <POI>();
            List <POI> varpoiAdd = new List <POI>();

            Debug.Print(varPOITmp.Count.ToString());
            ProfilePVI objProfilePVI = null;

            for (int i = 0; i < varPOITmp.Count; i++)
            {
                for (int j = 0; j < objProfilePVIs.Count; j++)
                {
                    objProfilePVI = objProfilePVIs[j];
                    if (Math.roundDown2((objProfilePVI.Station)) == Math.roundDown2(varPOITmp[i].Station))
                    {
                        varpoi.Add(varPOITmp[i]);
                        break;
                    }
                }
            }
            bool boolExists = false;

            for (int i = 0; i < objProfilePVIs.Count; i++)
            {
                boolExists    = false;
                objProfilePVI = objProfilePVIs[i];
                for (int j = 0; j < varpoi.Count; j++)
                {
                    if (Math.roundDown2(varpoi[j].Station) == Math.roundDown2((objProfilePVI.Station)))
                    {
                        boolExists = true;
                        break;
                    }
                }

                if (!boolExists)
                {
                    POI vpoi = new POI();
                    vpoi.Station   = Math.roundDown3((objProfilePVI.Station));
                    vpoi.Elevation = objProfilePVI.Elevation;
                    vpoi.ClassObj  = fStake.ClassObj;
                    vpoi.Desc0     = "GB";
                    varpoiAdd.Add(vpoi);
                }
            }

            if (varpoiAdd[0].Desc0 != "NOTHING")
            {
                for (int i = 0; i < varpoiAdd.Count; i++)
                {
                    varpoi.Add(varpoiAdd[i]);
                }
            }

            var sortSta = from p in varpoi
                          orderby p.Station ascending
                          select p;

            List <POI> poiTmp = new List <POI>();

            foreach (var p in sortSta)
            {
                poiTmp.Add(p);
            }

            varpoi = poiTmp;

            updateTableData(idTable, varpoi);

            fStake.POI_CALC = varpoi;
        }
Example #15
0
        setOffsetPoint(Point3d pnt3dX, string strOffset, string strName, string strDesc, ObjectId idAlign, double dblStation, object varXAlignDesc = null)
        {
            string nameAlign = Align.getAlignName(idAlign);

            Debug.Print(dblStation + " setOffsetPoint - Station In");

            double dblElevCPNT   = 0;
            double dblElevSTAKE  = 0;
            int    intCurbHeight = 0;

            string strLayer  = fStake.STAKE_LAYER;
            string descCgPnt = "";

            double offset = double.Parse(strOffset) * fStake.Side;

            TypedValue[] tvs = new TypedValue[4];
            tvs.SetValue(new TypedValue(1001, "STAKE"), 0);
            tvs.SetValue(new TypedValue(1005, idAlign.getHandle()), 1);
            tvs.SetValue(new TypedValue(1004, dblStation), 2);
            tvs.SetValue(new TypedValue(1040, offset), 3);

            pnt3dX = pnt3dX.addElevation(System.Math.Round(pnt3dX.Z, 3));

            //uint pntNum = 0;
            //ObjectId idCgPnt = pnt3dX.setPoint(out pntNum, "SPNT");
            //CogoPoint cgPnt = (CogoPoint)idCgPnt.getEnt();

            POI varPoi = new POI();

            varPoi.Station   = dblStation;
            varPoi.Elevation = pnt3dX.Z;
            //varPoi.PntNum = cgPnt .PointNumber.ToString();

            if (varPoi.Elevation == 0)
            {
                if (fStake.ClassObj != "WALL")
                {
                    varPoi.Elevation = System.Math.Round(Prof.getProfileElev(idAlign, "CPNT", dblStation), 3);
                    varPoi.PntNum    = varPoi.PntNum + " RP";
                }
            }

            //fStake.POI_STAKED.Add(varPoi);

            string strFS = "";

            switch (fStake.ClassObj)
            {
            case "CURB":

                strFS       = " TC";
                dblElevCPNT = Prof.getProfileElev(idAlign, "FLOWLINE", dblStation);

                dblElevSTAKE  = Prof.getProfileElev(idAlign, "STAKE", dblStation);
                intCurbHeight = Convert.ToInt32((Math.roundUP3(dblElevSTAKE - dblElevCPNT) * 12));
                ASCIIEncoding ascii = new ASCIIEncoding();
                strName = string.Format("{0}{1}{2}{3}", intCurbHeight, ascii.GetString((new Byte[] { 34 })), ascii.GetString((new Byte[] { 32 })), strName);

                break;

            case "WTR":

                strFS = " FS";

                break;

            case "ALIGN":

                switch (strDesc)
                {
                case "TG":
                    strFS = "";
                    break;

                case "HC":
                case "HE":
                case "H0":
                    strDesc = "";
                    strFS   = " INV";
                    break;

                default:
                    strFS = " INV";
                    break;
                }

                break;

            case "FL":

                strFS = " FS";

                break;

            case "BLDG":

                if (fGrid.optPBC.Checked)
                {
                    strFS = " FF";
                }
                else if (fGrid.optRBC.Checked)
                {
                    strFS = " PAD";
                }

                strLayer = string.Format("{0}-OS-{1}", fGrid.tbxOffsetH.Text, nameAlign);

                Alignment objAlign = (Alignment)idAlign.getEnt();

                double easting = 0, northing = 0;

                idAlign.getAlignPointLoc(dblStation, 0.0, ref easting, ref northing);
                Point3d pnt3d0 = new Point3d(easting, northing, 0);

                ObjectId idLine = Draw.addLine(pnt3d0, pnt3dX, strLayer, 9);

                break;
            }

            if ((varXAlignDesc == null))
            {
                if (strDesc.Substring(0, 2) == "RP")
                {
                    descCgPnt = string.Format("{0} {1}", strName, strDesc);

                    if (fStake.optYes.Checked)
                    {
                        descCgPnt = string.Format("{0} {1} {2}", strName, strDesc, string.Format("{0:###+00.00}", varPoi.Station));
                        descCgPnt = descCgPnt.Replace("  ", " ");
                    }
                }
                else
                {
                    if (fStake.ClassObj == "BLDG")
                    {
                        descCgPnt = string.Format("{0}'O/S {1} {2}", strOffset, strName, string.Format("{0} {1}", strDesc, strFS).Trim());
                        descCgPnt = descCgPnt.Replace("  ", " ");
                    }
                    else
                    {
                        descCgPnt = string.Format("{0}'O/S {1}@{2}", strOffset, strName, string.Format("{0} {1}", strDesc, strFS).Trim());
                        descCgPnt = descCgPnt.Replace("  ", " ");

                        if (fStake.optYes.Checked)
                        {
                            descCgPnt = string.Format("{0}'O/S {1}@{2} {3}", strOffset, strName, string.Format("{0} {1}", strDesc, strFS).Trim(), string.Format("{0:###+00.00}", varPoi.Station));
                            descCgPnt = descCgPnt.Replace("  ", " ");
                        }
                    }
                }
            }
            else
            {
                descCgPnt = string.Format("{0}'O/S {1}@{2}", strOffset, strName, string.Format("{0} {1}", strDesc, varXAlignDesc).Trim());
                descCgPnt = descCgPnt.Replace("  ", " ");
            }

            uint     pntNum  = 0;
            ObjectId idCgPnt = pnt3dX.setPoint("SPNT");

            using (Transaction tr = BaseObjs.startTransactionDb())
            {
                CogoPoint CgPnt = (CogoPoint)tr.GetObject(idCgPnt, OpenMode.ForWrite);
                CgPnt.LabelStyleId   = Pnt_Style.getPntLabelStyle("SPNT");
                CgPnt.RawDescription = descCgPnt;
                pntNum            = fStake.NextPntNum;
                CgPnt.PointNumber = pntNum;
                fStake.NextPntNum++;
                CgPnt.PointName = string.Format("SPNT{0}", pntNum);

                tr.Commit();
            }

            varPoi.PntNum = pntNum.ToString();
            fStake.POI_STAKED.Add(varPoi);

            Debug.Print(varPoi.Station + " setOffsetPoint");

            idCgPnt.setXData(tvs, "STAKE");
        }
Example #16
0
        stakePoints(object varStaBeg = null, object varStaEnd = null, object varSide = null, object varBegNum = null)
        {
            string    strClass = fStake.ClassObj;
            Alignment objAlign = null;

            try
            {
                objAlign = fStake.ACTIVEALIGN;
            }
            catch (System.Exception)
            {
                if (Stake_Algn.selectAlignment(ObjectId.Null))
                {
                    objAlign = fStake.ACTIVEALIGN;
                }
                else
                {
                    return;
                }
            }

            ObjectId idAlign = objAlign.ObjectId;

            fStake.STAKE_LAYER = fStake.cboOffset.Text + "-OS-" + objAlign.Name;

            ObjectId idTable = Stake_Table.getTableId(idAlign);

            List <POI> varpoi = Stake_Table.resetPOI(idTable);

            fStake.POI_CALC = varpoi;

            fStake.objectID = objAlign.ObjectId;
            int intSide = 0;

            double dblStation = 0, dblOffset = 0;

            if ((varSide == null))
            {
                if (double.Parse(fStake.cboOffset.Text) != 0)
                {
                    PromptStatus ps;
                    Point3d      varPntPick = Pub.pnt3dO;
                    try
                    {
                        varPntPick = UserInput.getPoint("\nSelect side to place stake points: <ESC to Cancel>", out ps, osMode: 0);
                    }
                    catch (System.Exception)
                    {
                        return;

                        ;
                    }

                    idAlign.getAlignStaOffset(varPntPick, ref dblStation, ref dblOffset);
                    if (System.Math.Abs(dblOffset) > 10.0)
                    {
                        string       message     = string.Format("Point selected is more than 10' from Alignment: {0} Continue", objAlign.Name);
                        DialogResult varResponse = MessageBox.Show(message, "Confirm stakng target.", MessageBoxButtons.YesNo);

                        if (varResponse == DialogResult.No)
                        {
                            return;
                        }
                        else
                        {
                            if (dblOffset < 0)
                            {
                                intSide = -1;
                            }
                            else
                            {
                                intSide = 1;
                            }

                            fStake.Side = intSide;
                        }
                    }
                    else
                    {
                        if (dblOffset < 0)
                        {
                            intSide = -1;
                        }
                        else
                        {
                            intSide = 1;
                        }

                        fStake.Side = intSide;
                    }
                }
                else
                {
                    fStake.Side = 1;
                }
            }
            else
            {
                intSide = int.Parse(varSide.ToString());
            }

            dblOffset = double.Parse(fStake.cboOffset.Text);
            string strName = fStake.NameStakeObject;

            var sortSta = from p in varpoi                              //sort stations
                          orderby p.Station ascending
                          select p;

            List <POI> poiTmp = new List <POI>();

            foreach (var p in sortSta)
            {
                poiTmp.Add(p);
            }
            varpoi = poiTmp;

            double dblStaBeg = Math.roundDown3((objAlign.StartingStation));
            double dblStaEnd = Math.roundDown3((objAlign.EndingStation));

            List <POI> varPOI_TOF = null;
            List <POI> varPOI_TOW = null;

            Profile objProfile = null;

            switch (strClass)
            {
            case "WTR":

                objProfile = Prof.getProfile(idAlign, "CPNT");

                break;

            case "WALL":
                for (int i = 0; i < varpoi.Count; i++)
                {
                    if (varpoi[i].Desc0 == "TOF")
                    {
                        varPOI_TOF.Add(varpoi[i]);
                    }
                    else if (varpoi[i].Desc0 == "TOW")
                    {
                        varPOI_TOW.Add(varpoi[i]);
                    }
                }
                break;

            default:

                objProfile = Prof.getProfile(idAlign, "STAKE");

                break;
            }

            List <POI> varPOI_TMP = new List <POI>();

            if (strClass == "WALL")
            {
                Stake_GetStationing.getStationing(ref varPOI_TOF, dblStaBeg, dblStaEnd);
                Stake_GetStationing.getStationing(ref varPOI_TOW, dblStaBeg, dblStaEnd);
                for (int i = 0; i < varPOI_TOF.Count; i++)
                {
                    varPOI_TMP.Add(varPOI_TOF[i]);
                }

                for (int j = 0; j < varPOI_TOW.Count; j++)
                {
                    varPOI_TMP.Add(varPOI_TOW[j]);
                }

                varpoi = varPOI_TMP;
            }
            else
            {
                Stake_GetCardinals.checkBegAndEndDesc(idAlign, ref varpoi);
                Stake_GetStationing.getStationing(ref varpoi, dblStaBeg, dblStaEnd);
            }

            poiTmp = new List <POI>();
            foreach (var p in sortSta)             //sort stations
            {
                poiTmp.Add(p);
            }
            varpoi = poiTmp;

            uint lngPntNumBeg = Stake_Util.getBegPntNum();

            fStake.POI_STAKED = new List <POI>();
            List <POI> varPOI_STAKE = new List <POI>();

            if (strClass == "BLDG")
            {
                varPOI_STAKE = fStake.POI_STAKE;
            }
            else
            {
                if ((varStaBeg == null))
                {
                    varPOI_STAKE = varpoi;
                }
                else
                {
                    for (int i = 0; i < varpoi.Count; i++)
                    {
                        if (varpoi[i].Station >= double.Parse(varStaBeg.ToString()) && varpoi[i].Station <= double.Parse(varStaEnd.ToString()))
                        {
                            varPOI_STAKE.Add(varpoi[i]);
                        }
                    }
                }
            }

            for (int i = 0; i < varPOI_STAKE.Count; i++)
            {
                Debug.Print(varPOI_STAKE[i].Station + " " + varPOI_STAKE[i].Desc0);
            }
            POI     poi = new POI();
            double  dblElev = 0, dblEasting = 0, dblNorthing = 0;
            string  strDesc = "", strOffset = "";
            Point3d dblPnt = Pub.pnt3dO;

            for (int i = 0; i < varPOI_STAKE.Count; i++)
            {             //**********PROCESS varPOI_STAKE*********************
                if (varPOI_STAKE[i].DescX == "")
                {
                    poi             = varPOI_STAKE[i];
                    poi.DescX       = varPOI_STAKE[i].Desc0;
                    varPOI_STAKE[i] = poi;
                }

                switch (varPOI_STAKE[i].ClassObj)
                {
                case "WALL":

                    if (varPOI_STAKE[i].Desc0 == "TOW")
                    {
                        dblElev = varPOI_STAKE[i].ElevTOW;
                    }
                    else if (varPOI_STAKE[i].Desc0 == "TOF")
                    {
                        dblElev = varPOI_STAKE[i].ElevTOF;
                    }

                    switch (varPOI_STAKE[i].Desc0)
                    {
                    case "AP":

                        if (varPOI_STAKE[i].DescX.Contains("END"))
                        {
                            switch (intSide)
                            {
                            case 1:                                                    //right side

                                if (varPOI_STAKE[i].isRightHand)
                                {                                                         //counterclockwise
                                    doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }
                                else
                                {                                                         //clockwise
                                    doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }

                                break;

                            case -1:                                                    //left side

                                if (varPOI_STAKE[i].isRightHand)
                                {                                                         //counterclockwise
                                    doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }
                                else
                                {                                                         //clockwise
                                    doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }

                                break;
                            }
                        }

                        break;

                    case "BC":
                    case "EC":

                        doCurve(ref i, idAlign, objProfile, varPOI_STAKE, intSide, dblOffset, strName);

                        break;

                    default:

                        strDesc = varPOI_STAKE[i].DescX;
                        if (string.IsNullOrEmpty(strDesc))
                        {
                            strDesc = varPOI_STAKE[i].Desc0;
                        }

                        try
                        {
                            idAlign.getAlignPointLoc(varPOI_STAKE[i].Station, dblOffset * intSide, ref dblEasting, ref dblNorthing);
                        }
                        catch (System.Exception)
                        {
                            idAlign.getAlignPointLoc(varPOI_STAKE[i].Station - 0.01, dblOffset * intSide, ref dblEasting, ref dblNorthing);
                        }

                        dblPnt = new Point3d(dblEasting, dblNorthing, dblElev);

                        strOffset = dblOffset.ToString();
                        setOffsetPoint(dblPnt, strOffset, strName, strDesc, idAlign, varPOI_STAKE[i].Station);

                        break;
                    }

                    break;

                case "WTR":

                    dblElev = System.Math.Round(objProfile.ElevationAt(Math.roundDown3(varPOI_STAKE[i].Station)), 2);

                    switch (varPOI_STAKE[i].Desc0.Substring(0, 2))
                    {
                    case "TE":

                        if (varPOI_STAKE[i].Side == intSide)
                        {
                            set5x5(idAlign, dblElev, varPOI_STAKE[i].Station, dblOffset, intSide, strName, varPOI_STAKE[i].DescX);
                        }
                        else
                        {
                            idAlign.getAlignPointLoc(varPOI_STAKE[i].Station, dblOffset * intSide, ref dblEasting, ref dblNorthing);

                            dblPnt = new Point3d(dblEasting, dblNorthing, dblElev);

                            strOffset = dblOffset.ToString();

                            setOffsetPoint(dblPnt, strOffset, strName, varPOI_STAKE[i].DescX, idAlign, varPOI_STAKE[i].Station);
                        }

                        break;

                    case "AP":

                        switch (intSide)
                        {
                        case 1:
                            //right side

                            //counterclockwise
                            if (varPOI_STAKE[i].isRightHand)
                            {
                                doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                //clockwise
                            }
                            else
                            {
                                doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                            }

                            break;

                        case -1:
                            //left side

                            //counterclockwise
                            if (varPOI_STAKE[i].isRightHand)
                            {
                                doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                //clockwise
                            }
                            else
                            {
                                doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                            }

                            break;
                        }

                        break;

                    default:

                        idAlign.getAlignPointLoc(varPOI_STAKE[i].Station, dblOffset * intSide, ref dblEasting, ref dblNorthing);
                        dblPnt = new Point3d(dblEasting, dblNorthing, dblElev);

                        strOffset = dblOffset.ToString();

                        double dblCrossingInv = 0;
                        string strCrossingInv = "";
                        if (varPOI_STAKE[i].CrossAlign != "")
                        {
                            if (varPOI_STAKE[i].CrossAlignInv != 0)
                            {
                                dblCrossingInv = System.Math.Round(varPOI_STAKE[i].CrossAlignInv, 2);
                                strCrossingInv = string.Format("{0} INV.", dblCrossingInv);
                            }
                            else
                            {
                                strCrossingInv = "";
                            }

                            ASCIIEncoding ascii = new ASCIIEncoding();

                            string strAlignDesc = string.Format("{0}{1}%%C PIPE {2}", varPOI_STAKE[i].CrossAlignSize, ascii.GetString(new Byte[] { (Byte)34 }), strCrossingInv);

                            setOffsetPoint(dblPnt, strOffset, strName, strAlignDesc, idAlign, varPOI_STAKE[i].Station);
                        }
                        else
                        {
                            setOffsetPoint(dblPnt, strOffset, strName, varPOI_STAKE[i].DescX, idAlign, varPOI_STAKE[i].Station);

                            if (varPOI_STAKE[i].Type != "")
                            {
                                setOffsetPoint(dblPnt, strOffset, strName, varPOI_STAKE[i].Type, idAlign, varPOI_STAKE[i].Station, " INV=");
                            }
                        }

                        break;
                    }

                    break;

                case "CURB":
                case "FL":

                    dblElev = System.Math.Round(objProfile.ElevationAt(Math.roundDown3(varPOI_STAKE[i].Station)), 2);

                    switch (varPOI_STAKE[i].Desc0)
                    {
                    case "AP":

                        if (varPOI_STAKE[i].DescX.Contains("END"))
                        {
                            switch (intSide)
                            {
                            case 1:                                                    //right side

                                if (varPOI_STAKE[i].isRightHand)
                                {                                                         //counterclockwise
                                    doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }
                                else
                                {                                                         //clockwise
                                    doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }

                                break;

                            case -1:                                                    //left side

                                if (varPOI_STAKE[i].isRightHand)
                                {                                                         //counterclockwise
                                    doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }
                                else
                                {                                                         //clockwise
                                    doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }

                                break;
                            }
                        }

                        break;

                    case "BC":
                    case "EC":

                        doCurve(ref i, idAlign, objProfile, varPOI_STAKE, intSide, dblOffset, strName);

                        break;

                    default:

                        strDesc = varPOI_STAKE[i].DescX;
                        //          If strDesc = "" Then
                        //            strDesc = varPOI_Stake[i].Desc0
                        //          End If

                        try
                        {
                            idAlign.getAlignPointLoc(varPOI_STAKE[i].Station, dblOffset * intSide, ref dblEasting, ref dblNorthing);
                        }
                        catch (System.Exception)
                        {
                            idAlign.getAlignPointLoc(varPOI_STAKE[i].Station - 0.01, dblOffset * intSide, ref dblEasting, ref dblNorthing);
                        }
                        dblPnt = new Point3d(dblEasting, dblNorthing, dblElev);

                        strOffset = dblOffset.ToString();
                        setOffsetPoint(dblPnt, strOffset, strName, strDesc, idAlign, varPOI_STAKE[i].Station);

                        break;
                    }

                    break;

                case "ALIGN":
                case "SEWER":

                    dblElev = System.Math.Round(objProfile.ElevationAt(Math.roundDown3(varPOI_STAKE[i].Station)), 2);

                    if (varPOI_STAKE[i].Desc0 == "BC")
                    {
                        setRadiusPoint(idAlign, varPOI_STAKE[i], varPOI_STAKE[i].Radius, strName);
                    }

                    try
                    {
                        idAlign.getAlignPointLoc(varPOI_STAKE[i].Station, dblOffset * intSide, ref dblEasting, ref dblNorthing);
                    }
                    catch (System.Exception)
                    {
                    }

                    dblPnt = new Point3d(dblEasting, dblNorthing, dblElev);

                    strOffset = dblOffset.ToString();
                    setOffsetPoint(dblPnt, strOffset, strName, varPOI_STAKE[i].Desc0, idAlign, varPOI_STAKE[i].Station);

                    break;
                }
            }

            List <POI> varPOI_STAKED = fStake.POI_STAKED;
            int        intUBnd       = varPOI_STAKED.Count - 1;

            uint lngPntNumEnd = uint.Parse(varPOI_STAKED[intUBnd].PntNum);

            TypedValue[] tvs = new TypedValue[4] {
                new TypedValue(1001, "STAKE"),
                new TypedValue(1071, lngPntNumBeg),
                new TypedValue(1071, lngPntNumEnd),
                new TypedValue(1000, fStake.STAKE_LAYER)
            };

            idAlign.setXData(tvs, "STAKE");

            CgPnt_Group.updatePntGroup("SPNT");

            Stake_UpdateProfile.updateProfile(idAlign, (fStake.POI_STAKED), "STAKE", true, "STAKED");

            bool     exists = false;
            ObjectId idDict = Dict.getNamedDictionary("STAKE_PNTS", out exists);

            List <Point3d> dblPnts   = new List <Point3d>();
            Point3d        pnt3d     = Pub.pnt3dO;
            uint           lngPntNum = 0;

            for (int p = 0; p < varPOI_STAKED.Count; p++)
            {
                string varPntNum = varPOI_STAKED[p].PntNum;

                int intPos = varPntNum.IndexOf(" ");

                if (intPos != 0)
                {
                    lngPntNum = uint.Parse(varPntNum.Substring(0, intPos - 1));
                }
                else
                {
                    lngPntNum = uint.Parse(varPntNum);
                }

                ObjectId idPnt = BaseObjs._civDoc.CogoPoints.GetPointByPointNumber(uint.Parse(varPOI_STAKED[p].PntNum));
                pnt3d = idPnt.getCogoPntCoordinates();
                dblPnts.Add(pnt3d);
                ResultBuffer rb = new ResultBuffer {
                    new TypedValue(1000, idPnt.getCogoPntNumber().ToString()),
                    new TypedValue(1005, idPnt.getHandle().ToString())
                };
                Dict.addXRec(idDict, idPnt.ToString(), rb);
            }

            dblPnts.Add(dblPnts[0]);

            Misc.logUsage("STAKE", (lngPntNumEnd - lngPntNumBeg + 1));
        }
Example #17
0
        getCardinals_Horizontal(ObjectId idAlign, ref List <POI> varpoi)
        {
            Alignment objAlign = (Alignment)idAlign.getEnt();
            //BEGIN HORIZONTAL CARDINALS
            AlignmentEntityCollection objAlignEnts = objAlign.Entities;
            AlignmentEntity           objAlignEnt  = objAlignEnts[0];

            //GET BEG AND END OF FIRST SEGMENT - THEN GET END OF FOLLOWING SEGMENTS
            switch (objAlignEnt.EntityType)
            {
            case AlignmentEntityType.Arc:
                AlignmentArc objAlignEntArc = (AlignmentArc)objAlignEnt;
                POI          poi            = new POI();
                poi.Station  = Math.roundDown3((objAlignEntArc.StartStation));
                poi.Desc0    = "HC";
                poi.ClassObj = fStake.ClassObj;
                varpoi.Add(poi);

                poi          = new POI();
                poi.Station  = Math.roundDown3((objAlignEntArc.EndStation));
                poi.Desc0    = "HC";
                poi.ClassObj = fStake.ClassObj;
                varpoi.Add(poi);
                break;

            case AlignmentEntityType.Line:
                AlignmentLine objAlignEntTan = (AlignmentLine)objAlignEnt;
                poi          = new POI();
                poi.Station  = Math.roundDown3((objAlignEntTan.StartStation));
                poi.Desc0    = "HC";
                poi.ClassObj = fStake.ClassObj;
                varpoi.Add(poi);

                poi          = new POI();
                poi.Station  = Math.roundDown3((objAlignEntTan.EndStation));
                poi.Desc0    = "HC";
                poi.ClassObj = fStake.ClassObj;
                varpoi.Add(poi);
                break;
            }

            POI vpoi = new POI();

            if (objAlignEnts.Count > 1)
            {
                for (int i = 1; i <= objAlignEnts.Count - 1; i++)
                {
                    objAlignEnt = objAlignEnts[i];

                    vpoi = new POI();
                    switch (objAlignEnt.EntityType)
                    {
                    case AlignmentEntityType.Arc:
                        AlignmentArc objAlignEntArc = (AlignmentArc)objAlignEnt;
                        vpoi.Station  = Math.roundDown3((objAlignEntArc.EndStation));
                        vpoi.Desc0    = "HC";
                        vpoi.ClassObj = fStake.ClassObj;
                        break;

                    case AlignmentEntityType.Line:
                        AlignmentLine objAlignEntTan = (AlignmentLine)objAlignEnt;
                        vpoi.Station  = Math.roundDown3((objAlignEntTan.EndStation));
                        vpoi.Desc0    = "HC";
                        vpoi.ClassObj = fStake.ClassObj;

                        break;
                    }
                    varpoi.Add(vpoi);
                }
            }
            //END HORIZONTAL CARDINALS
        }
Example #18
0
        set5x5(ObjectId idAlign, double dblElev, double dblStation, double dblOffset, int intSide, string strName, string strDesc)
        {
            double dblAngBack  = 0;
            double dblAngAhead = 0;

            double    dblEasting0  = 0;
            double    dblNorthing0 = 0;
            Alignment objAlign     = (Alignment)idAlign.getEnt();
            AlignmentEntityCollection alignEnts = objAlign.Entities;
            //Debug.Print objAlign.EndingStation

            AlignmentEntity        alignEnt0   = (AlignmentEntity)alignEnts.EntityAtStation(dblStation);
            AlignmentLine          alignLine0  = null;
            AlignmentSubEntityLine subEntLine0 = null;

            if (alignEnt0.EntityType == AlignmentEntityType.Line)
            {
                alignLine0  = (AlignmentLine)alignEnts.EntityAtStation(dblStation);
                subEntLine0 = (AlignmentSubEntityLine)alignLine0[0];
            }
            else
            {
                return;
            }

            AlignmentLine   alignLineA = null;
            AlignmentLine   alignLineB = null;
            AlignmentEntity alignEntX  = null;

            Point2d pnt2dBeg = Point2d.Origin;
            Point2d pnt2dEnd = Point2d.Origin;

            //Point at Tangent Start Point
            if (Math.roundDown3(dblStation) == Math.roundDown3(alignLine0.StartStation))
            {
                alignLineA = alignLine0;

                pnt2dBeg    = alignLineA.StartPoint;
                pnt2dEnd    = alignLineA.EndPoint;
                dblAngAhead = pnt2dBeg.getDirection(pnt2dEnd);

                //First Tangent
                if (alignEnt0.EntityBefore != 0)
                {
                    alignEntX = alignEnts[alignEnt0.EntityBefore - 1];

                    if (alignEntX.EntityType == AlignmentEntityType.Line)
                    {
                        alignLineB = (AlignmentLine)alignEntX;
                        pnt2dBeg   = alignLineB.StartPoint;
                        pnt2dEnd   = alignLineB.EndPoint;
                        dblAngBack = pnt2dBeg.getDirection(pnt2dEnd);
                    }
                }
                else
                {
                    dblAngBack = dblAngAhead;
                    //     Debug.Print dblAngBack
                }
                //Point at Tangent End Point
            }
            else if (Math.roundDown3(dblStation) == Math.roundDown3(alignLine0.EndStation))
            {
                alignLineB = alignLine0;

                pnt2dBeg   = alignLineB.StartPoint;
                pnt2dEnd   = alignLineB.EndPoint;
                dblAngBack = pnt2dBeg.getDirection(pnt2dEnd);

                //Last Tangent
                if (alignEnt0.EntityAfter != 0)
                {
                    alignEntX = alignEnts[alignLine0.EntityAfter - 1];

                    if (alignEntX.EntityType == AlignmentEntityType.Line)
                    {
                        alignLineA = (AlignmentLine)alignEntX;

                        pnt2dBeg    = alignLineA.StartPoint;
                        pnt2dEnd    = alignLineA.EndPoint;
                        dblAngAhead = pnt2dBeg.getDirection(pnt2dEnd);
                    }
                }
                else
                {
                    dblAngAhead = dblAngBack;
                }
            }
            else
            {
                pnt2dBeg    = alignLine0.StartPoint;
                pnt2dEnd    = alignLine0.EndPoint;
                dblAngAhead = pnt2dBeg.getDirection(pnt2dEnd);
            }

            idAlign.getAlignPointLoc(dblStation, 0.0, ref dblEasting0, ref dblNorthing0);
            //get point of intersection

            Point3d pnt3d = new Point3d(dblEasting0, dblNorthing0, 0.0);

            Point3d pnt3dX = pnt3d.traverse(dblAngAhead + (3 * PI / 4 * intSide * -1), dblOffset / System.Math.Sin(PI / 4));

            pnt3dX = pnt3dX.addElevation(dblElev);

            string strOffset = string.Format("{0} x {1}", dblOffset.ToString(), dblOffset.ToString());

            Debug.Print(dblStation + " set5x5");
            setOffsetPoint(pnt3dX, strOffset, strName, strDesc, idAlign, dblStation);

            pnt3dX = pnt3dX.traverse(dblAngAhead + (PI / 4 * intSide * -1), dblOffset / System.Math.Sin(PI / 4));
            pnt3dX = pnt3dX.addElevation(dblElev);

            strOffset = string.Format("{0} x {1}", dblOffset.ToString(), dblOffset.ToString());

            Debug.Print(dblStation + " set5x5");
            setOffsetPoint(pnt3dX, strOffset, strName, strDesc, idAlign, dblStation);
        }
Example #19
0
        changeAlignStartPoint()
        {
            //BEGIN: UPDATE PROFILE, TABLE, AND POIs

            AlgnData  algnData = new AlgnData();
            ObjectId  idAlign  = ObjectId.Null;
            Alignment objAlign = null;

            if (selectAlignment(idAlign))
            {
                objAlign = fStake.ACTIVEALIGN;
            }
            else
            {
                return;
            }

            objAlign = fStake.ACTIVEALIGN;
            AlignmentEntityCollection objAlignEnts = objAlign.Entities;

            //BEGIN: UPDATE PROFILE, TABLE, AND POIs
            double       dblLenAlign = objAlign.Length;
            PromptStatus ps;
            Point3d      varPnt = UserInput.getPoint("Select Desired Start Point", out ps, osMode: 0);

            double dblStation = 0, dblOffset = 0;

            idAlign.getAlignStaOffset(varPnt, ref dblStation, ref dblOffset);
            double dblStationStart = objAlign.StartingStation;
            double dblStationDelta = dblStation - dblStationStart;
            // if varPnt is out of range then dblStation returns ZERO

            Profile profFLOWLINE      = Prof.getProfile(idAlign, "FLOwLINE");
            ProfilePVICollection pvis = profFLOWLINE.PVIs;

            List <POI> varPOI_Temp = new List <POI>();

            foreach (ProfilePVI pvi in pvis)
            {
                POI poi = new POI {
                    Station = Math.roundDown3(pvi.Station), Elevation = pvi.Elevation
                };
                varPOI_Temp.Add(poi);
            }

            Debug.Print("varPOI_Temp Before");
            for (int i = 0; i < varPOI_Temp.Count; i++)
            {
                Debug.Print(varPOI_Temp[i].Station + "  " + varPOI_Temp[i].Elevation);
            }

            //adjust POI_Temp stationing

            for (int i = 0; i < varPOI_Temp.Count; i++)
            {
                POI poi = varPOI_Temp[i];
                if (poi.Station < dblStationDelta + dblStationStart)
                {
                    poi.Station = Math.roundDown3(dblLenAlign + varPOI_Temp[i].Station);
                }
                else
                {
                    poi.Station = Math.roundDown3(varPOI_Temp[i].Station - dblStationDelta);
                }
                varPOI_Temp[i] = poi;
            }

            List <POI> poiTmp       = new List <POI>();
            var        sortPOI_Temp = from t in varPOI_Temp
                                      orderby t.Station ascending
                                      select t;

            foreach (var t in sortPOI_Temp)
            {
                poiTmp.Add(t);
            }
            varPOI_Temp = poiTmp;

            int k = varPOI_Temp.Count;

            POI poitemp = varPOI_Temp[k - 1];

            poitemp.Elevation = varPOI_Temp[0].Elevation;
            varPOI_Temp[k]    = poitemp;

            Debug.Print("varPOI_Temp After");
            for (int i = 0; i < k; i++)
            {
                Debug.Print(varPOI_Temp[i].Station + "  " + varPOI_Temp[i].Elevation);
            }

            //END: UPDATE PROFILE, TABLE, AND POIs

            ObjectId idPoly = objAlign.GetPolyline();
            Polyline poly   = (Polyline)idPoly.getEnt();

            string   strAlignName = objAlign.Name;
            AlgnData aData;

            for (int j = 1; j < fStake.algnData.Count; j++)
            {
                aData = fStake.algnData[j];
                if (aData.AlignHandle == objAlign.Handle)
                {
                    break;
                }
            }

            objAlign.ReferencePointStation = 100.0;

            foreach (AlignmentEntity ent in objAlignEnts)
            {
                objAlignEnts.Remove(ent);
            }

            List <Vertex2d> v2ds = Conv.poly_Vertex2dList(idPoly);

            int p = 0;

            foreach (Vertex2d v in v2ds)
            {
                if (v.Position.IsEqualTo(varPnt, new Tolerance(0, 0)))
                {
                    break;
                }
                p++;
            }

            List <Vertex2d> v2dsNew = new List <Vertex2d>();

            for (int i = p; i < v2ds.Count; i++)
            {
                v2dsNew.Add(v2ds[i]);
            }

            for (int i = 1; i < p; i++)
            {
                v2dsNew.Add(v2ds[i]);
            }
            v2dsNew.Add(v2ds[p]);

            int     lngID = 0;
            Point3d dblPntBeg = Pub.pnt3dO, dblPntEnd = Pub.pnt3dO, dblPntMid = Pub.pnt3dO;

            for (int i = 1; i < v2dsNew.Count; i++)
            {
                if (v2dsNew[i].Bulge == 0)
                {
                    dblPntBeg = v2dsNew[i - 1].Position;
                    dblPntEnd = v2dsNew[i = 0].Position;

                    AlignmentLine objAlignEntTan = objAlign.Entities.AddFixedLine(lngID, dblPntBeg, dblPntEnd);
                    lngID = objAlignEntTan.EntityId;
                }
                else
                {
                    dblPntBeg = v2dsNew[i - 1].Position;
                    dblPntEnd = v2dsNew[i = 0].Position;

                    int intDir = 0;

                    if (v2dsNew[i - 1].Bulge > 0)
                    {
                        intDir = 1;
                    }
                    else
                    {
                        intDir = -1;
                    }

                    Arc arc = (Arc)Arc.Create(IntPtr.Zero, true);
                    arc.StartPoint = dblPntBeg;
                    arc.EndPoint   = dblPntEnd;

                    Point3d pnt3dMidLC = dblPntBeg.getMidPoint3d(dblPntEnd);
                    double  lenLC      = dblPntBeg.getDistance(dblPntEnd);
                    double  dirLC      = dblPntBeg.getDirection(dblPntEnd);
                    double  lenM       = System.Math.Abs(lenLC / 2 * v2dsNew[i - 1].Bulge);
                    dblPntMid = pnt3dMidLC.traverse(dirLC + System.Math.PI / 2 * intDir, lenM);

                    AlignmentArc objAlignEntArc = objAlign.Entities.AddFixedCurve(lngID, dblPntBeg, dblPntMid, dblPntEnd);
                    lngID = objAlignEntArc.EntityId;
                }
            }

            objAlign.Update();
            objAlign.ReferencePoint        = varPnt.Convert2d(BaseObjs.xyPlane);
            objAlign.ReferencePointStation = System.Math.Round(100.0 + dblStationDelta, 3);

            //BEGIN: UPDATE PROFILE, TABLE, AND POIs
            List <POI> varpoi = fStake.POI_CALC;

            //POIs are updated when selectAlignment is executed

            //ADJUST POI STATIONING
            //need complete POIs for descriptions
            for (int i = 0; i < varpoi.Count; i++)
            {
                if (varpoi[i].Station < dblStationDelta + dblStationStart)
                {
                    varpoi[i].Station = Math.roundDown3(dblLenAlign + varpoi[i].Station);
                }
                else
                {
                    varpoi[i].Station = Math.roundDown3(varpoi[i].Station - dblStationDelta);
                }
            }

            varpoi = varpoi.sortPOIbyStation();

            int n = varpoi.Count;

            varpoi[0].DescX     = "BEG " + varpoi[0].Desc0;
            varpoi[n - 2].DescX = varpoi[n - 2].DescX.Replace("END", "").Trim();
            varpoi[n - 1].DescX = varpoi[n - 1].DescX.Replace("BEG", "END").Trim();

            if (fStake.ClassObj == "CURB")
            {
                Stake_AddProfile.makeProfile(idAlign, varPOI_Temp, "CURB", "ByLayout", true);
            }

            ObjectId idTable = Stake_Table.makeTable(idAlign, varpoi);

            Stake_Table.addTableData(idTable, varpoi);

            if (Stake_GetBC_EC.getBC_EC(idAlign, ref varpoi) == false)
            {
                return;
            }

            fStake.POI_CALC = varpoi;
            //END: UPDATE PROFILE, TABLE, AND POIs
        }
Example #20
0
        userAddCrossingsFeatures(ObjectId idAlign, ref List <POI> varpoi)
        {
            Alignment objAlign = (Alignment)idAlign.getEnt();
            bool      escape;
            string    xRefPath = "";
            //BEGIN GET CROSSING FEATURES
            List <string> strLayName = new List <string>();
            List <string> strHandle  = new List <string>();
            List <Entity> ents       = new List <Entity>();

            do
            {
                Entity obj = xRef.getEntity("Select crossing entity <ESC to exit>: ", out escape, out xRefPath);

                if (obj == null || escape)
                {
                    break;
                }

                strLayName.Add(obj.Layer);
                strHandle.Add(obj.Handle.ToString());
                ents.Add(obj);
            }while (true);

            double dblStation = 0, dblOffset = 0;

            foreach (Entity ent in ents)
            {
                Point3dCollection varPntInt = new Point3dCollection();
                objAlign.IntersectWith(ent, Intersect.OnBothOperands, varPntInt, IntPtr.Zero, IntPtr.Zero);
                //EXTEND NONE

                if (varPntInt.Count == 0)
                {
                    return(false);
                }

                int k = varPntInt.Count;

                for (int n = 0; n < k; n++)
                {
                    Point3d dblPnt = varPntInt[n];

                    objAlign.StationOffset(dblPnt.X, dblPnt.Y, ref dblStation, ref dblOffset);

                    POI vpoi = new POI();

                    if (ent.Layer.Contains(fStake.NameStakeObject))
                    {
                        vpoi.Desc0 = "TEE";
                    }
                    else
                    {
                        int intPos = ent.Layer.IndexOf("|");
                        vpoi.Desc0     = ent.Layer.Substring(intPos + 1);
                        vpoi.CrossDesc = ent.Layer.Substring(intPos + 1);
                    }

                    vpoi.Station  = Math.roundDown3(dblStation);
                    vpoi.ClassObj = fStake.ClassObj;
                    varpoi.Add(vpoi);
                }
            }

            varpoi = varpoi.sortPOIbyStation();
            return(true);
        }
Example #21
0
        getCrossingAligns(ObjectId idAlign, ref List <POI> varpoi)
        {
            Alignment          objAlign = (Alignment)idAlign.getEnt();
            bool               boolAdd = false;
            double             dblStation = 0, dblStationX = 0, dblOffset = 0;
            ObjectIdCollection idAligns = BaseObjs._civDoc.GetAlignmentIds();

            for (int i = 0; i < idAligns.Count; i++)
            {
                if (Align.getAlignName(idAligns[i]) != Align.getAlignName(idAlign))
                {
                    Alignment objAlignX = (Alignment)idAligns[i].getEnt();
                    objAlignX.Highlight();

                    if (objAlignX.IsReferenceObject)
                    {
                        boolAdd = true;

                        Point3dCollection varPntInt = new Point3dCollection();
                        objAlign.IntersectWith(objAlignX, Intersect.OnBothOperands, varPntInt, IntPtr.Zero, IntPtr.Zero);

                        for (int k = 0; k < varPntInt.Count; k++)
                        {
                            Point3d pnt3dInt = varPntInt[k];
                            idAlign.getAlignStaOffset(pnt3dInt, ref dblStation, ref dblOffset);

                            POI vpoi = new POI();

                            vpoi.Station    = Math.roundDown3(dblStation);
                            vpoi.Desc0      = fStake.NameStakeObject;
                            vpoi.ClassObj   = fStake.ClassObj;
                            vpoi.CrossAlign = objAlignX.Name;

                            //GET PIPE INVERT ELEVATION

                            PIPE_DATA varPipeData = Stake_GetPipeInvertElev.getPipeData(dblStation, idAlign);

                            vpoi.Size   = varPipeData.Size;
                            vpoi.Invert = varPipeData.Invert;

                            idAligns[i].getAlignStaOffset(pnt3dInt, ref dblStationX, ref dblOffset);

                            vpoi.CrossAlignSta = System.Math.Round(dblStation, 3);

                            //GET PIPE INVERT ELEVATION

                            varPipeData = Stake_GetPipeInvertElev.getPipeData(dblStationX, idAligns[i]);

                            vpoi.CrossAlignSize = varPipeData.Size;
                            vpoi.CrossAlignInv  = varPipeData.Invert;

                            varpoi.Add(vpoi);
                        }
                    }
                }
            }

            if (boolAdd)
            {
                varpoi = varpoi.sortPOIbyStation();
            }
        }
Example #22
0
        Create_Align_Profile_By3dPoly2b2c(Alignment objAlignPL, string strName, string strNameAlign, ObjectId idLayer, ObjectId idPoly3dRF)
        {
            bool boolBeg = false;
            bool boolEnd = false;

            ObjectId idProfileStyle  = Prof_Style.getProfileStyle("WALL");
            ObjectId idStyleLabelSet = Prof_Style.getProfileLabelSetStyle("WALL");
            //ObjectId idProfileStyle = Prof_Style.getProfileStyle("Standard");
            //ObjectId idStyleLabelSet = Prof_Style.getProfileLabelSetStyle("Standard");

            List <Point3d> pnt3dsPoly3d = idPoly3dRF.getCoordinates3dList();

            ObjectId idPoly2dRF = idPoly3dRF.toPolyline(idPoly3dRF.getLayer());
            Point3d  pnt3dBegRF = idPoly2dRF.getBegPnt();
            Point3d  pnt3dEndRF = idPoly2dRF.getEndPnt();

            double easting = 0, northing = 0;

            objAlignPL.PointLocation(objAlignPL.StartingStation, 0.0, ref easting, ref northing);
            Point3d pnt3dBegWALL = new Point3d(easting, northing, 0);

            objAlignPL.PointLocation(Math.roundDown2(objAlignPL.EndingStation), 0.0, ref easting, ref northing);
            Point3d pnt3dEndWALL = new Point3d(easting, northing, 0);

            List <Point3d> pnts3d = new List <Point3d> {
                pnt3dBegWALL, pnt3dEndWALL
            };

            double dblAngle = 0;

            dblAngle = pnt3dBegWALL.getDirection(pnt3dEndWALL);

            double dblDistBeg = 0;

            dblDistBeg = Geom.getPerpDistToLine(pnt3dBegWALL, pnt3dEndWALL, pnt3dBegRF);

            double dblDistEnd = 0;

            dblDistEnd = Geom.getPerpDistToLine(pnt3dBegWALL, pnt3dEndWALL, pnt3dEndRF);
            double dblStaBegRef = 0, dblOffBegRef = 0;

            if (dblDistBeg > dblDistEnd)
            {
                idPoly2dRF.reversePolyX();

                pnt3dBegRF = idPoly2dRF.getBegPnt();
                pnt3dEndRF = idPoly2dRF.getEndPnt();

                dblDistBeg = Geom.getPerpDistToLine(pnt3dBegWALL, pnt3dEndWALL, pnt3dBegRF);
                dblDistEnd = Geom.getPerpDistToLine(pnt3dBegWALL, pnt3dEndWALL, pnt3dEndRF);
            }


            if (dblDistBeg < 0)
            {
                boolBeg      = true;
                pnt3dBegWALL = Math.traverse(pnt3dBegWALL, dblAngle - PI, dblDistBeg * -1 + 10);
                pnts3d.Insert(0, pnt3dBegWALL);
            }


            if (dblDistEnd > objAlignPL.Length + 10)
            {
                boolEnd      = true;
                pnt3dEndWALL = Math.traverse(pnt3dEndWALL, dblAngle, objAlignPL.Length - dblDistEnd + 10);
                pnts3d.Add(pnt3dEndWALL);
            }

            Profile objProfile = null;

            string strAlignName = objAlignPL.Name;
            string strLayer     = objAlignPL.Layer;

            idLayer = Layer.manageLayers(strLayer);


            if (boolBeg || boolEnd)
            {
                Align.removeAlignment(strAlignName);
                ObjectId idPoly2dWALL = Draw.addPoly(pnts3d, strLayer);

                objAlignPL = Align.addAlignmentFromPoly(strAlignName, strLayer, idPoly2dWALL, "Standard", "Standard", true);

                try
                {
                    objAlignPL.StationOffset(pnt3dBegRF.X, pnt3dBegRF.Y, ref dblStaBegRef, ref dblOffBegRef);
                }
                catch (Autodesk.Civil.PointNotOnEntityException)
                {
                    dblStaBegRef = 0.0;
                }

                objAlignPL.PointLocation(dblStaBegRef, 0.0, ref easting, ref northing);

                Point2d pnt2dRef = new Point2d(easting, northing);
                objAlignPL.ReferencePoint = pnt2dRef;

                fWall1.ACTIVEALIGN = objAlignPL;

                bool       exists          = false;
                TinSurface objSurfaceEXIST = Surf.getTinSurface("EXIST", out exists);

                ObjectId idAlignStyle         = Align_Style.getAlignmentStyle("Standard");
                ObjectId idAlignLabelSetStyle = Align_Style.getAlignmentLabelSetStyle("Standard");

                using (BaseObjs._acadDoc.LockDocument())
                {
                    using (Transaction TR = BaseObjs.startTransactionDb())
                    {
                        objProfile = Prof.addProfileBySurface("EXIST", objAlignPL.ObjectId, objSurfaceEXIST.ObjectId, idLayer, idProfileStyle, idStyleLabelSet);

                        TR.Commit();
                    }
                }
            }

            Alignment objAlignRF = Align.addAlignmentFromPoly(strNameAlign, strLayer, idPoly2dRF, "Standard", "Standard", true);

            objAlignRF.ReferencePointStation = 1000.0;

            double   dblStation = 0;
            double   dblOffset  = 0;
            ObjectId idAlignRF  = ObjectId.Null;

            try
            {
                idAlignRF.getAlignStaOffset(pnt3dsPoly3d[0], ref dblStation, ref dblOffset);
            }
            catch (Autodesk.Civil.PointNotOnEntityException)
            {
                dblStation = 0.0;
            }


            if (dblStation != objAlignRF.StartingStation)
            {
                idPoly3dRF.reversePolyX();
                pnt3dsPoly3d = idPoly3dRF.getCoordinates3dList();
            }

            using (BaseObjs._acadDoc.LockDocument())
            {
                using (Transaction TR = BaseObjs.startTransactionDb())
                {
                    objProfile = Prof.addProfileByLayout(strName, objAlignRF.ObjectId, idLayer, idProfileStyle, idStyleLabelSet);

                    double dblElev = 0;


                    for (short i = 0; i <= pnt3dsPoly3d.Count - 1; i++)
                    {
                        try
                        {
                            idAlignRF.getAlignStaOffset(pnt3dsPoly3d[i], ref dblStation, ref dblOffset);
                        }
                        catch (Autodesk.Civil.PointNotOnEntityException)
                        {
                            dblStation = 0.0;
                        }
                        dblElev = pnt3dsPoly3d[i].Z;

                        objProfile.PVIs.AddPVI(dblStation, dblElev);
                    }

                    TR.Commit();
                }
            }

            return(idAlignRF);
        }
Example #23
0
        CreateProfileByDesign2b(Alignment objAlignPL, Alignment objAlignRF)
        {
            Profile objProfileDES = null;

            Profile objprofilePL = Prof.getProfile(objAlignPL.Name, "EXIST");
            Profile objProfileRF = Prof.getProfile(objAlignRF.Name, "CPNT");

            double XT = 0;
            double X1 = 0;
            double X2 = 0;

            double X0 = Convert.ToDouble(fWall1.tbx_X0.Text);
            double S0 = Convert.ToDouble(fWall1.tbx_S0.Text);

            double CF = Convert.ToDouble(fWall1.tbx_CF.Text);

            double B1 = Convert.ToDouble(fWall1.tbx_B1.Text);
            double S1 = Convert.ToDouble(fWall1.tbx_S1.Text);

            double SG = Convert.ToDouble(fWall1.tbx_SG.Text);

            double B2 = Convert.ToDouble(fWall1.tbx_B2.Text);
            double S2 = Convert.ToDouble(fWall1.tbx_S2.Text);

            double dblOffsetPL = 0;

            double dblEasting  = 0;
            double dblNorthing = 0;

            List <Point3d> pnts3dX0  = new List <Point3d>();
            List <Point3d> pnts3dFL  = new List <Point3d>();
            List <Point3d> pnts3dTC  = new List <Point3d>();
            List <Point3d> pnts3dTOE = new List <Point3d>();
            List <Point3d> pnts3dTS  = new List <Point3d>();
            List <Point3d> pnts3dTOP = new List <Point3d>();

            List <Point3d> pnts3dWT0 = new List <Point3d>();
            List <Point3d> pnts3dWB0 = new List <Point3d>();
            List <Point3d> pnts3dWTB = new List <Point3d>();
            List <Point3d> pnts3dWBB = new List <Point3d>();

            short intSign = 0;

            double dblElevRF  = 0;
            double dblElevFL  = 0;
            double dblElevTC  = 0;
            double dblElevTOE = 0;
            double dblElevTS  = 0;
            double dblElevTOP = 0;

            double dblElevWT0 = 0;
            double dblElevWB0 = 0;
            double dblElevWTB = 0;
            double dblElevWBB = 0;
            double dblElevPL  = 0;

            double dblWallWidth = 10 / 12;

            double dblStationRF = 0;
            double dblStationPL = 0;

            ObjectId idPoly3d = ObjectId.Null;

            Point3d pnt3d = default(Point3d);

            string strLayerName = null;

            bool boolDesLow  = false;
            bool boolDesHigh = false;

            strLayerName = "PROFILE-CPNT";
            ObjectId idLayer = Layer.manageLayers(strLayerName);

            objAlignRF.PointLocation(objAlignRF.StartingStation, 0, ref dblEasting, ref dblNorthing);

            try
            {
                objAlignPL.StationOffset(dblEasting, dblNorthing, ref dblStationPL, ref dblOffsetPL);
            }
            catch (Autodesk.Civil.PointNotOnEntityException)
            {
                dblStationPL = 0.0;
            }

            if (dblOffsetPL < 0)
            {
                intSign     = -1;
                dblOffsetPL = dblOffsetPL * -1;
            }
            else
            {
                intSign = 1;
            }

            //----------------------------------------------------------------------------------------------------------------------------------------------------------------

            //Dim varPNT_DATA_FINAL() As PNT_DATA = getPNT_DATA_FINAL(objAlignPL, objAlignRF)
            List <double> dblStationsFinal = wd.getPNT_DATA_FINAL(objAlignPL, objAlignRF);

            fWall1.Stations = dblStationsFinal;

            //----------------------------------------------------------------------------------------------------------------------------------------------------------------


            if ((fWall1.Stations == null))
            {
                return;
            }
            else
            {
                objProfileRF = Prof.getProfile(objAlignRF.Name, "CPNT");
                objprofilePL = Prof.getProfile(objAlignPL.Name, "EXIST");
            }

            //-------CREATE PROFILE FOR DESIGN SURFACE AT WALL/PL ALIGNMENT

            try
            {
                Prof.removeProfile(objAlignPL.ObjectId, "CPNT");
                //Dim idProfileStyle As ObjectId = Prof_Style.getProfileStyle("WALL")
                //Dim idStyleLabelSet As ObjectId = Prof_Style.getProfileLabelSetStyle("WALL")
                ObjectId idProfileStyle  = Prof_Style.getProfileStyle("Standard");
                ObjectId idStyleLabelSet = Prof_Style.getProfileLabelSetStyle("Standard");

                using (BaseObjs._acadDoc.LockDocument())
                {
                    using (Transaction TR = BaseObjs.startTransactionDb())
                    {
                        objProfileDES = Prof.addProfileByLayout("CPNT", objAlignPL.ObjectId, idLayer, idProfileStyle, idStyleLabelSet);

                        TR.Commit();
                    }
                }
            }
            catch (Autodesk.AutoCAD.Runtime.Exception)
            {
            }

            double dblAngOFF  = 0;
            double dblAngWALL = 0;
            double dblSkew    = 0;

            Point3d pnt3dBeg = default(Point3d);
            Point3d pnt3dEnd = default(Point3d);

            pnt3dBeg  = objAlignRF.StartPoint;
            pnt3dEnd  = objAlignRF.EndPoint;
            dblAngOFF = Measure.getAzRadians(pnt3dBeg, pnt3dEnd);

            pnt3dBeg   = objAlignPL.StartPoint;
            pnt3dEnd   = objAlignPL.EndPoint;
            dblAngWALL = Measure.getAzRadians(pnt3dBeg, pnt3dEnd);

            dblSkew = dblAngWALL - dblAngOFF;

            bool boolStart = false;
            bool boolDone  = false;


            for (int i = 0; i < dblStationsFinal.Count; i++)
            {
                dblStationRF = Math.roundDown1(dblStationsFinal[i]);
                //CURRENT STATION ON RF

                objAlignRF.PointLocation(dblStationRF, 0.0, ref dblEasting, ref dblNorthing);

                try
                {
                    objAlignPL.StationOffset(dblEasting, dblNorthing, ref dblStationPL, ref dblOffsetPL);
                    // CORRESPONDING STATION ON PL
                }
                catch (Autodesk.Civil.PointNotOnEntityException)
                {
                    dblStationPL = 0.0;
                }


                if (System.Math.Round(dblStationPL, 1) >= System.Math.Round(objAlignPL.StartingStation, 1))
                {
                    boolStart = true;
                }


                if (System.Math.Round(dblStationPL, 1) <= System.Math.Round(objAlignPL.EndingStation, 1))
                {
                    boolDone = false;
                }


                if (boolStart == true & boolDone == false)
                {
                    dblElevRF = objProfileRF.ElevationAt(dblStationRF);
                    //elevation on RF at current RF station
                    dblElevFL = dblElevRF + (X0 - 0.15) * S0;
                    dblElevTC = dblElevFL + CF / 12;

                    dblElevPL = objprofilePL.ElevationAt(dblStationPL);


                    if (dblElevRF > 0 & dblElevPL > 0)
                    {
                        dblElevTS = dblElevPL - (B2 * S2);

                        objAlignRF.PointLocation(dblStationRF, X0 - 0.15, ref dblEasting, ref dblNorthing);
                        pnt3d = new Point3d(dblEasting, dblNorthing, dblElevFL);
                        pnts3dFL.Add(pnt3d);

                        objAlignRF.PointLocation(dblStationRF, X0, ref dblEasting, ref dblNorthing);
                        pnt3d = new Point3d(dblEasting, dblNorthing, dblElevTC);
                        pnts3dTC.Add(pnt3d);

                        if (dblElevTS - dblElevTC > 0)
                        {
                            boolDesLow  = true;
                            boolDesHigh = false;
                        }
                        else if (dblElevTC - dblElevTS > 0)
                        {
                            boolDesHigh = true;
                            boolDesLow  = false;
                        }


                        if (boolDesLow)
                        {
                            objAlignRF.PointLocation(dblStationRF, B1, ref dblEasting, ref dblNorthing);
                            //point location at back of B1

                            try
                            {
                                objAlignPL.StationOffset(dblEasting, dblNorthing, ref dblStationPL, ref dblOffsetPL);
                            }
                            catch (Autodesk.Civil.PointNotOnEntityException)
                            {
                                dblStationPL = 0.0;
                            }


                            if (dblStationPL == 0)
                            {
                                pnt3dBeg = new Point3d(dblEasting, dblNorthing, 0.0);
                                pnt3dEnd = objAlignPL.EndPoint;

                                dblOffsetPL = pnt3dBeg.getDistance(pnt3dEnd);
                            }

                            XT = System.Math.Abs(dblOffsetPL) - X0;
                            X2 = ((dblElevTC - dblElevPL) + (XT - B2) * S1 + (B2 * S2)) / (S1 - SG);
                            //slope width


                            if (X2 >= 0)
                            {
                                X1 = XT - X2;


                                if (X1 >= 0)
                                {
                                    dblElevTOE = dblElevTC + (S1 * B1) + (X1 * S1);

                                    objAlignPL.PointLocation(dblStationPL, (X2 + B2) * intSign, ref dblEasting, ref dblNorthing);
                                    //point perp to PL
                                    pnt3d = new Point3d(dblEasting, dblNorthing, dblElevTOE);
                                    pnts3dTOE.Add(pnt3d);

                                    dblElevTS = dblElevTOE + X2 * SG;

                                    objAlignPL.PointLocation(dblStationPL, (B2)*intSign, ref dblEasting, ref dblNorthing);
                                    pnt3d = new Point3d(dblEasting, dblNorthing, dblElevTS);
                                    pnts3dTS.Add(pnt3d);

                                    dblElevTOP = dblElevTS + B2 * S2;

                                    objAlignPL.PointLocation(dblStationPL, 0.0, ref dblEasting, ref dblNorthing);
                                    pnt3d = new Point3d(dblEasting, dblNorthing, dblElevTOP);
                                    pnts3dTOP.Add(pnt3d);


                                    try
                                    {
                                        objProfileDES.PVIs.AddPVI(dblStationPL, dblElevTOP);
                                    }
                                    catch (Autodesk.AutoCAD.Runtime.Exception)
                                    {
                                    }
                                }
                                else
                                {
                                    //here is where we put the wall at the limit of pavement or at back of B1

                                    X1 = B1;
                                    X2 = XT - X1;

                                    dblElevTOE = dblElevTC + X1 * S1;

                                    objAlignRF.PointLocation(dblStationRF, X1 + 0.1, ref dblEasting, ref dblNorthing);
                                    //point perp to RF
                                    pnt3d = new Point3d(dblEasting, dblNorthing, dblElevTOE);
                                    pnts3dTOE.Add(pnt3d);

                                    dblElevTS = dblElevTOE + X2 * SG;

                                    objAlignPL.PointLocation(dblStationPL, B2 * intSign, ref dblEasting, ref dblNorthing);
                                    //point perp to PL
                                    pnt3d = new Point3d(dblEasting, dblNorthing, dblElevTS);
                                    pnts3dTS.Add(pnt3d);

                                    dblElevTOP = dblElevTS + B2 * S2;

                                    objAlignPL.PointLocation(dblStationPL, 0.0, ref dblEasting, ref dblNorthing);
                                    //point perp to PL
                                    pnt3d = new Point3d(dblEasting, dblNorthing, dblElevTOP);
                                    pnts3dTOP.Add(pnt3d);

                                    //wall location

                                    dblElevWT0 = dblElevPL + 1.0;

                                    pnt3d = new Point3d(dblEasting, dblNorthing, dblElevWT0);
                                    pnts3dWT0.Add(pnt3d);

                                    dblElevWB0 = dblElevTOP - 1.0;

                                    pnt3d = new Point3d(dblEasting, dblNorthing, dblElevWB0);
                                    pnts3dWB0.Add(pnt3d);

                                    dblElevWTB = dblElevWT0;

                                    objAlignPL.PointLocation(dblStationRF, dblWallWidth * intSign * -1, ref dblEasting, ref dblNorthing);
                                    pnt3d = new Point3d(dblEasting, dblNorthing, dblElevWT0);
                                    pnts3dWTB.Add(pnt3d);

                                    dblElevWBB = dblElevWB0;
                                    pnt3d      = new Point3d(dblEasting, dblNorthing, dblElevWBB);
                                    pnts3dWBB.Add(pnt3d);


                                    try
                                    {
                                        objProfileDES.PVIs.AddPVI(dblStationRF, dblElevTOP);
                                    }
                                    catch (Autodesk.AutoCAD.Runtime.Exception)
                                    {
                                    }
                                }
                            }

                            //wall at pl
                        }
                        else if (boolDesHigh)
                        {
                            X1 = B1;
                            X2 = XT - X1;

                            dblElevTOE = dblElevTC + X1 * S1;

                            objAlignRF.PointLocation(dblStationRF, X1 + 0.1, ref dblEasting, ref dblNorthing);
                            //point perp to OFF at back of bench
                            pnt3d = new Point3d(dblEasting, dblNorthing, dblElevTOE);
                            pnts3dTOE.Add(pnt3d);

                            dblElevTS = dblElevTOE + X2 * S1;

                            objAlignPL.PointLocation(dblStationPL, B2 * intSign, ref dblEasting, ref dblNorthing);
                            pnt3d = new Point3d(dblEasting, dblNorthing, dblElevTS);
                            pnts3dTS.Add(pnt3d);

                            dblElevTOP = dblElevTS + B2 * S2;

                            objAlignPL.PointLocation(dblStationRF, 0, ref dblEasting, ref dblNorthing);
                            pnt3d = new Point3d(dblEasting, dblNorthing, dblElevTOP);
                            pnts3dTOP.Add(pnt3d);

                            //WALL Limits

                            dblElevWT0 = dblElevTOP + 1.0;
                            //wall top 0 offset
                            objAlignPL.PointLocation(dblStationRF, 0, ref dblEasting, ref dblNorthing);
                            pnt3d = new Point3d(dblEasting, dblNorthing, dblElevWT0);
                            pnts3dWT0.Add(pnt3d);

                            dblElevWB0 = dblElevPL - 1.0;
                            //wall bottom 0.1 offset

                            objAlignPL.PointLocation(dblStationRF, 0.1 * intSign, ref dblEasting, ref dblNorthing);
                            pnt3d = new Point3d(dblEasting, dblNorthing, dblElevWB0);
                            pnts3dWB0.Add(pnt3d);

                            dblElevWTB = dblElevWT0;
                            //wall top WallWidth offset

                            objAlignPL.PointLocation(dblStationRF, dblWallWidth * intSign * -1, ref dblEasting, ref dblNorthing);
                            pnt3d = new Point3d(dblEasting, dblNorthing, dblElevWT0);
                            pnts3dWTB.Add(pnt3d);

                            dblElevWBB = dblElevWB0;
                            //Wall bottom WallWidth + 0.1 offset

                            objAlignPL.PointLocation(dblStationRF, (dblWallWidth + 0.1) * intSign * -1, ref dblEasting, ref dblNorthing);
                            pnt3d = new Point3d(dblEasting, dblNorthing, dblElevWBB);
                            pnts3dWBB.Add(pnt3d);


                            try
                            {
                                objProfileDES.PVIs.AddPVI(dblStationRF, dblElevTOP);
                            }
                            catch (Autodesk.AutoCAD.Runtime.Exception)
                            {
                            }
                        }
                    }
                }
            }


            try
            {
                ObjectIdCollection objEntIDs     = new ObjectIdCollection();
                ObjectIdCollection objEntWallIDs = new ObjectIdCollection();

                TypedValue[] tvs = new TypedValue[2];
                tvs[0] = new TypedValue(1001, "WALL");

                idPoly3d = Base_Tools45.Draw.addPoly3d(pnts3dFL, "CPNT-BRKLINE", 1);
                tvs[1]   = new TypedValue(1000, "FL");
                idPoly3d.setXData(tvs, "WALL");
                objEntIDs.Add(idPoly3d);


                idPoly3d = Base_Tools45.Draw.addPoly3d(pnts3dTC, "CPNT-BRKLINE", 2);
                tvs[1]   = new TypedValue(1000, "TC");
                idPoly3d.setXData(tvs, "WALL");
                objEntIDs.Add(idPoly3d);

                idPoly3d = Base_Tools45.Draw.addPoly3d(pnts3dTOE, "CPNT-BRKLINE", 3);
                tvs[1]   = new TypedValue(1000, "TOE");
                idPoly3d.setXData(tvs, "WALL");
                objEntIDs.Add(idPoly3d);

                idPoly3d = Base_Tools45.Draw.addPoly3d(pnts3dTS, "CPNT-BRKLINE", 4);
                tvs[1]   = new TypedValue(1000, "TS");
                idPoly3d.setXData(tvs, "WALL");
                objEntIDs.Add(idPoly3d);

                idPoly3d = Base_Tools45.Draw.addPoly3d(pnts3dTOP, "CPNT-BRKLINE", 5);
                tvs[1]   = new TypedValue(1000, "TOP");
                idPoly3d.setXData(tvs, "WALL");
                objEntIDs.Add(idPoly3d);

                string strLayer = string.Format("{0}-BRKLINE", objAlignPL.Name);
                Layer.manageLayers(strLayer);

                idPoly3d = Base_Tools45.Draw.addPoly3d(pnts3dWB0, strLayer, 11);
                tvs[1]   = new TypedValue(1000, "WB0");
                idPoly3d.setXData(tvs, "WALL");
                objEntWallIDs.Add(idPoly3d);

                idPoly3d = Base_Tools45.Draw.addPoly3d(pnts3dWT0, strLayer, 170);
                tvs[1]   = new TypedValue(1000, "WT0");
                idPoly3d.setXData(tvs, "WALL");
                objEntWallIDs.Add(idPoly3d);

                idPoly3d = Base_Tools45.Draw.addPoly3d(pnts3dWTB, strLayer, 170);
                tvs[1]   = new TypedValue(1000, "WTB");
                idPoly3d.setXData(tvs, "WALL");
                objEntWallIDs.Add(idPoly3d);

                idPoly3d = Base_Tools45.Draw.addPoly3d(pnts3dWBB, strLayer, 11);
                tvs[1]   = new TypedValue(1000, "WBB");
                idPoly3d.setXData(tvs, "WALL");
                objEntWallIDs.Add(idPoly3d);

                ObjectIdCollection objEntEndIDs = default(ObjectIdCollection);
                objEntEndIDs = wdp.makeEndBrklinesWALL(strLayer, objEntIDs, false);

                bool       exists         = false;
                TinSurface objSurfaceCPNT = Surf.getTinSurface("CPNT-ON", out exists);

                objSurfaceCPNT.BreaklinesDefinition.AddStandardBreaklines(objEntIDs, 0, 0, 0, 0);
                objSurfaceCPNT.BreaklinesDefinition.AddStandardBreaklines(objEntEndIDs, 0, 0, 0, 0);

                TinSurface objSurfaceWall = Surf.getTinSurface(objAlignPL.Name, out exists);
                objSurfaceWall.BreaklinesDefinition.AddStandardBreaklines(objEntWallIDs, 0, 0, 0, 0);

                objEntEndIDs = wdp.makeEndBrklinesWALL(strLayer, objEntWallIDs, true);
                objSurfaceWall.BreaklinesDefinition.AddStandardBreaklines(objEntEndIDs, 0, 0, 0, 0);
            }
            catch (Autodesk.AutoCAD.Runtime.Exception)
            {
            }

            objProfileDES.Layer = strLayerName;
        }
Example #24
0
        getStationing(ref List <POI> varpoi, double dblStaBeg, double dblStaEnd)
        {
            POI  vPoi;
            bool boolBC  = false;
            bool boolEC  = false;
            bool boolSta = true;

            double dblInterval0 = double.Parse(fStake.cboInterval.Text);
            double dblTolerance = double.Parse(fStake.cboTolerance.Text);

            //BEGIN ON-STATION
            if (fStake.optYes.Checked)
            {
                double dblSta = getNominalStation(dblStaBeg, dblInterval0);

                //get nominal stations
                POI vPoiCur = new POI();
                do
                {
                    dblSta += dblInterval0;
                    boolSta = false;
                    for (int x = 0; x < varpoi.Count; x++)
                    {
                        vPoiCur = varpoi[x];
                        if (System.Math.Abs(varpoi[x].Station - dblSta) < double.Parse(fStake.cboTolerance.Text))
                        {
                            dblSta  = varpoi[x].Station;
                            boolSta = true;
                            break;
                        }
                    }

                    if (boolSta == false && dblSta < dblStaEnd)
                    {
                        vPoi          = new POI();
                        vPoi.Station  = Math.roundDown3(dblSta);
                        vPoi.ClassObj = fStake.ClassObj;

                        if (fStake.ClassObj == "WALL")
                        {
                            vPoi.Desc0   = vPoiCur.Desc0;
                            vPoi.ElevTOF = vPoiCur.ElevTOF;
                            vPoi.ElevTOW = vPoiCur.ElevTOW;
                        }
                        varpoi.Add(vPoi);
                    }
                } while (dblSta < dblStaEnd);

                var sortPOI = from p in varpoi
                              orderby p.Station ascending
                              select p;

                varpoi = varpoi.sortPOIbyStation();

                int        n         = 0;
                List <POI> varPoiTmp = new List <POI>();

                for (int j = 0; j < varpoi.Count; j++)
                {
                    if (varpoi[j].Desc0 == "BC")
                    {
                        n = j;

                        do
                        {
                            n += 1;
                            if (varpoi[n].Desc0 != "EC" & varpoi[n].Desc0 != "BC")
                            {
                                boolEC = false;
                            }
                            else
                            {
                                break;
                            }
                        } while (true);
                        //----------------------------------------------------------------------------------
                        int p = 0;
                        for (p = j; p < n; p++)
                        {
                            varPoiTmp.Add(varpoi[j]);
                            double dblStaBeg0 = getNominalStation(varpoi[p].Station, dblInterval0 / 2);

                            do
                            {
                                if (dblStaBeg0 - varpoi[p].Station > dblTolerance && varpoi[p + 1].Station - dblStaBeg0 > dblTolerance)
                                {
                                    varPoiTmp.Add(new POI {
                                        Station = dblStaBeg0, ClassObj = fStake.ClassObj
                                    });
                                }
                                else if (varpoi[p + 1].Station - dblStaBeg0 <= dblTolerance)
                                {
                                    varPoiTmp.Add(varpoi[p + 1]);
                                    break;
                                }

                                dblStaBeg0 += dblInterval0 / 2;
                            } while (true);
                        }
                        j = p;
                    }
                    else
                    {
                        varPoiTmp.Add(varpoi[j]);
                    }
                }

                var sortTmp = from p in varPoiTmp
                              orderby p.Station ascending
                              select p;

                varpoi = varPoiTmp.sortPOIbyStation();

                if (varpoi[varpoi.Count - 1].Station > dblStaEnd)
                {
                    varpoi.RemoveAt(varpoi.Count - 1);
                }

                //END GET NOMINAL STATIONS

                //BEGIN GET EVEN INTERVALS
            }
            else//not fStake.optYes
            {
                boolBC = false;
                boolEC = true;

                if (varpoi[0].Desc0 == "BC")
                {
                    boolBC = true;
                    boolEC = false;
                }

                for (int i = 1; i < varpoi.Count; i++)
                {
                    switch (varpoi[i].Desc0)
                    {
                    case "BC":
                    case "PCC":

                        boolBC = true;

                        if (boolEC)
                        {
                            getStationsOnTangent(ref i, varpoi, dblInterval0, dblTolerance);
                        }

                        boolEC = false;

                        break;

                    case "EC":

                        boolBC = false;
                        boolEC = true;

                        break;

                    default:

                        if (!boolBC & boolEC)
                        {
                            getStationsOnTangent(ref i, varpoi, dblInterval0, dblTolerance);
                        }

                        break;
                    }
                } //END GET EVEN INTERVALS
            }     //END ON-STATION
        }
Example #25
0
        getNestedEntities(ObjectId idAlign, ref List <POI> pois, BlockTableRecord btrXRefDbModelSpace)
        {
            Alignment align       = (Alignment)idAlign.getEnt();
            double    alignLength = align.Length;

            string strNameStakeObject = fStake.NameStakeObject;
            string strLayerName       = strNameStakeObject + "-TEMP";

            Layer.manageLayers(strLayerName);
            Layer.manageLayer(strLayerName, 2);

            Point3d varPntBeg, varPntEnd;

            List <ObjectId> ids = new List <ObjectId>();

            foreach (ObjectId id in btrXRefDbModelSpace)
            {
                Entity ent = id.getEnt();

                int intPos = ent.Layer.IndexOf("|");

                string strLayerObj = ent.Layer.Substring(intPos + 1);

                List <string> layers = new List <string> {
                    strNameStakeObject, "CURB", "FL", "GB", "EC", "BLDG", "SEWER", "WATER", "SD-CL", "PROP-WAT"
                };

                if (layers.Contains(strLayerObj))
                {
                    switch (ent.GetType().ToString())
                    {
                    case "Line":
                        ids.Add(ent.ObjectId);
                        break;

                    case "Arc":
                        ids.Add(ent.ObjectId);
                        break;

                    case "Polyline":
                        ids.Add(ent.ObjectId);
                        break;
                    }
                }
            }

            double dblStationBeg = 0, dblStationEnd = 0;
            double dblOffsetBeg = 0, dblOffsetEnd = 0;

            color = new Color();
            color = Color.FromColorIndex(ColorMethod.ByBlock, 4);
            for (int i = 0; i < ids.Count; i++)
            {
                ObjectId id = ids[i];

                Entity ent = id.getEnt();
                id.changeProp(color, ent.Layer, LineWeight.LineWeight100);

                int intPos = ent.Layer.IndexOf("|");

                string strLayerObj = ent.Layer.Substring(intPos + 1);

                if (strLayerObj == strNameStakeObject)
                {
                    switch (ent.GetType().Name)
                    {
                    case "Arc":

                        Arc objArc = (Arc)ent;

                        varPntBeg = objArc.StartPoint;
                        varPntEnd = objArc.EndPoint;

                        align.StationOffset(varPntBeg.X, varPntBeg.Y, ref dblStationBeg, ref dblOffsetBeg);
                        align.StationOffset(varPntEnd.X, varPntEnd.Y, ref dblStationEnd, ref dblOffsetEnd);

                        break;

                    case "Line":

                        Line line = (Line)ent;

                        varPntBeg = line.StartPoint;
                        varPntEnd = line.EndPoint;

                        align.StationOffset(varPntBeg.X, varPntBeg.Y, ref dblStationBeg, ref dblOffsetBeg);
                        align.StationOffset(varPntEnd.X, varPntEnd.Y, ref dblStationEnd, ref dblOffsetEnd);

                        break;

                    case "Polyline":

                        Polyline poly = (Polyline)ent;
                        varPntBeg = poly.StartPoint;
                        varPntEnd = poly.EndPoint;

                        align.StationOffset(varPntBeg.X, varPntBeg.Y, ref dblStationBeg, ref dblOffsetBeg);
                        align.StationOffset(varPntEnd.X, varPntEnd.Y, ref dblStationEnd, ref dblOffsetEnd);

                        break;
                    }

                    if (dblStationBeg >= align.StartingStation & dblStationBeg <= align.EndingStation)
                    {
                        if (dblStationEnd >= align.StartingStation & dblStationEnd <= align.EndingStation)
                        {
                            if (System.Math.Abs(dblOffsetBeg) < 0.1)
                            {
                                POI poi = new POI();

                                poi.Station   = Math.roundDown3(dblStationBeg);
                                poi.ClassObj  = fStake.ClassObj;
                                poi.Desc0     = "TEE";
                                poi.CrossDesc = "TEE";

                                if (dblOffsetEnd > 0)
                                {
                                    poi.Side = 1;
                                }
                                else
                                {
                                    poi.Side = -1;
                                }

                                pois.Add(poi);
                            }
                            else if (System.Math.Abs(dblOffsetEnd) < 0.1)
                            {
                                POI poi = new POI();

                                poi.Station   = Math.roundDown3(dblStationEnd);
                                poi.ClassObj  = fStake.ClassObj;
                                poi.Desc0     = "TEE";
                                poi.CrossDesc = "TEE";

                                if (dblOffsetBeg > 0)
                                {
                                    poi.Side = 1;
                                }
                                else
                                {
                                    poi.Side = -1;
                                }

                                pois.Add(poi);
                            }
                        }
                    }
                }
                else
                {
                    List <Point3d> varPntInt = align.intersectWith(ent, false, extend.source);

                    try
                    {
                        for (int n = 0; n <= varPntInt.Count; n++)
                        {
                            Point3d pnt3dInt = varPntInt[i];
                            align.StationOffset(pnt3dInt.X, pnt3dInt.Y, ref dblStationBeg, ref dblOffsetBeg);

                            POI poi = new POI();

                            poi.Station   = Math.roundDown3(dblStationBeg);
                            poi.ClassObj  = fStake.ClassObj;
                            poi.Desc0     = strLayerObj;
                            poi.CrossDesc = strLayerObj;

                            if (strLayerObj.Contains("SEW") || strLayerObj.Contains("WAT") || strLayerObj.Contains("SD") || strLayerObj.Contains("WTR"))
                            {
                                poi.Type = strLayerObj;
                            }

                            pois.Add(poi);
                        }
                    }
                    catch (System.Exception)
                    {
                    }
                }
            }

            for (int i = 0; i < ids.Count; i++)
            {
                ids[i].delete();
            }
        }
Example #26
0
        public static void reverseAlign(ObjectId idAlign)
        {
            List <POI>           varpoi      = null;
            List <POI>           varPOI_ORG  = null;
            List <POI>           varPOI_Temp = null;
            ProfilePVICollection objPVIs     = null;

            string nameLayer = idAlign.getLayer();

            TypedValue[] tvs = new TypedValue[9];
            tvs.SetValue(new TypedValue((int)DxfCode.Operator, "<OR"), 0);
            tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(Polyline)).DxfName), 1);
            tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(Leader)).DxfName), 2);
            tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(DBText)).DxfName), 3);
            tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(MText)).DxfName), 4);
            tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(Circle)).DxfName), 5);
            tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(Dimension)).DxfName), 6);
            tvs.SetValue(new TypedValue((int)DxfCode.Operator, "OR>"), 7);
            tvs.SetValue(new TypedValue((int)DxfCode.LayerName, nameLayer), 8);

            SelectionSet ss = Select.buildSSet(tvs);

            ObjectId[] ids = ss.GetObjectIds();
            foreach (ObjectId id in ids)
            {
                id.delete();
            }

            Alignment objAlign    = (Alignment)idAlign.getEnt();
            double    dblLenAlign = objAlign.Length;

            switch (fStake.ClassObj)
            {
            case "BLDG":
                Profile profCPNT = Prof.getProfile(idAlign, "CPNT");
                objPVIs = profCPNT.PVIs;
                break;

            case "CURB":
                Profile profFLOWLINE = Prof.getProfile(idAlign, "FLOWLINE");
                objPVIs = profFLOWLINE.PVIs;

                break;

            case "FL":

                profCPNT = Prof.getProfile(idAlign, "CPNT");
                objPVIs  = profCPNT.PVIs;

                break;

            case "SEWER":
            case "WTR":

                profCPNT = Prof.getProfile(idAlign, "CPNT");
                objPVIs  = profCPNT.PVIs;

                break;

            case "ALIGN":

                Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Object is an existing design alignment - exiting");
                return;
            }

            int j = objPVIs.Count;

            for (int i = 0; i < j; i++)
            {
                varPOI_Temp[i].Station = Math.roundDown3(dblLenAlign - (objPVIs[i].Station - objAlign.StartingStation)) + objAlign.StartingStation;
                //starting station is always 100
                varPOI_Temp[i].Elevation = objPVIs[i].Elevation;
            }

            objAlign.Reverse();

            varpoi = fStake.POI_CALC;

            //reverse varPOI stationing
            //need all POIs for descriptions
            for (int i = 0; i < varpoi.Count; i++)
            {
                varpoi[i].Station = Math.roundDown3(dblLenAlign - (varpoi[i].Station - objAlign.StartingStation)) + objAlign.StartingStation;
                //starting station is always 100
                varpoi[i].Side = varpoi[i].Side * -1;

                switch (varpoi[i].Desc0)
                {
                case "AP":

                    if (varpoi[i].isRightHand)
                    {
                        varpoi[i].AngDir = varpoi[i].AngDir + varpoi[i].AngDelta;
                    }
                    else
                    {
                        varpoi[i].AngDir = varpoi[i].AngDir - varpoi[i].AngDelta;
                    }

                    varpoi[i].isRightHand = !varpoi[i].isRightHand;

                    break;

                case "BC":

                    varpoi[i].Desc0 = "EC";
                    varpoi[i].DescX = varpoi[i].DescX.Replace("BC", "EC");

                    break;

                case "EC":

                    varpoi[i].Desc0 = "BC";
                    varpoi[i].DescX = varpoi[i].DescX.Replace("EC", "BC");

                    break;
                }
            }

            varPOI_ORG = fStake.POI_ORG;

            //reverse varPOI_ORG stationing
            //need all POIs for descriptions
            for (int i = 0; i < varPOI_ORG.Count; i++)
            {
                varPOI_ORG[i].Station = Math.roundDown3(dblLenAlign - (varPOI_ORG[i].Station - objAlign.StartingStation)) + objAlign.StartingStation;
                //starting station is always 100
            }
            List <POI> poiTmp = new List <POI>();

            var sortPOI = from p in varpoi
                          orderby p.Station ascending
                          select p;

            foreach (var p in sortPOI)
            {
                poiTmp.Add(p);
            }
            varpoi = poiTmp;

            poiTmp = new List <POI>();
            var sortPOI_ORG = from n in varPOI_ORG
                              orderby n.Station ascending
                              select n;

            foreach (var n in sortPOI_ORG)
            {
                poiTmp.Add(n);
            }
            varPOI_ORG = poiTmp;

            poiTmp = new List <POI>();
            var sortPOI_Temp = from t in varPOI_Temp
                               orderby t.Station ascending
                               select t;

            foreach (var t in sortPOI_Temp)
            {
                poiTmp.Add(t);
            }
            varPOI_Temp = poiTmp;

            j = varpoi.Count;
            varpoi[0].DescX = varpoi[0].DescX.Replace("END", "BEG");
            varpoi[j].DescX = varpoi[j].DescX.Replace("BEG", "END");

            ObjectId idTable = Stake_Table.getTableId(idAlign);

            Stake_Table.addTableData(idTable, varpoi);

            fStake.POI_CALC = varpoi;
            fStake.POI_ORG  = varPOI_ORG;

            switch (fStake.ClassObj)
            {
            case "BLDG":

                Stake_AddProfile.makeProfile(idAlign, varPOI_Temp, "STAKE", "ByLayout", true);
                Stake_UpdateProfile.updateProfile(idAlign, (fStake.POI_ORG), "STAKE", true, "STAKE");

                break;

            case "CURB":

                Stake_AddProfile.makeProfile(idAlign, varPOI_Temp, "CURB", "ByLayout", true);
                Stake_UpdateProfile.updateProfile(idAlign, (fStake.POI_ORG), "FLOWLINE", true, "ORG");

                break;

            case "FL":

                Stake_AddProfile.makeProfile(idAlign, varPOI_Temp, "FLOWLINE", "BySurface", true);
                Stake_UpdateProfile.updateProfile(idAlign, (fStake.POI_ORG), "STAKE", true, "ORG");

                break;

            case "WTR":

                Stake_AddProfile.makeProfile(idAlign, varPOI_Temp, "STAKE", "BySurface", true);
                Stake_UpdateProfile.updateProfile(idAlign, (fStake.POI_ORG), "CPNT", true, "ORG");
                Stake_UpdateProfile.updateProfile(idAlign, varpoi, "STAKE", false, "STAKE");

                break;
            }
        }
Example #27
0
        getNestedPoints(ObjectId idAlign, ref List <POI> varpoi, BlockTableRecord objXRefDbModelSpace, string strSource)
        {
            Alignment objAlign = (Alignment)idAlign.getEnt();

            string strNameStakeObject = fStake.NameStakeObject;
            double dblToleranceLength = 0.15;

            double dblToleranceAngle = PI;

            Point2d varPntRef = objAlign.ReferencePoint;
            string  strFilter = "";

            if (strSource.Contains("GCAL")
                )
            {
                strFilter = "*CPNT*";
            }
            else
            {
                strFilter = "*";
            }

            List <string> strPntNums = new List <string>();
            double        dblStation = 0, dblOffset = 0;
            ResultBuffer  rb = null;

            TypedValue[] tvs = null;

            List <POI> varPOI_PNTs = new List <POI>();

            foreach (ObjectId id in objXRefDbModelSpace)
            {
                bool boolAdd = false;

                Entity objXRefObj = id.getEnt();

                if (objXRefObj is CogoPoint)
                {
                    CogoPoint objPnt = (CogoPoint)objXRefObj;
                    Debug.Print(objPnt.PointNumber.ToString());

                    if (objPnt.Layer.Contains(strFilter))
                    {
                        strPntNums.Add(objPnt.PointNumber.ToString());

                        if (strSource == "GCAL")
                        {
                            rb  = id.getXData("STAKE");
                            tvs = rb.AsArray();
                        }

                        objAlign.StationOffset(objPnt.Easting, objPnt.Northing, ref dblStation, ref dblOffset);

                        Debug.Print(objPnt.Easting + "," + objPnt.Northing);

                        Point2d pnt2d = new Point2d(objPnt.Location.X, objPnt.Location.Y);

                        if (System.Math.Abs(dblOffset) < dblToleranceLength)
                        {
                            if (dblStation >= objAlign.StartingStation && dblStation <= objAlign.EndingStation)
                            {
                                boolAdd = true;
                            }
                        }
                        else if (pnt2d.isEqual(varPntRef, dblToleranceLength))
                        {
                            Point3d pnt3d = new Point3d(objPnt.Easting, objPnt.Northing, 0);

                            double dblAngle1 = Math.roundDown3(pnt2d.getDirection(varPntRef));

                            AlignmentEntity objAlignEnt = objAlign.Entities.EntityAtId(objAlign.Entities.FirstEntity);

                            switch (objAlignEnt.EntityType)
                            {
                            case AlignmentEntityType.Arc:

                                AlignmentArc objAlignEntArc = (AlignmentArc)objAlignEnt;
                                double       dblangle2      = 0;
                                if (objAlignEntArc.Clockwise)
                                {
                                    dblangle2 = objAlignEntArc.StartDirection - PI / 2 + objAlignEntArc.Delta / 2;
                                }
                                else
                                {
                                    dblangle2 = objAlignEntArc.StartDirection + PI / 2 - objAlignEntArc.Delta / 2;
                                }

                                if (System.Math.Abs(dblAngle1 - dblangle2) < dblToleranceAngle)
                                {
                                    boolAdd    = true;
                                    dblStation = objAlign.StartingStation;
                                }
                                else if (System.Math.Abs(Math.roundDown3(dblAngle1 - 2 * PI) - dblangle2) < dblToleranceAngle)
                                {
                                    boolAdd    = true;
                                    dblStation = objAlign.StartingStation;
                                }

                                break;

                            case AlignmentEntityType.Line:

                                AlignmentLine objAlignEntTan = (AlignmentLine)objAlignEnt;

                                dblangle2 = Math.roundDown3((objAlignEntTan.Direction));

                                if (System.Math.Abs(dblAngle1 - dblangle2) < dblToleranceAngle)
                                {
                                    boolAdd    = true;
                                    dblStation = objAlign.StartingStation;
                                }

                                break;
                            }
                        }
                        else
                        {
                            boolAdd = false;
                        }
                    }

                    if (boolAdd == true)
                    {
                        POI varPOI_PNT = new POI();

                        varPOI_PNT.Station   = Math.roundDown3(dblStation);
                        varPOI_PNT.PntNum    = objPnt.PointNumber.ToString();
                        varPOI_PNT.Elevation = System.Math.Round(objPnt.Elevation, 3);

                        if (strSource != "WALLDESIGN")
                        {
                            varPOI_PNT.ClassObj = fStake.ClassObj;
                        }

                        varPOI_PNT.OFFSET    = System.Math.Round(dblOffset, 2);
                        varPOI_PNT.PntSource = strSource;

                        if (strSource == "GCAL")
                        {
                            try
                            {
                                if (isTG(objXRefDbModelSpace, tvs[1].Value.ToString().stringToHandle()))
                                {
                                    varPOI_PNT.Desc0 = "TG";
                                }
                            }
                            catch (System.Exception)
                            {
                                varPOI_PNT.Desc0 = "PNT";
                            }
                        }
                        else if (strSource == "WALLDESIGN")
                        {
                            objAlign.StationOffset(objPnt.Easting, objPnt.Northing, ref dblStation, ref dblOffset);
                            varPOI_PNT.OFFSET    = System.Math.Round(dblOffset, 2);
                            varPOI_PNT.Desc0     = string.Format("{0} {0} {2}", objPnt.RawDescription, varPOI_PNT.OFFSET, varPOI_PNT.Elevation);
                            varPOI_PNT.PntSource = "TOPO";
                        }
                        else
                        {
                            varPOI_PNT.Desc0 = "PNT";
                        }
                        varPOI_PNTs.Add(varPOI_PNT);
                    }
                }
            }

            if (varPOI_PNTs.Count > 0)
            {
                var sortSta = from p in varPOI_PNTs
                              orderby p.Station ascending
                              select p;

                List <POI> poiTmp = new List <POI>();
                foreach (var p in sortSta)
                {
                    poiTmp.Add(p);
                }

                Stake_Util.removeDuplicatePoints(ref poiTmp);

                varPOI_PNTs = poiTmp;

                if (strSource != "WALLDESIGN")
                {
                    fStake.POI_PNTs = varPOI_PNTs;
                }

                if (varPOI_PNTs[0].Desc0 != "NOTHING")
                {
                    for (int i = 0; i < varPOI_PNTs.Count; i++)
                    {
                        varpoi.Add(varPOI_PNTs[i]);
                    }
                }

                poiTmp  = varpoi;
                sortSta = from p in poiTmp
                          orderby p.Station ascending
                          select p;
                varpoi = new List <POI>();
                foreach (var p in sortSta)
                {
                    varpoi.Add(p);
                }

                return(true);
            }
            return(false);
        }
Example #28
0
        getAnglePoints(ObjectId idAlign, ref List <POI> varpoi)
        {
            POI  vPoi       = new POI();
            bool boolClosed = false;

            string  strClass   = fStake.ClassObj;
            Profile objProfile = null;

            switch (strClass)
            {
            case "CURB":
                objProfile = Prof.getProfile(idAlign, "FLOWLINE");
                break;

            case "FL":
                objProfile = Prof.getProfile(idAlign, "STAKE");
                break;

            case "WTR":
                objProfile = Prof.getProfile(idAlign, "CPNT");
                break;

            case "BLDG":
                vPoi = new POI();
                break;
            }

            Alignment objAlign = (Alignment)idAlign.getEnt();
            AlignmentEntityCollection objAlignEnts = objAlign.Entities;
            double          dblElev      = 0;
            bool            isRightHand  = false;
            AlignmentEntity objAlignEnt0 = null;
            AlignmentEntity objAlignEntX = null;
            AlignmentLine   objAlignTan0 = null;
            AlignmentLine   objAlignTanX = null;
            AlignmentArc    objAlignArc0 = null;
            AlignmentArc    objAlignArcX = null;

            if (objAlignEnts.Count > 1)
            {
                for (int i = 0; i < objAlignEnts.Count - 1; i++)
                {
                    objAlignEnt0 = objAlignEnts[i + 0];
                    objAlignEntX = objAlignEnts[i + 1];

                    if (objAlignEnt0.EntityType == AlignmentEntityType.Line)
                    {
                        objAlignTan0 = (AlignmentLine)objAlignEnt0;

                        if (objAlignEntX.EntityType == AlignmentEntityType.Line)
                        {
                            objAlignTanX = (AlignmentLine)objAlignEntX;

                            double dblAng0 = objAlignTan0.StartPoint.getDirection(objAlignTan0.EndPoint);
                            double dblAngX = objAlignTanX.StartPoint.getDirection(objAlignTanX.EndPoint);

                            if (System.Math.Round(dblAng0, 3) != System.Math.Round(dblAngX, 3))
                            {
                                Point3d pnt3d1 = new Point3d(objAlignTan0.StartPoint.X, objAlignTan0.StartPoint.Y, 0);
                                Point3d pnt3d2 = new Point3d(objAlignTan0.EndPoint.X, objAlignTan0.EndPoint.Y, 0);
                                Point3d pnt3d3 = new Point3d(objAlignTanX.EndPoint.X, objAlignTanX.EndPoint.Y, 0);

                                double dblStation = System.Math.Round(objAlignTanX.StartStation, 3);
                                //          Debug.Print i

                                double dblAngDelta = Geom.getAngle3Points(pnt3d1, pnt3d2, pnt3d3);
                                double dblAngDir   = dblAngX;

                                Vector3d v3d1 = pnt3d2 - pnt3d1;
                                Vector3d v3d2 = pnt3d3 - pnt3d2;

                                Vector3d v3dC = v3d1.CrossProduct(v3d2);

                                if (v3dC.Z > 0)
                                {
                                    isRightHand = true;
                                }
                                else
                                {
                                    isRightHand = false;
                                }

                                switch (strClass)
                                {
                                case "CURB":
                                case "FL":
                                case "WTR":

                                    try
                                    {
                                        dblElev = System.Math.Round(objProfile.ElevationAt(dblStation), 3);
                                    }
                                    catch (System.Exception)
                                    {
                                    }

                                    break;
                                }

                                POI vpoi = new POI();

                                vpoi.Station     = dblStation;
                                vpoi.Desc0       = "AP";
                                vpoi.ClassObj    = strClass;
                                vpoi.AngDelta    = dblAngDelta;
                                vpoi.AngDir      = dblAngDir;
                                vpoi.isRightHand = isRightHand;
                                vpoi.Elevation   = dblElev;

                                varpoi.Add(vpoi);
                                varpoi = varpoi.sortPOIbyStation();
                            }
                        }
                    }
                }
            }

            objAlignEnt0 = objAlignEnts[objAlignEnts.FirstEntity - 1];
            objAlignEntX = objAlignEnts[objAlignEnts.LastEntity - 1];

            bool boolArc0 = false;
            bool boolArcX = false;
            bool boolTan0 = false;
            bool boolTanX = false;

            Point2d pnt2dBeg = Point2d.Origin, pnt2dEnd = Point2d.Origin;

            if (objAlignEnt0.EntityType == AlignmentEntityType.Arc)
            {
                objAlignArc0 = (AlignmentArc)objAlignEnt0;
                pnt2dBeg     = objAlignArc0.StartPoint;
                boolArc0     = true;
            }
            else
            {
                objAlignTan0 = (AlignmentLine)objAlignEnt0;
                pnt2dBeg     = objAlignTan0.StartPoint;
                boolTan0     = true;
            }

            if (objAlignEntX.EntityType == AlignmentEntityType.Arc)
            {
                objAlignArcX = (AlignmentArc)objAlignEntX;
                pnt2dEnd     = objAlignArcX.StartPoint;
                boolArcX     = true;
            }
            else
            {
                objAlignTanX = (AlignmentLine)objAlignEntX;
                pnt2dEnd     = objAlignTanX.StartPoint;
                boolTanX     = true;
            }

            if (System.Math.Round(pnt2dEnd.X, 2) == System.Math.Round(pnt2dBeg.X, 2))
            {
                if (System.Math.Round(pnt2dEnd.Y, 2) == System.Math.Round(pnt2dBeg.Y, 2))
                {
                    boolClosed         = true;
                    varpoi[0].isClosed = true;

                    if (boolArc0 & boolArcX)
                    {
                        varpoi[0].Desc0 = "PCC";
                    }
                    else if (boolArc0 & boolTanX)
                    {
                        //do nothing
                    }
                    else if (boolTan0 & boolArcX)
                    {
                        varpoi[0].Desc0 = "EC";
                    }
                    else if (boolTan0 & boolTanX)
                    {
                        Point3d pnt3d1 = new Point3d(objAlignTanX.StartPoint.X, objAlignTanX.StartPoint.Y, 0);
                        Point3d pnt3d2 = new Point3d(objAlignTanX.EndPoint.X, objAlignTanX.EndPoint.Y, 0);
                        Point3d pnt3d3 = new Point3d(objAlignTan0.EndPoint.X, objAlignTan0.EndPoint.Y, 0);

                        double dblAngDelta = Geom.getAngle3Points(pnt3d1, pnt3d2, pnt3d3);

                        double dblAng0   = objAlignTan0.StartPoint.getDirection(objAlignTan0.EndPoint);
                        double dblAngDir = dblAng0;

                        Vector3d v3d1 = pnt3d2 - pnt3d1;
                        Vector3d v3d2 = pnt3d3 - pnt3d2;

                        Vector3d v3dC = v3d1.CrossProduct(v3d2);

                        if (v3dC.Z > 0)
                        {
                            isRightHand = true;
                        }
                        else
                        {
                            isRightHand = false;
                        }

                        if (strClass == "BLDG")
                        {
                            varpoi[0].Station  = objAlignTan0.StartStation;
                            varpoi[0].Desc0    = "AP";
                            varpoi[0].DescX    = "BEG AP";
                            varpoi[0].ClassObj = strClass;
                            varpoi[0].AngDelta = dblAngDelta;
                            varpoi[0].AngDir   = dblAngDir;
                        }
                        else
                        {
                            varpoi[0].Desc0    = "AP";
                            varpoi[0].DescX    = "BEG AP";
                            varpoi[0].AngDelta = dblAngDelta;
                            varpoi[0].AngDir   = dblAngDir;
                        }
                    }
                }
            }

            if (boolClosed)
            {
                int j = varpoi.Count - 1;

                if (varpoi[j].Station != Math.roundDown3((objAlign.EndingStation)))
                {
                    POI vpoi = new POI();
                    vpoi.Station   = Math.roundDown3((objAlign.EndingStation));
                    vpoi.Elevation = varpoi[0].Elevation;
                    if (strClass == "BLDG")
                    {
                        vpoi.DescX = varpoi[0].DescX;
                    }
                    else
                    {
                        vpoi.DescX = "END AP";
                    }
                    vpoi.Desc0    = "AP";
                    vpoi.ClassObj = strClass;
                    vpoi.isClosed = true;

                    varpoi.Add(vpoi);
                }
                else
                {
                    POI vpoi = varpoi[j];

                    vpoi.Elevation = varpoi[0].Elevation;
                    vpoi.Desc0     = "AP";
                    if (strClass == "BLDG")
                    {
                        vpoi.DescX = varpoi[0].DescX;
                    }
                    vpoi.DescX    = "END AP";
                    vpoi.ClassObj = strClass;
                    vpoi.isClosed = true;
                    varpoi[j]     = vpoi;
                }
            }
        }
Example #29
0
        stakeGridPoints(ObjectId idAlign, List <POI> varPOI_STAKE, double staBeg = 0, double staEnd = 0, int side = 0, long begNum = 30000)
        {
            Alignment objAlign = (Alignment)idAlign.getEnt();
            double    dblStation = 0, dblOffset = 0;

            if ((side == 0))
            {
                if (double.Parse(fGrid.tbxOffsetH.Text) != 0)
                {
                    PromptStatus ps;
                    bool         escape = true;

                    Point3d varPntPick = UserInput.getPoint("Select side to place stake points: <ESC to Cancel>", Pub.pnt3dO, out escape, out ps, osMode: 8);
                    if (escape)
                    {
                        return;
                    }

                    objAlign.StationOffset(varPntPick.X, varPntPick.Y, ref dblStation, ref dblOffset);

                    if (System.Math.Abs(dblOffset) > 20.0)
                    {
                        DialogResult varResponse = MessageBox.Show(string.Format("\nPoint selected is more than 20' from Alignment: {0} \nContinue?", objAlign.Name, MessageBoxButtons.YesNo));

                        if (varResponse == DialogResult.No)
                        {
                            return;
                        }
                    }
                    if (dblOffset < 0)
                    {
                        side = -1;
                    }
                    else
                    {
                        side = 1;
                    }
                    fStake.Side = side;
                }
                else
                {
                    fStake.Side = 1;
                }
            }
            else
            {
                fStake.Side = side;
            }

            fStake.STAKE_LAYER = fGrid.tbxOffsetH.Text + "-OS-" + objAlign.Name;

            dblOffset = double.Parse(fGrid.tbxOffsetH.Text);
            string strName = fStake.NameStakeObject;

            double dblStaBeg = Math.roundDown3((objAlign.StartingStation));
            double dblStaEnd = Math.roundDown3((objAlign.EndingStation));

            uint lngPntNumBeg = Stake_Util.getBegPntNum();

            fStake.NextPntNum = lngPntNumBeg;

            CogoPointCollection cgPnts = CivilApplication.ActiveDocument.CogoPoints;

            fStake.POI_STAKED = new List <POI>();

            //**********PROCESS varPOI_STAKE*********************
            for (int i = 0; i <= varPOI_STAKE.Count; i++)
            {
                if (varPOI_STAKE[i].DescX == "")
                {
                    POI vPOI_STAKE = varPOI_STAKE[i];
                    vPOI_STAKE.DescX = vPOI_STAKE.Desc0;
                    varPOI_STAKE[i]  = vPOI_STAKE;
                }

                if (i == varPOI_STAKE.Count - 1)
                {
                    break;
                }

                double dblElev = varPOI_STAKE[i].Elevation;

                switch (varPOI_STAKE[i].Desc0)
                {
                case "AP":

                    switch (side)
                    {
                    case 1:
                        //right side

                        //counterclockwise
                        if (varPOI_STAKE[i].isRightHand)
                        {
                            if (fGrid.optPBC.Checked)
                            {
                                Stake_Calc.doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, side, dblOffset);
                            }
                            else if (fGrid.optRBC.Checked)
                            {
                                Stake_Calc.doAnglePointOUT_RBC(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, side, dblOffset);
                            }
                            //clockwise
                        }
                        else
                        {
                            Stake_Calc.doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, side, dblOffset);
                        }

                        break;

                    case -1:
                        //left side

                        //counterclockwise
                        if (varPOI_STAKE[i].isRightHand)
                        {
                            Stake_Calc.doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, side, dblOffset);
                            //clockwise
                        }
                        else
                        {
                            if (fGrid.optPBC.Checked)
                            {
                                Stake_Calc.doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, side, dblOffset);
                            }
                            else if (fGrid.optRBC.Checked)
                            {
                                Stake_Calc.doAnglePointOUT_RBC(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, side, dblOffset);
                            }
                        }

                        break;
                    }

                    break;

                default:

                    string strDesc = varPOI_STAKE[i].DescX;
                    double dblEasting = 0, dblNorthing = 0;
                    try
                    {
                        objAlign.PointLocation(varPOI_STAKE[i].Station, dblOffset * side, ref dblEasting, ref dblNorthing);
                    }
                    catch (IndexOutOfRangeException)
                    {
                        try
                        {
                            objAlign.PointLocation(varPOI_STAKE[i].Station - 0.01, dblOffset * side, ref dblEasting, ref dblNorthing);
                        }
                        catch (IndexOutOfRangeException)
                        {
                            objAlign.PointLocation(varPOI_STAKE[i].Station + 0.01, dblOffset * side, ref dblEasting, ref dblNorthing);
                        }
                    }

                    Point3d dblPnt = new Point3d(dblEasting, dblNorthing, varPOI_STAKE[i].Elevation);

                    string strOffset = dblOffset.ToString();
                    Stake_Calc.setOffsetPoint(dblPnt, strOffset, strName, strDesc, idAlign, varPOI_STAKE[i].Station);

                    break;
                }
            }

            List <POI> varPOI_STAKED = fStake.POI_STAKED;
            int        k             = varPOI_STAKED.Count - 1;

            uint lngPntNumEnd = uint.Parse(varPOI_STAKED[k].PntNum);

            TypedValue[] tvs = new TypedValue[4] {
                new TypedValue(1001, "STAKE"),
                new TypedValue(1071, lngPntNumBeg),
                new TypedValue(1071, lngPntNumEnd),
                new TypedValue(1000, fStake.STAKE_LAYER)
            };

            idAlign.setXData(tvs, "STAKE");

            CgPnt_Group.updatePntGroup("SPNT");

            Stake_UpdateProfile.updateProfile(idAlign, (fStake.POI_STAKED), "STAKE", true, "STAKED");

            bool     exists = false;
            ObjectId idDict = Dict.getNamedDictionary("STAKE_PNTS", out exists);

            List <Point3d> dblPnts = new List <Point3d>();
            Point3d        pnt3d   = Pub.pnt3dO;

            for (int p = 0; p < varPOI_STAKED.Count; p++)
            {
                ObjectId idPnt = BaseObjs._civDoc.CogoPoints.GetPointByPointNumber(uint.Parse(varPOI_STAKED[p].PntNum));
                pnt3d = idPnt.getCogoPntCoordinates();
                dblPnts.Add(pnt3d);
                ResultBuffer rb = new ResultBuffer {
                    new TypedValue(1000, idPnt.getCogoPntNumber().ToString()),
                    new TypedValue(1005, idPnt.getHandle().ToString())
                };
                Dict.addXRec(idDict, idPnt.ToString(), rb);
            }

            dblPnts.Add(dblPnts[0]);
            Draw.addPoly(dblPnts, fStake.STAKE_LAYER, 9);

            Misc.logUsage("STAKE", (lngPntNumEnd - lngPntNumBeg + 1));
        }