Issue #628 committing more PGEN code received from Plummer on 4-19-2012.

Former-commit-id: dcfb950cfb [formerly 22a29b98b2] [formerly a90d64e1fc] [formerly 0df0aa8663 [formerly a90d64e1fc [formerly bd658184b246452b5d3e2154d79f2179bdc12594]]]
Former-commit-id: 0df0aa8663
Former-commit-id: a5aab1ab3583a86ff017397d59291cb56b659f40 [formerly e1f03d9369]
Former-commit-id: af92e8d329
This commit is contained in:
Brad Gonzales 2012-05-10 17:02:18 -05:00
parent 6df38c98de
commit 634def5162
183 changed files with 123761 additions and 0 deletions

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.viz.ncep.displays.feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1 @@
bin.includes = feature.xml

View file

@ -0,0 +1,343 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="com.raytheon.uf.viz.ncep.displays.feature"
label="NCEP Displays Feature"
version="1.0.0.qualifier"
provider-name="RAYTHEON">
<description url="http://www.example.com/description">
[Enter Feature Description here.]
</description>
<copyright url="http://www.example.com/copyright">
[Enter Copyright Description here.]
</copyright>
<license url="http://www.example.com/license">
[Enter License Description here.]
</license>
<requires>
<import feature="com.raytheon.uf.viz.common.core.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.core.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.d2d.core.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.ncep.core.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.dataplugins.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.ncep.dataplugins.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.viz.satellite.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.viz.radar.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.viz.grib.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.viz.text.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.cots.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.eclipse.feature" version="1.0.0.qualifier"/>
</requires>
<plugin
id="com.raytheon.uf.viz.aviation.advisory"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.gempak.parameterConversionLibrary"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.ui.nctextui"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.ui.pgen"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.cloudHeight"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.gempak"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.overlays"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.resourceManager"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.airmet"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.atcf"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.convsigmet"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.ffa"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.ffg"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.hrcn"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.idft"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.intlsig"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.lightning"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.mosaic"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.ncgrid"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.ncscat"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.nonconvsigmet"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.pgen"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.plotdata"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.satellite"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.stormtrack"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.svrl"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.warn"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.wcn"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.wcp"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.wstm"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.tools"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.ui.seek"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.ui.locator"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.apache.camel"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.wou"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.ui.locator"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.resources"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.wavesat"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.wtch"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.ncradar"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.common.staticdata"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.staticdataprovider"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.rsc.fits"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="gov.noaa.nws.ncep.viz.customprojection"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

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>gov.noaa.nws.ncep.common.staticdata</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 Apr 02 08:33:03 EDT 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,11 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: StaticData
Bundle-SymbolicName: gov.noaa.nws.ncep.common.staticdata
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: NCEP
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: gov.noaa.nws.ncep.edex.common;bundle-version="1.0.0",
org.geotools;bundle-version="2.6.4"
Export-Package: gov.noaa.nws.ncep.common.staticdata
Import-Package: com.raytheon.uf.common.localization

View file

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

View file

@ -0,0 +1,136 @@
/*
* gov.noaa.nws.ncep.common.staticData.AbstractBounds
*
* 12 March 2012
*
* This code has been developed by the NCEP/SIB for use in the AWIPS2 system.
*/
package gov.noaa.nws.ncep.common.staticdata;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
/**
* Class to hold the common attributes for NCEP bounds.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 03/12 #? B. Yin Initial Creation.
*
* </pre>
*
* @author B. Yin
*/
public abstract class AbstractBounds {
protected String bid;
protected String area;
protected String name;
protected String id;
protected String statesInArea;
protected int numBlocks;
protected Coordinate centriod;
protected Geometry geometry;
/**
* @return the bid
*/
public String getBid() {
return bid;
}
/**
* @param bid the bid to set
*/
public void setBid(String bid) {
this.bid = bid;
}
/**
* @return the area
*/
public String getArea() {
return area;
}
/**
* @param area the area to set
*/
public void setArea(String area) {
this.area = area;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the statesInArea
*/
public String getStatesInArea() {
return statesInArea;
}
/**
* @param statesInArea the statesInArea to set
*/
public void setStatesInArea(String statesInArea) {
this.statesInArea = statesInArea;
}
/**
* @return the numBlocks
*/
public int getNumBlocks() {
return numBlocks;
}
/**
* @param numBlocks the numBlocks to set
*/
public void setNumBlocks(int numBlocks) {
this.numBlocks = numBlocks;
}
/**
* @return the centriod
*/
public Coordinate getCentriod() {
return centriod;
}
/**
* @param centriod the centriod to set
*/
public void setCentriod(Coordinate centriod) {
this.centriod = centriod;
}
/**
* @return the geometry
*/
public Geometry getGeometry() {
return geometry;
}
/**
* @param geometry the geometry to set
*/
public void setGeometry(Geometry geometry) {
this.geometry = geometry;
}
}

View file

@ -0,0 +1,63 @@
/*
* gov.noaa.nws.ncep.common.staticData.CostalWater
*
* 12 March 2012
*
* This code has been developed by the NCEP/SIB for use in the AWIPS2 system.
*/
package gov.noaa.nws.ncep.common.staticdata;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
/**
* Class for NCEP costal waters.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 03/12 #? B. Yin Initial Creation.
*
* </pre>
*
* @author B. Yin
*/
public class CostalWater extends AbstractBounds {
/**
* Class to hold Costal Water information
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/12 ? B. Yin Initial Creation.
*
* </pre>
*
* @author B. Yin
*/
public CostalWater(){
}
public CostalWater(String bid, String name,Coordinate centriod,
int numBlocks, String id, Geometry geometry) {
super();
this.bid = bid;
this.name = name;
this.id = id;
this.numBlocks = numBlocks;
this.centriod = centriod;
this.geometry = geometry;
}
}

View file

@ -0,0 +1,46 @@
/*
* gov.noaa.nws.ncep.common.staticData.FAArea
*
* 12 March 2012
*
* This code has been developed by the NCEP/SIB for use in the AWIPS2 system.
*/
package gov.noaa.nws.ncep.common.staticdata;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
/**
* Class to hold FA area information
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 02/12 ? B. Yin Initial Creation.
*
* </pre>
*
* @author B. Yin
*/
public class FAArea extends AbstractBounds{
public FAArea(){
}
public FAArea(String bid, String area, String name, String statesInArea,
int numBlocks, Coordinate centriod, Geometry geometry) {
super();
this.bid = bid;
this.area = area;
this.name = name;
this.statesInArea = statesInArea;
this.numBlocks = numBlocks;
this.centriod = centriod;
this.geometry = geometry;
}
}

View file

@ -0,0 +1,57 @@
/*
* gov.noaa.nws.ncep.common.staticData.FARegion
*
* 12 March 2012
*
* This code has been developed by the NCEP/SIB for use in the AWIPS2 system.
*/
package gov.noaa.nws.ncep.common.staticdata;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
/**
* Class to hold FA region information
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 02/12 ? B. Yin Initial Creation.
*
* </pre>
*
* @author B. Yin
*/
public class FARegion extends AbstractBounds {
private String region;
public FARegion(){
}
public FARegion(String bid, String region,
int numBlocks, Coordinate centriod, Geometry geometry) {
super();
this.bid = bid;
this.setRegion(region);
this.numBlocks = numBlocks;
this.centriod = centriod;
this.geometry = geometry;
}
/**
* @param region the region to set
*/
public void setRegion(String region) {
this.region = region;
}
/**
* @return the region
*/
public String getRegion() {
return region;
}
}

View file

@ -0,0 +1,45 @@
/*
* gov.noaa.nws.ncep.common.staticData.GreatLake
*
* 12 March 2012
*
* This code has been developed by the NCEP/SIB for use in the AWIPS2 system.
*/
package gov.noaa.nws.ncep.common.staticdata;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
/**
* Class to hold great lake information
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 02/12 ? B. Yin Initial Creation.
*
* </pre>
*
* @author B. Yin
*/
public class GreatLake extends AbstractBounds {
public GreatLake(){
}
public GreatLake(String bid, String area,Coordinate centriod,
int numBlocks, String id, Geometry geometry) {
super();
this.bid = bid;
this.area = area;
this.id = id;
this.numBlocks = numBlocks;
this.centriod = centriod;
this.geometry = geometry;
}
}

View file

@ -0,0 +1,83 @@
/*
* gov.noaa.nws.ncep.common.staticData.IStaticDataProvider
*
* 12 March 2012
*
* This code has been developed by the NCEP/SIB for use in the AWIPS2 system.
*/
package gov.noaa.nws.ncep.common.staticdata;
import gov.noaa.nws.ncep.edex.common.stationTables.StationTable;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.MultiPolygon;
/**
* Interface that contains all methods to load NCEP static data.
* This interface is also used to look up the data provider service in client side, such as PGEN.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 02/12 ? B. Yin Initial Creation.
*
* </pre>
*
* @author B. Yin
*/
public interface IStaticDataProvider {
public StationTable getSfStnTbl();
public StationTable getAnchorTbl();
public StationTable getVorTbl();
public StationTable getVolcanoTbl();
public HashMap<String,String> getClstTbl();
public List<SPCCounty> getSPCCounties();
public SPCCounty findCounty( String fips);
public List<SPCCounty> getCountiesInGeometry(Geometry geo );
public List<USState> getAllstates();
public HashMap<String, String> getStateAbrvMap();
//localization
public String getPgenLocalizationRoot();
public String getFileAbsolutePath(String fileLoczlizationPath);
public File getFile(String fileLoczlizationPath);
public LocalizationFile getStaticLocalizationFile( String fileName );
public LocalizationFile getLocalizationFile( LocalizationContext context, String fileName );
public LocalizationContext getLocalizationContext( LocalizationType type, LocalizationLevel level);
public File getStaticFile( String fname );
public File getGeogFile();
public File getSfcStnFile();
public File getFirBoundsFile();
//This is for sigmet
public List<Object[]> queryNcepDB(String field, String table);
//for TCA
public HashMap<String, String> getZoneMap();
//for GFA
public List<FAArea> getFAAreas();
public List<FAArea> getFAAreaX();
public List<FARegion> getFARegions();
public List<GreatLake> getGreatLakes();
public List<CostalWater> getCostalWaters();
//for g2g
public ArrayList<MultiPolygon> getG2GBounds(String tableAlias, String columnName, String columnValue);
}

View file

@ -0,0 +1,159 @@
/*
* gov.noaa.nws.ncep.common.staticData.SPCCounty
*
* 12 March 2012
*
* This code has been developed by the NCEP/SIB for use in the AWIPS2 system.
*/
package gov.noaa.nws.ncep.common.staticdata;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
/**
* Class to hold SPC county/marine zone information
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 05/10 #159 B. Yin Initial Creation.
* 04/11 ? B. Yin Read from Raytheon's tables
* 01/12 ? B. Yin Read county maps with lowest resolution.
* Fix invalid geometry problems.
* 03/12 B. Yin Moved from elements package
*
* </pre>
*
* @author B. Yin
*/
public class SPCCounty {
//county name
private String name;
private String fips;
private String wfo;
private String ugcId;
private String state;
private String country;
//for marine zone
private String zoneName;
private boolean marineZone;
private Coordinate centriod;
private Geometry shape;
//constructor
public SPCCounty(){
}
//constructor
public SPCCounty( String fips,
String name,
String wfo,
String ugcId,
String state,
String country,
String zoneName,
Coordinate centroid,
Geometry shape,
boolean marineZone ){
this.setFips(fips);
this.setName(name);
this.setWfo(wfo);
this.setUgcId(ugcId);
this.setState(state);
this.setCountry(country);
this.setZoneName(zoneName);
this.setCentriod(centroid);
this.setShape(shape);
this.setMarineZone(marineZone);
}
public void setFips(String fips) {
this.fips = fips;
}
public String getFips() {
return fips;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setWfo(String wfo) {
this.wfo = wfo;
}
public String getWfo() {
return wfo;
}
public void setUgcId(String ugcId) {
this.ugcId = ugcId;
}
public String getUgcId() {
return ugcId;
}
public void setState(String state) {
this.state = state;
}
public String getState() {
return state;
}
public void setCountry(String country) {
this.country = country;
}
public String getCountry() {
return country;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}
public String getZoneName() {
return zoneName;
}
public void setMarineZone(boolean marineZone) {
this.marineZone = marineZone;
}
public boolean isMarineZone() {
return marineZone;
}
public void setCentriod(Coordinate centriod) {
this.centriod = centriod;
}
public Coordinate getCentriod() {
return centriod;
}
public void setShape(Geometry shape) {
this.shape = shape;
}
public Geometry getShape() {
return shape;
}
}

View file

@ -0,0 +1,103 @@
/*
* gov.noaa.nws.ncep.common.staticData
*
* 23 February 2012
*
* This code has been developed by the NCEP/SIB for use in the AWIPS2 system.
*/
package gov.noaa.nws.ncep.common.staticdata;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
/**
* Class to hold US state information
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 02/12 ? B. Yin Initial Creation.
*
* </pre>
*
* @author B. Yin
*/
public class USState {
private String stateAbrv; //abbreviation
private String name; //full name
private String fips;
private Coordinate centriod;
private Geometry shape;
//constructor
public USState(){
}
//constructor
public USState( String stateAbrv,
String name,
String fips,
Coordinate centroid,
Geometry shape ){
this.setFips(fips);
this.setName(name);
this.setStateAbrv(stateAbrv);
this.setCentriod(centroid);
this.setShape(shape);
}
public void setStateAbrv(String state) {
this.stateAbrv = state;
}
public String getStateAbrv() {
return stateAbrv;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setFips(String fips) {
this.fips = fips;
}
public String getFips() {
return fips;
}
public void setCentriod(Coordinate centriod) {
this.centriod = centriod;
}
public Coordinate getCentriod() {
return centriod;
}
public void setShape(Geometry shape) {
this.shape = shape;
}
public Geometry getShape() {
return shape;
}
public boolean intersectGeometry(Geometry geo){
if ( shape != null ){
return shape.intersects(geo);
}
else return false;
}
}

View file

@ -0,0 +1,5 @@
/**
* Contains classes and interfaces for NCEP static data.
*
*/
package gov.noaa.nws.ncep.common.staticdata;

View file

@ -0,0 +1,8 @@
<?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="src" path="unit_test"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gov.noaa.nws.ncep.gempak.parameters.core</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 @@
#Thu Mar 29 12:26:43 EDT 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,12 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Core
Bundle-SymbolicName: gov.noaa.nws.ncep.gempak.parameters.core
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.junit
Export-Package: gov.noaa.nws.ncep.gempak.parameters.core.categorymap,
gov.noaa.nws.ncep.gempak.parameters.core.contourinterval,
gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea,
gov.noaa.nws.ncep.gempak.parameters.core.util

View file

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

View file

@ -0,0 +1,308 @@
/*
* CATMAP
*
* Date created (20 November 2009)
*
* This code has been developed by the SIB for use in the AWIPS2 system.
*/
package gov.noaa.nws.ncep.gempak.parameters.core.categorymap;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import gov.noaa.nws.ncep.gempak.parameters.core.util.StringUtil;
/**<pre>
* Parses an input <tt>String</tt> of the form label1=value1;...;labelN=valueN
* where label is a non-empty string without any blanks
* and value is a valid floating point number
* <p>
* When queried with a given label, CATMAP returns the matching value and vice-versa.
* <p>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 16-Nov-2009 194 Archana.S Initial Creation
* 20-Nov-2009 194 Archana.S Updated per review comments:
* Redesigned class to use a list of parameterized
* objects of the form CatMapInfo<String, Float>
* Created class CatMapInfo<String, Float>
* Added method getMatchingLabelForValue.
* 07-Jun-2010 194 Archana.S Updated the method call to
* the private method removeBlanksWithinString()
* to use the static method from the StringUtilities
* class and deleted the private method
* removeBlanksWithinString() from this class.
* Renamed the package as
* gov.noaa.nws.ncep.gempak.parameters.categorymap
* </pre>
* @author Archana.S
* @version 1
*/
public class CatMap {
/**List of parameterized objects of type <tt> CatMapInfo </tt>
*wherein each CatMapInfo object comprises of a single <tt>String</tt> label
*and its matching <tt>Float</tt> value*/
private List<CatMapInfo<String,Float>> catmapInfoList;
/**A boolean flag to indicate the success or failure of the parse operation*/
private boolean isCATMAPStringParsed;
/**CATMAP string of the form label1=value1;...;labelN=valueN;*/
private String strCategoricalMapping;
/**Regular expression to check if the input string matches a valid CATMAP string
*of the form label1=value1;...;labelN=valueN;*/
private String CATMAP_STRING = "([\\w\\p{Punct}]*=-?\\d*\\.?\\d*;*)+";
/**
* Overloaded constructor that accepts a string of the form label1=value1;...;labelN=valueN
* as input and parses it.
* <p>
* It initializes the instance variables.
* After checking that the input string is not empty and null, it invokes the
* method <tt>removeBlanksWithinString</tt>, if the input string contains any blanks.
* It then invokes the method <tt>parse</tt> to extract and store the labels and values
* in separate lists.
*
* @param strCATMAP - the input CATMAP string of the form label1=value1;...;labelN=valueN
*/
public CatMap(String strCATMAP){
/*Initialize state variables*/
setCategoricalMappingString(strCATMAP);
setCatmapInfoList(new ArrayList<CatMapInfo<String,Float>>());
/*If the input string is not null or empty*/
if(!(strCATMAP == null)&& (!strCATMAP.isEmpty())){
/*Check if the input string contains a blank character*/
if(strCATMAP.contains(" ")){
/*If so invoke the method removeBlanksWithinString*/
String strCATMAPWithoutBlanks = StringUtil.removeBlanksWithinString(strCATMAP);
/*Then invoke the method parse
*The boolean returned by parse, is passed as an argument to
*the method setCATMAPStringParsed().
**/
setCATMAPStringParsed(parse(strCATMAPWithoutBlanks));
}
else{
/*Else invoke the method parse*/
setCATMAPStringParsed(parse(strCATMAP));
}
}
else{/*Else if the string is null or empty set the boolean */
setCATMAPStringParsed(false);
}
}
/**
* Returns the floating point value associated with the first instance of a
* label that matches the input string
* <p>
* The input string containing the label is compared with the
* corresponding string component of each CatMapInfo object in the list of CatMapInfo objects
* (populated by parsing the input String)
* If the case-insensitive comparison fails,a wild-card comparison is carried out, if the label
* has only 2 characters of the form 'W*' or 'w*'
*In either case,if the comparison succeeds, the corresponding floating point value is returned.<p>
*Note:<p>
* Any label that was entered after the wild-card label and starts with the same letter as the wild-card
* will be returned the same value as that of the wild-card label.<p>
*
* For instance:<p>
* If the input string is <tt> abc=4;def=8;a*=20.7;oranges=30;apples=40 </tt>
* <p>
* Then, invoking the method <tt>getMatchingValueForLabel</tt> with the label <tt> apples</tt> will return
* a value of 20.7 (the value of associated with the wild-card label <tt>a*</tt>, whose first character matches
* the first character in <tt>apples</tt>) and not 40 as might otherwise be expected.<p>
* On the other-hand, the value returned for the label <tt>abc</tt> will be 4, since the it precedes
* the label <tt> a* </tt>
*
* @param inputLabelString - the string label for which a matching floating point value is sought
* @return the matching floating point value
*/
public Float getMatchingValueForLabel(String inputLabelString){
Float matchingValue = Float.NaN;
/*If the input string was parsed successfully*/
if (this.isCATMAPStringParsed()) {
/*For each CatMapInfo object in the list:
* Make a case insensitive comparison with the input string
* If this comparison fails, check whether the following conditions are satisfied:
* The label is 2 characters long
* The first character of the label and the input string are the same
* The second and final character of the label is a '*'(wild-card) character
* */
for(int i=0; i<this.getCatmapInfoList().size();i++){
CatMapInfo<String, Float> catmapObj = this.getCatmapInfoList().get(i);
if(catmapObj.getLabel().equalsIgnoreCase(inputLabelString)
|| ( (catmapObj.getLabel().length() == 2)
&& (catmapObj.getLabel().toUpperCase().charAt(0)
== inputLabelString.toUpperCase().charAt(0))
&& (catmapObj.getLabel().charAt(1) == '*'))){
matchingValue = catmapObj.getValue();
break;
}
}
}
return matchingValue;
}
/**
* Returns the matching <tt>String</tt> label (if found) for the input floating point number or null otherwise
* <p>
* The input <tt>Float</tt> value is compared successively with the corresponding <tt>Float</tt> data of each CatMapInfo object
* until a match is found. Once a match is found, the corresponding label of the CatMapInfo object is returned
* otherwise the method returns <tt>null</tt>
* @param inputFloatValue - the input <tt>Float</tt> value for which the matching label is sought
* @return the matching<tt>String</tt> label if it is found or <tt>null</tt> otherwise
*/
public String getMatchingLabelForValue(Float inputFloatValue){
StringBuffer strBuff = new StringBuffer();
/*If the input string was parsed successfully*/
if (this.isCATMAPStringParsed()) {
/*For each CatMapInfo object in the list, check if the input string matches
*its floating point value - if yes, get the corresponding label and return it, else
*return null
**/
for(int i=0; i<this.getCatmapInfoList().size();i++){
CatMapInfo<String, Float> catmapObj = this.getCatmapInfoList().get(i);
if(catmapObj.getValue().equals(inputFloatValue)){
strBuff.append(catmapObj.getLabel());
break;
}
}
}
return ( strBuff.length() > 0 ? strBuff.toString(): null);
}
/**
* Returns the input CATMAP string entered by the user
* @return The input string for the constructor
*/
public String getCategoricalMappingString() {
return strCategoricalMapping;
}
/**
* Returns the list of CatMapInfo objects
* @return the list of CatMapInfo objects
*/
private List<CatMapInfo<String, Float>> getCatmapInfoList() {
return catmapInfoList;
}
/**
* Sets the input list to the list of CatMapInfo objects
* @param catmapInfoList the list of CatMapInfo objects to set
*/
private void setCatmapInfoList(List<CatMapInfo<String, Float>> catmapInfoList) {
this.catmapInfoList = catmapInfoList;
}
/**
* Indicates the status of the parse operation
* @return the boolean flag to indicate whether the parse operation succeeded or failed
*/
private boolean isCATMAPStringParsed() {
return isCATMAPStringParsed;
}
/**
* Sets the status of the parse operation to the input boolean parameter
* @param parseStatus - boolean flag to indicate whether the parse operation
* succeeded or failed
*/
private void setCATMAPStringParsed(boolean parseStatus) {
this.isCATMAPStringParsed = parseStatus;
}
/**
* Stores the input string of the constructor
* @param strCategoricalMapping - The input string of the constructor
*/
private void setCategoricalMappingString(String strCategoricalMapping) {
this.strCategoricalMapping = strCategoricalMapping;
}
/**
* Parses the input string of the form label1=value1;....;labelN=valueN
* into label/value pairs and subsequently extracts
* and stores each label/value pair in individual CatMapInfo objects. Each
* CatMapInfo object is added then successively to a list of CatMapInfo objects.
* @param categoricalMappingString - the input string of label/value pairs
* @return isCATMAPStringParsedCorrectly - boolean flag to indicate the
* success or failure of the parse
*/
private boolean parse(String categoricalMappingString){
boolean isCATMAPStringParsedCorrectly = false;
String[] catmapLabelValuePairs;
String[] catmapTokens;
/*If the input string matches the regular expression for the CATMAP
*string
* */
if(Pattern.matches(CATMAP_STRING, categoricalMappingString)){
/*Split the input string using the ';' character as a delimiter*/
catmapLabelValuePairs = categoricalMappingString.split(";");
/*For each label-value token*/
for(String catMap:catmapLabelValuePairs){
/*split the token using the '=' character as a delimiter*/
catmapTokens = catMap.split("=");
/*if there are exactly 2 tokens*/
if(catmapTokens.length == 2){
try{
/*try to extract the floating point value from the string*/
Float tempValue = Float.parseFloat(catmapTokens[1]);
String tempString = catmapTokens[0];
/*Create a new CatMapInfo object with the extracted string and floating point
*values and add it to the list of CatMapInfo objects.
* */
this.catmapInfoList.add(new CatMapInfo<String,Float>(tempString,tempValue));
/*Set the boolean to true*/
isCATMAPStringParsedCorrectly = true;
}
/*In case there is an exception*/
catch(Exception e){
/*Add a CatMapInfo object initialized with invalid parameters to the list*/
this.catmapInfoList.add(new CatMapInfo<String, Float>("",Float.NaN));
/*Set the boolean to false*/
isCATMAPStringParsedCorrectly = false;
}
}
}
}
return isCATMAPStringParsedCorrectly;
}
}

View file

@ -0,0 +1,75 @@
/*
* CatMapInfo
*
* Date created (20 November 2009)
*
* This code has been developed by the SIB for use in the AWIPS2 system.
*/
package gov.noaa.nws.ncep.gempak.parameters.core.categorymap;
/**<pre>
*An object of the CatMapInfo class is to be created and used only by the class CATMAP
* Final class CatMapInfo is parameterized with two parameters:
* A String - to store the label
* A Float - to store the value
*For more details about how the label and value are obtained
*see {@link gov.noaa.nws.ncep.gempak.parameters.core.categorymap.CatMap}
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 20-Nov-2009 194 Archana.S Initial Creation
* 07-Jun-2010 194 Archana.S Renamed the package as
* gov.noaa.nws.ncep.gempak.parameters.categorymap
* </pre>
* @author Archana.S
* @version 1
*/
@SuppressWarnings("hiding")
final class CatMapInfo<String,Float> {
/**A string containing the label*/
private String label;
/**A string containing the floating point value*/
private Float value;
/***
*Stores the input string and floating point parameters
*
* @param label - the string stored as the label for the CatMapInfo object
* @param value - the floating point value stored as the value associated with the given label
*/
protected CatMapInfo(String label, Float value){
this.setLabel(label);
this.setValue(value);
}
/**
*
* @param label - the string to set
*/
protected void setLabel(String label) {
this.label = label;
}
/**
*
* @return the string label
*/
protected String getLabel() {
return label;
}
/**
*
* @param value - the floating point data to set
*/
protected void setValue(Float value) {
this.value = value;
}
/**
*
* @return the floating point value
*/
protected Float getValue() {
return value;
}
}

View file

@ -0,0 +1,540 @@
package gov.noaa.nws.ncep.gempak.parameters.core.contourinterval;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import gov.noaa.nws.ncep.gempak.parameters.core.contourinterval.ContourStringParser;
/**
* CINT accepts strings (in its overloaded constructor) matching one of the two formats below:
* <pre>
* <tt> contourInterval/minimumContourValue/maximumContourValue/numPaddingDigits<p>
* contourVal1;contourVal2;...;contourValn
* Multiple zoom levels (up to 5 levels) can be entered by separating the above input string formats with a ">"
* sign
* </tt>
*
* <tt>CINT</tt> returns a list of contour levels (and/or contour interval,
* minimum and maximum contour levels) only if the method <tt>isCINTStringParsed()</tt> returns true.
* Hence before attempting to use a numeric value returned by any method in <tt>CINT</tt>, it is strongly
* advised that the user checks the result of the method <tt>isCINTStringParsed()</tt>.
* </pre>
* <p>
*<pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 12-Nov-2009 174 Archana.S Initial Creation
* 07-Jun-2010 174 Archana.S Renamed the package as
* gov.noaa.nws.ncep.gempak.parameters.contourinterval
* 10-Jun-2010 174 Archana.S Added methods generateContourValueListAsString(),
* setContourValueListAsStringList() and
* getContourValueListAsStringList()
* 11-Jun-2010 174 Archana.S Added method addLeadingZeros() and
* updated generateContourValueListAsString() accordingly
* 14-Jun-2010 174 Archana.S Redesigned class to support multiple zoom levels
* 30-Jul-2010 174 Archana.S Added the zoom-level as an enum. Updated design to
* access the list of contour values, the contour interval,
* min and max contour values separately from each zoom level.
* Implemented each zoom level as a CNT object in a list of CINT objects.
* 17-May-2011 M. Li Created a parseCINT to simplify CINT parsing.
*
*
* </pre>
* @author Archana.S
* @version 1
* @see $GEMPAK/help/hlx/cint.hl2
*/
public class CINT {
/**The object responsible for parsing the CINT string*/
private ContourStringParser cintParser;
/** The input CINT string*/
private String contourIntervalString;
/** A real number that represents the contour interval*/
private Double contourInterval;
/** A real number that represents the minimum contour level*/
private Double minContourValue;
/** A real number that represents the maximum contour level*/
private Double maxContourValue;
/** Boolean flag to validate that the CINT string was parsed correctly*/
private boolean isCINTStringParsed;
/**An integer that decides the minimum number of digits in an integer contour label*/
private Integer numPaddingDigits;
/**The un-parsed CINT string entered by the user */
String userInputString;
public String getUserInputString() {
return userInputString;
}
private void setUserInputString(String userInputString) {
this.userInputString = new String(userInputString);
}
/**A list of CINT objects where each CINT object represents one zoom level*/
private List<CINT> listOfCINTObjects = new ArrayList<CINT>(0);
/**The list of contour values*/
private List<Double> contourValuesList;
/**The list of contour values represented as String objects*/
private List<String> contourValuesListAsString;
/**The list of extracted contour labels. For CINT strings without labels, it is the contour value stored as its String equivalent*/
private List<String> contourLabelList;
private List<String> getContourLabelList() {
return contourLabelList;
}
private void setContourLabelList(List<String> contourLabelList) {
this.contourLabelList = contourLabelList;
}
/**A HashMap of the contour values and their labels*/
private Map<Double, String> cintHashMap;
/**@return a list of CINT objects, each of which represents one zoom level*/
public List<CINT> getListOfCINTObjects() {
return (new ArrayList<CINT>(listOfCINTObjects));
}
/**
* Gets the {@code HashMap<Double, String>} of the contour values and labels for a specific zoom level
* @param The zoom level
* @return The {@code HashMap<Double, String>} of the contour values and labels for the input zoom level
* if the CINT object for that zoom level exists or an empty map otherwise.
* */
public Map<Double, String> getCintHashMap(ZoomLevel zLevel) {
int listSize = this.listOfCINTObjects.size();
if(listSize >= zLevel.zoomLevel){
Map <Double,String> thisMap = new HashMap<Double,String>(this.listOfCINTObjects.get( zLevel.zoomLevel - 1).cintHashMap);
if(thisMap.size() > 0){
return (thisMap);
}
}
return Collections.EMPTY_MAP;
}
/***
*
* @param cintHashMap
*/
private void setCintHashMap(Map<Double, String> cintHashMap) {
this.cintHashMap = cintHashMap;
}
/**
* Gets the {@code List<Double>} of the contour values for a specific zoom level
* @param the zoom level
* @return The {@code List<Double>} of the contour values for the input zoom level
* if the CINT object for that zoom level exists or an empty list otherwise.
* */
public List<Double> getContourValuesListAsDouble(ZoomLevel zLevel) {
int listSize = this.listOfCINTObjects.size();
if(listSize >= zLevel.zoomLevel){
List<Double> cList = new ArrayList<Double>(this.listOfCINTObjects.get(zLevel.zoomLevel - 1).contourValuesList);
if( cList.size() > 0){
return (new ArrayList<Double>(cList));
}
}
return Collections.EMPTY_LIST;
}
/***
*
* @param contourValuesList
*/
private void setContourValuesList(List<Double> contourValuesList) {
this.contourValuesList = new ArrayList<Double>(contourValuesList);
}
/**An enumeration to define the 5 zoom levels allowed in CINT*/
public static enum ZoomLevel {
FIRST(1), SECOND(2), THIRD(3), FOURTH(4), FIFTH(5);
private int zoomLevel;
private ZoomLevel(int index){
this.zoomLevel = index;
}
public int getZoomLevelAsInt(){
return zoomLevel;
}
}
/**Zoom constant representing the first zoom level*/
public static final ZoomLevel FIRST_ZOOM_LEVEL = ZoomLevel.FIRST;
/**Zoom constant representing the second zoom level*/
public static final ZoomLevel SECOND_ZOOM_LEVEL = ZoomLevel.SECOND;
/**Zoom constant representing the third zoom level*/
public static final ZoomLevel THIRD_ZOOM_LEVEL = ZoomLevel.THIRD;
/**Zoom constant representing the fourth zoom level*/
public static final ZoomLevel FOURTH_ZOOM_LEVEL = ZoomLevel.FOURTH;
/**Zoom constant representing the fifth zoom level*/
public static final ZoomLevel FIFTH_ZOOM_LEVEL = ZoomLevel.FIFTH;
/**Zoom constant representing the first zoom level as the minimum level of zoom*/
public static final ZoomLevel MIN_ZOOM_LEVEL = ZoomLevel.FIRST;
/**Zoom constant representing the fifth zoom levelas the maximum level of zooom*/
public static final ZoomLevel MAX_ZOOM_LEVEL = ZoomLevel.FIFTH;
/**
* Gets the {@code List<String>} of the contour values for a specific zoom level
* @param the zoom level
* @return The {@code List<String>} of the contour values for the input zoom level
* if the CINT object for that zoom level exists or an empty list otherwise.
* */
public List<String> getContourValuesListAsString(ZoomLevel zLevel) {
List<String> cvList = Collections.EMPTY_LIST;
int listSize = this.listOfCINTObjects.size();
if( listSize > 0 && listSize >= zLevel.zoomLevel){
cvList = new ArrayList<String>(this.listOfCINTObjects.get(zLevel.zoomLevel - 1).contourValuesListAsString);
}
return cvList;
}
/**
* Gets the {@code List<String>} of the contour labels for a specific zoom level
* @param the zoom level
* @return The {@code List<String>} of the contour labels for the input zoom level
* if the CINT object for that zoom level exists or an empty list otherwise.
* */
public List<String> getContourLabelsForZoomLevel(ZoomLevel zLevel){
List<String> cintLabelList = new ArrayList<String>(0);
int listSize = this.listOfCINTObjects.size();
if(listSize >= zLevel.zoomLevel){
cintLabelList = new ArrayList<String>(this.listOfCINTObjects.get( zLevel.zoomLevel-1).getContourLabelList());
}
return cintLabelList;
}
/**
*The default constructor initializes the instance variables to their defaults
**/
public CINT(){
setContourInterval(Double.NaN);
setMinContourValue(Double.NaN);
setMaxContourValue(Double.NaN);
isCINTStringParsed = false;
cintParser = new ContourStringParser();
cintHashMap = new HashMap<Double, String>(0);
contourValuesList = new ArrayList<Double>(0);
contourValuesListAsString = new ArrayList<String>(0);
contourLabelList = new ArrayList<String>(0);
}
//
// /**
// *The overloaded constructor accepts the CINT string as an input and calls the parse method of the
// *ContourStringParser on it.
// *If the parsing is successful, the contour interval, minimum contour level, maximum
// *contour level and the list of contour values will be populated by the corresponding parsed
// *data from the ContourStringParser object.
// *
// **/
public CINT(String contourIntervalString){
/*Initialize instance variables*/
setContourInterval(Double.NaN);
setMinContourValue(Double.NaN);
setMaxContourValue(Double.NaN);
contourValuesList = new ArrayList<Double>(0);
contourValuesListAsString = new ArrayList<String>(0);
contourLabelList = new ArrayList<String>(0);
setUserInputString(contourIntervalString);
cintParser = new ContourStringParser();
parseAndSetAttributes(contourIntervalString);
}
public static List<Double> parseCINT(String cint, int zoomLevelIndex, float minValue, float maxValue) {
/*
* Convert zoomLevel index
*/
ZoomLevel zoomLevel = CINT.FIRST_ZOOM_LEVEL;
switch (zoomLevelIndex) {
case 1:
zoomLevel = CINT.FIRST_ZOOM_LEVEL;
break;
case 2:
zoomLevel = CINT.SECOND_ZOOM_LEVEL;
break;
case 3:
zoomLevel = CINT.THIRD_ZOOM_LEVEL;
break;
case 4:
zoomLevel = CINT.FOURTH_ZOOM_LEVEL;
break;
case 5:
zoomLevel = CINT.FIFTH_ZOOM_LEVEL;
break;
}
/*
* Get contour values from CINT
*/
List<Double> cvalues = null;
Double cmin = new Double( minValue );
Double cmax = new Double( maxValue );
Double interval = null;
if (cint == null || cint.trim().length() < 1) {
interval = (cmax - cmin) / 10.0;
CINT contourInfo = new CINT(interval.toString()+"/"+cmin.toString()+"/"+cmax.toString());
cvalues = contourInfo.getUniqueSortedContourValuesFromAllZoomLevels();
}
else {
CINT contourInfo = new CINT(cint);
cvalues = contourInfo.getContourValuesListAsDouble(zoomLevel);
if (cvalues == null || cvalues.size() < 1 /*|| contourInfo.getContourInterval(zoomLevel) == 0.0*/) {
cmin = contourInfo.getMinContourValue(zoomLevel);
if (cmin == null || cmin.isNaN()) cmin = new Double( minValue );
cmax = contourInfo.getMaxContourValue(zoomLevel);
if (cmax == null || cmax.isNaN()) cmax = new Double( maxValue );
interval = contourInfo.getContourInterval(zoomLevel);
if (interval == null || interval.isNaN()) {
interval = (cmax - cmin) / 10.0;
}
//Only allow less than 50 contour levels
if ((cmax - cmin)/interval > 50) interval = (cmax - cmin)/50;
// System.out.println(" cmax=="+cmax);
contourInfo = new CINT(interval.toString()+"/"+cmin.toString()+"/"+cmax.toString());
cvalues = contourInfo.getUniqueSortedContourValuesFromAllZoomLevels();
}
}
return cvalues;
}
/**@return boolean isCINTStringParsed*/
public boolean isCINTStringParsed() {
return isCINTStringParsed;
}
/**
* @return The portion of the parsed CINT string specific to a zoom level
* if the CINT object for that zoom level exists or an empty String otherwise.
* */
public String getCINTString(ZoomLevel zLevel){
String currentCINTString="";
int listSize = this.listOfCINTObjects.size();
if(listSize >= zLevel.zoomLevel){
currentCINTString = new String ( this.listOfCINTObjects.get(zLevel.zoomLevel-1).contourIntervalString);
}
return currentCINTString;
}
/**
* @return The contour interval specific to a zoom level
* if the CINT object for that zoom level exists or NaN otherwise.
* */
public Double getContourInterval(ZoomLevel zLevel) {
Double currentContourInterval = Double.NaN;
int listSize = this.listOfCINTObjects.size();
if(listSize >= zLevel.zoomLevel){
currentContourInterval = new Double ( this.listOfCINTObjects.get(zLevel.zoomLevel-1).contourInterval);
}
return currentContourInterval;
}
/**
* @return The minimum contour value specific to a zoom level
* if the CINT object for that zoom level exists or NaN otherwise.
* */
public Double getMinContourValue(ZoomLevel zLevel) {
Double currentMinContourValue = Double.NaN;
int listSize = this.listOfCINTObjects.size();
if(listSize >= zLevel.zoomLevel){
currentMinContourValue = new Double ( this.listOfCINTObjects.get(zLevel.zoomLevel-1).minContourValue);
}
return currentMinContourValue;
}
/**
* @return The maximum contour value specific to a zoom level
* if the CINT object for that zoom level exists or NaN otherwise.
* */
public Double getMaxContourValue(ZoomLevel zLevel) {
Double currentMaxContourValue = Double.NaN;
int listSize = this.listOfCINTObjects.size();
if(listSize >= zLevel.zoomLevel){
currentMaxContourValue = new Double ( this.listOfCINTObjects.get(zLevel.zoomLevel-1).maxContourValue);
}
return currentMaxContourValue;
}
/**
* @return The minimum digits in the label for contour values specific to a zoom level
* if the CINT object for that zoom level exists or 0 otherwise.
* */
public Integer getNumPaddingDigits(ZoomLevel zLevel) {
Integer currentNumPaddingDigits = new Integer(0);
int listSize = this.listOfCINTObjects.size();
if(listSize >= zLevel.zoomLevel){
currentNumPaddingDigits = new Integer ( this.listOfCINTObjects.get(zLevel.zoomLevel-1).numPaddingDigits);
}
return currentNumPaddingDigits;
}
/***
*
* @return a list String objects representing the unique contour values from all zoom levels
*/
public List <String> getUniqueSortedContourValuesFromAllZoomLevelsAsString(){
List <Double> sortedKeySet = getUniqueSortedContourValuesFromAllZoomLevels();
List <String> contourValList = new ArrayList <String>(0);
if(sortedKeySet.size() > 0){
for(Double contourValue : sortedKeySet){
contourValList.add(contourValue.toString());
}
}
return contourValList;
}
/***
*
* @return a list of Double objects representing the unique contour values from all zoom levels
*/
public List<Double> getUniqueSortedContourValuesFromAllZoomLevels(){
Set<Double> setOfUnqiueContourValues = new HashSet<Double>(0);
List<Double> sortedList = new ArrayList<Double>(0);
int length = this.listOfCINTObjects.size();
for (int index = 0; index < length; index++) {
CINT currentCINTObj = this.listOfCINTObjects.get(index);
setOfUnqiueContourValues.addAll(currentCINTObj.contourValuesList);
sortedList = new ArrayList<Double>(setOfUnqiueContourValues);
Collections.sort(sortedList);
}
return sortedList;
}
private void setContourValuesListAsString(List<String> contourValuesListAsString) {
this.contourValuesListAsString = contourValuesListAsString;
}
/**@param boolean isCINTStringParsed*/
private void setCINTStringParsed(boolean isCINTStringParsed) {
this.isCINTStringParsed = isCINTStringParsed;
}
/**@param String cintString*/
private void setCINTString(String cintString){
contourIntervalString = new String(cintString);
}
/**@param Double contourInterval*/
private void setContourInterval(Double contourInterval) {
this.contourInterval = new Double(contourInterval);
}
/**@param Double minContourValue*/
private void setMinContourValue(Double minContourValue) {
this.minContourValue = new Double(minContourValue);
}
/**@param Double maxContourValue */
private void setMaxContourValue(Double maxContourValue) {
this.maxContourValue = new Double (maxContourValue);
}
/**
*@param Integer numPaddingDigits
**/
private void setNumPaddingDigits(Integer numPaddingDigits) {
this.numPaddingDigits = new Integer(numPaddingDigits);
}
/***
*
* @param inputStr
*/
private void parseAndSetAttributes(String inputStr){
boolean isParsed = false;
if (inputStr != null) {
String contourLevelStringsArray[] = inputStr.split(">");
int lengthOfContourLevelStringsArray = contourLevelStringsArray.length;
if(lengthOfContourLevelStringsArray > CINT.MAX_ZOOM_LEVEL.zoomLevel){
lengthOfContourLevelStringsArray = CINT.MAX_ZOOM_LEVEL.zoomLevel;
}
listOfCINTObjects = new ArrayList<CINT>(lengthOfContourLevelStringsArray);
for (int index = 0; index < lengthOfContourLevelStringsArray; index++) {
// /*Invoke the parse method of ContourStringParser*/
cintParser.parse(contourLevelStringsArray[index]);
//create the CINT object for the current zoom level
CINT currentCINTObj = new CINT();
currentCINTObj.setCINTStringParsed(cintParser.isContourStringParsed());
/*If the parse operation was successful, extract the numeric
*data and set the corresponding instance variables of currentCINTObj*/
if (currentCINTObj.isCINTStringParsed()) {
currentCINTObj.setCINTString(contourLevelStringsArray[index]);
currentCINTObj.setContourInterval(cintParser.getContourInterval());
currentCINTObj.setMinContourValue(cintParser.getMinContourLevel());
currentCINTObj.setMaxContourValue(cintParser.getMaxContourLevel());
currentCINTObj.setNumPaddingDigits(cintParser.getNumPaddingDigits());
currentCINTObj.setContourValuesList(cintParser.getContourValuesList());
currentCINTObj.setCintHashMap(cintParser.getLabeledContourValuesHashMap());
Set<Double> tempKeySet = new LinkedHashSet<Double>(currentCINTObj.cintHashMap.keySet());
currentCINTObj.setContourValuesList( new ArrayList<Double>(tempKeySet));
for(Double contourValue : tempKeySet){
currentCINTObj.contourValuesListAsString.add(contourValue.toString());
}
currentCINTObj.contourLabelList = new ArrayList<String>( new LinkedHashSet<String>(currentCINTObj.cintHashMap.values()));
}
if(index == 0){
isParsed = currentCINTObj.isCINTStringParsed();
}else{
isParsed = isParsed & currentCINTObj.isCINTStringParsed();
}
//Sets the status of the parse operations across all zoom levels (i.e. for all CINT objects in the list)
this.setCINTStringParsed(isParsed);
//finally add currentCINTObj to the list of CINT objects
listOfCINTObjects.add(currentCINTObj);
}
}
}
}

View file

@ -0,0 +1,635 @@
package gov.noaa.nws.ncep.gempak.parameters.core.contourinterval;
import gov.noaa.nws.ncep.gempak.parameters.core.util.StringUtil;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
/**
*
*<tt>ContourStringParser</tt> should be used only in conjunction with a <tt>FINT</tt> or a <tt>CINT</tt> object.
* It serves the purpose of parsing the contour interval string passed to the constructor of a
* <tt>FINT</tt> or a <tt>CINT</tt>object.Thereafter the instance variables of each of these
* two classes is populated by the data extracted by <tt>ContourStringParser</tt>, from the parsed string.
*<pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 09-Nov-2009 174 Archana.S Refactored and updated the actual parsing
* logic from ContourDataStringParser
* 12-Nov-2009 174 Archana.S Removed commented print statements
* Commented out logic to process labels
* Updated the method parseContourStringContainingLabel
* to set the boolean flag to false, when no number is found
*13-Nov-2009 174 Archana.S Updated per review comments:
* 1.Updated regular expression for
* checking labeled contour values
* 2.Removed a separate check to see if the contour value string
* matches an Integer, since the regex for real numbers, takes care of it.
* 07-Jun-2010 174 Archana.S Updated the method call to
* the private method removeBlanksWithinString()
* to use the static method from the StringUtilities
* class and deleted the private method
* removeBlanksWithinString() from this class.
* Renamed the package as
* gov.noaa.nws.ncep.gempak.parameters.contourinterval
*
* 08-Jun-2010 174 Archana.S Updated the method
* extractContourValueFromStringAndAddToContourList(String)
* to set the contour interval, the minimum and the maximum
* contour value in a labeled contour string.
* 09-Jun-2010 174 Archana.S Added and updated the logic to parse labeled contour
* values into a HashMap(String,Double).
* 14-Jun-2010 174 Archana.S Redesigned class to support multiple zoom levels
* 02-Aug-2010 174 Archana.S Updated code to parse a single real number as the contour interval
* </pre>
* @author Archana.S
* @version 1.0
* @see $GEMPAK/help/hlx/cint.hl2
* @see $GEMPAK/help/hlx/fint.hl2
*<p>
*/
public class ContourStringParser {
/** A real number that represents the contour interval*/
private Double contourInterval;
/** A real number that represents the minimum contour level*/
private Double minContourLevel;
/** A real number that represents the maximum contour level*/
private Double maxContourLevel;
/**An integer that decides the minimum number of digits in an integer contour label*/
private Integer numPaddingDigits;
/**The generated list of contour levels*/
private List<Double> contourValuesList;
/**A HashMap of the labels and their respective contour values*/
private Map<Double, String> labeledContourValuesHashMap;
/**A string that contains the extracted contour label from a single contour level*/
private String contourIntervalLabel;
/** Boolean flag to validate that the contour data string was parsed correctly*/
private boolean isContourStringParsed;
private String LIST_OF_CONTOUR_VALUES = "(-?\\d*\\.?\\d*;-?\\d*\\.?\\d*)+"; //The list must have atleast 2 numbers separated by a semi-colon
private String REAL_NUMBER = "-?\\d*\\.?\\d*;?";
private String INTEGER = "-?\\d+";
private String LABELLED_CONTOUR_VALUE = "(-?\\d*\\.?\\d*=[\\w\\p{Punct}]*;*)+";
/**The default constructor just initializes the instance variables to their defaults*/
public ContourStringParser(){
contourInterval = Double.NaN;
minContourLevel = Double.NaN;
maxContourLevel = Double.NaN;
numPaddingDigits = new Integer(0);
isContourStringParsed = false;
contourValuesList = null;
}
/**
* @return the labeledContourValuesHashMap
*/
public Map<Double, String> getLabeledContourValuesHashMap() {
return labeledContourValuesHashMap;
}
/**
* @param labeledContourValuesHashMap the labeledContourValuesHashMap to set
*/
private void setLabeledContourValuesHashMap(
Map<Double, String> labeledContourValuesHashMap) {
this.labeledContourValuesHashMap = labeledContourValuesHashMap;
}
public boolean isContourStringParsed() {
return isContourStringParsed;
}
/**@return List of Double - contourValuesList*/
public List <Double> getContourValuesList() {
return contourValuesList;
}
/** The method getContourInterval returns the contour interval value
*@return Double contourInterval
**/
public Double getContourInterval() {
return contourInterval;
}
/** The method getContourIntervalLabel returns the contour interval value
*@return String contourIntervalLabel
**/
public String getContourIntervalLabel() {
return contourIntervalLabel;
}
/**The method getMinContourLevel returns the value of the minimum contour level
* @return Double minContourLevel
**/
public Double getMinContourLevel() {
return minContourLevel;
}
/**The method getMaxContourLevel returns the value of the maximum contour level
* @return Double maxContourLevel
**/
public Double getMaxContourLevel() {
return maxContourLevel;
}
/** The method getNumPaddingDigits returns the value of the Integer numPaddingDigits
*@return Integer numPaddingDigits
**/
public Integer getNumPaddingDigits() {
return numPaddingDigits;
}
/**The method <tt>parse</tt> checks if the input string contains blanks.
*If so it invokes the method <tt>removeBlanksWithinString </tt> on the string
*and then invokes the method <tt>parseContourString</tt> on it. Else, the method <tt>parseContourString</tt>
*is directly invoked on the input string
*<p>
*@param String contourStringToParse
**/
public void parse(String contourStringToParse){
/*
* Initialize the list and the hash map
*/
setContourValuesList(new ArrayList<Double>(0));
setLabeledContourValuesHashMap(new LinkedHashMap<Double, String>(0));
if (contourStringToParse != null && !(contourStringToParse.isEmpty())) {
if (contourStringToParse.contains(" ")) {
String strWithoutBlanks = StringUtil
.removeBlanksWithinString(contourStringToParse);
isContourStringParsed = this.parseContourString(strWithoutBlanks);
}
else {
isContourStringParsed = this.parseContourString(contourStringToParse);
}
}
}
/**The method <tt>parseContourString</tt>
*@param String contourStringToParse
*@return boolean isInputContourStringParsed
*<p>The method <tt>parseContourString</tt> accepts the contour data string fed as an input
*from the method <tt>parse()</tt>.
*A valid contour string can take only one of the formats listed below:<P>
*1. contourInterval/minimumContourLevel/maximumContourLevel/numPaddingdigits <P>
*2. contourValue1;contourValue2;contourValue3;contourValue4;contourValue5.......<p>
*3. contourValue1=label1/contourValue1/contourValue1<p>
*4. contourValue1=label1;contourValue2=label2;contourValue3=label3;............<p>
*5. contourInterval/minimumContourLevel/maximumContourLevel<p>
*<p>
*If the input string is entered in the first or the fifth format,
*<tt>contourStringToParse</tt> is parsed using the "/" character as a delimiter.
*All numeric data is extracted and stored.
*<p>
*If the second format is chosen, the string contourStringParam is parsed using the ";" character
*as a delimiter.<p>
*The method<tt>generateContourValuesList</tt> is invoked to compute the range of contour values.
*The method setContourValuesList is invoked to store the computed range of contour values.
*<p>
*If the parsing and subsequent numeric data retrieval is successful,
*the boolean isInputContourStringParsed is set to true.
*<P>
***/
private boolean parseContourString(String contourStringToParse){
String contourStringsTokens[];
boolean isInputContourStringParsed = false;
// /*If the input string contains a list of contour values separated
// * by a ';' character as a delimiter*/
if(Pattern.matches(REAL_NUMBER, contourStringToParse)){
try{
String[] tempStr = contourStringToParse.split(";");
if(tempStr != null && tempStr.length > 0 ){
Double d = Double.parseDouble(tempStr[0]);
setContourInterval(d.doubleValue());
isInputContourStringParsed = true;
}
}catch(Exception e){
isInputContourStringParsed = false;
}
}
else if(Pattern.matches(LABELLED_CONTOUR_VALUE, contourStringToParse)) {
if(contourStringToParse.contains(";")){
contourStringsTokens = contourStringToParse.split(";");
for(String s:contourStringsTokens){
isInputContourStringParsed = this.parseContourStringContainingLabel(s);
/*TODO add code to store the labels in a list or in a HashMap with the
*corresponding contour values*/
if(!isInputContourStringParsed){
System.out.println("INVALID STRING");
break;
}
}
}else{
isInputContourStringParsed = this.parseContourStringContainingLabel(contourStringToParse);
}
}
else if(Pattern.matches(LIST_OF_CONTOUR_VALUES, contourStringToParse)){
if(contourStringToParse.contains(";")){
/*Split the input string into tokens using the ';' character as a delimiter*/
contourStringsTokens = contourStringToParse.split(";");
for(String s:contourStringsTokens){
/*for each string token, attempt to extract the contour value from it to
* the map of contour values*/
isInputContourStringParsed = this.extractContourValueFromStringAndAddToHashMap(s);
if(!isInputContourStringParsed){
break;
}
}
}else{
isInputContourStringParsed = this.extractContourValueFromStringAndAddToHashMap(contourStringToParse);
}
}
else{
if(contourStringToParse.contains("/")){
contourStringsTokens = contourStringToParse.split("/");
Double tempContourParam[] = new Double[3];
int i=0;
for(i=0;i<3;i++){
try{
tempContourParam[i] = Double.parseDouble(contourStringsTokens[i]);
isInputContourStringParsed = true;
}catch(Exception e){
tempContourParam[i] = Double.NaN;
}
}
/*Store extracted numeric data as minContourLevel and maxContouLevel */
setMinContourLevel(tempContourParam[1]);
setMaxContourLevel(tempContourParam[2]);
/*If the maxContourLevel value is different from the minContourLevel value,
*store the contourInterval value as retrieved from the corresponding string token.
**/
if(this.getMaxContourLevel().doubleValue() != this.getMinContourLevel().doubleValue()){
setContourInterval(tempContourParam[0]);
}
else{
/*Special case: check for a label in a single contour value*/
if(contourStringsTokens[0].contains("=")){
isInputContourStringParsed = parseContourStringContainingLabel(contourStringsTokens[0]);
if(isInputContourStringParsed){
setContourInterval(this.getMinContourLevel());
}
}else{
/* Since both maxContourLevel and minContourLevel are equal, and there
* is no contour label, the contour interval is set to 0.
*/
setContourInterval(0.0);
}
}
if( Double.isNaN(this.getContourInterval())
&& Double.isNaN(this.getMinContourLevel())
&& Double.isNaN(this.getMaxContourLevel())){
isInputContourStringParsed = false; /* All three parameters cannot be undefined in a successful parse operation*/
}
else{
isInputContourStringParsed = true;
}
/*If the parsing has been successful, generate the list of contour values*/
if((isInputContourStringParsed)) {
/*For CINT alone, a digit defining the minimum number of digits
*in a label is to be extracted from the 4th token, is it exists*/
if(contourStringsTokens.length >= 4){
try {
/*Check that the 4th string token is an integer:
*
*INTEGER is a regular expression of the form: \\d+ */
if (Pattern.matches(INTEGER,
contourStringsTokens[3])) {
setNumPaddingDigits(Integer.parseInt(contourStringsTokens[3]));
}
}
catch (Exception e) {
isInputContourStringParsed = false;
}
} else{
setNumPaddingDigits(0);
}
Map<Double,String> tempContourValMap = generateContourValuesMap(this.getContourInterval(),
this.getMinContourLevel(),
this.getMaxContourLevel(),
this.getNumPaddingDigits());
setLabeledContourValuesHashMap(tempContourValMap);
}
}
}
return isInputContourStringParsed;
}
/**
* @param String contourString
* @return boolean isContourValueExists
* <p>
* The method <tt>extractContourValueFromStringAndAddToHashMap</tt> is used to
* extract a real number (the contour value) from the input string.
* If the extraction is successful, the real number is added to a HashMap of contour values.
* If the extraction is successful, the method returns <tt>true</tt>, else <tt>false</tt>.
* */
private boolean extractContourValueFromStringAndAddToHashMap(String contourString){
Double tempContourValue;
boolean isContourValueExists = false;
try{
tempContourValue = Double.parseDouble(contourString);
/*If the parse is successful, add the contour value to the list of contour values*/
isContourValueExists = true;
}catch(Exception e){
tempContourValue = Double.NaN;
isContourValueExists = false;
}
if(isContourValueExists){
// this.getContourValuesList().add(tempContourValue);
this.getLabeledContourValuesHashMap().put(tempContourValue, contourString);
this.contourInterval = tempContourValue;
}
return isContourValueExists;
}
/**
* @param String contourValueWithLabel
* @return boolean isLabelExists
* <p>
* The method <tt>parseContourStringContainingLabel</tt> is used to
* parse the input string into it constituent contour value(a real number)
* and a string representing its label.
* If the extraction is successful, the method returns true, else false.
**/
private boolean parseContourStringContainingLabel(String contourValueWithLabel){
String singleContourLevelToken[];
boolean isLabelAndContourValueExists = false;
Double key=Double.NaN;
String value = "";
/*check for the "=" delimiter, to see if the string contains a label for the contour value*/
if (contourValueWithLabel.contains("=")) {
/*If yes, split the string using the delimiter "=" */
singleContourLevelToken = contourValueWithLabel.split("=");
/*Extract the contour value from the numeric data in the first string token*/
if (Pattern.matches(REAL_NUMBER, singleContourLevelToken[0])) {
if(singleContourLevelToken.length > 1){
isLabelAndContourValueExists = true;
String contourLabelIntervalValue[] = singleContourLevelToken[1].split("/");
value = new String(contourLabelIntervalValue[0]);
try{
key = Double.parseDouble(singleContourLevelToken[0]);
}catch(Exception e){
key = Double.NaN;
isLabelAndContourValueExists = false;
}
}
if(isLabelAndContourValueExists){
/*If the parse is successful, add the contour value to the list of contour values*/
this.getContourValuesList().add(key);
labeledContourValuesHashMap.put(key, value);
}
}
}
else{
/*No numeric data was found in the string token
* Set the boolean flag to false, to indicate an error.
* */
isLabelAndContourValueExists = false;
}
if(labeledContourValuesHashMap.size() == 1){
setContourInterval(0.0);
setMaxContourLevel(key);
setMinContourLevel(key);
}
return isLabelAndContourValueExists;
}
/**
* Generates a Map of Contour values of the form Map(Double, String)
*@param Double contourInterval
*@param Double minContourValue
*@param Double maxContourValue
*@param numLeadingZeros
*@return a Map of type (Double, String)
*<p>
*The method <tt>generateContourValuesMap</tt> accepts as input the <tt>contourInterval</tt>
*and the minimum and maximum contour values.
*It generates a Map (Double, String) representing the contour levels
*that lie in the range specified by <tt>minContourValue</tt> and <tt>maxContourValue</tt>.
* The String value of each entry in the map represents the contour value's String equivalent,
* after appending it with leading zeros depending on the value of numLeadingZeros
*<p>
*Each contour level is separated from its neighboring contour values by the value of the contourInterval.
*If <tt>minContourValue</tt> and <tt>maxContourValue</tt> are not exact multiples of <tt>contourInterval</tt>,
*then they are set to the next neighboring values that are exact multiples of the <tt>contourInterval</tt>.
*<p>
*
***/
private Map<Double, String> generateContourValuesMap(Double contourInterval,
Double minContourValue,
Double maxContourValue,
Integer numLeadingZeros){
Map<Double, String> contourValMap= new LinkedHashMap<Double,String>();
/*If contourInterval is negative, multiply it by -1*/
if(contourInterval < 0) {
contourInterval*= -1;
}
/*If the contourInterval is defined */
if(!(Double.isNaN(contourInterval)) && (contourInterval != 0)){
if(!(Double.isNaN(maxContourValue))
&& !(Double.isNaN(minContourValue))){
/*Even if the values of minContourValue and maxContourValue parameters are exchanged
*Swap them and then generate the list
**/
if (minContourValue.compareTo(maxContourValue) > 0) {
Double tempContourVal = new Double(minContourValue);
minContourValue = new Double(maxContourValue);
maxContourValue = new Double(tempContourVal);
setMinContourLevel(minContourValue);
setMaxContourLevel(maxContourValue);
}
/*If minContourValue and maxContourValue are not exact multiples of contourInterval
* they are set to neighboring values that are exact multiples of the contourInterval.
**/
// if(Pattern.matches(INTEGER, ))
Double d1 = minContourValue / contourInterval;
Double d2 = maxContourValue / contourInterval;
int intMinContourValueAdjFactor = 0;
int intMaxContourValueAdjFactor = 0;
if(!Pattern.matches(INTEGER, d1.toString())
&& d1.doubleValue() != 0){
intMinContourValueAdjFactor = (int) d1.doubleValue();
}
if(!Pattern.matches(INTEGER, d2.toString())
&& d2.doubleValue() != 0){
intMaxContourValueAdjFactor = (int) d2.doubleValue();
}
if(intMinContourValueAdjFactor != 0){
minContourValue = new Double( intMinContourValueAdjFactor * contourInterval);
}
if(intMaxContourValueAdjFactor != 0){
maxContourValue = new Double(intMaxContourValueAdjFactor * contourInterval);
}
/*Starting from minContourValue, until maxContourValue is reached, each contourValue is added to the map
*and the next contourValue in the range is computed by adding the contourInterval to the current contour value.
*Finally, the last element in the range - maxContourValue is also added to the map.
**/
while (minContourValue.compareTo(maxContourValue) < 0) {
String contourLabel = addLeadingZerosToContourValue(numLeadingZeros, minContourValue);
contourValMap.put(minContourValue, contourLabel);
minContourValue = new Double(contourInterval + minContourValue.doubleValue());
}
String contourLabel = addLeadingZerosToContourValue(numLeadingZeros, maxContourValue);
contourValMap.put(maxContourValue, contourLabel);
}
}
else{
if(minContourValue.doubleValue() == maxContourValue.doubleValue()){
/*When minContourValue is equal to maxContourValue,
* even if the contour interval is undefined
* the contour values list will contain one element
* namely the contour level specified by either
* minContourValue or maxContourValue(since they are the same).
*/
String contourLabel = addLeadingZerosToContourValue(numLeadingZeros, minContourValue);
contourValMap.put(minContourValue, contourLabel);
}else{
/*TODO Add code to generate the contour values list
* when contourInterval is NAN or 0 but
* minContourValue is not equal to maxContourValue*/
}
}
return contourValMap;
}
/**@param List of Double - contourValuesList*/
private void setContourValuesList(List <Double> contourValuesList) {
this.contourValuesList = contourValuesList;
}
/**
*@param Double contourInterval
**/
private void setContourInterval(Double contourInterval) {
this.contourInterval = contourInterval;
}
/**
*@param Double minContourLevel
**/
private void setMinContourLevel(Double minContourLevel) {
this.minContourLevel = minContourLevel;
}
/**
*@param Double maxContourLevel
**/
private void setMaxContourLevel(Double maxContourLevel) {
this.maxContourLevel = maxContourLevel;
}
/**
*@param Integer numPaddingDigits
**/
private void setNumPaddingDigits(Integer numPaddingDigits) {
this.numPaddingDigits = new Integer (numPaddingDigits);
}
/**
* Creates and returns a String representation of the input contour value
* after adding leading zeros to it.
* @param nPaddingDigits - the number of leading zeros to add
* @param inputDblVal - the contour value to which leading zeros might need to be added
*
* @return The String representation of the input Double value, after padding it
* with leading zeros if its integer portion has less number of digits than the
* number of padding digits
*/
private String addLeadingZerosToContourValue(int nPaddingDigits, Double inputDblVal){
Integer intVal = new Integer (inputDblVal.intValue());
boolean isNegative = false;
if(inputDblVal < 0){
isNegative = true;
inputDblVal = new Double(inputDblVal.doubleValue()* -1);
}
int lengthOfInputStr = intVal.toString().length();
int numZerosToAdd = nPaddingDigits - lengthOfInputStr;
StringBuilder stringBuilder = new StringBuilder(lengthOfInputStr);
for ( int i = 0; i < numZerosToAdd ; i++ ){
stringBuilder.insert(0,"0");
}
if(isNegative){
stringBuilder.insert(0,"-");
}
String inputString = inputDblVal.toString();
stringBuilder.append(inputString);
return stringBuilder.toString();
}
}

View file

@ -0,0 +1,78 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2009.09.29 at 09:13:32 AM EDT
//
package gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element ref="{}geographical_data" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"geographicalData"
})
@XmlRootElement(name = "geogCodeList")
public class GeogCodeList {
@XmlElement(name = "geographical_data")
protected List<GeographicalData> geographicalData;
/**
* Gets the value of the geographicalData property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the geographicalData property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getGeographicalData().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link GeographicalData }
*
*
*/
public List<GeographicalData> getGeographicalData() {
if (geographicalData == null) {
geographicalData = new ArrayList<GeographicalData>();
}
return this.geographicalData;
}
}

View file

@ -0,0 +1,295 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2009.09.29 at 09:13:32 AM EDT
//
package gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element ref="{}geog_code" minOccurs="0"/>
* &lt;element ref="{}geog_area_name" minOccurs="0"/>
* &lt;element ref="{}center_lat" minOccurs="0"/>
* &lt;element ref="{}center_lon" minOccurs="0"/>
* &lt;element ref="{}lower_left_lat" minOccurs="0"/>
* &lt;element ref="{}lower_left_lon" minOccurs="0"/>
* &lt;element ref="{}upper_right_lat" minOccurs="0"/>
* &lt;element ref="{}upper_right_lon" minOccurs="0"/>
* &lt;element ref="{}map_projection_string" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"geogCode",
"geogAreaName",
"centerLat",
"centerLon",
"lowerLeftLat",
"lowerLeftLon",
"upperRightLat",
"upperRightLon",
"mapProjectionString"
})
@XmlRootElement(name = "geographical_data")
public class GeographicalData {
@XmlElement(name = "geog_code")
protected String geogCode;
@XmlElement(name = "geog_area_name")
protected String geogAreaName;
@XmlElement(name = "center_lat")
protected Float centerLat;
@XmlElement(name = "center_lon")
protected Float centerLon;
@XmlElement(name = "lower_left_lat")
protected Float lowerLeftLat;
@XmlElement(name = "lower_left_lon")
protected Float lowerLeftLon;
@XmlElement(name = "upper_right_lat")
protected Float upperRightLat;
@XmlElement(name = "upper_right_lon")
protected Float upperRightLon;
@XmlElement(name = "map_projection_string")
protected String mapProjectionString;
/**
* Gets the value of the geogCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getGeogCode() {
return geogCode;
}
/**
* Sets the value of the geogCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setGeogCode(String value) {
this.geogCode = value;
}
/**
* Gets the value of the geogAreaName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getGeogAreaName() {
return geogAreaName;
}
/**
* Sets the value of the geogAreaName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setGeogAreaName(String value) {
this.geogAreaName = value;
}
/**
* Gets the value of the centerLat property.
*
* @return
* possible object is
* {@link Float }
*
*/
public Float getCenterLat() {
return centerLat;
}
/**
* Sets the value of the centerLat property.
*
* @param value
* allowed object is
* {@link Float }
*
*/
public void setCenterLat(Float value) {
this.centerLat = value;
}
/**
* Gets the value of the centerLon property.
*
* @return
* possible object is
* {@link Float }
*
*/
public Float getCenterLon() {
return centerLon;
}
/**
* Sets the value of the centerLon property.
*
* @param value
* allowed object is
* {@link Float }
*
*/
public void setCenterLon(Float value) {
this.centerLon = value;
}
/**
* Gets the value of the lowerLeftLat property.
*
* @return
* possible object is
* {@link Float }
*
*/
public Float getLowerLeftLat() {
return lowerLeftLat;
}
/**
* Sets the value of the lowerLeftLat property.
*
* @param value
* allowed object is
* {@link Float }
*
*/
public void setLowerLeftLat(Float value) {
this.lowerLeftLat = value;
}
/**
* Gets the value of the lowerLeftLon property.
*
* @return
* possible object is
* {@link Float }
*
*/
public Float getLowerLeftLon() {
return lowerLeftLon;
}
/**
* Sets the value of the lowerLeftLon property.
*
* @param value
* allowed object is
* {@link Float }
*
*/
public void setLowerLeftLon(Float value) {
this.lowerLeftLon = value;
}
/**
* Gets the value of the upperRightLat property.
*
* @return
* possible object is
* {@link Float }
*
*/
public Float getUpperRightLat() {
return upperRightLat;
}
/**
* Sets the value of the upperRightLat property.
*
* @param value
* allowed object is
* {@link Float }
*
*/
public void setUpperRightLat(Float value) {
this.upperRightLat = value;
}
/**
* Gets the value of the upperRightLon property.
*
* @return
* possible object is
* {@link Float }
*
*/
public Float getUpperRightLon() {
return upperRightLon;
}
/**
* Sets the value of the upperRightLon property.
*
* @param value
* allowed object is
* {@link Float }
*
*/
public void setUpperRightLon(Float value) {
this.upperRightLon = value;
}
/**
* Gets the value of the mapProjectionString property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMapProjectionString() {
return mapProjectionString;
}
/**
* Sets the value of the mapProjectionString property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMapProjectionString(String value) {
this.mapProjectionString = value;
}
}

View file

@ -0,0 +1,61 @@
package gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
/**
*<pre>
*
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 29-Sep-2009 171 Archana Initial Creation
* </pre>
*
* @author Archana
* @version 1
*/
public class GeographicalDataReader {
private final String PACKAGE = "gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea";
// Default table location
private String xmlFile = "res/geog.xml";
public GeographicalDataReader() {
}
public GeographicalDataReader(String file) {
xmlFile = file;
}
public List<GeographicalData> getGeographicalData() throws JAXBException{
JAXBContext context = JAXBContext.newInstance(
PACKAGE);
Unmarshaller unmarshaller = context.createUnmarshaller();
GeogCodeList gclist = null;
try {
gclist = (GeogCodeList)unmarshaller.unmarshal(
new FileReader(xmlFile));
List<GeographicalData> listOfItems = gclist.getGeographicalData();
return listOfItems;
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return null;
}
}

View file

@ -0,0 +1,379 @@
package gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea;
/**
*<pre>
*
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 23-Sep-2009 171 Archana Initial Creation
* </pre>
*
* @author Archana
* @version 1
*/
public class MapProjection {
/**
* @param args
*/
private String projection_data_str, map_projection_str, projection_class;
private Float angle1, angle2, angle3;
private Integer l_margin, r_margin, t_margin, b_margin;
private boolean map_projection_str_valid;
private enum Simple_map_projection{MER,NPS,SPS,LCC,SCC,CED,MCD,NOR,SOR}
private enum CYL{MER,CED,MCD}
private enum AZM{STR,AED,ORT,LEA,GNO}
private enum CON{LCC,SCC}
//private enum Graph_projections{LIN,LOG,KAP,POL}
/**
*The overloaded constructor accepts as input - a string 's' containing the projection data.
*It initializes the 3 angles and the 4 margins to invalid values.
*It then invokes a method called setProjectionString() with the input string and uses the boolean
*value returned by this method to set the flag 'map_projection_str_valid'.
*/
public MapProjection(String s){
angle1 = -500.0f;
angle2 = -500.0f;
angle3 = -500.0f;
l_margin = -1000;
r_margin = -1000;
t_margin = -1000;
b_margin = -1000;
map_projection_str_valid = parseMapProjectionString(s);
}
/**
* The method isProjectionStringValid() returns the value of the boolean flag 'map_projection_str_valid'.
* This method should be invoked before using the data 'map_projection_str' or 'projection_class'.
*/
public boolean isProjectionStringValid(){
return map_projection_str_valid;
}
private boolean parseMapProjectionString(String s){
String[] projection_string_tokens, angle_tokens, margin_tokens;
projection_string_tokens = s.split("/");
boolean angle_flag;
boolean margin_flag;
System.out.println("###projection_string_tokens[0] = "+projection_string_tokens[0]);
// boolean str_flag = setProjectionString(projection_string_tokens[0]);
setProjectionString(projection_string_tokens[0]);
if(projection_string_tokens.length == 2){
angle_flag = this.setProjectionAngles(projection_string_tokens[1], ";");
}
if(projection_string_tokens.length == 3){
margin_flag = this.setProjectionMargins(projection_string_tokens[2], ";");
}
if(projection_string_tokens.length == 3 ){
this.map_projection_str = projection_string_tokens[0];
if(map_projection_str.length()==3){
for(CYL cyl: CYL.values()){
if(map_projection_str.equals(cyl.toString())){
this.projection_class = "CYL";
this.map_projection_str = projection_string_tokens[0];
break;
// flag = true;
}
}
for(AZM azm: AZM.values()){
//System.out.println("under AZM zone, azm.toString()="+azm.toString());
//System.out.println("under AZM zone, map_projection_str="+map_projection_str);
if(map_projection_str.equals(azm.toString())){
this.projection_class = "AZM";
this.map_projection_str = projection_string_tokens[0];
break;
// flag = true;
}
}
for(CON con: CON.values()){
if(map_projection_str.equals(con.toString())){
this.projection_class = "CON";
this.map_projection_str = projection_string_tokens[0];
break;
// flag = true;
}
}
if(projection_string_tokens[1].length() > 0){
angle_tokens=projection_string_tokens[1].split(";");
if(angle_tokens.length > 0){
if(angle_tokens.length<3){
//TODO Send a message to indicate that there are less than 3 angles.
// flag = false;
}
else if(angle_tokens.length>3){
//TODO Send a message to indicate that there are more than 3 angles.
// flag = false;
}
else{
angle1 = Float.valueOf(angle_tokens[0]).floatValue();
angle2 = Float.valueOf(angle_tokens[1]).floatValue();
angle3 = Float.valueOf(angle_tokens[2]).floatValue();
}
}
else{
// flag = false;
}
}
else{
//TODO Send a message to indicate that there are NO angles.
// flag = false;
}
if(projection_string_tokens[2].length() != 0){
margin_tokens = projection_string_tokens[2].split(";");
// if((margin_tokens.length != 0) && (margin_tokens.length == 4)){
if(margin_tokens.length == 4){
l_margin= Integer.valueOf(margin_tokens[0]).intValue();
b_margin= Integer.valueOf(margin_tokens[1]).intValue();
r_margin= Integer.valueOf(margin_tokens[2]).intValue();
t_margin= Integer.valueOf(margin_tokens[3]).intValue();
}
else{
//If no margins are specified (using the code NM), the 4 margin values are set to 0.
if(projection_string_tokens[2].equals("NM")){
this.setProjectionMargins("0, 0, 0, 0", ",");
}
}
}
else{
// flag = false;
}
}
}
else{
// flag = false;
}
return true;
}
private boolean setProjectionString(String s){
boolean proj_str_set = false;
//TODO If the projection string is blank,
//check if the GAREA coordinates have a pre-defined projection in the geog table:
if(s.length() == 0){
this.map_projection_str =s;
proj_str_set = true;
}
//TODO If projection string is DEF,
//check if the GAREA coordinates have a pre-defined projection in the geog table
//else use current map projection
if(s.equals("DEF")){
this.map_projection_str =s;
proj_str_set = true;
}
//TO DO May have to add code for the image drop flag
/*else if(s.equals("SAT")||s.equals("RAD")){
this.map_projection_str =s;
proj_str_set = true;
}*/
else{
//Assign default values for the angles and the margins, in the case of a Simple Map Projection
if((s.length()== 3)) {
for(Simple_map_projection smp: Simple_map_projection.values()){
if(s.equals(smp.toString())){
//The three angles are initialized to random values.
this.setProjectionAngles("0, 0, 0", ",");
//TODO The default value of the margins is 0,3,0,0 in the map mode but it is 6,4,4,1 in the graph mode
// May have to add logic to set the default margins in the graph mode.
this.setProjectionMargins("0;3;0;0", ";");
this.map_projection_str =s;
proj_str_set = true;
break;
}
}
//TODO Find out what needs to be done for Graph Projections, once the design decisions are resolved.
/*for(Graph_projections gp: Graph_projections.values()){
if(s.equals(gp.toString())){
this.map_projection_str =s;
proj_str_set = true;
}
}*/
}
else if(s.length()<3 && s.length()>0){
proj_str_set = false;
}
else{
this.projection_data_str = s;
proj_str_set = parseMapProjectionString(projection_data_str);
}
}
System.out.println("### right before return, map_projection_str="+map_projection_str);
return proj_str_set;
}
/**
*The method getProjectionString() returns a String object containing the value of the projection string.
*/
public String getProjectionString(){
// System.out.println("Projection String =" + map_projection_str);
return this.map_projection_str;
}
/**
*The method getProjectionClass() returns a String object containing the value of the projection class.
*/
public String getProjectionClass(){
System.out.println("Projection String =" + projection_class);
return this.projection_class;
}
/**
*The method setProjectionMargins() accepts 4 integer values to set the margin values
*in the following order- left, bottom, right, top.
*/
public boolean setProjectionMargins(String s, String parseString){
System.out.println("within setProjectionMargins, input s="+s);
System.out.println("within setProjectionMargins, input s.length="+s.length());
System.out.println("within setProjectionMargins, input parseString="+parseString);
boolean margin_flag = false;
if(!s.equals("NM") && !s.equals("N")){
System.out.println("within setProjectionMargins, under !s.equals(\"NM\") logic");
// String margin_tokens[] = s.split(";");
String margin_tokens[] = s.split(parseString);
int margin;
if(margin_tokens[0].length() > 0){
margin = Integer.valueOf(margin_tokens[0]).intValue();
if(margin >= 0)
this.l_margin = margin;
}
if(margin_tokens[1].length() > 0){
margin= Integer.valueOf(margin_tokens[1].trim()).intValue();
if(margin >= 0)
this.b_margin = margin;
}
if(margin_tokens[2].length() > 0){
margin= Integer.valueOf(margin_tokens[2].trim()).intValue();
if(margin >= 0)
this.r_margin = margin;
}
if(margin_tokens[3].length() > 0){
margin= Integer.valueOf(margin_tokens[3].trim()).intValue();
if(margin >= 0)
this.t_margin = margin;
}
if(this.l_margin != -1000 &&
this.b_margin != -1000 &&
this.r_margin != -1000 &&
this.t_margin != -1000){
margin_flag = true;
}
}
else{
System.out.println("within setProjectionMargins, under teh else loop of !s.equals(\"NM\") logic");
this.l_margin = 0;
this.b_margin = 0;
this.r_margin = 0;
this.t_margin = 0;
margin_flag = true;
}
return margin_flag;
}
/**
*The method getProjectionMargins() returns an array of Integer objects containing the values of the margins
*in the following order: left, bottom, right, top.
*/
public Integer[] getProjectionMargins(){
Integer[] margins = new Integer[4];
margins[0] = this.l_margin;
margins[1] = this.b_margin;
margins[2] = this.r_margin;
margins[3] = this.t_margin;
return margins;
}
/**
*The method setProjectionAngles() sets the values of the 3 angles used in the projection.
*/
private boolean setProjectionAngles(String s, String parseString){
// String angle_tokens[] = s.split(";");
String angle_tokens[] = s.split(parseString);
float angle_val;
boolean angle_set = false;
if(angle_tokens.length > 0){
if(angle_tokens[0].length() > 0){
angle_val = Float.valueOf(angle_tokens[0]).floatValue();
if(angle_val >= -90.0 && angle_val <= 90.0 )
this.angle1 = angle_val;
}
if(angle_tokens[1].length() > 0){
angle_val = Float.valueOf(angle_tokens[1]).floatValue();
if(angle_val >= -180.0 && angle_val <= 360.0 )
this.angle2 = angle_val;
}
if(angle_tokens[2].length() > 0){
angle_val = Float.valueOf(angle_tokens[2]).floatValue();
if(angle_val >= 0.0 && angle_val <= 360.0)
this.angle3=angle_val;
}
if(this.angle1 != -500.0 && this.angle2 != -500.0 && this.angle3 != -500.0)
angle_set = true;
System.out.println("angle1 ="+ this.angle1 + "\nangle2="+angle2 + "\nangle3="+angle3);
}
return angle_set;
}
/**
*The method getProjectionAngles() returns an array containing the values of the 3 angles
*used in the projection.
*/
public Float[] getProjectionAngles(){
Float[] angles = new Float[3];
angles[0] = this.angle1;
angles[1] = this.angle2;
angles[2] = this.angle3;
return angles;
}
}

View file

@ -0,0 +1,148 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2009.09.29 at 09:13:32 AM EDT
//
package gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the gov.noaa.nws.ncep.viz.tools.customdialog package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _GeogCode_QNAME = new QName("", "geog_code");
private final static QName _LowerLeftLon_QNAME = new QName("", "lower_left_lon");
private final static QName _UpperRightLat_QNAME = new QName("", "upper_right_lat");
private final static QName _GeogAreaName_QNAME = new QName("", "geog_area_name");
private final static QName _LowerLeftLat_QNAME = new QName("", "lower_left_lat");
private final static QName _MapProjectionString_QNAME = new QName("", "map_projection_string");
private final static QName _CenterLat_QNAME = new QName("", "center_lat");
private final static QName _UpperRightLon_QNAME = new QName("", "upper_right_lon");
private final static QName _CenterLon_QNAME = new QName("", "center_lon");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: gov.noaa.nws.ncep.viz.tools.customdialog
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link GeogCodeList }
*
*/
public GeogCodeList createGeogCodeList() {
return new GeogCodeList();
}
/**
* Create an instance of {@link GeographicalData }
*
*/
public GeographicalData createGeographicalData() {
return new GeographicalData();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "geog_code")
public JAXBElement<String> createGeogCode(String value) {
return new JAXBElement<String>(_GeogCode_QNAME, String.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Float }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "lower_left_lon")
public JAXBElement<Float> createLowerLeftLon(Float value) {
return new JAXBElement<Float>(_LowerLeftLon_QNAME, Float.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Float }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "upper_right_lat")
public JAXBElement<Float> createUpperRightLat(Float value) {
return new JAXBElement<Float>(_UpperRightLat_QNAME, Float.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "geog_area_name")
public JAXBElement<String> createGeogAreaName(String value) {
return new JAXBElement<String>(_GeogAreaName_QNAME, String.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Float }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "lower_left_lat")
public JAXBElement<Float> createLowerLeftLat(Float value) {
return new JAXBElement<Float>(_LowerLeftLat_QNAME, Float.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "map_projection_string")
public JAXBElement<String> createMapProjectionString(String value) {
return new JAXBElement<String>(_MapProjectionString_QNAME, String.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Float }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "center_lat")
public JAXBElement<Float> createCenterLat(Float value) {
return new JAXBElement<Float>(_CenterLat_QNAME, Float.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Float }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "upper_right_lon")
public JAXBElement<Float> createUpperRightLon(Float value) {
return new JAXBElement<Float>(_UpperRightLon_QNAME, Float.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Float }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "center_lon")
public JAXBElement<Float> createCenterLon(Float value) {
return new JAXBElement<Float>(_CenterLon_QNAME, Float.class, null, value);
}
}

View file

@ -0,0 +1,29 @@
package gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea;
import java.util.List;
public class TestGeogDataTable {
/**
* @param args
*/
public static void main(String args[]) throws Exception{
GeographicalDataReader my_geog_data_reader = new GeographicalDataReader("res/geog.xml");
List<GeographicalData> list = my_geog_data_reader.getGeographicalData();
for(GeographicalData itm : list){
System.out.println("Geographical Area Code = " + itm.getGeogCode() +
"\n Geographical Area Descriptor = " + itm.getGeogAreaName() +
"\n Center Latitude = " + itm.getCenterLat() +
"\n Center Longitude = " + itm.getCenterLon() +
"\n Lower Left Latitude = " + itm.getLowerLeftLat() +
"\n Lower Left Longitude = " + itm.getLowerLeftLon() +
"\n Upper Right Latitude = " + itm.getUpperRightLat() +
"\n Upper Right Longitude = " + itm.getUpperRightLon() +
"\n Map Projection String = " + itm.getMapProjectionString()
);
}
}
}

View file

@ -0,0 +1,158 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2009.10.01 at 01:42:02 PM EDT
//
package gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea.station;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the gov.noaa.nws.ncep.viz.tools.customdialog.sfstns package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _Stid_QNAME = new QName("", "stid");
private final static QName _Stnnum_QNAME = new QName("", "stnnum");
private final static QName _Location_QNAME = new QName("", "location");
private final static QName _Priority_QNAME = new QName("", "priority");
private final static QName _Elevation_QNAME = new QName("", "elevation");
private final static QName _State_QNAME = new QName("", "state");
private final static QName _Longitude_QNAME = new QName("", "longitude");
private final static QName _Stnname_QNAME = new QName("", "stnname");
private final static QName _Latitude_QNAME = new QName("", "latitude");
private final static QName _Country_QNAME = new QName("", "country");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: gov.noaa.nws.ncep.viz.tools.customdialog.sfstns
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link Station }
*
*/
public Station createStation() {
return new Station();
}
/**
* Create an instance of {@link StationList }
*
*/
public StationList createStationList() {
return new StationList();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "stid")
public JAXBElement<String> createStid(String value) {
return new JAXBElement<String>(_Stid_QNAME, String.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "stnnum")
public JAXBElement<String> createStnnum(String value) {
return new JAXBElement<String>(_Stnnum_QNAME, String.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "location")
public JAXBElement<String> createLocation(String value) {
return new JAXBElement<String>(_Location_QNAME, String.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "priority")
public JAXBElement<Integer> createPriority(Integer value) {
return new JAXBElement<Integer>(_Priority_QNAME, Integer.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "elevation")
public JAXBElement<Integer> createElevation(Integer value) {
return new JAXBElement<Integer>(_Elevation_QNAME, Integer.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "state")
public JAXBElement<String> createState(String value) {
return new JAXBElement<String>(_State_QNAME, String.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Float }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "longitude")
public JAXBElement<Float> createLongitude(Float value) {
return new JAXBElement<Float>(_Longitude_QNAME, Float.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "stnname")
public JAXBElement<String> createStnname(String value) {
return new JAXBElement<String>(_Stnname_QNAME, String.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Float }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "latitude")
public JAXBElement<Float> createLatitude(Float value) {
return new JAXBElement<Float>(_Latitude_QNAME, Float.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*
*/
@XmlElementDecl(namespace = "", name = "country")
public JAXBElement<String> createCountry(String value) {
return new JAXBElement<String>(_Country_QNAME, String.class, null, value);
}
}

View file

@ -0,0 +1,312 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2009.10.01 at 01:42:02 PM EDT
//
package gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea.station;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element ref="{}stid" minOccurs="0"/>
* &lt;element ref="{}stnnum" minOccurs="0"/>
* &lt;element ref="{}stnname" minOccurs="0"/>
* &lt;element ref="{}state" minOccurs="0"/>
* &lt;element ref="{}country" minOccurs="0"/>
* &lt;element ref="{}latitude" minOccurs="0"/>
* &lt;element ref="{}longitude" minOccurs="0"/>
* &lt;element ref="{}elevation" minOccurs="0"/>
* &lt;element ref="{}priority" minOccurs="0"/>
* &lt;element ref="{}location" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"stid",
"stnnum",
"stnname",
"state",
"country",
"latitude",
"longitude",
"elevation",
"priority",
"location"
})
@XmlRootElement(name = "station")
public class Station {
protected String stid;
protected String stnnum;
protected String stnname;
protected String state;
protected String country;
protected Float latitude;
protected Float longitude;
protected Integer elevation;
protected Integer priority;
protected String location;
/**
* Gets the value of the stid property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getStid() {
return stid;
}
/**
* Sets the value of the stid property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStid(String value) {
this.stid = value;
}
/**
* Gets the value of the stnnum property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getStnnum() {
return stnnum;
}
/**
* Sets the value of the stnnum property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStnnum(String value) {
this.stnnum = value;
}
/**
* Gets the value of the stnname property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getStnname() {
return stnname;
}
/**
* Sets the value of the stnname property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStnname(String value) {
this.stnname = value;
}
/**
* Gets the value of the state property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getState() {
return state;
}
/**
* Sets the value of the state property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setState(String value) {
this.state = value;
}
/**
* Gets the value of the country property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCountry() {
return country;
}
/**
* Sets the value of the country property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCountry(String value) {
this.country = value;
}
/**
* Gets the value of the latitude property.
*
* @return
* possible object is
* {@link Float }
*
*/
public Float getLatitude() {
return latitude;
}
/**
* Sets the value of the latitude property.
*
* @param value
* allowed object is
* {@link Float }
*
*/
public void setLatitude(Float value) {
this.latitude = value;
}
/**
* Gets the value of the longitude property.
*
* @return
* possible object is
* {@link Float }
*
*/
public Float getLongitude() {
return longitude;
}
/**
* Sets the value of the longitude property.
*
* @param value
* allowed object is
* {@link Float }
*
*/
public void setLongitude(Float value) {
this.longitude = value;
}
/**
* Gets the value of the elevation property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getElevation() {
return elevation;
}
/**
* Sets the value of the elevation property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setElevation(Integer value) {
this.elevation = value;
}
/**
* Gets the value of the priority property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getPriority() {
return priority;
}
/**
* Sets the value of the priority property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setPriority(Integer value) {
this.priority = value;
}
/**
* Gets the value of the location property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLocation() {
return location;
}
/**
* Sets the value of the location property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLocation(String value) {
this.location = value;
}
}

View file

@ -0,0 +1,61 @@
package gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea.station;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
/**
*<pre>
*
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 01-Oct-2009 171 Archana Initial Creation
* </pre>
*
* @author Archana
* @version 1
*/
public class StationDataReader {
private final String PACKAGE = "gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea.station";
// Default table location
private String xmlFile = "res/sfstns.xml";
public StationDataReader() {
}
public StationDataReader(String file) {
xmlFile = file;
}
public List<Station> getStationData() throws JAXBException{
JAXBContext context = JAXBContext.newInstance(
PACKAGE);
Unmarshaller unmarshaller = context.createUnmarshaller();
StationList sfstnlist = null;
try {
sfstnlist = (StationList)unmarshaller.unmarshal(
new FileReader(xmlFile));
List<Station> listOfItems = sfstnlist.getStation();
return listOfItems;
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return null;
}
}

View file

@ -0,0 +1,76 @@
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2009.10.01 at 01:42:02 PM EDT
//
package gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea.station;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element ref="{}station" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"station"
})
@XmlRootElement(name = "stationList")
public class StationList {
protected List<Station> station;
/**
* Gets the value of the station property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the station property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getStation().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Station }
*
*
*/
public List<Station> getStation() {
if (station == null) {
station = new ArrayList<Station>();
}
return this.station;
}
}

View file

@ -0,0 +1,29 @@
package gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea.station;
import java.util.List;
public class TestStationsTable {
/**
* @param args
*/
public static void main(String args[]) throws Exception{
StationDataReader my_sfstns_data_reader = new StationDataReader("res/sfstns.xml");
List<Station> list = my_sfstns_data_reader.getStationData();
for(Station itm : list){
System.out.println(" Station Id = " + itm.getStid() +
" Station Number = " + itm.getStnnum()+
" Station Name = " + itm.getStnname()+
" State ID = " + itm.getState()+
" Country ID = " + itm.getCountry()+
" Latitude = " + itm.getLatitude()+
" Longitude = " + itm.getLongitude()+
" Station Elevation = " + itm.getElevation() +
" Priority = " + itm.getPriority()
);
}
}
}

View file

@ -0,0 +1,41 @@
/**
* Date created (07 June 2010)
*
* This code has been developed by the SIB for use in the AWIPS2 system.
*/
package gov.noaa.nws.ncep.gempak.parameters.core.util;
/**
* Provides utility functions additional to Java's String class.
* <pre>
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 07-June-2010 211 Archana.S Initial Creation
* 10-June-2010 211 Archana.S Updated the method to
* use String class's
* replaceAll() and trim()
* methods.
* Updated the Javadoc.
* </pre>
* @author Archana.S
* @version 1
*/
public class StringUtil {
/**
* Given an input string with blanks, the same string is returned without any blank
* characters
* <p>
* The method <tt>removeBlanksWithinString</tt> invokes the String class's
* replaceAll() method with the regular expression for white-spaces
* to replace all whitespace characters with an empty string
* and then calls the trim() method of the String class to remove
* any leading and trailing white-spaces.
* @param inputString - the string with blanks
* @return the input string without any blanks
*/
public static String removeBlanksWithinString(String dlinesString) {
return dlinesString.replaceAll("\\s+","").trim();
}
}

View file

@ -0,0 +1,364 @@
package gov.noaa.nws.ncep.gempak.parameters.core.categorymap;
import static org.junit.Assert.*;
import gov.noaa.nws.ncep.gempak.parameters.core.categorymap.CatMap;
import org.junit.Test;
/**<pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 16-Nov-2009 194 Archana.S Initial Creation
* 20-Nov-2009 194 Archana.S Updated per review comments:
* Added a test-case to retrieve the label
* given a value
* Updated method names per design changes in the class
* CATMAP
*
* </pre>
* @author Archana.S
* @version 1<p>
{@link gov.noaa.nws.ncep.gempak.parameters.core.categorymap.CatMap}.
*/
public class CATMAPTest {
private static int testCaseNumber;
/**
*Test for valid label/value pair
*/
@Test
public void testGetValueForLabel() {
testCaseNumber=1;
CatMap catmap = new CatMap("ABC=4;acd=2;lmn=0.5");
assertEquals(catmap.getMatchingValueForLabel("abc"),4.0);
assertEquals(catmap.getMatchingValueForLabel("ABC"),4.0);
assertEquals(catmap.getMatchingValueForLabel("LmN"),0.5);
System.out.println("=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("Test for valid label/value pairs without wild-card");
System.out.println("The input string = "+catmap.getCategoricalMappingString());
System.out.println("The value for label ABC = "+ catmap.getMatchingValueForLabel("ABC"));
System.out.println("The value for label abc = "+ catmap.getMatchingValueForLabel("abc"));
System.out.println("The value for label LmN = "+ catmap.getMatchingValueForLabel("LmN"));
testCaseNumber++;
}
/**
*Test to retrieve matching label given a floating point value
*/
@Test
public void testGetLabelForValue() {
CatMap catmap = new CatMap("ABC=4;acd=2;lmn=0.5;efg=2;hij=2");
assertEquals(catmap.getMatchingLabelForValue(0.5f),"lmn");
assertEquals(catmap.getMatchingLabelForValue(4f),"ABC");
assertEquals(catmap.getMatchingLabelForValue(2f),"acd");
System.out.println("=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("Test for getting the matching label, given a floating point value");
System.out.println("The input string = "+catmap.getCategoricalMappingString());
System.out.println("The label for the value 4 = "+ catmap.getMatchingLabelForValue(4f));
System.out.println("The label for the value 0.5 = "+ catmap.getMatchingLabelForValue(0.5f));
System.out.println("The label for the value 2 = "+ catmap.getMatchingLabelForValue(2f));
testCaseNumber++;
}
/**
*Test to retrieve the label for a floating point value not in the list
*/
@Test
public void testGetLabelForNonExistentValue() {
CatMap catmap = new CatMap("ABC=4;acd=2;lmn=0.5;efg=2;hij=2");
assertEquals(catmap.getMatchingLabelForValue(0.00005f),null);
System.out.println("=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("Test for getting the matching label, given a floating point value not in the list");
System.out.println("The input string = "+catmap.getCategoricalMappingString());
System.out.println("The label for the value 0.00005 = "+ catmap.getMatchingLabelForValue(0.00005f));
testCaseNumber++;
}
/**
*Test for valid label with a wild-card character
*/
@Test
public void testGetValueForWildcardLabel() {
CatMap catmap = new CatMap("Abc=4;a*=0.5;acd=2");
assertEquals(catmap.getMatchingValueForLabel("abc"),4.0);
assertEquals(catmap.getMatchingValueForLabel("ACD"),0.5);
assertEquals(catmap.getMatchingValueForLabel("A*"),0.5);
System.out.println("\n=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("Test for valid label/value pairs with a wild-card label included");
System.out.println("The input string = "+catmap.getCategoricalMappingString());
System.out.println("The value for label ABC = "+ catmap.getMatchingValueForLabel("ABC"));
System.out.println("The value for label aCD = "+ catmap.getMatchingValueForLabel("aCD"));
System.out.println("The value for label a = "+ catmap.getMatchingValueForLabel("a"));
testCaseNumber++;
}
/**
*Test CATMAP String with invalid delimiters
*/
@Test
public void testInvalidDelimiter() {
CatMap catmap = new CatMap("Abc=4:a*=0.5:acd=2");
assertEquals(catmap.getMatchingValueForLabel("abc"),Float.NaN);
assertEquals(catmap.getMatchingValueForLabel("ACD"),Float.NaN);
assertEquals(catmap.getMatchingValueForLabel("A*"),Float.NaN);
System.out.println("\n=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("Test for invalid delimiters");
System.out.println("The input string = "+catmap.getCategoricalMappingString());
System.out.println("The value for label ABC = "+ catmap.getMatchingValueForLabel("ABC"));
System.out.println("The value for label aCD = "+ catmap.getMatchingValueForLabel("aCD"));
System.out.println("The value for label a = "+ catmap.getMatchingValueForLabel("a"));
testCaseNumber++;
}
/**
* Test CATMAP String without '=' character between label/value pairs
*/
@Test
public void testCATMAPStringWithoutEqualToSign() {
CatMap catmap = new CatMap("Abc-4;a*-0.5;acd+2");
assertEquals(catmap.getMatchingValueForLabel("abc"),Float.NaN);
assertEquals(catmap.getMatchingValueForLabel("ACD"),Float.NaN);
assertEquals(catmap.getMatchingValueForLabel("A*"),Float.NaN);
System.out.println("\n=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("Test for missing '=' character");
System.out.println("The input string = "+catmap.getCategoricalMappingString());
System.out.println("The value for label ABC = "+ catmap.getMatchingValueForLabel("ABC"));
System.out.println("The value for label aCD = "+ catmap.getMatchingValueForLabel("aCD"));
System.out.println("The value for label a = "+ catmap.getMatchingValueForLabel("a"));
testCaseNumber++;
}
/**
* Test empty CATMAP String
*/
@Test
public void testEmptyCATMAPString(){
CatMap catmap = new CatMap("");
System.out.println("\n=====================Test-Case "+testCaseNumber+"a ========================");
System.out.println("Test for empty input string");
System.out.println("The input string = "+catmap.getCategoricalMappingString());
System.out.println("The value for label \"\" = "+ catmap.getMatchingValueForLabel(""));
CatMap catmap3 = new CatMap(null);
System.out.println("\n=====================Test-Case "+testCaseNumber+"b ========================");
System.out.println("Test for null string");
System.out.println("The input string = "+catmap3.getCategoricalMappingString());
System.out.println("The value for null string = "+ catmap3.getMatchingValueForLabel(null));
CatMap catmap4 = new CatMap(" ");
System.out.println("\n=====================Test-Case "+testCaseNumber+"c ========================");
System.out.println("Test for string with only blanks");
System.out.println("The input string = "+catmap4.getCategoricalMappingString());
System.out.println("The value for string with only blanks= "+ catmap4.getMatchingValueForLabel(" "));
testCaseNumber++;
}
/**
* Test CATMAP String with a missing label
*/
@Test
public void testMissingLabel(){
CatMap catmap = new CatMap("Abc=4;bingo=-0.5; =2");
assertEquals(catmap.getMatchingValueForLabel("abc"),4.0);
assertEquals(catmap.getMatchingValueForLabel("bINgO"),-0.5);
assertEquals(catmap.getMatchingValueForLabel(" "),Float.NaN);
System.out.println("\n=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("Test for missing Label");
System.out.println("The input string = "+catmap.getCategoricalMappingString());
System.out.println("The value for label ABC = "+ catmap.getMatchingValueForLabel("ABC"));
System.out.println("The value for label bINgO = "+ catmap.getMatchingValueForLabel("bINgO"));
System.out.println("The value for the missing label= "+ catmap.getMatchingValueForLabel(" "));
testCaseNumber++;
}
/**
* Test CATMAP String with a missing value
*/
@Test
public void testMissingValue(){
CatMap catmap = new CatMap("Abc= ;bingo=-.5;label3=2");
assertEquals(catmap.getMatchingValueForLabel("abc"),Float.NaN);
assertEquals(catmap.getMatchingValueForLabel("bINgO"),-0.5);
assertEquals(catmap.getMatchingValueForLabel("label3"),2);
System.out.println("\n=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("Test for missing value");
System.out.println("The input string = "+catmap.getCategoricalMappingString());
System.out.println("The value for label ABC = "+ catmap.getMatchingValueForLabel("ABC"));
System.out.println("The value for label bINgO = "+ catmap.getMatchingValueForLabel("bINgO"));
System.out.println("The value for the label3= "+ catmap.getMatchingValueForLabel("label3"));
testCaseNumber++;
}
/**
* Test CATMAP string with a missing label and a missing value
*/
@Test
public void testMissingValueAndLabel(){
CatMap catmap = new CatMap("Abc=99.99999; = ;bingo=-.5");
assertEquals(catmap.getMatchingValueForLabel("abc"),99.99999);
assertEquals(catmap.getMatchingValueForLabel("bINgO"),-0.5);
assertEquals(catmap.getMatchingValueForLabel(" "),Float.NaN);
System.out.println("\n=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("Test for missing label and value");
System.out.println("The input string = "+catmap.getCategoricalMappingString());
System.out.println("The value for label ABC = "+ catmap.getMatchingValueForLabel("ABC"));
System.out.println("The value for label bINgO = "+ catmap.getMatchingValueForLabel("bINgO"));
System.out.println("The value for the missing label= "+ catmap.getMatchingValueForLabel(" "));
testCaseNumber++;
}
/**
* Test CATMAP string with missing label/value pairs
*/
@Test
public void testMissingLabelValuePairs(){
CatMap catmap = new CatMap("Abc=99.99999;;;;bingo=-.5");
assertEquals(catmap.getMatchingValueForLabel("abc"),99.99999);
assertEquals(catmap.getMatchingValueForLabel("bINgO"),-0.5);
System.out.println("\n=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("Test with missing label/value pairs");
System.out.println("The input string = "+catmap.getCategoricalMappingString());
System.out.println("The value for label ABC = "+ catmap.getMatchingValueForLabel("ABC"));
System.out.println("The value for label bINgO = "+ catmap.getMatchingValueForLabel("bINgO"));
testCaseNumber++;
}
/**
* Test CATMAP string with non-numeric data for value
*/
@Test
public void testNonNumericDataForValue(){
CatMap catmap = new CatMap("Abc=99acd.99999;bingo=-.5");
assertEquals(catmap.getMatchingValueForLabel("abc"),Float.NaN);
assertEquals(catmap.getMatchingValueForLabel("bINgO"),Float.NaN);
System.out.println("\n=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("Test for non-numeric characters in the value");
System.out.println("The input string = "+catmap.getCategoricalMappingString());
System.out.println("The value for label ABC = "+ catmap.getMatchingValueForLabel("ABC"));
System.out.println("The value for label bINgO = "+ catmap.getMatchingValueForLabel("bINgO"));
testCaseNumber++;
}
/**
* Test CATMAP string with multiple '=' characters
*/
@Test
public void testMultipleEqualToCharaters(){
CatMap catmap = new CatMap("Abc=99;bingo==-.5");
assertEquals(catmap.getMatchingValueForLabel("abc"),99);
assertEquals(catmap.getMatchingValueForLabel("bINgO"),Float.NaN);
System.out.println("\n=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("Test for multiple '=' characters");
System.out.println("The input string = "+catmap.getCategoricalMappingString());
System.out.println("The value for label ABC = "+ catmap.getMatchingValueForLabel("ABC"));
System.out.println("The value for label bingo = "+ catmap.getMatchingValueForLabel("bingo"));
testCaseNumber++;
}
/**
* Test CATMAP string with labels containing punctuation symbols
*/
@Test
public void testLabelWithPunctuationSymbols(){
CatMap catmap = new CatMap("@!'Ab#c=99;@#$%^=19.08");
assertEquals(catmap.getMatchingValueForLabel("@!'Ab#c"),99);
assertEquals(catmap.getMatchingValueForLabel("@#$%^"),19.08);
System.out.println("\n=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("Test for labels containing punctuation symbols");
System.out.println("The input string = "+catmap.getCategoricalMappingString()+"\n");
System.out.println("The value for label ABC = "+ catmap.getMatchingValueForLabel("@!'Ab#c"));
System.out.println("The value for label bINgO = "+ catmap.getMatchingValueForLabel("@#$%^"));
testCaseNumber++;
}
/**
* Test valid CATMAP string with blanks between labels and values
*/
@Test
public void testCATMAPStringWithBlanksBetweenLabelsAndValues(){
CatMap catmap = new CatMap(" @!'Ab#c = 99 ; @#$%^ = 19.08 ");
assertEquals(catmap.getMatchingValueForLabel("@!'Ab#c"),99);
assertEquals(catmap.getMatchingValueForLabel("@#$%^"),19.08);
System.out.println("\n=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("Test for string containing blanks between labels and values");
System.out.println("The input string = "+catmap.getCategoricalMappingString()+"\n");
System.out.println("The value for label ABC = "+ catmap.getMatchingValueForLabel("@!'Ab#c"));
System.out.println("The value for label bINgO = "+ catmap.getMatchingValueForLabel("@#$%^"));
testCaseNumber++;
}
}

View file

@ -0,0 +1,664 @@
package gov.noaa.nws.ncep.gempak.parameters.core.contourinterval;
import gov.noaa.nws.ncep.gempak.parameters.core.contourinterval.CINT;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*<pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 12-Nov-2009 174 Archana.S Initial Creation
* 10-Jun-2010 174 Archana.S Added assertion to check that
* the list of String equivalents for the contour
* values is generated correctly.
* 15-Jun-2010 174 Archana.S Updated test-cases per changes in the code design
* 02-Aug-2010 174 Archana.S Updated test-cases per changes in the code design
* </pre>
* @author Archana.S
* @version 1
*/
public class CINTTest {
private static int testCaseNumber;
private List<Double> testList;
private List<Double> testList2;
private List<Double> keySetList;
List<String> contourValuesList;
@Test
/* Test for valid fill contour string of the form contourInterval/minContourValue/maxContourValue */
public void testPositiveContourIntervalWithMinMaxValues(){
testCaseNumber = 1;
CINT cint = new CINT("10/0.5/9");
assertEquals(cint.isCINTStringParsed(),true);
testList = new ArrayList<Double>(Arrays.asList(0.5, 9.0));
keySetList = cint.getContourValuesListAsDouble(CINT.FIRST_ZOOM_LEVEL);
assertEquals(keySetList,testList);
assertEquals(cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL).doubleValue(), 10);
assertEquals(cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL).doubleValue(), 0.5);
assertEquals(cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL).doubleValue(), 9);
assertEquals(cint.getNumPaddingDigits(CINT.FIRST_ZOOM_LEVEL), 0);
System.out.println("=====================Test-Case "+testCaseNumber+"a ========================");
System.out.println("The input string = " + cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
contourValuesList = cint.getContourValuesListAsString(CINT.FIRST_ZOOM_LEVEL);
System.out.println("The set of contour values: " + contourValuesList);
System.out.println("The contour interval: " + cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL));
System.out.println("The minimum contour value: " + cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL));
System.out.println("The maximum contour value: " + cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL));
CINT cint2 = new CINT(" 10 / -57 / 86 / 4 ");
assertEquals(cint2.isCINTStringParsed(),true);
testList2 = new ArrayList<Double>(Arrays.asList(-50.0, -40.0, -30.0, -20.0, -10.0, 0.0, 10.0,
20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0));
keySetList = cint2.getContourValuesListAsDouble(CINT.FIRST_ZOOM_LEVEL);
assertEquals(testList2,keySetList);
assertEquals(cint2.getContourInterval(CINT.FIRST_ZOOM_LEVEL).doubleValue(), 10);
assertEquals(cint2.getMinContourValue(CINT.FIRST_ZOOM_LEVEL).doubleValue(), -57);
assertEquals(cint2.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL).doubleValue(), 86);
assertEquals(cint2.getNumPaddingDigits(CINT.FIRST_ZOOM_LEVEL), 4);
System.out.println("=====================Test-Case "+testCaseNumber+"b ========================");
System.out.println("The input string = " + cint2.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint2.isCINTStringParsed());
contourValuesList = cint2.getContourValuesListAsString(CINT.FIRST_ZOOM_LEVEL);
System.out.println("The set of contour values: " + contourValuesList);
System.out.println("The contour interval: " + cint2.getContourInterval(CINT.FIRST_ZOOM_LEVEL));
System.out.println("The minimum contour value: " + cint2.getMinContourValue(CINT.FIRST_ZOOM_LEVEL));
System.out.println("The maximum contour value: " + cint2.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL));
testCaseNumber++;
}
@Test
/* Test for valid contour data string of the form contourInterval/minContourValue/maxContourValue
* with a negative contourInterval
* */
public void testNegativeContourIntervalWithMinMaxValues(){
CINT cint = new CINT("-5/-11/23");
assertEquals(cint.isCINTStringParsed(),true);
testList = new ArrayList<Double>(Arrays.asList(-10.0, -5.0, 0.0, 5.0, 10.0, 15.0, 20.0));
keySetList = cint.getContourValuesListAsDouble(CINT.FIRST_ZOOM_LEVEL);
assertEquals(keySetList,testList);
System.out.println("=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("The input string = " + cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
contourValuesList = cint.getContourValuesListAsString(CINT.FIRST_ZOOM_LEVEL);
System.out.println("The set of contour values: " + contourValuesList);
testCaseNumber++;
}
@Test
/*Test for valid contour value string of the form val1;val2;val3;val4..... */
public void testValidContourLevelValuesString(){
CINT cint = new CINT("66.1;0.1;5000;76;-.999;12233459390;0.00009988;1234.567890");
assertEquals(cint.isCINTStringParsed(), true);
testList = new ArrayList<Double>(Arrays.asList(66.1, 0.1, 5000.0, 76.0, -0.999,
1.223345939E10, 9.988E-5, 1234.56789));
keySetList = cint.getContourValuesListAsDouble(CINT.FIRST_ZOOM_LEVEL);
assertEquals(keySetList,testList);
System.out.println("=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("The input string = " + cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
contourValuesList = cint.getContourValuesListAsString(CINT.FIRST_ZOOM_LEVEL);
System.out.println("The set of contour values: " + contourValuesList);
testCaseNumber++;
}
@Test
/*Test for valid contour value string of the form val1 ; val2 ; val3 */
public void testValidContourLevelValuesStringWithBlanks(){
CINT cint = new CINT(" 66.1 ; 0.1 ; 5000 ");
assertEquals(cint.isCINTStringParsed(), true);
testList = new ArrayList<Double>(Arrays.asList(66.1, 0.1, 5000.0));
keySetList = cint.getContourValuesListAsDouble(CINT.FIRST_ZOOM_LEVEL);
assertEquals(keySetList,testList);
System.out.println("=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("The input string = " + cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
contourValuesList = cint.getContourValuesListAsString(CINT.FIRST_ZOOM_LEVEL);
System.out.println("The set of contour values: " + contourValuesList);
testCaseNumber++;
}
@Test
/*Test for valid contour string of the form contourInterval/minContourValue/ */
public void testContourIntervalWithMinValueOnly(){
CINT cint = new CINT("-0.345/0/");
assertEquals(cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL),-0.345);
assertEquals(cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL),0);
assertEquals(cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL),Double.NaN);
System.out.println("=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("The input string = " + cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
System.out.println("Contour Interval = "+cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Minimum Contour Level = "+cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Maximum Contour Level = "+cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL));
testCaseNumber++;
}
@Test
/*Test for valid contour data string of the form contourInterval//maxContourValue */
public void testContourIntervalWithMaxValueOnly(){
CINT cint = new CINT("15//30");
assertEquals(cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL),15);
assertEquals(cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL),Double.NaN);
assertEquals(cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL),30);
System.out.println("=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
System.out.println("Contour Interval = "+cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Minimum Contour Level = "+cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Maximum Contour Level = "+cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL));
testCaseNumber++;
}
@Test
public void testCINTWithOnlyContourIntervalSpecified(){
CINT cint = new CINT("-0.5/");
assertEquals(cint.isCINTStringParsed(),true);
assertEquals(cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL),-0.5);
assertEquals(cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL),Double.NaN);
assertEquals(cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL),Double.NaN);
System.out.println("=====================Test-Case "+testCaseNumber+"a ========================");
System.out.println("The input string = " + cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
System.out.println("Contour Interval = "+cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Minimum Contour Level = "+cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Maximum Contour Level = "+cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL));
CINT cint2 = new CINT("-.89//");
assertEquals(cint2.isCINTStringParsed(),true);
assertEquals(cint2.getContourInterval(CINT.FIRST_ZOOM_LEVEL),-0.89);
assertEquals(cint2.getMinContourValue(CINT.FIRST_ZOOM_LEVEL),Double.NaN);
assertEquals(cint2.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL),Double.NaN);
System.out.println("=====================Test-Case "+testCaseNumber+"b ========================");
System.out.println("The input string = " + cint2.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint2.isCINTStringParsed());
System.out.println("Contour Interval = "+cint2.getContourInterval(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Minimum Contour Level = "+cint2.getMinContourValue(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Maximum Contour Level = "+cint2.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL));
testCaseNumber++;
}
@Test
/*Test for valid contour data string of the form /minContourValue/maxContourValue */
public void testContourIntervalWithNoContourIntervalAndWithMinMaxValueOnly(){
CINT cint = new CINT("/10/30");
assertEquals(cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL),Double.NaN);
assertEquals(cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL),10);
assertEquals(cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL),30);
System.out.println("=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("The input string = " + cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
System.out.println("Contour Interval = "+cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Minimum Contour Level = "+cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Maximum Contour Level = "+cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL));
testCaseNumber++;
}
@Test
/*Test for valid contour data string of the form /minContourValue/maxContourValue */
public void testContourIntervalWithMinValSameAsMaxValAndNoContourIntervalSpecified(){
CINT cint = new CINT("/10/10");
assertEquals(cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL),Double.NaN);
assertEquals(cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL),10);
assertEquals(cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL),10);
testList = new ArrayList<Double>(Arrays.asList(10.0));
keySetList = cint.getContourValuesListAsDouble(CINT.FIRST_ZOOM_LEVEL);
assertEquals(keySetList,testList);
System.out.println("=====================Test-Case "+testCaseNumber+" ========================");
System.out.println("The input string = " + cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
System.out.println("Contour Interval = "+cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Minimum Contour Level = "+cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Maximum Contour Level = "+cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL));
contourValuesList = cint.getContourValuesListAsString(CINT.FIRST_ZOOM_LEVEL);
System.out.println("The set of contour values: " + contourValuesList);
testCaseNumber++;
}
@Test
/*Test input string containing a single contour value */
public void testLessNumArgsContourIntervalString(){
CINT cint = new CINT("-0.6");
assertEquals(cint.isCINTStringParsed(),true);
testList = new ArrayList<Double>(Arrays.asList(-0.6));
keySetList = cint.getContourValuesListAsDouble(CINT.FIRST_ZOOM_LEVEL);
// assertEquals(keySetList,testList);
System.out.println("=====================Test-Case "+testCaseNumber+"a ========================");
System.out.println("The input string = " + cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
System.out.println("The contour interval is: " + cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL));
contourValuesList = cint.getContourValuesListAsString(CINT.FIRST_ZOOM_LEVEL);
System.out.println("List with single contour value = " + contourValuesList);
CINT cint2 = new CINT("0.7;");
assertEquals(cint2.isCINTStringParsed(),true);
testList2 = new ArrayList<Double>(Arrays.asList(0.7));
keySetList = cint.getContourValuesListAsDouble(CINT.FIRST_ZOOM_LEVEL);
// assertEquals(keySetList,testList);
System.out.println("=====================Test-Case "+testCaseNumber+"b ========================");
System.out.println("The input string = " + cint2.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint2.isCINTStringParsed());
System.out.println("The contour interval is: " + cint2.getContourInterval(CINT.FIRST_ZOOM_LEVEL));
contourValuesList = cint2.getContourValuesListAsString(CINT.FIRST_ZOOM_LEVEL);
System.out.println("List with single contour value = " + contourValuesList);
testCaseNumber++;
}
@Test
/*Test for contour data string of the form contourInterval/minContourValue/maxContourValue/extraNumbers/extraNumbers/extraNumbers*/
public void testExtraNumArgsContourIntervalString(){
CINT cint = new CINT("20/10/70/30/40/500");
assertEquals(cint.isCINTStringParsed(), true);
assertEquals(cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL),20);
assertEquals(cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL),10);
assertEquals(cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL),70);
//
testList = new ArrayList<Double>(Arrays.asList(10.0, 30.0, 50.0, 60.0));
keySetList = cint.getContourValuesListAsDouble(CINT.FIRST_ZOOM_LEVEL);
assertEquals(keySetList,testList);
System.out.println("=====================Test-Case "+testCaseNumber+"========================");
System.out.println("The input string = "+cint.getUserInputString());
System.out.println("Contour Interval = "+cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Minimum Contour Level = "+cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Maximum Contour Level = "+cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL));
contourValuesList = cint.getContourValuesListAsString(CINT.FIRST_ZOOM_LEVEL);
System.out.println("The set of contour values: " + contourValuesList);
testCaseNumber++;
}
@Test
/*Test for non-numeric values in contour interval string*/
public void testNonNumericContourIntervalString(){
CINT cint = new CINT("-def/abc/%^&/30/40");
assertEquals(cint.isCINTStringParsed(), false);
assertEquals(cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL),Double.NaN);
assertEquals(cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL),Double.NaN);
assertEquals(cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL),Double.NaN);
System.out.println("=====================Test-Case "+testCaseNumber+"========================");
System.out.println("The input string = "+cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
System.out.println("Contour Interval = "+cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Minimum Contour Level = "+cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Maximum Contour Level = "+cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL));
testCaseNumber++;
}
@Test
/*Test contour interval string with invalid delimiters*/
public void testInvalidDelimitersInContourIntervalString(){
CINT cint = new CINT("5.10.60.9");
assertEquals(cint.isCINTStringParsed(), false);
assertEquals(cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL),Double.NaN);
assertEquals(cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL),Double.NaN);
assertEquals(cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL),Double.NaN);
System.out.println("=====================Test-Case "+testCaseNumber+"========================");
System.out.println("The input string = "+cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
System.out.println("Contour Interval = "+cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Minimum Contour Level = "+cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Maximum Contour Level = "+cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL));
testCaseNumber++;
}
@Test
/*Test contour interval string by interchanging minContourValue and maxContourValue */
public void testMinMaxValuesInterchangedContourIntervalString(){
CINT cint = new CINT("-5/20/5");
assertEquals(cint.isCINTStringParsed(), true);
assertEquals(cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL),-5);
assertEquals(cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL),5);
assertEquals(cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL),20);
testList = new ArrayList<Double>(Arrays.asList(5.0, 10.0, 15.0, 20.0));
keySetList = cint.getContourValuesListAsDouble(CINT.FIRST_ZOOM_LEVEL);
assertEquals(keySetList,testList);
System.out.println("=====================Test-Case "+testCaseNumber+"a========================");
System.out.println("The input string = "+cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
System.out.println("Contour Interval = " + cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Minimum Contour Level = " + cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Maximum Contour Level = " + cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL));
contourValuesList = cint.getContourValuesListAsString(CINT.FIRST_ZOOM_LEVEL);
System.out.println("List with single contour value = " + contourValuesList);
CINT cint2 = new CINT("5/20/5");
assertEquals(cint2.isCINTStringParsed(), true);
assertEquals(cint2.getContourInterval(CINT.FIRST_ZOOM_LEVEL),5);
assertEquals(cint2.getMinContourValue(CINT.FIRST_ZOOM_LEVEL),5);
assertEquals(cint2.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL),20);
testList = new ArrayList<Double>(Arrays.asList(5.0, 10.0, 15.0, 20.0));
// assertEquals(cint2.getContourValuesList(),testList);
System.out.println("=====================Test-Case "+testCaseNumber+"b========================");
System.out.println("The input string = "+cint2.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint2.isCINTStringParsed());
System.out.println("Contour Interval = "+cint2.getContourInterval(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Minimum Contour Level = "+cint2.getMinContourValue(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Maximum Contour Level = "+cint2.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Contour Values List = "+cint2.getContourValuesListAsDouble(CINT.FIRST_ZOOM_LEVEL));
testCaseNumber++;
}
@Test
/*Test for non-numeric vales in contour values' string*/
public void testInvalidContourLevelValuesString(){
CINT cint = new CINT("66.1;abc;5000;76;;@#$%;12233459390");
assertEquals(cint.isCINTStringParsed(), false);
System.out.println("=====================Test-Case "+testCaseNumber+"========================");
System.out.println("The input string = "+cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
testCaseNumber++;
}
@Test
/*Test for invalid delimiters in contour values' string */
public void testInvalidDelimiterContourValuesString(){
CINT cint = new CINT("66.1,0,1,5000,76,-.999,12233459390");
assertEquals(cint.isCINTStringParsed(), false);
System.out.println("=====================Test-Case "+testCaseNumber+"========================");
System.out.println("The input string = "+cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
testCaseNumber++;
}
@Test
/*Test for empty contour data string*/
public void testEmptyString(){
CINT cint = new CINT();
assertEquals(cint.isCINTStringParsed(), false);
System.out.println("=====================Test-Case "+testCaseNumber+"a========================");
System.out.println("The input string = " + cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
CINT cint2 = new CINT("");
assertEquals(cint2.isCINTStringParsed(), false);
System.out.println("=====================Test-Case "+testCaseNumber+"b========================");
System.out.println("The input string = " + cint2.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint2.isCINTStringParsed());
CINT cint3 = new CINT(null);
assertEquals(cint3.isCINTStringParsed(), false);
System.out.println("=====================Test-Case "+testCaseNumber+"c========================");
System.out.println("The input string = " + cint3.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint3.isCINTStringParsed());
testCaseNumber++;
}
@Test
/*Test for contour data string with blank-spaces*/
public void testContourDataStringWithBlankSpaces(){
CINT cint = new CINT(" ");
assertEquals(cint.isCINTStringParsed(), false);
System.out.println("=====================Test-Case "+testCaseNumber+"========================");
System.out.println("The input string = " + cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
testCaseNumber++;
}
@Test
/*Test contour interval string by interchanging minContourValue and maxContourValue */
public void testSingleLabelledContourIntervalString(){
CINT cint = new CINT("5=good/5/5");
assertEquals(cint.isCINTStringParsed(), true);
assertEquals(cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL),0);
assertEquals(cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL),5);
assertEquals(cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL),5);
testList = new ArrayList<Double>(Arrays.asList(5.0));
keySetList = cint.getContourValuesListAsDouble(CINT.FIRST_ZOOM_LEVEL);
assertEquals(keySetList,testList);
System.out.println("=====================Test-Case "+testCaseNumber+"========================");
System.out.println("The input string = "+cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
System.out.println("Contour Interval = " + cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Minimum Contour Level = " + cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Maximum Contour Level = " + cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL));
contourValuesList = cint.getContourValuesListAsString(CINT.FIRST_ZOOM_LEVEL);
System.out.println("List with single contour value = " + contourValuesList);
testCaseNumber++;
}
@Test
/*Test contour interval string by interchanging minContourValue and maxContourValue */
public void testLabelledContourIntervalStrings(){
CINT cint = new CINT("10=ab;35=sdnf");
assertEquals(cint.isCINTStringParsed(), true);
testList = new ArrayList<Double>(Arrays.asList(10.0,35.0));
keySetList = cint.getContourValuesListAsDouble(CINT.FIRST_ZOOM_LEVEL);
assertEquals(keySetList,testList);
System.out.println("=====================Test-Case "+testCaseNumber+"========================");
System.out.println("The input string = "+cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
System.out.println("HashMap for labeled contour string = " + cint.getCintHashMap(CINT.FIRST_ZOOM_LEVEL));
testCaseNumber++;
}
@Test
/*Test contour interval string of the form:
*contourInterval/minimumContourValue/maximumContourValue/numPaddingDigits*/
public void testCINTStringWithNumPaddingDigits(){
// CINT cint = new CINT("1/2/10/3");
CINT cint = new CINT("1/2/10/3 > 4/2/18");
assertEquals(cint.isCINTStringParsed(), true);
assertEquals(cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL),1);
assertEquals(cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL),2);
assertEquals(cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL),10);
assertEquals(cint.getNumPaddingDigits(CINT.FIRST_ZOOM_LEVEL),3);
testList = new ArrayList<Double>(Arrays.asList(2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0));
keySetList = cint.getContourValuesListAsDouble(CINT.FIRST_ZOOM_LEVEL);
assertEquals(keySetList,testList);
System.out.println("=====================Test-Case "+testCaseNumber+"========================");
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
System.out.println("The input string = "+ cint. getUserInputString());
System.out.println("The parsed input string at first zoom level = "+ cint. getCINTString(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Contour Interval = " + cint.getContourInterval(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Minimum Contour Level = " + cint.getMinContourValue(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Maximum Contour Level = " + cint.getMaxContourValue(CINT.FIRST_ZOOM_LEVEL));
System.out.println("Minimum number of digits in label = " + cint.getNumPaddingDigits(CINT.FIRST_ZOOM_LEVEL));
List<Double>contourList = cint.getContourValuesListAsDouble(CINT.FIRST_ZOOM_LEVEL);
System.out.println("Contour values list as double= " + contourList);
System.out.println("Set of contour values with padding digits = " + cint.getContourLabelsForZoomLevel(CINT.FIRST_ZOOM_LEVEL));
System.out.println("HashMap at first zoom level = " + cint.getCintHashMap(CINT.FIRST_ZOOM_LEVEL));
System.out.println("The parsed input string at second zoom level = "+ cint. getCINTString(CINT.SECOND_ZOOM_LEVEL));
System.out.println("Contour Interval = " + cint.getContourInterval(CINT.SECOND_ZOOM_LEVEL));
System.out.println("Minimum Contour Level = " + cint.getMinContourValue(CINT.SECOND_ZOOM_LEVEL));
System.out.println("Maximum Contour Level = " + cint.getMaxContourValue(CINT.SECOND_ZOOM_LEVEL));
System.out.println("Minimum number of digits in label = " + cint.getNumPaddingDigits(CINT.SECOND_ZOOM_LEVEL));
System.out.println("HashMap at second zoom level = " + cint.getCintHashMap(CINT.SECOND_ZOOM_LEVEL));
contourList = new ArrayList<Double> (cint.getContourValuesListAsDouble(CINT.SECOND_ZOOM_LEVEL));
System.out.println("Contour values list as double= " + contourList);
testCaseNumber++;
}
/*
* Test contour interval string with multiple zoom levels
*/
@Test
public void testCINTMultipleZoomLevels(){
CINT cint = new CINT("2/-6/6/3 > 30;50;80 > 60=abc; 80=def > 0.00009999 > 0.0000001;");
assertEquals(cint.isCINTStringParsed(), true);
testList = new ArrayList<Double>(Arrays.asList(-6.0, -4.0,-2.0, 0.0, 2.0, 4.0, 6.0));
keySetList = cint.getContourValuesListAsDouble(CINT.FIRST_ZOOM_LEVEL);
assertEquals(testList,keySetList);
testList = new ArrayList<Double>(Arrays.asList(30.0,50.0,80.0));
keySetList = cint.getContourValuesListAsDouble(CINT.SECOND_ZOOM_LEVEL);
assertEquals(testList,keySetList);
testList = new ArrayList<Double>(Arrays.asList(60.0,80.0));
keySetList = cint.getContourValuesListAsDouble(CINT.THIRD_ZOOM_LEVEL);
assertEquals(testList,keySetList);
assertEquals(0.00009999, cint.getContourInterval(CINT.FOURTH_ZOOM_LEVEL));
assertEquals(0.0000001, cint.getContourInterval(CINT.FIFTH_ZOOM_LEVEL));
// testList = new ArrayList<Double>(Arrays.asList(0.00009999));
// keySetList = cint.getContourValuesListAsDouble(CINT.FOURTH_ZOOM_LEVEL);
// assertEquals(testList,keySetList);
// testList = new ArrayList<Double>(Arrays.asList(0.0000001));
// keySetList = cint.getContourValuesListAsDouble(CINT.FIFTH_ZOOM_LEVEL);
assertEquals(testList,keySetList);
testList = new ArrayList<Double>(Arrays.asList(-6.0, -4.0, -2.0, 0.0, 2.0, 4.0, 6.0, 30.0, 50.0, 60.0, 80.0));
keySetList = cint.getUniqueSortedContourValuesFromAllZoomLevels();
assertEquals(testList,keySetList);
System.out.println("=====================Test-Case "+testCaseNumber+"========================");
System.out.println("The input string = "+cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
System.out.println("The HashMap at 1st zoom level"+ cint.getCintHashMap(CINT.FIRST_ZOOM_LEVEL));
System.out.println("The HashMap at 2nd zoom level"+ cint.getCintHashMap(CINT.SECOND_ZOOM_LEVEL));
System.out.println("The HashMap at 3rd zoom level"+ cint.getCintHashMap(CINT.THIRD_ZOOM_LEVEL));
System.out.println("The HashMap at 4th zoom level"+ cint.getCintHashMap(CINT.FOURTH_ZOOM_LEVEL));
System.out.println("The HashMap at 5th zoom level"+ cint.getCintHashMap(CINT.FIFTH_ZOOM_LEVEL));
System.out.println("The unique contour values sorted in ascending order: "+ cint.getUniqueSortedContourValuesFromAllZoomLevelsAsString());
}
/*
* Test contour interval string with more than 5 zoom levels (currently 5 is the maximum)
*/
@Test
public void testCINTWithMoreThanFiveZoomLevels(){
CINT cint = new CINT("2/-6/6/3 > 30;50;80 > 60=abc; 80=def > 0.00009999 > 0.0000001;1.2 > 90=GoodLuck > 100;200;300;400");
testList = new ArrayList<Double>(Arrays.asList(0.0000001,1.2));
keySetList = cint.getContourValuesListAsDouble(CINT.MAX_ZOOM_LEVEL);
assertEquals(testList,keySetList);
System.out.println("=====================Test-Case "+testCaseNumber+"========================");
System.out.println("The input string = "+cint.getUserInputString());
System.out.println("Is the contour data string parsed correctly? " + cint.isCINTStringParsed());
System.out.println("The HashMap at 1st zoom level"+ cint.getCintHashMap(CINT.FIRST_ZOOM_LEVEL));
System.out.println("The HashMap at 2nd zoom level"+ cint.getCintHashMap(CINT.SECOND_ZOOM_LEVEL));
System.out.println("The HashMap at 3rd zoom level"+ cint.getCintHashMap(CINT.THIRD_ZOOM_LEVEL));
System.out.println("The HashMap at 4th zoom level"+ cint.getCintHashMap(CINT.FOURTH_ZOOM_LEVEL));
System.out.println("The HashMap at 5th zoom level"+ cint.getCintHashMap(CINT.FIFTH_ZOOM_LEVEL));
}
/*
* Test contour interval string with multiple zoom levels, some of which are invalid
*/
@Test
public void testCINTWithInvalidZoomLevels() throws IndexOutOfBoundsException{
System.out.println("=====================Test-Case "+testCaseNumber+"========================");
System.out.println("The input string = "+"2/-6/6/3 > > 60=abc; 80=def > > ");
CINT cint = new CINT("2/-6/6/3 > > 60=abc; 80=def > > ");
System.out.println( "Is CINT String parsed correctly? " + cint.isCINTStringParsed());
}
}

View file

@ -0,0 +1,504 @@
package gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea;
import static org.junit.Assert.*;
import gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea.GraphicsAreaCoordinates;
import org.junit.Test;
/**
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 29-Sep-2009 171 Archana Initial Version
*
* </pre>
* @author Archana
* @version 1
*/
/**
* This junit test file tests the methods in the class GraphicsAreaCoordinates.
*/
public class GraphicsAreaCoordinatesTest {
private boolean flag;
private String error_msg;
@Test
//Test that all Latitude/Longitude values can be set to 0
public void testAllZeroLatLon(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("0;0;0;0");
flag = gac.isGraphicsAreaStringValid();
if(flag == true){
double lat_lon[] = gac.getGAREACoordinates();
assertEquals(lat_lon[0],0.0f);
assertEquals(lat_lon[1],0.0f);
assertEquals(lat_lon[2],0.0f);
assertEquals(lat_lon[3],0.0f);
assertEquals(lat_lon[4],0.0f);
assertEquals(lat_lon[5],0.0f);
}
}
@Test
// Test that Lower Left Latitude is not <-91 or > 90
public void testLowerLeftLatOutOfBounds(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("-90.1;0;20;40");
flag = gac.isGraphicsAreaStringValid();
assertFalse("Lower Left Latitude can only take values between -90.00 and 90.00", flag);
// if(!flag){
// error_msg = gac.getErrorCode();
// assertEquals(error_msg,"Lower Left Latitude can only take values between -90.00 and 90.00");
// }
GraphicsAreaCoordinates gac2 = new GraphicsAreaCoordinates("90.1;0;90.0;40");
flag = gac2.isGraphicsAreaStringValid();
assertFalse("Lower Left Latitude can only take values between -90.00 and 90.00", flag);
// if(!flag){
// error_msg = gac2.getErrorCode();
// assertEquals(error_msg,"Lower Left Latitude can only take values between -90.00 and 90.00");
// }
}
@Test
// Test that Upper Right Latitude is not <-91 or > 90
public void testUpperRightLatOutOfBounds(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("-60;50;-90.1;0");
flag = gac.isGraphicsAreaStringValid();
assertFalse("Upper Right Latitude can only take values between -90.00 and 90.00", flag);
// if(!flag){
// error_msg = gac.getErrorCode();
// assertEquals(error_msg,"Upper Right Latitude can only take values between -90.00 and 90.00");
// }
GraphicsAreaCoordinates gac2 = new GraphicsAreaCoordinates("0;0;90.1;50");
flag = gac2.isGraphicsAreaStringValid();
assertFalse("Upper Right Latitude can only take values between -90.00 and 90.00", flag);
// if(!flag){
// error_msg = gac2.getErrorCode();
// assertEquals(error_msg,"Upper Right Latitude can only take values between -90.00 and 90.00");
// }
}
@Test
// Test that Lower Left Longitude is not > 360 or < -181
public void testLowerLeftLonOutOfBounds(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("-89;-180.1;60;0");
flag = gac.isGraphicsAreaStringValid();
assertFalse("Lower Left Longitude can only take values between -180.00 to 180.00 or 0.00 to 360.00", flag);
// if(!flag){
// error_msg = gac.getErrorCode();
// assertEquals(error_msg,"Lower Left Longitude can only take values between -180.00 to 180.00 or 0.00 to 360.00");
// }
GraphicsAreaCoordinates gac2= new GraphicsAreaCoordinates("0;360.1;50;0");
flag = gac2.isGraphicsAreaStringValid();
assertFalse("Lower Left Longitude can only take values between -180.00 to 180.00 or 0.00 to 360.00", flag);
// if(!flag){
// error_msg = gac2.getErrorCode();
// assertEquals(error_msg,"Lower Left Longitude can only take values between -180.00 to 180.00 or 0.00 to 360.00");
// }
}
@Test
// Test that Upper Right Longitude is not > 360 or < -181
public void testUpperRightLonOutOfBounds(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("-89;59;50;-180.1");
flag = gac.isGraphicsAreaStringValid();
assertTrue("After adding convertLongitudeValue(...) logic, Upper Right Longitude -180.1 is valid now", flag);
// if(!flag){
// error_msg = gac.getErrorCode();
// assertEquals(error_msg,"Upper Right Longitude can only take values between -180.00 to 180.00 or 0.00 to 360.00");
// }
GraphicsAreaCoordinates gac2 = new GraphicsAreaCoordinates("0;0;0;360.1");
flag = gac2.isGraphicsAreaStringValid();
assertTrue("After adding convertLongitudeValue(...) logic, Upper Right Longitude 360.1 is valid now", flag);
// if(!flag){
// error_msg = gac2.getErrorCode();
// assertEquals(error_msg,"Upper Right Longitude can only take values between -180.00 to 180.00 or 0.00 to 360.00");
// }
}
@Test
//Test for valid values of Lower Left and Upper Right Latitude/Longitude values
public void testValidLatLonDataRange(){
String gAreaString = "-90;-180;90;180";
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates(gAreaString);
// flag = gac.parseGraphicsAreaString(gAreaString);
flag = gac.isGraphicsAreaStringValid();
assertTrue("The input Graphics Area Coordinates should be valid", flag);
double lat_lon[] = gac.getGAREACoordinates();
assertEquals(lat_lon[0],-90.0f);
assertEquals(lat_lon[1],-180.0f);
assertEquals(lat_lon[2],90.0f);
assertEquals(lat_lon[3],180.0f);
assertEquals(lat_lon[4],0.0f);
assertEquals(lat_lon[5],0.0f);
gAreaString = "-89;-179;89;179";
GraphicsAreaCoordinates gac2 = new GraphicsAreaCoordinates(gAreaString);
flag = gac2.isGraphicsAreaStringValid();
// flag = gac2.parseGraphicsAreaString(gAreaString);
assertTrue("The input Graphics Area Coordinates should be valid", flag);
lat_lon = gac2.getGAREACoordinates();
assertEquals(lat_lon[0],-89f);
assertEquals(lat_lon[1],-179.0f);
assertEquals(lat_lon[2],89.0f);
assertEquals(lat_lon[3],179.0f);
assertEquals(lat_lon[4],0.0f);
assertEquals(lat_lon[5],0.0f);
}
@Test
//Test if Latitude/Longitude values can be entered without any digit preceding the '.' character.
public void testValiLatLonNoLeadingDigit(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("-.55;.66;30.45678;170");
flag = gac.isGraphicsAreaStringValid();
assertTrue("The input Graphics Area Coordinates should be valid", flag);
double lat_lon[] = gac.getGAREACoordinates();
assertEquals(lat_lon[0],-0.55f);
assertEquals(lat_lon[1],0.66f);
assertEquals(lat_lon[2],30.45678f);
assertEquals(lat_lon[3],170.0f);
assertEquals(lat_lon[4],14.95339f);
assertEquals(lat_lon[5],85.33f);
}
@Test
// Test for less than 4 Latitude/Longitude values
public void testLessThanFourLatLonValues(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("10;20;30");
flag = gac.isGraphicsAreaStringValid();
assertFalse("Too few arguments entered", flag);
// if(!flag){
// error_msg = gac.getErrorCode();
// assertEquals(error_msg,"Too few arguments entered");
// }
}
@Test
//Test for more than 4 Latitude/Longitude values
public void testMoreThanFourLatLonValues(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("10;20;30;40;50");
flag = gac.isGraphicsAreaStringValid();
assertTrue("For the number of arguments more than 4, it should be considered a valid string, the extra arguments is simply ignored", flag);
// if(!flag){
// error_msg = gac.getErrorCode();
// }
}
@Test
//Test that Lower Left Latitude value cannot exceed the Upper Right Latitude
public void testLowerLeftLatLessThanUpperRightLat(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("70.55;40.45;30.02;80.44");
flag = gac.isGraphicsAreaStringValid();
assertFalse("Lower left latitude must be less than or equal to upper right latitude", flag);
// if(!flag){
// error_msg = gac.getErrorCode();
// assertEquals(error_msg,"Lower left latitude must be less than or equal to upper right latitude");
// }
GraphicsAreaCoordinates gac_1 = new GraphicsAreaCoordinates("90;180;-90;-180");
flag = gac_1.isGraphicsAreaStringValid();
assertFalse("Lower left latitude must be less than or equal to upper right latitude", flag);
// if(!flag){
// error_msg = gac_1.getErrorCode();
// assertEquals(error_msg,"Lower left latitude must be less than or equal to upper right latitude");
// }
}
@Test
//Test that Lower Left Longitude value cannot exceed the Upper Right Longitude
public void testLowerLeftLonLessThanUpperRightLon(){
GraphicsAreaCoordinates gac19 = new GraphicsAreaCoordinates("20.55;140.45;30.02;80.44");
flag = gac19.isGraphicsAreaStringValid();
assertFalse("Lower left longitude must be less than or equal to upper right longitude", flag);
// if(!flag){
// error_msg = gac19.getErrorCode();
// assertEquals(error_msg,"Lower left longitude must be less than or equal to upper right longitude");
// }
GraphicsAreaCoordinates gac_1 = new GraphicsAreaCoordinates("90;180;90;-180");
flag = gac_1.isGraphicsAreaStringValid();
assertFalse("The two coordinate points are the same point, thus it is invalid", flag);
// if(!flag){
// error_msg = gac_1.getErrorCode();
// assertEquals(error_msg,"Lower left longitude must be less than or equal to upper right longitude");
// }
}
@Test
//Test for invalid separator like a ',' character or a '.' character instead of ';'
public void testInvalidDelimiter(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("0.0.0.0");
flag = gac.isGraphicsAreaStringValid();
assertFalse("Invalid String Format", flag);
// if(!flag){
// error_msg = gac.getErrorCode();
// assertEquals(error_msg,"Invalid String Format");
// }
GraphicsAreaCoordinates gac2 = new GraphicsAreaCoordinates("#0,0,0,0");
flag = gac2.isGraphicsAreaStringValid();
assertFalse("String Format '#0,0,0,0' should be invalid", flag);
// if(!flag){
// error_msg = gac2.getErrorCode();
// assertEquals(error_msg,"Invalid String Format");
// }
}
@Test
//Test for the presence of an extra '.' character
public void testExtraDemialPoint(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("-.55;90..77;30.45678;170");
flag = gac.isGraphicsAreaStringValid();
assertFalse("Invalid lat/lon String Format", flag);
// if(!flag){
// error_msg = gac.getErrorCode();
// assertEquals(error_msg,"Invalid lat/lon values entered");
// }
}
@Test
//Test for non-numeric characters in the input Latitude/Longitude string
public void testInvalidNonNumericLatLonInput(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("0;$0;0-;0");
flag = gac.isGraphicsAreaStringValid();
assertFalse("Invalid lat/lon values entered", flag);
// if(!flag){
// error_msg = gac.getErrorCode();
// assertEquals(error_msg,"Invalid lat/lon values entered");
// }
}
@Test
//Test that the Upper Right and Lower Left Latitude Values computed from the Center/Delta Lat/Lon Values
// lie in the correct range from -90.0 to 90.0
public void testInvalidCenterDeltaLatValues(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("#-90.0;10.4;0.1;0.45");
flag = gac.isGraphicsAreaStringValid();
assertFalse("center_lat - delta_lat should be >= -90.0 and center_lat + delta_lat should be <=90.0", flag);
// if(!flag){
// error_msg = gac.getErrorCode();
// assertEquals(error_msg,"center_lat - delta_lat should be >= -90.0 and center_lat + delta_lat should be <=90.0");
// }
GraphicsAreaCoordinates gac2 = new GraphicsAreaCoordinates("#90.0;10.4;0.1;0.45");
flag = gac2.isGraphicsAreaStringValid();
assertFalse("center_lat - delta_lat should be >= -90.0 and center_lat + delta_lat should be <=90.0", flag);
// if(!flag){
// error_msg = gac2.getErrorCode();
// assertEquals(error_msg,"center_lat - delta_lat should be >= -90.0 and center_lat + delta_lat should be <=90.0");
// }
}
@Test
//Test that the Upper Right and Lower Left Longitude Values computed from the Center/Delta Latitude/Longitude Values
// lie in the correct range from -180.0 to 360.0
public void testInvalidCenterDeltaLonValues(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("#89.0;-180;0.1;0.45");
flag = gac.isGraphicsAreaStringValid();
assertFalse("center_lon - delta_lon should be >= -180.0 and center_lon + delta_lon should be <=360.0", flag);
// if(!flag){
// error_msg = gac.getErrorCode();
// assertEquals(error_msg,"center_lon - delta_lon should be >= -180.0 and center_lon + delta_lon should be <=360.0");
// }
GraphicsAreaCoordinates gac2 = new GraphicsAreaCoordinates("#89.0;180;0.1;0.45");
flag = gac2.isGraphicsAreaStringValid();
assertTrue("A valid string pattern meets the logic of center_lon - delta_lon should be >= -180.0 and center_lon + delta_lon should be <=360.0", flag);
// if(!flag){
// error_msg = gac2.getErrorCode();
// assertEquals(error_msg,"center_lon - delta_lon should be >= -180.0 and center_lon + delta_lon should be <=360.0");
// }
GraphicsAreaCoordinates gac3 = new GraphicsAreaCoordinates("#89.0;360;0.1;0.45");
flag = gac3.isGraphicsAreaStringValid();
/*
* After convertLongitudeValue(..) logic, the center Lon=360 is converted to Lon=0, thus,
* (center_lon + delta_lon=0.45) <=360.0
*/
assertTrue("After convertLongitudeValue(..) logic,, this string should be valid", flag);
// if(!flag){
// error_msg = gac3.getErrorCode();
// assertEquals(error_msg,"center_lon - delta_lon should be >= -180.0 and center_lon + delta_lon should be <=360.0");
// }
}
@Test
//Test for negative delta latitude value
public void testNegativeDeltaLat(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("#30.0;160.00;-0.761;0.45");
flag = gac.isGraphicsAreaStringValid();
assertFalse("Delta Latitude values cannot be negative", flag);
// if(!flag){
// error_msg = gac.getErrorCode();
// assertEquals(error_msg,"Delta Latitude values cannot be negative");
// }
}
@Test
//Test for negative delta longitude value
public void testNegativeDeltaLon(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("#30.0;160.00;0.761;-0.45");
flag = gac.isGraphicsAreaStringValid();
assertFalse("Delta Longitude values cannot be negative", flag);
// if(!flag){
// error_msg = gac.getErrorCode();
// assertEquals(error_msg,"Delta Longitude values cannot be negative");
// }
}
@Test
//Test if the Latitude/Longitude and Projection String Data can be retrieved from the Geog Table (geog.xml)
// When the input string is a Geographical Area Code.
public void testValidInputGeogTable(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("MAAR");
flag = gac.isGraphicsAreaStringValid();
assertTrue("MAAR is a valid name in geog.xml table", flag);
assertEquals(gac.getGeogAreaCode(),"MAAR");
assertEquals(gac.getMapProjectionString(),"MER");
double lat_lon[] = gac.getGAREACoordinates();
assertEquals(lat_lon[0],17.00f);
assertEquals(lat_lon[1],-63.90f);
assertEquals(lat_lon[2],18.60f);
assertEquals(lat_lon[3],-62.30f);
assertEquals(lat_lon[4],17.80f);
assertEquals(lat_lon[5],-63.10f);
GraphicsAreaCoordinates gac2 = new GraphicsAreaCoordinates("105");
flag = gac2.isGraphicsAreaStringValid();
assertTrue("105 is a valid name in geog.xml table", flag);
assertEquals(gac2.getMapProjectionString(),"STR/90;-105;0");
lat_lon = gac2.getGAREACoordinates();
assertEquals(lat_lon[0],17.52f);
assertEquals(lat_lon[1],-129.30f);
assertEquals(lat_lon[2],53.78f);
assertEquals(lat_lon[3],-22.37f);
assertEquals(lat_lon[4],35.65f);
assertEquals(lat_lon[5],-105.00f);
GraphicsAreaCoordinates gac3 = new GraphicsAreaCoordinates("105**");
flag = gac3.isGraphicsAreaStringValid();
assertTrue("105** is a valid name in geog.xml table", flag);
assertEquals(gac3.getMapProjectionString(),"STR/90;-105;0");
lat_lon = gac3.getGAREACoordinates();
assertEquals(lat_lon[0],26.585f);
assertEquals(lat_lon[1],-102.567f);
assertEquals(lat_lon[2],46.981f);
assertEquals(lat_lon[3],-42.419f);
assertEquals(lat_lon[4],35.65f);
assertEquals(lat_lon[5],-105.00f);
GraphicsAreaCoordinates gac4 = new GraphicsAreaCoordinates("105---");
flag = gac4.isGraphicsAreaStringValid();
assertTrue("105--- is a valid name in geog.xml table", flag);
assertEquals(gac4.getMapProjectionString(),"STR/90;-105;0");
lat_lon = gac4.getGAREACoordinates();
assertEquals(lat_lon[0],-0.609f);
assertEquals(lat_lon[1],-182.765f);
assertEquals(lat_lon[2],80.975f);
assertEquals(lat_lon[3],57.827f);
assertEquals(lat_lon[4],35.65f);
assertEquals(lat_lon[5],-105.00f);
}
@Test
public void testInvalidInputGeogTable(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("105$%&");
flag = gac.isGraphicsAreaStringValid();
assertFalse("105$%& is NOT a valid name in geog.xml table", flag);
// if(!flag){
// assertEquals(gac.getGeogAreaCode(),"Invalid String Format");
// }
}
@Test
public void testValidInputStationTable(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("LFK");
flag = gac.isGraphicsAreaStringValid();
assertTrue("LFK is a valid name in sfstas.xml station table", flag);
assertEquals(gac.getStationCode(),"LFK");
double lat_lon[] = gac.getGAREACoordinates();
assertEquals(lat_lon[4],31.00f);
assertEquals(lat_lon[5],-94.00f);
GraphicsAreaCoordinates gac2 = new GraphicsAreaCoordinates("BLI++");
flag = gac2.isGraphicsAreaStringValid();
assertTrue("BLI++ is a valid name in sfstas.xml station table", flag);
assertEquals(gac2.getStationCode(),"BLI");
lat_lon = gac2.getGAREACoordinates();
assertEquals(lat_lon[0],46.00f);
assertEquals(lat_lon[1],-125.50f);
assertEquals(lat_lon[2],51.50f);
assertEquals(lat_lon[3],-118.50f);
assertEquals(lat_lon[4],48.00f);
assertEquals(lat_lon[5],-122.00f);
GraphicsAreaCoordinates gac3 = new GraphicsAreaCoordinates("BLI-");
flag = gac3.isGraphicsAreaStringValid();
assertTrue("BLI- is a valid name in sfstas.xml station table", flag);
assertEquals(gac3.getStationCode(),"BLI");
lat_lon = gac3.getGAREACoordinates();
assertEquals(lat_lon[0],40.00f);
assertEquals(lat_lon[1],-136.00f);
assertEquals(lat_lon[2],62.00f);
assertEquals(lat_lon[3],-108.00f);
assertEquals(lat_lon[4],48.00f);
assertEquals(lat_lon[5],-122.00f);
}
@Test
public void testInvalidInputStationTable(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("#BLI!@#$%&");
flag = gac.isGraphicsAreaStringValid();
assertFalse("invalid station table name is entered", flag);
// if(!flag){
// assertEquals(gac.getGeogAreaCode(),"Invalid String Format");
// }
}
@Test
public void testEmptyString(){
GraphicsAreaCoordinates gac = new GraphicsAreaCoordinates("");
flag = gac.isGraphicsAreaStringValid();
assertFalse("Empty String is not a valid Graphic Area Coordinate string", flag);
// if(!flag){
// assertEquals(gac.getGeogAreaCode(),"Empty String");
// }
}
}

View file

@ -0,0 +1,52 @@
package gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea;
import static org.junit.Assert.*;
import gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea.MapProjection;
import org.junit.Test;
/**
{@link gov.noaa.nws.ncep.gempak.parameters.core.marshaller.garea.MapProjection}.
*/
public class MapProjectionTest {
@Test
public void testIsProjectionStringValid() {
MapProjection map_obj = new MapProjection("LCC");
assertEquals(map_obj.isProjectionStringValid(),true);
Integer[] margins = map_obj.getProjectionMargins();
assertEquals(margins[0],0);
assertEquals(margins[1],3);
assertEquals(margins[2],0);
assertEquals(margins[3],0);
Float[] angles = map_obj.getProjectionAngles();
assertEquals(angles[0],0);
assertEquals(angles[1],0);
assertEquals(angles[2],0);
}
@Test
public void testSetProjectionString() {
MapProjection map_obj = new MapProjection("DEF");
assertEquals(map_obj.getProjectionString(),"DEF");
}
@Test
public void testGetProjectionString() {
MapProjection m4 = new MapProjection("GNO/40.5;50.5;60.5/5;6;7;8");
assertEquals(m4.getProjectionString(),"GNO");
}
@Test
public void testGetProjectionClass() {
MapProjection m1 = new MapProjection("CED/90.0;-90.0;-360.0/2;4;6;8");
assertEquals(m1.getProjectionClass(),"CYL");
MapProjection m2 = new MapProjection("SCC/90.0;-90.0;-360.0/2;4;6;8");
assertEquals(m2.getProjectionClass(),"CON");
MapProjection m3 = new MapProjection("STR/-90.0;90.0;360.0/NM");
assertEquals(m3.getProjectionClass(),"AZM");
}
}

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="unit-test"/>
<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="lib" path="jna.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gov.noaa.nws.ncep.standalone</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,7 @@
#Wed Nov 25 08:08:32 EST 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

@ -0,0 +1,42 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Standalone Plug-in
Bundle-SymbolicName: gov.noaa.nws.ncep.standalone; singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: gov.noaa.nws.ncep.standalone.Activator
Export-Package: gov.noaa.nws.ncep.standalone,
gov.noaa.nws.ncep.standalone.colormapConverter,
gov.noaa.nws.ncep.standalone.vgfConverter,
gov.noaa.nws.ncep.standalone.xmlConverter
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
com.raytheon.uf.common.colormap,
com.raytheon.uf.common.localization,
com.raytheon.uf.common.message,
com.raytheon.uf.common.serialization,
com.raytheon.uf.viz.core,
gov.noaa.nws.ncep.common;bundle-version="1.0.0",
gov.noaa.nws.ncep.viz.common,
gov.noaa.nws.ncep.viz.localization;bundle-version="1.0.0",
org.apache.log4j;bundle-version="1.0.0",
org.geotools,
org.junit;bundle-version="1.0.0",
gov.noaa.nws.ncep.ui.pgen;bundle-version="1.0.0",
gov.noaa.nws.ncep.common.staticdata;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Import-Package: com.raytheon.uf.common.geospatial,
com.raytheon.uf.common.message,
com.raytheon.uf.viz.core,
com.raytheon.uf.viz.core.exception,
com.raytheon.uf.viz.core.rsc,
com.raytheon.uf.viz.core.rsc.capabilities,
com.raytheon.viz.core.rsc,
com.raytheon.viz.ui.dialogs,
com.raytheon.viz.ui.dialogs.colordialog,
com.raytheon.viz.ui.editor,
gov.noaa.nws.ncep.edex.common.stationTables,
gov.noaa.nws.ncep.viz.localization,
gov.noaa.nws.ncep.viz.resources.manager
Bundle-ClassPath: ., jna.jar, VgfXml.so

Binary file not shown.

View file

@ -0,0 +1,4 @@
#!/bin/csh
setenv HTTP http://localhost:9581/services
setenv ISCONVERTER true

View file

@ -0,0 +1,151 @@
<!--2012.01 Q.Zhou
Remove <fileset dir="../org.apache.commons.httpclient" includes="*.jar"/>
Add <fileset dir="../org.apache.http" includes="*.jar"/>
Add <fileset dir="../com.raytheon.uf.common.localization/bin" includes="**/*.class"/>
-->
<project name="clipvgf" default="build-jar" basedir=".">
<description>
This build file is for building ClipVGF application only.
This build does not compile the projects and relies on Eclipse, which automatically compiles them.
All the classes and needed jar libraries are copied to the distClip folder, the references to these files
are updated in manifest.mf
The list of projects which this xml file uses can be found below in target "init".
To build a jar file, right click on this file, then "Run As...", then Target, then Select "build-jar",
then click "Apply", then clcik "Run"
</description>
<!-- set global properties for this build -->
<property name="project_name" value="clipvgf"/>
<property name="src" location="src" />
<property name="srcOther" location="../com.raytheon.uf.viz.core/src" />
<property name="build" location="build" />
<property name="distClip" location="distClip" />
<property name="clipvgf" location="gov/noaa/nws/ncep/standalone/clipvgf" />
<property name="bin" location="bin" />
<target name="init">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<!-- Copy all the needed files from the projects which eclipse already compiled -->
<copy todir="${build}">
<fileset dir="../com.raytheon.uf.common.dataquery/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.comm/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.util/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.status/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.colormap/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.geospatial/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.serialization/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.message/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.localization/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.viz.core/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.viz.core/" includes="**/*"/>
<fileset dir="../gov.noaa.nws.ncep.ui.pgen/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.common/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.edex.common/bin" includes="**/*.class"/>
<!--fileset dir="../gov.noaa.nws.ncep.viz.localization/bin" includes="**/*.class"/-->
<fileset dir="${bin}" includes="**/*.class"/>
<!-- 1300 copy less -->
<!--fileset dir="../gov.noaa.nws.ncep.ui.pgen/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.viz.core/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.common/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.meteolib/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.plugin.obs/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.plugin.satellite/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.plugin.warning/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.uengine/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.common/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.dataplugin/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.dataplugin.level/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.dataquery/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.comm/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.util/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.datastorage/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.edex.decodertools/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.edex.pointdata/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.localization/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.message/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.pointdata/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.python/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.serialization/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.serialization.comm/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.status/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.time/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.viz.d2d.core/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.bcd/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.core/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.core.gl/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.pointdata/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.satellite/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.shapefile/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.ui/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.ui.glMap/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.ui.tools.map/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.common/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.resources/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.rsc.plotdata/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.tools/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.ui.display/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.ui.locator/bin" includes="**/*.class"/>
<fileset dir="../meteolib.jni/bin" includes="**/*.class"/-->
</copy>
<copy todir="${distClip}/lib">
<fileset dir="../org.geotools" includes="*.jar"/>
<fileset dir="../uframe-eclipse/plugins/" includes="org.eclipse.equinox.common_3.6.0.v20100503.jar"/>
<fileset dir="../../eclipse/plugins" includes="org.eclipse.swt*.jar"/>
<fileset dir="../javax.measure" includes="*.jar"/>
<fileset dir="../javax.persistence" includes="*.jar"/>
<fileset dir="../javax.vecmath" includes="*.jar"/>
<!--fileset dir="../org.apache.commons.httpclient" includes="*.jar"/-->
<fileset dir="../org.apache.http" includes="*.jar"/>
<fileset dir="../com.facebook.thrift" includes="*.jar"/>
<fileset dir="../net.sf.cglib" includes="*.jar"/>
<fileset dir="../org.apache.log4j" includes="*.jar"/>
<fileset dir="../org.apache.commons.logging" includes="*.jar"/>
</copy>
<copy todir="${distClip}" file="hlp/${project_name}.hlp"/>
<path id="distClip.classpath">
<fileset dir="${distClip}/lib" casesensitive="yes">
<include name="**/*.jar" />
</fileset>
</path>
</target>
<target name="build-jar" depends="clean, init" description="generate the distribution">
<!-- Create the distribution directory -->
<mkdir dir="${distClip}/lib" />
<manifestclasspath property="distClip.manifest.classpath" jarfile="${distClip}/${project_name}.jar">
<classpath refid="distClip.classpath" />
</manifestclasspath>
<jar jarfile="${distClip}/${project_name}.jar" basedir="${build}">
<fileset dir="${build}" includes="**/*.*" />
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Vendor" value="Example Organization"/>
<attribute name="Build-Date" value="${TODAY}"/>
<attribute name="Implementation-Vendor" value="SIB"/>
<attribute name="Class-Path" value="${distClip.manifest.classpath}"/>
<attribute name="Main-Class" value="gov/noaa/nws/ncep/standalone/clipvgf/ClipVGF"/>
</manifest>
</jar>
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${distClip} directory trees -->
<delete dir="${build}" />
<delete dir="${distClip}" />
</target>
</project>

View file

@ -0,0 +1,78 @@
<project name="colormapConverter" default="build-jar" basedir=".">
<description>
This build file is for building colormapConverter application only.
This build does not compile the projects and relies on Eclipse, which automatically compiles them.
All the classes and needed jar libraries are copied to the distCol folder, the references to these files
are updated in manifest.mf
The list of projects which this xml file uses can be found below in target "init".
To build a jar file, right click on this file, then "Run As...", then Target, then Select "build-jar",
then click "Apply", then clcik "Run"
</description>
<!-- set global properties for this build -->
<property name="project_name" value="colormapConverter"/>
<property name="src" location="src" />
<!-- <property name="srcOther" location="../com.raytheon.uf.viz.core/src" /> -->
<property name="build" location="build" />
<property name="distCol" location="distCol" />
<property name="colormapConverter" location="gov/noaa/nws/ncep/standalone/colormapConverter" />
<property name="bin" location="bin" />
<target name="init">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<!-- Copy all the needed files from the projects which eclipse already compiled -->
<copy todir="${build}">
<fileset dir="../gov.noaa.nws.ncep.standalone/bin" includes="gov/noaa/nws/ncep/standalone/colormapConverter/*.class"/>
<fileset dir="../com.raytheon.uf.common.colormap/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.serialization/bin" includes="**/*.class"/>
</copy>
<!-- <mkdir dir="${distCol}/lib" /> -->
<copy todir="${distCol}/table">
<fileset dir="../gov.noaa.nws.ncep.standalone/table" includes="enhance.tbl"/>
</copy>
<path id="distCol.classpath">
<fileset dir="${distCol}/lib" casesensitive="yes">
<include name="**/*.jar" />
</fileset>
</path>
</target>
<target name="build-jar" depends="clean, init" description="generate the distribution">
<!-- Create the distribution directory -->
<mkdir dir="${distCol}/lib" />
<manifestclasspath property="distCol.manifest.classpath" jarfile="${distCol}/${project_name}.jar">
<classpath refid="distCol.classpath" />
</manifestclasspath>
<jar jarfile="${distCol}/${project_name}.jar" basedir="${build}">
<fileset dir="${build}" includes="**/*.*" />
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Vendor" value="Example Organization"/>
<attribute name="Build-Date" value="${TODAY}"/>
<attribute name="Implementation-Vendor" value="SIB"/>
<attribute name="Class-Path" value="${distCol.manifest.classpath}"/>
<attribute name="Main-Class" value="gov/noaa/nws/ncep/standalone/colormapConverter/ColormapConvert"/>
</manifest>
</jar>
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${distCol} directory trees -->
<delete dir="${build}" />
<delete dir="${distCol}" />
</target>
</project>

View file

@ -0,0 +1,80 @@
<project name="compareVgf" default="build-jar" basedir=".">
<description>
This build file is for building testVgfConverter application only.
This build does not compile the projects and relies on Eclipse, which automatically compiles them.
All the classes and needed jar libraries are copied to the distVT folder, the references to these files
are updated in manifest.mf
The list of projects which this xml file uses can be found below in target "init".
To build a jar file, right click on this file, then "Run As...", then Target, then Select "build-jar",
then click "Apply", then clcik "Run"
</description>
<!-- set global properties for this build -->
<property name="project_name" value="compareVgf"/>
<property name="src" location="src" />
<!-- <property name="srcOther" location="../com.raytheon.uf.viz.core/src" /> -->
<property name="build" location="build" />
<property name="distVT" location="distVT" />
<property name="compareVgf" location="gov/noaa/nws/ncep/standalone/testVgfConverter" />
<property name="bin" location="bin" />
<target name="init">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<!-- Copy all the needed files from the projects which eclipse already compiled -->
<copy todir="${build}">
<fileset dir="${bin}" includes="**/*.class"/>
</copy>
<copy todir="${distVT}/lib">
<fileset dir="../gov.noaa.nws.ncep.standalone" includes="*.jar"/>
<fileset dir="../gov.noaa.nws.ncep.standalone/script" includes="*.so"/>
</copy>
<!-- copy todir="${distVT}">
<fileset dir="../gov.noaa.nws.ncep.standalone/script" includes="vgfnvgf"/>
</copy-->
<path id="distVT.classpath">
<fileset dir="${distVT}/lib" casesensitive="yes">
<include name="**/*.jar" />
</fileset>
</path>
</target>
<target name="build-jar" depends="clean, init" description="generate the distribution">
<!-- Create the distribution directory -->
<mkdir dir="${distVT}/lib" />
<manifestclasspath property="distVT.manifest.classpath" jarfile="${distVT}/${project_name}.jar">
<classpath refid="distVT.classpath" />
</manifestclasspath>
<jar jarfile="${distVT}/${project_name}.jar" basedir="${build}">
<fileset dir="${build}" includes="**/*.*" />
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Vendor" value="Example Organization"/>
<attribute name="Build-Date" value="${TODAY}"/>
<attribute name="Implementation-Vendor" value="SIB"/>
<attribute name="Class-Path" value="${distVT.manifest.classpath}"/>
<attribute name="Main-Class" value="gov/noaa/nws/ncep/standalone/testVgfConverter/TestVgfConvert"/>
</manifest>
</jar>
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${distVT} directory trees -->
<delete dir="${build}" />
<delete dir="${distVT}" />
</target>
</project>

View file

@ -0,0 +1,114 @@
<project name="compareXml" default="build-jar" basedir=".">
<description>
This build file is for building testConverter application only.
This build does not compile the projects and relies on Eclipse, which automatically compiles them.
All the classes and needed jar libraries are copied to the distXT folder, the references to these files
are updated in manifest.mf
The list of projects which this xml file uses can be found below in target "init".
To build a jar file, right click on this file, then "Run As...", then Target, then Select "build-jar",
then click "Apply", then clcik "Run"
</description>
<!-- set global properties for this build -->
<property name="project_name" value="compareXml"/>
<property name="src" location="src" />
<!-- <property name="srcOther" location="../com.raytheon.uf.viz.core/src" /> -->
<property name="build" location="build" />
<property name="distXT" location="distXT" />
<property name="compareXml" location="gov/noaa/nws/ncep/standalone/testConverter" />
<property name="bin" location="bin" />
<target name="init">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<!-- Copy all the needed files from the projects which eclipse already compiled -->
<copy todir="${build}">
<fileset dir="../com.raytheon.uf.viz.core/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.serialization/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.message/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.common/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.ui.pgen/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.common/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.edex.common/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.localization/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.comm/bin" includes="**/*.class"/>
<fileset dir="${bin}" includes="**/*.class"/>
</copy>
<copy todir="${distXT}/lib"> <!--/lib-->
<fileset dir="../../eclipse/plugins" includes="javax.xml.bind_2.0.0.v20080604-1500.jar"/>
<fileset dir="../org.geotools" includes="*.jar"/>
<fileset dir="../../eclipse/plugins" includes="org.eclipse.jface_3.6.1.M20100825-0800.jar"/>
<fileset dir="../../eclipse/plugins" includes="org.eclipse.core.commands_3.6.0.I20100512-1500.jar"/>
<fileset dir="../../eclipse/plugins" includes="org.eclipse.core.runtime_3.6.0.v20100505.jar"/>
<fileset dir="../../eclipse/plugins" includes="org.eclipse.equinox.common_3.6.0.v20100503.jar"/>
<fileset dir="../../eclipse/plugins" includes="org.eclipse.equinox.registry_3.5.0.v20100503.jar"/>
<fileset dir="../../eclipse/plugins" includes="org.eclipse.osgi_3.6.1.R36x_v20100806.jar"/>
<!--fileset dir="../org.apache.commons.httpclient" includes="*.jar"/-->
<fileset dir="../com.facebook.thrift" includes="*.jar"/>
<fileset dir="../net.sf.cglib" includes="*.jar"/>
<fileset dir="../javax.measure" includes="*.jar"/>
</copy>
<copy todir="${distXT}/table">
<fileset dir="../gov.noaa.nws.ncep.standalone/table" includes="spcwatch.xml"/>
<fileset dir="../gov.noaa.nws.ncep.standalone/table" includes="vaa.xml"/>
<fileset dir="../gov.noaa.nws.ncep.standalone/table" includes="mzcntys.xml"/>
</copy>
<!-- <copy todir="${distXT}">
<fileset dir="../gov.noaa.nws.ncep.standalone/script" includes="xmlnxml"/>
</copy> -->
<path id="distXT.classpath">
<fileset dir="${distXT}/lib" casesensitive="yes"> <!--/lib-->
<include name="**/*.jar" />
</fileset>
<!--
<fileset dir="${distXT}" casesensitive="yes">
<include name="**/*.jar" />
</fileset>
-->
</path>
</target>
<target name="build-jar" depends="clean, init" description="generate the distribution">
<!-- Create the distribution directory -->
<!--
<mkdir dir="${distXT}/lib" />
-->
<manifestclasspath property="distXT.manifest.classpath" jarfile="${distXT}/${project_name}.jar">
<classpath refid="distXT.classpath" />
</manifestclasspath>
<jar jarfile="${distXT}/${project_name}.jar" basedir="${build}">
<fileset dir="${build}" includes="**/*.*" />
<fileset dir="${distXT}/lib" includes="**/*.*" /> <!--/lib-->
<fileset dir="." includes="spcwatch.xml" />
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Vendor" value="Example Organization"/>
<attribute name="Build-Date" value="${TODAY}"/>
<attribute name="Implementation-Vendor" value="SIB"/>
<attribute name="Class-Path" value="${distXT.manifest.classpath}"/>
<attribute name="Main-Class" value="gov/noaa/nws/ncep/standalone/testConverter/TestXmlConvert"/>
</manifest>
</jar>
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${distXT} directory trees -->
<delete dir="${build}" />
<delete dir="${distXT}" />
</target>
</project>

View file

@ -0,0 +1,124 @@
<!--2012.01
Remove <fileset dir="../com.raytheon.viz.ui.glMap/bin" includes="**/*.class"/>
-->
<project name="fop" default="build-jar" basedir=".">
<description>
This build file is for building fop application only.
This build does not compile the projects and relies on Eclipse, which automatically compiles them.
All the classes and needed jar libraries are copied to the distFop folder, the references to these files
are updated in manifest.mf
The list of projects which this xml file uses can be found below in target "init".
To build a jar file, right click on this file, then "Run As...", then Target, then Select "build-jar",
then click "Apply", then clcik "Run"
</description>
<!-- set global properties for this build -->
<property name="project_name" value="fop"/>
<property name="src" location="src" />
<property name="srcOther" location="../com.raytheon.uf.viz.core/src" />
<property name="build" location="build" />
<property name="distFop" location="distFop" />
<property name="fop" location="gov/noaa/nws/ncep/standalone/fop" />
<property name="bin" location="bin" />
<target name="init">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<!-- Copy all the needed files from the projects which eclipse already compiled -->
<copy todir="${build}">
<fileset dir="../gov.noaa.nws.ncep.ui.pgen/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.viz.core/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.common/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.meteolib/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.plugin.obs/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.plugin.satellite/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.plugin.warning/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.uengine/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.colormap/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.dataplugin/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.dataplugin.level/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.datastorage/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.geospatial/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.localization/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.message/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.pointdata/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.python/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.serialization/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.serialization.comm/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.status/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.time/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.edex.decodertools/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.edex.pointdata/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.viz.core/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.viz.d2d.core/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.bcd/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.core/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.core.gl/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.pointdata/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.satellite/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.shapefile/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.ui/bin" includes="**/*.class"/>
<!--fileset dir="../com.raytheon.viz.ui.glMap/bin" includes="**/*.class"/-->
<fileset dir="../com.raytheon.viz.ui.tools.map/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.edex.common/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.ui.pgen/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.common/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.resources/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.rsc.plotdata/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.tools/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.ui.display/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.ui.locator/bin" includes="**/*.class"/>
<fileset dir="../meteolib.jni/bin" includes="**/*.class"/>
<fileset dir="${bin}" includes="**/*.class"/>
</copy>
<copy todir="${distFop}/lib">
<fileset dir="../org.geotools" includes="*.jar"/>
<fileset dir="../javax.measure" includes="*.jar"/>
</copy>
<copy todir="${distFop}" file="hlp/${project_name}.hlp"/>
<path id="distFop.classpath">
<fileset dir="${distFop}/lib" casesensitive="yes">
<include name="**/*.jar" />
<exclude name="**/*common*"/>
</fileset>
</path>
</target>
<target name="build-jar" depends="clean, init" description="generate the distribution">
<!-- Create the distribution directory -->
<mkdir dir="${distFop}/lib" />
<manifestclasspath property="distFop.manifest.classpath" jarfile="${distFop}/${project_name}.jar">
<classpath refid="distFop.classpath" />
</manifestclasspath>
<jar jarfile="${distFop}/${project_name}.jar" basedir="${build}">
<fileset dir="${build}" includes="**/*.*" />
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Vendor" value="Example Organization"/>
<attribute name="Build-Date" value="${TODAY}"/>
<attribute name="Implementation-Vendor" value="SIB"/>
<attribute name="Class-Path" value="${distFop.manifest.classpath}"/>
<attribute name="Main-Class" value="gov/noaa/nws/ncep/standalone/fop/FOP"/>
</manifest>
</jar>
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${distFop} directory trees -->
<delete dir="${build}" />
<delete dir="${distFop}" />
</target>
</project>

View file

@ -0,0 +1,122 @@
<project name="joinvgf" default="build-jar" basedir=".">
<description>
This build file is for building JoinVGF application only.
This build does not compile the projects and relies on Eclipse, which automatically compiles them.
All the classes and needed jar libraries are copied to the distJoin folder, the references to these files
are updated in manifest.mf
The list of projects which this xml file uses can be found below in target "init".
To build a jar file, right click on this file, then "Run As...", then Target, then Select "build-jar",
then click "Apply", then clcik "Run"
</description>
<!-- set global properties for this build -->
<property name="project_name" value="joinvgf"/>
<property name="src" location="src" />
<property name="srcOther" location="../com.raytheon.uf.viz.core/src" />
<property name="build" location="build" />
<property name="distJoin" location="distJoin" />
<property name="joinvgf" location="gov/noaa/nws/ncep/standalone/joinvgf" />
<property name="bin" location="bin" />
<target name="init">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<!-- Copy all the needed files from the projects which eclipse already compiled -->
<copy todir="${build}">
<fileset dir="../gov.noaa.nws.ncep.ui.pgen/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.viz.core/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.common/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.meteolib/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.plugin.obs/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.plugin.satellite/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.plugin.warning/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.uengine/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.colormap/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.dataplugin/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.dataplugin.level/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.datastorage/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.geospatial/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.localization/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.message/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.pointdata/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.python/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.serialization/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.serialization.comm/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.status/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.time/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.edex.decodertools/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.edex.pointdata/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.viz.core/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.viz.d2d.core/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.bcd/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.core/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.core.gl/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.pointdata/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.satellite/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.shapefile/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.ui/bin" includes="**/*.class"/>
<!--fileset dir="../com.raytheon.viz.ui.glMap/bin" includes="**/*.class"/-->
<fileset dir="../com.raytheon.viz.ui.tools.map/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.edex.common/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.ui.pgen/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.common/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.resources/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.rsc.plotdata/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.tools/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.ui.display/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.ui.locator/bin" includes="**/*.class"/>
<fileset dir="../meteolib.jni/bin" includes="**/*.class"/>
<fileset dir="${bin}" includes="**/*.class"/>
</copy>
<copy todir="${distJoin}/lib">
<fileset dir="../org.geotools" includes="*.jar"/>
<fileset dir="../javax.measure" includes="*.jar"/>
<fileset dir="../org.apache.log4j" includes="*.jar"/>
</copy>
<copy todir="${distJoin}" file="hlp/${project_name}.hlp"/>
<path id="distJoin.classpath">
<fileset dir="${distJoin}/lib" casesensitive="yes">
<include name="**/*.jar" />
<exclude name="**/*common*"/>
</fileset>
</path>
</target>
<target name="build-jar" depends="clean, init" description="generate the distribution">
<!-- Create the distribution directory -->
<mkdir dir="${distJoin}/lib" />
<manifestclasspath property="distJoin.manifest.classpath" jarfile="${distJoin}/${project_name}.jar">
<classpath refid="distJoin.classpath" />
</manifestclasspath>
<jar jarfile="${distJoin}/${project_name}.jar" basedir="${build}">
<fileset dir="${build}" includes="**/*.*" />
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Vendor" value="Example Organization"/>
<attribute name="Build-Date" value="${TODAY}"/>
<attribute name="Implementation-Vendor" value="SIB"/>
<attribute name="Class-Path" value="${distJoin.manifest.classpath}"/>
<attribute name="Main-Class" value="gov/noaa/nws/ncep/standalone/joinvgf/JoinVGF"/>
</manifest>
</jar>
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${distJoin} directory trees -->
<delete dir="${build}" />
<delete dir="${distJoin}" />
</target>
</project>

View file

@ -0,0 +1,86 @@
<project name="miscsetConverter" default="build-jar" basedir=".">
<description>
This build file is for building miscsetConverter application only.
This build does not compile the projects and relies on Eclipse, which automatically compiles them.
All the classes and needed jar libraries are copied to the distMisc folder, the references to these files
are updated in manifest.mf
The list of projects which this xml file uses can be found below in target "init".
To build a jar file, right click on this file, then "Run As...", then Target, then Select "build-jar",
then click "Apply", then click "Run"
</description>
<!-- set global properties for this build -->
<property name="project_name" value="miscsetConverter"/>
<property name="src" location="src" />
<!-- <property name="srcOther" location="../com.raytheon.uf.viz.core/src" /> -->
<property name="build" location="build" />
<property name="distMisc" location="distMisc" />
<property name="miscsetConverter" location="gov/noaa/nws/ncep/standalone/miscsetConverter" />
<property name="bin" location="bin" />
<target name="init">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<!-- Copy all the needed files from the projects which eclipse already compiled -->
<copy todir="${build}">
<!--
<fileset dir="../gov.noaa.nws.ncep.viz.resources/bin" includes="**/*.class"/>
-->
<fileset dir="../com.raytheon.uf.common.serialization/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.common/bin" includes="**/*.class"/>
<fileset dir="${bin}" includes="**/*.class"/>
</copy>
<!-- <mkdir dir="${distMisc}/lib" /> -->
<!--copy todir="${distMisc}/lib"-->
<!--fileset dir="../org.apache.commons.httpclient" includes="*.jar"/--> <!-- needed?? -->
<!--fileset dir="../../eclipse/plugins" includes="*swt.gtk.linux.x86*.jar" excludes="*source*"/-->
<!--/copy-->
<!--
<copy todir="${distMisc}/table">
<fileset dir="../gov.noaa.nws.ncep.standalone/table" includes="enhance.tbl"/>
</copy>
-->
<copy todir="${distMisc}" file="hlp/${project_name}.hlp"/>
<path id="distMisc.classpath">
<fileset dir="${distMisc}/lib" casesensitive="yes">
<include name="**/*.jar" />
</fileset>
</path>
</target>
<target name="build-jar" depends="clean, init" description="generate the distribution">
<!-- Create the distribution directory -->
<mkdir dir="${distMisc}/lib" />
<manifestclasspath property="distMisc.manifest.classpath" jarfile="${distMisc}/${project_name}.jar">
<classpath refid="distMisc.classpath" />
</manifestclasspath>
<jar jarfile="${distMisc}/${project_name}.jar" basedir="${build}">
<fileset dir="${build}" includes="**/*.*" />
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Vendor" value="Example Organization"/>
<attribute name="Build-Date" value="${TODAY}"/>
<attribute name="Implementation-Vendor" value="SIB"/>
<attribute name="Class-Path" value="${distMisc.manifest.classpath}"/>
<attribute name="Main-Class" value="gov/noaa/nws/ncep/standalone/miscsetConverter/MiscsetConvert"/>
</manifest>
</jar>
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${distMisc} directory trees -->
<delete dir="${build}" />
<delete dir="${distMisc}" />
</target>
</project>

View file

@ -0,0 +1,85 @@
<project name="modresConverter" default="build-jar" basedir=".">
<description>
This build file is for building modresConverter application only.
This build does not compile the projects and relies on Eclipse, which automatically compiles them.
All the classes and needed jar libraries are copied to the distMod folder, the references to these files
are updated in manifest.mf
The list of projects which this xml file uses can be found below in target "init".
To build a jar file, right click on this file, then "Run As...", then Target, then Select "build-jar",
then click "Apply", then click "Run"
</description>
<!-- set global properties for this build -->
<property name="project_name" value="modresConverter"/>
<property name="src" location="src" />
<!-- <property name="srcOther" location="../com.raytheon.uf.viz.core/src" /> -->
<property name="build" location="build" />
<property name="distMod" location="distMod" />
<property name="modresConverter" location="gov/noaa/nws/ncep/standalone/modresConverter" />
<property name="bin" location="bin" />
<target name="init">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<!-- Copy all the needed files from the projects which eclipse already compiled -->
<copy todir="${build}">
<fileset dir="../gov.noaa.nws.ncep.viz.common/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.resources/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.serialization/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.localization/bin" includes="**/*.class"/>
<fileset dir="${bin}" includes="**/*.class"/>
</copy>
<!-- <mkdir dir="${distMod}/lib" /> -->
<copy todir="${distMod}/lib">
<!--fileset dir="../org.apache.commons.httpclient" includes="*.jar"/-->
<fileset dir="../../eclipse/plugins" includes="*javax.xml*.jar"/>
</copy>
<!--
<copy todir="${distMod}/table">
<fileset dir="../gov.noaa.nws.ncep.standalone/table" includes="enhance.tbl"/>
</copy>
-->
<copy todir="${distMod}" file="hlp/${project_name}.hlp"/>
<path id="distMod.classpath">
<fileset dir="${distMod}/lib" casesensitive="yes">
<include name="**/*.jar" />
</fileset>
</path>
</target>
<target name="build-jar" depends="clean, init" description="generate the distribution">
<!-- Create the distribution directory -->
<mkdir dir="${distMod}/lib" />
<manifestclasspath property="distMod.manifest.classpath" jarfile="${distMod}/${project_name}.jar">
<classpath refid="distMod.classpath" />
</manifestclasspath>
<jar jarfile="${distMod}/${project_name}.jar" basedir="${build}">
<fileset dir="${build}" includes="**/*.*" />
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Vendor" value="Example Organization"/>
<attribute name="Build-Date" value="${TODAY}"/>
<attribute name="Implementation-Vendor" value="SIB"/>
<attribute name="Class-Path" value="${distMod.manifest.classpath}"/>
<attribute name="Main-Class" value="gov/noaa/nws/ncep/standalone/modresConverter/ModresConvert"/>
</manifest>
</jar>
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${distMod} directory trees -->
<delete dir="${build}" />
<delete dir="${distMod}" />
</target>
</project>

View file

@ -0,0 +1,75 @@
<project name="pgenxml2txt" default="build-jar" basedir=".">
<description>
This build file is for building pgenxml2txt application only.
This build does not compile the projects and relies on Eclipse, which automatically compiles them.
All the classes and needed jar libraries are copied to the dist folder, the references to these files
are updated in manifest.mf
The list of projects which this xml file uses can be found below in target "init".
To build a jar file, right click on this file, then "Run As...", then Target, then Select "build-jar",
then click "Apply", then click "Run"
</description>
<!-- set global properties for this build -->
<property name="project_name" value="pgenxml2txt"/>
<property name="src" location="src" />
<property name="build" location="build" />
<property name="dist" location="dist" />
<property name="pgenxml2txt" location="gov/noaa/nws/ncep/standalone/pgenxml2txt" />
<property name="bin" location="bin" />
<target name="init">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<!-- Copy all the needed files from the projects which eclipse already compiled -->
<copy todir="${build}">
<fileset dir="${bin}" includes="**/*.class"/>
</copy>
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib" />
<copy todir="${dist}/lib">
<fileset dir="../../eclipse/plugins" includes="javax.xml_1.3.4.v200806030440.jar"/>
</copy>
<copy todir="${dist}" file="hlp/${project_name}.hlp"/>
<path id="dist.classpath">
<fileset dir="${dist}/lib" casesensitive="yes">
<include name="**/*.jar" />
<exclude name="**/*common*"/>
</fileset>
</path>
</target>
<target name="build-jar" depends="clean, init" description="generate the distribution">
<manifestclasspath property="dist.manifest.classpath" jarfile="${dist}/${project_name}.jar">
<classpath refid="dist.classpath" />
</manifestclasspath>
<jar jarfile="${dist}/${project_name}.jar" basedir="${build}">
<fileset dir="${build}" includes="**/*.*" />
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Vendor" value="Example Organization"/>
<attribute name="Build-Date" value="${TODAY}"/>
<attribute name="Implementation-Vendor" value="SIB"/>
<attribute name="Class-Path" value="${dist.manifest.classpath}"/>
<attribute name="Main-Class" value="gov/noaa/nws/ncep/standalone/pgenxml2txt/PgenXml2Txt"/>
</manifest>
</jar>
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}" />
<delete dir="${dist}" />
</target>
</project>

View file

@ -0,0 +1,124 @@
<!--2012.01
Remove <fileset dir="../com.raytheon.viz.ui.glMap/bin" includes="**/*.class"/>
-->
<project name="rfop" default="build-jar" basedir=".">
<description>
This build file is for building rfop application only.
This build does not compile the projects and relies on Eclipse, which automatically compiles them.
All the classes and needed jar libraries are copied to the distRfop folder, the references to these files
are updated in manifest.mf
The list of projects which this xml file uses can be found below in target "init".
To build a jar file, right click on this file, then "Run As...", then Target, then Select "build-jar",
then click "Apply", then clcik "Run"
</description>
<!-- set global properties for this build -->
<property name="project_name" value="rfop"/>
<property name="src" location="src" />
<property name="srcOther" location="../com.raytheon.uf.viz.core/src" />
<property name="build" location="build" />
<property name="distRfop" location="distRfop" />
<property name="rfop" location="gov/noaa/nws/ncep/standalone/rfop" />
<property name="bin" location="bin" />
<target name="init">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<!-- Copy all the needed files from the projects which eclipse already compiled -->
<copy todir="${build}">
<fileset dir="../gov.noaa.nws.ncep.ui.pgen/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.viz.core/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.common/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.meteolib/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.plugin.obs/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.plugin.satellite/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.plugin.warning/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.uengine/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.colormap/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.dataplugin/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.dataplugin.level/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.datastorage/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.geospatial/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.localization/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.message/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.pointdata/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.python/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.serialization/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.serialization.comm/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.status/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.time/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.edex.decodertools/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.edex.pointdata/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.viz.core/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.viz.d2d.core/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.bcd/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.core/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.core.gl/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.pointdata/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.satellite/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.shapefile/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.viz.ui/bin" includes="**/*.class"/>
<!--fileset dir="../com.raytheon.viz.ui.glMap/bin" includes="**/*.class"/-->
<fileset dir="../com.raytheon.viz.ui.tools.map/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.edex.common/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.ui.pgen/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.common/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.resources/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.rsc.plotdata/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.tools/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.ui.display/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.ui.locator/bin" includes="**/*.class"/>
<fileset dir="../meteolib.jni/bin" includes="**/*.class"/>
<fileset dir="${bin}" includes="**/*.class"/>
</copy>
<copy todir="${distRfop}/lib">
<fileset dir="../org.geotools" includes="*.jar"/>
<fileset dir="../javax.measure" includes="*.jar"/>
</copy>
<copy todir="${distRfop}" file="hlp/${project_name}.hlp"/>
<path id="distRfop.classpath">
<fileset dir="${distRfop}/lib" casesensitive="yes">
<include name="**/*.jar" />
<exclude name="**/*common*"/>
</fileset>
</path>
</target>
<target name="build-jar" depends="clean, init" description="generate the distribution">
<!-- Create the distribution directory -->
<mkdir dir="${distRfop}/lib" />
<manifestclasspath property="distRfop.manifest.classpath" jarfile="${distRfop}/${project_name}.jar">
<classpath refid="distRfop.classpath" />
</manifestclasspath>
<jar jarfile="${distRfop}/${project_name}.jar" basedir="${build}">
<fileset dir="${build}" includes="**/*.*" />
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Vendor" value="Example Organization"/>
<attribute name="Build-Date" value="${TODAY}"/>
<attribute name="Implementation-Vendor" value="SIB"/>
<attribute name="Class-Path" value="${distRfop.manifest.classpath}"/>
<attribute name="Main-Class" value="gov/noaa/nws/ncep/standalone/rfop/RFOP"/>
</manifest>
</jar>
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${distRfop} directory trees -->
<delete dir="${build}" />
<delete dir="${distRfop}" />
</target>
</project>

View file

@ -0,0 +1,83 @@
<project name="vgfConverter" default="build-jar" basedir=".">
<description>
This build file is for building vgfConverter application only.
This build does not compile the projects and relies on Eclipse, which automatically compiles them.
All the classes and needed jar libraries are copied to the distVC folder, the references to these files
are updated in manifest.mf
The list of projects which this xml file uses can be found below in target "init".
To build a jar file, right click on this file, then "Run As...", then Target, then Select "build-jar",
then click "Apply", then clcik "Run"
</description>
<!-- set global properties for this build -->
<property name="project_name" value="vgfConverter"/>
<property name="src" location="src" />
<property name="build" location="build" />
<property name="distVC" location="distVC" />
<property name="vgfConverter" location="gov/noaa/nws/ncep/standalone/vgfConverter" />
<property name="bin" location="bin" />
<target name="init">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<!-- Copy all the needed files from the projects which eclipse already compiled -->
<copy todir="${build}">
<fileset dir="../gov.noaa.nws.ncep.standalone/bin" includes="gov/noaa/nws/ncep/standalone/vgfConverter/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.standalone/bin" includes="gov/noaa/nws/ncep/standalone/util/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.ui.pgen/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.serialization/bin" includes="**/*.class"/>
<!--fileset dir="${bin}" includes="**/*.class"/-->
</copy>
<copy todir="${distVC}/lib">
<fileset dir="../gov.noaa.nws.ncep.standalone" includes="*.jar"/>
<fileset dir="../gov.noaa.nws.ncep.standalone/script" includes="*.so"/>
<fileset dir="../org.geotools" includes="jts-1.10.jar"/> <!-- Coordinate. gt-*, geo*, common* are not needed -->
</copy>
<copy todir="${distVC}/table">
<fileset dir="../gov.noaa.nws.ncep.standalone/table" includes="*.tbl"/>
</copy>
<path id="distVC.classpath">
<fileset dir="${distVC}/lib" casesensitive="yes">
<include name="**/*.jar" />
<include name="**/*.so" />
</fileset>
</path>
</target>
<target name="build-jar" depends="clean, init" description="generate the distribution">
<!-- Create the distribution directory -->
<mkdir dir="${distVC}/lib" />
<manifestclasspath property="distVC.manifest.classpath" jarfile="${distVC}/${project_name}.jar">
<classpath refid="distVC.classpath" />
</manifestclasspath>
<jar jarfile="${distVC}/${project_name}.jar" basedir="${build}">
<fileset dir="${build}" includes="**/*.*" />
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Vendor" value="Example Organization"/>
<attribute name="Build-Date" value="${TODAY}"/>
<attribute name="Implementation-Vendor" value="SIB"/>
<attribute name="Class-Path" value="${distVC.manifest.classpath}"/>
<attribute name="Main-Class" value="gov/noaa/nws/ncep/standalone/vgfConverter/Convert"/>
</manifest>
</jar>
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${distVC} directory trees -->
<delete dir="${build}" />
<delete dir="${distVC}" />
</target>
</project>

View file

@ -0,0 +1,105 @@
<project name="xmlConverter" default="build-jar" basedir=".">
<description>
This build file is for building xmlConverter application only.
This build does not compile the projects and relies on Eclipse, which automatically compiles them.
All the classes and needed jar libraries are copied to the distXC folder, the references to these files
are updated in manifest.mf
The list of projects which this xml file uses can be found below in target "init".
To build a jar file, right click on this file, then "Run As...", then Target, then Select "build-jar",
then click "Apply", then clcik "Run"
</description>
<!-- set global properties for this build -->
<property name="project_name" value="xmlConverter"/>
<property name="src" location="src" />
<property name="build" location="build" />
<property name="distXC" location="distXC" />
<property name="xmlConverter" location="gov/noaa/nws/ncep/standalone/xmlConverter" />
<property name="bin" location="bin" />
<target name="init">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
<!-- Copy all the needed files from the projects which eclipse already compiled -->
<copy todir="${build}">
<fileset dir="../com.raytheon.uf.viz.core/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.comm/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.serialization/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.uf.common.message/bin" includes="**/*.class"/>
<fileset dir="../com.raytheon.edex.common/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.standalone/bin" includes="gov/noaa/nws/ncep/standalone/xmlConverter/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.standalone/bin" includes="gov/noaa/nws/ncep/standalone/util/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.ui.pgen/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.viz.common/bin" includes="**/*.class"/>
<fileset dir="../gov.noaa.nws.ncep.edex.common/bin" includes="**/*.class"/>
</copy>
<copy todir="${distXC}/lib">
<fileset dir="../../eclipse/plugins" includes="javax.xml.bind_2.0.0.v20080604-1500.jar"/>
<fileset dir="../org.geotools" includes="jts-1.10.jar"/>
<fileset dir="../org.geotools" includes="geoapi-*.jar"/>
<fileset dir="../org.geotools" includes="gt-*.jar"/>
<fileset dir="../../eclipse/plugins" includes="org.eclipse.jface_3.6.1.M20100825-0800.jar"/>
<fileset dir="../../eclipse/plugins" includes="org.eclipse.core.commands_3.6.0.I20100512-1500.jar"/>
<fileset dir="../../eclipse/plugins" includes="org.eclipse.core.runtime_3.6.0.v20100505.jar"/>
<fileset dir="../../eclipse/plugins" includes="org.eclipse.equinox.common_3.6.0.v20100503.jar"/>
<fileset dir="../../eclipse/plugins" includes="org.eclipse.equinox.registry_3.5.0.v20100503.jar"/>
<fileset dir="../../eclipse/plugins" includes="org.eclipse.osgi_3.6.1.R36x_v20100806.jar"/>
<!--fileset dir="../net.sf.cglib" includes="*.jar"/-->
<fileset dir="../javax.measure" includes="*.jar"/>
<fileset dir="../org.apache.log4j" includes="*.jar"/>
</copy>
<copy todir="${distXC}/table">
<fileset dir="../gov.noaa.nws.ncep.standalone/table" includes="spcwatch.xml"/>
<fileset dir="../gov.noaa.nws.ncep.standalone/table" includes="vaa.xml"/>
<fileset dir="../gov.noaa.nws.ncep.standalone/table" includes="mzcntys.xml"/>
</copy>
<path id="distXC.classpath">
<fileset dir="${distXC}" casesensitive="yes">
<include name="**/*.jar" />
</fileset>
</path>
</target>
<target name="build-jar" depends="clean, init" description="generate the distribution">
<!-- Create the distribution directory -->
<mkdir dir="${distXC}/lib" /> <!--/lib-->
<manifestclasspath property="distXC.manifest.classpath" jarfile="${distXC}/${project_name}.jar">
<classpath refid="distXC.classpath" />
</manifestclasspath>
<fileset dir="${distXC}/lib" includes="**/*.*" />
<fileset dir="." includes="spcwatch.xml, mzcntys.xml, vaa.xml" />
<jar jarfile="${distXC}/${project_name}.jar" basedir="${build}">
<fileset dir="${build}" includes="**/*.*" />
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Specification-Vendor" value="Example Organization"/>
<attribute name="Build-Date" value="${TODAY}"/>
<attribute name="Implementation-Vendor" value="SIB"/>
<attribute name="Class-Path" value="${distXC.manifest.classpath}"/>
<attribute name="Main-Class" value="gov/noaa/nws/ncep/standalone/xmlConverter/XmlLoading"/>
</manifest>
</jar>
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${distXC} directory trees -->
<delete dir="${build}" />
<delete dir="${distXC}" />
</target>
</project>

View file

@ -0,0 +1,8 @@
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.,\
icons/,\
jna.jar

View file

@ -0,0 +1,9 @@
#!/bin/csh
foreach file(*.tag)
set base=`echo $file | cut -d. -f1`
tag2vgf<<EOF
$file
${base}A.vgf
EOF
end

View file

@ -0,0 +1,74 @@
*******************************************************************************
Clip VGF
*******************************************************************************
INPUT PARAMETERS
java -jar clipvgf.jar input_filename clip_bound keep_flag output_filename clip_accuracy [EDEXServer]
clipvgf Program name
input_filename xml file to be clipped
clip_bound Bounds name of geographical clipping area; format:
bound_name|<area_tag_name>area_tag_value
and must be enclosed w/ quotes so the shell will ignore
directives.
keep_flag "keep" keeps all element points inside clip_bound;
"notkeep" keeps all element points outside clip_bound;
anything else tosses element points inside clip_bound.
output_filename Clipped xml file
clip_accuracy must be "exact". This parameter is required when EDEX
sever is specified, otherwise it is optional.
EDEXServer http address of EDEX server location
PROGRAM DESCRIPTION
CLIPVGF scans an xml file and tests each element for clipping against a
bounds area. Users are given a choice of employing one of two clipping
techniques.
CLIPPING TECHNIQUE (ACCURACY)
Element (lat,lon) points are determined to be either inside or outside
of the geographical clip area and are either kept or thrown away based
on the input flag "keep_flag". Note that linear elements such as fronts
and lines will not be clipped precisely at the clip area boundary when
using this option.
NOTE: In both cases, the line's unsmoothed points are used to determine
the clip edges. Therefore if the line has a smoothing factor, the resulting
line may not have precisely the same curvature as the original, unclipped
line when the smoothing factor is re-applied.\n
LABELING
If a linear object is grouped with a text label, the resulting clipped
object will also be grouped with the same text label even if this label
must be created. Labels such as these will be located midway between the
first and second points of the clipped line. If a symbol is grouped with
a text label, the text label will be either clipped or not depending on
whether the symbol is clipped or not.
The following element classes are not processed:
CLASS_WATCHES, CLASS_TRACKS, CLASS_SIGMETS
The bounds area MUST be a single area, i.e., it may not have multiple parts
such as islands. The only bounds file designed specifically for clipping
(only one part per bound area) is the seamless surface analysis (SSA) file.
EXAMPLES
java -jar clipvgf.jar input.xml "STATEBNDS|<STATE>CO" keep output.xml exact http://localhost:9581/services
- clips the xml file "input.xml" against the seamless surface analysis
bounds area. "STATEBNDS" is in the alias of the table stored in bounds.clo table,
"<STATE>" is the column name in that table, and "CO" is the shape name. In this example,
STATEBNDS|<STATE>CO corresponds to bounds.statebnds table, column state, shape for Colorado.
"Clip against the shape taken from bounds.statebnds table where state is CO"
Element points within this bounds area are saved into the xml file "output.xml".
java -jar clipvgf.jar input.xml "COUNTY|<WFO>GID" notkeep output.xml exact http://lnx111.ncep.noaa.gov:9581/services
- clips the xml file "input.xml" against the seamless surface analysis
bounds area named "GID". "COUNTY" corresponds to COUNTYBNDS in bounds.clo,
"WFO" is the column name. Element points outside of this bounds
area are saved into the xml file "output.xml". Linear objects are
clipped exactly at the boundaries.

View file

@ -0,0 +1,35 @@
*******************************************************************************
Flood Outlook Product (FOP) ASCII to PGen XML translator
*******************************************************************************
INPUT PARAMETERS
java -jar fop.jar input_filename [output_filename]
input_filename XML file to be examined for translation
output_filename XML file to store the result.
Optional parameter. If this parameter is not specified,
then the output filename is build from the input ASCII
filename by removing any extension from the ASCII
filename and replacing it w/".xml". If no extension
exists, then the ".xml" extension is applied.
This programs translates an ASCII text file containing information
about flood locations and times into a VGF file containing lines
and text elements. Each line is grouped with a text element.
The format of the ASCII file is assumed to be:
numpts flood_category valid_dates
lat1 lon1
lat2 lon2
lat3 lon3
.... ....
latN lonN
NOTES:
- Valid flood_categories: 0 (possible), 1 (likely), 2 (occurring).
- Input data points closer together than TOLERANCE (km) are ignored
since these are likely to be geographical boundaries. The result
may be multiple lines derived from a single time. In this case,
all lines will be grouped with the appropriate text element.

View file

@ -0,0 +1,64 @@
*******************************************************************************
Join VGF
*******************************************************************************
INPUT PARAMETERS
JOINVGF connects similar linear objects in two xml files if certain
distance criterion is met.
INPUT PARAMETERS
java -jar joinvgf.jar input_filename1 input_filename2 output_filename [tolerance]
joinvgf Program name.
input_filename1 XML file1 to be examined for connection.
input_filename2 XML file2 to be examined for connection.
output_filename XML file containing elements from fiel1 and file2.
[tolerance] Distance in kilometers within which points from
two separate lines are to be connected, optional.
The default value is currently set to 0.5 km.
PROGRAM DESCRIPTION
JOINVGF scans two xml files and tests linear objects for "similarity".
If two objects are found to be "similar" the objects are further tested
for "closeness". After that there are two possibilities:
1) If "closeness" is met, JOINVGF proceeds with connecting the objects
following the CONNECTION RULES.
2) If "closeness" is NOT met, the objects are not connected. Resulting
output file contains elements from file1 followed by elements from
file2 as they are.
CONNECTION RULES
* order of points from file1 is never reversed;
* order of points from file2 may be reversed;
* points from file2 may proceed or follow points from file1;
* connecting point is not repeated but taken as average of two
neighboring points;
* the resulting line may be closed if the endpoints meet the
"closeness" test;
* the attributes of the resulting connected linear object are inherited
from file1, including the group associations;
LABELING
Each linear object is permitted to keep its label.
USAGE NOTES
1. The following element classes are not processed:
CLASS_WATCHES, CLASS_TRACKS, CLASS_SIGMETS.
2. It is assumed that two input XML files are the result of clipping
of some initial XML file by program CLIPVGF using "exact" clipping
algorithm.
EXAMPLE
java -jar joinvgf.jar input1.xml input2.xml output.xml 0.1
- the programs searches input1.xml and input2.xml for lines,
endpoints of which are closer than 0.1 km; if found, the lines
are connected in the resulting file output.xml, otherwise -
they are written out unconnected.

View file

@ -0,0 +1,144 @@
*******************************************************************************
Convert miscset.tbl
*******************************************************************************
PURPOSE
MiscsetConvert ... Converts legacy NMAP2 "miscellaneous" data source settings
table miscset.tbl into equivalent files for use by the AWIPS II
National Centers Perspective (NCP).
INPUT PARAMETERS
java -jar MiscsetConvert.jar input_filename output_directory
or
<converterDir>/bin/miscset2new input_filename output_directory
MiscsetConvert Program name.
input_filename Legacy miscset.tbl to be converted.
May be referenced using an environment variable, for
example: $GEMTBL/config/miscset.tbl
output_directory Root directory into which output files are to be written.
May be referenced using an environment variable.
The directory must exist and be writable by the user.
A "MISC" subdirectory tree will be created under this
directory (if it does not already exist) in order to
match the structure of resource attribute files as
required by the new system. Individual attribute (.attr)
files will be written to the various subdirectories.
PROGRAM DESCRIPTION
MiscsetConvert is one of a suite of standalone tools provided to facilitate
migration of existing site-, desk-, and/or user-specific preference settings
from the legacy NMAP2 environment to the new AWIPS II National Centers
Perspective (NCP).
MiscsetConvert specifically reads a legacy miscset.tbl file -- which
contains a table of settings for the various MISC data types -- and
converts the information into resource attribute (*.attr) files,
which go under the .../resources/resourceDefns/MISC/*/... directory
tree for a given localization level.
USAGE NOTES
Typically, a site administrator and/or individual user(s) would run this
utility once for each existing customized version of the MISC data source
settings (miscset) table.
After running the program, all of the output files from that run should
be copied from the output_directory subdirectories into the corresponding
subdirectories:
.../resources/resourceDefns/MISC/...
...for the specific localization level (site, desk, user) being migrated.
EXAMPLE
java -jar MiscsetConvert.jar $GEMTBL/config/miscset.tbl $HOME/miscset
- The program ingests the input miscset.tbl file, and produces
output *.attr files under directories:
$HOME/miscset/MISC/AIRMET
$HOME/miscset/MISC/ATCF
$HOME/miscset/MISC/CSIG
$HOME/miscset/MISC/FFA
$HOME/miscset/MISC/ISIG
$HOME/miscset/MISC/LTNG
$HOME/miscset/MISC/NCON
$HOME/miscset/MISC/SCAT
$HOME/miscset/MISC/SCAT/ASCT
$HOME/miscset/MISC/SCAT/EXASCT
$HOME/miscset/MISC/SCAT/QSCT
$HOME/miscset/MISC/SCAT/WSAT
$HOME/miscset/MISC/SVRL
$HOME/miscset/MISC/WARN
$HOME/miscset/MISC/WCN
$HOME/miscset/MISC/WCP
$HOME/miscset/MISC/WOU
$HOME/miscset/MISC/WSTM
CONVERSION NOTES
1. Legacy table content
The legacy MISC data source settings (miscset.tbl) table is a
user-customizable ASCII text file which specifies adjustable
settings and their default values for each of the data sources
listed under the MISC group.
In the legacy table, each ALIAS key specifies the name of a MISC
data source, which must also be defined in the table of known data
types, datatype.tbl.
Under each ALIAS key, a series of FLAG and/or TYPE lines describe
boolean and more general (respectively) settings available for
that data type. TYPE lines may have subsidiary ARRW, LINE, SYM1,
and/or SYM2 lines. (The miscset.tbl file header explains these
in detail.)
A key point for conversion is that while the ALIAS entries are
distinguished by the name given in the table, this is not the
case for the FLAG and TYPE entries underneath them. Even though
each FLAG or TYPE entry has a "name" string, the meaning of
each is known to the legacy system by its order among the other
FLAG or TYPE entries; that is, the legacy system has hard-coded
knowledge of which FLAG entries and which TYPE entries appear
in which sequence.
2. AWIPS II NCP resource attribute files
The equivalent information in the new system is captured in
resource attribute (*.attr) files which define attribute values
in terms of variables whose name and meaning is known to the
system.
The converter knows the format and default content of each of
these attribute files for the MISC data sources ("resources" in
AWIPS II), including comment lines as delivered with the base
system.
The converter also knows which new attribute files are associated
with which legacy data type "ALIAS" names, and, for each resource
attribute which has an equivalent setting in the legacy system,
which (sequential) FLAG or TYPE in the legacy table provides the
equivalent setting value, and (if necessary) how to convert the
legacy value to an equivalent in the new system.
So, the converter will generate a fixed set of *.attr files,
in fixed subdirectory locations in the output MISC tree. The
content (variable definitions, and comments and blank lines)
of each *.attr file is also fixed, EXCEPT that IF the legacy
miscset.tbl supplies a value whose converted equivalent value
differs from the known default, then that custom value will
override the default value in the generated *.attr file.
When such an override occurs, an informational message similar
to the following appears...
[INFO: Variable 'outlookLineWidth' value '2' replaced by '3' based on legacy TYPE entry]
...as confirmation to the user.

View file

@ -0,0 +1,231 @@
*******************************************************************************
Convert mod_res.tbl
*******************************************************************************
PURPOSE
ModresConvert ... Converts legacy NMAP2 model product selection table mod_res.tbl
(and legacy restore files it references) into equivalent files
for use by the AWIPS II National Centers Perspective (NCP).
INPUT PARAMETERS
java -jar ModresConvert.jar input_file output_directory
or
<converterDir>/bin/modres2new input_file output_directory
ModresConvert Program name.
input_file Legacy mod_res.tbl (or equivalent) file to be converted.
May be referenced using an environment variable, for
example: $GEMTBL/nmap/mod_res.tbl
output_directory Directory into which output files will be written.
May be referenced using an environment variable.
The directory must exist and be writable by the user.
The output comprises one main ModelFcstGridContours.xml
file, and as many individual attribute set (*.attr)
files as there are valid legacy restore files referenced
in the input file.
PROGRAM DESCRIPTION
ModresConvert is one of a suite of standalone tools provided to facilitate
migration of existing site-, desk-, and/or user-specific preference settings
from the legacy NMAP2 environment to the new AWIPS II National Centers
Perspective (NCP).
ModresConvert specifically converts model product selection data from the
model product selection table mod_res.tbl into attribute set groups used by
the AWIPS II NCP.
USAGE NOTES
Typically, a site administrator and/or individual user(s) would run this
utility once for each existing customized version of the model product
selection (mod_res) table.
After running the program, all of the output files from that run should
be copied from the output_directory into the particular installation target
subdirectory:
.../resources/resourceDefns/AttrSetGroups/ModelFcstGridContours
...for the specific localization level (site, desk, user) being migrated.
EXAMPLE
java -jar ModresConvert.jar $GEMTBL/nmap/mod_res.tbl $HOME/modres
- The program ingests the input file, and produces attribute sets
definition file ModelFcstGridContours.xml and *.attr attribute files
corresponding to the restore files referenced in the input file.
All output files will be written to the "modres" subdirectory of
the user's home directory, which is assumed to exist.
CONVERSION NOTES
1. Table Content
The legacy model product selection (mod_res) table is a user-customizable
ASCII text file containing a series of lines, each of which may contain
four columns of information. The table header describes this:
! mod_res.tbl
!
! This table contains the information necessary for setting up the model
! product selection within NMAP. The columns are not in fixed locations.
!
! Column 1 - product name as it is to appear in NMAP,
! Column 2 - path/filename to restore file for product in column 1,
! Column 3 - group name under which the product is to appear,
! Column 4 - list of models (separated by semicolons, no spaces!)
! to which product will apply.
A typical (simplfied) entry line is:
! PRODUCT NAME PATH/FILENAME GROUP MODELS
...
500mb_HGHT_WIND $NMAP_RESTORE/stnd/500mb_hght_wind standard dgex;gfs;gfshd;nam
None of the entries in each of the columns need be unique to a single
line entry, so complex (many-to-many) relationships can be created.
In the AWIPS II NCP, these same relationships are expressed in an XML
file called ModelFcstGridContours.xml; however, the hierarchy of those
relationships is different. The XML file contains a list of "attribute
set groups", each of which essentially corresponds to a model-group
pair; that is, to a unique combination of entries from Columns 3 and 4
in the legacy table. For example, the attribute set group expressing
the GFS/standard/500mb_hght_wind relationship (the "gfs" part of the
above legacy sample) -- with many attrSetNames omitted -- is:
<AttrSetGroup>
<resource>GFS</resource>
<attrSetGroupName>standard</attrSetGroupName>
<attrSetNames>50mb_hght_wind_stnd, ... ,500mb_hght_wind_stnd, ... </attrSetNames>
</AttrSetGroup>
Note that this entry contains multiple (all) products that apply
to a given model (resource) / group pair, whereas a legacy entry
line could contain all models to which a product / group pair would
apply. The conversion algorithm takes care of inverting these
relationships appropriately.
Note that the new attribute set name (here, "500mb_hght_wind_stnd")
differs slightly from the legacy restore file name and product name.
In the legacy system, the same restore file name ("500mb_hght_wind")
could appear in multiple directories, each such file having different
content. In the new system, on the other hand, the new attribute
set files must coexist in a single directory, and therefore they
must have unique names. To meet this requirement, the converter
determines the attribute set name to use by taking the legacy
PRODUCT NAME (Column 1) entry (converted to lower case, with non-
alphanumeric characters except "_" removed), and suffixes it with "_"
and the name of the immediate parent subdirectory of the legacy
restore file (in the example, "stnd", from Column 2).
The attribute set file name is the attribute set name, suffixed
with ".attr".
2. Restore Files to Attribute Sets
In addition to the main ModelFcstGridContours.xml file, the converter
produces attribute set (*.attr) files corresponding to the union of
all of the XML <attrSetNames> entries. Each of these files is very
similar to the legacy restore file it replaces. For each one, the
converter does the following:
- The legacy restore file is located using the PATH/FILENAME
(Column 2) entry of mod_res.tbl.
- Comments (beginning with "!") and blank lines are copied to the
new attribute set file without change.
- Parameter assignment lines are generally moved to the new
file with insertion of an equal sign "=" (required in the new
system) with formatting otherwise preserved, except as follows:
o Some legacy parameters are not used in the new system,
and so any assignments to them will not be carried forward.
Only assignments to the following will be preserved...
GLEVEL, GVCORD, SCALE, GDPFUN, TYPE, CINT, LINE, FINT,
FLINE, HILO, HLSYM, WIND, TITLE, COLORS, MARKER, GRDLBL;
...any others will not appear in the new file.
o Most of the parameters in the preceding list are "optional"
in the new files; that is, if one of them does not appear
in the legacy restore file, then it will also not appear
in the new attribute set file.
o The exceptions to this are COLORS, MARKER, and GRDLBL.
These "required" parameters will appear in the attribute
set file even if they do not appear in the legacy file.
(Default assignment values in this case are 2, 2, and 5,
respectively.)
SELECTED CONSOLE OUTPUT MESSAGES
1. Ingesting the legacy table
[Info: Reading legacy table <file> ...]
The specified "mod_res" (model product selection) legacy table
file has been successfully opened and is being ingested.
[Warning: Restore file <file> could not be located]
A line in the legacy table references a restore file, but that
file cannot be located (even with environment variable
translation). In this case, a reference to the corresponding
attribute file that would have been generated WILL be inserted
in the output XML file, so the attribute file can be prepared
manually, but no automatic generation of the attribute file
will take place.
[Warning: Line <text> missing model name(s); ignored]
The specified line in the legacy table doesn't have any models
listed, and so no output will be generated for this line.
[Warning: Line <text> has other than 4 fields; ignored]
Similar to previous condition for more general case.
[Error: <I/O exception>]
A problem has occurred reading the legacy table file.
[Info: ... <file> read successfully]
The legacy table file has been ingested completely.
2. Generating the attribute set group list XML file
[Info: Writing attribute set group list as XML file <file> ...]
[Info: ... <file> written successfully]
These messages appear once, before and after (respectively)
the attribute set group list XML file is generated. (This
XML file contains information similar to the original table
file.)
3. Converting the individual restore files to attribute files.
[Info: Converting legacy restore file <file> ...]
[ ...to new attribute file <file>]
Output as each restore file is mapped to an attribute file.
[Info: Optional parameter <parm> not in legacy, so not in new either]
One of the set of parameters recognized by the new system (but
not required by it) doesn't appear in the legacy restore file.
This message is merely informational; if the parameter were
required, a default value would be supplied in the generated
attribute file, along with a comment indicating this.
4. Completion
[Success: The file is converted. The Conversion is finished.]
As with the other conversion programs, this message appears
on completion.

View file

@ -0,0 +1,54 @@
***********************************************************************************************************************************
PGEN XML to Text Converter
***********************************************************************************************************************************
PROGRAM DESCRIPTION
This Pgen XML to text converter program takes the Pgen data contained in an XML file,
formats it based on the style-sheet data and then creates a text file with the formatted data.
The type of formatting depends on the type of style-sheet used - whether it is wou.xlt or sev.xlt or sel.xlt or saw.xlt.
INPUT PARAMETERS
java -jar pgenxml2txt.jar xmlfilename.xml stylesheetname.xlt [textfilename]
xmlfilename.xml - The Pgen XML file. It must have the file extension .xml
stylesheetname.xlt - The XML style-sheet contains the information required
to format the Pgen XML file so that it can be displayed correctly in the text file.
The following style-sheets are currently supported:
wou.xlt, sev.xlt,sel.xlt and saw.xlt.
The style-sheet can also have the extension as xslt instead of xlt.
textfilename - The name of the text file is an optional.parameter.
If it is not specified, the program will generate a default name for it.
The default name for the text file takes the form:
xmlfilename.stylesheetname if the style-sheet name is one of (WOU/SEL/SEV/SAW).
For instance, if the XML file is called WW0002.xml and the style-sheet is called
SEL.xlt, then the text file generated will be named WW0002.SEL, if the user
does not specify a name for it.
However, if the XML file is called WW0002.xml and the style-sheet is called ABC.xlt,
then the default name for the text file will be WW0002.TXT
NOTE:
1.Both the XML file and the style-sheet must be readable and must exist in the same directory as the pgenxml2txt.jar file.
2.The order of the parameters must not be changed - the name of the XML file must be specified before that of the style-sheet.
3.The XML file name and the style-sheet name must be specified with their respective file extensions.
4.Additionally, the user must have permissions to execute and write within this directory
5.The program will provide relevant error messages, if it finds any discrepancies.
6.The text file is always named in UPPERCASE letters.
EXAMPLES
java -jar pgenxml2txt.jar WW0002.xml SEV.xlt WATCH.TXT
WATCH.TXT created successfully
java -jar pgenxml2txt.jar WW0002.xml SEV.xlt
WW0002.SEV created successfully
java -jar pgenxml2txt.jar ww0002.xml test.xlt
WW0002.TXT created successfully

View file

@ -0,0 +1,66 @@
*******************************************************************************
Reverse Flood Outlook Product (RFOP) PGen XML to fop ASCII translator
*******************************************************************************
RFOP converts a PGen XML NWS Flood Outlook Product file into an ASCII NWS
Flood Outlook Product file. Unfilled closed lines are assumed to be
areas of possible flooding, hatch filled areas are assumed to be areas
of likely flooding, solid fill areas are assumed to be areas of
imminent or occurring flooding.
INPUT PARAMETERS
java -jar rfop.jar input_filename [output_filename]
rfop Program name
input_filename XML file to be converted
[output_filename] output ASCII file, optional paramter. If this parameter
is not specified, then the output file name will be equal
to the input name without ".xml" extension. I the input
file name does not have ".xml" extension, then ".txt" will
be added to the file name instead.
PROGRAM DESCRIPTION
RFOP scans an XML file and generates a text description of each line.
The output file format is:
NWS NATIONAL FLOOD OUTLOOK PRODUCT yymmdd/hhmm
line1npts category valid_dates
lon1, lat1
lon2, lat2
lon3, lat3
...
lonN, latN
line2npts category valid_dates
...
Flood categories are:
0 - flooding possible
1 - flooding likely
2 - flooding occurring or imminent
EXAMPLES
If the XML file 'testfile.xml' contained a single 4-point line with
no fill, then the output would look like:
NWS NATIONAL FLOOD OUTLOOK PRODUCT 020321/1223
5 0 Mar 21 - Mar 23
45.53 -69.08
44.40 -67.62
44.11 -67.51
45.22 -69.02
45.53 -69.08
If the VGF file 'testfile.xml' contained a single 5-point line with
solid fill, then the output would look like:
NWS NATIONAL FLOOD OUTLOOK PRODUCT 020321/1223
6 2 Mar 21 - Mar 23
45.53 -69.08
44.40 -67.62
44.11 -67.51
45.22 -69.02
45.39 -70.07
45.53 -69.08

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View file

@ -0,0 +1,307 @@
/* XPM */
static char * icon48_xpm[] = {
"48 48 256 2",
" c #4B4B3B3B9090",
". c #0D0D0E0E5454",
"X c #11110E0E5B5B",
"o c #17170F0F6363",
"O c #1D1D13136969",
"+ c #212114146C6C",
"@ c #252514147171",
"# c #282811116C6C",
"$ c #26260D0D6363",
"% c #22220B0B5E5E",
"& c #1C1C0B0B5A5A",
"* c #1C1C0B0B5252",
"= c #1B1B05055353",
"- c #161606064D4D",
"; c #161605054949",
": c #111104044848",
"> c #131304044545",
", c #131305054242",
"< c #141410105E5E",
"1 c #2C2C15157373",
"2 c #2B2B1B1B7575",
"3 c #343416167272",
"4 c #313113136E6E",
"5 c #222209095757",
"6 c #1B1B06064D4D",
"7 c #15150B0B4242",
"8 c #13130C0C5555",
"9 c #2E2E1B1B7878",
"0 c #33331F1F7C7C",
"q c #343418187878",
"w c #3B3B1C1C7575",
"e c #2E2E10106767",
"r c #1B1B07074747",
"t c #18180B0B4646",
"y c #151513136262",
"u c #1A1A15156464",
"i c #34341F1F7777",
"p c #40401E1E8080",
"a c #42421B1B7A7A",
"s c #3B3B15157474",
"d c #2B2B0B0B5B5B",
"f c #222207075252",
"g c #373727277A7A",
"h c #474724248484",
"j c #393915156E6E",
"k c #373711116A6A",
"l c #343413136363",
"z c #232319196E6E",
"x c #292919197070",
"c c #3C3C2C2C8282",
"v c #444431318585",
"b c #494934348A8A",
"n c #505026268A8A",
"m c #3D3D1B1B6E6E",
"M c #31310E0E5C5C",
"N c #2B2B0D0D5353",
"B c #222207074A4A",
"V c #52523C3C9292",
"C c #58583C3C9494",
"Z c #5D5D44449797",
"A c #5C5C2E2E9292",
"S c #676733339595",
"D c #424228287575",
"F c #29290A0A4F4F",
"G c #6C6C4A4A9E9E",
"H c #72725454A7A7",
"J c #8C8C6D6DB2B2",
"K c #343424246E6E",
"L c #3A3A23236A6A",
"P c #3A3A1C1C6767",
"I c #24240A0A4B4B",
"U c #151518186161",
"Y c #76766F6FA5A5",
"T c #ADAD9191CCCC",
"R c #98988989D3D3",
"E c #45453B3B8686",
"W c #3C3C35357979",
"Q c #363631317575",
"! c #32322D2D6B6B",
"~ c #323229296363",
"^ c #30301F1F6262",
"/ c #323218185E5E",
"( c #272707074B4B",
") c #202028286C6C",
"_ c #1E1E1D1D6868",
"` c #9A9A8282BBBB",
"' c #C8C8B3B3D3D3",
"] c #B3B3AFAFE7E7",
"[ c #84847272C6C6",
"{ c #58585757A3A3",
"} c #3F3F3C3C8A8A",
"| c #3B3B3A3A8484",
" . c #414139397D7D",
".. c #3D3D39397A7A",
"X. c #37372E2E6E6E",
"o. c #2C2C21215A5A",
"O. c #2E2E1B1B5B5B",
"+. c #F5F5EFEFF5F5",
"@. c #656566669A9A",
"#. c #47474B4B8E8E",
"$. c #3C3C44447B7B",
"%. c #444442428080",
"&. c #45453E3E8181",
"*. c #40403C3C8181",
"=. c #3D3D33337474",
"-. c #3B3B30306E6E",
";. c #38382D2D6969",
":. c #303026265D5D",
">. c #2C2C15155A5A",
",. c #1F1F1C1C7070",
"<. c #25251E1E7171",
"1. c #59595C5C9191",
"2. c #4D4D53538989",
"3. c #4C4C49498484",
"4. c #484845458585",
"5. c #494941418585",
"6. c #494940408181",
"7. c #2F2F1C1C5353",
"8. c #2B2B28287676",
"9. c #323231317F7F",
"0. c #545452528B8B",
"q. c #51514E4E8989",
"w. c #4E4E4B4B8C8C",
"e. c #4C4C47478686",
"r. c #46463D3D7E7E",
"t. c #434336367A7A",
"y. c #2B2B13135555",
"u. c #47473D3D8D8D",
"i. c #575757578E8E",
"p. c #48483E3E7F7F",
"a. c #46463A3A7D7D",
"s. c #424235357575",
"d. c #404034347171",
"f. c #BFBFCBCBFAFA",
"g. c #B8B8A8A8DDDD",
"h. c #5E5E60609292",
"j. c #565655558C8C",
"k. c #4B4B44448282",
"l. c #454539397B7B",
"z. c #434338387878",
"x. c #3F3F32326D6D",
"c. c #3D3D30306969",
"v. c #3A3A2E2E6363",
"b. c #36362A2A5C5C",
"n. c #343424245555",
"m. c #30301E1E4D4D",
"M. c #49493C3C8282",
"N. c #5E5E4F4F8C8C",
"B. c #56563B3B8B8B",
"V. c #545407078585",
"C. c #424234347272",
"Z. c #9797A4A4F7F7",
"A. c #444436367676",
"S. c #7D7D7979D5D5",
"D. c #464640408A8A",
"F. c #44444B4B8282",
"G. c #414107077777",
"H. c #71716161C1C1",
"J. c #303039397979",
"K. c #8E8E8E8EE6E6",
"L. c #404033338B8B",
"P. c #4A4A45458C8C",
"I. c #46463A3A8080",
"U. c #363629295454",
"Y. c #303022224848",
"T. c #424237377575",
"R. c #2E2E1D1D6363",
"E. c #79798383EAEA",
"W. c #74747B7BE4E4",
"Q. c #6D6D7676D6D6",
"!. c #6A6A7171CECE",
"~. c #66666969C6C6",
"^. c #62626565BCBC",
"/. c #5F5F6060B5B5",
"(. c #5B5B5B5BACAC",
"). c #535353539898",
"_. c #4F4F4F4FA4A4",
"`. c #54544D4DA4A4",
"'. c #323204046B6B",
"]. c #303035357979",
"[. c #313122224343",
"{. c #5A5A5B5BB7B7",
"}. c #484846468080",
"|. c #454541417575",
" X c #4B4B31318282",
".X c #47473C3C8484",
"XX c #3E3E35356E6E",
"oX c #2F2F26264040",
"OX c #2B2B23233A3A",
"+X c #262619195C5C",
"@X c #252515155A5A",
"#X c #55555151B3B3",
"$X c #3C3C2D2D5D5D",
"%X c #39392F2F5656",
"&X c #37372D2D5050",
"*X c #25251F1F3030",
"=X c #24241D1D4343",
"-X c #202013135656",
";X c #41413B3B6C6C",
":X c #444442429696",
">X c #212100005E5E",
",X c #444436367272",
"<X c #444436366F6F",
"1X c #424236366868",
"2X c #3F3F34346161",
"3X c #3C3C32325A5A",
"4X c #34342A2A4A4A",
"5X c #21211B1B2121",
"6X c #22221C1C6363",
"7X c #2D2D01015E5E",
"8X c #20201B1B2525",
"9X c #49492F2F7B7B",
"0X c #434334346C6C",
"qX c #323229294545",
"wX c #1C1C10104F4F",
"eX c #222217176363",
"rX c #37371E1E6B6B",
"tX c #424232326E6E",
"yX c #444433336969",
"uX c #424233336565",
"iX c #1E1E1A1A1E1E",
"pX c #161601014C4C",
"aX c #1C1C11115454",
"sX c #252503035B5B",
"dX c #414131316A6A",
"fX c #22221F1F7878",
"gX c #272724246767",
"hX c #1D1D16165E5E",
"jX c #131305055151",
"kX c #40402F2F6464",
"lX c #111107074E4E",
"zX c #0C0C05054B4B",
"xX c #22221E1E5757",
"cX c #1A1A0D0D4D4D",
"vX c #16160B0B4D4D",
"bX c #060604044747",
"nX c #040403034343",
"mX c #3B3B27276565",
"MX c #0E0E03034141",
"NX c #111106064A4A",
"BX c #0E0E04044646",
"VX c #111105053B3B",
"CX c #0D0D01013A3A",
"ZX c #030305053F3F",
"AX c #0F0F0F0F4C4C",
"SX c #020207073B3B",
"DX c #0D0D03034646",
"FX c #0B0B02023F3F",
"GX c #0D0D02023434",
"HX c #0A0A0E0E4444",
"JX c #161614145252",
"KX c #0B0B04044646",
"LX c #0A0A03034444",
"PX c #1D1D21215757",
"IX c #090910104040",
"UX c #18181E1E5353",
" ",
" . . . . X X o o o o O + + @ @ @ @ @ @ @ # # # # # # $ $ % % & & & & * = - - - ; : > > , , , ",
" . . X X < < o o O O + @ 1 2 2 1 1 1 1 1 1 1 1 3 4 # # $ $ $ % % % 5 = = 6 6 - ; ; > > , , 7 ",
" . 8 < < < o O O + @ @ 2 9 9 0 0 q q q q q q q w 3 4 4 e e $ $ $ $ % 5 = = 6 6 6 ; ; > > r t ",
" . X < y u O O + @ 1 2 i 0 0 p p p p p p p a a p a s 3 4 4 e e e e d 5 5 f f 6 6 6 ; ; r r t ",
" X < y u O + + @ 2 9 0 g p p h h h h h h h p h h a a s s j k k j l d d 5 5 f f 6 6 r r r r r ",
" X < y O z x x 9 0 g c v b n n n n n n n n n n n h a a s s j j m l M d d N f f B B B B r r r ",
" < y u + z 2 0 c c b V C Z C C A A A A A S S S n h D w w m m m m k l M d d N f F F F B r r r ",
" < y O z z 9 c b V Z G H H H G S G G J J H V v c g g K K K K L P l l l M M N N N N I B B r r ",
" U u + z x i v C H Y J J J J H J T R H V E W W Q Q Q Q ! ! ! ~ ^ ^ / / M M M M M N ( B B r r ",
" ) _ z x 9 g b Z Y ` ' ' ' T T ] [ { } | .........W W Q Q X.! ~ ~ o.O./ / / / N F ( B B B r ",
" ) ) z x i c V G J ' +.+.+.+.] [ @.#.$.%.%.%.&.*. . .....W =.-.X.;.~ :.o.O.^ >.N F ( B B B B ",
" ) ,.<.2 g v C H J ' +.+.+.+.T Y 1.2.3.4.4.4.5.6.&.&. . ...W =.=.-.;.~ :.o.7.>.N F F ( B I I ",
" ) ,.<.8.9.b C H J T +.+.+.' J @.1.0.q.q.w.e.4.5.6.&.r. . .t.W =.=.-.;.~ :.o.7.y.N F ( ( I I ",
" 8.8.8.9.| u.C G J T +.+.' ` Y @.1.i.0.q.q.e.e.5.6.p.r.a. .t.t.s.d.d.-.;.~ :.7.7.y.F F ( I I ",
" 9.c c c v b A S H ' f.g.` Y @.h.1.i.j.0.q.q.e.k.6.p.r.a.l.t.z.s.s.d.x.c.v.b.n.m.7.N F F F I ",
" <.g M.N.B.B.n V.J f.R J @.h.h.1.i.i.j.j.0.q.3.k.6.p.r.a.l.l.z.s.C.d.x.x.c.v.b.n.m.y.N F F F ",
" + x i v B.Z Z G g.Z.[ @.2.i.i.j.j.j.j.j.0.q.3.k.6.p.p.a.l.l.A.s.C.C.d.x.c.v.b.n.m.7.y.N N y. ",
" O # 3 w p n Z ` f.S.H D.F.q.0.0.0.0.j.0.q.q.3.k.6.p.r.a.a.l.A.s.s.C.d.x.x.c.v.b.n.m.y.y.y.y. ",
" O # 4 s a G.V.T Z.H.V J.%.e.w.q.0.0.0.0.q.q.e.k.6.p.r.a.a.l.z.A.s.C.d.d.x.c.v.b.n.m.7.>.y.y. ",
" O # 4 s w G.A f.K.H L...4.P.w.w.w.q.q.q.q.e.e.5.6.M.I.I.a.a.l.z.A.s.d.d.x.c.v.v.U.Y.7.O.>.y. ",
" $ # 4 3 s G.G f.S.Z 9.*.D.P.P.w.w.w.w.w.e.e.5.5.M.M.I.I.a.a.l.z.T.s.d.d.x.x.c.v.U.Y.m.R.>.>. ",
" E.E.W.W.W.W.E.Z.E.W.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.!.!.!.!.!.~.~.~.~.~.~.^.^.^.^.^./././.(.{ { )._.`._. ",
" + # 3 w s '.` f.H.V ].*.D.P.P.P.P.P.P.P.5.5.5.M.M.M.I.I.a.l.z.z.T.T.s.d.d.x.c.v.U.Y.[.^ O.>. ",
" ~.~.~.~.~.~.K.Z.S.~.{.^.^.^.^.^.^.^.^././././././.(.(.(.(.(.(.{ { { { { ).).).w.w.}.|.P.u.} ",
" .I.6. X X XT f.H.b ].*.E D.D.D.D.5.5..X.XM.M.I.I.a.a.l.l.z.z.T.T.T.d.XXx.c.v.b.U.oXOXR.+X@X ",
" E.E.E.W.W.W.K.Z.E.W.Q.Q.Q.Q.Q.Q.Q.Q.!.!.!.!.!.!.~.~.~.~.~.~.^.^.^.^.^./././.(.{ { ).).#X_._. ",
" & % $ e '.= H f.H.b 8.W *.E E E .X.X.XI.I.I.I.a.a.l.l.z.z.T.T.T.C.XXXXc.v.$X%X&XY.*X=X2 @X-X ",
" {.{.{.{.{.#X~.Z.W.~.{.{./././././././././.(.(.(.(.(.(.(.{ { { { { { ).).).w.w.3.}.;X%.:X} } ",
" & & % $ e >XV.f.S.C K X.W t. . .l.l.t.t.t.t.A.A.A.,X,X,X,X,X<X;X1X1X2X3X%X&X4XoX*X5Xo.6X-X-X ",
" & & % $ $ >X7X` Z.Z D ! =.=.s.t.t.t.A.A.s.A.,X,X,X,X<X<X<X<X;X1X2X2X3X%X&X4XoXOX8X5X<.@X-X-X ",
" 8 & & $ e K 9XJ f.^. XK X.=.=.s.s.s.s.s.C.C.C.C.<X0X0X0X1X1X1X2X2X3X%X&X4XqXOX*X8X=X<.-X-XwX ",
" 8 & eXK k.@.M. Xg.E.B.rX~ -.d.d.C.C.C.C.C.tX0X0X0XyXyX1X1XuX2X2X3X%X&X4XqXoXOX8XiX6XeX-X-XwX ",
" 6XQ h.Y N.K e pXB.f./.9Xo.;.-.x.d.tXtXtXtXtX0X0XyXyXyXuXuX2X2X3X%X&X4XqXoXOX*XiX=X_ aX-XaXwX ",
" Y Y .R.@X% sX= 7XT Z.V P :.;.c.x.x.x.tXdXdXdXyXyXuXuX2X2X3X3X%X&X4XqXoXOX*X8X*XfXaXaXaXwXwX ",
" gXhX& * & 5 5 sXjXa ] S.9X/ ~ v.c.dXdXdXdXdXuXuXuXkX2X2X3X%X%X&X4XqXoXOX*X8XiX<.hXwXwXaXwXwX ",
" 8 lXlXjX= * 5 5 = zX9X] H.D 7.b.v.v.kXc.kXkXkXkXkX2X$X3X%X&X&X4XqXoXOX*X8XiXxXhXwXcXcXwXwXwX ",
" zXzXlXlXjX= = f f sXD Y ] ~.D 7.n.b.v.v.kXkXkXkX$X$X%X%X&X4XqXoXoXOX*X8X5XgXu cXvXvXcXcXwXwX ",
" bXbXzXlXlX- = * @XX.h.e D T S.D n.m.b.$X$X$X$X$X%X%X&X&X4XqXoXOX*X8X8X*X<.hXvX; ; vXvXvXcXwX ",
" nXbXzXzXlXlX- -XX.Y R.pXpXP J K.Z mXm.n.U.U.U.U.U.4X4XY.oXOX*X8X8X8X=X,.aXvX; > > > t t t cX ",
" nXbXbXzXzXlXaXXXY +Xf = f = 7XtXR R mXn.Y.[.[.[.[.OX*X*X8X5X*X=X,.u vXvX; > > MXMX, 7 t t ",
" nXnXnXbXzXvX-.Y +XcX6 6 = = = d L B.G H `.X.:.7.m.=X=X=X=X=X6X,.u cXvXNX: BX> MXVXCXVX7 7 7 ",
" ZXZXnXbXAXgX@.+XvX; - - - - * @XR.>.sX>.R.i 0 x eXeXeXeXO hXaXcXvXNX: BXMXMXMXVXCXCXCXVX7 7 ",
" SXZXZXAXgXN.aXNX: : NXNXNX- * +X+X* 6 6 6 * * * * * * * vXvX- NX: DXBXMXMXFXCXCXCXCXGXVXVX7 ",
" SXSXHXgX0.JXKXLXKXKXDX: : NX* @X-X- - - - - - - - - - - NX: DXDXDXMXMXFXFXCXCXCXCXGXGXGXVXVX ",
" SXHXPX3.JXnXnXnXnXbXLXKXKXNXaX-XvX: : NX: : : : : : : BXDXDXLXMXMXFXFXCXCXCXCXGXGXGXGXGXGXGX ",
" IXUX$.AXZXZXZXZXnXnXnXLXLXNXJXvXBXDXBXBXBXBXDXDXDXDXLXDXLXLXFXFXFXFXCXCXCXCXGXGXGXGXGXGXGXGX ",
" "};

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 983 B

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,167 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension
id="application"
point="org.eclipse.core.runtime.applications">
<application>
<run
class="gov.noaa.nws.ncep.standalone.Application">
</run>
</application>
</extension>
<extension
point="org.eclipse.ui.perspectives">
<perspective
name="RCP Perspective"
class="gov.noaa.nws.ncep.standalone.Perspective"
id="gov.noaa.nws.ncep.standalone.perspective">
</perspective>
</extension>
<extension
id="product"
point="org.eclipse.core.runtime.products">
<product
application="gov.noaa.nws.ncep.standalone.application"
name="CAVEStandalone">
<property
name="preferenceCustomization"
value="plugin_customization.ini">
</property>
<property
name="appName"
value="CAVEStandalone">
</property>
<property
name="aboutText"
value="AWIPS Common Visualization Environment (CAVE)&#x0A;&#x0A;&#x0A;&#x0A;Developed on the Raytheon Visualization Environment (viz)">
</property>
</product>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
defaultHandler="gov.noaa.nws.ncep.standalone.colormapConverter.ConvertHandler"
id="gov.noaa.nws.ncep.standalone.commands.ConvertHandler"
name="ConvertHandler">
</command>
<command
defaultHandler="gov.noaa.nws.ncep.standalone.vgfConverter.VgfConvertHandler"
id="gov.noaa.nws.ncep.standalone.commands.VgfConvertHandler"
name="VgfConvertHandler">
</command>
<command
defaultHandler="gov.noaa.nws.ncep.standalone.xmlConverter.XmlConvertHandler"
id="gov.noaa.nws.ncep.standalone.commands.XmlConvertHandler"
name="XmlConvertHandler">
</command>
<command
defaultHandler="gov.noaa.nws.ncep.standalone.testConverter.TestXmlHandler"
id="gov.noaa.nws.ncep.standalone.commands.TestXmlHandler"
name="TestXmlHandler">
</command>
<command
defaultHandler="gov.noaa.nws.ncep.standalone.testVgfConverter.TestVgfHandler"
id="gov.noaa.nws.ncep.standalone.commands.TestVgfHandler"
name="TestVgfHandler">
</command>
<command
defaultHandler="gov.noaa.nws.ncep.standalone.clipvgf.ClipVGFHandler"
description="Clip PGen XML"
id="gov.noaa.nws.ncep.standalone.commands.ClipVGFHandler"
name="ClipVGF">
</command>
<command
defaultHandler="gov.noaa.nws.ncep.standalone.joinvgf.JoinVGFHandler"
description="Join PGen XML"
id="gov.noaa.nws.ncep.standalone.commands.JoinVGFHandler"
name="JoinVGF">
</command>
<command
defaultHandler="gov.noaa.nws.ncep.standalone.fop.FOPHandler"
description="Flood Outlook Product"
id="gov.noaa.nws.ncep.standalone.commands.FOPHandler"
name="FOP">
</command>
<command
defaultHandler="gov.noaa.nws.ncep.standalone.rfop.RFOPHandler"
description="Reverse Flood Outlook Product"
id="gov.noaa.nws.ncep.standalone.commands.RFOPHandler"
name="RFOP">
</command>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="menu:org.eclipse.ui.main.menu">
<menu
id="Converter"
label="Converter">
<command
commandId="gov.noaa.nws.ncep.standalone.commands.ConvertHandler"
label="Convert Colormap"
style="push"
tooltip="Convert TBL Colormap">
</command>
<command
commandId="gov.noaa.nws.ncep.standalone.commands.VgfConvertHandler"
label="Convert VGF"
style="push"
tooltip="Convert VGF files to XML files">
</command>
<command
commandId="gov.noaa.nws.ncep.standalone.commands.XmlConvertHandler"
label="Convert XML"
style="push"
tooltip="Convert XML files to TAG files">
</command>
</menu>
<menu
id="TestConverter"
label="TestConverter">
<command
commandId="gov.noaa.nws.ncep.standalone.commands.TestVgfHandler"
label="Test Vgf Converter"
style="push"
tooltip="Test Vgf file and the converted Vgf file">
</command>
<command
commandId="gov.noaa.nws.ncep.standalone.commands.TestXmlHandler"
label="Test XML Converter"
style="push"
tooltip="Test Xml file and the converted XML file">
</command>
</menu>
<menu
id="VGFMenu"
label="PGen XML">
<command
commandId="gov.noaa.nws.ncep.standalone.commands.ClipVGFHandler"
label="clipvgf"
style="push"
tooltip="ClipVGF">
</command>
<command
commandId="gov.noaa.nws.ncep.standalone.commands.JoinVGFHandler"
label="joinvgf"
style="push"
tooltip="JoinVGF">
</command>
<command
commandId="gov.noaa.nws.ncep.standalone.commands.FOPHandler"
label="fop"
style="push"
tooltip="Flood Outlook Product">
</command>
<command
commandId="gov.noaa.nws.ncep.standalone.commands.RFOPHandler"
label="rfop"
style="push"
tooltip="Reverse Flood Outlook Product">
</command>
</menu>
</menuContribution>
</extension>
</plugin>

View file

@ -0,0 +1,2 @@
org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = false

View file

@ -0,0 +1,26 @@
#!/bin/sh
usage(){
cat <<EOF
This scripts is used to convert colormap tbl file to cmap file.
Usage: ctbl2cmap <source> <target> <lookupTable>
- <source>: the source directory
- <target>: the target directory
- <lookupTable>: Registed the <source> files in types representing Satellite and Radar
The converted file has the same name with .cmap ending.
The converted files are saved to <target> sub-directories named Satellite, Radar and Other.
EOF
exit
}
srcpath=$1
tgtpath=$2
if [ $# -lt 2 ]; then
usage
fi
mkdir -p $tgtpath
java -jar %{CONV_INSTALL}%/distCol/colormapConverter.jar $srcpath $tgtpath %{CONV_INSTALL}%/distCol/table/enhance.tbl

Binary file not shown.

View file

@ -0,0 +1,26 @@
#!/bin/sh
usage(){
cat <<EOF
This script is used to convert legacy miscset.tbl file into an equivalent
resource attribute files.
Usage: miscset2new <sourcedf> <target>
- <sourcedf>: the source file (example: \$GEMTBL/config/miscset.tbl)
- <target>: the target directory (example: . [current working directory])
The converted attribute files are placed in resource-specific subdirectories
of the output directory; they all end in ".attr".
EOF
exit
}
srcpath=$1
tgtpath=$2
if [ $# -lt 2 ]; then
usage
fi
java -jar %{CONV_INSTALL}%/distMisc/miscsetConverter.jar $srcpath $tgtpath

View file

@ -0,0 +1,26 @@
#!/bin/sh
usage(){
cat <<EOF
This script is used to convert legacy mod_res.tbl file and the
restore files it references into an equivalent XML file and
associated attribute files.
Usage: modres2new <sourcedf> <target>
- <sourcedf>: the source file (example: \$GEMTBL/nmap/mod_res.tbl)
- <target>: the target directory (example: . [current working directory])
The converted XML file is ModelFcstGridContours.xml; the attribute files
have derived unique names ending in ".attr".
EOF
exit
}
srcpath=$1
tgtpath=$2
if [ $# -lt 2 ]; then
usage
fi
java -jar %{CONV_INSTALL}%/distMod/modresConverter.jar $srcpath $tgtpath

Binary file not shown.

View file

@ -0,0 +1,27 @@
#!/bin/sh
usage(){
cat <<EOF
This scripts is used to convert vgf file to xml file.
Usage: vgf2xml <sourcedf> <target>
- <sourcedf>: the source directory or the source file.
- <target>: the target directory
The converted file has the same name with .xml ending.
EOF
exit
}
srcpath=$1
tgtpath=$2
if [ $# -lt 2 ]; then
usage
fi
mkdir -p $tgtpath
export LD_LIBRARY_PATH=%{CONV_INSTALL}%/distVC/lib:$LD_LIBRARY_PATH
java -jar %{CONV_INSTALL}%/distVC/vgfConverter.jar $srcpath $tgtpath

View file

@ -0,0 +1,33 @@
#!/bin/sh
usage(){
cat <<EOF
This scripts is used to compare *.vgf files with *A.vgf files.
Usage: vgfnvgf <sourcedf> <targetdf>
- <sourcedf>: the source directory or the source file.
- <targetdf>: the target directory or the target file. Put *A.vgf files in <target>
EOF
exit
}
srcpath=$1
tgtpath=$2
if [ $# -lt 2 ]; then
usage
fi
if [ -d $srcpath ]; then
for file in ${srcpath}/*.vgf ; do
tem=`basename ${file} | cut -d. -f1`
java -jar compareVgf.jar ${srcpath}/${tem}.vgf ${tgtpath}/${tem}.vgf
done
fi
if [ -f $srcpath ]; then
java -jar compareVgf.jar $srcpath $tgtpath
fi

View file

@ -0,0 +1,59 @@
#!/bin/sh
usage(){
cat <<EOF
This scripts is used to convert xml file to vgf file.
Usage: xml2vgf <sourcedf> <target>
- <sourcedf>: the source directory or the source file.
- <trget>: the target directory
The converted file has the same name with .vgf suffix.
Running each conversion will overwrite the previous results
ll
EOF
exit
}
srcpath=$1
tgtpath=$2
if [ $# -lt 2 ]; then
usage
fi
export PATH=%{CONV_INSTALL}%/bin:$PATH
java -jar %{CONV_INSTALL}%/distXC/xmlConverter.jar $srcpath $tgtpath
cd $tgtpath
run_tag2vgf(){
%{CONV_INSTALL}%/bin/tag2vgf<<EOF
${tgtpath}/${vfile}.tag
${tgtpath}/${vfile}.vgf
EOF
}
if [ -d $srcpath ]; then
echo " "
echo "The source is a directory, any previous converted vgf files inside the target folder will be deleted "
for file in ${srcpath}/*.xml ; do
vfile=`basename $file | cut -d. -f1`
if [ -e ${tgtpath}/${vfile}.vgf ]; then
rm -f ${tgtpath}/${vfile}.vgf
fi
run_tag2vgf
done
fi
if [ -f $srcpath ]; then
echo " "
echo "The source is a file, the previous converted vgf file will be deleted "
vfile=`basename $srcpath | cut -d. -f1`
if [ -e ${tgtpath}/${vfile}.vgf ]; then
rm -f ${tgtpath}/${vfile}.vgf
fi
run_tag2vgf
fi

View file

@ -0,0 +1,32 @@
#!/bin/sh
usage(){
cat <<EOF
This scripts is used to compare *.xml files with *A.xml files.
Usage: xmlnxml <sourcedf> <targetdf>
- <sourcedf>: the source directory or the source file.
- <targetdf>: the target directory or the target file. Put *A.xml files in <target>
EOF
exit
}
srcpath=$1
tgtpath=$2
if [ $# -lt 2 ]; then
usage
fi
if [ -d $srcpath ]; then
for file in ${srcpath}/*.xml ; do
tem=`echo ${file} | cut -d. -f1`
java -jar compareXml.jar ${srcpath}/${tem}.xml ${tgtpath}/${tem}.xml
done
fi
if [ -f $srcpath ]; then
java -jar compareXml.jar $srcpath $tgtpath
fi

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

View file

@ -0,0 +1,61 @@
package gov.noaa.nws.ncep.standalone;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "gov.noaa.nws.ncep.standalone";
// 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;
}
/**
* Returns an image descriptor for the image file at the given
* plug-in relative path
*
* @param path the path
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
}

View file

@ -0,0 +1,46 @@
package gov.noaa.nws.ncep.standalone;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
/**
* This class controls all aspects of the application's execution
*/
public class Application implements IApplication {
/* (non-Javadoc)
* @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
*/
public Object start(IApplicationContext context) throws Exception {
Display display = PlatformUI.createDisplay();
try {
int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
if (returnCode == PlatformUI.RETURN_RESTART)
return IApplication.EXIT_RESTART;
else
return IApplication.EXIT_OK;
} finally {
display.dispose();
}
}
/* (non-Javadoc)
* @see org.eclipse.equinox.app.IApplication#stop()
*/
public void stop() {
final IWorkbench workbench = PlatformUI.getWorkbench();
if (workbench == null)
return;
final Display display = workbench.getDisplay();
display.syncExec(new Runnable() {
public void run() {
if (!display.isDisposed())
workbench.close();
}
});
}
}

View file

@ -0,0 +1,48 @@
package gov.noaa.nws.ncep.standalone;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.ui.IWorkbenchWindow;
//import org.eclipse.ui.actions.ActionFactory;
//import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;
/**
* Converter Dialog
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 11/25/2009 187 Q. Zhou Initial
*
* </pre>
*
* @author Q. Zhou
* @version 1
*/
public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
//Declaring all the Workbench Actions
// private IWorkbenchAction newAction;
// private IWorkbenchAction saveAction;
// private IWorkbenchAction openPerspective;
public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
super(configurer);
}
protected void makeActions(IWorkbenchWindow window) {
// openPerspective= ActionFactory.OPEN_PERSPECTIVE_DIALOG.create(window);
// register(openPerspective);
}
protected void fillMenuBar(IMenuManager menuBar) {
}
}

View file

@ -0,0 +1,18 @@
package gov.noaa.nws.ncep.standalone;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchAdvisor;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
private static final String PERSPECTIVE_ID = "gov.noaa.nws.ncep.standalone.perspective";
public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
return new ApplicationWorkbenchWindowAdvisor(configurer);
}
public String getInitialWindowPerspectiveId() {
return PERSPECTIVE_ID;
}
}

View file

@ -0,0 +1,39 @@
package gov.noaa.nws.ncep.standalone;
import org.eclipse.swt.graphics.Point;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
/**
* Converter Dialog
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 11/25/2009 187 Q. Zhou Initial
*
* </pre>
*
* @author Q. Zhou
* @version 1
*/
public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
super(configurer);
}
public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
return new ApplicationActionBarAdvisor(configurer);
}
public void preWindowOpen() {
IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
configurer.setInitialSize(new Point(1000, 700));
configurer.setShowCoolBar(false);
configurer.setShowStatusLine(false);
}
}

View file

@ -0,0 +1,10 @@
package gov.noaa.nws.ncep.standalone;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
public class Perspective implements IPerspectiveFactory {
public void createInitialLayout(IPageLayout layout) {
}
}

View file

@ -0,0 +1,995 @@
/*
* gov.noaa.nws.ncep.standalone.clipvgf.ClipVGF
*
* Date created (as Jan 12, 2010)
*
* This code has been developed by the SIB for use in the AWIPS2 system.
*/
package gov.noaa.nws.ncep.standalone.clipvgf;
import static java.lang.Math.abs;
import static java.lang.Math.atan2;
import static java.lang.Math.cos;
import static java.lang.Math.pow;
import static java.lang.Math.sin;
import static java.lang.Math.sqrt;
import static java.lang.Math.toDegrees;
import static java.lang.Math.toRadians;
import gov.noaa.nws.ncep.standalone.joinvgf.JoinVGF;
import gov.noaa.nws.ncep.standalone.util.Util;
import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent;
import gov.noaa.nws.ncep.ui.pgen.elements.Arc;
import gov.noaa.nws.ncep.ui.pgen.elements.Layer;
import gov.noaa.nws.ncep.ui.pgen.elements.Line;
import gov.noaa.nws.ncep.ui.pgen.elements.KinkLine;
import gov.noaa.nws.ncep.ui.pgen.elements.MultiPointElement;
import gov.noaa.nws.ncep.ui.pgen.elements.Product;
import gov.noaa.nws.ncep.ui.pgen.elements.SinglePointElement;
import gov.noaa.nws.ncep.ui.pgen.gfa.Gfa;
import gov.noaa.nws.ncep.ui.pgen.file.ProductConverter;
import gov.noaa.nws.ncep.ui.pgen.file.Products;
import gov.noaa.nws.ncep.viz.common.dbQuery.NcDirectDbQuery;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.geotools.geometry.jts.JTS;
//import org.geotools.referencing.GeodeticCalculator;
//import org.geotools.referencing.datum.DefaultEllipsoid;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.exception.VizServerSideException;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.CoordinateSequence;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.LineString;
import com.vividsolutions.jts.geom.LinearRing;
import com.vividsolutions.jts.geom.MultiPolygon;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.Polygon;
import com.vividsolutions.jts.geom.impl.CoordinateArraySequence;
import com.vividsolutions.jts.io.WKBReader;
/**
* This is a standalone clipping application, replacement for clipvgf.
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* 06/11 213 Q. Zhou Modified convertArcToLine() for ellipse
* Due to refactoring, separate multipointLine to Line, Gfa, Circle...
* Added code to change arc line to arc
* </pre>
* @author mlaryukhin
*/
public class ClipVGF extends Thread {
/**
* Input parameter, defined by user; true to clip all the elements within the bounds, false -
* outside.
*/
public static boolean keep = true;
/** Input parameters. */
public String[] args;
/**
* The table alias to be looked up in CONFIG.CLO table, which corresponds to the table name in
* bounds schema.
*/
public String boundsTableAlias;
/** The columnd name which is extracted from arg1[1]. */
private String columnName;
/** The column value. To search for KZNY_8 it is sufficient to use KZNY. */
private String columnValue;
/** EDEX http server location. */
public static String httpServer;
/** Database name, currently defaulted to "ncep". */
public String database = "ncep";
/** Schema name, currently defaulted to "bounds". */
public String schema = "bounds";
/** Help file where the program description is stored. */
public static String HELP_FILE_NAME = "clipvgf.hlp";
/** Input file name. */
private String inputName;
/** Output file name to store results. */
private String outputName;
/** Factory */
private GeometryFactory geometryFactory = new GeometryFactory();
/** Bounds shape is to be converted to this polygon. */
private Polygon polygon;
/** Tolerance for coordinates to be treated as the same /close points. */
private final double PRECISION = 0.000000001;
/** An instance of JoinVGF to be used for joining touching parts. */
private JoinVGF joinvgf;
static{
// no logger needed in apache classes
Logger.getRootLogger().setLevel(Level.OFF);
}
/**
* Constructor.
*
* @param args
* <code>String[]</code> input parameters
* @throws VizException
*/
public ClipVGF(String[] args) throws VizException {
this.args = args;
checkParameters();
createPolygon();
}
/**
* Open a product file to replace or append to the current product list.
*
* @throws FileNotFoundException
*/
private List<Product> openProducts() throws FileNotFoundException {
Products products = Util.read(inputName);
return ProductConverter.convert(products);
}
/**
* Save the products to file.
*/
private void saveProducts(List<Product> productList) {
Products fileProducts = ProductConverter.convert(productList);
if (outputName != null) {
/*
* Write all products into one file.
*/
try {
Util.write(outputName, fileProducts, Products.class);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
/**
* Static method to clip the xml file.
*
* @param productList
*
* @return
*
* @throws FileNotFoundException
*
* @throws VizException
* if database fails
*/
private void clip(String inputName, String outputName) throws FileNotFoundException, VizException {
// open
List<Product> productList = openProducts();
// clip each Product
for (Product p : productList) {
clipProduct(p);
}
// save
saveProducts(productList);
}
/**
* Clips each individual product.
*
* @param p
*
* @return
*/
private void clipProduct(Product p) {
for (Layer layer : p.getLayers()) {
List<AbstractDrawableComponent> before = layer.getDrawables();
List<AbstractDrawableComponent> after = new ArrayList<AbstractDrawableComponent>();
boolean changed = false;
for (AbstractDrawableComponent adc : before) {
List<AbstractDrawableComponent> c = clipDrawableComponent(adc);
if (c != null && !c.isEmpty()) {
after.addAll(c);
}
changed = true;
}
if (changed) {
while (getJoinVGF().joinItself(after)) {
}
layer.setDrawables(after);
}
}
}
/**
* Getter for JoinVGF instance.
*
* @return
*/
private JoinVGF getJoinVGF() {
if (joinvgf == null) {
joinvgf = new JoinVGF(null);
}
return joinvgf;
}
/**
* Clips DrawableComponent.
*
* @param adc
*
* @return
*/
private List<AbstractDrawableComponent> clipDrawableComponent(AbstractDrawableComponent adc) {
List<AbstractDrawableComponent> ret = null;
if (adc instanceof SinglePointElement) {
ret = clipSinglePointElement(adc);
}
else if (adc instanceof MultiPointElement) {
// circle is a special case, convert it to Line (the same way it is done in old clipvgf)
// But cave has Arc, so add the line points to Arc to make a special arc.
// After clipping, convert it back to Arc with right angles and points.
AbstractDrawableComponent adcOrig = null;
if (adc instanceof Arc) {
// we cannot use polymorphism here, we need pure LIne object to
// be able to draw points
adcOrig = adc.copy();
adc = convertArcToLine((Arc) adc);
}
// if (((MultiPointElement) adc).isClosedLine()) {
// adc.getPoints().add(adc.getPoints().get(0));
// }
// MultiPointElement include Line, Kinkline, Gfa,and Jet...Jet is not clised
else if (adc instanceof Line) {
if (((Line) adc).isClosedLine())
adc.getPoints().add(adc.getPoints().get(0));
}
else if (adc instanceof Gfa) {
if (((Gfa) adc).isClosedLine())
adc.getPoints().add(adc.getPoints().get(0));
}
else if (adc instanceof KinkLine) {
if (((KinkLine) adc).isClosedLine())
adc.getPoints().add(adc.getPoints().get(0));
}
ret = clipMultiPointElement(adc);
if (ret == null)
return null;
/**
* convert special arc to normal arc
*/
for (int i=0; i<ret.size(); i++) {
if (ret.get(i).getPgenCategory().equalsIgnoreCase("Arc")) {
Arc newArc = (Arc)ret.get(i).getPrimaryDE();
//get special points
Coordinate center = ((Arc)adcOrig).getCenterPoint();
Coordinate circum = ((Arc)adcOrig).getCircumferencePoint();
Coordinate startPt = newArc.getPoints().get(0);
Coordinate endPt = newArc.getPoints().get(newArc.getPoints().size()-1);
// do conversion
Coordinate centerProjection = new Coordinate();
Coordinate circumProjection = new Coordinate();
Coordinate startPtProjection =new Coordinate();
Coordinate endPtProjection = new Coordinate();
CoordinateReferenceSystem crs = MapUtil.constructStereographic(MapUtil.AWIPS_EARTH_RADIUS,
MapUtil.AWIPS_EARTH_RADIUS, center.y, center.x);
MathTransform fromLatLon = null;
MathTransform toLatLon = null;
try {
fromLatLon = MapUtil.getTransformFromLatLon(crs);
} catch (FactoryException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if (fromLatLon != null) {
try {
toLatLon = fromLatLon.inverse();
} catch (org.opengis.referencing.operation.NoninvertibleTransformException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try {
JTS.transform(center, centerProjection, fromLatLon);
JTS.transform(circum, circumProjection, fromLatLon);
JTS.transform(startPt, startPtProjection, fromLatLon);
JTS.transform(endPt, endPtProjection, fromLatLon);
} catch (TransformException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// double theta = toDegrees(atan2(circumProjection.y - centerProjection.y, circumProjection.x - centerProjection.x)); //((Arc)adcOrig).getStartAngle()
// double aStart = toDegrees(atan2(startPtProjection.y - centerProjection.y, startPtProjection.x - centerProjection.x));
// double aEnd = toDegrees(atan2(endPtProjection.y - center.y, endPtProjection.x - centerProjection.x));
double x0 = centerProjection.x; // Center
double y0 = centerProjection.y;
double x1 = circumProjection.x;
double y1 = circumProjection.y;
double xs = startPtProjection.x;
double ys = startPtProjection.y;
double xe = endPtProjection.x;
double ye = endPtProjection.y;
double radius = sqrt(pow((y1 - y0), 2) + pow((x1 - x0), 2));
double radius2 = radius * newArc.getAxisRatio();
// in polar coordinate
double theta = toDegrees(atan2(y1 - y0, x1 - x0));
double beta = atan2(y1 - y0, x1 - x0);
double sinbeta = Math.sin(beta);
double cosbeta = Math.cos(beta);
// Let alpha be start angle, (xs, ys) be the ellipse point at start angle. x0=y0=0.
// double xs = x0 + (radius * cosalpha * cosbeta - radius2 * sinalpha * sinbeta);
// double ys = y0 + (radius * cosalpha * sinbeta + radius2 * sinalpha * cosbeta);
// we get cosalpha:
// cosalpha = (ys*sinbeta+xs*cosbeta)/radius/(cosbeta*cosbeta+sinbeta*sinbeta) = (ys*sinbeta+xs*cosbeta)/radius
// Math.acos(cosalpha) = 0~PI. Need to treat according to xs,ys
double cosalpha = 0;
cosalpha = (ys*sinbeta+xs*cosbeta)/radius;
double startAngle = Math.toDegrees(Math.acos(cosalpha));
cosalpha = (ye*sinbeta+xe*cosbeta)/radius;
double endAngle = Math.toDegrees(Math.acos(cosalpha));
//System.out.println("newtheta "+theta +" "+startAngle +" "+endAngle);
double xTest = (radius * cos(toRadians(-startAngle)) * cosbeta - radius2 * sin(toRadians(-startAngle)) * sinbeta);
double yTest = (radius * cos(toRadians(-startAngle)) * sinbeta + radius2 * sin(toRadians(-startAngle)) * cosbeta);
if (abs((xs-xTest)/xs) > 0.005 || abs((ys-yTest)/ys) > 0.005)
startAngle = 360 -startAngle;
//System.out.println("xstest "+xTest +" "+yTest );
xTest = (radius * cos(toRadians(-endAngle)) * cosbeta - radius2 * sin(toRadians(-endAngle)) * sinbeta);
yTest = (radius * cos(toRadians(-endAngle)) * sinbeta + radius2 * sin(toRadians(-endAngle)) * cosbeta);
if (abs((xe-xTest)/xe) > 0.005 || abs((ye-yTest)/ye) > 0.005) //-90866.87 176333.57 -90448.95 176440.64
endAngle = 360 -endAngle;
//System.out.println("xetest "+xTest +" "+yTest );
if ( abs(endAngle) <0.001) //360
endAngle = 360 + endAngle;
if (startAngle >= endAngle) //start to circum to end
endAngle = 360 + endAngle;
//System.out.println("xe "+xs +" "+ys +" "+xe +" "+ye+" "+" "+x1 +" "+y1 +" "+xTest+" "+yTest);
// if (newArc.getStartAngle() <= 180) {
// if (startAngle < previousEndAngle)
// startAngle = 360 -startAngle;
// if (startAngle >= endAngle)
// endAngle = 360 - endAngle;
// if (abs(startAngle - endAngle)<180 && ret.get(i).getPoints().size() >36)
// endAngle = 360 - endAngle;
// previousEndAngle = endAngle;
// }
// else {
// startAngle = 360 -startAngle;
// if (startAngle < previousEndAngle)
// startAngle = 360 -startAngle;
// if (startAngle >= endAngle)
// endAngle = 360 - endAngle;
// previousEndAngle = endAngle;
// }
//System.out.println("& "+startAngle +" "+endAngle);
newArc.setCenterPoint(center);
newArc.setCircumferencePoint(circum);
newArc.setStartAngle(startAngle);
newArc.setEndAngle(endAngle);
ArrayList<Coordinate> pts = new ArrayList<Coordinate>();
pts.add(center);
pts.add(circum);
newArc.setPoints(pts);
ret.set(i, newArc);
}
}
}
return ret;
}
/**
* Clips SinglePointElement, depending on keep variable. If keep is true, then the element stays
* if its location is within the polygon.
*
* @param elementToClip
*
* @return the same element if needed to stay, a list of ofjects if this one is split in parts,
* or null
*/
private List<AbstractDrawableComponent> clipSinglePointElement(AbstractDrawableComponent elementToClip) {
// using JTS Polygon to determine if a point is inside the polygon
Coordinate c = null;
if (elementToClip instanceof SinglePointElement) {
c = ((SinglePointElement) elementToClip).getLocation();
} else if (elementToClip instanceof Arc) {
c = ((Arc) elementToClip).getCenterPoint();
}
Point p = geometryFactory.createPoint(c);
if (pointStays(p)) {
ArrayList<AbstractDrawableComponent> ret = new ArrayList<AbstractDrawableComponent>();
ret.add(elementToClip);
return ret;
}
return null;
}
/**
* Converts Arc to pure Line object. We cannot use polymorphism here since Arc extends Line.
*
* @param arc
*
* @return
*/
private Arc convertArcToLine(Arc arc) {
//Line line = new Line();
Arc newArc = new Arc();
try {
// create points
ArrayList<Coordinate> points = new ArrayList<Coordinate>();
Coordinate c0 = arc.getCenterPoint();
Coordinate c0world = new Coordinate();
Coordinate c1 = arc.getCircumferencePoint();
Coordinate c1world = new Coordinate();
CoordinateReferenceSystem crs = MapUtil.constructStereographic(MapUtil.AWIPS_EARTH_RADIUS,
MapUtil.AWIPS_EARTH_RADIUS, c0.y, c0.x);
MathTransform fromLatLon = MapUtil.getTransformFromLatLon(crs);
MathTransform toLatLon = fromLatLon.inverse();
JTS.transform(c0, c0world, fromLatLon);
JTS.transform(c1, c1world, fromLatLon);
double x0 = c0world.x; // Center
double y0 = c0world.y;
double x1 = c1world.x; // CircumferencePoint
double y1 = c1world.y;
double radius = sqrt(pow((y1 - y0), 2) + pow((x1 - x0), 2));
double radius2 = radius * arc.getAxisRatio();
// theta in polar coordinate
double theta = toDegrees(atan2(y1 - y0, x1 - x0));
// double a1 = theta - arc.getStartAngle();
// double a2 = theta - arc.getEndAngle();
double a1 = -arc.getStartAngle();
double a2 = -arc.getEndAngle();
if (abs(a1 - a2) < 0.00001 ) a2 -= 360; //whole circle
double beta = atan2(y1 - y0, x1 - x0);
double sinbeta = Math.sin(beta);
double cosbeta = Math.cos(beta);
//System.out.println("*****angles "+theta +" "+a1 +" "+a2);
for ( double angle =a1; angle > a2; angle -= 5)
{
double alpha = toRadians(angle) ;
double sinalpha = Math.sin(alpha);
double cosalpha = Math.cos(alpha);
double x = x0 + (radius * cosalpha * cosbeta - radius2 * sinalpha * sinbeta);
double y = y0 + (radius * cosalpha * sinbeta + radius2 * sinalpha * cosbeta);
Coordinate c = new Coordinate(x, y);
JTS.transform(c, c, toLatLon);
points.add(c);
}
double lastA2x = x0 + (radius * Math.cos(toRadians(a2)) * cosbeta - radius2 * Math.sin(toRadians(a2)) * sinbeta);
double lastA2y = y0 + (radius * Math.cos(toRadians(a2)) * sinbeta + radius2 * Math.sin(toRadians(a2)) * cosbeta);
Coordinate c = new Coordinate(lastA2x, lastA2y);
JTS.transform(c, c, toLatLon);
points.add(c);
arc.setPoints(points);
// line.setLineWidth(arc.getLineWidth());
// line.setSizeScale(arc.getSizeScale());
// line.setSmoothFactor(arc.getSmoothFactor());
// line.setClosed(false);
// line.setFilled(arc.isFilled());
// line.setFillPattern(arc.getFillPattern());
// line.setPgenCategory("Lines");
// line.setPgenType("LINE_SOLID");
// line.setPoints(points);
// line.setColors(arc.getColors());
} catch (Exception e) {
// e.printStackTrace();
// line = null;
}
return arc;
//return line;
}
/**
* Clips MultiPointElement, depending on keep variable. If keep is true, then the element stays
* if its location is within the polygon.
*
* @param elementToClip
*
* @return
*/
private List<AbstractDrawableComponent> clipMultiPointElement(AbstractDrawableComponent elementToClip) {
ArrayList<Coordinate> pointsActual = ((MultiPointElement) elementToClip).getPoints();
/*
* first insert additional points which are on the border
*/
// and keep track of the newly inserted points
ArrayList<Coordinate> pointsOnBorder = new ArrayList<Coordinate>();
/*
* Process intersections
*/
ArrayList<Coordinate> pointsIncludingIntersections = processMultiPointElementIntersection(pointsActual);
/*
* Now leave only the points which are inside of the polygon (if keep is false, then
* outside)
*/
ArrayList<Coordinate> pointsToLeave = processPointsToLeave(pointsOnBorder,
pointsIncludingIntersections);
if (!pointsToLeave.isEmpty()) {
((MultiPointElement) elementToClip).setPoints(pointsToLeave);
ArrayList<AbstractDrawableComponent> ret = new ArrayList<AbstractDrawableComponent>();
// need to split in chunks if two consecutive points are newly
// inserted on the border
// boolean closed = ((MultiPointElement) elementToClip).isClosedLine();
boolean closed = false; //jet is false
if (elementToClip instanceof Line) {
closed = ((Line) elementToClip).isClosedLine();
}
// else if (elementToClip instanceof Arc) { closed = false
// closed = ((Arc) elementToClip).isClosedLine();
// }
else if (elementToClip instanceof Gfa) {
closed = ((Gfa) elementToClip).isClosedLine();
}
else if (elementToClip instanceof KinkLine) {
closed = ((KinkLine) elementToClip).isClosedLine();
}
if (isToSplit(elementToClip, pointsOnBorder)) {
List<AbstractDrawableComponent> splitted = split(elementToClip, pointsOnBorder);
// combine if needed
combineFirstAndLast(closed, splitted);
ret.addAll(splitted);
} else {
((MultiPointElement) elementToClip).setClosed(false);
ret.add(elementToClip);
}
return ret;
}
return null;
}
/**
* Process intersections
*
* @param pointsActual
*
* @return pointsIncludingIntersections
*/
private ArrayList<Coordinate> processMultiPointElementIntersection(ArrayList<Coordinate> pointsActual) {
ArrayList<Coordinate> pointsIncludingIntersections = new ArrayList<Coordinate>();
Coordinate[] line = new Coordinate[2];
for (int i = 0; i < pointsActual.size() - 1; i++) {
line[0] = pointsActual.get(i);
line[1] = pointsActual.get(i + 1);
CoordinateArraySequence cas = new CoordinateArraySequence(line);
LineString ls = new LineString(cas, geometryFactory);
Geometry intersection = null;
if (polygon.getExteriorRing().intersects(ls)) {
intersection = polygon.intersection(ls);
}
// add first point
pointsIncludingIntersections.add(pointsActual.get(i));
// add all the intersection points
if (intersection != null) {
for (Coordinate c : intersection.getCoordinates()) {
if (!compareCoordinates(c, line[0]) && !compareCoordinates(c, line[1])) {
// no need to add the same coordinates twice
pointsIncludingIntersections.add(c);
}
}
}
}
// add the last Coordinate
pointsIncludingIntersections.add(pointsActual.get(pointsActual.size() - 1));
return pointsIncludingIntersections;
}
/**
* Process points to leave.
*
* @param pointsOnBorder
*
* @param pointsIncludingIntersections
*
* @return
*/
private ArrayList<Coordinate> processPointsToLeave(ArrayList<Coordinate> pointsOnBorder,
ArrayList<Coordinate> pointsIncludingIntersections) {
ArrayList<Coordinate> pointsToLeave = new ArrayList<Coordinate>();
for (Coordinate c : pointsIncludingIntersections) {
Point p = geometryFactory.createPoint(c);
// If KEEP is false and the point is on border, it should stay.
boolean onBorder = polygon.getExteriorRing().distance(p) < PRECISION;
if (onBorder) {
pointsOnBorder.add(c);
}
if (pointStays(p) || onBorder) {
pointsToLeave.add(c);
}
}
return pointsToLeave;
}
/**
* Decides whether the point is staying or being clipped.
*
* <pre>
* Inverse XOR operation !(A&circ;B) here: INSIDE POLYGON KEEP STAYS true true true false true false true
* false false false false true
* </pre>
*
* @param p
*
* @param pointsOnBorder
*
* @return true to stay, false to clip
*/
private boolean pointStays(Point p) {
return !(polygon.contains(p) ^ keep);
}
/**
* Compares two Coordinate objects by comparing x and y coordinates. If the coordinates are
* close within a precision, returns true, otherwise false.
*
* @param c1
*
* @param c2
*
* @return true is x and y are very close, false otherwise
*/
private boolean compareCoordinates(Coordinate c1, Coordinate c2) {
if (abs(c1.x - c2.x) < PRECISION && abs(c1.y - c2.y) < PRECISION) {
return true;
}
return false;
}
/**
* This method determines if a component needs to be splitted in chunks when two consecutive
* points are newly inserted on the border.
*
* @param ret
*
* @return true if need to split, false otherwise
*/
private boolean isToSplit(AbstractDrawableComponent adc, ArrayList<Coordinate> pointsOnBorder) {
if (adc instanceof MultiPointElement) {
ArrayList<Coordinate> points = ((MultiPointElement) adc).getPoints();
for (int i = 0; i < points.size() - 2; i++) {
if (pointsOnBorder.contains(points.get(i)) && pointsOnBorder.contains(points.get(i + 1))) {
return true;
}
}
}
return false;
}
/**
* Splits the component, use only if isNeedToSplit method returns true.
*
* @param adc
*
* @param pointsOnBorder
*
* @return
*/
private List<AbstractDrawableComponent> split(AbstractDrawableComponent adc,
ArrayList<Coordinate> pointsOnBorder) {
ArrayList<AbstractDrawableComponent> ret = new ArrayList<AbstractDrawableComponent>();
if (adc instanceof MultiPointElement) {
ArrayList<Coordinate> points = ((MultiPointElement) adc).getPoints();
ArrayList<Coordinate> firstElementPoints = new ArrayList<Coordinate>();
ArrayList<Coordinate> remainingPoints = new ArrayList<Coordinate>();
int i = 0;
for (i = 0; i < points.size() - 2; i++) {
firstElementPoints.add(points.get(i));
if (i == 0) continue;
if (pointsOnBorder.contains(points.get(i)) && pointsOnBorder.contains(points.get(i + 1))) {
i++;
break;
}
}
// continue looping
for (; i < points.size(); i++) {
remainingPoints.add(points.get(i));
}
AbstractDrawableComponent copy = adc.copy();
((MultiPointElement) adc).setPoints(firstElementPoints);
if (firstElementPoints.size() > 1) {
((MultiPointElement) adc).setClosed(false);
ret.add(adc);
}
((MultiPointElement) copy).setPoints(remainingPoints);
// by this time we have two elements, the second one might need to
// be splitted, recursive call to the same method
if (copy.getPoints().size() > 2 && isToSplit(copy, pointsOnBorder)) {
ret.addAll(split(copy, pointsOnBorder));
} else {
((MultiPointElement) copy).setClosed(false);
ret.add(copy);
}
}
return ret;
}
/**
* First and last object created after the clipping procedure can be combined if they share a
* point.
*
* @param closed
*
* @param splitted
*/
private void combineFirstAndLast(boolean closed, List<AbstractDrawableComponent> splitted) {
AbstractDrawableComponent first = splitted.get(0);
AbstractDrawableComponent last = splitted.get(splitted.size() - 1);
if (compareCoordinates(first.getPoints().get(0), last.getPoints().get(last.getPoints().size() - 1))) {
closed = true;
}
if (closed && !keep && splitted.size() > 1) {
splitted.remove(0);
// combine first and last
last.getPoints().addAll(first.getPoints());
// remove duplicates
((MultiPointElement) last).setPoints(removeDuplicates(((MultiPointElement) last).getPoints()));
((MultiPointElement) last).setClosed(false);
}
}
/**
* Creates a bound polygon.
*
* @throws VizException
*/
private void createPolygon() throws VizException {
String sql = "select t.table_name from config.clo t where t.alias_name = upper('" + boundsTableAlias + "')";
List<Object[]> firstResult = performQuery(sql);
String tableName = null; // comes from config.clo
if(firstResult.isEmpty()){
// no record, this means use it as a table name
tableName = boundsTableAlias;
} else {
for (Object o : firstResult.get(0)) {
tableName = (String) o;
}
}
if (tableName == null) {
throw new IllegalArgumentException(
"Second argument invalid format: no such record exists in config.clo table or invalid table name");
}
sql = "SELECT AsBinary(t.the_geom) FROM " + schema + "." + tableName + " t" + " WHERE t."
+ columnName + " like '" + columnValue + "%'";
List<Object[]> secondResult = performQuery(sql);
WKBReader wkbReader = new WKBReader();
if (secondResult != null && !secondResult.isEmpty()) {
Object[] bound = secondResult.get(0); // take the very first one
try {
Geometry g = wkbReader.read((byte[]) bound[0]);
if(g instanceof MultiPolygon){
MultiPolygon mg = (MultiPolygon) g;
int max = 0;
int index = 0;
for (int i = 0; i < mg.getNumGeometries(); i++) {
if (max < mg.getGeometryN(i).getNumPoints()){
max = mg.getGeometryN(i).getNumPoints();
index = i;
}
}
polygon = (Polygon) mg.getGeometryN(index);
return;
}
CoordinateSequence sequence = new CoordinateArraySequence(g.getCoordinates());
LinearRing ring = new LinearRing(sequence, geometryFactory);
polygon = new Polygon(ring, null, geometryFactory);
} catch (Exception e) {
// cannot do anything here, wrong data
// the same as database problem
throw new VizException(e);
}
} else {
throw new RuntimeException("No bounds found, please check parameters");
}
}
/**
* This method is a workaround for non-Eclipse-plugin applications.
*
* @param sql
* @return
* @throws VizException
* @throws VizServerSideException
*/
private List<Object[]> performQuery(String sql) throws VizException, VizServerSideException {
NcDirectDbQuery.setHttpServer(httpServer);
List<Object[]> res = NcDirectDbQuery.executeQuery(sql, database, QueryLanguage.SQL);
return res;
}
/**
* Helper method to remove duplicates from array list, returns a new object with no duplicates.
*
* @param <T>
*
* @param list
*
* @return
*/
private <T> ArrayList<T> removeDuplicates(ArrayList<T> list) {
ArrayList<T> ret = new ArrayList<T>();
for (T obj : list) {
if (!ret.contains(obj)) {
ret.add(obj);
}
}
return ret;
}
/**
* Entry point.
*
* @param args
*/
public void run() {
long time = System.currentTimeMillis();
System.out.println("\nClipping started: " + inputName);
try {
clip(args[0], args[3]);
} catch (FileNotFoundException e) {
throw new RuntimeException("Could not open " + args[0] + " file");
} catch (VizException e) {
throw new RuntimeException("ERROR: Database failed");
}
System.out.println("Clipping finished: " + (System.currentTimeMillis() - time) + "ms");
}
/**
* Checks parameters and throws IllegalArgumentException if these parameters do not pass
* validation.
*
* @param args
*
* @see ClipVGFDialog.getProgramDescription()
*/
private void checkParameters() {
if (args.length < 4) {
// ignore args[4], we always "exact", never "rough"
throw new IllegalArgumentException("Not enough arguments");
}
// "STATEBNDS|<STATE>IL"
String[] arg1 = args[1].split("\\|");
if (arg1.length != 2 || !(arg1[1].indexOf("<") > -1)) {
throw new IllegalArgumentException("Second argument invalid format");
}
boundsTableAlias = arg1[0];
// extract <STATE> and sate as column name
columnName = arg1[1].substring(arg1[1].indexOf("<") + 1, arg1[1].indexOf(">"));
columnValue = arg1[1].substring(arg1[1].indexOf(">") + 1, arg1[1].length());
if (args.length > 5) {
httpServer = args[5];
// VizApp.setHttpServer(httpServer);
}
if (boundsTableAlias.isEmpty() || columnValue.isEmpty()) {
throw new IllegalArgumentException("boundsTable or firId are not set up correctly");
} else if (httpServer == null) {
throw new IllegalArgumentException("EDEX http server is not set up correctly");
}
inputName = args[0];
outputName = args[3];
if ("notkeep".equalsIgnoreCase(args[2])) {
// explicitly leave everything what is outside of the polygon only
// if "notkeep" is specified. everything is interpreted as "keep"
ClipVGF.keep = false;
} else {
ClipVGF.keep = true;
}
}
/**
* Description.
*
* @return
*/
public static String getProgramDescription() {
try {
return Util.getContent(HELP_FILE_NAME).toString();
} catch (IOException e) {
return "";
}
}
/**
* Entry point for command line. (Not implemented yet)
*
* @param args
*/
public static void main(String[] args) {
if (args.length == 0 || "--help".equals(args[0]) || "/h".equalsIgnoreCase(args[0])) {
System.out.println(getProgramDescription());
return;
} // else proceed
try {
ClipVGF thread = new ClipVGF(args);
thread.start();
} catch (VizException e) {
System.err.println("Database error");
e.printStackTrace();
}
}
}

View file

@ -0,0 +1,181 @@
/*
* gov.noaa.nws.ncep.standalone.clipvgf.ClipVGFDialog
*
* Date created (as Jan 12, 2010)
*
* This code has been developed by the SIB for use in the AWIPS2 system.
*/
package gov.noaa.nws.ncep.standalone.clipvgf;
import java.io.File;
import java.io.IOException;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
/**
* ClipVGFDialog - GUI part of ClipVGF application.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ------------ --------------------------
* 01/21/2010 197 mlaryukhin Initial created
*
* </pre>
*
* @author mlaryukhin
*/
public class ClipVGFDialog extends TitleAreaDialog {
private Text server;
private Text inputFilename;
private Text clipBound;
private Text keepFlag;
private Text outputFilename;
private Label statusLbl;
private File currentDir;
private final int TEXT_SIZE = 700;
private final String DEFAULT_SERVER = "http://localhost:9581/services";
private final Color RED = new Color(null, 255, 0, 0);
private final Color DARK_GREEN = new Color(null, 0, 100, 0);
public ClipVGFDialog(Shell parentShell) {
super(parentShell);
currentDir = new File(".");
}
@Override
protected Control createContents(Composite parent) {
Control contents = super.createContents(parent);
setTitle("Clip PGen XML");
setMessage("This program clips elements in a VGF file based on a bounds specification.");
return contents;
}
@Override
protected Control createDialogArea(final Composite parent) {
StyledText area = new StyledText(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
GridData gd = new GridData(GridData.VERTICAL_ALIGN_FILL);
gd.horizontalSpan = 3;
gd.heightHint = 200;
gd.widthHint = TEXT_SIZE + 100;
area.setLayoutData(gd);
area.setText(ClipVGF.getProgramDescription());
Font font = new Font(parent.getDisplay(), "Courier", 10, SWT.NORMAL);
area.setFont(font);
area.setEditable(false);
Composite comp = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
comp.setLayout(layout);
new Label(comp, SWT.NONE).setText("EDEX http server: ");
server = new Text(comp, SWT.LEFT);
gd = new GridData(TEXT_SIZE, SWT.DEFAULT);
gd.horizontalSpan = 2;
server.setLayoutData(gd);
new Label(comp, SWT.NONE).setText("Input file name: ");
inputFilename = new Text(comp, SWT.LEFT);
gd = new GridData(TEXT_SIZE, SWT.DEFAULT);
gd.horizontalSpan = 2;
inputFilename.setLayoutData(gd);
new Label(comp, SWT.NONE).setText("Clip bound: ");
clipBound = new Text(comp, SWT.LEFT);
gd = new GridData(TEXT_SIZE, SWT.DEFAULT);
gd.horizontalSpan = 2;
clipBound.setLayoutData(gd);
new Label(comp, SWT.NONE).setText("Keep flag: ");
keepFlag = new Text(comp, SWT.LEFT);
gd = new GridData(TEXT_SIZE, SWT.DEFAULT);
gd.horizontalSpan = 2;
keepFlag.setLayoutData(gd);
new Label(comp, SWT.NONE).setText("Output file name: ");
outputFilename = new Text(comp, SWT.LEFT);
gd = new GridData(TEXT_SIZE, SWT.DEFAULT);
gd.horizontalSpan = 2;
outputFilename.setLayoutData(gd);
statusLbl = new Label(comp, SWT.RIGHT);
gd = new GridData(SWT.RIGHT, SWT.TOP, true, false, 3, 1);
gd.widthHint = TEXT_SIZE;
statusLbl.setLayoutData(gd);
// default values
server.setText(DEFAULT_SERVER);
try {
inputFilename.setText(currentDir.getCanonicalPath() + File.separator + "input.xml");
outputFilename.setText(currentDir.getCanonicalPath() + File.separator + "output.xml");
} catch (IOException e) {
inputFilename.setText("");
outputFilename.setText("");
}
keepFlag.setText("keep");
return parent;
}
@Override
protected void createButtonsForButtonBar(Composite parent) {
createOkButton(parent, IDialogConstants.OK_ID);
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}
private Button createOkButton(Composite parent, int id) {
// increment the number of columns in the button bar
((GridLayout) parent.getLayout()).numColumns++;
Button button = new Button(parent, SWT.PUSH);
button.setText(" Clip ");
button.setData(id);
button.addSelectionListener(new OkListener());
Shell shell = parent.getShell();
if (shell != null) {
shell.setDefaultButton(button);
}
setButtonLayoutData(button);
return button;
}
/**
* Listener implementation
*
* @author mlaryukhin
*/
class OkListener extends SelectionAdapter {
@Override
public void widgetSelected(SelectionEvent event) {
String[] args = { inputFilename.getText(), clipBound.getText(), keepFlag.getText(),
outputFilename.getText(), "exact", server.getText() };
try {
// new thread so it would not freeze GUI
ClipVGF thread = new ClipVGF(args);
thread.start();
} catch (Exception e) {
e.printStackTrace();
statusLbl.setForeground(RED);
statusLbl.setText("Error");
return;
}
statusLbl.setForeground(DARK_GREEN);
statusLbl.setText("Complete");
}
}
}

View file

@ -0,0 +1,30 @@
/*
* gov.noaa.nws.ncep.standalone.clipvgf.ClipVGFHandler
*
* Date created (as Jan 12, 2010)
*
* This code has been developed by the SIB for use in the AWIPS2 system.
*/
package gov.noaa.nws.ncep.standalone.clipvgf;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.handlers.HandlerUtil;
/**
* ClipVGF Handler
*
* @author mlaryukhin
*/
public class ClipVGFHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ClipVGFDialog dialog = new ClipVGFDialog(HandlerUtil.getActiveWorkbenchWindow(event).getShell());
dialog.open();
return null;
}
}

Some files were not shown because too many files have changed in this diff Show more