Exemple #1
0
        private static void AddSQX(ref Profile myPr, ref SRBA.SQX kitty, ref Editor ed)
        {
            Point2d St = new Point2d(kitty.BPDList[0].PK, kitty.BPDList[0].H), Ed;
            Point2d A = new Point2d(), B = new Point2d(), C = new Point2d();

            SRBA.BPD preBPD = new SRBA.BPD(), curBPD = new SRBA.BPD(), nextBPD = new SRBA.BPD();

            if (kitty.BPDList.Count <= 2)
            {
                curBPD  = kitty.BPDList[0];
                nextBPD = kitty.BPDList[1];
                B       = new Point2d(curBPD.PK, curBPD.H);
                C       = new Point2d(nextBPD.PK, nextBPD.H);
                myPr.Entities.AddFixedTangent(B, C);
                return;
            }

            for (int i = 0; i < kitty.BPDList.Count; i++)
            {
                curBPD = kitty.BPDList[i];
                if (i != 0)
                {
                    Ed = new Point2d(curBPD.PK, curBPD.H);
                    myPr.Entities.AddFixedTangent(St, Ed);
                    St = Ed;
                }
            }

            for (int i = 1; i < kitty.BPDList.Count - 2; i++)
            {
                curBPD = kitty.BPDList[i];
                if (curBPD.R == 0)
                {
                    continue;
                }
                ProfileTangent    ptA = (ProfileTangent)myPr.Entities[i];
                ProfileTangent    ptB = (ProfileTangent)myPr.Entities[i + 1];
                VerticalCurveType ct  = ptA.Grade < ptB.Grade ? VerticalCurveType.Sag : VerticalCurveType.Crest;
                double            dr  = 0.01;
                double            RR  = curBPD.R;
                while (true)
                {
                    try
                    {
                        myPr.Entities.AddFreeSymmetricParabolaByRadius((uint)i, (uint)(i + 1), ct, RR);
                        break;
                    }
                    catch
                    {
                        RR = RR - dr;
                        continue;
                    }
                }
            }


            //oProfile.Entities.AddFreeSymmetricParabolaByLength(oTangent1.EntityId, oTangent2.EntityId, VerticalCurveType.Sag, 900.1, true);
        }
Exemple #2
0
        public Align(string name, string ICDtext, string SQXtext, string DMXtext, string CGtext = null, bool isReadVert = true)
        {
            Name   = name;
            curPQX = new PQX(Name + "_PQX");
            curPQX.ReadICDFile(ICDtext);

            if (isReadVert)
            {
                curDMX = new DMX(Regex.Split(ICDtext, "\\s+"));
                curSQX = new SQX(Regex.Split(SQXtext, "\\s+"));
                curCG  = new CG(Regex.Split(DMXtext, "\\s+"));
            }

            WorkDir = "";
        }
Exemple #3
0
        public Align(string workDir, bool isReadVert = true)
        {
            var dd = new DirectoryInfo(workDir);

            Name = dd.Name;

            curPQX = new PQX(Name + "_PQX");
            curPQX.ReadICDFile(dd.FullName + "\\" + Name + ".ICD");
            if (isReadVert)
            {
                curDMX = new DMX(dd.FullName + "\\" + Name + ".DMX");
                curSQX = new SQX(dd.FullName + "\\" + Name + ".SQX");
                curCG  = new CG(dd.FullName + "\\" + Name + ".CG");
                curHDX = new HDX(dd.FullName + "\\" + Name + ".HDX");
            }

            WorkDir = workDir;
        }
Exemple #4
0
        public Align(string name, string[] ICDtext, string[] SQXtext, string[] DMXtext, string[] CGtext = null, string[] HDXtext = null, bool isReadVert = true)
        {
            Name   = name;
            curPQX = new PQX(Name + "_PQX");
            curPQX.ReadICDFile(ICDtext);

            if (isReadVert)
            {
                curDMX = new DMX(DMXtext);
                curSQX = new SQX(SQXtext);
                if (CGtext != null)
                {
                    curCG = new CG(CGtext);
                }
                if (HDXtext != null)
                {
                    curHDX = new HDX(HDXtext);
                }
            }

            WorkDir = "";
        }
Exemple #5
0
        public static void ReadICD()
        {
            // CAD指针
            CivilDocument civildoc = CivilApplication.ActiveDocument;
            Document      doc      = Application.DocumentManager.MdiActiveDocument;
            Database      acCurDb  = doc.Database;
            Editor        ed       = doc.Editor;


            PromptOpenFileOptions opt = new PromptOpenFileOptions("\n请选择线型文件.");

            opt.Filter = "ICD File (*.icd)|*.icd|All files (*.*)|*.*";
            PromptFileNameResult res = ed.GetFileNameForOpen(opt);

            if (res.Status != PromptStatus.OK)
            {
                return;
            }
            SRBA.PM bill = new SRBA.PM(res.StringResult);

            // 转化平曲线
            ObjectId AlgID = Alignment.Create(civildoc, Path.GetFileNameWithoutExtension(res.StringResult), null, "0", "Basic", "All Labels");

            using (Transaction ts = acCurDb.TransactionManager.StartTransaction())
            {
                Alignment myAg = ts.GetObject(AlgID, OpenMode.ForWrite) as Alignment;
                AddICD(ref myAg, ref bill, ref ed);
                myAg.ReferencePointStation = bill.StartPK;
                //ed.WriteMessage("\n{0}读取成功.", res.StringResult);


                // 竖曲线
                PromptKeywordOptions pKeyOpts = new PromptKeywordOptions("\n是否加载竖曲线?");
                pKeyOpts.Keywords.Add("Y");
                pKeyOpts.Keywords.Add("N");
                pKeyOpts.Keywords.Default = "Y";
                pKeyOpts.AllowNone        = true;
                PromptResult pKeyRes = doc.Editor.GetKeywords(pKeyOpts);
                switch (pKeyRes.Status)
                {
                case PromptStatus.OK:
                    if (pKeyRes.StringResult == "Y")
                    {
                        SRBA.SQX kitty      = new SRBA.SQX(Path.ChangeExtension(res.StringResult, "SQX"));
                        ObjectId layerId    = myAg.LayerId;
                        ObjectId styleId    = civildoc.Styles.ProfileStyles["Basic"];
                        ObjectId labelSetId = civildoc.Styles.LabelSetStyles.ProfileLabelSetStyles["Complete Label Set"];
                        ObjectId oProfileId = Profile.CreateByLayout(myAg.Name + "-Profile", myAg.ObjectId, layerId, styleId, labelSetId);
                        Profile  oProfile   = ts.GetObject(oProfileId, OpenMode.ForWrite) as Profile;

                        AddSQX(ref oProfile, ref kitty, ref ed);
                    }
                    break;

                default:
                    break;
                }


                // 转化对比JD法
                //pKeyOpts = new PromptKeywordOptions("\n是否加载交点法平曲线?");
                //pKeyOpts.Keywords.Add("Y");
                //pKeyOpts.Keywords.Add("N");
                //pKeyOpts.Keywords.Default = "Y";
                //pKeyOpts.AllowNone = true;
                //pKeyRes = doc.Editor.GetKeywords(pKeyOpts);
                //switch (pKeyRes.Status)
                //{
                //    case PromptStatus.OK:
                //        if (pKeyRes.StringResult == "Y")
                //        {

                //            PQXnew kitty = new PQXnew("Test");
                //            kitty.ReadICDFile(res.StringResult);
                //            ObjectId layerId = myAg.LayerId;
                //            ObjectId styleId = civildoc.Styles.ProfileStyles["Basic"];
                //            ObjectId labelSetId = civildoc.Styles.LabelSetStyles.ProfileLabelSetStyles["Complete Label Set"];
                //            ObjectId oProfileId = Profile.CreateByLayout(myAg.Name + "-Profile", myAg.ObjectId, layerId, styleId, labelSetId);
                //            Profile oProfile = ts.GetObject(oProfileId, OpenMode.ForWrite) as Profile;

                //            AddPQX( 0,24000,500, ref acCurDb, ref kitty, ref ed);
                //        }
                //        break;
                //    default:
                //        break;
                //}



                ts.Commit();
            }
        }