Esempio n. 1
0
        public void CGABM()
        {
            int intInterLS   = 0;
            int intInterSS   = 1;
            int intSg        = 2;
            int intInterLSSg = 3;
            int intInterSSSg = 4;

            var pstrFieldNameLtLt = this.strFieldNameLtLt;
            var pObjValueLtLtLt   = this.ObjValueLtLtLt;

            var intInterLSFaceNumIndex1 = CSaveFeature.FindFieldNameIndex(pstrFieldNameLtLt[intInterLS], "FaceNum1");
            var intInterLSFaceNumIndex2 = CSaveFeature.FindFieldNameIndex(pstrFieldNameLtLt[intInterLS], "FaceNum2");
            var intSgFaceNumIndex       = CSaveFeature.FindFieldNameIndex(pstrFieldNameLtLt[intSg], "FaceNum");

            //count the faces
            var intInterLSFaceNumSS = new SortedSet <int>();

            foreach (var objlt in pObjValueLtLtLt[intInterLS])
            {
                intInterLSFaceNumSS.Add((int)objlt[intInterLSFaceNumIndex1]);
                intInterLSFaceNumSS.Add((int)objlt[intInterLSFaceNumIndex2]);
            }
            var intInterLSFaceCount = intInterLSFaceNumSS.Count;

            _intStart    = 0;
            _intEndCount = intInterLSFaceCount;
            UpdateStartEnd();

            var pInterLSCplLt   = new List <CPolyline>();
            var pInterSSCplLt   = new List <CPolyline>();
            var pObjValueLSLtLt = pObjValueLtLtLt[intInterLS]; //the values for the layer of the larger-scale polylines

            for (int i = 0; i < pObjValueLSLtLt.Count; i++)
            {
                int intFaceNum1 = (int)pObjValueLSLtLt[i][intInterLSFaceNumIndex1];
                int intFaceNum2 = (int)pObjValueLSLtLt[i][intInterLSFaceNumIndex2];

                if ((intFaceNum1 >= _intStart && intFaceNum1 < _intEndCount) ||
                    (intFaceNum2 >= _intStart && intFaceNum2 < _intEndCount))
                {
                    pInterLSCplLt.Add(this.ObjCGeoLtLt[intInterLS][i] as CPolyline);
                    pInterSSCplLt.Add(this.ObjCGeoLtLt[intInterSS][i] as CPolyline);
                }
            }

            var pInterLSSgCplLt = new List <CPolyline>();
            var pInterSSSgCplLt = new List <CPolyline>();
            var pObjValueSgLtLt = pObjValueLtLtLt[intSg]; //the values for the layer of the larger-scale polylines

            for (int i = 0; i < pObjValueSgLtLt.Count; i++)
            {
                int intFaceNum = (int)pObjValueSgLtLt[i][intSgFaceNumIndex];

                if (intFaceNum >= _intStart && intFaceNum < _intEndCount)
                {
                    pInterLSSgCplLt.Add(this.ObjCGeoLtLt[intInterLSSg][i] as CPolyline);
                    pInterSSSgCplLt.Add(this.ObjCGeoLtLt[intInterSSSg][i] as CPolyline);
                }
            }

            _CorrCptsLtLt   = CGeoFunc.GetCorrCptsLtLt(pInterLSCplLt, pInterSSCplLt);
            _SgCorrCptsLtLt = CGeoFunc.GetCorrCptsLtLt(pInterLSSgCplLt, pInterSSSgCplLt);

            CHelpFunc.SetMoveVectorForCorrCptsLtLt(_CorrCptsLtLt);
            CHelpFunc.SetMoveVectorForCorrCptsLtLt(_SgCorrCptsLtLt);

            ////to save memory
            //this.ObjCGeoLtLt[0] = null;
            //this.ObjCGeoLtLt[1] = null;
            //this.ObjCGeoLtLt[2] = null;
            //this.ObjCGeoLtLt[3] = null;



            //CTranslation pTranslation=new CTranslation ();
            //double dblSum = pTranslation.CalTranslationCorr(_CorrCptsLtLt);
            //double dblSumSg = pTranslation.CalTranslationCorr(_SgCorrCptsLtLt);
        }
Esempio n. 2
0
        public void Transform()
        {
            int intInterLS = 0;
            int intInterSS = 1;
            int intSg      = 2;


            var pParameterInitialize = CConstants.ParameterInitialize;
            var pstrFieldNameLtLt    = this.strFieldNameLtLt;
            var pObjValueLtLtLt      = this.ObjValueLtLtLt;

            var InterLSIplLt = this.ObjIGeoLtLt[intInterLS].Select(obj => obj as IPolyline5).ToList();
            var InterSSIplLt = this.ObjIGeoLtLt[intInterSS].Select(obj => obj as IPolyline5).ToList();
            var SgIplLt      = this.ObjIGeoLtLt[intSg].Select(obj => obj as IPolyline5).ToList();

            var pStopwatch = new Stopwatch();

            pStopwatch.Start();

            var intInterLSFaceNumIndex1 = CSaveFeature.FindFieldNameIndex(pstrFieldNameLtLt[intInterLS], "FaceNum1");
            var intInterLSFaceNumIndex2 = CSaveFeature.FindFieldNameIndex(pstrFieldNameLtLt[intInterLS], "FaceNum2");
            var intSgFaceNumIndex       = CSaveFeature.FindFieldNameIndex(pstrFieldNameLtLt[intSg], "FaceNum");

            //count the faces
            var intInterLSFaceNumSS = new SortedSet <int>();

            foreach (var objlt in pObjValueLtLtLt[intInterLS])
            {
                intInterLSFaceNumSS.Add((int)objlt[intInterLSFaceNumIndex1]);
                intInterLSFaceNumSS.Add((int)objlt[intInterLSFaceNumIndex2]);
            }
            var intInterLSFaceCount = intInterLSFaceNumSS.Count;

            //record the ipolylines into corresponding faces (lists)
            var InterLSIplLtLt = new List <List <IPolyline5> >(intInterLSFaceCount);
            var InterSSIplLtLt = new List <List <IPolyline5> >(intInterLSFaceCount);

            InterLSIplLtLt.EveryElementNew();
            InterSSIplLtLt.EveryElementNew();

            var pInterLSObjValueLtLt = pObjValueLtLtLt[intInterLS];  //the value table of LSLayer

            for (int i = 0; i < pInterLSObjValueLtLt.Count; i++)
            {
                //pLSObjValueLtLt[i][intInterLSFaceNumIndex1] is the index of a face
                InterLSIplLtLt[(int)pInterLSObjValueLtLt[i][intInterLSFaceNumIndex1]].Add(InterLSIplLt[i]);
                InterLSIplLtLt[(int)pInterLSObjValueLtLt[i][intInterLSFaceNumIndex2]].Add(InterLSIplLt[i]);

                //we use the same index, i.e.,pLSObjValueLtLt[i][intInterLSFaceNumIndex1], as we use for LS
                InterSSIplLtLt[(int)pInterLSObjValueLtLt[i][intInterLSFaceNumIndex1]].Add(InterSSIplLt[i]);
                InterSSIplLtLt[(int)pInterLSObjValueLtLt[i][intInterLSFaceNumIndex2]].Add(InterSSIplLt[i]);
            }

            var SgIplLtLt      = new List <List <IPolyline5> >(intInterLSFaceCount);
            var intSgIndexLtLt = new List <List <int> >(intInterLSFaceCount);

            SgIplLtLt.EveryElementNew();
            intSgIndexLtLt.EveryElementNew();

            var pSgObjValueLtLt = pObjValueLtLtLt[intSg];  //the value table of LSLayer

            for (int i = 0; i < pSgObjValueLtLt.Count; i++)
            {
                //pLSObjValueLtLt[i][intInterLSFaceNumIndex1] is the index of a face
                SgIplLtLt[(int)pSgObjValueLtLt[i][intSgFaceNumIndex]].Add(SgIplLt[i]);
                //we record the index of every polyline
                //so that later we can store the transformed polylines with the same orders as SgIplLt
                intSgIndexLtLt[(int)pSgObjValueLtLt[i][intSgFaceNumIndex]].Add(i);
            }

            //var dlgTransform = SetDlgTransform(pParameterInitialize.cboTransform.Text);
            var TransSgIGeoLt = new List <IGeometry>(SgIplLt.Count);

            TransSgIGeoLt.EveryElementValue(null);
            CHelpFunc.Displaytspb(0.5, intInterLSFaceCount);

            _intStart    = 0;
            _intEndCount = intInterLSFaceCount;
            UpdateStartEnd();

            for (int i = _intStart; i < _intEndCount; i++)
            {
                Console.WriteLine("Face Num: " + i);
                if (SgIplLtLt[i].Count != 0) //face 0 is the outer face, the count is zero
                {
                    List <CPolyline> TransSgCplLt;
                    switch (pParameterInitialize.cboTransform.Text)
                    {
                    case "CT Max Common Chords":
                        TransSgCplLt = CTTransform(InterLSIplLtLt[i], InterSSIplLtLt[i], SgIplLtLt[i], true);
                        break;

                    case "Compatible Triangulations":
                        TransSgCplLt = CTTransform(InterLSIplLtLt[i], InterSSIplLtLt[i], SgIplLtLt[i], false);
                        break;

                    case "Rubber Sheeting":
                        TransSgCplLt = RSTransform(InterLSIplLtLt[i], InterSSIplLtLt[i], SgIplLtLt[i]);
                        break;

                    default: throw new ArgumentOutOfRangeException("a case doesn't exist!");
                    }

                    //var TransSgCplEb = dlgTransform(InterLSIplLtLt[i], InterSSIplLtLt[i], SgIplLtLt[i]);

                    int intCount = 0;
                    foreach (var TransSgCpl in TransSgCplLt)
                    {
                        TransSgIGeoLt[intSgIndexLtLt[i][intCount++]] = TransSgCpl.JudgeAndSetAEGeometry();
                    }
                }
                CHelpFunc.Displaytspb(i + 1, intInterLSFaceCount);
            }

            CHelpFunc.DisplayRunTime(pStopwatch.ElapsedMilliseconds);
            CSaveFeature.SaveIGeoEb(TransSgIGeoLt, esriGeometryType.esriGeometryPolyline, "TransSgCPlLt",
                                    this.strFieldNameLtLt[intSg], this.esriFieldTypeLtLt[intSg], _ObjValueLtLtLt[intSg]);
        }