Exemplo n.º 1
0
        updateProfile(ObjectId idAlign, List <POI> varPOI, string strProfileName, bool boolAdpnt3dNum, string strFunction)
        {
            int       intColor  = 0;
            Alignment objAlign  = (Alignment)idAlign.getEnt();
            string    nameLayer = objAlign.Layer;

            ProfileView objProfileView = null;

            TypedValue[] tvs;
            if (strFunction != "WALLDESIGN")
            {
                ResultBuffer rb = idAlign.getXData("PROFILE");
                if (rb == null)
                {
                    return;
                }
                tvs = rb.AsArray();
                ObjectId idProfileView = tvs.getObjectId(1);

                objProfileView = (ProfileView)idProfileView.getEnt();
            }
            else
            {
                ResultBuffer rb = idAlign.getXData("WALLDESIGN");
                if (rb == null)
                {
                    return;
                }
                tvs = rb.AsArray();
                ObjectId idProfileView = tvs.getObjectId(1);
                objProfileView = (ProfileView)idProfileView.getEnt();
            }

            int shtScale = Misc.getCurrAnnoScale();

            if (strProfileName == "STAKE")
            {
                intColor = 2;
            }
            else
            {
                intColor = 4;
            }

            Extents3d ext3d    = (Extents3d)objProfileView.Bounds;
            Point3d   pnt3dMin = ext3d.MinPoint;
            Point3d   pnt3dMax = ext3d.MaxPoint;

            double dblStaStart         = objProfileView.StationStart;
            double dblElevMin          = objProfileView.ElevationMin;
            double dblElevMax          = objProfileView.ElevationMax;
            double dblScaleProfileView = (pnt3dMax.Y - pnt3dMin.Y) / (dblElevMax - dblElevMin);
            double staX = 0;

            Profile objProfile = Prof.getProfile(idAlign, strProfileName);

            for (int i = 0; i < varPOI.Count; i++)
            {
                POI vPOI = varPOI[i];

                if (varPOI[i].Elevation == 0)
                {
                    try
                    {
                        vPOI.Elevation = objProfile.ElevationAt(varPOI[i].Station);
                    }
                    catch (Exception)
                    {
                        if (i == 0)
                        {
                            staX = vPOI.Station + 0.01;
                        }
                        if (i == varPOI.Count - 1)
                        {
                            staX = vPOI.Station - 0.01;
                        }

                        vPOI.Elevation = objProfile.ElevationAt(staX);
                    }
                }

                varPOI[i] = vPOI;

                double dblCenX = pnt3dMin.X + (varPOI[i].Station - dblStaStart);
                double dblCenY = pnt3dMax.Y + (varPOI[i].Elevation - dblElevMin) * dblScaleProfileView;

                string strDesc = "";
                if (strProfileName == "STAKE")
                {
                    strDesc = varPOI[i].DescX;
                    if (strDesc == "")
                    {
                        strDesc = varPOI[i].Desc0;
                    }
                }
                else if (strFunction == "WALLDESIGN")
                {
                    strDesc = varPOI[i].Desc0;
                }
                else
                {
                    strDesc = varPOI[i].Desc0;
                }

                if (strDesc.Contains("HE"))
                {
                    string note = string.Format("{0} {1:###+00.00}", "???", varPOI[i].Station);
                    addTriangle(dblCenX, dblCenY, nameLayer, note);
                }

                Point3d dblPntCen = new Point3d(dblCenX, dblCenY, 0);
                color = new Color();
                color = Color.FromColorIndex(ColorMethod.ByBlock, (short)intColor);

                if (strDesc.Contains("HC"))
                {
                    ObjectId idCircle = Draw.addCircle(dblPntCen, 1.0);
                    idCircle.changeProp(color, nameLayer);
                }

                if (strDesc.Contains("GB"))
                {
                    List <Vertex2d> dblPnts = new List <Vertex2d> {
                        new Vertex2d(new Point3d(dblCenX - 0.5, dblCenY - 0.5, 0), 0, 0, 0, 0),
                        new Vertex2d(new Point3d(dblCenX + 1, dblCenY - 0.5, 0), 0, 0, 0, 0),
                        new Vertex2d(new Point3d(dblCenX + 1, dblCenY + 0.5, 0), 0, 0, 0, 0),
                        new Vertex2d(new Point3d(dblCenX + 0, dblCenY - 0.5, 0), 0, 0, 0, 0),
                        new Vertex2d(new Point3d(dblCenX + 0, dblCenY - 0.0, 0), 0, 0, 0, 0),
                    };

                    ObjectId idBox = Draw.addPoly(dblPnts);
                    idBox.changeProp(color, nameLayer, LineWeight.LineWeight035);
                }

                if (strDesc.Contains("PNT"))
                {
                    ObjectId idCircle = Draw.addCircle(dblPntCen, 0.5);
                    idCircle.changeProp(color, nameLayer);
                }

                if (varPOI[i].CrossAlign != "")
                {
                    string note = string.Format("{0} {1:###+00.00}", varPOI[i].CrossAlign, varPOI[i].Station);
                    addTriangle(dblCenX, dblCenY, nameLayer, note);
                }
                else if (varPOI[i].CrossDesc != "")
                {
                    string note = string.Format("{0} {1:###+00.00}", varPOI[i].CrossDesc, varPOI[i].Station);
                    addTriangle(dblCenX, dblCenY, nameLayer, note);
                }
                else if (varPOI[i].Type != "")
                {
                    string note = string.Format("{0} {1:###+00.00}", varPOI[i].Desc0, varPOI[i].Station);
                    addTriangle(dblCenX, dblCenY, nameLayer, note);
                }

                if (boolAdpnt3dNum)
                {
                    if ((varPOI[i].PntNum != null))
                    {
                        if (!addLeader(dblPntCen, varPOI[i].PntNum, nameLayer, strProfileName, shtScale, dblScaleProfileView, varPOI[i].Desc0))
                        {
                            return;
                        }
                    }
                }
            }

            if (strFunction == "STAKED")
            {
                Dim.addDims(pnt3dMin, dblStaStart, dblElevMin, varPOI, nameLayer, dblScaleProfileView);
            }
        }