示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <remarks>construct DCEL for InterLSCPlLt, and set the two face numbers for every Cpl.
        /// since InterSSCPlLt are stored with the same order as InterLSCPlLt,
        /// we also set the same faces numbers for every Cpl from InterSSCPlLt for a SgCpl,
        /// we get a point on it and test in which face this point is</remarks>
        public void IdentifyAddFaceNumber()
        {
            CParameterInitialize pParameterInitialize = _ParameterInitialize;

            _intInterLS = 0;
            _intInterSS = 1;
            _intSg      = 2;


            List <CPolyline> pInterLSCPlLt = this.ObjCGeoLtLt[_intInterLS].AsExpectedClassEb <CPolyline, CGeoBase>().ToList();
            List <CPolyline> pSgCPlLt      = this.ObjCGeoLtLt[_intSg].AsExpectedClassEb <CPolyline, CGeoBase>().ToList();

            CDCEL pInterLSDCEL = new CDCEL(pInterLSCPlLt);

            pInterLSDCEL.ConstructDCEL();

            List <object> InterLSobjlt1 = new List <object>(pInterLSCPlLt.Count);
            List <object> InterLSobjlt2 = new List <object>(pInterLSCPlLt.Count);

            for (int i = 0; i < pInterLSCPlLt.Count; i++)
            {
                int indexID1 = pInterLSCPlLt[i].CEdgeLt[0].cpgIncidentFace.indexID;
                int indexID2 = pInterLSCPlLt[i].CEdgeLt[0].cedgeTwin.cpgIncidentFace.indexID;

                //we store the smaller index at "FaceNum_1", and store the larger index at "FaceNum_2"
                int intSmallerindexID;
                int intLargerindexID;
                CHelpFunc.CompareAndOrder(indexID1, indexID2, ID => ID, out intSmallerindexID, out intLargerindexID);

                InterLSobjlt1.Add(intSmallerindexID);
                InterLSobjlt2.Add(intLargerindexID);
            }

            //it should be true that a polyline of pInterSSCPlLt has the same indices of faces
            //as the corresponding polyline of pInterLSCPlLt does
            CSaveFeature.AddFieldandAttribute(pParameterInitialize.pFLayerLt[_intInterLS].FeatureClass,
                                              esriFieldType.esriFieldTypeInteger, "FaceNum1", InterLSobjlt1);
            CSaveFeature.AddFieldandAttribute(pParameterInitialize.pFLayerLt[_intInterLS].FeatureClass,
                                              esriFieldType.esriFieldTypeInteger, "FaceNum2", InterLSobjlt2);
            CSaveFeature.AddFieldandAttribute(pParameterInitialize.pFLayerLt[_intInterSS].FeatureClass,
                                              esriFieldType.esriFieldTypeInteger, "FaceNum1", InterLSobjlt1);
            CSaveFeature.AddFieldandAttribute(pParameterInitialize.pFLayerLt[_intInterSS].FeatureClass,
                                              esriFieldType.esriFieldTypeInteger, "FaceNum2", InterLSobjlt2);


            List <object> Sgobjlt = new List <object>(pSgCPlLt.Count);

            for (int i = 0; i < pSgCPlLt.Count; i++)
            {
                Sgobjlt.Add(DetectFaceForSg(pSgCPlLt[i], pInterLSDCEL).indexID);
            }
            CSaveFeature.AddFieldandAttribute(pParameterInitialize.pFLayerLt[_intSg].FeatureClass,
                                              esriFieldType.esriFieldTypeInteger, "FaceNum", Sgobjlt);
        }
        public void MergeAndSplitPolylines()
        {
            var ParameterInitialize = _ParameterInitialize;
            List <CPolyline> pCPlLt = this.ObjCGeoLtLt[0].Select(cgeo => cgeo as CPolyline).ToList();

            long lngStartTime = System.Environment.TickCount;

            CDCEL pDCEL = new CDCEL(pCPlLt);

            pDCEL.ConstructDCEL();

            pDCEL.HalfEdgeLt.ForEach(cedge => cedge.isTraversed = false);
            List <CPolyline> OutputCPlLt = new List <CPolyline>();

            int intID = 0;

            foreach (var cedge in pDCEL.HalfEdgeLt)
            {
                if (cedge.isTraversed == true)
                {
                    continue;
                }

                var PreCptLt = new List <CPoint>();
                var SucCptLt = new List <CPoint>();
                SucCptLt.Add(cedge.ToCpt);
                GetCptLtUntilIntersection(SucCptLt, cedge.cedgeNext);
                if (SucCptLt.Count == 1 || SucCptLt.Last().GID != SucCptLt[0].GID)   //if it is not a "hole"
                {
                    PreCptLt.Add(cedge.FrCpt);
                    cedge.isTraversed           = true;
                    cedge.cedgeTwin.isTraversed = true;

                    GetCptLtUntilIntersection(PreCptLt, cedge.cedgeTwin.cedgeNext);
                }

                PreCptLt.Reverse();
                PreCptLt.AddRange(SucCptLt);
                OutputCPlLt.Add(new CPolyline(intID++, PreCptLt));
            }
            CSaveFeature.SaveCGeoEb(OutputCPlLt, esriGeometryType.esriGeometryPolyline,
                                    ParameterInitialize.pFLayerLt[0].Name + "MergeAndSplit");

            long lngEndTime = System.Environment.TickCount;//记录结束时间

            ParameterInitialize.tsslTime.Text = "Running Time: " + Convert.ToString(lngEndTime - lngStartTime) + "ms";
        }
示例#3
0
        /// <summary>
        /// Transform interior polylines in one province
        /// </summary>
        /// <param name="pParameterInitialize"></param>
        /// <param name="InterLSIplLt"></param>
        /// <param name="InterSSIplLt"></param>
        /// <param name="SgIplLt"></param>
        /// <returns></returns>
        /// <remarks>InterLSIplLt and InterSSIplLt can be clockwise of counterclockwise.
        /// we will construct DCEL, in which the directions will be counterclockwise.
        /// InterLSIplLt and InterSSIplLt should have the same direction and the corresponding start points</remarks>
        private List <CPolyline> CTTransform(List <IPolyline5> InterLSIplLt, List <IPolyline5> InterSSIplLt,
                                             List <IPolyline5> SgIplLt, bool blnMaxCommonChords = true)
        {
            CConstants.dblVerySmallCoord /= 10;  //this assignment should equal to _dblVerySmallDenominator = 10000000


            var InterLSCplLt = CHelpFunc.GenerateCGeoEbAccordingToGeoEb <CPolyline>(InterLSIplLt).ToList();
            var InterSSCplLt = CHelpFunc.GenerateCGeoEbAccordingToGeoEb <CPolyline>(InterSSIplLt).ToList();
            var SgCplEb      = CHelpFunc.GenerateCGeoEbAccordingToGeoEb <CPolyline>(SgIplLt);

            //there are only two faces: the super face and a normal face. Face *.FaceCpgLt[1] is the normal face
            var pInterLSDCEL = new CDCEL(InterLSCplLt);

            pInterLSDCEL.ConstructDCEL();
            pInterLSDCEL.FaceCpgLt[1].SetOuterFaceCptlt(false, true, InterLSCplLt[0].CptLt[0]);

            //there are only two faces: the super face and a normal face. Face *.FaceCpgLt[1] is the normal face
            var pInterSSDCEL = new CDCEL(InterSSCplLt);

            pInterSSDCEL.ConstructDCEL();
            pInterSSDCEL.FaceCpgLt[1].SetOuterFaceCptlt(false, true, InterSSCplLt[0].CptLt[0]);

            //we maintaine this SD so that for a point from single polyline,
            //we can know whether this single point overlaps a point of a larger-scale polyline
            var pInterLSCptSD = pInterLSDCEL.FaceCpgLt[1].CptLt.ToSD(cpt => cpt, new CCmpCptYX_VerySmall());


            var pCptbCtgl = new CCptbCtgl(pInterLSDCEL.FaceCpgLt[1], pInterSSDCEL.FaceCpgLt[1],
                                          blnMaxCommonChords, _blnSave);

            pCptbCtgl.ConstructCcptbCtgl();
            var TransSgCPlLt = new List <CPolyline>(SgIplLt.Count);

            foreach (var SgCpl in SgCplEb)
            {
                TransSgCPlLt.Add(GenerateCorrSgCpl(pCptbCtgl, SgCpl, pInterLSCptSD));
            }

            CConstants.dblVerySmallCoord *= 10;
            return(TransSgCPlLt);
        }