Search in sources :

Example 21 with MapEx

use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.

the class GeoPackage method newDataSource.

@Override
public DataSource newDataSource(final Map<String, ? extends Object> config) {
    final MapEx newConfig = new LinkedHashMapEx(config);
    final String url = newConfig.getString("url");
    if (Property.hasValue(url) && !url.startsWith("jdbc")) {
        try {
            final UrlResource resource = new UrlResource(url);
            final File file = resource.getFile();
            final String newUrl = JDBC_PREFIX + FileUtil.getCanonicalPath(file);
            newConfig.put("url", newUrl);
        } catch (final Exception e) {
            throw new IllegalArgumentException(url + " must be a file", e);
        }
    }
    newConfig.put("enable_load_extension", true);
    return JdbcDatabaseFactory.super.newDataSource(newConfig);
}
Also used : LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) MapEx(com.revolsys.collection.map.MapEx) UrlResource(com.revolsys.spring.resource.UrlResource) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) File(java.io.File)

Example 22 with MapEx

use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.

the class CreateIndex method main.

public static void main(final String[] args) {
    SymbolLibrary.findSymbol("maki/police");
    final Resource makiFile = new UrlResource("https://www.mapbox.com/maki/www/maki.json");
    final List<MapEx> symbolList = Json.toMapList(makiFile);
    final SymbolLibrary symbolLibrary = new SymbolLibrary("maki", "Maki");
    for (final MapEx symbolMap : symbolList) {
        final String name = "maki/" + symbolMap.getString("icon");
        final String title = symbolMap.getString("name");
        symbolLibrary.addSymbolSvg(name, title);
    }
    final File symbolLibraryFile = new File("src/main/resources/META-INF/com.revolsys.swing.map.symbol.SymbolLibrary.json");
    MapObjectFactory.write(symbolLibraryFile, symbolLibrary);
    final SymbolLibrary symbolLibrary2 = MapObjectFactory.toObject(symbolLibraryFile);
}
Also used : UrlResource(com.revolsys.spring.resource.UrlResource) MapEx(com.revolsys.collection.map.MapEx) Resource(com.revolsys.spring.resource.Resource) UrlResource(com.revolsys.spring.resource.UrlResource) SymbolLibrary(com.revolsys.swing.map.symbol.SymbolLibrary) File(java.io.File)

Example 23 with MapEx

use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.

the class LasPointCloudHeader method toMap.

@Override
public MapEx toMap() {
    final MapEx map = new LinkedHashMapEx();
    addToMap(map, "version", this.version);
    addToMap(map, "fileSourceId", this.fileSourceId, 0);
    addToMap(map, "systemIdentifier", this.systemIdentifier);
    addToMap(map, "generatingSoftware", this.generatingSoftware);
    addToMap(map, "date", this.date);
    if (this.geometryFactory != null) {
        final int coordinateSystemId = this.geometryFactory.getCoordinateSystemId();
        if (coordinateSystemId > 0) {
            addToMap(map, "coordinateSystemId", coordinateSystemId);
        }
        final CoordinateSystem coordinateSystem = this.geometryFactory.getCoordinateSystem();
        if (coordinateSystem != null) {
            addToMap(map, "coordinateSystemName", coordinateSystem.getCoordinateSystemName());
            addToMap(map, "coordinateSystem", coordinateSystem.toEsriWktCs());
        }
    }
    addToMap(map, "boundingBox", getBoundingBox());
    addToMap(map, "headerSize", this.headerSize);
    if (this.laszip) {
        addToMap(map, "laszip", this.lasZipHeader);
    }
    addToMap(map, "pointRecordsOffset", this.pointRecordsOffset, 0);
    addToMap(map, "pointFormat", this.pointFormat.getId());
    addToMap(map, "pointCount", this.pointCount);
    int returnCount = 15;
    if (this.pointFormat.getId() < 6) {
        returnCount = 5;
    }
    int returnIndex = 0;
    final List<Long> pointCountByReturn = new ArrayList<>();
    for (final long pointCountForReturn : this.pointCountByReturn) {
        if (returnIndex < returnCount) {
            pointCountByReturn.add(pointCountForReturn);
        }
        returnIndex++;
    }
    addToMap(map, "pointCountByReturn", pointCountByReturn);
    return map;
}
Also used : MapEx(com.revolsys.collection.map.MapEx) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) CoordinateSystem(com.revolsys.geometry.cs.CoordinateSystem) ArrayList(java.util.ArrayList) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) LasPoint(com.revolsys.elevation.cloud.las.pointformat.LasPoint)

Example 24 with MapEx

use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.

the class LasPoint0Core method toMap.

@Override
public MapEx toMap() {
    final MapEx map = super.toMap();
    addToMap(map, "intensity", this.intensity, 0);
    addToMap(map, "returnNumber", getReturnNumber(), 0);
    addToMap(map, "numberOfReturns", getNumberOfReturns(), 0);
    addToMap(map, "scanDirectionFlag", isScanDirectionFlag(), false);
    addToMap(map, "edgeOfFlightLine", isEdgeOfFlightLine(), false);
    addToMap(map, "classification", getClassification());
    addToMap(map, "synthetic", isSynthetic(), false);
    addToMap(map, "keyPoint", isKeyPoint(), false);
    addToMap(map, "withheld", isWithheld(), false);
    addToMap(map, "scanAngle", this.scanAngleRank, 0);
    addToMap(map, "userData", this.userData, 0);
    addToMap(map, "pointSourceID", this.pointSourceID, 0);
    addToMap(map, "scannerChannel", this.scannerChannel, 0);
    return map;
}
Also used : MapEx(com.revolsys.collection.map.MapEx)

Example 25 with MapEx

use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.

the class LasPoint10GpsTimeRgbNirWavePackets method toMap.

@Override
public MapEx toMap() {
    final MapEx map = super.toMap();
    addToMap(map, "wavePacketDescriptorIndex", this.wavePacketDescriptorIndex);
    addToMap(map, "byteOffsetToWaveformData", this.byteOffsetToWaveformData);
    addToMap(map, "waveformPacketSizeInBytes", this.waveformPacketSizeInBytes);
    addToMap(map, "returnPointWaveformLocation", this.returnPointWaveformLocation);
    addToMap(map, "xT", this.xT);
    addToMap(map, "yT", this.yT);
    addToMap(map, "zT", this.zT);
    return map;
}
Also used : MapEx(com.revolsys.collection.map.MapEx)

Aggregations

MapEx (com.revolsys.collection.map.MapEx)144 LinkedHashMapEx (com.revolsys.collection.map.LinkedHashMapEx)48 ArrayList (java.util.ArrayList)17 Resource (com.revolsys.spring.resource.Resource)9 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)7 Map (java.util.Map)7 HashMap (java.util.HashMap)6 PathName (com.revolsys.io.PathName)5 UrlResource (com.revolsys.spring.resource.UrlResource)5 DataType (com.revolsys.datatype.DataType)4 FieldDefinition (com.revolsys.record.schema.FieldDefinition)4 PathResource (com.revolsys.spring.resource.PathResource)4 Color (java.awt.Color)4 LinkedHashMap (java.util.LinkedHashMap)4 List (java.util.List)4 TreeMap (java.util.TreeMap)4 NamedLinkedHashMapEx (com.revolsys.collection.map.NamedLinkedHashMapEx)3 Geometry (com.revolsys.geometry.model.Geometry)3 LineString (com.revolsys.geometry.model.LineString)3 Record (com.revolsys.record.Record)3