Example #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);
        }
Example #2
0
        public void IdentifyCorrCpgAddRegionNum()
        {
            var ParameterInitialize = _ParameterInitialize;
            var pLSCPgLt            = this.ObjCGeoLtLt[0].AsExpectedClassEb <CPolygon, CGeoBase>().ToList();
            var pSSCPgLt            = this.ObjCGeoLtLt[1].AsExpectedClassEb <CPolygon, CGeoBase>().ToList();

            long            lngStartTime     = System.Environment.TickCount;
            List <CPolygon> LSAttentionCPgLt = new List <CPolygon>();
            List <CPolygon> SSAttentionCPgLt = new List <CPolygon>();

            CMatchAndMergePolygons.MatchCpg(ref pLSCPgLt, ref pSSCPgLt, ref LSAttentionCPgLt, ref SSAttentionCPgLt);


            List <object> LSRgNumLt = new List <object>(pLSCPgLt.Count);

            LSRgNumLt.EveryElementValue(-1);
            List <object> SSRgNumLt = new List <object>(pSSCPgLt.Count);


            foreach (var sscpg in pSSCPgLt)
            {
                SSRgNumLt.Add(sscpg.ID);

                foreach (var corrcgeo in sscpg.CorrCGeoLt)
                {
                    LSRgNumLt[corrcgeo.ID] = sscpg.ID;
                }
            }

            CSaveFeature.AddFieldandAttribute(ParameterInitialize.pFLayerLt[0].FeatureClass,
                                              esriFieldType.esriFieldTypeInteger, "RegionNum", LSRgNumLt);
            CSaveFeature.AddFieldandAttribute(ParameterInitialize.pFLayerLt[1].FeatureClass,
                                              esriFieldType.esriFieldTypeInteger, "RegionNum", SSRgNumLt);



            CSaveFeature.SaveCGeoEb(SSAttentionCPgLt, esriGeometryType.esriGeometryPolygon,
                                    ParameterInitialize.cboLayerLt[1].Text + "_Attention");
            CSaveFeature.SaveCGeoEb(LSAttentionCPgLt, esriGeometryType.esriGeometryPolygon,
                                    ParameterInitialize.cboLayerLt[0].Text + "_Attention");
        }