12.10.1-3 baseline (better than previous which was missing changeset 7d75620)

Former-commit-id: af8ffe73c81cd980843f137800f9fbb453c9e2c0
This commit is contained in:
Steve Harris 2012-09-12 13:10:36 -05:00
parent 21f430062b
commit 077ced354e
22 changed files with 550 additions and 8 deletions

View file

@ -200,4 +200,16 @@
install-size="0"
version="0.0.0"/>
<plugin
id="com.raytheon.uf.viz.truecolor"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="com.raytheon.uf.viz.truecolor.gl"
download-size="0"
install-size="0"
version="0.0.0"/>
</feature>

View file

@ -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,

View file

@ -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;
}

View file

@ -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<DrawableImage> getImages(IGraphicsTarget target,
PaintProperties paintProps) throws VizException;
}
/**
* Draw the images passed in
*

View file

@ -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;

View file

@ -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
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 8, 2012 mschenke Initial creation
*
* </pre>
*
* @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<MultiKey, TileSet> tileSetCache = new HashMap<MultiKey, TileSet>();
/**
* 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<Tile> 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<Tile> 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<Tile> intersecting = new ArrayList<Tile>();
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;
}
}

View file

@ -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;
}
}

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.viz.truecolor.gl</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -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

View file

@ -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

View file

@ -0,0 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
localization/,\
plugin.xml

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<?eclipse version="3.2"?>
<plugin>
<extension
point="com.raytheon.uf.viz.core.graphicsExtension">
<graphicsExtension
class="com.raytheon.uf.viz.truecolor.gl.extension.GLTrueColorImagingExtension">
</graphicsExtension>
</extension>
</plugin>

View file

@ -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;
}
}

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.viz.truecolor</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -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

View file

@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml

View file

@ -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;
}
}

View file

@ -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();
/**

View file

@ -112,4 +112,8 @@ public class GLColorMapData {
public int[] getDimensions() {
return dimensions;
}
public int getBytesPerPixel() {
return dataFormat.getBytesPerPixel();
}
}

View file

@ -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];
}