static private List <FeaInfoClass> GetClosedContour(IFeatureLayer conFyr) { List <FeaInfoClass> temperClosedline = new List <FeaInfoClass>(); IFeatureCursor pFeaCursor = conFyr.FeatureClass.Search(null, false); IFeature pFeature = pFeaCursor.NextFeature(); while (pFeature != null) { IPointCollection ptCol = pFeature.Shape as IPointCollection; if (Math.Abs(ptCol.get_Point(0).X - ptCol.get_Point(ptCol.PointCount - 1).X) < 0.01 && Math.Abs(ptCol.get_Point(0).Y - ptCol.get_Point(ptCol.PointCount - 1).Y) < 0.01) { FeaInfoClass fInClass = new FeaInfoClass(); fInClass.ConFea = pFeature; fInClass.Z = Math.Round(ptCol.get_Point(0).Z, 0); temperClosedline.Add(fInClass); } else { FeaInfoClass fInClass = new FeaInfoClass(); fInClass.ConFea = pFeature; fInClass.Z = Math.Round(ptCol.get_Point(0).Z, 0); openline.Add(fInClass); } pFeature = pFeaCursor.NextFeature(); } return(temperClosedline); }
static private List <FeaInfoClass> OrderedOfClosedCon(IFeatureLayer conFyr) { List <FeaInfoClass> getClosedLine = GetClosedContour(conFyr); List <FeaInfoClass> temperlist = new List <FeaInfoClass>(); for (int i = 0; i < getClosedLine.Count - 1; i++) { FeaInfoClass fClass = new FeaInfoClass(); for (int j = 0; j < getClosedLine.Count - 1; j++) { if (getClosedLine[j + 1].Z >= getClosedLine[j].Z) { fClass = getClosedLine[j + 1]; getClosedLine[j + 1] = getClosedLine[j]; getClosedLine[j] = fClass; } } } return(temperlist = getClosedLine); }