Class MergeSourceBuildingVisitor
java.lang.Object
org.openstreetmap.josm.data.osm.visitor.MergeSourceBuildingVisitor
- All Implemented Interfaces:
OsmPrimitiveVisitor
MergeSourceBuildingVisitor helps to build the "hull" of a collection of
OsmPrimitives
which shall be merged into another layer. The "hull" is slightly bigger than the original
collection. It includes, for instance the nodes of a way in the original collection even though
these nodes might not be present explicitly in the original collection. The "hull" also includes
incomplete OsmPrimitives which are referred to by relations in the original collection. And
it turns OsmPrimitive referred to by Relations in the original collection into
incomplete OsmPrimitives in the "hull", if they are not themselves present in the original collection.- Since:
- 1891
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DataSetprivate final Map<OsmPrimitive,PrimitiveData> private final DataSet -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds and returns the "hull".protected voidprotected booleanisAlreadyRemembered(OsmPrimitive primitive) protected booleanisInSelectionBase(OsmPrimitive primitive) protected voidrememberIncomplete(OsmPrimitive primitive) protected voidrememberNode(Node n) Remembers a node in the "hull"protected voidRemembers a relation in the hullprotected voidprotected voidrememberWay(Way w) remembers a way in the hullvoidVisiting call for points.voidVisiting call for relations.voidVisiting call for lines.
-
Field Details
-
selectionBase
-
hull
-
mappedPrimitives
-
-
Constructor Details
-
MergeSourceBuildingVisitor
Creates the visitor. The visitor starts to build the "hull" from the currently selected primitives in the datasetselectionBase, i.e. fromOsmData.getSelected().- Parameters:
selectionBase- the dataset. Must not be null.- Throws:
IllegalArgumentException- if selectionBase is null
-
-
Method Details
-
isInSelectionBase
-
isAlreadyRemembered
-
rememberNode
Remembers a node in the "hull"- Parameters:
n- the node
-
rememberWay
remembers a way in the hull- Parameters:
w- the way
-
rememberRelation
Remembers a relation in the hull- Parameters:
r- the relation
-
rememberRelationPartial
-
rememberIncomplete
-
visit
Description copied from interface:OsmPrimitiveVisitorVisiting call for points.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Parameters:
n- The node to inspect.
-
visit
Description copied from interface:OsmPrimitiveVisitorVisiting call for lines.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Parameters:
w- The way to inspect.
-
visit
Description copied from interface:OsmPrimitiveVisitorVisiting call for relations.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Parameters:
r- The relation to inspect.
-
buildHull
-
build
Builds and returns the "hull".- Returns:
- the "hull" data set
-