Search in sources :

Example 66 with MapEx

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

the class RasterizerGriddedElevationModelLayerRenderer method toMap.

@Override
public MapEx toMap() {
    final MapEx map = super.toMap();
    addToMap(map, "rasterizer", this.rasterizer);
    addToMap(map, "opacity", this.opacity);
    return map;
}
Also used : MapEx(com.revolsys.collection.map.MapEx)

Example 67 with MapEx

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

the class MapGuideWebServerRecordLayer method toMap.

@Override
public MapEx toMap() {
    final MapEx map = super.toMap();
    addToMap(map, "url", this.url);
    addToMap(map, "username", this.username);
    addToMap(map, "password", PasswordUtil.encrypt(this.password));
    addToMap(map, "layerPath", this.layerPath);
    return map;
}
Also used : MapEx(com.revolsys.collection.map.MapEx)

Example 68 with MapEx

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

the class ArcGisRestServerRecordLayer method initRenderer.

private void initRenderer() {
    final List<AbstractRecordLayerRenderer> renderers = new ArrayList<>();
    final MapEx drawingInfo = this.layerDescription.getProperty("drawingInfo");
    if (drawingInfo != null) {
        final MapEx rendererProperties = drawingInfo.getValue("renderer");
        if (rendererProperties != null) {
            final String rendererType = rendererProperties.getString("type");
            if ("simple".equals(rendererType)) {
                final AbstractRecordLayerRenderer renderer = newSymbolRenderer(rendererProperties, "symbol");
                if (renderer != null) {
                    renderers.add(renderer);
                }
            } else if ("uniqueValue".equals(rendererType)) {
                final FilterMultipleRenderer filterRenderer = newUniqueValueRenderer(rendererProperties);
                renderers.add(filterRenderer);
            } else {
                Logs.error(this, "Unsupported renderer=" + rendererType + "\n" + rendererProperties);
            }
        }
        final List<MapEx> labellingInfo = drawingInfo.getValue("labelingInfo");
        if (labellingInfo != null) {
            final MultipleRecordRenderer labelRenderer = new MultipleRecordRenderer(this);
            labelRenderer.setName("labels");
            for (final MapEx labelProperties : labellingInfo) {
                addTextRenderer(labelRenderer, labelProperties);
            }
            if (!labelRenderer.isEmpty()) {
                renderers.add(labelRenderer);
            }
        }
    }
    if (renderers.isEmpty()) {
    } else if (renderers.size() == 1) {
        setRenderer(renderers.get(0));
    } else {
        setRenderer(new MultipleRecordRenderer(this, renderers));
    }
}
Also used : AbstractRecordLayerRenderer(com.revolsys.swing.map.layer.record.renderer.AbstractRecordLayerRenderer) MapEx(com.revolsys.collection.map.MapEx) MultipleRecordRenderer(com.revolsys.swing.map.layer.record.renderer.MultipleRecordRenderer) ArrayList(java.util.ArrayList) FilterMultipleRenderer(com.revolsys.swing.map.layer.record.renderer.FilterMultipleRenderer)

Example 69 with MapEx

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

the class ArcGisRestServerRecordLayer method addTextRenderer.

private void addTextRenderer(final AbstractMultipleRenderer renderers, final MapEx labelProperties) {
    final TextStyle textStyle = new TextStyle();
    final String alignment = labelProperties.getString("labelPlacement");
    if (alignment.endsWith("Left")) {
        textStyle.setTextHorizontalAlignment("right");
    } else if (alignment.endsWith("Right")) {
        textStyle.setTextHorizontalAlignment("left");
    } else if (alignment.endsWith("Before")) {
        textStyle.setTextHorizontalAlignment("right");
        textStyle.setTextPlacementType("vertex(0)");
    } else if (alignment.endsWith("Start")) {
        textStyle.setTextHorizontalAlignment("left");
        textStyle.setTextPlacementType("vertex(0)");
    } else if (alignment.endsWith("After")) {
        textStyle.setTextHorizontalAlignment("left");
        textStyle.setTextPlacementType("vertex(n)");
    } else if (alignment.endsWith("End")) {
        textStyle.setTextHorizontalAlignment("right");
        textStyle.setTextPlacementType("vertex(n)");
    } else if (alignment.endsWith("Along")) {
        textStyle.setTextHorizontalAlignment("center");
        textStyle.setTextPlacementType("auto");
    } else {
        textStyle.setTextHorizontalAlignment("center");
    }
    if (alignment.contains("Above")) {
        textStyle.setTextVerticalAlignment("bottom");
    } else if (alignment.endsWith("Below")) {
        textStyle.setTextVerticalAlignment("top");
    } else {
        textStyle.setTextVerticalAlignment("center");
    }
    String textName = labelProperties.getString("labelExpression");
    textName = textName.replace(" CONCAT ", "");
    textName = textName.replaceAll("\"([^\"]+)\"", "$1");
    textStyle.setTextName(textName);
    final MapEx symbol = labelProperties.getValue("symbol");
    if ("esriTS".equals(symbol.getString("type"))) {
        final Color textFill = getColor(symbol);
        textStyle.setTextFill(textFill);
        final Color backgroundColor = getColor(symbol, "backgroundColor");
        textStyle.setTextBoxColor(backgroundColor);
        // "useCodedValues": false,
        // "borderLineColor": null,
        // "verticalAlignment": "bottom",
        // "horizontalAlignment": "left",
        // "rightToLeft": false,
        // "kerning": true,
        final double angle = symbol.getDouble("angle", 0);
        textStyle.setTextOrientation(angle);
        final Quantity<Length> textDx = Quantities.getQuantity(symbol.getDouble("xoffset", 0), CustomUnits.PIXEL);
        textStyle.setTextDx(textDx);
        final Quantity<Length> textDy = Quantities.getQuantity(symbol.getDouble("yoffset", 0), CustomUnits.PIXEL);
        textStyle.setTextDx(textDy);
        final MapEx font = symbol.getValue("font");
        if (font != null) {
            final String faceName = font.getString("family", "Arial");
            textStyle.setTextFaceName(faceName);
            final Quantity<Length> size = Quantities.getQuantity(font.getDouble("size", 10), CustomUnits.PIXEL);
            textStyle.setTextSize(size);
        }
    // "font": {
    // "style": "normal",
    // "weight": "bold",
    // "decoration": "none"
    }
    final TextStyleRenderer textRenderer = new TextStyleRenderer(this, textStyle);
    textRenderer.setName(textName.replace("[", "").replace("]", ""));
    long minimumScale = labelProperties.getLong("minScale", Long.MAX_VALUE);
    if (minimumScale == 0) {
        minimumScale = Long.MAX_VALUE;
    }
    textRenderer.setMinimumScale(minimumScale);
    final long maximumScale = labelProperties.getLong("maxScale", 0);
    textRenderer.setMaximumScale(maximumScale);
    final String where = labelProperties.getString("where");
    textRenderer.setQueryFilter(where);
    renderers.addRenderer(textRenderer);
}
Also used : TextStyle(com.revolsys.swing.map.layer.record.style.TextStyle) MapEx(com.revolsys.collection.map.MapEx) Length(javax.measure.quantity.Length) Color(java.awt.Color) TextStyleRenderer(com.revolsys.swing.map.layer.record.renderer.TextStyleRenderer)

Example 70 with MapEx

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

the class PointCloudLayer method toMap.

@Override
public MapEx toMap() {
    final MapEx map = super.toMap();
    addToMap(map, "url", this.url);
    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