public void Init(GisViewer v) { viewer = v; GisOperatingTool.SetHost(this); mapTools = new Dictionary <OperatingToolType, GisOperatingTool>(); mapTools.Add(OperatingToolType.GISHand, new GisHandTool(viewer)); mapTools.Add(OperatingToolType.GISPolyline, new GisPolylineTool()); mapTools.Add(OperatingToolType.GISPolygon, new GisPolygonTool()); mapTools.Add(OperatingToolType.GISPoint, new GisPointTool()); mapTools.Add(OperatingToolType.GISBoxSelect, new GisBoxSelect()); mapTools.Add(OperatingToolType.GISPointSelect, new GisPointSelect()); mapTools.Add(OperatingToolType.GISCircleSelect, new GisCircleSelect()); mapTools.Add(OperatingToolType.GISPolygonSelect, new GisPolygonSelect()); SetCurrentType(OperatingToolType.GISHand); sqtype = SpatialRelation_TYPE.hhhwSRT_Intersect; }
void SurfaceSpatialQuery(List <Vector2D> lst, SpatialRelation_TYPE t) { Geometry poly = new Geometry(wkbGeometryType.wkbPolygon); Geometry lr = new Geometry(wkbGeometryType.wkbLinearRing); foreach (var item in lst) { lr.AddPoint_2D(item.x, item.y); } lr.CloseRings(); poly.AddGeometryDirectly(lr); Envelope ogrenv = new Envelope(); poly.GetEnvelope(ogrenv); CPPOGREnvelope env = new CPPOGREnvelope(); env.MinX = ogrenv.MinX; env.MinY = ogrenv.MinY; env.MaxX = ogrenv.MaxX; env.MaxY = ogrenv.MaxY; var r = model.SpatialQuery(env); ogrenv.Dispose(); foreach (var item in r) { var other = item.fea.GetGeometryRef(); bool r2 = false; if (t == SpatialRelation_TYPE.hhhwSRT_Intersect) { r2 = utils.Intersects(poly, other); } else if (t == SpatialRelation_TYPE.hhhwSRT_Within) { r2 = utils.Within(poly, other); } if (r2) { ss.Add(item); } } poly.Dispose(); }
public void SetSpatialRelationl(SpatialRelation_TYPE t) { GisOperatingToolSet.sqtype = t; }