if (pGPValue is IGPFeatureLayer) { IFeatureLayer pFeatureLayer = pGPUtilities.DecodeLayer(pGPValue) as IFeatureLayer; ISelectionSet pSelectionSet = (pFeatureLayer as IFeatureSelection).SelectionSet; if (pSelectionSet != null && pSelectionSet.Count > 0) { IEnumIDs pEnumIDs = pSelectionSet.IDs; for (int j = 0; j < pSelectionSet.Count; ++j) { IEnvelope pCurrentExtent = pFeatureLayer.FeatureClass.GetFeature(pEnumIDs.Next()).Extent; if (pCurrentExtent != null) { pCurrentExtent.Project(pGeographicCoordinateSystem); pInputExtent.Union(pCurrentExtent); } } } else { IQueryFilter pQueryFilter = null; int iFeatureCount = pFeatureLayer.FeatureClass.FeatureCount(pQueryFilter); for (int j = 0; j < iFeatureCount; ++j) { IEnvelope pCurrentExtent = pFeatureLayer.FeatureClass.GetFeature(j).Extent; if (pCurrentExtent != null) { pCurrentExtent.Project(pGeographicCoordinateSystem); pInputExtent.Union(pCurrentExtent); } } } }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.