diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/MapUtil.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/MapUtil.java index 0ba848c811..f16cd33f5f 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/MapUtil.java +++ b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/MapUtil.java @@ -1336,7 +1336,7 @@ public class MapUtil { * @return * @throws TransformException */ - public static synchronized Envelope reprojectAndIntersect( + public static ReferencedEnvelope reprojectAndIntersect( Envelope sourceEnvelope, Envelope targetEnvelope) throws TransformException { try { @@ -1393,25 +1393,25 @@ public class MapUtil { MathTransform mt = CRS.findMathTransform( targetEnvelope.getCoordinateReferenceSystem(), sourceEnvelope.getCoordinateReferenceSystem()); - DirectPosition2D top = new DirectPosition2D( - targetEnvelope.getMedian(0), targetEnvelope.getMaximum(1)); - DirectPosition2D bot = new DirectPosition2D( - targetEnvelope.getMedian(0), targetEnvelope.getMinimum(1)); - DirectPosition2D left = new DirectPosition2D( - targetEnvelope.getMinimum(0), targetEnvelope.getMedian(1)); - DirectPosition2D right = new DirectPosition2D( - targetEnvelope.getMaximum(0), targetEnvelope.getMedian(1)); - for (DirectPosition2D edge : new DirectPosition2D[] { top, bot, - left, right }) { - if (!result.contains(edge)) { - try { - DirectPosition2D tmp = new DirectPosition2D(); - mt.transform(edge, tmp); - if (sourceRefEnvelope.contains(tmp)) { - result.expandToInclude(edge.x, edge.y); + double[] xTestPoints = { targetEnvelope.getMinimum(0), + targetEnvelope.getMedian(0), targetEnvelope.getMaximum(0) }; + double[] yTestPoints = { targetEnvelope.getMinimum(1), + targetEnvelope.getMedian(1), targetEnvelope.getMaximum(1) }; + + for (double xTestPoint : xTestPoints) { + for (double yTestPoint : yTestPoints) { + DirectPosition2D edge = new DirectPosition2D(xTestPoint, + yTestPoint); + if (!result.contains(edge)) { + try { + DirectPosition2D tmp = new DirectPosition2D(); + mt.transform(edge, tmp); + if (sourceRefEnvelope.contains(tmp)) { + result.expandToInclude(edge.x, edge.y); + } + } catch (Exception ex) { + ;// ignore, can't expand the envelope. } - } catch (Exception ex) { - ;// ignore, can't expand the envelope. } } } diff --git a/edexOsgi/com.raytheon.uf.common.gridcoverage/src/com/raytheon/uf/common/gridcoverage/subgrid/SubGrid.java b/edexOsgi/com.raytheon.uf.common.gridcoverage/src/com/raytheon/uf/common/gridcoverage/subgrid/SubGrid.java index 24521cb9a4..60c3ac5572 100644 --- a/edexOsgi/com.raytheon.uf.common.gridcoverage/src/com/raytheon/uf/common/gridcoverage/subgrid/SubGrid.java +++ b/edexOsgi/com.raytheon.uf.common.gridcoverage/src/com/raytheon/uf/common/gridcoverage/subgrid/SubGrid.java @@ -36,9 +36,6 @@ package com.raytheon.uf.common.gridcoverage.subgrid; */ public class SubGrid { - /** The model name */ - private String modelName; - /** the upper left x the subgrid will start with */ private int upperLeftX; @@ -127,19 +124,4 @@ public class SubGrid { this.upperRightLon = upperRightLon; } - /** - * @return the modelName - */ - public String getModelName() { - return modelName; - } - - /** - * @param modelName - * the modelName to set - */ - public void setModelName(String modelName) { - this.modelName = modelName; - } - } \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.serialization/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/edexOsgi/com.raytheon.uf.common.serialization/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject index 6c20700801..28aa41cdc9 100644 --- a/edexOsgi/com.raytheon.uf.common.serialization/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject +++ b/edexOsgi/com.raytheon.uf.common.serialization/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject @@ -1 +1,2 @@ -com.raytheon.uf.common.serialization.adapters.GridGeometrySerialized \ No newline at end of file +com.raytheon.uf.common.serialization.adapters.GridGeometrySerialized +com.raytheon.uf.common.serialization.adapters.ReferencedEnvelopeSerialized \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/DynamicSerializationManager.java b/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/DynamicSerializationManager.java index 075ad03b2f..5bf66071c7 100644 --- a/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/DynamicSerializationManager.java +++ b/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/DynamicSerializationManager.java @@ -50,6 +50,7 @@ import net.sf.cglib.beans.BeanMap; import org.geotools.coverage.grid.GeneralGridGeometry; import org.geotools.coverage.grid.GridGeometry2D; +import org.geotools.geometry.jts.ReferencedEnvelope; import com.raytheon.uf.common.serialization.BuiltInTypeSupport.CalendarSerializer; import com.raytheon.uf.common.serialization.BuiltInTypeSupport.DateSerializer; @@ -64,6 +65,7 @@ import com.raytheon.uf.common.serialization.adapters.GridGeometry2DAdapter; import com.raytheon.uf.common.serialization.adapters.GridGeometryAdapter; import com.raytheon.uf.common.serialization.adapters.JTSEnvelopeAdapter; import com.raytheon.uf.common.serialization.adapters.PointAdapter; +import com.raytheon.uf.common.serialization.adapters.ReferencedEnvelopeAdapter; import com.raytheon.uf.common.serialization.adapters.StackTraceElementAdapter; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; @@ -139,6 +141,8 @@ public class DynamicSerializationManager { registerAdapter(Envelope.class, new JTSEnvelopeAdapter()); registerAdapter(GridGeometry2D.class, new GridGeometry2DAdapter()); registerAdapter(GeneralGridGeometry.class, new GridGeometryAdapter()); + registerAdapter(ReferencedEnvelope.class, + new ReferencedEnvelopeAdapter()); registerAdapter(EnumSet.class, new EnumSetAdapter()); registerAdapter(StackTraceElement.class, new StackTraceElementAdapter()); registerAdapter(Duration.class, diff --git a/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/adapters/ReferencedEnvelopeAdapter.java b/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/adapters/ReferencedEnvelopeAdapter.java new file mode 100644 index 0000000000..91b0a4fc14 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/adapters/ReferencedEnvelopeAdapter.java @@ -0,0 +1,104 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.common.serialization.adapters; + +import javax.xml.bind.annotation.adapters.XmlAdapter; + +import org.geotools.geometry.jts.ReferencedEnvelope; +import org.geotools.referencing.CRS; +import org.opengis.referencing.FactoryException; +import org.opengis.referencing.crs.CoordinateReferenceSystem; + +import com.raytheon.uf.common.serialization.IDeserializationContext; +import com.raytheon.uf.common.serialization.ISerializationContext; +import com.raytheon.uf.common.serialization.ISerializationTypeAdapter; +import com.raytheon.uf.common.serialization.SerializationException; + +/** + * + * Adapter for serialization and JAXBing ReferencedEnvelope objects. + * + *
+ * + * SOFTWARE HISTORY + * + * Date Ticket# Engineer Description + * ------------ ---------- ----------- -------------------------- + * Dec 4, 2012 bsteffen Initial creation + * + *+ * + * @author bsteffen + * @version 1.0 + */ +public class ReferencedEnvelopeAdapter extends + XmlAdapter
+ * + * SOFTWARE HISTORY + * + * Date Ticket# Engineer Description + * ------------ ---------- ----------- -------------------------- + * Dec 4, 2012 bsteffen Initial creation + * + *+ * + * @author bsteffen + * @version 1.0 + */ +@XmlRootElement +@XmlAccessorType(XmlAccessType.NONE) +public class ReferencedEnvelopeSerialized implements ISerializableObject { + + @XmlAttribute + public Double minX; + + @XmlAttribute + public Double maxX; + + @XmlAttribute + public Double minY; + + @XmlAttribute + public Double maxY; + + @XmlElement + public String crs; + +}