diff --git a/cave/com.raytheon.uf.viz.core.feature/feature.xml b/cave/com.raytheon.uf.viz.core.feature/feature.xml index 891672963d..8bd3c7cee6 100644 --- a/cave/com.raytheon.uf.viz.core.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.core.feature/feature.xml @@ -200,4 +200,16 @@ install-size="0" version="0.0.0"/> + + + + diff --git a/cave/com.raytheon.uf.viz.core/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.core/META-INF/MANIFEST.MF index ef154e2e97..89b97e5e13 100644 --- a/cave/com.raytheon.uf.viz.core/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.core/META-INF/MANIFEST.MF @@ -30,7 +30,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.common.dataplugin, com.raytheon.uf.common.dataplugin.level, com.raytheon.uf.common.dataquery;visibility:=reexport, - com.raytheon.uf.viz.application;bundle-version="1.0.0" + com.raytheon.uf.viz.application;bundle-version="1.0.0", + com.raytheon.uf.common.geospatial;bundle-version="1.12.1174" Bundle-ActivationPolicy: lazy Eclipse-BuddyPolicy: ext, registered, global Eclipse-RegisterBuddy: org.apache.velocity, com.raytheon.edex.common, com.raytheon.uf.common.serialization, com.raytheon.uf.common.serialization.comm, com.raytheon.uf.common.status, com.raytheon.uf.common.dataplugin.level @@ -72,6 +73,7 @@ Export-Package: com.raytheon.uf.viz.core, com.raytheon.uf.viz.core.status, com.raytheon.uf.viz.core.style, com.raytheon.uf.viz.core.style.level, + com.raytheon.uf.viz.core.tile, com.raytheon.uf.viz.core.time, com.raytheon.uf.viz.core.topo, com.raytheon.uf.viz.core.velocity, @@ -87,7 +89,6 @@ Import-Package: com.raytheon.edex.colormap, com.raytheon.uf.common.comm, com.raytheon.uf.common.datastorage, com.raytheon.uf.common.datastorage.records, - com.raytheon.uf.common.geospatial, com.raytheon.uf.common.message, com.raytheon.uf.common.message.response, com.raytheon.uf.common.pointdata, diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/PixelCoverage.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/PixelCoverage.java index af9ed10489..ee7130fa30 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/PixelCoverage.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/PixelCoverage.java @@ -74,6 +74,11 @@ public class PixelCoverage { new Coordinate(center.x - width / 2, center.y + height / 2)); } + public PixelCoverage(IMesh mesh) { + this(new Coordinate(0, 0), 0, 0); + this.mesh = mesh; + } + public Coordinate getLl() { return ll; } diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/ext/IImagingExtension.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/ext/IImagingExtension.java index c5ce18bde2..8175b4dc0b 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/ext/IImagingExtension.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/ext/IImagingExtension.java @@ -19,7 +19,10 @@ **/ package com.raytheon.uf.viz.core.drawables.ext; +import java.util.Collection; + import com.raytheon.uf.viz.core.DrawableImage; +import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension.IGraphicsExtensionInterface; import com.raytheon.uf.viz.core.exception.VizException; @@ -43,6 +46,11 @@ import com.raytheon.uf.viz.core.exception.VizException; public interface IImagingExtension extends IGraphicsExtensionInterface { + public static interface ImageProvider { + public Collection getImages(IGraphicsTarget target, + PaintProperties paintProps) throws VizException; + } + /** * Draw the images passed in * diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/capabilities/ImagingCapability.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/capabilities/ImagingCapability.java index f4a827588f..881f20b581 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/capabilities/ImagingCapability.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/capabilities/ImagingCapability.java @@ -23,6 +23,8 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; +import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension.ImageProvider; + /** * Capability for imaging features * @@ -42,6 +44,8 @@ import javax.xml.bind.annotation.XmlAttribute; @XmlAccessorType(XmlAccessType.NONE) public class ImagingCapability extends AbstractCapability { + private ImageProvider provider; + @XmlAttribute private float contrast = 1.0f; @@ -144,9 +148,25 @@ public class ImagingCapability extends AbstractCapability { } } + /** + * @return the provider + */ + public ImageProvider getProvider() { + return provider; + } + + /** + * @param provider + * the provider to set + */ + public void setProvider(ImageProvider provider) { + this.provider = provider; + } + @Override public AbstractCapability clone() { ImagingCapability ic = new ImagingCapability(); + ic.provider = provider; ic.contrast = contrast; ic.brightness = brightness; ic.interpolationState = interpolationState; diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/tile/TileSet.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/tile/TileSet.java new file mode 100644 index 0000000000..ea026799cb --- /dev/null +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/tile/TileSet.java @@ -0,0 +1,258 @@ +/** + * 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.tile; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.collections.keyvalue.MultiKey; +import org.geotools.coverage.grid.GeneralGridEnvelope; +import org.geotools.coverage.grid.GeneralGridGeometry; +import org.geotools.coverage.grid.GridGeometry2D; +import org.opengis.coverage.grid.GridEnvelope; +import org.opengis.geometry.Envelope; + +import com.raytheon.uf.viz.core.IExtent; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.GeometryFactory; + +/** + * A TileSet is an object that consists of multiple tile levels. Each tile level + * is represented by a {@link TileLevel} object. These objects are only accessed + * via static funtion + * {@link #getTileSet(GridGeometry2D, GeneralGridGeometry, int, int)} to ensure + * tile set sharing. When a TileSet is no longer needed, dispose must be called + * on it to make sure it is cleaned up + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Aug 8, 2012            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ + +public class TileSet { + + /** Each tile level is LEVEL_FACTOR much smaller than the previous level */ + private static final int LEVEL_FACTOR = 2; + + static final GeometryFactory gf = new GeometryFactory(); + + /** Static cache for TileSets */ + private static Map tileSetCache = new HashMap(); + + /** + * Creates a {@link TileSet} object with the specified tile size and levels + * + * @param tileSetGeometry + * @param targetGeometry + * @param levels + * @param tileSize + * @return + */ + public static TileSet getTileSet(GridGeometry2D tileSetGeometry, + GeneralGridGeometry targetGeometry, int levels, int tileSize) { + synchronized (TileSet.class) { + MultiKey key = new MultiKey(tileSetGeometry, targetGeometry, + levels, tileSize); + TileSet tileSet = tileSetCache.get(key); + if (tileSet == null) { + // No tileset for key, create one + tileSet = new TileSet(tileSetGeometry, targetGeometry, levels, + tileSize, key); + tileSetCache.put(key, tileSet); + } + ++tileSet.refCount; + return tileSet; + } + } + + /** GridGeometry tileSet is created for */ + private GeneralGridGeometry targetGeometry; + + /** {@link TileLevel} array, one per tile level */ + private TileLevel[] tileLevels; + + private int tileSize; + + private int refCount = 0; + + private MultiKey cacheKey; + + private TileSet(GridGeometry2D tileSetGeometry, + GeneralGridGeometry targetGeometry, int levels, int tileSize, + MultiKey cacheKey) { + this.targetGeometry = targetGeometry; + this.tileSize = tileSize; + this.cacheKey = cacheKey; + initialize(tileSetGeometry, levels); + } + + /** + * @param tileSetGeometry + * @param levels + */ + private void initialize(GridGeometry2D tileSetGeometry, int levels) { + Envelope envelope = tileSetGeometry.getEnvelope(); + GridEnvelope range = tileSetGeometry.getGridRange(); + int startX = range.getLow(0); + int startY = range.getLow(1); + int width = range.getSpan(0); + int height = range.getSpan(1); + + tileLevels = new TileLevel[levels]; + for (int i = 0; i < levels; ++i) { + if (i > 0) { + startX /= LEVEL_FACTOR; + startY /= LEVEL_FACTOR; + width /= LEVEL_FACTOR; + height /= LEVEL_FACTOR; + tileSetGeometry = new GridGeometry2D(new GeneralGridEnvelope( + new int[] { startX, startY }, + new int[] { width, height }, false), envelope); + } + tileLevels[i] = new TileLevel(tileSetGeometry, targetGeometry, i, + tileSize); + } + + // Fully populate lowest resolution tile level + tileLevels[tileLevels.length - 1].populateTiles(); + } + + /** + * Disposes of the TileSet, needs to be called when tile set is no longer + * needed + */ + public void dispose() { + synchronized (TileSet.class) { + --refCount; + if (refCount == 0) { + tileSetCache.remove(cacheKey); + } + } + } + + /** + * Returns the {@link TileLevel} object for the specified level. Lower level + * = higher resolution + * + * @param level + * @return + */ + public TileLevel getTileLevel(int level) { + return tileLevels[level]; + } + + /** + * Returns all intersecting tiles in the level for the given extent. Lower + * tile level = higher resolution with 0 being the highest + * + * @param level + * level to get tiles at + * @param extent + * area requesting tiles at in targetGeometry space + * @return + */ + public Collection getIntersectingTiles(int level, IExtent extent) { + // Start with level 0 and work way up to requested level + Geometry extentGeom = gf.createPolygon( + gf.createLinearRing(new Coordinate[] { + new Coordinate(extent.getMinX(), extent.getMinY()), + new Coordinate(extent.getMaxX(), extent.getMinY()), + new Coordinate(extent.getMaxX(), extent.getMaxY()), + new Coordinate(extent.getMinX(), extent.getMaxY()), + new Coordinate(extent.getMinX(), extent.getMinY()) }), + null); + TileLevel tileLevel = getTileLevel(tileLevels.length - 1); + return getIntersectingTiles(tileLevel, level, 0, 0, + tileLevel.getNumXTiles(), tileLevel.getNumYTiles(), extentGeom); + } + + /** + * Returns intersecting tiles for the desired level. Recursive function that + * checks intersection by looking at previous tile level tiles + * + * @param tileLevel + * @param level + * @param startX + * @param startY + * @param endX + * @param endY + * @param extent + * @return + */ + private Collection getIntersectingTiles(TileLevel tileLevel, + int level, int startX, int startY, int endX, int endY, + Geometry extent) { + TileLevel nextTileLevel = null; + if (tileLevel.getLevel() != level) { + // If we are not at desired level, get next tile level + nextTileLevel = getTileLevel(tileLevel.getLevel() - 1); + } + List intersecting = new ArrayList(); + for (int y = startY; y < endY; ++y) { + for (int x = startX; x < endX; ++x) { + Tile tile = tileLevel.getTile(x, y); + if (tile.intersects(extent)) { + if (nextTileLevel != null) { + // nextTileLevel is not null meaning we are not at + // desired level. Calculate index into next tile level + // and call recursively + int nextStartX = x * LEVEL_FACTOR; + int nextStartY = y * LEVEL_FACTOR; + int nextEndX = Math.min(nextStartX + LEVEL_FACTOR, + nextTileLevel.getNumXTiles()); + int nextEndY = Math.min(nextStartY + LEVEL_FACTOR, + nextTileLevel.getNumYTiles()); + intersecting.addAll(getIntersectingTiles(nextTileLevel, + level, nextStartX, nextStartY, nextEndX, + nextEndY, extent)); + } else if (tile.tileBorder != null) { + // This is desired tile level, add to list if we + // actually have a valid border that intersects + intersecting.add(tile); + } + } + } + } + + return intersecting; + } + + /** + * Gets the GridGeometry the tileSet is created for + * + * @return + */ + public GeneralGridGeometry getTargetGeometry() { + return targetGeometry; + } +} diff --git a/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/FileTreeView.java b/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/FileTreeView.java index d9b598edac..0e2fb1bf97 100644 --- a/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/FileTreeView.java +++ b/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/FileTreeView.java @@ -655,11 +655,7 @@ public class FileTreeView extends ViewPart implements IPartListener2, String text = curItems[i].getText(); int comp = text.compareToIgnoreCase(name); if (comp >= 0) { - if (comp == 0 && text.compareTo(name) == 0) { - idx = -1; - } else { - idx = i; - } + idx = i; break; } } diff --git a/cave/com.raytheon.uf.viz.truecolor.gl/.classpath b/cave/com.raytheon.uf.viz.truecolor.gl/.classpath new file mode 100644 index 0000000000..ad32c83a78 --- /dev/null +++ b/cave/com.raytheon.uf.viz.truecolor.gl/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/cave/com.raytheon.uf.viz.truecolor.gl/.project b/cave/com.raytheon.uf.viz.truecolor.gl/.project new file mode 100644 index 0000000000..0c0bdb6392 --- /dev/null +++ b/cave/com.raytheon.uf.viz.truecolor.gl/.project @@ -0,0 +1,28 @@ + + + com.raytheon.uf.viz.truecolor.gl + + + + + + 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.truecolor.gl/.settings/org.eclipse.jdt.core.prefs b/cave/com.raytheon.uf.viz.truecolor.gl/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..18d9bac87b --- /dev/null +++ b/cave/com.raytheon.uf.viz.truecolor.gl/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Mon Aug 06 13:10:16 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.truecolor.gl/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.truecolor.gl/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..9e409a92a1 --- /dev/null +++ b/cave/com.raytheon.uf.viz.truecolor.gl/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: True Color GL +Bundle-SymbolicName: com.raytheon.uf.viz.truecolor.gl;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: com.raytheon.uf.viz.truecolor.gl.Activator +Bundle-Vendor: RAYTHEON +Require-Bundle: org.eclipse.core.runtime, + com.raytheon.uf.viz.core;bundle-version="1.12.1174", + com.raytheon.uf.viz.truecolor;bundle-version="1.0.0", + com.raytheon.viz.core.gl;bundle-version="1.12.1174", + javax.media.opengl;bundle-version="1.1.0", + com.raytheon.uf.common.util;bundle-version="1.12.1174" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy diff --git a/cave/com.raytheon.uf.viz.truecolor.gl/build.properties b/cave/com.raytheon.uf.viz.truecolor.gl/build.properties new file mode 100644 index 0000000000..15f66d39dc --- /dev/null +++ b/cave/com.raytheon.uf.viz.truecolor.gl/build.properties @@ -0,0 +1,6 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + localization/,\ + plugin.xml diff --git a/cave/com.raytheon.uf.viz.truecolor.gl/plugin.xml b/cave/com.raytheon.uf.viz.truecolor.gl/plugin.xml new file mode 100644 index 0000000000..bb842039ee --- /dev/null +++ b/cave/com.raytheon.uf.viz.truecolor.gl/plugin.xml @@ -0,0 +1,29 @@ + + + + + + + + + \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.truecolor.gl/src/com/raytheon/uf/viz/truecolor/gl/Activator.java b/cave/com.raytheon.uf.viz.truecolor.gl/src/com/raytheon/uf/viz/truecolor/gl/Activator.java new file mode 100644 index 0000000000..0d51332790 --- /dev/null +++ b/cave/com.raytheon.uf.viz.truecolor.gl/src/com/raytheon/uf/viz/truecolor/gl/Activator.java @@ -0,0 +1,30 @@ +package com.raytheon.uf.viz.truecolor.gl; + +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.truecolor/.classpath b/cave/com.raytheon.uf.viz.truecolor/.classpath new file mode 100644 index 0000000000..ad32c83a78 --- /dev/null +++ b/cave/com.raytheon.uf.viz.truecolor/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/cave/com.raytheon.uf.viz.truecolor/.project b/cave/com.raytheon.uf.viz.truecolor/.project new file mode 100644 index 0000000000..4fdb451882 --- /dev/null +++ b/cave/com.raytheon.uf.viz.truecolor/.project @@ -0,0 +1,28 @@ + + + com.raytheon.uf.viz.truecolor + + + + + + 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.truecolor/.settings/org.eclipse.jdt.core.prefs b/cave/com.raytheon.uf.viz.truecolor/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..a901901779 --- /dev/null +++ b/cave/com.raytheon.uf.viz.truecolor/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Mon Aug 06 11:45:00 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.truecolor/build.properties b/cave/com.raytheon.uf.viz.truecolor/build.properties new file mode 100644 index 0000000000..e9863e281e --- /dev/null +++ b/cave/com.raytheon.uf.viz.truecolor/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml diff --git a/cave/com.raytheon.uf.viz.truecolor/src/com/raytheon/uf/viz/truecolor/Activator.java b/cave/com.raytheon.uf.viz.truecolor/src/com/raytheon/uf/viz/truecolor/Activator.java new file mode 100644 index 0000000000..a928b76c01 --- /dev/null +++ b/cave/com.raytheon.uf.viz.truecolor/src/com/raytheon/uf/viz/truecolor/Activator.java @@ -0,0 +1,62 @@ +package com.raytheon.uf.viz.truecolor; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "com.raytheon.uf.viz.truecolor"; //$NON-NLS-1$ + + public static final IUFStatusHandler statusHandler = UFStatus + .getHandler(Activator.class); + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext + * ) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext + * ) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/dataformat/AbstractGLColorMapDataFormat.java b/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/dataformat/AbstractGLColorMapDataFormat.java index 678072b0eb..400584ccdf 100644 --- a/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/dataformat/AbstractGLColorMapDataFormat.java +++ b/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/dataformat/AbstractGLColorMapDataFormat.java @@ -74,6 +74,11 @@ public abstract class AbstractGLColorMapDataFormat { */ public abstract Number getValue(int x, int y, GLColorMapData data); + /** + * Get the number of bytes each pixel takes up + * + * @return + */ public abstract int getBytesPerPixel(); /** diff --git a/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/dataformat/GLColorMapData.java b/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/dataformat/GLColorMapData.java index 6681a2c8c0..84b53ec68c 100644 --- a/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/dataformat/GLColorMapData.java +++ b/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/dataformat/GLColorMapData.java @@ -112,4 +112,8 @@ public class GLColorMapData { public int[] getDimensions() { return dimensions; } + + public int getBytesPerPixel() { + return dataFormat.getBytesPerPixel(); + } } diff --git a/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/images/GLCMTextureData.java b/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/images/GLCMTextureData.java index 869765dcd9..d6fc718a9f 100644 --- a/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/images/GLCMTextureData.java +++ b/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/images/GLCMTextureData.java @@ -250,7 +250,7 @@ public class GLCMTextureData implements IImageCacheable { public int getSize() { if (data != null) { int[] dimensions = data.getDimensions(); - int totalSize = 1; + int totalSize = data.getBytesPerPixel(); for (int i = 0; i < dimensions.length; ++i) { totalSize *= dimensions[i]; }