Clear data menu command change to wipe loaded products. Also Tileset buffer added for Mcidas native projections.

Former-commit-id: f769ec9f80 [formerly da8a5a42ea] [formerly e499cf5c10fe894a26b1e7e52658a798ed6c0098 [formerly cf580ae837]]
Former-commit-id: a448bc94828ed21ed99e9c8c62d7f04c6fe05e84 [formerly 892d9150d3]
Former-commit-id: 172307d5ce
This commit is contained in:
AWIPS User 2015-05-24 21:01:45 -05:00 committed by mjames-upc
parent 69f88a23ca
commit 40c10581c9
4 changed files with 66 additions and 52 deletions

View file

@ -130,14 +130,14 @@
id="view"
label="View"
sibling_order="<menu
 label="label">
 </menu>">
<visibleWhen>
<visibleWhen>
<reference
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
</reference>
</visibleWhen>
<command
commandId="com.raytheon.viz.ui.clear"
label="Clear">
label="Clear Data">
</command>
<separator
name="beforeLoopControlGroup"
@ -789,7 +789,9 @@
</extension>
<extension point="org.eclipse.ui.handlers">
<extension
id="com.raytheon.uf.viz.d2d.ui.map.actions"
point="org.eclipse.ui.handlers">
<handler
class="com.raytheon.uf.viz.d2d.ui.actions.DataScaleAction"
commandId="com.raytheon.uf.viz.d2d.ui.actions.dataScaleAction">

View file

@ -20,6 +20,10 @@
package com.raytheon.uf.viz.d2d.ui.map.actions;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
@ -30,19 +34,20 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.globals.VizGlobalsManager;
import com.raytheon.uf.viz.core.maps.actions.NewMapEditor;
import com.raytheon.uf.viz.core.maps.display.VizMapEditor;
import com.raytheon.uf.viz.core.status.StatusConstants;
import com.raytheon.uf.viz.d2d.ui.Activator;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.HistoryList;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.viz.ui.editor.IMultiPaneEditor;
/**
* Action to reset a map to its initial state
* Action to reset a map to its initial state. What this *should*
* do is remove all non-map resources....
*
* <pre>
*
@ -56,6 +61,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
* Jul 10, 2008 chammack Properly clear the resource list on the old
* descriptor to facilitate better cleanup
* Oct 21, 2008 #1450 randerso Fixed to support multipane editors
* May 24, 2015 mjames@ucar Moved UnloadAllProductsAction here to replace map reload
*
* </pre>
*
@ -68,22 +74,30 @@ public class ClearAction extends AbstractHandler {
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
IEditorPart part = EditorUtil.getActiveEditor();
if (part == null) {
new NewMapEditor().execute(null);
return null;
}
try {
if (part instanceof IDisplayPaneContainer) {
HistoryList.getInstance().refreshLatestBundle();
clear(part);
HistoryList.getInstance().addBundle();
} else {
clear(part);
IDisplayPaneContainer cont = EditorUtil.getActiveVizContainer();
IDisplayPane[] panes = cont.getDisplayPanes();
for (IDisplayPane displayPane : panes) {
IDescriptor desc = displayPane.getDescriptor();
ResourceList rl = desc.getResourceList();
Iterator<ResourcePair> iterator = rl.iterator();
List<AbstractVizResource<?, ?>> rscsToRemove = new ArrayList<AbstractVizResource<?, ?>>();
while (iterator.hasNext()) {
ResourcePair rp = iterator.next();
if (!rp.getProperties().isMapLayer()
&& !rp.getProperties().isSystemResource()) {
rscsToRemove.add(rp.getResource());
}
}
for (AbstractVizResource<?, ?> rsc : rscsToRemove) {
rl.removeRsc(rsc);
}
} catch (VizException e) {
throw new ExecutionException("Error during clear", e);
}
cont.refresh();
return null;
}

View file

@ -243,6 +243,7 @@ public class SatResource extends
}
if (tileSet == null) {
tileSet = new SatTileSetRenderable(SatResource.this, record);
// this is where getGridGeometry is called from D2D SAT
tileSet.project(descriptor.getGridGeometry());
tileMap.put(record.getCoverage(), tileSet);
}

View file

@ -21,6 +21,7 @@
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;
@ -41,9 +42,11 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.geotools.coverage.grid.GeneralGridEnvelope;
import org.geotools.coverage.grid.GridEnvelope2D;
import org.geotools.coverage.grid.GridGeometry2D;
import org.geotools.geometry.Envelope2D;
import org.geotools.geometry.GeneralEnvelope;
import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.hibernate.annotations.Type;
import org.opengis.coverage.grid.GridEnvelope;
@ -86,6 +89,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Nov 05, 2014 3788 bsteffen Make gid a sequence instead of a hash.
* 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
* </pre>
*/
@Entity
@ -495,37 +499,30 @@ public class SatMapCoverage extends PersistableDataObject<Object> implements
@Override
public GridGeometry2D getGridGeometry() {
/*
GridEnvelope gridRange;
Envelope crsRange;
gridRange = new GridEnvelope2D(0, 0, getNx(), getNy());
crsRange = new Envelope2D(getCrs(), new Rectangle2D.Double(
minX, minY, getNx() * getDx(), getNy() * getDy()));
*/
GridEnvelope gridRange;
Envelope crsRange;
if (projection == PROJ_GVAR) { // for native projection
minX = getUpperLeftElement();
int maxX = getUpperLeftElement() + (getNx() * getElementRes());
minY = getUpperLeftLine() + (getNy() * getLineRes());
minY = -minY;
int maxY = -1 * getUpperLeftLine();
gridRange = new GridEnvelope2D(0, 0, nx, ny);
Rectangle2D rect = new Rectangle2D.Double(minX,
minY, maxX, maxY);
crsRange = new Envelope2D(getCrs(), rect );
}else {
int nx = getNx();
int ny = getNy();
gridRange = new GridEnvelope2D(0, 0, nx, ny);
crsRange = new Envelope2D(getCrs(), new Rectangle2D.Double(minX,
minY, nx * getDx(), ny * getDy()));
/*
* Native projections
*/
if (projection == PROJ_GVAR) {
GridEnvelope gridRange = new GeneralGridEnvelope(new int[] {
0, 0 }, new int[] { getNx(),getNy() }, false);
GeneralEnvelope crsRange = new GeneralEnvelope(2);
crsRange.setCoordinateReferenceSystem( getCrs() );
int minX = getUpperLeftElement();
int maxX = getUpperLeftElement() + ( getNx() * getElementRes() );
int minY = getUpperLeftLine() + ( getNy() * getLineRes() );
minY = -minY;
int maxY = -1 * getUpperLeftLine();
crsRange.setRange(0, minX, maxX);
crsRange.setRange(1, minY, maxY);
return new GridGeometry2D(gridRange, crsRange);
} else {
GridEnvelope gridRange = new GridEnvelope2D(0, 0, getNx(), getNy());
Envelope crsRange = new Envelope2D(getCrs(), new Rectangle2D.Double(
minX, minY, getNx() * getDx(), getNy() * getDy()));
return new GridGeometry2D(gridRange, crsRange);
}
GridGeometry2D tmpGrid = new GridGeometry2D(gridRange, crsRange);
return new GridGeometry2D(gridRange, crsRange);
}
@Override