public class MergeSourceBuildingVisitor extends java.lang.Object implements OsmPrimitiveVisitor
OsmPrimitive
s
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 OsmPrimitive
s which are referred to by relations in the original collection. And
it turns OsmPrimitive
referred to by Relation
s in the original collection into
incomplete OsmPrimitive
s in the "hull", if they are not themselves present in the original collection.Modifier and Type | Field and Description |
---|---|
private DataSet |
hull |
private java.util.Map<OsmPrimitive,PrimitiveData> |
mappedPrimitives |
private DataSet |
selectionBase |
Constructor and Description |
---|
MergeSourceBuildingVisitor(DataSet selectionBase)
Creates the visitor.
|
Modifier and Type | Method and Description |
---|---|
DataSet |
build()
Builds and returns the "hull".
|
protected void |
buildHull() |
protected boolean |
isAlreadyRemembered(OsmPrimitive primitive) |
protected boolean |
isInSelectionBase(OsmPrimitive primitive) |
protected void |
rememberIncomplete(OsmPrimitive primitive) |
protected void |
rememberNode(Node n)
Remebers a node in the "hull"
|
protected void |
rememberRelation(Relation r)
Remembers a relation in the hull
|
protected void |
rememberRelationPartial(Relation r) |
protected void |
rememberWay(Way w)
remembers a way in the hull
|
void |
visit(Node n)
Visiting call for points.
|
void |
visit(Relation r)
Visiting call for relations.
|
void |
visit(Way w)
Visiting call for lines.
|
private final DataSet selectionBase
private final java.util.Map<OsmPrimitive,PrimitiveData> mappedPrimitives
public MergeSourceBuildingVisitor(DataSet selectionBase)
selectionBase
,
i.e. from OsmData.getSelected()
.selectionBase
- the dataset. Must not be null.java.lang.IllegalArgumentException
- if selectionBase is nullprotected boolean isInSelectionBase(OsmPrimitive primitive)
protected boolean isAlreadyRemembered(OsmPrimitive primitive)
protected void rememberNode(Node n)
n
- the nodeprotected void rememberWay(Way w)
w
- the wayprotected void rememberRelation(Relation r)
r
- the relationprotected void rememberRelationPartial(Relation r)
protected void rememberIncomplete(OsmPrimitive primitive)
public void visit(Node n)
OsmPrimitiveVisitor
visit
in interface OsmPrimitiveVisitor
n
- The node to inspect.public void visit(Way w)
OsmPrimitiveVisitor
visit
in interface OsmPrimitiveVisitor
w
- The way to inspect.public void visit(Relation r)
OsmPrimitiveVisitor
visit
in interface OsmPrimitiveVisitor
r
- The relation to inspect.protected void buildHull()