Search in sources :

Example 1 with OsmElement

use of com.revolsys.record.io.format.openstreetmap.model.OsmElement in project com.revolsys.open by revolsys.

the class OsmProxyLayerRecord method getRecordProxied.

@Override
protected LayerRecord getRecordProxied() {
    final Identifier identifier = getIdentifier();
    final OsmElement record = this.document.getRecord(identifier);
    final AbstractRecordLayer layer = getLayer();
    return new ArrayLayerRecord(layer, record);
}
Also used : OsmElement(com.revolsys.record.io.format.openstreetmap.model.OsmElement) ArrayLayerRecord(com.revolsys.swing.map.layer.record.ArrayLayerRecord) Identifier(com.revolsys.identifier.Identifier) AbstractRecordLayer(com.revolsys.swing.map.layer.record.AbstractRecordLayer)

Example 2 with OsmElement

use of com.revolsys.record.io.format.openstreetmap.model.OsmElement in project com.revolsys.open by revolsys.

the class OsmOverpassLayer method getRecords.

@Override
public List<LayerRecord> getRecords(BoundingBox boundingBox) {
    if (hasGeometryField()) {
        boundingBox = convertBoundingBox(boundingBox);
        if (Property.hasValue(boundingBox)) {
            final Map<Identifier, LayerRecord> recordMap = new HashMap<>();
            final List<BoundingBox> boundingBoxes = getTileBoundingBoxes(boundingBox);
            for (final BoundingBox tileBoundingBox : boundingBoxes) {
                final OsmDocument document = getTile(tileBoundingBox);
                for (final OsmElement record : document.getRecords()) {
                    final Geometry geometry = record.getGeometry();
                    if (geometry != null && !geometry.isEmpty()) {
                        if (boundingBox.intersects(geometry.getBoundingBox())) {
                            final Identifier identifier = record.getIdentifier();
                        // final OsmProxyLayerRecord layerRecord = new
                        // OsmProxyLayerRecord(
                        // this, document, identifier);
                        // recordMap.put(identifier, layerRecord);
                        }
                    }
                }
            }
            this.boundingBoxTileMap.keySet().retainAll(boundingBoxes);
            return new ArrayList<>(recordMap.values());
        }
    }
    return Collections.emptyList();
}
Also used : OsmElement(com.revolsys.record.io.format.openstreetmap.model.OsmElement) Geometry(com.revolsys.geometry.model.Geometry) Identifier(com.revolsys.identifier.Identifier) HashMap(java.util.HashMap) BoundingBox(com.revolsys.geometry.model.BoundingBox) ArrayList(java.util.ArrayList) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) OsmDocument(com.revolsys.record.io.format.openstreetmap.model.OsmDocument)

Example 3 with OsmElement

use of com.revolsys.record.io.format.openstreetmap.model.OsmElement in project com.revolsys.open by revolsys.

the class OpenStreetMapApiLayer method getRecords.

@Override
public List<LayerRecord> getRecords(BoundingBox boundingBox) {
    if (hasGeometryField()) {
        boundingBox = convertBoundingBox(boundingBox);
        if (Property.hasValue(boundingBox)) {
            final Map<Identifier, LayerRecord> recordMap = new HashMap<>();
            final List<BoundingBox> boundingBoxes = getTileBoundingBoxes(boundingBox);
            for (final BoundingBox tileBoundingBox : boundingBoxes) {
                final OsmDocument document = getTile(tileBoundingBox);
                for (final OsmElement record : document.getRecords()) {
                    final Geometry geometry = record.getGeometry();
                    if (geometry != null && !geometry.isEmpty()) {
                        if (boundingBox.intersects(geometry.getBoundingBox())) {
                            final Identifier identifier = record.getIdentifier();
                            final OsmProxyLayerRecord layerRecord = new OsmProxyLayerRecord(this, document, identifier);
                            recordMap.put(identifier, layerRecord);
                        }
                    }
                }
            }
            this.boundingBoxTileMap.keySet().retainAll(boundingBoxes);
            return new ArrayList<>(recordMap.values());
        }
    }
    return Collections.emptyList();
}
Also used : OsmElement(com.revolsys.record.io.format.openstreetmap.model.OsmElement) Geometry(com.revolsys.geometry.model.Geometry) Identifier(com.revolsys.identifier.Identifier) HashMap(java.util.HashMap) BoundingBox(com.revolsys.geometry.model.BoundingBox) ArrayList(java.util.ArrayList) LayerRecord(com.revolsys.swing.map.layer.record.LayerRecord) OsmDocument(com.revolsys.record.io.format.openstreetmap.model.OsmDocument)

Aggregations

Identifier (com.revolsys.identifier.Identifier)3 OsmElement (com.revolsys.record.io.format.openstreetmap.model.OsmElement)3 BoundingBox (com.revolsys.geometry.model.BoundingBox)2 Geometry (com.revolsys.geometry.model.Geometry)2 OsmDocument (com.revolsys.record.io.format.openstreetmap.model.OsmDocument)2 LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 AbstractRecordLayer (com.revolsys.swing.map.layer.record.AbstractRecordLayer)1 ArrayLayerRecord (com.revolsys.swing.map.layer.record.ArrayLayerRecord)1