Merge "Issue #1638 Made gl extensions more usable by other gl projects and topo resource more extendable." into development
Former-commit-id:3151ba277c
[formerly b442e15efa533e64a2707878e15c52531cd79d5b] Former-commit-id:a7367c1e1a
This commit is contained in:
commit
877e78717b
16 changed files with 44 additions and 33 deletions
|
@ -21,6 +21,7 @@ Bundle-ActivationPolicy: lazy
|
|||
Export-Package: com.raytheon.viz.core.gl,
|
||||
com.raytheon.viz.core.gl.dataformat,
|
||||
com.raytheon.viz.core.gl.ext,
|
||||
com.raytheon.viz.core.gl.ext.imaging,
|
||||
com.raytheon.viz.core.gl.glsl,
|
||||
com.raytheon.viz.core.gl.images
|
||||
Import-Package: com.raytheon.uf.common.status,
|
||||
|
|
|
@ -36,22 +36,22 @@
|
|||
<extension
|
||||
point="com.raytheon.uf.viz.core.graphicsExtension">
|
||||
<graphicsExtension
|
||||
class="com.raytheon.viz.core.gl.internal.ext.GLColormapShadedShapeExtension">
|
||||
class="com.raytheon.viz.core.gl.ext.GLColormapShadedShapeExtension">
|
||||
</graphicsExtension>
|
||||
<graphicsExtension
|
||||
class="com.raytheon.viz.core.gl.ext.GLOffscreenRenderingExtension">
|
||||
</graphicsExtension>
|
||||
<graphicsExtension
|
||||
class="com.raytheon.viz.core.gl.internal.ext.GLMapMeshExtension">
|
||||
class="com.raytheon.viz.core.gl.ext.GLMapMeshExtension">
|
||||
</graphicsExtension>
|
||||
<graphicsExtension
|
||||
class="com.raytheon.viz.core.gl.internal.ext.GLColormappedImageExtension">
|
||||
class="com.raytheon.viz.core.gl.ext.imaging.GLColormappedImageExtension">
|
||||
</graphicsExtension>
|
||||
<graphicsExtension
|
||||
class="com.raytheon.viz.core.gl.internal.ext.GLSingleColorImageExtension">
|
||||
class="com.raytheon.viz.core.gl.ext.imaging.GLSingleColorImageExtension">
|
||||
</graphicsExtension>
|
||||
<graphicsExtension
|
||||
class="com.raytheon.viz.core.gl.internal.ext.GLDefaultImagingExtension">
|
||||
class="com.raytheon.viz.core.gl.ext.imaging.GLDefaultImagingExtension">
|
||||
</graphicsExtension>
|
||||
<graphicsExtension
|
||||
class="com.raytheon.viz.core.gl.internal.ext.mosaic.GLMosaicImageExtension">
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.core.gl.internal.ext;
|
||||
package com.raytheon.viz.core.gl.ext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.core.gl.internal.ext;
|
||||
package com.raytheon.viz.core.gl.ext;
|
||||
|
||||
import org.geotools.coverage.grid.GeneralGridGeometry;
|
||||
import org.geotools.coverage.grid.GridGeometry2D;
|
|
@ -44,10 +44,10 @@ import com.raytheon.viz.core.gl.dataformat.AbstractGLColorMapDataFormat;
|
|||
import com.raytheon.viz.core.gl.dataformat.GLByteDataFormat;
|
||||
import com.raytheon.viz.core.gl.dataformat.GLColorMapDataFormatFactory;
|
||||
import com.raytheon.viz.core.gl.dataformat.IGLColorMapDataFormatProvider;
|
||||
import com.raytheon.viz.core.gl.ext.imaging.GLColormappedImageExtension;
|
||||
import com.raytheon.viz.core.gl.images.AbstractGLImage;
|
||||
import com.raytheon.viz.core.gl.images.GLColormappedImage;
|
||||
import com.raytheon.viz.core.gl.internal.GLView2D;
|
||||
import com.raytheon.viz.core.gl.internal.ext.GLColormappedImageExtension;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.core.gl.ext;
|
||||
package com.raytheon.viz.core.gl.ext.imaging;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.core.gl.internal.ext;
|
||||
package com.raytheon.viz.core.gl.ext.imaging;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
|
@ -17,12 +17,11 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.core.gl.internal.ext;
|
||||
package com.raytheon.viz.core.gl.ext.imaging;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.core.gl.ext.AbstractGLImagingExtension;
|
||||
import com.raytheon.viz.core.gl.glsl.GLShaderProgram;
|
||||
import com.raytheon.viz.core.gl.images.AbstractGLImage;
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.core.gl.internal.ext;
|
||||
package com.raytheon.viz.core.gl.ext.imaging;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
|
@ -21,7 +21,7 @@ package com.raytheon.viz.core.gl.glsl;
|
|||
|
||||
import com.raytheon.viz.core.gl.GLCapabilities;
|
||||
import com.raytheon.viz.core.gl.IGLTarget;
|
||||
import com.raytheon.viz.core.gl.ext.AbstractGLImagingExtension;
|
||||
import com.raytheon.viz.core.gl.ext.imaging.AbstractGLImagingExtension;
|
||||
import com.raytheon.viz.core.gl.internal.GLTarget;
|
||||
|
||||
/**
|
||||
|
|
|
@ -220,10 +220,12 @@ public class GLShaderProgram {
|
|||
gl.glUniform1i(getUniformLocation(uniformName),
|
||||
((Boolean) value) == true ? 1 : 0);
|
||||
} else if (value instanceof int[]) {
|
||||
gl.glUniform1iv(getUniformLocation(uniformName), MAX_MULTIGRIDS,
|
||||
int[] ints = (int[]) value;
|
||||
gl.glUniform1iv(getUniformLocation(uniformName), ints.length,
|
||||
(int[]) value, 0);
|
||||
} else if (value instanceof float[]) {
|
||||
gl.glUniform1fv(getUniformLocation(uniformName), MAX_MULTIGRIDS,
|
||||
float[] floats = (float[]) value;
|
||||
gl.glUniform1fv(getUniformLocation(uniformName), floats.length,
|
||||
(float[]) value, 0);
|
||||
} else if (value instanceof RGB) {
|
||||
gl.glUniform3f(getUniformLocation(uniformName),
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.eclipse.swt.graphics.RGB;
|
|||
|
||||
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.ISingleColorImageExtension.ISingleColorImage;
|
||||
import com.raytheon.viz.core.gl.internal.ext.GLSingleColorImageExtension;
|
||||
import com.raytheon.viz.core.gl.ext.imaging.GLSingleColorImageExtension;
|
||||
|
||||
/**
|
||||
* GL Image object that all non-zero values should be mapped to a single color
|
||||
|
|
|
@ -85,12 +85,12 @@ import com.raytheon.viz.core.gl.GLDisposalManager;
|
|||
import com.raytheon.viz.core.gl.GLStats;
|
||||
import com.raytheon.viz.core.gl.IGLFont;
|
||||
import com.raytheon.viz.core.gl.IGLTarget;
|
||||
import com.raytheon.viz.core.gl.ext.imaging.GLColormappedImageExtension;
|
||||
import com.raytheon.viz.core.gl.ext.imaging.GLDefaultImagingExtension;
|
||||
import com.raytheon.viz.core.gl.glsl.GLSLFactory;
|
||||
import com.raytheon.viz.core.gl.glsl.GLShaderProgram;
|
||||
import com.raytheon.viz.core.gl.images.GLColormappedImage;
|
||||
import com.raytheon.viz.core.gl.images.GLImage;
|
||||
import com.raytheon.viz.core.gl.internal.ext.GLColormappedImageExtension;
|
||||
import com.raytheon.viz.core.gl.internal.ext.GLDefaultImagingExtension;
|
||||
import com.raytheon.viz.core.gl.objects.GLTextureObject;
|
||||
import com.sun.opengl.util.Screenshot;
|
||||
import com.sun.opengl.util.j2d.TextRenderer;
|
||||
|
|
|
@ -64,6 +64,7 @@ import com.raytheon.uf.viz.core.style.StyleManager;
|
|||
import com.raytheon.uf.viz.core.style.StyleManager.StyleType;
|
||||
import com.raytheon.uf.viz.core.style.StyleRule;
|
||||
import com.raytheon.uf.viz.core.tile.TileSetRenderable;
|
||||
import com.raytheon.uf.viz.core.tile.TileSetRenderable.TileImageCreator;
|
||||
import com.raytheon.viz.core.style.image.DataScale;
|
||||
import com.raytheon.viz.core.style.image.ImagePreferences;
|
||||
import com.raytheon.viz.core.style.image.SamplePreferences;
|
||||
|
@ -94,9 +95,9 @@ public class TopoResource extends
|
|||
}
|
||||
};
|
||||
|
||||
private File dataFile;
|
||||
protected File dataFile;
|
||||
|
||||
private TileSetRenderable topoTileSet;
|
||||
protected TileSetRenderable topoTileSet;
|
||||
|
||||
protected TopoResource(TopoResourceData topoData,
|
||||
LoadProperties loadProperties, File dataFile) throws VizException {
|
||||
|
@ -214,11 +215,14 @@ public class TopoResource extends
|
|||
|
||||
topoTileSet = new TileSetRenderable(
|
||||
getCapability(ImagingCapability.class), getTopoGeometry(),
|
||||
new TopoTileImageCreator(this, dataFile),
|
||||
getNumberOfTopoLevels(), 512);
|
||||
getTopoTileImageCreator(), getNumberOfTopoLevels(), 512);
|
||||
topoTileSet.project(descriptor.getGridGeometry());
|
||||
}
|
||||
|
||||
protected TileImageCreator getTopoTileImageCreator() {
|
||||
return new TopoTileImageCreator(this, dataFile);
|
||||
}
|
||||
|
||||
private int getNumberOfTopoLevels() throws VizException {
|
||||
IDataStore ds = DataStoreFactory.getDataStore(dataFile);
|
||||
try {
|
||||
|
|
|
@ -52,7 +52,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
|||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class TopoResourceData extends AbstractResourceData {
|
||||
|
||||
private static final String TOPO_DIR = "topo";
|
||||
protected static final String TOPO_DIR = "topo";
|
||||
|
||||
@XmlElement
|
||||
private String topoFile = "srtm30.hdf";
|
||||
|
@ -85,7 +85,7 @@ public class TopoResourceData extends AbstractResourceData {
|
|||
public TopoResource construct(LoadProperties loadProperties,
|
||||
IDescriptor descriptor) throws VizException {
|
||||
return new TopoResource(this, loadProperties, new File(TOPO_DIR
|
||||
+ IPathManager.SEPARATOR + topoFile));
|
||||
+ IPathManager.SEPARATOR + getTopoFile()));
|
||||
}
|
||||
|
||||
public String getTopoFile() {
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.raytheon.uf.viz.core.IGraphicsTarget;
|
|||
import com.raytheon.uf.viz.core.IGraphicsTarget.RasterMode;
|
||||
import com.raytheon.uf.viz.core.IMesh;
|
||||
import com.raytheon.uf.viz.core.PixelCoverage;
|
||||
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
|
||||
import com.raytheon.uf.viz.core.data.prep.HDF5DataRetriever;
|
||||
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.colormap.IColormappedImageExtension;
|
||||
|
@ -56,7 +57,7 @@ import com.raytheon.uf.viz.core.tile.TileSetRenderable.TileImageCreator;
|
|||
|
||||
public class TopoTileImageCreator implements TileImageCreator {
|
||||
|
||||
private TopoResource resource;
|
||||
protected TopoResource resource;
|
||||
|
||||
private File dataFile;
|
||||
|
||||
|
@ -76,15 +77,9 @@ public class TopoTileImageCreator implements TileImageCreator {
|
|||
@Override
|
||||
public DrawableImage createTileImage(IGraphicsTarget target, Tile tile,
|
||||
GeneralGridGeometry targetGeometry) throws VizException {
|
||||
int level = tile.tileLevel;
|
||||
String dataset = "/full";
|
||||
if (level > 0) {
|
||||
dataset = "/interpolated/" + level;
|
||||
}
|
||||
|
||||
IColormappedImage image = target.getExtension(
|
||||
IColormappedImageExtension.class).initializeRaster(
|
||||
new HDF5DataRetriever(dataFile, dataset, tile.getRectangle()),
|
||||
createColormapImageCallback(tile),
|
||||
resource.getCapability(ColorMapCapability.class)
|
||||
.getColorMapParameters());
|
||||
IMesh mesh = target.getExtension(IMapMeshExtension.class)
|
||||
|
@ -92,4 +87,14 @@ public class TopoTileImageCreator implements TileImageCreator {
|
|||
return new DrawableImage(image, new PixelCoverage(mesh),
|
||||
RasterMode.ASYNCHRONOUS);
|
||||
}
|
||||
|
||||
protected IColorMapDataRetrievalCallback createColormapImageCallback(
|
||||
Tile tile) {
|
||||
int level = tile.tileLevel;
|
||||
String dataset = "/full";
|
||||
if (level > 0) {
|
||||
dataset = "/interpolated/" + level;
|
||||
}
|
||||
return new HDF5DataRetriever(dataFile, dataset, tile.getRectangle());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue