From 96c81a03df927fc2d965535505aabce4b4d4c137 Mon Sep 17 00:00:00 2001 From: Max Schenkelberg Date: Tue, 17 Apr 2012 17:47:21 -0500 Subject: [PATCH] Issue #239 Got radar and radar mosaic working for collaboration Former-commit-id: a8c0dd15e221a6415c44f73897a80bc4b69e5ca0 --- .../feature.xml | 8 + .../.classpath | 7 + .../.project | 28 ++ .../.settings/org.eclipse.jdt.core.prefs | 8 + .../META-INF/MANIFEST.MF | 21 ++ .../build.properties | 4 + .../plugin.xml | 38 +++ .../uf/viz/collaboration/radar/Activator.java | 30 ++ .../radar/mesh/CreateRadarRadialMesh.java | 261 ++++++++++++++++++ .../mesh/DispatchingRadarMeshExtension.java | 89 ++++++ .../radar/mosaic/CreateMosaicImageEvent.java | 101 +++++++ .../radar/mosaic/DispatchingMosaicImage.java | 97 +++++++ .../DispatchingRadarMosaicExtension.java | 84 ++++++ .../radar/mosaic/UpdateImagesToMosaic.java | 64 +++++ .../radar/mosaic/UpdateMosaicExtent.java | 76 +++++ .../RadarGraphicsExtRenderingHandler.java | 106 +++++++ .../META-INF/MANIFEST.MF | 4 +- .../rendering/ImagingRenderingHandler.java | 25 +- .../META-INF/MANIFEST.MF | 2 +- .../mosaic/GLRadarMosaicImageExtension.java | 4 +- .../graphics/DispatchGraphicsTarget.java | 1 + .../events/imagery/PaintImagesEvent.java | 72 +++++ .../AbstractDispatchingImageExtension.java | 51 +--- 23 files changed, 1122 insertions(+), 59 deletions(-) create mode 100644 cave/com.raytheon.uf.viz.collaboration.radar/.classpath create mode 100644 cave/com.raytheon.uf.viz.collaboration.radar/.project create mode 100644 cave/com.raytheon.uf.viz.collaboration.radar/.settings/org.eclipse.jdt.core.prefs create mode 100644 cave/com.raytheon.uf.viz.collaboration.radar/META-INF/MANIFEST.MF create mode 100644 cave/com.raytheon.uf.viz.collaboration.radar/build.properties create mode 100644 cave/com.raytheon.uf.viz.collaboration.radar/plugin.xml create mode 100644 cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/Activator.java create mode 100644 cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mesh/CreateRadarRadialMesh.java create mode 100644 cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mesh/DispatchingRadarMeshExtension.java create mode 100644 cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/CreateMosaicImageEvent.java create mode 100644 cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/DispatchingMosaicImage.java create mode 100644 cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/DispatchingRadarMosaicExtension.java create mode 100644 cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/UpdateImagesToMosaic.java create mode 100644 cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/UpdateMosaicExtent.java create mode 100644 cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/rendering/RadarGraphicsExtRenderingHandler.java diff --git a/cave/com.raytheon.uf.viz.collaboration.feature/feature.xml b/cave/com.raytheon.uf.viz.collaboration.feature/feature.xml index 6305646966..8b10257ec3 100644 --- a/cave/com.raytheon.uf.viz.collaboration.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.collaboration.feature/feature.xml @@ -22,6 +22,7 @@ + + + diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/.classpath b/cave/com.raytheon.uf.viz.collaboration.radar/.classpath new file mode 100644 index 0000000000..ad32c83a78 --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.radar/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/.project b/cave/com.raytheon.uf.viz.collaboration.radar/.project new file mode 100644 index 0000000000..7e145e7f30 --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.radar/.project @@ -0,0 +1,28 @@ + + + com.raytheon.uf.viz.collaboration.radar + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/.settings/org.eclipse.jdt.core.prefs b/cave/com.raytheon.uf.viz.collaboration.radar/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..88de49aa5c --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.radar/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Thu Apr 12 17:10:20 CDT 2012 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.collaboration.radar/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..dee25288d9 --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.radar/META-INF/MANIFEST.MF @@ -0,0 +1,21 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Radar Collaboration +Bundle-SymbolicName: com.raytheon.uf.viz.collaboration.radar;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: com.raytheon.uf.viz.collaboration.radar.Activator +Bundle-Vendor: RAYTHEON +Eclipse-RegisterBuddy: com.raytheon.uf.viz.core +Require-Bundle: org.eclipse.core.runtime, + com.raytheon.uf.viz.core;bundle-version="1.12.1174", + com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0", + com.raytheon.viz.radar;bundle-version="1.12.1174", + com.raytheon.uf.viz.remote.graphics;bundle-version="1.0.0", + com.raytheon.uf.common.geospatial;bundle-version="1.12.1174", + org.geotools;bundle-version="2.6.4", + com.raytheon.uf.common.colormap;bundle-version="1.12.1174", + com.raytheon.uf.viz.collaboration.ui;bundle-version="1.0.0", + com.raytheon.uf.viz.collaboration;bundle-version="1.0.0", + com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/build.properties b/cave/com.raytheon.uf.viz.collaboration.radar/build.properties new file mode 100644 index 0000000000..34d2e4d2da --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.radar/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/plugin.xml b/cave/com.raytheon.uf.viz.collaboration.radar/plugin.xml new file mode 100644 index 0000000000..2f7d3ff262 --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.radar/plugin.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/Activator.java b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/Activator.java new file mode 100644 index 0000000000..88ee972452 --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/Activator.java @@ -0,0 +1,30 @@ +package com.raytheon.uf.viz.collaboration.radar; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +public class Activator implements BundleActivator { + + private static BundleContext context; + + static BundleContext getContext() { + return context; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext bundleContext) throws Exception { + Activator.context = bundleContext; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext bundleContext) throws Exception { + Activator.context = null; + } + +} diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mesh/CreateRadarRadialMesh.java b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mesh/CreateRadarRadialMesh.java new file mode 100644 index 0000000000..7f90e8b643 --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mesh/CreateRadarRadialMesh.java @@ -0,0 +1,261 @@ +/** + * 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.collaboration.radar.mesh; + +import org.geotools.coverage.grid.GeneralGridGeometry; + +import com.raytheon.uf.common.dataplugin.radar.RadarRecord; +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; +import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent; + +/** + * Event class used to specify the creation of a radar radial mesh + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 16, 2012            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ +@DynamicSerialize +public class CreateRadarRadialMesh extends AbstractDispatchingObjectEvent { + + @DynamicSerializeElement + private Integer numBins; + + @DynamicSerializeElement + private Integer numRadials; + + @DynamicSerializeElement + private float[] angleData; + + @DynamicSerializeElement + private Integer gateResolution; + + @DynamicSerializeElement + private Float trueElevationAngle; + + @DynamicSerializeElement + private Integer jstart; + + @DynamicSerializeElement + private String format; + + @DynamicSerializeElement + private Float latitude; + + @DynamicSerializeElement + private Float longitude; + + @DynamicSerializeElement + private GeneralGridGeometry targetGeometry; + + /** + * @return the radarRecord + */ + public RadarRecord getRadarRecord() { + RadarRecord radarRecord = new RadarRecord(); + radarRecord.setAngleData(angleData); + radarRecord.setFormat(format); + radarRecord.setGateResolution(gateResolution); + radarRecord.setJstart(jstart); + radarRecord.setLatitude(latitude); + radarRecord.setLongitude(longitude); + radarRecord.setNumBins(numBins); + radarRecord.setNumRadials(numRadials); + radarRecord.setTrueElevationAngle(trueElevationAngle); + return radarRecord; + } + + /** + * @param radarRecord + * the radarRecord to set + */ + public void setRadarRecord(RadarRecord radarRecord) { + this.angleData = radarRecord.getAngleData(); + this.format = radarRecord.getFormat(); + this.gateResolution = radarRecord.getGateResolution(); + this.jstart = radarRecord.getJstart(); + this.latitude = radarRecord.getLatitude(); + this.longitude = radarRecord.getLongitude(); + this.numBins = radarRecord.getNumBins(); + this.numRadials = radarRecord.getNumRadials(); + this.trueElevationAngle = radarRecord.getTrueElevationAngle(); + } + + /** + * @return the targetGeometry + */ + public GeneralGridGeometry getTargetGeometry() { + return targetGeometry; + } + + /** + * @param targetGeometry + * the targetGeometry to set + */ + public void setTargetGeometry(GeneralGridGeometry targetGeometry) { + this.targetGeometry = targetGeometry; + } + + /** + * @return the numBins + */ + public Integer getNumBins() { + return numBins; + } + + /** + * @param numBins + * the numBins to set + */ + public void setNumBins(Integer numBins) { + this.numBins = numBins; + } + + /** + * @return the numRadials + */ + public Integer getNumRadials() { + return numRadials; + } + + /** + * @param numRadials + * the numRadials to set + */ + public void setNumRadials(Integer numRadials) { + this.numRadials = numRadials; + } + + /** + * @return the angleData + */ + public float[] getAngleData() { + return angleData; + } + + /** + * @param angleData + * the angleData to set + */ + public void setAngleData(float[] angleData) { + this.angleData = angleData; + } + + /** + * @return the gateResolution + */ + public Integer getGateResolution() { + return gateResolution; + } + + /** + * @param gateResolution + * the gateResolution to set + */ + public void setGateResolution(Integer gateResolution) { + this.gateResolution = gateResolution; + } + + /** + * @return the trueElevationAngle + */ + public Float getTrueElevationAngle() { + return trueElevationAngle; + } + + /** + * @param trueElevationAngle + * the trueElevationAngle to set + */ + public void setTrueElevationAngle(Float trueElevationAngle) { + this.trueElevationAngle = trueElevationAngle; + } + + /** + * @return the jstart + */ + public Integer getJstart() { + return jstart; + } + + /** + * @param jstart + * the jstart to set + */ + public void setJstart(Integer jstart) { + this.jstart = jstart; + } + + /** + * @return the format + */ + public String getFormat() { + return format; + } + + /** + * @param format + * the format to set + */ + public void setFormat(String format) { + this.format = format; + } + + /** + * @return the latitude + */ + public Float getLatitude() { + return latitude; + } + + /** + * @param latitude + * the latitude to set + */ + public void setLatitude(Float latitude) { + this.latitude = latitude; + } + + /** + * @return the longitude + */ + public Float getLongitude() { + return longitude; + } + + /** + * @param longitude + * the longitude to set + */ + public void setLongitude(Float longitude) { + this.longitude = longitude; + } + +} diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mesh/DispatchingRadarMeshExtension.java b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mesh/DispatchingRadarMeshExtension.java new file mode 100644 index 0000000000..1d3769ef3e --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mesh/DispatchingRadarMeshExtension.java @@ -0,0 +1,89 @@ +/** + * 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.collaboration.radar.mesh; + +import org.geotools.coverage.grid.GeneralGridGeometry; + +import com.raytheon.uf.common.dataplugin.radar.RadarRecord; +import com.raytheon.uf.viz.core.IMesh; +import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension; +import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.remote.graphics.DispatchGraphicsTarget; +import com.raytheon.uf.viz.remote.graphics.events.RemoteGraphicsEventFactory; +import com.raytheon.uf.viz.remote.graphics.objects.DispatchingMesh; +import com.raytheon.viz.radar.rsc.image.IRadialMeshExtension; + +/** + * Radar mesh extension implementation which creates dispatching mesh that + * forwards key events + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 13, 2012            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ + +public class DispatchingRadarMeshExtension extends + GraphicsExtension implements + IRadialMeshExtension { + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.viz.radar.rsc.image.IRadialMeshExtension#constructMesh(com + * .raytheon.uf.common.dataplugin.radar.RadarRecord, + * org.geotools.coverage.grid.GeneralGridGeometry) + */ + @Override + public IMesh constructMesh(RadarRecord radarData, + GeneralGridGeometry targetGeometry) throws VizException { + DispatchingMesh wrapping = new DispatchingMesh(target + .getWrappedObject().getExtension(IRadialMeshExtension.class) + .constructMesh(radarData, targetGeometry), + target.getDispatcher()); + CreateRadarRadialMesh create = RemoteGraphicsEventFactory.createEvent( + CreateRadarRadialMesh.class, wrapping); + create.setRadarRecord(radarData); + create.setTargetGeometry(targetGeometry); + target.dispatch(create); + return wrapping; + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension# + * getCompatibilityValue(com.raytheon.uf.viz.core.IGraphicsTarget) + */ + @Override + public int getCompatibilityValue(DispatchGraphicsTarget target) { + return Compatibilty.TARGET_COMPATIBLE; + } + +} diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/CreateMosaicImageEvent.java b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/CreateMosaicImageEvent.java new file mode 100644 index 0000000000..c5f9691087 --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/CreateMosaicImageEvent.java @@ -0,0 +1,101 @@ +/** + * 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.collaboration.radar.mosaic; + +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; +import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent; +import com.raytheon.uf.viz.remote.graphics.events.colormap.UpdateColorMapParametersEvent; + +/** + * Event for creating a new mosaic image + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 16, 2012            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ +@DynamicSerialize +public class CreateMosaicImageEvent extends AbstractDispatchingObjectEvent { + + @DynamicSerializeElement + private int[] bounds; + + @DynamicSerializeElement + private UpdateMosaicExtent extent; + + @DynamicSerializeElement + private UpdateColorMapParametersEvent colorMapParameters; + + /** + * @return the bounds + */ + public int[] getBounds() { + return bounds; + } + + /** + * @param bounds + * the bounds to set + */ + public void setBounds(int[] bounds) { + this.bounds = bounds; + } + + /** + * @return the extent + */ + public UpdateMosaicExtent getExtent() { + return extent; + } + + /** + * @param extent + * the extent to set + */ + public void setExtent(UpdateMosaicExtent extent) { + this.extent = extent; + } + + /** + * @return the colorMapParameters + */ + public UpdateColorMapParametersEvent getColorMapParameters() { + return colorMapParameters; + } + + /** + * @param colorMapParameters + * the colorMapParameters to set + */ + public void setColorMapParameters( + UpdateColorMapParametersEvent colorMapParameters) { + this.colorMapParameters = colorMapParameters; + } + +} diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/DispatchingMosaicImage.java b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/DispatchingMosaicImage.java new file mode 100644 index 0000000000..53503b1cda --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/DispatchingMosaicImage.java @@ -0,0 +1,97 @@ +/** + * 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.collaboration.radar.mosaic; + +import com.raytheon.uf.viz.core.DrawableImage; +import com.raytheon.uf.viz.core.IExtent; +import com.raytheon.uf.viz.core.drawables.ColorMapParameters; +import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension; +import com.raytheon.uf.viz.remote.graphics.Dispatcher; +import com.raytheon.uf.viz.remote.graphics.events.RemoteGraphicsEventFactory; +import com.raytheon.uf.viz.remote.graphics.events.imagery.PaintImagesEvent; +import com.raytheon.uf.viz.remote.graphics.objects.DispatchingColormappedImage; +import com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension.IMosaicImage; + +/** + * Dispatching mosaic image object created from graphics image and forwards key + * events to remote clients + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 16, 2012            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ + +public class DispatchingMosaicImage extends + DispatchingColormappedImage implements IMosaicImage { + + /** + * @param targetObject + * @param extensionClass + * @param dispatcher + */ + public DispatchingMosaicImage(IMosaicImage targetObject, + Class extensionClass, + Dispatcher dispatcher, ColorMapParameters parameters) { + super(targetObject, extensionClass, dispatcher, parameters); + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension.IMosaicImage + * #setImagesToMosaic(com.raytheon.uf.viz.core.DrawableImage[]) + */ + @Override + public void setImagesToMosaic(DrawableImage... images) { + UpdateImagesToMosaic event = RemoteGraphicsEventFactory.createEvent( + UpdateImagesToMosaic.class, this); + event.setImagesToMosaic(PaintImagesEvent.toPaintEvents(images)); + wrappedObject.setImagesToMosaic(PaintImagesEvent + .extractTargetImages(images)); + dispatch(event); + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension.IMosaicImage + * #setImageExtent(com.raytheon.uf.viz.core.IExtent) + */ + @Override + public void setImageExtent(IExtent imageExtent) { + wrappedObject.setImageExtent(imageExtent); + UpdateMosaicExtent extentUpdate = RemoteGraphicsEventFactory + .createEvent(UpdateMosaicExtent.class, this); + extentUpdate.setIExtent(imageExtent); + dispatch(extentUpdate); + } + +} diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/DispatchingRadarMosaicExtension.java b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/DispatchingRadarMosaicExtension.java new file mode 100644 index 0000000000..b8ff3d36a2 --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/DispatchingRadarMosaicExtension.java @@ -0,0 +1,84 @@ +/** + * 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.collaboration.radar.mosaic; + +import com.raytheon.uf.viz.core.IExtent; +import com.raytheon.uf.viz.core.drawables.ColorMapParameters; +import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.remote.graphics.events.RemoteGraphicsEventFactory; +import com.raytheon.uf.viz.remote.graphics.extensions.AbstractDispatchingImageExtension; +import com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension; + +/** + * Dispatching radar mosaic extension, creates dispatching IMosaicImage + * implementation that forwards key image events + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 13, 2012            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ + +public class DispatchingRadarMosaicExtension extends + AbstractDispatchingImageExtension implements IRadarMosaicImageExtension { + + /* + * (non-Javadoc) + * + * @see com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension# + * initializeRaster(int[], com.raytheon.uf.viz.core.IExtent, + * com.raytheon.uf.viz.core.drawables.ColorMapParameters) + */ + @Override + public IMosaicImage initializeRaster(int[] imageBounds, + IExtent imageExtent, ColorMapParameters params) throws VizException { + DispatchingMosaicImage image = new DispatchingMosaicImage(target + .getWrappedObject() + .getExtension(IRadarMosaicImageExtension.class) + .initializeRaster(imageBounds, imageExtent, params), + DispatchingRadarMosaicExtension.class, target.getDispatcher(), + params); + // Send creation event + CreateMosaicImageEvent creation = RemoteGraphicsEventFactory + .createEvent(CreateMosaicImageEvent.class, image); + creation.setBounds(imageBounds); + if (params != null) { + creation.setColorMapParameters(DispatchingMosaicImage + .createColorMapParametersUpdateEvent(image)); + } + if (imageExtent != null) { + UpdateMosaicExtent extentUpdate = RemoteGraphicsEventFactory + .createEvent(UpdateMosaicExtent.class, image); + extentUpdate.setIExtent(imageExtent); + creation.setExtent(extentUpdate); + } + target.dispatch(creation); + return image; + } + +} diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/UpdateImagesToMosaic.java b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/UpdateImagesToMosaic.java new file mode 100644 index 0000000000..d74b333c93 --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/UpdateImagesToMosaic.java @@ -0,0 +1,64 @@ +/** + * 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.collaboration.radar.mosaic; + +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; +import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent; +import com.raytheon.uf.viz.remote.graphics.events.imagery.PaintImageEvent; + +/** + * Event for updating what images should be in the mosaic + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 16, 2012            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ +@DynamicSerialize +public class UpdateImagesToMosaic extends AbstractDispatchingObjectEvent { + + @DynamicSerializeElement + private PaintImageEvent[] imagesToMosaic; + + /** + * @return the imagesToMosaic + */ + public PaintImageEvent[] getImagesToMosaic() { + return imagesToMosaic; + } + + /** + * @param imagesToMosaic + * the imagesToMosaic to set + */ + public void setImagesToMosaic(PaintImageEvent[] imagesToMosaic) { + this.imagesToMosaic = imagesToMosaic; + } + +} diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/UpdateMosaicExtent.java b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/UpdateMosaicExtent.java new file mode 100644 index 0000000000..795e85b9ec --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/mosaic/UpdateMosaicExtent.java @@ -0,0 +1,76 @@ +/** + * 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.collaboration.radar.mosaic; + +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; +import com.raytheon.uf.viz.core.IExtent; +import com.raytheon.uf.viz.core.PixelExtent; +import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent; + +/** + * Event object for updating mosaic images extent + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 17, 2012            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ +@DynamicSerialize +public class UpdateMosaicExtent extends AbstractDispatchingObjectEvent { + + @DynamicSerializeElement + private double[] extent; + + /** + * @return the extent + */ + public double[] getExtent() { + return extent; + } + + /** + * @param extent + * the extent to set + */ + public void setExtent(double[] extent) { + this.extent = extent; + } + + public void setIExtent(IExtent extent) { + if (extent != null) { + setExtent(new double[] { extent.getMinX(), extent.getMaxX(), + extent.getMinY(), extent.getMaxY() }); + } + } + + public IExtent getIExtent() { + return new PixelExtent(extent[0], extent[1], extent[2], extent[3]); + } + +} diff --git a/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/rendering/RadarGraphicsExtRenderingHandler.java b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/rendering/RadarGraphicsExtRenderingHandler.java new file mode 100644 index 0000000000..b47d530f3c --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.radar/src/com/raytheon/uf/viz/collaboration/radar/rendering/RadarGraphicsExtRenderingHandler.java @@ -0,0 +1,106 @@ +/** + * 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.collaboration.radar.rendering; + +import com.google.common.eventbus.Subscribe; +import com.raytheon.uf.viz.collaboration.radar.mesh.CreateRadarRadialMesh; +import com.raytheon.uf.viz.collaboration.radar.mosaic.CreateMosaicImageEvent; +import com.raytheon.uf.viz.collaboration.radar.mosaic.UpdateImagesToMosaic; +import com.raytheon.uf.viz.collaboration.radar.mosaic.UpdateMosaicExtent; +import com.raytheon.uf.viz.collaboration.ui.rsc.rendering.CollaborationRenderingHandler; +import com.raytheon.uf.viz.collaboration.ui.rsc.rendering.ImagingRenderingHandler; +import com.raytheon.uf.viz.core.IExtent; +import com.raytheon.uf.viz.core.IGraphicsTarget; +import com.raytheon.uf.viz.core.drawables.ColorMapParameters; +import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.viz.radar.rsc.image.IRadialMeshExtension; +import com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension; +import com.raytheon.viz.radar.rsc.mosaic.ext.IRadarMosaicImageExtension.IMosaicImage; + +/** + * Rendering handler for radar graphics extension objects + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 17, 2012            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ + +public class RadarGraphicsExtRenderingHandler extends + CollaborationRenderingHandler { + + @Subscribe + public void createRadarMesh(CreateRadarRadialMesh event) + throws VizException { + int meshId = event.getObjectId(); + IGraphicsTarget target = getTarget(); + dataManager.putRenderableObject( + meshId, + target.getExtension(IRadialMeshExtension.class).constructMesh( + event.getRadarRecord(), event.getTargetGeometry())); + } + + @Subscribe + public void createMosaicImage(CreateMosaicImageEvent event) + throws VizException { + int imageId = event.getObjectId(); + IGraphicsTarget target = getTarget(); + IExtent imageExtent = null; + ColorMapParameters parameters = null; + if (event.getExtent() != null) { + imageExtent = event.getExtent().getIExtent(); + } + if (event.getColorMapParameters() != null) { + parameters = event.getColorMapParameters().asColorMapParameters(); + } + dataManager.putRenderableObject( + imageId, + target.getExtension(IRadarMosaicImageExtension.class) + .initializeRaster(event.getBounds(), imageExtent, + parameters)); + } + + @Subscribe + public void updateImagesToMosaic(UpdateImagesToMosaic event) { + IMosaicImage image = dataManager.getRenderableObject( + event.getObjectId(), IMosaicImage.class); + if (image != null) { + image.setImagesToMosaic(ImagingRenderingHandler.toDrawableImages( + event.getImagesToMosaic(), dataManager)); + } + } + + @Subscribe + public void updateMosaicImageExtent(UpdateMosaicExtent event) { + IMosaicImage image = dataManager.getRenderableObject( + event.getObjectId(), IMosaicImage.class); + if (image != null) { + image.setImageExtent(event.getIExtent()); + } + } +} diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.collaboration.ui/META-INF/MANIFEST.MF index 89eb6a2496..555c48acdb 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.collaboration.ui/META-INF/MANIFEST.MF @@ -6,7 +6,8 @@ Bundle-Version: 1.0.0.qualifier Bundle-Activator: com.raytheon.uf.viz.collaboration.ui.Activator Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Eclipse-RegisterBuddy: com.raytheon.uf.viz.core -Export-Package: com.raytheon.uf.viz.collaboration.ui +Export-Package: com.raytheon.uf.viz.collaboration.ui, + com.raytheon.uf.viz.collaboration.ui.rsc.rendering Require-Bundle: com.raytheon.viz.ui, org.eclipse.ui, org.eclipse.core.runtime, @@ -15,7 +16,6 @@ Require-Bundle: com.raytheon.viz.ui, org.eclipse.ecf;bundle-version="3.1.0", com.raytheon.uf.viz.core;bundle-version="1.12.1174", org.geotools;bundle-version="2.6.4", - com.google.guava;bundle-version="1.0.0", com.raytheon.viz.core;bundle-version="1.12.1174", com.raytheon.uf.viz.drawing;bundle-version="1.0.0", com.raytheon.uf.viz.remote.graphics;bundle-version="1.0.0" diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/ImagingRenderingHandler.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/ImagingRenderingHandler.java index d99d071b08..94751bfcab 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/ImagingRenderingHandler.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/rendering/ImagingRenderingHandler.java @@ -72,6 +72,24 @@ public class ImagingRenderingHandler extends CollaborationRenderingHandler { PaintProperties paintProps = getPaintProperties(); IGraphicsTarget target = getTarget(); PaintImageEvent[] events = event.getImageEvents(); + DrawableImage[] images = toDrawableImages(events, dataManager); + if (images.length > 0) { + PaintProperties imageProps = new PaintProperties(paintProps); + imageProps.setAlpha(event.getAlpha()); + target.drawRasters(imageProps, images); + } + } + + /** + * Converts PaintImageEvent[] into DrawableImage[] by looking up image and + * mesh objects from dataManager + * + * @param events + * @param dataManager + * @return + */ + public static DrawableImage[] toDrawableImages(PaintImageEvent[] events, + CollaborationRenderingDataManager dataManager) { List images = new ArrayList(events.length); for (PaintImageEvent pie : events) { IImage image = dataManager.getRenderableObject(pie.getObjectId(), @@ -89,12 +107,7 @@ public class ImagingRenderingHandler extends CollaborationRenderingHandler { // TODO: Log? } } - if (images.size() > 0) { - PaintProperties imageProps = new PaintProperties(paintProps); - imageProps.setAlpha(event.getAlpha()); - target.drawRasters(imageProps, - images.toArray(new DrawableImage[images.size()])); - } + return images.toArray(new DrawableImage[images.size()]); } @Subscribe diff --git a/cave/com.raytheon.uf.viz.collaboration/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.collaboration/META-INF/MANIFEST.MF index b10f7f750a..392bbfd55b 100644 --- a/cave/com.raytheon.uf.viz.collaboration/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.collaboration/META-INF/MANIFEST.MF @@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.ecf;bundle-version="3.1.300", org.eclipse.ecf.presence;bundle-version="2.0.0", org.eclipse.ecf.provider.xmpp;bundle-version="3.2.0", - com.google.guava;bundle-version="1.0.0", + com.google.guava;bundle-version="1.0.0";visibility:=reexport, com.raytheon.uf.common.serialization;bundle-version="1.12.1174", com.raytheon.uf.viz.core;bundle-version="1.12.1174", org.jivesoftware.smack;bundle-version="3.1.100" diff --git a/cave/com.raytheon.uf.viz.radar.gl/src/com/raytheon/uf/viz/radar/gl/mosaic/GLRadarMosaicImageExtension.java b/cave/com.raytheon.uf.viz.radar.gl/src/com/raytheon/uf/viz/radar/gl/mosaic/GLRadarMosaicImageExtension.java index 3fbd1ff9ea..8a5e5e6946 100644 --- a/cave/com.raytheon.uf.viz.radar.gl/src/com/raytheon/uf/viz/radar/gl/mosaic/GLRadarMosaicImageExtension.java +++ b/cave/com.raytheon.uf.viz.radar.gl/src/com/raytheon/uf/viz/radar/gl/mosaic/GLRadarMosaicImageExtension.java @@ -168,8 +168,8 @@ public class GLRadarMosaicImageExtension extends AbstractGLSLImagingExtension program.setUniform("mosaicTexture", 1); // pass in width and height - program.setUniform("height", (paintProps.getCanvasBounds().height)); - program.setUniform("width", (paintProps.getCanvasBounds().width)); + program.setUniform("height", writeToImage.getHeight()); + program.setUniform("width", writeToImage.getWidth()); } } diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/DispatchGraphicsTarget.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/DispatchGraphicsTarget.java index c33a354671..3e46d19f23 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/DispatchGraphicsTarget.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/DispatchGraphicsTarget.java @@ -484,6 +484,7 @@ public class DispatchGraphicsTarget extends DispatchingObject private void sendDrawWireframeShapeEvent(DispatchingWireframeShape shape, RGB color, float lineWidth, LineStyle lineStyle, IFont font, Float alpha) { + shape.updateState(); RenderWireframeShapeEvent event = RemoteGraphicsEventFactory .createEvent(RenderWireframeShapeEvent.class, shape); event.setColor(color); diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/imagery/PaintImagesEvent.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/imagery/PaintImagesEvent.java index 235b65fe4a..0cceb0b1c8 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/imagery/PaintImagesEvent.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/events/imagery/PaintImagesEvent.java @@ -21,8 +21,15 @@ package com.raytheon.uf.viz.remote.graphics.events.imagery; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; +import com.raytheon.uf.viz.core.DrawableImage; +import com.raytheon.uf.viz.core.IMesh; +import com.raytheon.uf.viz.core.PixelCoverage; +import com.raytheon.uf.viz.core.drawables.IImage; import com.raytheon.uf.viz.remote.graphics.AbstractRemoteGraphicsEvent; import com.raytheon.uf.viz.remote.graphics.events.IRenderEvent; +import com.raytheon.uf.viz.remote.graphics.events.RemoteGraphicsEventFactory; +import com.raytheon.uf.viz.remote.graphics.objects.AbstractDispatchingImage; +import com.raytheon.uf.viz.remote.graphics.objects.DispatchingMesh; /** * TODO Add Description @@ -80,4 +87,69 @@ public class PaintImagesEvent extends AbstractRemoteGraphicsEvent implements this.alpha = alpha; } + /** + * @param images + * the images to set + */ + public static PaintImageEvent[] toPaintEvents(DrawableImage[] images) { + PaintImageEvent[] imageEvents = new PaintImageEvent[images.length]; + + for (int i = 0; i < images.length; ++i) { + DrawableImage di = images[i]; + AbstractDispatchingImage dispatchingImage = (AbstractDispatchingImage) di + .getImage(); + + // If image parameters have been modified, update + dispatchingImage.updateState(); + + PixelCoverage coverage = di.getCoverage(); + PixelCoverage targetCoverage = new PixelCoverage(coverage.getUl(), + coverage.getUr(), coverage.getLr(), coverage.getLl()); + + PaintImageEvent paintEvent = RemoteGraphicsEventFactory + .createEvent(PaintImageEvent.class, dispatchingImage); + paintEvent.setPixelCoverage(coverage); + + IMesh mesh = coverage.getMesh(); + IMesh targetMesh = null; + if (mesh != null) { + DispatchingMesh dmesh = (DispatchingMesh) mesh; + targetMesh = dmesh.getWrappedObject(); + paintEvent.setMeshId(dmesh.getObjectId()); + targetCoverage.setMesh(targetMesh); + } + + imageEvents[i] = paintEvent; + } + return imageEvents; + } + + /** + * @param images + * the images to set + */ + public static DrawableImage[] extractTargetImages(DrawableImage[] images) { + DrawableImage[] targeted = new DrawableImage[images.length]; + + for (int i = 0; i < images.length; ++i) { + DrawableImage di = images[i]; + AbstractDispatchingImage dispatchingImage = (AbstractDispatchingImage) di + .getImage(); + + IImage targetImage = dispatchingImage.getWrappedObject(); + PixelCoverage coverage = di.getCoverage(); + PixelCoverage targetCoverage = new PixelCoverage(coverage.getUl(), + coverage.getUr(), coverage.getLr(), coverage.getLl()); + + IMesh mesh = coverage.getMesh(); + if (mesh != null) { + DispatchingMesh dmesh = (DispatchingMesh) mesh; + targetCoverage.setMesh(dmesh.getWrappedObject()); + } + + targeted[i] = new DrawableImage(targetImage, targetCoverage, + di.getMode()); + } + return targeted; + } } diff --git a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/extensions/AbstractDispatchingImageExtension.java b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/extensions/AbstractDispatchingImageExtension.java index 33973970a5..4bdd655b38 100644 --- a/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/extensions/AbstractDispatchingImageExtension.java +++ b/cave/com.raytheon.uf.viz.remote.graphics/src/com/raytheon/uf/viz/remote/graphics/extensions/AbstractDispatchingImageExtension.java @@ -19,23 +19,14 @@ **/ package com.raytheon.uf.viz.remote.graphics.extensions; -import java.util.ArrayList; -import java.util.List; - import com.raytheon.uf.viz.core.DrawableImage; -import com.raytheon.uf.viz.core.IMesh; -import com.raytheon.uf.viz.core.PixelCoverage; -import com.raytheon.uf.viz.core.drawables.IImage; import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension; import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.remote.graphics.DispatchGraphicsTarget; import com.raytheon.uf.viz.remote.graphics.events.RemoteGraphicsEventFactory; -import com.raytheon.uf.viz.remote.graphics.events.imagery.PaintImageEvent; import com.raytheon.uf.viz.remote.graphics.events.imagery.PaintImagesEvent; -import com.raytheon.uf.viz.remote.graphics.objects.AbstractDispatchingImage; -import com.raytheon.uf.viz.remote.graphics.objects.DispatchingMesh; /** * TODO Add Description @@ -79,49 +70,13 @@ public abstract class AbstractDispatchingImageExtension extends @Override public boolean drawRasters(PaintProperties paintProps, DrawableImage... images) throws VizException { - // All of these images are ready for actual rendering (status == LOADED) - List targeted = new ArrayList( - images.length); - PaintImageEvent[] imageEvents = new PaintImageEvent[images.length]; - - for (int i = 0; i < images.length; ++i) { - DrawableImage di = images[i]; - AbstractDispatchingImage dispatchingImage = (AbstractDispatchingImage) di - .getImage(); - - // If image parameters have been modified, update - dispatchingImage.updateState(); - - IImage targetImage = dispatchingImage.getWrappedObject(); - PixelCoverage coverage = di.getCoverage(); - PixelCoverage targetCoverage = new PixelCoverage(coverage.getUl(), - coverage.getUr(), coverage.getLr(), coverage.getLl()); - - PaintImageEvent paintEvent = RemoteGraphicsEventFactory - .createEvent(PaintImageEvent.class, dispatchingImage); - paintEvent.setPixelCoverage(coverage); - - IMesh mesh = coverage.getMesh(); - IMesh targetMesh = null; - if (mesh != null) { - DispatchingMesh dmesh = (DispatchingMesh) mesh; - targetMesh = dmesh.getWrappedObject(); - paintEvent.setMeshId(dmesh.getObjectId()); - targetCoverage.setMesh(targetMesh); - } - - targeted.add(new DrawableImage(targetImage, targetCoverage, di - .getMode())); - - imageEvents[i] = paintEvent; - } - PaintImagesEvent bulkRender = RemoteGraphicsEventFactory.createEvent( PaintImagesEvent.class, target); - bulkRender.setImageEvents(imageEvents); + bulkRender.setImageEvents(PaintImagesEvent.toPaintEvents(images)); + DrawableImage[] targeted = PaintImagesEvent.extractTargetImages(images); bulkRender.setAlpha(paintProps.getAlpha()); boolean rval = target.getWrappedObject().drawRasters(paintProps, - targeted.toArray(new DrawableImage[targeted.size()])); + targeted); target.dispatch(bulkRender); return rval; }