private bool IsOverlaps(IGeometry pFeatureGeo, string typevalue) //判断几何图形间是否有重叠 { bool isoverlaps = false; switch (typevalue) { case "001": pBasicGeo = GetBasicGeo("003"); break; case "002": pBasicGeo = GetBasicGeo("004"); break; case "003": pBasicGeo = GetBasicGeo("001"); break; case "004": pBasicGeo = GetBasicGeo("002"); break; default: break; } IRelationalOperator pRelaOperator = pBasicGeo as IRelationalOperator; isoverlaps = pRelaOperator.Overlaps(pFeatureGeo) || pRelaOperator.Contains(pFeatureGeo); return(isoverlaps); }
public bool polygonOverlaps(IFeature SourceFeature, IFeature InspectedFeature) { //isOverlaps==true 表示两个面要素有重叠 IRelationalOperator RelationalOperator = SourceFeature.Shape as IRelationalOperator; bool isOverlaps = false; isOverlaps = RelationalOperator.Overlaps(InspectedFeature.Shape); return(isOverlaps); }
public List <GeoStruct> BufferAnalyseNew(IPolyline pGeom, double dist, IFeatureLayer fealyr, IGeometry Reg = null) { List <GeoStruct> geoList = new List <GeoStruct>(); ITopologicalOperator top = pGeom as ITopologicalOperator; IGeometry geom = top.Buffer(dist); IFeatureCursor searchCursor = SpatialSearch(geom, "1=1", fealyr); if (searchCursor != null) { IFeature fea = searchCursor.NextFeature(); while (fea != null) { GeoStruct geoTmp = new GeoStruct(); var fieldDict = new Dictionary <string, string>(); for (var i = 0; i < fea.Fields.FieldCount; i++) { var field = fea.Fields.Field[i]; if (field.Type != esriFieldType.esriFieldTypeGeometry) { fieldDict.Add(field.Name, fea.Value[i].ToString()); } else { geoTmp.geo = fea.Shape; } } geoTmp.geoinfos = fieldDict; IRelationalOperator relation = Reg as IRelationalOperator; bool bin = (relation.Overlaps(fea.Shape) || relation.Touches(fea.Shape) || relation.Contains(fea.Shape)); double distance = CalculateDistanceNew(pGeom, geoTmp.geo); if (bin) { distance = 0.0; } if (distance < Global.searchlen) { geoTmp.dist = distance; geoList.Add(geoTmp); } //geoTmp.dist = distance; //geoList.Add(geoTmp); fea = searchCursor.NextFeature(); } } return(geoList); }
/// <summary> /// 验证指定的要素是否在裁切范围内 /// </summary> /// <param name="pFeatureGeometry"></param> /// <returns></returns> public virtual bool FeatureInCutRegion(IGeometry pFeatureGeometry) { try { if (pFeatureGeometry == null) return false; IRelationalOperator pRelation = m_CutGeometry as IRelationalOperator; if (pRelation.Crosses(pFeatureGeometry) || pRelation.Contains(pFeatureGeometry) || pRelation.Touches(pFeatureGeometry)|| pRelation.Overlaps(pFeatureGeometry) || pRelation.Within(pFeatureGeometry) || pRelation.Equals(pFeatureGeometry)) return true; return false; } catch (Exception ex) { LogAPI.WriteLog("判断裁切范围时出错,系统将不对【" + StructureNode.TableName + "】进行裁切!\r\n"); return false; } }