/** * ${@inheritDoc}. * * @see * org.openstreetmap.osm.data.IDataSet#containsRelation(org.openstreetmap.osmosis.core.domain.v0_5.Relation) */ public boolean containsRelation(final Relation aR) { if (myCachingDataSet.containsRelation(aR)) return true; Relation n = myDataSource.getRelationByID(aR.getId()); if (n == null) return false; myCachingDataSet.addRelation(n); return true; }
/** * ${@inheritDoc}. * * @see org.openstreetmap.osm.data.IDataSet#getRelationByID(long) */ public Relation getRelationByID(final long aRelationID) { Relation n = myCachingDataSet.getRelationByID(aRelationID); if (n == null) { n = myDataSource.getRelationByID(aRelationID); if (n != null) myCachingDataSet.addRelation(n); } return n; }
/** * ${@inheritDoc}. * * @see * org.openstreetmap.osm.data.IDataSet#getRelations(org.openstreetmap.osm.data.coordinates.Bounds) */ public Iterator<Relation> getRelations(final Bounds aBoundingBox) { Iterator<Relation> n = myCachingDataSet.getRelations(aBoundingBox); if (n == null || !n.hasNext()) { n = myDataSource.getRelations(aBoundingBox); if (n != null && n.hasNext()) { LinkedList<Relation> nodes = new LinkedList<Relation>(); while (n.hasNext()) { Relation node = n.next(); nodes.add(node); myCachingDataSet.addRelation(node); return nodes.iterator(); } } } return n; }
/** * ${@inheritDoc}. * * @see * org.openstreetmap.osm.data.IDataSet#addRelation(org.openstreetmap.osmosis.core.domain.v0_5.Relation) */ public void addRelation(final Relation aR) { myCachingDataSet.addRelation(aR); myDataSource.addRelation(aR); }