示例#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;
            }
        }
示例#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;
                    }
                }
            }
        }
示例#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;
            }
        }
示例#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();
        }
示例#5
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);
            }
        }
示例#6
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;
            }
        }
示例#7
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
        }
示例#8
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;
        }
示例#9
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));
        }
示例#10
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);
        }
示例#11
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
        }
示例#12
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
        }
示例#13
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();
            }
        }
示例#14
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();
            }
        }
示例#15
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);
        }
示例#16
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);
        }
示例#17
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;
            }
        }
示例#18
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));
        }
示例#19
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;
                }
            }
        }
示例#20
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);
        }