public IntersectionPart Execute(IFeature other) { const string methodName = "CalculateMuniPrivateCommand"; var municipleIntersection = new CalculateIntersectionCommand(_whole, _logger).Execute(other); if (municipleIntersection.Intersection == null) { return(new IntersectionPart()); } var wholeMuni = (ITopologicalOperator4)municipleIntersection.Intersection; var privateFilter = new SpatialFilter { Geometry = municipleIntersection.Intersection, SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects, WhereClause = "OWNER = 'Private'" }; var cursor = LandOwnership.FeatureClass.Search(privateFilter, true); IFeature privateLand; IGeometry privateGeometry = null; while ((privateLand = cursor.NextFeature()) != null) { var intersection = wholeMuni.Intersect(privateLand.ShapeCopy, esriGeometryDimension.esriGeometry2Dimension); if (privateGeometry == null) { privateGeometry = intersection; } else { privateGeometry = ((ITopologicalOperator4)privateGeometry).Union(intersection); } } if (privateGeometry == null) { return(new IntersectionPart()); } var part = new IntersectionPart(); var area = (IArea)privateGeometry; #if !DEBUG _logger.LogMessage(ServerLogger.msgType.infoStandard, methodName, MessageCode, string.Format("Area: {0}", area.Area)); #endif part.Size = Math.Abs(area.Area); part.Intersection = privateGeometry; return(part); }
public IntersectionPart Execute(IFeature other) { const string methodName = "CalculateCountyPrivateCommand"; var countyIntersection = new CalculateIntersectionCommand(_whole, _logger).Execute(other); // out of utah if (countyIntersection.Intersection == null) { return(new IntersectionPart()); } var countyPart = (ITopologicalOperator4)countyIntersection.Intersection; var privateFilter = new SpatialFilter { Geometry = countyIntersection.Intersection, SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects, WhereClause = "OWNER = 'Private'" }; var muniFilter = new SpatialFilter { Geometry = countyIntersection.Intersection, SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects }; var privateGeometry = UnionItemsFor(LandOwnership.FeatureClass, privateFilter, countyPart); var municipalGeometry = UnionItemsFor(Municipalities.FeatureClass, muniFilter, countyPart); // no private or municipal land if (privateGeometry == null && municipalGeometry == null) { return(new IntersectionPart()); } // no municipality - return private if (municipalGeometry == null) { var privateArea = (IArea)privateGeometry; #if !DEBUG _logger.LogMessage(ServerLogger.msgType.infoStandard, methodName, MessageCode, string.Format("Area: {0}", privateArea.Area)); #endif return(new IntersectionPart { Size = Math.Abs(privateArea.Area), Intersection = privateGeometry }); } // no private - return 0 because it's places people live not in a city if (privateGeometry == null) { return(new IntersectionPart()); } // there are both private and muni var privatePart = (ITopologicalOperator4)privateGeometry; var intersection = privatePart.Difference(municipalGeometry); var part = new IntersectionPart(); var area = (IArea)intersection; #if !DEBUG _logger.LogMessage(ServerLogger.msgType.infoStandard, methodName, MessageCode, string.Format("Area: {0}", area.Area)); #endif part.Size = Math.Abs(area.Area); part.Intersection = intersection; return(part); }