Search in sources :

Example 1 with SymbolLibrary

use of com.revolsys.swing.map.symbol.SymbolLibrary 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 2 with SymbolLibrary

use of com.revolsys.swing.map.symbol.SymbolLibrary in project com.revolsys.open by revolsys.

the class CreateIndex method main.

public static void main(final String[] args) {
    SymbolLibrary.findSymbol("maki/police");
    final File makiFile = new File("../maki/_includes/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);
    System.out.println(symbolLibrary2);
}
Also used : MapEx(com.revolsys.collection.map.MapEx) SymbolLibrary(com.revolsys.swing.map.symbol.SymbolLibrary) File(java.io.File)

Aggregations

MapEx (com.revolsys.collection.map.MapEx)2 SymbolLibrary (com.revolsys.swing.map.symbol.SymbolLibrary)2 File (java.io.File)2 Resource (com.revolsys.spring.resource.Resource)1 UrlResource (com.revolsys.spring.resource.UrlResource)1