From 765f077dedc558d351ea87e304da58f117217028 Mon Sep 17 00:00:00 2001 From: Nathan Bowler Date: Tue, 10 Feb 2015 15:03:12 -0500 Subject: [PATCH] Omaha #2866 Calculate subgrid size to limit response sizes Change-Id: I3ccc8f7fa6e63f9bf5bf3bc7487aa38df3cc76c1 Former-commit-id: 6620a7bdc7da9d1c2edcb49b710db425f5a1c110 --- .../gfe/dataaccess/GFEGridFactory.java | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/dataaccess/GFEGridFactory.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/dataaccess/GFEGridFactory.java index dd707c4f56..3237d86908 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/dataaccess/GFEGridFactory.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/dataaccess/GFEGridFactory.java @@ -1,19 +1,19 @@ /** * 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. **/ @@ -58,11 +58,11 @@ import com.raytheon.uf.common.util.StringUtil; /** * A data factory for getting gfe data from the metadata database. There are * currently not any required identifiers. - * + * *
- * 
+ *
  * SOFTWARE HISTORY
- * 
+ *
  * Date          Ticket#  Engineer    Description
  * ------------- -------- ----------- --------------------------
  * Feb 04, 2013           bsteffen    Initial creation
@@ -74,9 +74,10 @@ import com.raytheon.uf.common.util.StringUtil;
  * Oct 31, 2013  2508     randerso    Change to use DiscreteGridSlice.getKeys()
  * Feb 04, 2014  2672     bsteffen    Enable requesting subgrids.
  * Jul 30, 2014  3184     njensen     Renamed valid identifiers to optional
- * 
+ * Feb 10, 2015  2866     nabowle     Overwrite subgrid size estimation.
+ *
  * 
- * + * * @author bsteffen * @version 1.0 */ @@ -204,6 +205,22 @@ public class GFEGridFactory extends AbstractGridDataPluginFactory implements return constraints; } + /** + * Estimates the subgrid memory size using the grid geometry's size because + * {@link #getDataSource(PluginDataObject, SubGridGeometryCalculator)} uses + * an {@link OffsetDataSource} that holds the full grid data in memory. + * + * @param gridGeom + * @param subGrid + * @return + */ + protected long estimateSubgridSize(GridGeometry2D gridGeom, + SubGridGeometryCalculator subGrid) { + long size = gridGeom.getGridRange().getSpan(0) + * gridGeom.getGridRange().getSpan(1); + return size; + } + @Override protected DataSource getDataSource(PluginDataObject pdo, SubGridGeometryCalculator subGrid) {