Package qupath.lib.io
Class FeatureCollection
java.lang.Object
qupath.lib.io.FeatureCollection
Class to wrap a collection of objects to indicate they should be export as a GeoJSON "FeatureCollection".
-
Method Summary
Modifier and TypeMethodDescriptionboolean
If true, include child objects nested within the output.Collection
<? extends PathObject> Get the objects being wrapped.static FeatureCollection
wrap
(Collection<? extends PathObject> pathObjects) Wrap a collection of PathObjects as a FeatureCollection, ignoring nested (child) objects.static FeatureCollection
wrap
(Collection<? extends PathObject> pathObjects, boolean includeChildObjects) Wrap a collection of PathObjects as a FeatureCollection.
-
Method Details
-
getIncludeChildren
public boolean getIncludeChildren()If true, include child objects nested within the output.- Returns:
-
getPathObjects
Get the objects being wrapped.- Returns:
-
wrap
Wrap a collection of PathObjects as a FeatureCollection, ignoring nested (child) objects. The purpose of this is to enable exporting a GeoJSON FeatureCollection that may be reused in other software.- Parameters:
pathObjects
- a collection of path objects to store in a feature collection- Returns:
- a feature collection that can be used with
GsonTools
- See Also:
-
wrap
public static FeatureCollection wrap(Collection<? extends PathObject> pathObjects, boolean includeChildObjects) Wrap a collection of PathObjects as a FeatureCollection. The purpose of this is to enable exporting a GeoJSON FeatureCollection that may be reused in other software.- Parameters:
pathObjects
- a collection of path objects to store in a feature collectionincludeChildObjects
- if true, include child object in the feature collection.- Returns:
- a feature collection that can be used with
GsonTools
- Implementation Note
- Currently no checks are made to avoid duplicate objects. This may change in the future,
but for now it's best to be ensure the input does not contain duplicates.
This is particularly relevant is
includeChildObjects
is true, where duplicates may be nested inside other objects. - Implementation Requirements
- a defensive copy of the collection is created, so that changes to the original collection will not affect the wrapped FeatureCollection - although changes to the underlying objects will make a difference.
-