use of com.revolsys.elevation.gridded.rasterizer.ColorGradientGriddedElevationModelRasterizer in project com.revolsys.open by revolsys.
the class GriddedElevationModelStylePanel method newField.
@Override
protected Field newField(final String fieldName, final Class<?> fieldClass, final Object value) {
if ("opacity".equals(fieldName)) {
final PercentSlider opacityField = new PercentSlider("opacity", (float) value);
Property.addListener(opacityField, this);
opacityField.setMaximumSize(new Dimension(100, 25));
return opacityField;
} else if ("gradient".equals(fieldName)) {
final ColorGradientField field = new ColorGradientField((ColorGradientGriddedElevationModelRasterizer) this.rasterizer);
Property.addListener(field, this);
return field;
} else {
return super.newField(fieldName, fieldClass, value);
}
}
use of com.revolsys.elevation.gridded.rasterizer.ColorGradientGriddedElevationModelRasterizer in project com.revolsys.open by revolsys.
the class GriddedElevationModel method serviceInit.
public static void serviceInit() {
IoFactoryRegistry.addFactory(new ScaledIntegerGriddedDigitalElevation());
IoFactoryRegistry.addFactory(new EsriAsciiGriddedElevation());
IoFactoryRegistry.addFactory(new UsgsGriddedElevation());
IoFactoryRegistry.addFactory(new Byn());
MapObjectFactoryRegistry.newFactory("gradientStop", GradientStop::new);
MapObjectFactoryRegistry.newFactory("multiStopLinearGradient", MultiStopLinearGradient::new);
// Rasterizers
MapObjectFactoryRegistry.newFactory("colorGriddedElevationModelRasterizer", ColorGriddedElevationModelRasterizer::new);
MapObjectFactoryRegistry.newFactory("colorGradientGriddedElevationModelRasterizer", ColorGradientGriddedElevationModelRasterizer::new);
MapObjectFactoryRegistry.newFactory("hillShadeGriddedElevationModelRasterizer", HillShadeGriddedElevationModelRasterizer::new);
}
use of com.revolsys.elevation.gridded.rasterizer.ColorGradientGriddedElevationModelRasterizer in project com.revolsys.open by revolsys.
the class RasterizerGriddedElevationModelLayerRenderer method render.
@Override
public void render(final Viewport2D viewport, final Cancellable cancellable, final ElevationModelLayer layer) {
// TODO cancel
final double scaleForVisible = viewport.getScaleForVisible();
if (layer.isVisible(scaleForVisible)) {
if (!layer.isEditable()) {
final GriddedElevationModel elevationModel = getElevationModel();
if (elevationModel != null) {
synchronized (this) {
if (this.rasterizer == null) {
final ColorGradientGriddedElevationModelRasterizer rasterizer = new ColorGradientGriddedElevationModelRasterizer();
setRasterizer(rasterizer);
final String name = this.rasterizer.getName();
setName(name);
}
if (this.image == null) {
this.image = new GriddedElevationModelImage(this.rasterizer);
}
if (this.image.getElevationModel() != elevationModel) {
this.image.setElevationModel(elevationModel);
this.redraw = true;
}
if (this.rasterizer != this.image.getRasterizer()) {
this.image.setRasterizer(this.rasterizer);
this.redraw = true;
}
}
if (this.image.hasImage() && !(this.image.isCached() && this.redraw)) {
final BoundingBox boundingBox = layer.getBoundingBox();
final Graphics2D graphics = viewport.getGraphics();
if (graphics != null) {
final Object interpolationMethod = null;
GeoreferencedImageLayerRenderer.renderAlpha(viewport, graphics, this.image, true, this.opacity, interpolationMethod);
GeoreferencedImageLayerRenderer.renderDifferentCoordinateSystem(viewport, graphics, boundingBox);
}
} else {
synchronized (this) {
if (this.redraw && this.worker == null) {
this.redraw = false;
this.worker = new Thread(() -> {
synchronized (this) {
if (this.worker == Thread.currentThread()) {
this.image.redraw();
this.worker = null;
}
layer.redraw();
}
});
this.worker.start();
}
}
}
}
}
}
}
use of com.revolsys.elevation.gridded.rasterizer.ColorGradientGriddedElevationModelRasterizer in project com.revolsys.open by revolsys.
the class RasterizerGriddedElevationModelLayerRenderer method newColorGradient.
public static RasterizerGriddedElevationModelLayerRenderer newColorGradient(final ElevationModelLayer layer, final IMultipleGriddedElevationModelLayerRenderer parent) {
final ColorGradientGriddedElevationModelRasterizer rasterizer = new ColorGradientGriddedElevationModelRasterizer();
final RasterizerGriddedElevationModelLayerRenderer renderer = new RasterizerGriddedElevationModelLayerRenderer(layer, parent, rasterizer);
renderer.setOpacity(0.8f);
return renderer;
}
Aggregations