copy constructCRSfromWKT from McidasCRSBuilder because eclipse PDE build fails to import gov.noaa.nws.ncep.edex.common

Former-commit-id: 270312e06b [formerly c0cc9e88c6]
Former-commit-id: dcd3c56bf3
This commit is contained in:
AWIPS User 2015-06-23 16:18:27 -06:00
parent ce7c0f2814
commit c5185e7a52
6 changed files with 80 additions and 25 deletions

View file

@ -9,7 +9,7 @@ Export-Package: com.raytheon.edex.plugin.satellite,
com.raytheon.edex.util.satellite
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin.satellite;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.satellite;bundle-version="1.14.0",
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
com.raytheon.uf.common.geospatial;bundle-version="1.14.1",
@ -23,6 +23,3 @@ Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
com.raytheon.uf.edex.database;bundle-version="1.0.0",
com.raytheon.uf.edex.menus;bundle-version="1.0.0",
com.raytheon.uf.common.numeric;bundle-version="1.14.0"
Import-Package: gov.noaa.nws.ncep.common.tools,
gov.noaa.nws.ncep.edex.util,
org.apache.commons.codec.binary

View file

@ -21,7 +21,6 @@
package com.raytheon.edex.util.satellite;
import java.awt.geom.Rectangle2D;
import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN;
import org.geotools.geometry.DirectPosition2D;
import org.opengis.referencing.crs.ProjectedCRS;
@ -376,9 +375,9 @@ public class SatSpatialFactory {
int upperLeftLine, int xres, int yres, ProjectedCRS crs,
Geometry geometry) {
// do your shit here.
float dx = IDecoderConstantsN.FLOAT_MISSING;
float dy = IDecoderConstantsN.FLOAT_MISSING;
// do your stuff here.
float dx = 999999.f;
float dy = 999999.f;
double minX, minY;
//if (crsType == PROJ_GVAR) { // for native projection

View file

@ -15,7 +15,8 @@ Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
com.raytheon.uf.common.dataquery;bundle-version="1.0.0",
com.raytheon.uf.common.datastorage;bundle-version="1.12.1174",
org.hibernate;bundle-version="1.0.0",
com.raytheon.uf.common.numeric;bundle-version="1.14.0"
com.raytheon.uf.common.numeric;bundle-version="1.14.0",
com.raytheon.uf.edex.decodertools;bundle-version="1.14.0"
Export-Package: com.raytheon.uf.common.dataplugin.satellite,
com.raytheon.uf.common.dataplugin.satellite.units,
com.raytheon.uf.common.dataplugin.satellite.units.counts,
@ -24,5 +25,3 @@ Export-Package: com.raytheon.uf.common.dataplugin.satellite,
com.raytheon.uf.common.dataplugin.satellite.units.goes.convert,
com.raytheon.uf.common.dataplugin.satellite.units.ir,
com.raytheon.uf.common.dataplugin.satellite.units.water
Import-Package: gov.noaa.nws.ncep.common.dataplugin.mcidas,
gov.noaa.nws.ncep.common.tools

View file

@ -20,12 +20,13 @@
package com.raytheon.uf.common.dataplugin.satellite;
import gov.noaa.nws.ncep.common.dataplugin.mcidas.McidasMapCoverage;
import gov.noaa.nws.ncep.common.dataplugin.mcidas.McidasRecord;
import gov.noaa.nws.ncep.common.dataplugin.mcidas.McidasSpatialFactory;
import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN;
//import gov.noaa.nws.ncep.edex.util.McidasCRSBuilder;
import com.raytheon.uf.edex.decodertools.core.IDecoderConstants;
import java.awt.geom.Rectangle2D;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -48,16 +49,21 @@ import org.geotools.coverage.grid.GridGeometry2D;
import org.geotools.geometry.Envelope2D;
import org.geotools.geometry.GeneralEnvelope;
import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.geotools.referencing.operation.DefaultMathTransformFactory;
import org.hibernate.annotations.Type;
import org.opengis.coverage.grid.GridEnvelope;
import org.opengis.geometry.Envelope;
import org.opengis.parameter.ParameterValueGroup;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.NoSuchIdentifierException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.crs.ProjectedCRS;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.geospatial.CRSCache;
import com.raytheon.uf.common.geospatial.IGridGeometryProvider;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.geospatial.adapter.GeometryAdapter;
import com.raytheon.uf.common.geospatial.util.EnvelopeIntersection;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@ -90,6 +96,8 @@ import com.vividsolutions.jts.geom.Polygon;
* May 19, 2015 mjames@ucar Added decoding of GVAR native projection products,
* increased crsWKT to 5120 for GVAR the_geom
* May 21, 2015 mjames@ucar Added display capability for GVAR projection products
* Jun 23, 2015 mjames@ucar Copied constructCRSfromWKT and constructCRS from
* McidasCRSBuilder because PDE build dependency failed
* </pre>
*/
@Entity
@ -233,10 +241,10 @@ public class SatMapCoverage extends PersistableDataObject<Object> implements
this.ny = ny;
this.dx = dx;
this.dy = dy;
this.upperLeftElement = IDecoderConstantsN.INTEGER_MISSING;
this.upperLeftLine = IDecoderConstantsN.INTEGER_MISSING;
this.elementRes = IDecoderConstantsN.INTEGER_MISSING;
this.lineRes = IDecoderConstantsN.INTEGER_MISSING;
this.upperLeftElement = IDecoderConstants.VAL_MISSING;
this.upperLeftLine = IDecoderConstants.VAL_MISSING;
this.elementRes = IDecoderConstants.VAL_MISSING;
this.lineRes = IDecoderConstants.VAL_MISSING;
this.crsObject = crs;
Geometry latLonGeometry = null;
try {
@ -483,8 +491,7 @@ public class SatMapCoverage extends PersistableDataObject<Object> implements
if (crsObject == null && crsWKT != null) {
try {
if (this.projection == PROJ_GVAR) {
crsObject = McidasSpatialFactory.getInstance()
.constructCRSfromWKT(crsWKT);
crsObject = constructCRSfromWKT(crsWKT);
} else {
crsObject = CRSCache.getInstance()
@ -584,5 +591,58 @@ public class SatMapCoverage extends PersistableDataObject<Object> implements
return false;
return true;
}
public static ProjectedCRS constructCRSfromWKT(String crsWKT) {
Pattern p = Pattern.compile("PROJCS\\[\"MCIDAS\\sAREA\\s(.*)\"");
Matcher m = p.matcher(crsWKT);
m.find();
ProjectedCRS crsObject = null;
if (m.groupCount() == 1) {
String type = m.group(1);
p = Pattern.compile("\\[\"NAV_BLOCK_BASE64\",\\s\"(.*)\"\\],");
m = p.matcher(crsWKT);
boolean found = m.find();
if (found) {
String navBlock = m.group(1);
crsObject = constructCRS(type, navBlock);
}
}
return crsObject;
}
public static ProjectedCRS constructCRS(String type, String encoded) {
ParameterValueGroup pvg = null;
DefaultMathTransformFactory dmtFactory = new DefaultMathTransformFactory();
try {
pvg = dmtFactory.getDefaultParameters("MCIDAS_AREA_NAV");
} catch (NoSuchIdentifierException e1) {
e1.printStackTrace();
}
/*
* semi_major and semi_minor parameters are set to 1, so that no global
* scaling is performed during coordinate transforms by
* org.geotools.referencing.operation.projection.MapProjection based on
* the radius of earth
*/
pvg.parameter("semi_major").setValue(1.0);
pvg.parameter("semi_minor").setValue(1.0);
pvg.parameter("central_meridian").setValue(0.0);
pvg.parameter("NAV_BLOCK_BASE64").setValue(encoded);
String projectionName = "MCIDAS AREA " + type;
ProjectedCRS mcidasCRS = null;
try {
mcidasCRS = MapUtil.constructProjection(projectionName, pvg);
} catch (NoSuchIdentifierException e) {
e.printStackTrace();
} catch (FactoryException e) {
e.printStackTrace();
}
return mcidasCRS;
}
}

View file

@ -5,11 +5,11 @@ Bundle-SymbolicName: com.raytheon.uf.edex.plugin.satellite.gini
Bundle-Version: 1.14.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: com.raytheon.edex.plugin.satellite;bundle-version="1.14.1",
Require-Bundle: com.raytheon.edex.plugin.satellite,
com.raytheon.uf.common.status;bundle-version="1.14.1",
com.raytheon.uf.common.time;bundle-version="1.14.0",
com.raytheon.uf.common.dataplugin;bundle-version="1.14.0",
com.raytheon.uf.common.dataplugin.satellite;bundle-version="1.14.0",
com.raytheon.uf.common.dataplugin.satellite,
com.raytheon.uf.common.serialization;bundle-version="1.14.2",
com.raytheon.uf.common.localization;bundle-version="1.14.1",
com.raytheon.uf.common.util;bundle-version="1.14.1",

View file

@ -10,8 +10,8 @@ Require-Bundle: com.raytheon.edex.common,
javax.measure,
org.apache.commons.lang,
javax.persistence,
com.raytheon.uf.common.dataplugin.satellite;bundle-version="1.0.0",
com.raytheon.edex.plugin.satellite;bundle-version="1.12.1174"
com.raytheon.uf.common.dataplugin.satellite,
com.raytheon.edex.plugin.satellite
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: com.raytheon.uf.common.localization,
com.raytheon.uf.common.menus,