Class MergeSourceBuildingVisitor
- java.lang.Object
-
- org.openstreetmap.josm.data.osm.visitor.MergeSourceBuildingVisitor
-
- All Implemented Interfaces:
OsmPrimitiveVisitor
public class MergeSourceBuildingVisitor extends java.lang.Object implements OsmPrimitiveVisitor
MergeSourceBuildingVisitor helps to build the "hull" of a collection ofOsmPrimitives 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 incompleteOsmPrimitives which are referred to by relations in the original collection. And it turnsOsmPrimitivereferred to byRelations in the original collection into incompleteOsmPrimitives in the "hull", if they are not themselves present in the original collection.- Since:
- 1891
-
-
Field Summary
Fields Modifier and Type Field Description private DataSethullprivate java.util.Map<OsmPrimitive,PrimitiveData>mappedPrimitivesprivate DataSetselectionBase
-
Constructor Summary
Constructors Constructor Description MergeSourceBuildingVisitor(DataSet selectionBase)Creates the visitor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DataSetbuild()Builds and returns the "hull".protected voidbuildHull()protected booleanisAlreadyRemembered(OsmPrimitive primitive)protected booleanisInSelectionBase(OsmPrimitive primitive)protected voidrememberIncomplete(OsmPrimitive primitive)protected voidrememberNode(Node n)Remembers a node in the "hull"protected voidrememberRelation(Relation r)Remembers a relation in the hullprotected voidrememberRelationPartial(Relation r)protected voidrememberWay(Way w)remembers a way in the hullvoidvisit(Node n)Visiting call for points.voidvisit(Relation r)Visiting call for relations.voidvisit(Way w)Visiting call for lines.
-
-
-
Field Detail
-
selectionBase
private final DataSet selectionBase
-
mappedPrimitives
private final java.util.Map<OsmPrimitive,PrimitiveData> mappedPrimitives
-
-
Constructor Detail
-
MergeSourceBuildingVisitor
public MergeSourceBuildingVisitor(DataSet selectionBase)
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:
java.lang.IllegalArgumentException- if selectionBase is null
-
-
Method Detail
-
isInSelectionBase
protected boolean isInSelectionBase(OsmPrimitive primitive)
-
isAlreadyRemembered
protected boolean isAlreadyRemembered(OsmPrimitive primitive)
-
rememberNode
protected void rememberNode(Node n)
Remembers a node in the "hull"- Parameters:
n- the node
-
rememberWay
protected void rememberWay(Way w)
remembers a way in the hull- Parameters:
w- the way
-
rememberRelation
protected void rememberRelation(Relation r)
Remembers a relation in the hull- Parameters:
r- the relation
-
rememberRelationPartial
protected void rememberRelationPartial(Relation r)
-
rememberIncomplete
protected void rememberIncomplete(OsmPrimitive primitive)
-
visit
public void visit(Node n)
Description copied from interface:OsmPrimitiveVisitorVisiting call for points.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Parameters:
n- The node to inspect.
-
visit
public void visit(Way w)
Description copied from interface:OsmPrimitiveVisitorVisiting call for lines.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Parameters:
w- The way to inspect.
-
visit
public void visit(Relation r)
Description copied from interface:OsmPrimitiveVisitorVisiting call for relations.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Parameters:
r- The relation to inspect.
-
buildHull
protected void buildHull()
-
-