Omaha #3165 remove dead code from uengine

Change-Id: Id47a5c3ef95d606270f235b1c17c1abfa0919b08

Former-commit-id: b1216dd31b [formerly ba4fed408842df8bf1cbfd46c467cbd58aed49bd]
Former-commit-id: 4718ca6614
This commit is contained in:
Nate Jensen 2014-06-25 16:59:07 -05:00
parent 2b3f7f02e5
commit 6bdf7ce79a
7 changed files with 3 additions and 925 deletions

View file

@ -1,7 +0,0 @@
#Thu Mar 26 10:28:36 CDT 2009
eclipse.preferences.version=1
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

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Uengine Plug-in
Bundle-SymbolicName: com.raytheon.edex.uengine
Bundle-Version: 1.14.0.qualifier
Bundle-Version: 1.14.1.qualifier
Bundle-Vendor: RAYTHEON
Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.edex.uengine,
@ -12,13 +12,11 @@ Export-Package: com.raytheon.edex.uengine,
com.raytheon.edex.uengine.tasks,
com.raytheon.edex.uengine.tasks.query,
com.raytheon.edex.uengine.util
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.raytheon.edex.colormap,
com.raytheon.edex.exception,
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: com.raytheon.edex.exception,
com.raytheon.edex.msg,
com.raytheon.edex.util,
com.raytheon.edex.utility,
com.raytheon.uf.common.colormap,
org.apache.commons.logging
Require-Bundle: com.raytheon.uf.edex.core;bundle-version="1.12.1174",
com.raytheon.uf.edex.database;bundle-version="1.0.0",
@ -29,7 +27,6 @@ Require-Bundle: com.raytheon.uf.edex.core;bundle-version="1.12.1174",
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
com.raytheon.uf.common.localization;bundle-version="1.12.1174",
com.raytheon.uf.common.status;bundle-version="1.12.1174",
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174",
com.raytheon.uf.common.python;bundle-version="1.12.1174",
com.raytheon.uf.common.util;bundle-version="1.12.1174",
org.apache.commons.configuration;bundle-version="1.6.0",

View file

@ -1,345 +0,0 @@
/**
* 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.edex.uengine.color;
import java.util.HashMap;
import java.util.Map;
/**
* Class used by <code>ColorMapImage</code> task to get color map information.
*
* @author pheaberl
*/
public class ColorMap {
private String colorMapName = null;
private int numColors = -1;
private int numBits = -1;
private float maxVal = 0f;
private float minVal = 0f;
private byte[] red = null;
private byte[] blue = null;
private byte[] green = null;
// "enumeration" HashMap
private static Map<String, ColorMap> colorMapEnum = new HashMap<String, ColorMap>();
private ColorMap(String colorMapName, int numColors, int numBits) {
super();
this.colorMapName = colorMapName;
this.numColors = numColors;
this.numBits = numBits;
}
public byte[] getRed() {
return red;
}
public byte[] getGreen() {
return green;
}
public byte[] getBlue() {
return blue;
}
public int getNumBits() {
return numBits;
}
public int getNumColors() {
return numColors;
}
public float getMaxVal() {
return maxVal;
}
public float getMinVal() {
return minVal;
}
//----------------------- ColorMaps
public static final ColorMap BLACK_WHITE = new ColorMap("BW", 256, 8);
static {
BLACK_WHITE.red = new byte[BLACK_WHITE.numColors];
BLACK_WHITE.green = new byte[BLACK_WHITE.numColors];
BLACK_WHITE.blue = new byte[BLACK_WHITE.numColors];
// Grayscale color map to use with satellite imagery
for (int i = 0; i < BLACK_WHITE.numColors; i++)
{
BLACK_WHITE.red[i] = (byte)i;
BLACK_WHITE.green[i] = (byte)i;
BLACK_WHITE.blue[i] = (byte)i;
}
colorMapEnum.put(BLACK_WHITE.colorMapName, BLACK_WHITE);
}
public static final ColorMap STOP_LIGHT = new ColorMap("StopLight",3,8);
static {
/*
* creates a "stop light" color map.
* 0 => green
* 1 => yellow
* 2 => red
*/
byte[] red = { 0 , (byte)255, (byte)255};
byte[] green = {(byte)255, (byte)255, 0 };
byte[] blue = { 0 , 0 , 0 };
STOP_LIGHT.red = red;
STOP_LIGHT.green = green;
STOP_LIGHT.blue = blue;
STOP_LIGHT.minVal = 0;
STOP_LIGHT.maxVal = 2;
colorMapEnum.put(STOP_LIGHT.colorMapName,STOP_LIGHT);
}
public static final ColorMap SIXTY_FOUR_RGB = new ColorMap("64RGB",256,8);
static {
SIXTY_FOUR_RGB.red = new byte[SIXTY_FOUR_RGB.numColors];
SIXTY_FOUR_RGB.green = new byte[SIXTY_FOUR_RGB.numColors];
SIXTY_FOUR_RGB.blue = new byte[SIXTY_FOUR_RGB.numColors];
// funky map of 64 colors
int[] range = {0,1,2,3};
for(int i : range) {
for (int j : range) {
for(int k : range) {
int l = 16 * i + 4 * j + k;
int red = 64 * i;
int green = 64 * j;
int blue = 64 * k;
for (int m : range) {
int n = 4 * l + m;
SIXTY_FOUR_RGB.red[n] = (byte)red;
SIXTY_FOUR_RGB.green[n] = (byte)green;
SIXTY_FOUR_RGB.blue[n] = (byte)blue;
}
}
}
}
SIXTY_FOUR_RGB.maxVal = 255;
SIXTY_FOUR_RGB.minVal = 0;
colorMapEnum.put(SIXTY_FOUR_RGB.colorMapName, SIXTY_FOUR_RGB);
}
public static final ColorMap SIXTY_FOUR_BW = new ColorMap("64BW",256,8);
static {
SIXTY_FOUR_BW.red = new byte[SIXTY_FOUR_BW.numColors];
SIXTY_FOUR_BW.green = new byte[SIXTY_FOUR_BW.numColors];
SIXTY_FOUR_BW.blue = new byte[SIXTY_FOUR_BW.numColors];
// funky map of 64 gray scales
int[] range = {0,1,2,3};
for(int i : range) {
for (int j : range) {
for(int k : range) {
int l = 64 * i + 16 * j + 4 * k;
for (int m : range) {
SIXTY_FOUR_BW.red[l + m] = (byte)l;
SIXTY_FOUR_BW.green[l + m] = (byte)l;
SIXTY_FOUR_BW.blue[l + m] = (byte)l;
}
}
}
}
SIXTY_FOUR_BW.maxVal = 255;
SIXTY_FOUR_BW.minVal = 0;
colorMapEnum.put(SIXTY_FOUR_BW.colorMapName, SIXTY_FOUR_BW);
}
public static final ColorMap FALSE_COLOR = new ColorMap("false",33,8);
static {
byte red[] = {0,(byte)255,0,(byte)228,(byte)205,(byte)170,(byte)135,(byte)130,(byte)130,(byte)130,(byte)130,(byte)139,(byte)152,(byte)161,(byte)176,(byte)189,(byte)202,(byte)214,(byte)220,(byte)227,(byte)240,(byte)176,(byte)128,80,32,0,0,0,0,0,0,0,0};
FALSE_COLOR.red = red;
byte green[] = {0,(byte)255,(byte)178,(byte)228,(byte)205,(byte)170,(byte)135,106,84,72,60,75,96,111,(byte)135,(byte)156,(byte)177,(byte)198,(byte)207,(byte)219,(byte)240,(byte)224,(byte)212,(byte)200,(byte)188,(byte)180,(byte)165,(byte)140,125,110,95,80,0};
FALSE_COLOR.green = green;
byte blue[] = {0,(byte)255,(byte)238,(byte)228,(byte)205,(byte)170,(byte)135,95,65,48,30,28,24,22,18,14,10,7,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
FALSE_COLOR.blue = blue;
FALSE_COLOR.maxVal = 32;
FALSE_COLOR.minVal = 0;
colorMapEnum.put(FALSE_COLOR.colorMapName, FALSE_COLOR);
}
public static final ColorMap GRIB_COLOR = new ColorMap("GribRGB", 64, 8);
static {
byte[] red = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 7, 23, 39, 55, 71, 87, 103, 119, (byte)135, (byte)151,
(byte)167, (byte)183, (byte)199, (byte)215, (byte)231,(byte) 247, (byte)255, (byte)255, (byte)255, (byte)255, (byte)255, (byte)255,
(byte)255, (byte)255, (byte)255, (byte)255,(byte) 255, (byte)255, (byte)255, (byte)255, (byte)255, (byte)255, (byte)246, (byte)228,
(byte)211, (byte)193, (byte)175, (byte)158, (byte)140 };
GRIB_COLOR.red = red;
byte[] green = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 27, 43, 59, 75, 91, 107,
123, (byte)139, (byte)155, (byte)171, (byte)187, (byte)203, (byte)219, (byte)235, (byte)251, (byte)255, (byte)255, (byte)255,
(byte)255, (byte)255, (byte)255, (byte)255, (byte)255, (byte)255, (byte)255, (byte)255, (byte)255, (byte)255, (byte)255, (byte)255,
(byte)255, (byte)247, (byte)231, (byte)215, (byte)199, (byte)183, (byte)167, (byte)151, (byte)135, 119, 103, 87, 71,
55, 39, 23, 7, 0, 0, 0, 0, 0, 0, 0 };
GRIB_COLOR.green = green;
byte[] blue = { 0, (byte)143, (byte)159, (byte)175, (byte)191, (byte)207, (byte)223, (byte)239, (byte)255, (byte)255, (byte)255,
(byte)255, (byte)255,(byte) 255, (byte)255, (byte)255, (byte)255, (byte)255, (byte)255, (byte)255,(byte) 255, (byte)255, (byte)255,
(byte)255, (byte)255, (byte)247, (byte)231, (byte)215, (byte)199, (byte)183, (byte)167, (byte)151, (byte)135, 119, 103, 87,
71, 55, 39, 23, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 };
GRIB_COLOR.blue = blue;
GRIB_COLOR.maxVal = 330f;//134.33f;
GRIB_COLOR.minVal = 165f;//-162.67f;
colorMapEnum.put(GRIB_COLOR.colorMapName, GRIB_COLOR);
}
/**
* Creates a blue to red ramp for temperature gradiation. This color map is based
* on an article found on the web @ http://local.wasp.uwa.edu.au/~pbourke/colour/colourramp/
*/
public static final ColorMap GRIB_TEMP = new ColorMap("GribTempRGB", 256, 8);
static {
byte[] red = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62,66,70,74,78,82,86,90,94,98,102,106,110,114,118,122,126,(byte)130,(byte)134,(byte)138,(byte)142,(byte)146,(byte)150,(byte)154,(byte)158,(byte)162,(byte)166,(byte)170,(byte)174,(byte)178,(byte)182,(byte)186,(byte)190,(byte)194,(byte)198,(byte)202,(byte)206,(byte)210,(byte)214,(byte)218,(byte)222,(byte)226,(byte)230,(byte)234,(byte)238,(byte)242,(byte)246,(byte)250,(byte)254,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255};
GRIB_TEMP.red = red;
byte[] green = {0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,(byte)128,(byte)132,(byte)136,(byte)140,(byte)144,(byte)148,(byte)152,(byte)156,(byte)160,(byte)164,(byte)168,(byte)172,(byte)176,(byte)180,(byte)184,(byte)188,(byte)192,(byte)196,(byte)200,(byte)204,(byte)208,(byte)212,(byte)216,(byte)220,(byte)224,(byte)228,(byte)232,(byte)236,(byte)240,(byte)244,(byte)248,(byte)252,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)252,(byte)248,(byte)244,(byte)240,(byte)236,(byte)232,(byte)228,(byte)224,(byte)220,(byte)216,(byte)212,(byte)208,(byte)204,(byte)200,(byte)196,(byte)192,(byte)187,(byte)183,(byte)179,(byte)175,(byte)171,(byte)167,(byte)163,(byte)159,(byte)155,(byte)151,(byte)147,(byte)143,(byte)139,(byte)135,(byte)131,127,123,119,115,111,107,103,99,95,91,87,83,79,75,71,67,63,59,55,51,47,43,39,35,31,27,23,19,15,11,7,3,0};
GRIB_TEMP.green = green;
byte[] blue = {(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)255,(byte)254,(byte)250,(byte)246,(byte)242,(byte)238,(byte)234,(byte)230,(byte)226,(byte)222,(byte)218,(byte)214,(byte)210,(byte)206,(byte)202,(byte)198,(byte)194,(byte)189,(byte)185,(byte)181,(byte)177,(byte)173,(byte)169,(byte)165,(byte)161,(byte)157,(byte)153,(byte)149,(byte)145,(byte)141,(byte)137,(byte)133,(byte)129,125,121,117,113,109,105,101,97,93,89,85,81,77,73,69,65,61,57,53,49,45,41,37,33,29,25,21,17,13,9,5,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
GRIB_TEMP.blue = blue;
GRIB_TEMP.minVal = 220f; // approximately -60F
GRIB_TEMP.maxVal = 335f; // approximately 145F
colorMapEnum.put(GRIB_TEMP.colorMapName, GRIB_TEMP);
}
public static final ColorMap IR_ENHANCED = new ColorMap("IREnhanced", 256, 8);
static {
byte[] red = new byte[256];
byte[] green = new byte[256];
byte [] blue = new byte[256];
for(int i = 0; i <= 60; i++){
red[i] = green[i] = blue[i]= 0;
}
for(int i = 0; i <= 29; i++){
int position = 61 + i;
float currentColorDiff = (float)(67.0 * (i / 29.0));
int color = 3 + Math.round(currentColorDiff);
red[position] = green[position] = blue[position] = (byte)color;
}
for(int i = 91; i <= 100; i++){
red[i] = green[i] = blue[i] = (byte)i;
}
for(int i = 0; i <= 44; i++){
int position = 101 + i;
float currentColorDiff = (float)(147.0 * (i/44.0));
int color = 103 + Math.round(currentColorDiff);
red[position] = green[position] = blue[position] = (byte)color;
}
for(int i = 0; i <= 8; i++){
int position = 146 + i;
float currentBlueColorDiff = (float)(5.0 * (i/8.0));
float currentGreenColorDiff = (float)(222.0 * (i/8.0));
float currentRedColorDiff = (float)(52.0 * (i/8.0));
int blueColor = 250 + Math.round(currentBlueColorDiff);
int greenColor = 222 - Math.round(currentGreenColorDiff);
int redColor = 243 - Math.round(currentRedColorDiff);
green[position] = (byte)greenColor;
blue[position] = (byte)blueColor;
red[position] = (byte)redColor;
}
for(int i = 0; i <= 15; i++){
int position = 155 + i;
float currentColorDiff = (float)(191.0 * (i/15.0));
int color = 191 - Math.round(currentColorDiff);
blue[position] = (byte)255;
green[position] = 0;
red[position] = (byte)color;
}
for(int i = 0; i <= 19; i++){
int position = 171 + i;
float currentBlueColorDiff = (float)(242.0 * (i/19.0));
float currentGreenColorDiff = (float)(243.0 * (i/19.0));
int blueColor = 242 - Math.round(currentBlueColorDiff);
int greenColor = 12 + Math.round(currentGreenColorDiff);
green[position] = (byte)greenColor;
blue[position] = (byte)blueColor;
red[position] = 0;
}
for(int i = 0; i <= 9; i++){
int position = 191 + i;
float currentColorDiff = (float)(230.0 * (i/9.0));
int color = 25 + Math.round(currentColorDiff);
blue[position] = 0;
green[position] = (byte)255;
red[position] = (byte)color;
}
for(int i = 0; i <= 9; i++){
int position = 201 + i;
float currentColorDiff = (float)(229.0 * (i/9.0));
int color = 229 - Math.round(currentColorDiff);
blue[position] = 0;
green[position] = (byte)color;
red[position] = (byte)255;
}
for(int i = 0; i <= 9; i++){
int position = 211 + i;
float currentColorDiff = (float)(229.0 * (i/9.0));
int color = 229 - Math.round(currentColorDiff);
green[position] = blue[position] = 0;
red[position] = (byte)color;
}
for(int i = 0; i <= 24; i++){
int position = 221 + i;
float currentColorDiff = (float)(235.0 * (i/24.0));
int color = 20 + Math.round(currentColorDiff);
red[position] = green[position] = blue[position] = (byte)color;
}
for(int i = 246; i <= 255; i++){
red[i] = green[i] = blue[i] = (byte)255;
}
IR_ENHANCED.red = red;
IR_ENHANCED.blue = blue;
IR_ENHANCED.green = green;
IR_ENHANCED.maxVal = 255;
IR_ENHANCED.minVal = 0;
colorMapEnum.put(IR_ENHANCED.colorMapName, IR_ENHANCED);
}
//----------------------- map ColorMaps to String
/**
* Gets the color map by name.
*
* @param colorMapName the color map name
* @return the color map
*/
public static final ColorMap getColorMap(String colorMapName) {
return colorMapEnum.get(colorMapName);
}
/**
* Checks to see if their is a color map matching a specified name.
* @param colorMapName the color map name
* @return true if the specified color map exists
*/
public static final boolean isColorMap(String colorMapName) {
return colorMapEnum.containsKey(colorMapName);
}
}

View file

@ -1,27 +0,0 @@
/**
* 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.
**/
/**
* Contains classes defining AWIPS Color Maps. These Color Maps may
* may be specified using the &mu;Engine {@code <colorImage>} XML tag.
*
* @see "com.raytheon.edex.uengine"
* @see com.raytheon.edex.uengine.tasks.ColorMapImage
*/
package com.raytheon.edex.uengine.color;

View file

@ -1,230 +0,0 @@
/**
* 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.edex.uengine.tasks.output;
import java.io.File;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.geotools.data.FeatureWriter;
import org.geotools.data.Transaction;
import org.geotools.data.shapefile.ShapefileDataStore;
import org.geotools.data.store.ContentFeatureSource;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import com.raytheon.edex.uengine.tasks.ScriptTask;
import com.raytheon.uf.edex.core.props.PropertiesFactory;
import com.vividsolutions.jts.geom.GeometryCollection;
import com.vividsolutions.jts.geom.Point;
/**
* Derived from original uEngine task Shapefile.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 11, 2007 njensen Initial Creation
* Mar 11, 2014 #2718 randerso Changes for GeoTools 10.5
* </PRE>
*
*/
public class Shapefile extends ScriptTask {
Log logger = LogFactory.getLog(getClass());
public Shapefile(GeometryCollection aGeometryCollection,
Map<String, List<?>> anAttributeMap, String anIcaoFilePrefix) {
collection = aGeometryCollection;
shapefileAttributes = anAttributeMap;
icaoFilePrefix = anIcaoFilePrefix;
}
private GeometryCollection collection;
private Map<String, List<?>> shapefileAttributes;
private String icaoFilePrefix;
private String filePrefix = "";
private String destDir = null;
private boolean ignoreDefaultDataDir;
/*
* (non-Javadoc)
*
* @see com.raytheon.edex.uengine.js.tasks.ScriptTask#execute()
*/
@Override
public Object execute() {
String uEngineDir = PropertiesFactory.getInstance().getEnvProperties()
.getEnvValue("UENGINEOUTDIR");
String shapefileDir = null;
String defaultDataDir = PropertiesFactory.getInstance()
.getEnvProperties().getEnvValue("DEFAULTDATADIR");
// Set up what our data schema will look like
SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.setName("Shape");
builder.add("the_geom", Point.class);
// get a unique name
String fileName = java.util.UUID.randomUUID().toString();
// File theShape = new File(uEngineDir + "/" + filePrefix + fileName +
// ".shp");
// GeometryFactory geomFactory = new GeometryFactory();
File theShape;
// if a destdir is specified, check if the defaultdata dir should be
// used
// if no destdir is specified, write to the uEngineDir
if (destDir != null) {
if (!ignoreDefaultDataDir) {
shapefileDir = defaultDataDir + destDir;
} else {
shapefileDir = destDir;
}
} else {
shapefileDir = uEngineDir;
}
if (icaoFilePrefix != null) {
theShape = new File(shapefileDir + "/" + icaoFilePrefix + ".shp");
} else {
theShape = new File(shapefileDir + "/" + filePrefix + fileName
+ ".shp");
}
// iterate through each String/List pair in the set
// create an attribute for each key
for (Map.Entry<String, List<?>> entry : shapefileAttributes.entrySet()) {
// get the class of the first element of a list
builder.add(entry.getKey(), entry.getValue().get(0).getClass());
}
try {
// get the canonical path
theShape = theShape.getCanonicalFile();
// get the attribute types as an array and create the feature type
SimpleFeatureType featureType = builder.buildFeatureType();
// Load up the datastore
ShapefileDataStore shpDS = new ShapefileDataStore(theShape.toURI()
.toURL());
shpDS.setMemoryMapped(true);
// Tell the datastore to create the dbf schema if it does not
// exist
shpDS.createSchema(featureType);
// Get the transaction object
ContentFeatureSource fs = shpDS.getFeatureSource();
Transaction trx = fs.getTransaction();
// Open a feature writer with the transaction
FeatureWriter<SimpleFeatureType, SimpleFeature> writer = shpDS
.getFeatureWriter(trx);
for (int counter = 0; counter < collection.getNumGeometries(); counter++) {
// Load the feature to write, and set all of the properties by
// name
SimpleFeature feature = writer.next();
// iterate through all
for (Map.Entry<String, List<?>> entry : shapefileAttributes
.entrySet()) {
feature.setAttribute(entry.getKey(),
entry.getValue().get(counter));
}
feature.setDefaultGeometry(collection.getGeometryN(counter));
writer.write();
}
writer.close();
} catch (Exception e) {
logger.error("Error creating shapefile", e);
}
return theShape.toURI();
}
public GeometryCollection getCollection() {
return collection;
}
public void setCollection(GeometryCollection aCollection) {
collection = aCollection;
}
public String getDestDir() {
return destDir;
}
public void setDestDir(String aDestDir) {
destDir = aDestDir;
}
public String getFilePrefix() {
return filePrefix;
}
public void setFilePrefix(String aFilePrefix) {
filePrefix = aFilePrefix;
}
public String getIcaoFilePrefix() {
return icaoFilePrefix;
}
public void setIcaoFilePrefix(String aIcaoFilePrefix) {
icaoFilePrefix = aIcaoFilePrefix;
}
public boolean isIgnoreDefaultDataDir() {
return ignoreDefaultDataDir;
}
public void setIgnoreDefaultDataDir(boolean aIgnoreDefaultDataDir) {
ignoreDefaultDataDir = aIgnoreDefaultDataDir;
}
public Map<?, ?> getShapefileAttributes() {
return shapefileAttributes;
}
public void setShapefileAttributes(Map<String, List<?>> aShapefileAttributes) {
shapefileAttributes = aShapefileAttributes;
}
}

View file

@ -1,63 +0,0 @@
/**
* 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.edex.uengine.tasks.query;
import java.util.Date;
import com.raytheon.edex.colormap.ColorMapManager;
import com.raytheon.edex.uengine.tasks.ScriptTask;
import com.raytheon.uf.common.message.CatalogItem;
import com.raytheon.uf.common.message.response.ResponseMessageCatalog;
/**
* Queries for available colormaps.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 26, 2007 njensen Initial creation
*
* </pre>
*
* @author njensen
*/
public class ColormapQuery extends ScriptTask {
/*
* (non-Javadoc)
*
* @see com.raytheon.edex.uengine.tasks.ScriptTask#execute()
*/
@Override
public Object execute() {
ResponseMessageCatalog response = new ResponseMessageCatalog();
String[] colormaps = ColorMapManager.getInstance().listColorMaps();
response.setValues(colormaps);
response.setItems(new CatalogItem[] {});
response.setFileType("");
response.setDataURI("");
response.setValidTime(new Date());
return response;
}
}

View file

@ -1,247 +0,0 @@
/**
* 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.edex.uengine.tasks.query;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import org.geotools.data.Query;
import org.geotools.data.shapefile.ShapefileDataStore;
import org.geotools.factory.CommonFactoryFinder;
import org.geotools.factory.GeoTools;
import org.geotools.feature.FeatureIterator;
import org.geotools.filter.IllegalFilterException;
import org.geotools.geometry.jts.ReferencedEnvelope;
import org.opengis.feature.IllegalAttributeException;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.type.AttributeDescriptor;
import org.opengis.filter.Filter;
import org.opengis.filter.FilterFactory2;
import com.raytheon.edex.uengine.exception.MicroEngineException;
import com.raytheon.edex.uengine.tasks.ScriptTask;
import com.raytheon.uf.common.geospatial.MapUtil;
/**
* Derived from original uEngine ShapefileQuery task. Queries within a bounding
* box on a shape file.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 11, 2007 njensen Initial Creation
* Mar 11, 2014 #2718 randerso Changes for GeoTools 10.5
* </PRE>
*
*/
public class ShapefileQuery extends ScriptTask {
private String shapeFile;
private List<String> attributeNames = new ArrayList<String>();
private double minLat;
private double maxLat;
private double minLon;
private double maxLon;
public ShapefileQuery(String aShapeFilePath, double aMinLat,
double aMaxLat, double aMinLon, double aMaxLon) {
shapeFile = aShapeFilePath;
minLat = aMinLat;
maxLat = aMaxLat;
minLon = aMinLon;
maxLon = aMaxLon;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.edex.uengine.js.tasks.ScriptTask#execute()
*/
@Override
public Object execute() {
File theShape = new File(shapeFile);
logger.warn("Querying shapeFile: " + theShape.getAbsolutePath());
Map<String, List<Object>> resultMap = new HashMap<String, List<Object>>();
try {
ShapefileDataStore shpDS;
shpDS = new ShapefileDataStore(theShape.toURI().toURL());
// Load up the schema attributes into memory
List<AttributeDescriptor> at = new ArrayList<AttributeDescriptor>();
for (String an : attributeNames) {
AttributeDescriptor a = shpDS.getSchema().getDescriptor(an);
if (a == null) {
String msg = "shapeFile query failure. shapeFile does not contain desired attribute. ";
logger.error(msg);
throw new MicroEngineException(msg);
} else {
resultMap.put(an, new ArrayList<Object>());
at.add(a);
}
}
// The geometry attribute
String theShapeField = shpDS.getSchema().getGeometryDescriptor()
.getLocalName();
// Get the types
String[] types = shpDS.getTypeNames();
Query query = new Query();
// Query geom
query.setTypeName(types[0]);
// Query all fields
query.setPropertyNames(attributeNames);
// Generate a geometry filter using an envelope
// org.geotools.filter.FilterFactory ff = new FilterFactoryImpl();
// Envelope e = new Envelope(minLon, maxLon, minLat, maxLat);
// Expression bbox = ff.createBBoxExpression(e);
// Expression geometry =
// ff.createAttributeExpression(theShapeField);
//
// GeometryFilter bboxFilter = ff
// .createGeometryFilter(AbstractFilter.GEOMETRY_BBOX);
// bboxFilter.addLeftGeometry(geometry);
// bboxFilter.addRightGeometry(bbox);
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(GeoTools
.getDefaultHints());
ReferencedEnvelope bbox = new ReferencedEnvelope(minLon, maxLon,
minLat, maxLat, MapUtil.LATLON_PROJECTION);
Filter bboxFilter = ff.bbox(ff.property(theShapeField), bbox);
query.setFilter(bboxFilter);
FeatureIterator<SimpleFeature> fr = shpDS.getFeatureSource()
.getFeatures(query).features();
SimpleFeature feature = null;
if (!fr.hasNext()) {
String msg = "shapeQuery returned no data. ";
logger.warn(msg);
throw new MicroEngineException(msg);
} else {
while (fr.hasNext()) {
feature = fr.next();
String msg = "FOUND";
for (String an : attributeNames) {
Object attr = feature.getAttribute(an);
msg = msg + " " + an + ": " + attr.toString();
resultMap.get(an).add(attr);
}
logger.info(msg);
}
}
fr.close();
} catch (MalformedURLException e1) {
String msg = "shapeFile query failure. ShapeFile URL is malformed. ";
logger.error(msg);
throw new MicroEngineException(msg);
} catch (NoSuchElementException e) {
String msg = "shapeFile query failure. No such element. ";
logger.error(msg);
throw new MicroEngineException(msg);
} catch (IOException e) {
String msg = "shapeFile query failure. I/O exception. ";
logger.error(msg);
throw new MicroEngineException(msg);
} catch (IllegalFilterException e) {
String msg = "shapeFile query failure. Illegal filter. ";
logger.error(msg);
throw new MicroEngineException(msg);
} catch (IllegalAttributeException e) {
String msg = "shapeFile query failure. Illegal attribute. ";
logger.error(msg);
throw new MicroEngineException(msg);
}
return resultMap;
}
public void addAttributeName(String anAttributeName) {
attributeNames.add(anAttributeName);
}
public double getMaxLat() {
return maxLat;
}
public void setMaxLat(double aMaxLat) {
maxLat = aMaxLat;
}
public double getMaxLon() {
return maxLon;
}
public void setMaxLon(double aMaxLon) {
maxLon = aMaxLon;
}
public double getMinLat() {
return minLat;
}
public void setMinLat(double aMinLat) {
minLat = aMinLat;
}
public double getMinLon() {
return minLon;
}
public void setMinLon(double aMinLon) {
minLon = aMinLon;
}
public String getShapeFile() {
return shapeFile;
}
public void setShapeFile(String aShapeFile) {
shapeFile = aShapeFile;
}
public List<String> getAttributeNames() {
return attributeNames;
}
public void setAttributeNames(List<String> aAttributeNames) {
attributeNames = aAttributeNames;
}
}