use of com.revolsys.swing.map.layer.record.renderer.GeometryStyleRenderer in project com.revolsys.open by revolsys.
the class LayerGroup method openFile.
public int openFile(int index, final URL url) {
final String urlString = url.toString();
final Map<String, Object> properties = new HashMap<>();
properties.put("url", urlString);
String name = UrlUtil.getFileBaseName(url);
name = FileUtil.fromSafeName(name);
properties.put("name", name);
Layer layer;
if (IoFactory.hasFactory(TriangulatedIrregularNetworkReadFactory.class, url)) {
layer = new TriangulatedIrregularNetworkLayer(properties);
} else if (IoFactory.hasFactory(GriddedElevationModelReadFactory.class, url)) {
layer = new GriddedElevationModelLayer(properties);
} else if (IoFactory.hasFactory(GeoreferencedImageReadFactory.class, url)) {
layer = new GeoreferencedImageLayer(properties);
} else if (IoFactory.hasFactory(PointCloudReadFactory.class, url)) {
layer = new PointCloudLayer(properties);
} else if (IoFactory.hasFactory(RecordReaderFactory.class, url)) {
final FileRecordLayer recordLayer = new FileRecordLayer(properties);
final GeometryStyleRenderer renderer = recordLayer.getRenderer();
renderer.setStyle(GeometryStyle.newStyle());
layer = recordLayer;
} else {
layer = null;
}
if (layer != null) {
layer.setProperty("showTableView", isShowNewLayerTableView());
if (index == -1) {
addLayer(layer);
} else {
addLayer(index++, layer);
}
}
return index;
}
use of com.revolsys.swing.map.layer.record.renderer.GeometryStyleRenderer in project com.revolsys.open by revolsys.
the class LayerGroup method openFile.
public int openFile(final Class<? extends IoFactory> factoryClass, int index, final URL url) {
final String urlString = url.toString();
final Map<String, Object> properties = new HashMap<>();
properties.put("url", urlString);
String name = UrlUtil.getFileBaseName(url);
name = FileUtil.fromSafeName(name);
properties.put("name", name);
Layer layer;
if (factoryClass == TriangulatedIrregularNetworkReadFactory.class) {
layer = new TriangulatedIrregularNetworkLayer(properties);
} else if (factoryClass == GriddedElevationModelReadFactory.class) {
layer = new GriddedElevationModelLayer(properties);
} else if (factoryClass == GeoreferencedImageReadFactory.class) {
layer = new GeoreferencedImageLayer(properties);
} else if (factoryClass == PointCloudReadFactory.class) {
layer = new PointCloudLayer(properties);
} else if (factoryClass == RecordReaderFactory.class) {
final FileRecordLayer recordLayer = new FileRecordLayer(properties);
final GeometryStyleRenderer renderer = recordLayer.getRenderer();
renderer.setStyle(GeometryStyle.newStyle());
layer = recordLayer;
} else {
layer = null;
}
if (layer != null) {
layer.setProperty("showTableView", isShowNewLayerTableView());
if (index == -1) {
addLayer(layer);
} else {
addLayer(index++, layer);
}
}
return index;
}
use of com.revolsys.swing.map.layer.record.renderer.GeometryStyleRenderer in project com.revolsys.open by revolsys.
the class ArcGisRestServerRecordLayer method newSimpleFillRenderer.
private AbstractRecordLayerRenderer newSimpleFillRenderer(final MapEx symbol) {
final MapEx outline = symbol.getValue("outline");
final GeometryStyle style;
if (outline == null) {
style = new GeometryStyle();
style.setLineWidth(Quantities.getQuantity(0, CustomUnits.PIXEL));
} else {
style = newSimpleLineStyle(outline);
}
final Color fillColor = getColor(symbol);
style.setPolygonFill(fillColor);
return new GeometryStyleRenderer(this, style);
}
use of com.revolsys.swing.map.layer.record.renderer.GeometryStyleRenderer in project com.revolsys.open by revolsys.
the class AbstractRecordLayer method setProperties.
@Override
public void setProperties(final Map<String, ? extends Object> properties) {
if (!properties.containsKey("style")) {
final GeometryStyleRenderer renderer = getRenderer();
if (renderer != null) {
renderer.setStyle(GeometryStyle.newStyle());
}
}
super.setProperties(properties);
final Predicate<Record> predicate = AbstractRecordLayerRenderer.getFilter(this, properties);
if (predicate instanceof RecordDefinitionSqlFilter) {
final RecordDefinitionSqlFilter sqlFilter = (RecordDefinitionSqlFilter) predicate;
setWhere(sqlFilter.getQuery());
}
if (this.fieldNamesSets.isEmpty()) {
setFieldNamesSets(null);
}
}
Aggregations