Merge "Issue #772 switch satellite from offscreen rendering to mosaic for a more well defined graphics API. Change-Id: If293a65f577f13f6ba2ccae41b100dd9542d6998" into development
Former-commit-id:2af538f200
[formerly2af538f200
[formerly 95d4cacc92bbf5531ca54c3a4dda811ea402ac84]] Former-commit-id:ee43626e2e
Former-commit-id:3fbdc016c5
This commit is contained in:
commit
7644305fff
21 changed files with 417 additions and 253 deletions
|
@ -47,7 +47,6 @@ import com.raytheon.uf.viz.core.drawables.ImagingSupport;
|
||||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension.IGraphicsExtensionInterface;
|
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension.IGraphicsExtensionInterface;
|
||||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtensionManager;
|
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtensionManager;
|
||||||
import com.raytheon.uf.viz.core.drawables.ext.IOffscreenRenderingExtension;
|
|
||||||
import com.raytheon.uf.viz.core.drawables.ext.colormap.IColormappedImageExtension;
|
import com.raytheon.uf.viz.core.drawables.ext.colormap.IColormappedImageExtension;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
|
||||||
|
@ -382,17 +381,6 @@ public abstract class AbstractGraphicsTarget implements IGraphicsTarget {
|
||||||
magnification);
|
magnification);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void renderOffscreen(IImage offscreenImage) throws VizException {
|
|
||||||
getExtension(IOffscreenRenderingExtension.class).renderOffscreen(
|
|
||||||
offscreenImage);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void renderOnscreen() throws VizException {
|
|
||||||
getExtension(IOffscreenRenderingExtension.class).renderOnscreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawString(IFont font, String text, double x, double y,
|
public void drawString(IFont font, String text, double x, double y,
|
||||||
double z, TextStyle textStyle, RGB color,
|
double z, TextStyle textStyle, RGB color,
|
||||||
|
|
|
@ -731,20 +731,6 @@ public interface IGraphicsTarget extends IImagingExtension {
|
||||||
*/
|
*/
|
||||||
public IView getView();
|
public IView getView();
|
||||||
|
|
||||||
/**
|
|
||||||
* Use getExtension(IOffscreenRenderingExtension.class).renderOffscreen(
|
|
||||||
* offscreenImage) instead;
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void renderOffscreen(IImage offscreenImage) throws VizException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use getExtension(IOffscreenRenderingExtension.class).renderOnscreen()
|
|
||||||
* instead;
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void renderOnscreen() throws VizException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use drawStrings(DrawableString parameters)
|
* Use drawStrings(DrawableString parameters)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,17 +17,18 @@
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.viz.radar.rsc.mosaic.ext;
|
package com.raytheon.uf.viz.core.drawables.ext;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.core.DrawableImage;
|
import com.raytheon.uf.viz.core.DrawableImage;
|
||||||
import com.raytheon.uf.viz.core.IExtent;
|
import com.raytheon.uf.viz.core.IExtent;
|
||||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||||
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
|
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
|
||||||
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
|
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Radar mosaic image extension, creates IMosaicImages
|
* Mosaic image extension, creates IMosaicImages. Mosaicing should be used when
|
||||||
|
* multiple overlapping images are being drawn to the screen. The mosaic
|
||||||
|
* extension will combine these images into a single mosaic image.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
|
@ -43,7 +44,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface IRadarMosaicImageExtension extends IImagingExtension {
|
public interface IMosaicImageExtension extends IImagingExtension {
|
||||||
|
|
||||||
public static interface IMosaicImage extends IColormappedImage {
|
public static interface IMosaicImage extends IColormappedImage {
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.uf.viz.core.drawables.ext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A mosaicing extension that combines images by using the largest value for
|
||||||
|
* overlapped areas of multiple iamges.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Jul 10, 2012 bsteffen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author bsteffen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface IMosaicMaxValImageExtension extends IMosaicImageExtension {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.uf.viz.core.drawables.ext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A mosaicing extension that combines images by using the values from the last
|
||||||
|
* drawn image when images overalap.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Jul 10, 2012 bsteffen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author bsteffen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface IMosaicOrderedImageExtension extends IMosaicImageExtension {
|
||||||
|
|
||||||
|
}
|
|
@ -1,82 +0,0 @@
|
||||||
package com.raytheon.uf.viz.core.drawables.ext;
|
|
||||||
|
|
||||||
import java.nio.Buffer;
|
|
||||||
|
|
||||||
import com.raytheon.uf.viz.core.IExtent;
|
|
||||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
|
||||||
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
|
|
||||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
|
||||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension.IGraphicsExtensionInterface;
|
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
|
||||||
|
|
||||||
public interface IOffscreenRenderingExtension extends
|
|
||||||
IGraphicsExtensionInterface {
|
|
||||||
/**
|
|
||||||
* All drawing between a call to renderOffscreen and the next call to
|
|
||||||
* renderOnscreen will be drawn to offscreenImage rather than to the screen.
|
|
||||||
* Will use the current screen's world as the coverage area for the
|
|
||||||
* offscreen image
|
|
||||||
*
|
|
||||||
* @param offscreenImage
|
|
||||||
* image to render to
|
|
||||||
* @throws VizException
|
|
||||||
*/
|
|
||||||
public void renderOffscreen(IImage offscreenImage) throws VizException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All drawing between a call to renderOffscreen and the next call to
|
|
||||||
* renderOnscreen will be drawn to offscreenImage rather than to the screen.
|
|
||||||
* Will use the extent passed in as the world coverage area for the
|
|
||||||
* offscreen image
|
|
||||||
*
|
|
||||||
* @param offscreenImage
|
|
||||||
* @param offscreenExtent
|
|
||||||
* @throws VizException
|
|
||||||
*/
|
|
||||||
public void renderOffscreen(IImage offscreenImage, IExtent offscreenExtent)
|
|
||||||
throws VizException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset rendering to the screen. This only needs to be called if
|
|
||||||
* renderOffscreen has been called.
|
|
||||||
*
|
|
||||||
* @throws VizException
|
|
||||||
*/
|
|
||||||
public void renderOnscreen() throws VizException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct an offscreen image with the specified dimensions. This image
|
|
||||||
* will be an RGB based image
|
|
||||||
*
|
|
||||||
* @param dimensions
|
|
||||||
* @return
|
|
||||||
* @throws VizException
|
|
||||||
*/
|
|
||||||
public IImage constructOffscreenImage(int[] dimensions) throws VizException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct an offscreen image for given Buffer type and size
|
|
||||||
*
|
|
||||||
* @param dataType
|
|
||||||
* @param dataBounds
|
|
||||||
* @return
|
|
||||||
* @throws VizException
|
|
||||||
*/
|
|
||||||
public IColormappedImage constructOffscreenImage(
|
|
||||||
Class<? extends Buffer> dataType, int[] dimensions)
|
|
||||||
throws VizException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Construct an offscreen image for given Buffer type and size, applying
|
|
||||||
* ColorMapParameters to offscreen image where possible
|
|
||||||
*
|
|
||||||
* @param dataType
|
|
||||||
* @param dataBounds
|
|
||||||
* @param parameters
|
|
||||||
* @return
|
|
||||||
* @throws VizException
|
|
||||||
*/
|
|
||||||
public IColormappedImage constructOffscreenImage(
|
|
||||||
Class<? extends Buffer> dataType, int[] dimensions,
|
|
||||||
ColorMapParameters parameters) throws VizException;
|
|
||||||
}
|
|
|
@ -6,8 +6,5 @@
|
||||||
<graphicsExtension
|
<graphicsExtension
|
||||||
class="com.raytheon.uf.viz.radar.gl.GLRadialMeshExtension">
|
class="com.raytheon.uf.viz.radar.gl.GLRadialMeshExtension">
|
||||||
</graphicsExtension>
|
</graphicsExtension>
|
||||||
<graphicsExtension
|
|
||||||
class="com.raytheon.uf.viz.radar.gl.mosaic.GLRadarMosaicImageExtension">
|
|
||||||
</graphicsExtension>
|
|
||||||
</extension>
|
</extension>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// this shader program sets values into a mosaic texture
|
// this shader program sets values into a mosaic texture
|
||||||
// which is the same size as the screen (frame buffer)
|
// which is the same size as the screen (frame buffer)
|
||||||
|
|
||||||
uniform sampler2D radarData;
|
uniform sampler2D imageData;
|
||||||
uniform sampler2D mosaicTexture;
|
uniform sampler2D mosaicTexture;
|
||||||
uniform int height;
|
uniform int height;
|
||||||
uniform int width;
|
uniform int width;
|
||||||
|
@ -9,10 +9,10 @@ uniform int width;
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
vec2 xy = gl_FragCoord.xy;
|
vec2 xy = gl_FragCoord.xy;
|
||||||
vec4 radarVal = texture2D(radarData,gl_TexCoord[0].st);
|
vec4 imageVal = texture2D(imageData,gl_TexCoord[0].st);
|
||||||
vec4 curVal = texture2D(mosaicTexture, vec2((xy.x / float(width)), (xy.y / float(height))));
|
vec4 curVal = texture2D(mosaicTexture, vec2((xy.x / float(width)), (xy.y / float(height))));
|
||||||
if ( radarVal.r > curVal.r ) {
|
if ( imageVal.r > curVal.r ) {
|
||||||
gl_FragColor = vec4(radarVal.r,0.0,0.0,1.0);
|
gl_FragColor = vec4(imageVal.r,0.0,0.0,1.0);
|
||||||
} else {
|
} else {
|
||||||
gl_FragColor = vec4(curVal.r,0.0,0.0,1.0);
|
gl_FragColor = vec4(curVal.r,0.0,0.0,1.0);
|
||||||
}
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
// this shader program sets values into a mosaic texture
|
||||||
|
// which is the same size as the screen (frame buffer)
|
||||||
|
|
||||||
|
uniform sampler2D imageData;
|
||||||
|
uniform sampler2D mosaicTexture;
|
||||||
|
uniform int height;
|
||||||
|
uniform int width;
|
||||||
|
|
||||||
|
void main(void)
|
||||||
|
{
|
||||||
|
vec2 xy = gl_FragCoord.xy;
|
||||||
|
vec4 imageVal = texture2D(imageData,gl_TexCoord[0].st);
|
||||||
|
vec4 curVal = texture2D(mosaicTexture, vec2((xy.x / float(width)), (xy.y / float(height))));
|
||||||
|
// assume 0 or NaN is No Data and should be replaced if another image has better values.
|
||||||
|
if ( imageVal.r != 0 && imageVal.r == imageVal.r) {
|
||||||
|
gl_FragColor = vec4(imageVal.r,0.0,0.0,1.0);
|
||||||
|
} else {
|
||||||
|
gl_FragColor = vec4(curVal.r,0.0,0.0,1.0);
|
||||||
|
}
|
||||||
|
}
|
|
@ -56,5 +56,14 @@
|
||||||
<graphicsExtension
|
<graphicsExtension
|
||||||
class="com.raytheon.viz.core.gl.internal.ext.GLMultiChannelImageExtension">
|
class="com.raytheon.viz.core.gl.internal.ext.GLMultiChannelImageExtension">
|
||||||
</graphicsExtension>
|
</graphicsExtension>
|
||||||
|
<graphicsExtension
|
||||||
|
class="com.raytheon.viz.core.gl.internal.ext.mosaic.GLMosaicImageExtension">
|
||||||
|
</graphicsExtension>
|
||||||
|
<graphicsExtension
|
||||||
|
class="com.raytheon.viz.core.gl.internal.ext.mosaic.GLMosaicMaxValImageExtension">
|
||||||
|
</graphicsExtension>
|
||||||
|
<graphicsExtension
|
||||||
|
class="com.raytheon.viz.core.gl.internal.ext.mosaic.GLMosaicOrderedImageExtension">
|
||||||
|
</graphicsExtension>
|
||||||
</extension>
|
</extension>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -1,3 +1,22 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* 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;
|
||||||
|
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
|
@ -16,7 +35,7 @@ import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
||||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension;
|
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension;
|
||||||
import com.raytheon.uf.viz.core.drawables.ext.IOffscreenRenderingExtension;
|
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension.IGraphicsExtensionInterface;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.viz.core.gl.IGLTarget;
|
import com.raytheon.viz.core.gl.IGLTarget;
|
||||||
import com.raytheon.viz.core.gl.dataformat.AbstractGLColorMapDataFormat;
|
import com.raytheon.viz.core.gl.dataformat.AbstractGLColorMapDataFormat;
|
||||||
|
@ -27,8 +46,28 @@ import com.raytheon.viz.core.gl.images.GLColormappedImage;
|
||||||
import com.raytheon.viz.core.gl.internal.GLView2D;
|
import com.raytheon.viz.core.gl.internal.GLView2D;
|
||||||
import com.raytheon.viz.core.gl.internal.ext.GLColormappedImageExtension;
|
import com.raytheon.viz.core.gl.internal.ext.GLColormappedImageExtension;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Provides logic for creating offscreen images in GL so that data can be
|
||||||
|
* rendered and saved for better efficiency. When rendering offscreen all render
|
||||||
|
* events to the target are sent to an offscreen image, this image can later be
|
||||||
|
* rendered onscreen.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Jul 10, 2012 bsteffen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author bsteffen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
public class GLOffscreenRenderingExtension extends GraphicsExtension<IGLTarget>
|
public class GLOffscreenRenderingExtension extends GraphicsExtension<IGLTarget>
|
||||||
implements IOffscreenRenderingExtension {
|
implements IGraphicsExtensionInterface {
|
||||||
|
|
||||||
private static class ViewInfo {
|
private static class ViewInfo {
|
||||||
private IView view;
|
private IView view;
|
||||||
|
@ -53,25 +92,10 @@ public class GLOffscreenRenderingExtension extends GraphicsExtension<IGLTarget>
|
||||||
|
|
||||||
private ViewInfo currentInfo = null;
|
private ViewInfo currentInfo = null;
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.raytheon.uf.viz.core.drawables.ext.IOffscreenRenderingExtension#
|
|
||||||
* renderOffscreen(com.raytheon.uf.viz.core.drawables.IImage)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void renderOffscreen(IImage offscreenImage) throws VizException {
|
public void renderOffscreen(IImage offscreenImage) throws VizException {
|
||||||
renderOffscreen(offscreenImage, target.getView().getExtent());
|
renderOffscreen(offscreenImage, target.getView().getExtent());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.raytheon.uf.viz.core.drawables.ext.IOffscreenRenderingExtension#
|
|
||||||
* renderOffscreen(com.raytheon.uf.viz.core.drawables.IImage,
|
|
||||||
* com.raytheon.uf.viz.core.IExtent)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void renderOffscreen(IImage offscreenImage, IExtent offscreenExtent)
|
public void renderOffscreen(IImage offscreenImage, IExtent offscreenExtent)
|
||||||
throws VizException {
|
throws VizException {
|
||||||
if (!(offscreenImage instanceof AbstractGLImage)) {
|
if (!(offscreenImage instanceof AbstractGLImage)) {
|
||||||
|
@ -100,7 +124,6 @@ public class GLOffscreenRenderingExtension extends GraphicsExtension<IGLTarget>
|
||||||
setCurrentView(new ViewInfo(view, glImage));
|
setCurrentView(new ViewInfo(view, glImage));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void renderOnscreen() throws VizException {
|
public void renderOnscreen() throws VizException {
|
||||||
if (viewStack.size() > 0) {
|
if (viewStack.size() > 0) {
|
||||||
setCurrentView(viewStack.pop());
|
setCurrentView(viewStack.pop());
|
||||||
|
@ -139,13 +162,6 @@ public class GLOffscreenRenderingExtension extends GraphicsExtension<IGLTarget>
|
||||||
return Compatibilty.TARGET_COMPATIBLE;
|
return Compatibilty.TARGET_COMPATIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.raytheon.uf.viz.core.drawables.ext.IOffscreenRenderingExtension#
|
|
||||||
* constructOffscreenImage(int[])
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public IImage constructOffscreenImage(final int[] dimensions)
|
public IImage constructOffscreenImage(final int[] dimensions)
|
||||||
throws VizException {
|
throws VizException {
|
||||||
return target.initializeRaster(new IRenderedImageCallback() {
|
return target.initializeRaster(new IRenderedImageCallback() {
|
||||||
|
@ -157,26 +173,12 @@ public class GLOffscreenRenderingExtension extends GraphicsExtension<IGLTarget>
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.raytheon.uf.viz.core.drawables.ext.IOffscreenRenderingExtension#
|
|
||||||
* constructOffscreenImage(java.lang.Class, java.awt.Rectangle)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GLColormappedImage constructOffscreenImage(
|
public GLColormappedImage constructOffscreenImage(
|
||||||
Class<? extends Buffer> dataType, int[] dimensions)
|
Class<? extends Buffer> dataType, int[] dimensions)
|
||||||
throws VizException {
|
throws VizException {
|
||||||
return constructOffscreenImage(dataType, dimensions, null);
|
return constructOffscreenImage(dataType, dimensions, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.raytheon.uf.viz.core.drawables.ext.IOffscreenRenderingExtension#
|
|
||||||
* constructOffscreenImage(java.lang.Class, java.awt.Rectangle)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public GLColormappedImage constructOffscreenImage(
|
public GLColormappedImage constructOffscreenImage(
|
||||||
Class<? extends Buffer> dataType, final int[] dimensions,
|
Class<? extends Buffer> dataType, final int[] dimensions,
|
||||||
ColorMapParameters parameters) throws VizException {
|
ColorMapParameters parameters) throws VizException {
|
||||||
|
|
|
@ -17,14 +17,15 @@
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.radar.gl.mosaic;
|
package com.raytheon.viz.core.gl.internal.ext.mosaic;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.core.DrawableImage;
|
import com.raytheon.uf.viz.core.DrawableImage;
|
||||||
import com.raytheon.uf.viz.core.IExtent;
|
import com.raytheon.uf.viz.core.IExtent;
|
||||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.ext.IMosaicImageExtension;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.ext.IMosaicImageExtension.IMosaicImage;
|
||||||
import com.raytheon.viz.core.gl.images.GLColormappedImage;
|
import com.raytheon.viz.core.gl.images.GLColormappedImage;
|
||||||
import com.raytheon.viz.core.gl.images.GLDelegateImage;
|
import com.raytheon.viz.core.gl.images.GLDelegateImage;
|
||||||
import com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension.IMosaicImage;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GL implementation of IMosaicImage, wraps an offscreen image and contains
|
* GL implementation of IMosaicImage, wraps an offscreen image and contains
|
||||||
|
@ -61,8 +62,9 @@ public class GLMosaicImage extends GLDelegateImage<GLColormappedImage>
|
||||||
* @param extensionClass
|
* @param extensionClass
|
||||||
*/
|
*/
|
||||||
public GLMosaicImage(GLColormappedImage image, int[] bounds,
|
public GLMosaicImage(GLColormappedImage image, int[] bounds,
|
||||||
IExtent imageExtent) {
|
IExtent imageExtent,
|
||||||
super(image, GLRadarMosaicImageExtension.class);
|
Class<? extends IMosaicImageExtension> extensionClass) {
|
||||||
|
super(image, extensionClass);
|
||||||
this.bounds = bounds;
|
this.bounds = bounds;
|
||||||
this.extent = imageExtent;
|
this.extent = imageExtent;
|
||||||
}
|
}
|
|
@ -17,7 +17,7 @@
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.radar.gl.mosaic;
|
package com.raytheon.viz.core.gl.internal.ext.mosaic;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
|
@ -30,13 +30,12 @@ import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||||
import com.raytheon.uf.viz.core.drawables.ImagingSupport;
|
import com.raytheon.uf.viz.core.drawables.ImagingSupport;
|
||||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||||
import com.raytheon.uf.viz.core.drawables.ext.IOffscreenRenderingExtension;
|
import com.raytheon.uf.viz.core.drawables.ext.IMosaicImageExtension;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.viz.core.gl.ext.GLOffscreenRenderingExtension;
|
import com.raytheon.viz.core.gl.ext.GLOffscreenRenderingExtension;
|
||||||
import com.raytheon.viz.core.gl.glsl.AbstractGLSLImagingExtension;
|
import com.raytheon.viz.core.gl.glsl.AbstractGLSLImagingExtension;
|
||||||
import com.raytheon.viz.core.gl.glsl.GLShaderProgram;
|
import com.raytheon.viz.core.gl.glsl.GLShaderProgram;
|
||||||
import com.raytheon.viz.core.gl.images.AbstractGLImage;
|
import com.raytheon.viz.core.gl.images.AbstractGLImage;
|
||||||
import com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension used for rendering radar mosaic images
|
* Extension used for rendering radar mosaic images
|
||||||
|
@ -55,8 +54,8 @@ import com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension;
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class GLRadarMosaicImageExtension extends AbstractGLSLImagingExtension
|
public class GLMosaicImageExtension extends AbstractGLSLImagingExtension
|
||||||
implements IRadarMosaicImageExtension {
|
implements IMosaicImageExtension {
|
||||||
|
|
||||||
private AbstractGLImage writeToImage;
|
private AbstractGLImage writeToImage;
|
||||||
|
|
||||||
|
@ -65,7 +64,7 @@ public class GLRadarMosaicImageExtension extends AbstractGLSLImagingExtension
|
||||||
return new GLMosaicImage(target.getExtension(
|
return new GLMosaicImage(target.getExtension(
|
||||||
GLOffscreenRenderingExtension.class).constructOffscreenImage(
|
GLOffscreenRenderingExtension.class).constructOffscreenImage(
|
||||||
ByteBuffer.class, imageBounds, params), imageBounds,
|
ByteBuffer.class, imageBounds, params), imageBounds,
|
||||||
imageExtent);
|
imageExtent, this.getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -77,7 +76,7 @@ public class GLRadarMosaicImageExtension extends AbstractGLSLImagingExtension
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getShaderProgramName() {
|
public String getShaderProgramName() {
|
||||||
return "mosaicMaxVal";
|
return "mosaicOrdered";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -95,8 +94,8 @@ public class GLRadarMosaicImageExtension extends AbstractGLSLImagingExtension
|
||||||
GLMosaicImage mosaicImage = (GLMosaicImage) image;
|
GLMosaicImage mosaicImage = (GLMosaicImage) image;
|
||||||
if (mosaicImage.isRepaint()) {
|
if (mosaicImage.isRepaint()) {
|
||||||
writeToImage = mosaicImage.getWrappedImage();
|
writeToImage = mosaicImage.getWrappedImage();
|
||||||
IOffscreenRenderingExtension extension = target
|
GLOffscreenRenderingExtension extension = target
|
||||||
.getExtension(IOffscreenRenderingExtension.class);
|
.getExtension(GLOffscreenRenderingExtension.class);
|
||||||
try {
|
try {
|
||||||
extension.renderOffscreen(mosaicImage,
|
extension.renderOffscreen(mosaicImage,
|
||||||
mosaicImage.getImageExtent());
|
mosaicImage.getImageExtent());
|
||||||
|
@ -164,7 +163,7 @@ public class GLRadarMosaicImageExtension extends AbstractGLSLImagingExtension
|
||||||
@Override
|
@Override
|
||||||
public void loadShaderData(GLShaderProgram program, IImage image,
|
public void loadShaderData(GLShaderProgram program, IImage image,
|
||||||
PaintProperties paintProps) throws VizException {
|
PaintProperties paintProps) throws VizException {
|
||||||
program.setUniform("radarData", 0);
|
program.setUniform("imageData", 0);
|
||||||
program.setUniform("mosaicTexture", 1);
|
program.setUniform("mosaicTexture", 1);
|
||||||
|
|
||||||
// pass in width and height
|
// pass in width and height
|
|
@ -0,0 +1,49 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.viz.core.gl.internal.ext.mosaic;
|
||||||
|
|
||||||
|
import com.raytheon.uf.viz.core.drawables.ext.IMosaicMaxValImageExtension;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GL implementation of the max val mosaic algorithm
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Jul 10, 2012 bsteffen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author bsteffen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class GLMosaicMaxValImageExtension extends GLMosaicImageExtension
|
||||||
|
implements IMosaicMaxValImageExtension {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getShaderProgramName() {
|
||||||
|
return "mosaicMaxVal";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
|
package com.raytheon.viz.core.gl.internal.ext.mosaic;
|
||||||
|
|
||||||
|
import com.raytheon.uf.viz.core.drawables.ext.IMosaicOrderedImageExtension;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GL implementation of the ordered mosaic algorithm
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Jul 10, 2012 bsteffen Initial creation
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author bsteffen
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class GLMosaicOrderedImageExtension extends GLMosaicImageExtension
|
||||||
|
implements IMosaicOrderedImageExtension {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getShaderProgramName() {
|
||||||
|
return "mosaicOrdered";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -22,6 +22,7 @@ package com.raytheon.viz.core.rsc.hdf5;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -434,7 +435,7 @@ public abstract class AbstractTileSet implements IRenderable, IMeshCallback {
|
||||||
* @param isRecursiveCall
|
* @param isRecursiveCall
|
||||||
* @throws VizException
|
* @throws VizException
|
||||||
*/
|
*/
|
||||||
protected void drawInternal(IGraphicsTarget target,
|
protected List<DrawableImage> drawInternal(IGraphicsTarget target,
|
||||||
PaintProperties paintProps, int lvl, int depth) throws VizException {
|
PaintProperties paintProps, int lvl, int depth) throws VizException {
|
||||||
|
|
||||||
List<ImageTile> intersectedTiles = new ArrayList<ImageTile>();
|
List<ImageTile> intersectedTiles = new ArrayList<ImageTile>();
|
||||||
|
@ -504,12 +505,14 @@ public abstract class AbstractTileSet implements IRenderable, IMeshCallback {
|
||||||
|
|
||||||
// Draw lower resolution data first
|
// Draw lower resolution data first
|
||||||
if (needDrawLower && (lvl + 1) < levels) {
|
if (needDrawLower && (lvl + 1) < levels) {
|
||||||
drawInternal(target, paintProps, lvl + 1, depth + 1);
|
// put lower levels first in the list so they are drawn first.
|
||||||
|
List<DrawableImage> lowerImages = drawInternal(target, paintProps,
|
||||||
|
lvl + 1, depth + 1);
|
||||||
|
lowerImages.addAll(drawableImages);
|
||||||
|
drawableImages = lowerImages;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw all tiles at once
|
return drawableImages;
|
||||||
target.drawRasters(paintProps, drawableImages
|
|
||||||
.toArray(new DrawableImage[drawableImages.size()]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -526,11 +529,16 @@ public abstract class AbstractTileSet implements IRenderable, IMeshCallback {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lastPaintedTarget = target;
|
lastPaintedTarget = target;
|
||||||
do2D(target, paintProps);
|
List<DrawableImage> drawableImages = do2D(target, paintProps);
|
||||||
|
|
||||||
|
// Draw all tiles at once
|
||||||
|
target.drawRasters(paintProps, drawableImages
|
||||||
|
.toArray(new DrawableImage[drawableImages.size()]));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void do2D(IGraphicsTarget target, PaintProperties paintProps)
|
protected List<DrawableImage> do2D(IGraphicsTarget target,
|
||||||
throws VizException {
|
PaintProperties paintProps) throws VizException {
|
||||||
|
|
||||||
double screenToWorldRatio = paintProps.getCanvasBounds().width
|
double screenToWorldRatio = paintProps.getCanvasBounds().width
|
||||||
/ paintProps.getView().getExtent().getWidth();
|
/ paintProps.getView().getExtent().getWidth();
|
||||||
|
@ -550,9 +558,11 @@ public abstract class AbstractTileSet implements IRenderable, IMeshCallback {
|
||||||
|
|
||||||
if (this.tileSet.getTileSet() != null
|
if (this.tileSet.getTileSet() != null
|
||||||
&& tileSet.getTileSet().size() > 0) {
|
&& tileSet.getTileSet().size() > 0) {
|
||||||
drawInternal(target, paintProps, usedTileLevel, 0);
|
|
||||||
|
|
||||||
lastPaintedLevel = usedTileLevel;
|
lastPaintedLevel = usedTileLevel;
|
||||||
|
|
||||||
|
return drawInternal(target, paintProps, usedTileLevel, 0);
|
||||||
|
} else {
|
||||||
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,6 @@ Export-Package: com.raytheon.viz.radar;
|
||||||
com.raytheon.viz.radar.rsc.graphic,
|
com.raytheon.viz.radar.rsc.graphic,
|
||||||
com.raytheon.viz.radar.rsc.image,
|
com.raytheon.viz.radar.rsc.image,
|
||||||
com.raytheon.viz.radar.rsc.mosaic,
|
com.raytheon.viz.radar.rsc.mosaic,
|
||||||
com.raytheon.viz.radar.rsc.mosaic.ext,
|
|
||||||
com.raytheon.viz.radar.ui;
|
com.raytheon.viz.radar.ui;
|
||||||
uses:="com.raytheon.viz.radar,
|
uses:="com.raytheon.viz.radar,
|
||||||
com.raytheon.viz.ui.dialogs,
|
com.raytheon.viz.ui.dialogs,
|
||||||
|
|
|
@ -31,6 +31,9 @@ import com.raytheon.uf.viz.core.PixelCoverage;
|
||||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.ext.IMosaicImageExtension;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.ext.IMosaicImageExtension.IMosaicImage;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.ext.IMosaicMaxValImageExtension;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||||
import com.raytheon.uf.viz.core.rsc.IRefreshListener;
|
import com.raytheon.uf.viz.core.rsc.IRefreshListener;
|
||||||
|
@ -40,8 +43,6 @@ import com.raytheon.viz.core.rsc.BestResResource;
|
||||||
import com.raytheon.viz.radar.rsc.MosaicPaintProperties;
|
import com.raytheon.viz.radar.rsc.MosaicPaintProperties;
|
||||||
import com.raytheon.viz.radar.rsc.RadarImageResource;
|
import com.raytheon.viz.radar.rsc.RadarImageResource;
|
||||||
import com.raytheon.viz.radar.rsc.mosaic.RadarMosaicRendererFactory.IRadarMosaicRenderer;
|
import com.raytheon.viz.radar.rsc.mosaic.RadarMosaicRendererFactory.IRadarMosaicRenderer;
|
||||||
import com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension;
|
|
||||||
import com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension.IMosaicImage;
|
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -177,12 +178,21 @@ public class RadarMosaicRenderer implements IRadarMosaicRenderer,
|
||||||
*/
|
*/
|
||||||
private void init(IGraphicsTarget target, PaintProperties paintProps,
|
private void init(IGraphicsTarget target, PaintProperties paintProps,
|
||||||
ColorMapParameters params) throws VizException {
|
ColorMapParameters params) throws VizException {
|
||||||
|
IMosaicImageExtension ext = target
|
||||||
|
.getExtension(IMosaicMaxValImageExtension.class);
|
||||||
|
if (ext == null) {
|
||||||
|
// This could return about any mosaicing algorithm but it is better
|
||||||
|
// than drawing nothing
|
||||||
|
ext = target.getExtension(IMosaicImageExtension.class);
|
||||||
|
}
|
||||||
|
if (ext == null) {
|
||||||
|
|
||||||
|
}
|
||||||
// Construct texture for mosaicing
|
// Construct texture for mosaicing
|
||||||
writeTo = target.getExtension(IRadarMosaicImageExtension.class)
|
writeTo = ext.initializeRaster(
|
||||||
.initializeRaster(
|
new int[] { paintProps.getCanvasBounds().width,
|
||||||
new int[] { paintProps.getCanvasBounds().width,
|
paintProps.getCanvasBounds().height }, paintProps
|
||||||
paintProps.getCanvasBounds().height },
|
.getView().getExtent(), params);
|
||||||
paintProps.getView().getExtent(), params);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -28,14 +28,16 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||||
|
|
||||||
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
|
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
import com.raytheon.uf.common.time.DataTime;
|
||||||
|
import com.raytheon.uf.viz.core.DrawableImage;
|
||||||
import com.raytheon.uf.viz.core.IExtent;
|
import com.raytheon.uf.viz.core.IExtent;
|
||||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||||
import com.raytheon.uf.viz.core.PixelCoverage;
|
import com.raytheon.uf.viz.core.PixelCoverage;
|
||||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||||
import com.raytheon.uf.viz.core.drawables.PaintStatus;
|
|
||||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||||
import com.raytheon.uf.viz.core.drawables.ext.IOffscreenRenderingExtension;
|
import com.raytheon.uf.viz.core.drawables.ext.IMosaicImageExtension;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.ext.IMosaicImageExtension.IMosaicImage;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.ext.IMosaicOrderedImageExtension;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||||
|
@ -44,6 +46,8 @@ import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
||||||
import com.raytheon.uf.viz.core.rsc.IResourceGroup;
|
import com.raytheon.uf.viz.core.rsc.IResourceGroup;
|
||||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,9 +71,7 @@ public class SatBlendedResource extends
|
||||||
AbstractVizResource<SatBlendedResourceData, MapDescriptor> implements
|
AbstractVizResource<SatBlendedResourceData, MapDescriptor> implements
|
||||||
IResourceGroup, IRefreshListener, IResourceDataChanged {
|
IResourceGroup, IRefreshListener, IResourceDataChanged {
|
||||||
|
|
||||||
private IImage offscreenImage = null;
|
private IMosaicImage mosaicImage = null;
|
||||||
|
|
||||||
private int[] imageBounds = null;
|
|
||||||
|
|
||||||
private IExtent lastExtent = null;
|
private IExtent lastExtent = null;
|
||||||
|
|
||||||
|
@ -149,15 +151,21 @@ public class SatBlendedResource extends
|
||||||
@Override
|
@Override
|
||||||
protected void paintInternal(IGraphicsTarget target,
|
protected void paintInternal(IGraphicsTarget target,
|
||||||
PaintProperties paintProps) throws VizException {
|
PaintProperties paintProps) throws VizException {
|
||||||
if (offscreenImage == null
|
ColorMapParameters params = getCapability(ColorMapCapability.class)
|
||||||
|| Arrays.equals(imageBounds,
|
.getColorMapParameters();
|
||||||
new int[] { paintProps.getCanvasBounds().width,
|
|
||||||
paintProps.getCanvasBounds().height }) == false) {
|
// If first paint, initialize and wait for next paint
|
||||||
|
if (mosaicImage == null) {
|
||||||
|
initImage(target, paintProps, params);
|
||||||
|
} else if (Arrays.equals(
|
||||||
|
new int[] { mosaicImage.getWidth(), mosaicImage.getHeight() },
|
||||||
|
new int[] { paintProps.getCanvasBounds().width,
|
||||||
|
paintProps.getCanvasBounds().height }) == false) {
|
||||||
|
// If Window size changed, recreate the off screen buffer
|
||||||
disposeImage();
|
disposeImage();
|
||||||
initImage(target, paintProps);
|
initImage(target, paintProps, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean newTimes = false;
|
|
||||||
List<DataTime> rscTimes = new ArrayList<DataTime>();
|
List<DataTime> rscTimes = new ArrayList<DataTime>();
|
||||||
for (ResourcePair rp : getResourceList()) {
|
for (ResourcePair rp : getResourceList()) {
|
||||||
AbstractVizResource<?, ?> rsc = rp.getResource();
|
AbstractVizResource<?, ?> rsc = rp.getResource();
|
||||||
|
@ -165,41 +173,41 @@ public class SatBlendedResource extends
|
||||||
rscTimes.add(descriptor.getTimeForResource(rsc));
|
rscTimes.add(descriptor.getTimeForResource(rsc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rscTimes.equals(lastTimes) == false) {
|
|
||||||
newTimes = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastTimes = rscTimes;
|
IExtent extent = paintProps.getView().getExtent().clone();
|
||||||
|
if (extent.equals(lastExtent) == false
|
||||||
|
|| rscTimes.equals(lastTimes) == false) {
|
||||||
|
lastTimes = rscTimes;
|
||||||
|
lastExtent = extent;
|
||||||
|
List<DrawableImage> images = new ArrayList<DrawableImage>();
|
||||||
|
|
||||||
if (paintProps.getView().getExtent().equals(lastExtent) == false
|
for (ResourcePair rp : getResourceList()) {
|
||||||
|| newTimes) {
|
AbstractVizResource<?, ?> rsc = rp.getResource();
|
||||||
|
DataTime time = paintProps.getFramesInfo().getTimeForResource(
|
||||||
IExtent extent = lastExtent = paintProps.getView().getExtent()
|
rsc);
|
||||||
.clone();
|
if (rsc != null && time != null) {
|
||||||
|
SatResource sr = (SatResource) rsc;
|
||||||
// render offscreen so alpha can be applied to combined image rather
|
DataTime timeForRsc = paintProps.getFramesInfo()
|
||||||
// than to each image.
|
.getTimeForResource(rsc);
|
||||||
target.renderOffscreen(offscreenImage);
|
PaintProperties rscProps = new PaintProperties(paintProps);
|
||||||
|
rscProps.setDataTime(timeForRsc);
|
||||||
if (paintProps.getDataTime() != null) {
|
rscProps.setAlpha(1.0f);
|
||||||
for (ResourcePair rp : getResourceList()) {
|
List<DrawableImage> rscImages = sr.getImages(target,
|
||||||
AbstractVizResource<?, ?> rsc = rp.getResource();
|
rscProps);
|
||||||
if (rsc != null) {
|
for (DrawableImage di : rscImages) {
|
||||||
DataTime timeForRsc = paintProps.getFramesInfo()
|
if (di != null && di.getImage() != null
|
||||||
.getTimeForResource(rsc);
|
&& di.getCoverage() != null
|
||||||
PaintProperties rscProps = new PaintProperties(
|
&& di.getCoverage().getMesh() != null) {
|
||||||
paintProps);
|
// If image is ready to go, add
|
||||||
rscProps.setDataTime(timeForRsc);
|
images.add(di);
|
||||||
rscProps.setAlpha(1.0f);
|
|
||||||
PaintStatus paintStatus = rsc.paint(target, rscProps);
|
|
||||||
if (paintStatus != PaintStatus.PAINTED) {
|
|
||||||
updatePaintStatus(paintStatus);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
target.renderOnscreen();
|
mosaicImage.setImagesToMosaic(images
|
||||||
|
.toArray(new DrawableImage[images.size()]));
|
||||||
|
mosaicImage.setImageExtent(extent);
|
||||||
|
|
||||||
Coordinate ul = new Coordinate(extent.getMinX(), extent.getMaxY());
|
Coordinate ul = new Coordinate(extent.getMinX(), extent.getMaxY());
|
||||||
Coordinate ur = new Coordinate(extent.getMaxX(), extent.getMaxY());
|
Coordinate ur = new Coordinate(extent.getMaxX(), extent.getMaxY());
|
||||||
|
@ -209,24 +217,35 @@ public class SatBlendedResource extends
|
||||||
imageCoverage = new PixelCoverage(ul, ur, lr, ll);
|
imageCoverage = new PixelCoverage(ul, ur, lr, ll);
|
||||||
}
|
}
|
||||||
|
|
||||||
target.drawRaster(offscreenImage, imageCoverage, paintProps);
|
mosaicImage.setContrast(getCapability(ImagingCapability.class)
|
||||||
|
.getContrast());
|
||||||
|
mosaicImage.setBrightness(getCapability(ImagingCapability.class)
|
||||||
|
.getBrightness());
|
||||||
|
|
||||||
|
target.drawRaster(mosaicImage, imageCoverage, paintProps);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initImage(IGraphicsTarget target, PaintProperties paintProps)
|
private void initImage(IGraphicsTarget target, PaintProperties paintProps,
|
||||||
throws VizException {
|
ColorMapParameters params) throws VizException {
|
||||||
// Construct texture for fbo
|
IMosaicImageExtension ext = target
|
||||||
imageBounds = new int[] { paintProps.getCanvasBounds().width,
|
.getExtension(IMosaicOrderedImageExtension.class);
|
||||||
paintProps.getCanvasBounds().height };
|
if (ext == null) {
|
||||||
offscreenImage = target
|
// This could return about any mosaicing algorithm but it is better
|
||||||
.getExtension(IOffscreenRenderingExtension.class)
|
// than drawing nothing
|
||||||
.constructOffscreenImage(imageBounds);
|
ext = target.getExtension(IMosaicImageExtension.class);
|
||||||
|
}
|
||||||
|
// Construct texture for mosaicing
|
||||||
|
mosaicImage = ext.initializeRaster(
|
||||||
|
new int[] { paintProps.getCanvasBounds().width,
|
||||||
|
paintProps.getCanvasBounds().height }, paintProps
|
||||||
|
.getView().getExtent(), params);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disposeImage() {
|
private void disposeImage() {
|
||||||
// Dispose of all data, offscreen texture
|
// Dispose of all data, offscreen texture
|
||||||
if (offscreenImage != null) {
|
if (mosaicImage != null) {
|
||||||
offscreenImage.dispose();
|
mosaicImage.dispose();
|
||||||
offscreenImage = null;
|
mosaicImage = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,12 @@ import com.raytheon.uf.common.datastorage.StorageException;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
|
import com.raytheon.uf.viz.core.DrawableImage;
|
||||||
import com.raytheon.uf.viz.core.HDF5Util;
|
import com.raytheon.uf.viz.core.HDF5Util;
|
||||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||||
import com.raytheon.uf.viz.core.drawables.ext.colormap.IColormappedImageExtension;
|
import com.raytheon.uf.viz.core.drawables.ext.colormap.IColormappedImageExtension;
|
||||||
import com.raytheon.uf.viz.core.exception.VizException;
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||||
|
@ -296,4 +298,9 @@ public class SatFileBasedTileSet extends FileBasedTileSet {
|
||||||
public void cancelRequest(int level, int i, int j) {
|
public void cancelRequest(int level, int i, int j) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DrawableImage> getImages(IGraphicsTarget target,
|
||||||
|
PaintProperties paintProps) throws VizException {
|
||||||
|
return do2D(target, paintProps);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.measure.converter.UnitConverter;
|
import javax.measure.converter.UnitConverter;
|
||||||
|
@ -52,6 +53,7 @@ import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.common.time.BinOffset;
|
import com.raytheon.uf.common.time.BinOffset;
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
import com.raytheon.uf.common.time.DataTime;
|
||||||
|
import com.raytheon.uf.viz.core.DrawableImage;
|
||||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||||
import com.raytheon.uf.viz.core.IMeshCallback;
|
import com.raytheon.uf.viz.core.IMeshCallback;
|
||||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||||
|
@ -107,13 +109,13 @@ public class SatResource extends
|
||||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
.getHandler(SatResource.class);
|
.getHandler(SatResource.class);
|
||||||
|
|
||||||
protected Map<DataTime, FileBasedTileSet> tileSet;
|
protected Map<DataTime, SatFileBasedTileSet> tileSet;
|
||||||
|
|
||||||
private Map<DataTime, SatelliteRecord> recordMap = new HashMap<DataTime, SatelliteRecord>();
|
private Map<DataTime, SatelliteRecord> recordMap = new HashMap<DataTime, SatelliteRecord>();
|
||||||
|
|
||||||
protected DataTime displayedDate;
|
protected DataTime displayedDate;
|
||||||
|
|
||||||
protected FileBasedTileSet baseTile;
|
protected SatFileBasedTileSet baseTile;
|
||||||
|
|
||||||
protected String legend;
|
protected String legend;
|
||||||
|
|
||||||
|
@ -125,7 +127,7 @@ public class SatResource extends
|
||||||
|
|
||||||
protected String viewType;
|
protected String viewType;
|
||||||
|
|
||||||
protected FileBasedTileSet currentTile;
|
protected SatFileBasedTileSet currentTile;
|
||||||
|
|
||||||
protected GridGeometry recordGeometry;
|
protected GridGeometry recordGeometry;
|
||||||
|
|
||||||
|
@ -139,7 +141,7 @@ public class SatResource extends
|
||||||
public SatResource(SatResourceData data, LoadProperties props) {
|
public SatResource(SatResourceData data, LoadProperties props) {
|
||||||
super(data, props);
|
super(data, props);
|
||||||
data.addChangeListener(this);
|
data.addChangeListener(this);
|
||||||
this.tileSet = new HashMap<DataTime, FileBasedTileSet>();
|
this.tileSet = new HashMap<DataTime, SatFileBasedTileSet>();
|
||||||
this.dataTimes = new ArrayList<DataTime>();
|
this.dataTimes = new ArrayList<DataTime>();
|
||||||
this.legend = null;
|
this.legend = null;
|
||||||
SatelliteRecord[] records = data.getRecords();
|
SatelliteRecord[] records = data.getRecords();
|
||||||
|
@ -224,12 +226,11 @@ public class SatResource extends
|
||||||
if (sr != null && sr.getPreferences() instanceof ImagePreferences) {
|
if (sr != null && sr.getPreferences() instanceof ImagePreferences) {
|
||||||
sampleRange = ((ImagePreferences) sr.getPreferences())
|
sampleRange = ((ImagePreferences) sr.getPreferences())
|
||||||
.getSamplePrefs();
|
.getSamplePrefs();
|
||||||
String lg = ((ImagePreferences) sr.getPreferences())
|
String lg = ((ImagePreferences) sr.getPreferences()).getLegend();
|
||||||
.getLegend();
|
// test, so legend is not over written with empty string
|
||||||
// test, so legend is not over written with empty string
|
if (lg != null && !lg.trim().isEmpty()) {
|
||||||
if (lg != null && !lg.trim().isEmpty()) {
|
legend = lg;
|
||||||
legend = lg;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
colorMapParameters = ColorMapParameterFactory.build(null,
|
colorMapParameters = ColorMapParameterFactory.build(null,
|
||||||
|
@ -447,7 +448,7 @@ public class SatResource extends
|
||||||
|
|
||||||
public void addRecord(PluginDataObject record) throws VizException {
|
public void addRecord(PluginDataObject record) throws VizException {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
FileBasedTileSet tile;
|
SatFileBasedTileSet tile;
|
||||||
DataTime recordTime = null;
|
DataTime recordTime = null;
|
||||||
if (resourceData.getBinOffset() != null || resourceData.equals(0)) {
|
if (resourceData.getBinOffset() != null || resourceData.equals(0)) {
|
||||||
BinOffset binOffset = resourceData.getBinOffset();
|
BinOffset binOffset = resourceData.getBinOffset();
|
||||||
|
@ -562,4 +563,18 @@ public class SatResource extends
|
||||||
issueRefresh();
|
issueRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DrawableImage> getImages(IGraphicsTarget target,
|
||||||
|
PaintProperties paintProps) throws VizException {
|
||||||
|
this.target = target;
|
||||||
|
this.displayedDate = paintProps.getDataTime();
|
||||||
|
if (this.displayedDate == null)
|
||||||
|
return Collections.emptyList();
|
||||||
|
|
||||||
|
currentTile = this.tileSet.get(this.displayedDate);
|
||||||
|
if (currentTile != null) {
|
||||||
|
return currentTile.getImages(target, paintProps);
|
||||||
|
}
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue