@Test public void testAddWay() throws Exception { Way testWay = new Way(1, 0, new Date(), null, 0); testWay.getTags().add(new Tag("highway", "motorway")); testWay.getWayNodes().add(new WayNode(1)); testWay.getWayNodes().add(new WayNode(2)); testWay.getWayNodes().add(new WayNode(3)); Node testNode0 = new Node(1, 0, new Date(), null, 0, 1, 1); Node testNode1 = new Node(2, 0, new Date(), null, 0, 1.00001, 1.00001); Node testNode2 = new Node(3, 0, new Date(), null, 0, 3, 3); mySubject.addNode(testNode0); mySubject.addNode(testNode1); mySubject.addNode(testNode2); mySubject.addWay(testWay); Assert.assertEquals(1, this.myTestBaseDataSet.getWaysCount()); Assert.assertEquals(3, this.myTestBaseDataSet.getNodesCount()); Assert.assertEquals(1, this.myTestLOD1DataSet.getRelationsCount()); Assert.assertEquals(1, this.myTestLOD1DataSet.getWaysCount()); Assert.assertEquals(2, this.myTestLOD1DataSet.getNodesCount()); Assert.assertEquals(1, this.myTestLOD2DataSet.getRelationsCount()); Assert.assertEquals(1, this.myTestLOD2DataSet.getWaysCount()); Assert.assertEquals(2, this.myTestLOD2DataSet.getNodesCount()); Assert.assertEquals(1, this.myTestLOD3DataSet.getRelationsCount()); Assert.assertEquals(1, this.myTestLOD3DataSet.getWaysCount()); Assert.assertEquals(2, this.myTestLOD3DataSet.getNodesCount()); }
public void addWay(final Way aW) { getBaseDataSet().addWay(aW); String highway = WayHelper.getTag(aW, Tags.TAG_HIGHWAY); String boundary = WayHelper.getTag(aW, Tags.TAG_BOUNDARY); String waterway = WayHelper.getTag(aW, Tags.TAG_WATERWAY); String landuse = WayHelper.getTag(aW, Tags.TAG_LANDUSE); String natural = WayHelper.getTag(aW, Tags.TAG_NATURAL); boolean isLOD1 = false; boolean isLOD2 = false; Way simpleWay = aW; Relation compoundWayLOD1 = null; RelationBuilder compoundWayRelationWithSimplifiedRoles = null; WayBuilder[] compoundWaysBaseLOD = null; if (highway != null || boundary != null || (waterway != null && !waterway.equalsIgnoreCase("riverbank"))) { if (myLOD1Selector.isAllowed(getLOD1DataSet(), aW)) { List<WayNode> fewNodes = getWayHelper().simplifyWay(aW, simplificationThresholdLOD1, nodeDistanceThresholdLOD1, false, false); if (aW.getWayNodes().size() > fewNodes.size()) { simpleWay = new Way(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), aW.getChangesetId()); simpleWay.getTags().addAll(aW.getTags()); simpleWay.getWayNodes().addAll(fewNodes); } compoundWayLOD1 = getOrCreateCompoundWayLOD123(simpleWay); if (compoundWayLOD1 != null) { compoundWayRelationWithSimplifiedRoles = new RelationBuilder(compoundWayLOD1); compoundWaysBaseLOD = combineCompoundWay(compoundWayRelationWithSimplifiedRoles, simpleWay); isLOD1 = combineSpitWays(getLOD1DataSet(), compoundWayRelationWithSimplifiedRoles, compoundWaysBaseLOD, simpleWay, minSizeLOD1, compoundWayLOD1, simplificationThresholdLOD1, nodeDistanceThresholdLOD1, myLOD1Selector); } } } else if (landuse != null || natural != null || (waterway != null && waterway.equalsIgnoreCase("riverbank"))) { if (myLOD1Selector.isAllowed(getLOD1DataSet(), aW)) { List<WayNode> simpleArea = getBaseDataSet().getWayHelper().simplifyWay(aW, simplificationThresholdLOD1, nodeDistanceThresholdLOD1, false, false); WayBuilder simpleAreaWay = new WayBuilder(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), 0); simpleAreaWay.getTags().addAll(aW.getTags()); for (WayNode wayNode : simpleArea) { simpleAreaWay.addWayNode(wayNode); Node node = getBaseDataSet().getNodeByID(wayNode.getNodeId()); if (node != null) { getLOD1DataSet().addNode(extendedNodeToNode(node)); } } getLOD1DataSet().addWay(simpleAreaWay.buildEntity()); } } if (!isLOD1) { return; } if (highway != null || boundary != null) { if (myLOD2Selector.isAllowed(getLOD2DataSet(), aW)) { isLOD2 = combineSpitWays(getLOD2DataSet(), compoundWayRelationWithSimplifiedRoles, compoundWaysBaseLOD, simpleWay, minSizeLOD2, compoundWayLOD1, simplificationThresholdLOD2, nodeDistanceThresholdLOD2, myLOD2Selector); } } else if (landuse != null || natural != null) { if (myLOD2Selector.isAllowed(getLOD2DataSet(), aW)) { List<WayNode> simpleArea = getBaseDataSet().getWayHelper().simplifyWay(aW, simplificationThresholdLOD2, nodeDistanceThresholdLOD2, false, false); WayBuilder simpleAreaWay = new WayBuilder(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), 0); simpleAreaWay.getTags().addAll(aW.getTags()); for (WayNode wayNode : simpleArea) { simpleAreaWay.addWayNode(wayNode); Node node = getBaseDataSet().getNodeByID(wayNode.getNodeId()); if (node != null) { getLOD2DataSet().addNode(extendedNodeToNode(node)); } } getLOD2DataSet().addWay(simpleAreaWay.buildEntity()); } } if (!isLOD2) { return; } if (highway != null || boundary != null) { if (myLOD3Selector.isAllowed(getLOD3DataSet(), aW)) { combineSpitWays(getLOD3DataSet(), compoundWayRelationWithSimplifiedRoles, compoundWaysBaseLOD, simpleWay, minSizeLOD3, compoundWayLOD1, simplificationThresholdLOD3, nodeDistanceThresholdLOD3, myLOD3Selector); } } else if (landuse != null || natural != null) { if (myLOD3Selector.isAllowed(getLOD1DataSet(), aW)) { List<WayNode> simpleArea = getBaseDataSet().getWayHelper().simplifyWay(aW, simplificationThresholdLOD3, nodeDistanceThresholdLOD3, false, false); WayBuilder simpleAreaWay = new WayBuilder(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), 0); simpleAreaWay.getTags().addAll(aW.getTags()); for (WayNode wayNode : simpleArea) { simpleAreaWay.addWayNode(wayNode); Node node = getBaseDataSet().getNodeByID(wayNode.getNodeId()); if (node != null) { getLOD3DataSet().addNode(extendedNodeToNode(node)); } } getLOD3DataSet().addWay(simpleAreaWay.buildEntity()); } } }
LODDataSet implements IHintableDataSet, IDataSet { public void addWay(final Way aW) { getBaseDataSet().addWay(aW); String highway = WayHelper.getTag(aW, Tags.TAG_HIGHWAY); String boundary = WayHelper.getTag(aW, Tags.TAG_BOUNDARY); String waterway = WayHelper.getTag(aW, Tags.TAG_WATERWAY); String landuse = WayHelper.getTag(aW, Tags.TAG_LANDUSE); String natural = WayHelper.getTag(aW, Tags.TAG_NATURAL); boolean isLOD1 = false; boolean isLOD2 = false; Way simpleWay = aW; Relation compoundWayLOD1 = null; RelationBuilder compoundWayRelationWithSimplifiedRoles = null; WayBuilder[] compoundWaysBaseLOD = null; if (highway != null || boundary != null || (waterway != null && !waterway.equalsIgnoreCase("riverbank"))) { if (myLOD1Selector.isAllowed(getLOD1DataSet(), aW)) { List<WayNode> fewNodes = getWayHelper().simplifyWay(aW, simplificationThresholdLOD1, nodeDistanceThresholdLOD1, false, false); if (aW.getWayNodes().size() > fewNodes.size()) { simpleWay = new Way(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), aW.getChangesetId()); simpleWay.getTags().addAll(aW.getTags()); simpleWay.getWayNodes().addAll(fewNodes); } compoundWayLOD1 = getOrCreateCompoundWayLOD123(simpleWay); if (compoundWayLOD1 != null) { compoundWayRelationWithSimplifiedRoles = new RelationBuilder(compoundWayLOD1); compoundWaysBaseLOD = combineCompoundWay(compoundWayRelationWithSimplifiedRoles, simpleWay); isLOD1 = combineSpitWays(getLOD1DataSet(), compoundWayRelationWithSimplifiedRoles, compoundWaysBaseLOD, simpleWay, minSizeLOD1, compoundWayLOD1, simplificationThresholdLOD1, nodeDistanceThresholdLOD1, myLOD1Selector); } } } else if (landuse != null || natural != null || (waterway != null && waterway.equalsIgnoreCase("riverbank"))) { if (myLOD1Selector.isAllowed(getLOD1DataSet(), aW)) { List<WayNode> simpleArea = getBaseDataSet().getWayHelper().simplifyWay(aW, simplificationThresholdLOD1, nodeDistanceThresholdLOD1, false, false); WayBuilder simpleAreaWay = new WayBuilder(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), 0); simpleAreaWay.getTags().addAll(aW.getTags()); for (WayNode wayNode : simpleArea) { simpleAreaWay.addWayNode(wayNode); Node node = getBaseDataSet().getNodeByID(wayNode.getNodeId()); if (node != null) { getLOD1DataSet().addNode(extendedNodeToNode(node)); } } getLOD1DataSet().addWay(simpleAreaWay.buildEntity()); } } if (!isLOD1) { return; } if (highway != null || boundary != null) { if (myLOD2Selector.isAllowed(getLOD2DataSet(), aW)) { isLOD2 = combineSpitWays(getLOD2DataSet(), compoundWayRelationWithSimplifiedRoles, compoundWaysBaseLOD, simpleWay, minSizeLOD2, compoundWayLOD1, simplificationThresholdLOD2, nodeDistanceThresholdLOD2, myLOD2Selector); } } else if (landuse != null || natural != null) { if (myLOD2Selector.isAllowed(getLOD2DataSet(), aW)) { List<WayNode> simpleArea = getBaseDataSet().getWayHelper().simplifyWay(aW, simplificationThresholdLOD2, nodeDistanceThresholdLOD2, false, false); WayBuilder simpleAreaWay = new WayBuilder(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), 0); simpleAreaWay.getTags().addAll(aW.getTags()); for (WayNode wayNode : simpleArea) { simpleAreaWay.addWayNode(wayNode); Node node = getBaseDataSet().getNodeByID(wayNode.getNodeId()); if (node != null) { getLOD2DataSet().addNode(extendedNodeToNode(node)); } } getLOD2DataSet().addWay(simpleAreaWay.buildEntity()); } } if (!isLOD2) { return; } if (highway != null || boundary != null) { if (myLOD3Selector.isAllowed(getLOD3DataSet(), aW)) { combineSpitWays(getLOD3DataSet(), compoundWayRelationWithSimplifiedRoles, compoundWaysBaseLOD, simpleWay, minSizeLOD3, compoundWayLOD1, simplificationThresholdLOD3, nodeDistanceThresholdLOD3, myLOD3Selector); } } else if (landuse != null || natural != null) { if (myLOD3Selector.isAllowed(getLOD1DataSet(), aW)) { List<WayNode> simpleArea = getBaseDataSet().getWayHelper().simplifyWay(aW, simplificationThresholdLOD3, nodeDistanceThresholdLOD3, false, false); WayBuilder simpleAreaWay = new WayBuilder(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), 0); simpleAreaWay.getTags().addAll(aW.getTags()); for (WayNode wayNode : simpleArea) { simpleAreaWay.addWayNode(wayNode); Node node = getBaseDataSet().getNodeByID(wayNode.getNodeId()); if (node != null) { getLOD3DataSet().addNode(extendedNodeToNode(node)); } } getLOD3DataSet().addWay(simpleAreaWay.buildEntity()); } } } }
LODDataSet implements IHintableDataSet, IDataSet { public void addWay(final Way aW) { getBaseDataSet().addWay(aW); String highway = WayHelper.getTag(aW, Tags.TAG_HIGHWAY); String boundary = WayHelper.getTag(aW, Tags.TAG_BOUNDARY); String waterway = WayHelper.getTag(aW, Tags.TAG_WATERWAY); String landuse = WayHelper.getTag(aW, Tags.TAG_LANDUSE); String natural = WayHelper.getTag(aW, Tags.TAG_NATURAL); boolean isLOD1 = false; boolean isLOD2 = false; Way simpleWay = aW; Relation compoundWayLOD1 = null; RelationBuilder compoundWayRelationWithSimplifiedRoles = null; WayBuilder[] compoundWaysBaseLOD = null; if (highway != null || boundary != null || (waterway != null && !waterway.equalsIgnoreCase("riverbank"))) { if (myLOD1Selector.isAllowed(getLOD1DataSet(), aW)) { List<WayNode> fewNodes = getWayHelper().simplifyWay(aW, simplificationThresholdLOD1, nodeDistanceThresholdLOD1, false, false); if (aW.getWayNodes().size() > fewNodes.size()) { simpleWay = new Way(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), aW.getChangesetId()); simpleWay.getTags().addAll(aW.getTags()); simpleWay.getWayNodes().addAll(fewNodes); } compoundWayLOD1 = getOrCreateCompoundWayLOD123(simpleWay); if (compoundWayLOD1 != null) { compoundWayRelationWithSimplifiedRoles = new RelationBuilder(compoundWayLOD1); compoundWaysBaseLOD = combineCompoundWay(compoundWayRelationWithSimplifiedRoles, simpleWay); isLOD1 = combineSpitWays(getLOD1DataSet(), compoundWayRelationWithSimplifiedRoles, compoundWaysBaseLOD, simpleWay, minSizeLOD1, compoundWayLOD1, simplificationThresholdLOD1, nodeDistanceThresholdLOD1, myLOD1Selector); } } } else if (landuse != null || natural != null || (waterway != null && waterway.equalsIgnoreCase("riverbank"))) { if (myLOD1Selector.isAllowed(getLOD1DataSet(), aW)) { List<WayNode> simpleArea = getBaseDataSet().getWayHelper().simplifyWay(aW, simplificationThresholdLOD1, nodeDistanceThresholdLOD1, false, false); WayBuilder simpleAreaWay = new WayBuilder(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), 0); simpleAreaWay.getTags().addAll(aW.getTags()); for (WayNode wayNode : simpleArea) { simpleAreaWay.addWayNode(wayNode); Node node = getBaseDataSet().getNodeByID(wayNode.getNodeId()); if (node != null) { getLOD1DataSet().addNode(extendedNodeToNode(node)); } } getLOD1DataSet().addWay(simpleAreaWay.buildEntity()); } } if (!isLOD1) { return; } if (highway != null || boundary != null) { if (myLOD2Selector.isAllowed(getLOD2DataSet(), aW)) { isLOD2 = combineSpitWays(getLOD2DataSet(), compoundWayRelationWithSimplifiedRoles, compoundWaysBaseLOD, simpleWay, minSizeLOD2, compoundWayLOD1, simplificationThresholdLOD2, nodeDistanceThresholdLOD2, myLOD2Selector); } } else if (landuse != null || natural != null) { if (myLOD2Selector.isAllowed(getLOD2DataSet(), aW)) { List<WayNode> simpleArea = getBaseDataSet().getWayHelper().simplifyWay(aW, simplificationThresholdLOD2, nodeDistanceThresholdLOD2, false, false); WayBuilder simpleAreaWay = new WayBuilder(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), 0); simpleAreaWay.getTags().addAll(aW.getTags()); for (WayNode wayNode : simpleArea) { simpleAreaWay.addWayNode(wayNode); Node node = getBaseDataSet().getNodeByID(wayNode.getNodeId()); if (node != null) { getLOD2DataSet().addNode(extendedNodeToNode(node)); } } getLOD2DataSet().addWay(simpleAreaWay.buildEntity()); } } if (!isLOD2) { return; } if (highway != null || boundary != null) { if (myLOD3Selector.isAllowed(getLOD3DataSet(), aW)) { combineSpitWays(getLOD3DataSet(), compoundWayRelationWithSimplifiedRoles, compoundWaysBaseLOD, simpleWay, minSizeLOD3, compoundWayLOD1, simplificationThresholdLOD3, nodeDistanceThresholdLOD3, myLOD3Selector); } } else if (landuse != null || natural != null) { if (myLOD3Selector.isAllowed(getLOD1DataSet(), aW)) { List<WayNode> simpleArea = getBaseDataSet().getWayHelper().simplifyWay(aW, simplificationThresholdLOD3, nodeDistanceThresholdLOD3, false, false); WayBuilder simpleAreaWay = new WayBuilder(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), 0); simpleAreaWay.getTags().addAll(aW.getTags()); for (WayNode wayNode : simpleArea) { simpleAreaWay.addWayNode(wayNode); Node node = getBaseDataSet().getNodeByID(wayNode.getNodeId()); if (node != null) { getLOD3DataSet().addNode(extendedNodeToNode(node)); } } getLOD3DataSet().addWay(simpleAreaWay.buildEntity()); } } }  }
LODDataSet implements IHintableDataSet, IDataSet { public void addWay(final Way aW) { getBaseDataSet().addWay(aW); String highway = WayHelper.getTag(aW, Tags.TAG_HIGHWAY); String boundary = WayHelper.getTag(aW, Tags.TAG_BOUNDARY); String waterway = WayHelper.getTag(aW, Tags.TAG_WATERWAY); String landuse = WayHelper.getTag(aW, Tags.TAG_LANDUSE); String natural = WayHelper.getTag(aW, Tags.TAG_NATURAL); boolean isLOD1 = false; boolean isLOD2 = false; Way simpleWay = aW; Relation compoundWayLOD1 = null; RelationBuilder compoundWayRelationWithSimplifiedRoles = null; WayBuilder[] compoundWaysBaseLOD = null; if (highway != null || boundary != null || (waterway != null && !waterway.equalsIgnoreCase("riverbank"))) { if (myLOD1Selector.isAllowed(getLOD1DataSet(), aW)) { List<WayNode> fewNodes = getWayHelper().simplifyWay(aW, simplificationThresholdLOD1, nodeDistanceThresholdLOD1, false, false); if (aW.getWayNodes().size() > fewNodes.size()) { simpleWay = new Way(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), aW.getChangesetId()); simpleWay.getTags().addAll(aW.getTags()); simpleWay.getWayNodes().addAll(fewNodes); } compoundWayLOD1 = getOrCreateCompoundWayLOD123(simpleWay); if (compoundWayLOD1 != null) { compoundWayRelationWithSimplifiedRoles = new RelationBuilder(compoundWayLOD1); compoundWaysBaseLOD = combineCompoundWay(compoundWayRelationWithSimplifiedRoles, simpleWay); isLOD1 = combineSpitWays(getLOD1DataSet(), compoundWayRelationWithSimplifiedRoles, compoundWaysBaseLOD, simpleWay, minSizeLOD1, compoundWayLOD1, simplificationThresholdLOD1, nodeDistanceThresholdLOD1, myLOD1Selector); } } } else if (landuse != null || natural != null || (waterway != null && waterway.equalsIgnoreCase("riverbank"))) { if (myLOD1Selector.isAllowed(getLOD1DataSet(), aW)) { List<WayNode> simpleArea = getBaseDataSet().getWayHelper().simplifyWay(aW, simplificationThresholdLOD1, nodeDistanceThresholdLOD1, false, false); WayBuilder simpleAreaWay = new WayBuilder(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), 0); simpleAreaWay.getTags().addAll(aW.getTags()); for (WayNode wayNode : simpleArea) { simpleAreaWay.addWayNode(wayNode); Node node = getBaseDataSet().getNodeByID(wayNode.getNodeId()); if (node != null) { getLOD1DataSet().addNode(extendedNodeToNode(node)); } } getLOD1DataSet().addWay(simpleAreaWay.buildEntity()); } } if (!isLOD1) { return; } if (highway != null || boundary != null) { if (myLOD2Selector.isAllowed(getLOD2DataSet(), aW)) { isLOD2 = combineSpitWays(getLOD2DataSet(), compoundWayRelationWithSimplifiedRoles, compoundWaysBaseLOD, simpleWay, minSizeLOD2, compoundWayLOD1, simplificationThresholdLOD2, nodeDistanceThresholdLOD2, myLOD2Selector); } } else if (landuse != null || natural != null) { if (myLOD2Selector.isAllowed(getLOD2DataSet(), aW)) { List<WayNode> simpleArea = getBaseDataSet().getWayHelper().simplifyWay(aW, simplificationThresholdLOD2, nodeDistanceThresholdLOD2, false, false); WayBuilder simpleAreaWay = new WayBuilder(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), 0); simpleAreaWay.getTags().addAll(aW.getTags()); for (WayNode wayNode : simpleArea) { simpleAreaWay.addWayNode(wayNode); Node node = getBaseDataSet().getNodeByID(wayNode.getNodeId()); if (node != null) { getLOD2DataSet().addNode(extendedNodeToNode(node)); } } getLOD2DataSet().addWay(simpleAreaWay.buildEntity()); } } if (!isLOD2) { return; } if (highway != null || boundary != null) { if (myLOD3Selector.isAllowed(getLOD3DataSet(), aW)) { combineSpitWays(getLOD3DataSet(), compoundWayRelationWithSimplifiedRoles, compoundWaysBaseLOD, simpleWay, minSizeLOD3, compoundWayLOD1, simplificationThresholdLOD3, nodeDistanceThresholdLOD3, myLOD3Selector); } } else if (landuse != null || natural != null) { if (myLOD3Selector.isAllowed(getLOD1DataSet(), aW)) { List<WayNode> simpleArea = getBaseDataSet().getWayHelper().simplifyWay(aW, simplificationThresholdLOD3, nodeDistanceThresholdLOD3, false, false); WayBuilder simpleAreaWay = new WayBuilder(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), 0); simpleAreaWay.getTags().addAll(aW.getTags()); for (WayNode wayNode : simpleArea) { simpleAreaWay.addWayNode(wayNode); Node node = getBaseDataSet().getNodeByID(wayNode.getNodeId()); if (node != null) { getLOD3DataSet().addNode(extendedNodeToNode(node)); } } getLOD3DataSet().addWay(simpleAreaWay.buildEntity()); } } }  String toString(); void addNode(final Node aW); void addRelation(final Relation aR); void addWay(final Way aW); boolean containsNode(final Node aW); boolean containsRelation(final Relation aR); boolean containsWay(final Way aW); Node getNearestNode(final LatLon aLastGPSPos, final Selector aSelector); Node getNodeByID(final long aNodeID); Iterator<Node> getNodes(final Bounds aBoundingBox); Iterator<Node> getNodesByName(final String aLookFor); Iterator<Node> getNodesByTag(final String aKey, final String aValue); Relation getRelationByID(final long aRelationID); Iterator<Relation> getRelations(final Bounds aBoundingBox); WayHelper getWayHelper(); Iterator<Way> getWays(final Bounds aBoundingBox); Way getWaysByID(final long aWayID); Iterator<Way> getWaysByName(final String aLookFor, final Bounds aBoundingBox); Iterator<Way> getWaysByTag(final String aKey, final String aValue); Iterator<Way> getWaysForNode(final long aNodeID); void removeNode(final Node aW); void removeRelation(final Relation aR); void removeWay(final Way aW); IDataSet getLOD1DataSet(); void setLOD1DataSet(final IDataSet aDataSet); IDataSet getBaseDataSet(); void setBaseDataSet(final IDataSet aBaseDataSet); IDataSet getLOD2DataSet(); void setLOD2DataSet(final IDataSet aDataSet); IDataSet getLOD3DataSet(); void setLOD3DataSet(final IDataSet aDataSet); @Override void shutdown(); @Override ConfigurationSection getSettings(); @Override void hintImportEnded(); @Override void hintImportStarting(); }
LODDataSet implements IHintableDataSet, IDataSet { public void addWay(final Way aW) { getBaseDataSet().addWay(aW); String highway = WayHelper.getTag(aW, Tags.TAG_HIGHWAY); String boundary = WayHelper.getTag(aW, Tags.TAG_BOUNDARY); String waterway = WayHelper.getTag(aW, Tags.TAG_WATERWAY); String landuse = WayHelper.getTag(aW, Tags.TAG_LANDUSE); String natural = WayHelper.getTag(aW, Tags.TAG_NATURAL); boolean isLOD1 = false; boolean isLOD2 = false; Way simpleWay = aW; Relation compoundWayLOD1 = null; RelationBuilder compoundWayRelationWithSimplifiedRoles = null; WayBuilder[] compoundWaysBaseLOD = null; if (highway != null || boundary != null || (waterway != null && !waterway.equalsIgnoreCase("riverbank"))) { if (myLOD1Selector.isAllowed(getLOD1DataSet(), aW)) { List<WayNode> fewNodes = getWayHelper().simplifyWay(aW, simplificationThresholdLOD1, nodeDistanceThresholdLOD1, false, false); if (aW.getWayNodes().size() > fewNodes.size()) { simpleWay = new Way(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), aW.getChangesetId()); simpleWay.getTags().addAll(aW.getTags()); simpleWay.getWayNodes().addAll(fewNodes); } compoundWayLOD1 = getOrCreateCompoundWayLOD123(simpleWay); if (compoundWayLOD1 != null) { compoundWayRelationWithSimplifiedRoles = new RelationBuilder(compoundWayLOD1); compoundWaysBaseLOD = combineCompoundWay(compoundWayRelationWithSimplifiedRoles, simpleWay); isLOD1 = combineSpitWays(getLOD1DataSet(), compoundWayRelationWithSimplifiedRoles, compoundWaysBaseLOD, simpleWay, minSizeLOD1, compoundWayLOD1, simplificationThresholdLOD1, nodeDistanceThresholdLOD1, myLOD1Selector); } } } else if (landuse != null || natural != null || (waterway != null && waterway.equalsIgnoreCase("riverbank"))) { if (myLOD1Selector.isAllowed(getLOD1DataSet(), aW)) { List<WayNode> simpleArea = getBaseDataSet().getWayHelper().simplifyWay(aW, simplificationThresholdLOD1, nodeDistanceThresholdLOD1, false, false); WayBuilder simpleAreaWay = new WayBuilder(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), 0); simpleAreaWay.getTags().addAll(aW.getTags()); for (WayNode wayNode : simpleArea) { simpleAreaWay.addWayNode(wayNode); Node node = getBaseDataSet().getNodeByID(wayNode.getNodeId()); if (node != null) { getLOD1DataSet().addNode(extendedNodeToNode(node)); } } getLOD1DataSet().addWay(simpleAreaWay.buildEntity()); } } if (!isLOD1) { return; } if (highway != null || boundary != null) { if (myLOD2Selector.isAllowed(getLOD2DataSet(), aW)) { isLOD2 = combineSpitWays(getLOD2DataSet(), compoundWayRelationWithSimplifiedRoles, compoundWaysBaseLOD, simpleWay, minSizeLOD2, compoundWayLOD1, simplificationThresholdLOD2, nodeDistanceThresholdLOD2, myLOD2Selector); } } else if (landuse != null || natural != null) { if (myLOD2Selector.isAllowed(getLOD2DataSet(), aW)) { List<WayNode> simpleArea = getBaseDataSet().getWayHelper().simplifyWay(aW, simplificationThresholdLOD2, nodeDistanceThresholdLOD2, false, false); WayBuilder simpleAreaWay = new WayBuilder(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), 0); simpleAreaWay.getTags().addAll(aW.getTags()); for (WayNode wayNode : simpleArea) { simpleAreaWay.addWayNode(wayNode); Node node = getBaseDataSet().getNodeByID(wayNode.getNodeId()); if (node != null) { getLOD2DataSet().addNode(extendedNodeToNode(node)); } } getLOD2DataSet().addWay(simpleAreaWay.buildEntity()); } } if (!isLOD2) { return; } if (highway != null || boundary != null) { if (myLOD3Selector.isAllowed(getLOD3DataSet(), aW)) { combineSpitWays(getLOD3DataSet(), compoundWayRelationWithSimplifiedRoles, compoundWaysBaseLOD, simpleWay, minSizeLOD3, compoundWayLOD1, simplificationThresholdLOD3, nodeDistanceThresholdLOD3, myLOD3Selector); } } else if (landuse != null || natural != null) { if (myLOD3Selector.isAllowed(getLOD1DataSet(), aW)) { List<WayNode> simpleArea = getBaseDataSet().getWayHelper().simplifyWay(aW, simplificationThresholdLOD3, nodeDistanceThresholdLOD3, false, false); WayBuilder simpleAreaWay = new WayBuilder(aW.getId(), aW.getVersion(), aW.getTimestamp(), aW.getUser(), 0); simpleAreaWay.getTags().addAll(aW.getTags()); for (WayNode wayNode : simpleArea) { simpleAreaWay.addWayNode(wayNode); Node node = getBaseDataSet().getNodeByID(wayNode.getNodeId()); if (node != null) { getLOD3DataSet().addNode(extendedNodeToNode(node)); } } getLOD3DataSet().addWay(simpleAreaWay.buildEntity()); } } }  String toString(); void addNode(final Node aW); void addRelation(final Relation aR); void addWay(final Way aW); boolean containsNode(final Node aW); boolean containsRelation(final Relation aR); boolean containsWay(final Way aW); Node getNearestNode(final LatLon aLastGPSPos, final Selector aSelector); Node getNodeByID(final long aNodeID); Iterator<Node> getNodes(final Bounds aBoundingBox); Iterator<Node> getNodesByName(final String aLookFor); Iterator<Node> getNodesByTag(final String aKey, final String aValue); Relation getRelationByID(final long aRelationID); Iterator<Relation> getRelations(final Bounds aBoundingBox); WayHelper getWayHelper(); Iterator<Way> getWays(final Bounds aBoundingBox); Way getWaysByID(final long aWayID); Iterator<Way> getWaysByName(final String aLookFor, final Bounds aBoundingBox); Iterator<Way> getWaysByTag(final String aKey, final String aValue); Iterator<Way> getWaysForNode(final long aNodeID); void removeNode(final Node aW); void removeRelation(final Relation aR); void removeWay(final Way aW); IDataSet getLOD1DataSet(); void setLOD1DataSet(final IDataSet aDataSet); IDataSet getBaseDataSet(); void setBaseDataSet(final IDataSet aBaseDataSet); IDataSet getLOD2DataSet(); void setLOD2DataSet(final IDataSet aDataSet); IDataSet getLOD3DataSet(); void setLOD3DataSet(final IDataSet aDataSet); @Override void shutdown(); @Override ConfigurationSection getSettings(); @Override void hintImportEnded(); @Override void hintImportStarting();  }