/// <summary> /// Get the geometry in this collection that falls within the specified axis-aligned bounding box /// </summary> /// <param name="bounds">The bounding box to check</param> /// <param name="inclusive">If true, the output can include objects that lie partially within the bounds, else /// the geometry must be entirely contained by the box to be included</param> /// <param name="addToThis">The output collection, to which passing geometry should be added</param> public void GeometryInBounds(BoundingBox bounds, bool inclusive, VertexGeometryCollection <TShape> addToThis) { foreach (TShape vG in this) { if (!addToThis.Contains(vG.GUID) && (inclusive && bounds.Overlaps(vG)) || (!inclusive && bounds.Contains(vG))) { addToThis.Add(vG); } } }
/// <summary> /// Get the geometry in this table that falls within the specified axis-aligned bounding box /// </summary> /// <param name="bounds">The bounding box to check</param> /// <param name="inclusive">If true, the output can include objects that lie partially within the bounds, else /// the geometry must be entirely contained by the box to be included</param> /// <param name="visibleLayersOnly">If true (default) only layers which are currently visible will be considered</param> public VertexGeometryCollection GeometryInBounds(BoundingBox bounds, bool inclusive, bool visibleLayersOnly = true) { var result = new VertexGeometryCollection(); foreach (GeometryLayer layer in this) { if (!visibleLayersOnly || layer.Visible) { layer.GeometryInBounds(bounds, inclusive, result); } } return(result); }
/// <summary> /// Get all the geometry objects contained within this layer table as /// a single flat collection /// </summary> /// <returns></returns> public VertexGeometryCollection AllGeometry() { var result = new VertexGeometryCollection(); foreach (GeometryLayer layer in this) { foreach (VertexGeometry geometry in layer) { result.Add(geometry); } } return(result); }