use of com.revolsys.swing.map.layer.record.FileRecordLayer 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.FileRecordLayer 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;
}
Aggregations