diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/src/com/raytheon/uf/common/dataplugin/npp/viirs/projection/VIIRSMapProjection.java b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/src/com/raytheon/uf/common/dataplugin/npp/viirs/projection/VIIRSMapProjection.java index 86365f2910..c2d7e57dca 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/src/com/raytheon/uf/common/dataplugin/npp/viirs/projection/VIIRSMapProjection.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/src/com/raytheon/uf/common/dataplugin/npp/viirs/projection/VIIRSMapProjection.java @@ -62,6 +62,7 @@ import com.vividsolutions.jts.geom.LineSegment; * algorithm to use great circle intersections for * more accurate results * Aug 27, 2013 #2190 mschenke Sped up transform functions + * Mar 27, 2014 #2015 njensen Overrode getParameterValues() * * * @@ -148,6 +149,24 @@ public class VIIRSMapProjection extends MapProjection { return Provider.PARAMETERS; } + @Override + public ParameterValueGroup getParameterValues() { + final ParameterDescriptorGroup descriptor = getParameterDescriptors(); + final ParameterValueGroup values = descriptor.createValue(); + values.parameter(CENTER_LATITUDES).setValue(centerLats); + values.parameter(CENTER_LONGITUDES).setValue(centerLons); + values.parameter(DIRECTIONS).setValue(directions); + values.parameter(CENTER_LENGTH).setValue(actualHeight); + values.parameter(RESOLUTION).setValue(resolution); + values.parameter(SEMI_MAJOR).setValue( + VIIRSMapProjectionFactory.SEMI_MINOR_MAJOR_VALUE); + values.parameter(SEMI_MINOR).setValue( + VIIRSMapProjectionFactory.SEMI_MINOR_MAJOR_VALUE); + values.parameter(Provider.CENTRAL_MERIDIAN.getName().getCode()) + .setValue(Provider.CENTRAL_MERIDIAN.getDefaultValue()); + return values; + } + /* * (non-Javadoc) * diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/src/com/raytheon/uf/common/dataplugin/npp/viirs/projection/VIIRSMapProjectionFactory.java b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/src/com/raytheon/uf/common/dataplugin/npp/viirs/projection/VIIRSMapProjectionFactory.java index 3b7c5234a6..edb1204a2a 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/src/com/raytheon/uf/common/dataplugin/npp/viirs/projection/VIIRSMapProjectionFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.npp.viirs/src/com/raytheon/uf/common/dataplugin/npp/viirs/projection/VIIRSMapProjectionFactory.java @@ -19,7 +19,6 @@ **/ package com.raytheon.uf.common.dataplugin.npp.viirs.projection; -import org.geotools.referencing.crs.DefaultProjectedCRS; import org.geotools.referencing.operation.DefaultMathTransformFactory; import org.opengis.parameter.ParameterValueGroup; import org.opengis.referencing.FactoryException; @@ -38,6 +37,7 @@ import com.raytheon.uf.common.geospatial.MapUtil; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jul 16, 2012 mschenke Initial creation + * Mar 27, 2014 2015 njensen Made semi minor/major a constant * * * @@ -50,6 +50,12 @@ public class VIIRSMapProjectionFactory { /** Using single factory is faster due to internal caching */ private static DefaultMathTransformFactory dmtFactory = new DefaultMathTransformFactory(); + /** + * MapProjection requires semi_major/minor but our projection does not use + * them + */ + protected static final double SEMI_MINOR_MAJOR_VALUE = 1.0; + public static ProjectedCRS construct(VIIRSSpatialCoverage record) throws FactoryException { try { @@ -65,10 +71,10 @@ public class VIIRSMapProjectionFactory { record.getDirections()); group.parameter(VIIRSMapProjection.RESOLUTION).setValue( record.getDy().doubleValue()); - // MapProjection requires semi_major/minor but our projection does - // not use them - group.parameter(VIIRSMapProjection.SEMI_MAJOR).setValue(1.0); - group.parameter(VIIRSMapProjection.SEMI_MINOR).setValue(1.0); + group.parameter(VIIRSMapProjection.SEMI_MAJOR).setValue( + SEMI_MINOR_MAJOR_VALUE); + group.parameter(VIIRSMapProjection.SEMI_MINOR).setValue( + SEMI_MINOR_MAJOR_VALUE); return MapUtil.constructProjection( VIIRSMapProjection.PROJECTION_NAME, group); } catch (Exception e) { diff --git a/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/adapters/GridGeometry2DAdapter.java b/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/adapters/GridGeometry2DAdapter.java index eb1f59435b..db77a84fb6 100644 --- a/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/adapters/GridGeometry2DAdapter.java +++ b/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/adapters/GridGeometry2DAdapter.java @@ -19,12 +19,33 @@ **/ package com.raytheon.uf.common.serialization.adapters; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.geotools.coverage.grid.GridEnvelope2D; import org.geotools.coverage.grid.GridGeometry2D; import org.geotools.geometry.Envelope2D; +import org.geotools.parameter.DefaultParameterDescriptor; +import org.geotools.parameter.Parameter; +import org.geotools.parameter.ParameterGroup; import org.geotools.referencing.CRS; +import org.geotools.referencing.crs.DefaultProjectedCRS; +import org.geotools.referencing.cs.DefaultCartesianCS; +import org.geotools.referencing.operation.DefaultMathTransformFactory; +import org.geotools.referencing.operation.DefiningConversion; import org.opengis.geometry.Envelope; +import org.opengis.parameter.GeneralParameterValue; +import org.opengis.parameter.ParameterDescriptor; +import org.opengis.parameter.ParameterValue; +import org.opengis.parameter.ParameterValueGroup; import org.opengis.referencing.crs.CoordinateReferenceSystem; +import org.opengis.referencing.crs.GeographicCRS; +import org.opengis.referencing.crs.ProjectedCRS; +import org.opengis.referencing.cs.CartesianCS; +import org.opengis.referencing.operation.Conversion; +import org.opengis.referencing.operation.MathTransform; +import org.opengis.util.InternationalString; import com.raytheon.uf.common.serialization.IDeserializationContext; import com.raytheon.uf.common.serialization.ISerializationContext; @@ -32,14 +53,18 @@ import com.raytheon.uf.common.serialization.ISerializationTypeAdapter; import com.raytheon.uf.common.serialization.SerializationException; /** - * TODO Add Description + * Dynamic Serialize type adapter for GridGeometry2D * *
* * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Jan 5, 2010 randerso Initial creation + * Jan 5, 2010 randerso Initial creation + * Mar 27, 2014 2015 njensen Added ParameterValueAdapter and + * serialize PROJCS differently to + * work around geotools WKT limitations + * * ** @@ -50,6 +75,87 @@ import com.raytheon.uf.common.serialization.SerializationException; public class GridGeometry2DAdapter implements ISerializationTypeAdapter