From 91564e2401c5232f1941987b50a26e800500949c Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Tue, 30 Sep 2014 14:41:31 -0500 Subject: [PATCH 01/19] pgen working in D2D for evaluation Change-Id: I39205962e4983c224c4ba1aad6389e249d25922a Former-commit-id: e9b6c8d181609d2c248b4c4ba2ee708587f01b2f --- .../META-INF/MANIFEST.MF | 1 + .../OSGI-INF/staticDataProvider.xml | 9 + .../ncep/staticdataprovider/Activator.java | 14 +- .../StaticDataProvider.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- ncep/gov.noaa.nws.ncep.ui.pgen/plugin.xml | 67 +++- .../noaa/nws/ncep/ui/pgen/PgenSession.java | 329 ++++++++++-------- .../gov/noaa/nws/ncep/ui/pgen/PgenUtil.java | 71 +++- .../ui/pgen/attrdialog/ContoursAttrDlg.java | 53 +-- .../pgen/display/DisplayElementFactory.java | 11 +- .../ui/pgen/display/SymbolCirclePart.java | 8 +- .../gov/noaa/nws/ncep/ui/pgen/file/TCM.java | 6 +- .../ui/pgen/palette/PgenPaletteAction.java | 19 + .../ui/pgen/palette/PgenPaletteWindow.java | 70 ++-- .../nws/ncep/ui/pgen/rsc/PgenResource.java | 26 +- .../ncep/ui/pgen/rsc/PgenResourceData.java | 21 +- .../nws/ncep/ui/pgen/sigmet/SigmetInfo.java | 22 +- .../pgen/tools/AbstractPgenDrawingTool.java | 8 +- .../ncep/ui/pgen/tools/AbstractPgenTool.java | 5 +- .../ncep/ui/pgen/tools/PgenCopyElement.java | 61 ++-- .../tools/PgenWatchBoxAddDelCntyHandler.java | 14 +- 21 files changed, 547 insertions(+), 274 deletions(-) create mode 100644 ncep/gov.noaa.nws.ncep.staticdataprovider/OSGI-INF/staticDataProvider.xml diff --git a/ncep/gov.noaa.nws.ncep.staticdataprovider/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.staticdataprovider/META-INF/MANIFEST.MF index 7c7ae6a9a5..91bf10627b 100644 --- a/ncep/gov.noaa.nws.ncep.staticdataprovider/META-INF/MANIFEST.MF +++ b/ncep/gov.noaa.nws.ncep.staticdataprovider/META-INF/MANIFEST.MF @@ -23,3 +23,4 @@ Import-Package: com.vividsolutions.jts.geom, org.dom4j, org.dom4j.io Export-Package: gov.noaa.nws.ncep.staticdataprovider +Service-Component: OSGI-INF/staticDataProvider.xml diff --git a/ncep/gov.noaa.nws.ncep.staticdataprovider/OSGI-INF/staticDataProvider.xml b/ncep/gov.noaa.nws.ncep.staticdataprovider/OSGI-INF/staticDataProvider.xml new file mode 100644 index 0000000000..d405b99a56 --- /dev/null +++ b/ncep/gov.noaa.nws.ncep.staticdataprovider/OSGI-INF/staticDataProvider.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/ncep/gov.noaa.nws.ncep.staticdataprovider/src/gov/noaa/nws/ncep/staticdataprovider/Activator.java b/ncep/gov.noaa.nws.ncep.staticdataprovider/src/gov/noaa/nws/ncep/staticdataprovider/Activator.java index 95ddc9a1ad..d83416b406 100644 --- a/ncep/gov.noaa.nws.ncep.staticdataprovider/src/gov/noaa/nws/ncep/staticdataprovider/Activator.java +++ b/ncep/gov.noaa.nws.ncep.staticdataprovider/src/gov/noaa/nws/ncep/staticdataprovider/Activator.java @@ -8,8 +8,6 @@ package gov.noaa.nws.ncep.staticdataprovider; -import gov.noaa.nws.ncep.common.staticdata.IStaticDataProvider; - import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; @@ -39,20 +37,22 @@ public class Activator implements BundleActivator { * (non-Javadoc) * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) */ - public void start(BundleContext bundleContext) throws Exception { + @Override + public void start(BundleContext bundleContext) throws Exception { Activator.context = bundleContext; //Register service - context.registerService(IStaticDataProvider.class.getName(), - StaticDataProvider.getInstance(), - null); + // context.registerService(IStaticDataProvider.class.getName(), + // StaticDataProvider.getInstance(), + // null); } /* * (non-Javadoc) * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) */ - public void stop(BundleContext bundleContext) throws Exception { + @Override + public void stop(BundleContext bundleContext) throws Exception { Activator.context = null; } diff --git a/ncep/gov.noaa.nws.ncep.staticdataprovider/src/gov/noaa/nws/ncep/staticdataprovider/StaticDataProvider.java b/ncep/gov.noaa.nws.ncep.staticdataprovider/src/gov/noaa/nws/ncep/staticdataprovider/StaticDataProvider.java index fef31e78c6..25c74ea32f 100644 --- a/ncep/gov.noaa.nws.ncep.staticdataprovider/src/gov/noaa/nws/ncep/staticdataprovider/StaticDataProvider.java +++ b/ncep/gov.noaa.nws.ncep.staticdataprovider/src/gov/noaa/nws/ncep/staticdataprovider/StaticDataProvider.java @@ -70,7 +70,7 @@ public class StaticDataProvider implements IStaticDataProvider { return dataProvider; } - private StaticDataProvider() { + public StaticDataProvider() { } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.ui.pgen/META-INF/MANIFEST.MF index 2c38a9fa91..42d212ed12 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/META-INF/MANIFEST.MF +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/META-INF/MANIFEST.MF @@ -39,8 +39,10 @@ Export-Package: gov.noaa.nws.ncep.ui.pgen, gov.noaa.nws.ncep.ui.pgen.store, gov.noaa.nws.ncep.ui.pgen.tca, gov.noaa.nws.ncep.ui.pgen.tools -Import-Package: com.raytheon.viz.core.contours.util, +Import-Package: com.raytheon.uf.viz.core.maps.display, + com.raytheon.viz.core.contours.util, com.raytheon.viz.core.gl, com.raytheon.viz.core.gl.images, gov.noaa.nws.ncep.common.staticdata, javax.measure.unit +Bundle-ClassPath: . diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/plugin.xml b/ncep/gov.noaa.nws.ncep.ui.pgen/plugin.xml index 87f0020413..8e2890bc70 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/plugin.xml +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/plugin.xml @@ -322,11 +322,6 @@ - - - - + - + + + + + + + + + + + + + + + + + + + + + diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenSession.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenSession.java index 249b96f0f4..d6e71be2f0 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenSession.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenSession.java @@ -7,160 +7,203 @@ */ package gov.noaa.nws.ncep.ui.pgen; +import java.util.ArrayList; +import java.util.List; + +import com.raytheon.uf.viz.core.maps.display.VizMapEditor; +import com.raytheon.viz.ui.editor.AbstractEditor; + import gov.noaa.nws.ncep.ui.pgen.controls.PgenCommandManager; import gov.noaa.nws.ncep.ui.pgen.palette.PgenPaletteWindow; import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResource; +import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResourceData; + //import gov.noaa.nws.ncep.viz.ui.display.NmapUiUtils; /** - * This singleton is intended to couple a PGEN Palette with a PGgenResource, so that - * a palette can be updated and used to modify a specific PgenResource + * This singleton is intended to couple a PGEN Palette with a PGgenResource, so + * that a palette can be updated and used to modify a specific PgenResource + * * @author sgilbert - * + * */ public class PgenSession { - /* - * The singleton instance - */ - private static PgenSession instance = null; - - /* - * the current PGEN resource - */ - private PgenResource pgenResource = null; - - /* - * the current PGEN palette - */ - private PgenPaletteWindow palette = null; - - /* - * Hide default constructor - */ - private PgenSession() { - - } - - /** - * Static method to get THE PgenSession instance - * @return PgenSession reference - */ - public static synchronized PgenSession getInstance() { - - if ( instance == null ) instance = new PgenSession(); - return instance; - } - - /** - * Sets a PgenResource for the current session - * @param rsc a Pgen Resource - */ - public void setResource(PgenResource rsc) { - - /* - * Remove the current PGEN Resource from the Session - */ - removeResource(); - - // set new PGEN resource - pgenResource = rsc; - // add the palette's stack listener to new resource's command Manager - if ( pgenResource != null ) pgenResource.getCommandMgr().addStackListener(palette); + /* + * The singleton instance + */ + private static PgenSession instance = null; - } - - /** - * Removes the current PGEN resource from the Session - */ - public void removeResource() { - if ( pgenResource != null ) { - //Remove the Palette's stack listener from the Resource's CommandManager - pgenResource.getCommandMgr().removeStackListener(palette); - } - pgenResource = null; - - /* - * disable the palette's Undo and redo buttons. - */ - if ( palette != null ) palette.disableUndoRedo(); - } - - /** - * Gets an appropriate PGEN Resource. Returns the current Pgen Resource registered with this - * PGEN Session if there is one. If not, it will look for an existing resource in the current - * editor. If one is not found, a new PgenResource will be created. - * @return the rsc - */ - public PgenResource getPgenResource() { - - if ( pgenResource == null ) { -// PgenResource rsc = PgenUtil.findPgenResource(NmapUiUtils.getActiveNatlCntrsEditor()); - PgenResource rsc = PgenUtil.findPgenResource(PgenUtil.getActiveEditor()); - if ( rsc != null ) { - pgenResource = rsc; - } - else { - pgenResource = PgenUtil.createNewResource(); - } - } - - return pgenResource; - } - - /** - * Get the PGEN Resource currently registered with the session - * @return - */ - public PgenResource getCurrentResource() { - return pgenResource; - } + /* + * the current PGEN resource + */ + private PgenResource pgenResource = null; - /** - * Gets the Resource's Command Manager - * @return the commandMgr - */ - public PgenCommandManager getCommandManager() { - return pgenResource.getCommandMgr(); - } + /* + * the current PGEN palette + */ + private PgenPaletteWindow palette = null; + + private List editors = new ArrayList(); + /* + * Hide default constructor + */ + private PgenSession() { + + } + + /** + * Static method to get THE PgenSession instance + * + * @return PgenSession reference + */ + public static synchronized PgenSession getInstance() { + + if (instance == null) + instance = new PgenSession(); + return instance; + } + + /** + * Sets a PgenResource for the current session + * + * @param rsc + * a Pgen Resource + */ + public void setResource(PgenResource rsc) { + + /* + * Remove the current PGEN Resource from the Session + */ + removeResource(); + + // set new PGEN resource + pgenResource = rsc; + // add the palette's stack listener to new resource's command Manager + if (pgenResource != null) + pgenResource.getCommandMgr().addStackListener(palette); + + } + + /** + * Removes the current PGEN resource from the Session + */ + public void removeResource() { + if (pgenResource != null) { + // Remove the Palette's stack listener from the Resource's + // CommandManager + pgenResource.getCommandMgr().removeStackListener(palette); + } + pgenResource = null; + + /* + * disable the palette's Undo and redo buttons. + */ + if (palette != null) + palette.disableUndoRedo(); + } + + /** + * Gets an appropriate PGEN Resource. Returns the current Pgen Resource + * registered with this PGEN Session if there is one. If not, it will look + * for an existing resource in the current editor. If one is not found, a + * new PgenResource will be created. + * + * @return the rsc + */ + public PgenResource getPgenResource() { + + if (pgenResource == null) { + // PgenResource rsc = + // PgenUtil.findPgenResource(NmapUiUtils.getActiveNatlCntrsEditor()); + PgenResource rsc = PgenUtil.findPgenResource(PgenUtil + .getActiveEditor()); + if (rsc != null) { + pgenResource = rsc; + } else { + pgenResource = PgenUtil.createNewResource(); + } + } + + return pgenResource; + } + + /** + * Get the PGEN Resource currently registered with the session + * + * @return + */ + public PgenResource getCurrentResource() { + return pgenResource; + } + + /** + * Gets the Resource's Command Manager + * + * @return the commandMgr + */ + public PgenCommandManager getCommandManager() { + return pgenResource.getCommandMgr(); + } + + /** + * Register the given palette with the Session + * + * @param pal + */ + public void setPalette(PgenPaletteWindow pal) { + palette = pal; + // Register this palette's stack listener with the CommandManager, if + // able + if (pgenResource != null) + pgenResource.getCommandMgr().addStackListener(palette); + } + + /** + * Remove the current palette from this Session + */ + public void removePalette() { + // Remove this palette's stack listener from the CommandManager, if able + if (pgenResource != null) + pgenResource.getCommandMgr().removeStackListener(palette); + palette = null; + } + + /** + * Clear and disable undo/redos. + */ + public void disableUndoRedo() { + + if (pgenResource != null) + getCommandManager().clearStacks(); + + if (palette != null) { + palette.disableUndoRedo(); + } + + } + + public PgenResourceData getPgenResourceData() { + if (pgenResource != null) { + return pgenResource.getResourceData(); + } else { + return null; + } + } + + /** + * Return the palette window + */ + public PgenPaletteWindow getPgenPalette() { + return palette; + } + + public void addEditor(AbstractEditor editor){ + editors.add(editor); + } + + public List getEditors(){ + return editors; + } - /** - * Register the given palette with the Session - * @param pal - */ - public void setPalette(PgenPaletteWindow pal) { - palette = pal; - // Register this palette's stack listener with the CommandManager, if able - if ( pgenResource != null ) pgenResource.getCommandMgr().addStackListener(palette); - } - - /** - * Remove the current palette from this Session - */ - public void removePalette() { - // Remove this palette's stack listener from the CommandManager, if able - if ( pgenResource != null ) pgenResource.getCommandMgr().removeStackListener(palette); - palette = null; - } - - /** - * Clear and disable undo/redos. - */ - public void disableUndoRedo() { - - if ( pgenResource != null ) getCommandManager().clearStacks(); - - if ( palette != null ) { - palette.disableUndoRedo(); - } - - } - - /** - * Return the palette window - */ - public PgenPaletteWindow getPgenPalette(){ - return palette; - } - } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenUtil.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenUtil.java index 200fca8c3d..6ad3a7b443 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenUtil.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenUtil.java @@ -81,6 +81,7 @@ import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.map.IMapDescriptor; import com.raytheon.uf.viz.core.map.MapDescriptor; +import com.raytheon.uf.viz.core.maps.display.VizMapEditor; import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.ResourceList; @@ -682,6 +683,67 @@ public class PgenUtil { PgenResource drawingLayer = null; // NCMapEditor editor = NmapUiUtils.getActiveNatlCntrsEditor(); AbstractEditor editor = getActiveEditor(); + if (editor != null) { + try { + if ( editor instanceof VizMapEditor || PgenUtil.isNatlCntrsEditor(editor)){ + PgenSession.getInstance().addEditor(editor); + } + switch (getPgenMode()) { + case SINGLE: + /* + * Use existing (or new) PgenResourceData to construct new + * Resources to add to each Pane's ResourceList + */ + if (rscData == null) { + rscData = new PgenResourceData(); + } + int iii = 0; + for (IDisplayPane pane : editor.getDisplayPanes()) { + IDescriptor idesc = pane.getDescriptor(); + if (idesc.getResourceList().size() > 0) { + drawingLayer = rscData.construct( + new LoadProperties(), idesc); + // System.out.println("NEW pgen resource: "+drawingLayer); + idesc.getResourceList().add(drawingLayer); + idesc.getResourceList().addPreRemoveListener( + drawingLayer); + drawingLayer.init(pane.getTarget()); + } + } + break; + case MULTIPLE: + /* + * Add a new PgenResourceData and Resource to active Pane's + * ResourceList + */ + IMapDescriptor desc = (IMapDescriptor) editor + .getActiveDisplayPane().getRenderableDisplay() + .getDescriptor(); + drawingLayer = new PgenResourceData().construct( + new LoadProperties(), desc); + desc.getResourceList().add(drawingLayer); + desc.getResourceList().addPreRemoveListener(drawingLayer); + drawingLayer + .init(editor.getActiveDisplayPane().getTarget()); + break; + } + + } catch (Exception e) { + e.printStackTrace(); + } + } + return drawingLayer; + } + + /** + * Create a new PgenResource and add it to the current editor. + * + * @return the PgenResource + */ + public static final PgenResource addPgenResourceToActiveEditor() { + + PgenResource drawingLayer = null; + AbstractEditor editor = getActiveEditor(); if (editor != null) { try { switch (getPgenMode()) { @@ -696,8 +758,15 @@ public class PgenUtil { for (IDisplayPane pane : editor.getDisplayPanes()) { IDescriptor idesc = pane.getDescriptor(); if (idesc.getResourceList().size() > 0) { - drawingLayer = rscData.construct( + + if ( PgenSession.getInstance().getPgenResource() != null ){ + drawingLayer = PgenSession.getInstance().getPgenResource(); + } + else { + drawingLayer = rscData.construct( new LoadProperties(), idesc); + } + // System.out.println("NEW pgen resource: "+drawingLayer); idesc.getResourceList().add(drawingLayer); idesc.getResourceList().addPreRemoveListener( diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/attrdialog/ContoursAttrDlg.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/attrdialog/ContoursAttrDlg.java index ebd338f1d9..affe9a9579 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/attrdialog/ContoursAttrDlg.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/attrdialog/ContoursAttrDlg.java @@ -148,9 +148,9 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, private String contourFcstHr = "f000"; - private Calendar contourTime1 = (Calendar) Calendar.getInstance(); + private Calendar contourTime1 = Calendar.getInstance(); - private Calendar contourTime2 = (Calendar) Calendar.getInstance(); + private Calendar contourTime2 = Calendar.getInstance(); private String defCint = ContoursInfoDlg.getCints().get( contourParm + "-" + contourLevel); @@ -397,6 +397,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, setInfoBtnText(); infoBtn.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent event) { openContourInfoDlg(); } @@ -407,6 +408,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, makeGridBtn.setText("Make Grid"); makeGridBtn.setToolTipText("Generate grid from this Contours"); makeGridBtn.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent event) { openG2GDlg(); } @@ -468,6 +470,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, quickLineBtns.add(btn); btn.addListener(SWT.MouseDoubleClick, new Listener() { + @Override public void handleEvent(Event event) { openLineTypePanel(); } @@ -527,6 +530,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, lineClosedBtn.setToolTipText("Click to draw a closed line"); lineClosedBtn.setSelection(drawClosedLine); lineClosedBtn.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent event) { drawClosedLine = lineClosedBtn.getSelection(); } @@ -564,7 +568,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, if (de != null && de.getParent() != null && de.getParent() instanceof ContourLine) { ContourLine pde = (ContourLine) de.getParent(); - lineAttrDlg.setAttrForDlg((IAttribute) pde.getLine()); + lineAttrDlg.setAttrForDlg(pde.getLine()); } else { if (lineTemplate == null) { @@ -577,7 +581,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, .toString()); } - lineAttrDlg.setAttrForDlg((IAttribute) lineTemplate); + lineAttrDlg.setAttrForDlg(lineTemplate); } @@ -642,6 +646,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, quickSymbolBtns.add(btn); btn.addListener(SWT.MouseDoubleClick, new Listener() { + @Override public void handleEvent(Event event) { openSymbolPanel(); } @@ -724,7 +729,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, DrawableElement de = drawingLayer.getSelectedDE(); if (de != null && de instanceof Symbol && de.getParent() instanceof ContourMinmax) { - minmaxAttrDlg.setAttrForDlg((IAttribute) de); + minmaxAttrDlg.setAttrForDlg(de); } else { minmaxTemplate = (Symbol) contoursAttrSettings .get(activeQuickSymbolBtn.getData().toString()); @@ -736,8 +741,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, } - minmaxAttrDlg - .setAttrForDlg((IAttribute) minmaxTemplate); + minmaxAttrDlg.setAttrForDlg(minmaxTemplate); } @@ -779,6 +783,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, setButtonColor(circleTypeBtn, circleTemplate.getColors()[0]); circleTypeBtn.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent event) { if (!ContoursAttrDlg.this.drawCircle()) { if (circleTemplate == null) { @@ -830,8 +835,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, if (de != null && de.getParent() != null && de.getParent() instanceof ContourCircle) { ContourCircle pde = (ContourCircle) de.getParent(); - circleAttrDlg.setAttrForDlg((IAttribute) pde - .getCircle()); + circleAttrDlg.setAttrForDlg(pde.getCircle()); } else { if (circleTemplate == null) { @@ -840,8 +844,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, circleTemplate.setPgenType("Circle"); } - circleAttrDlg - .setAttrForDlg((IAttribute) circleTemplate); + circleAttrDlg.setAttrForDlg(circleTemplate); } @@ -891,6 +894,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, labelTxt.setText("0"); labelTxt.addFocusListener(new FocusListener() { + @Override public void focusLost(FocusEvent e) { float value = 0; try { @@ -905,6 +909,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, } + @Override public void focusGained(FocusEvent e) { } }); @@ -912,6 +917,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, Button valueUpArrow = new Button(textValueComp, SWT.ARROW | SWT.UP); valueUpArrow.setLayoutData(new GridData(20, 22)); valueUpArrow.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent event) { changeLabel(true); } @@ -921,6 +927,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, Button valueDownArrow = new Button(textValueComp, SWT.ARROW | SWT.DOWN); valueDownArrow.setLayoutData(new GridData(20, 22)); valueDownArrow.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent event) { changeLabel(false); } @@ -967,18 +974,16 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, if (de.getParent() instanceof ContourLine && ((ContourLine) (de.getParent())).getLabels() .size() > 0) { - labelAttrDlg - .setAttrForDlg((IAttribute) ((ContourLine) (de - .getParent())).getLabels().get(0)); + labelAttrDlg.setAttrForDlg(((ContourLine) (de + .getParent())).getLabels().get(0)); if (isUseMainColor()) { labelAttrDlg.setColor(lineTemplate.getColors()[0]); } } else if (de.getParent() instanceof ContourMinmax && ((ContourMinmax) (de.getParent())) .getLabel() != null) { - labelAttrDlg - .setAttrForDlg((IAttribute) ((ContourMinmax) (de - .getParent())).getLabel()); + labelAttrDlg.setAttrForDlg(((ContourMinmax) (de + .getParent())).getLabel()); if (isUseMainColor()) { labelAttrDlg.setColor(minmaxTemplate .getColors()[0]); @@ -986,9 +991,8 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, } else if (de.getParent() instanceof ContourCircle && ((ContourCircle) (de.getParent())) .getLabel() != null) { - labelAttrDlg - .setAttrForDlg((IAttribute) ((ContourCircle) (de - .getParent())).getLabel()); + labelAttrDlg.setAttrForDlg(((ContourCircle) (de + .getParent())).getLabel()); if (isUseMainColor()) { labelAttrDlg.setColor(circleTemplate .getColors()[0]); @@ -999,7 +1003,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, labelTemplate = (gov.noaa.nws.ncep.ui.pgen.elements.Text) contoursAttrSettings .get(getLabelTempKey()); - labelAttrDlg.setAttrForDlg((IAttribute) labelTemplate); + labelAttrDlg.setAttrForDlg(labelTemplate); if (isUseMainColor()) { if (drawingStatus == ContourDrawingStatus.DRAW_LINE) { @@ -1381,6 +1385,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, btn.setText(lblstr); btn.setData(lblstr); btn.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent event) { labelTxt.setText(event.widget.getData().toString()); if (labelTemplate != null) { @@ -1572,6 +1577,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, * Updates the selected contours and contour line, then redraws the PGEN * layer. */ + @Override public void okPressed() { /* @@ -2943,6 +2949,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, /** * Updates the selected type's data string and image icon. */ + @Override public void okPressed() { Color clr = activeButtonColor; @@ -3091,6 +3098,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, /** * Updates the selected type's data string and image icon. */ + @Override public void okPressed() { /* @@ -3195,7 +3203,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, * Update the symbol template first. */ minmaxTemplate = (gov.noaa.nws.ncep.ui.pgen.elements.Symbol) new DrawableElementFactory() - .create(DrawableType.SYMBOL, (IAttribute) this, "Symbol", + .create(DrawableType.SYMBOL, this, "Symbol", getActiveSymbolObjType(), (Coordinate) null, null); contoursAttrSettings.put(getActiveSymbolObjType(), minmaxTemplate); @@ -3690,6 +3698,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, /** * Removes ghost line, handle bars, and closes the dialog */ + @Override public void cancelPressed() { PgenUtil.setSelectingMode(); diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/display/DisplayElementFactory.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/display/DisplayElementFactory.java index 68bc12d2fe..4dfb02a1e2 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/display/DisplayElementFactory.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/display/DisplayElementFactory.java @@ -140,7 +140,7 @@ import com.vividsolutions.jts.operation.distance.DistanceOp; * this class * 11/13 TTR 752 J. Wu added methods to compute an element's range record. * 12/13 #1089 B. Yin Modify watch to display county list - * 02/14 #2819 R. Anderson Removed unnecessary .clone() call + * 05/14 TTR 995 J. Wu Make contour label auto-placement an option. * 05/14 TTR 995 J. Wu Make contour label auto-placement an option. * 07/14 ? B. Yin Added support for dashed-line circle for TCM 12 feet sea. * 08/14 ? B. Yin Fixed world wrap for TCM track and zero circle issues. @@ -707,8 +707,9 @@ public class DisplayElementFactory { iDescriptor, PointStyle.CROSS); try { - compiler.handle(cntyUnion, new RGB(colors[1].getRed(), - colors[1].getGreen(), colors[1].getBlue())); + compiler.handle((Geometry) cntyUnion.clone(), + new RGB(colors[1].getRed(), colors[1].getGreen(), + colors[1].getBlue())); if (elem.getFillPattern() != FillPattern.TRANSPARENCY && elem.getFillPattern() != FillPattern.SOLID) { @@ -1814,8 +1815,7 @@ public class DisplayElementFactory { double major = Math.sqrt((diff[0] * diff[0]) + (diff[1] * diff[1])); double minor = major * arc.getAxisRatio(); - if (major / this.screenToExtent < 0.000001) { // ignore circles with - // major = 0 + if (major / this.screenToExtent < 0.000001) { // ignore circles with major = 0 return slist; } @@ -1886,6 +1886,7 @@ public class DisplayElementFactory { return slist; } + /** /** * Creates a list of IDisplayable Objects from an IArc object * diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/display/SymbolCirclePart.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/display/SymbolCirclePart.java index a7a5899cf2..cb99104e5f 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/display/SymbolCirclePart.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/display/SymbolCirclePart.java @@ -79,7 +79,8 @@ public class SymbolCirclePart extends SymbolPart { * Gets the coordinates defining the line path * @return the line path */ - public Coordinate[] getPath() { + @Override + public Coordinate[] getPath() { if ( pathNeedsUpdate ) updatePath(); return path; } @@ -88,7 +89,8 @@ public class SymbolCirclePart extends SymbolPart { * Gets whether area defined by line path should be filled * @return the filled flag */ - public boolean isFilled() { + @Override + public boolean isFilled() { return filled; } @@ -143,7 +145,7 @@ public class SymbolCirclePart extends SymbolPart { int numpts = 16; path = new Coordinate[numpts]; - double increment = 360.0 / (double)numpts; + double increment = 360.0 / numpts; double angle = 0.0; for (int j=0; jJava class for anonymous complex type. diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteAction.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteAction.java index 3a052a0b99..b7fc35af78 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteAction.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteAction.java @@ -8,6 +8,8 @@ package gov.noaa.nws.ncep.ui.pgen.palette; +import gov.noaa.nws.ncep.ui.pgen.PGenRuntimeException; +import gov.noaa.nws.ncep.ui.pgen.PgenStaticDataProvider; import gov.noaa.nws.ncep.ui.pgen.PgenUtil; //import gov.noaa.nws.ncep.viz.ui.display.NCMapEditor; @@ -23,6 +25,7 @@ import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.internal.WorkbenchPage; +import com.raytheon.uf.viz.core.maps.display.VizMapEditor; import com.raytheon.viz.ui.EditorUtil; import com.raytheon.viz.ui.editor.AbstractEditor; @@ -32,6 +35,19 @@ public class PgenPaletteAction extends AbstractHandler { @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { + try { + PgenStaticDataProvider.getProvider(); + } + catch (PGenRuntimeException e ){ + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + MessageBox mb = new MessageBox(shell, SWT.ICON_WARNING + | SWT.OK); + + mb.setMessage( "Please start NCP first to initialize PGEN data!"); + mb.open(); + return null; + } + /* * The viewID string is in the XML file for PGEN extension point. */ @@ -80,6 +96,9 @@ public class PgenPaletteAction extends AbstractHandler { mb.setMessage( "Pgen is not supported in this editor. Please select a mapEditor for Pgen to use first!"); mb.open(); } + + + return null; } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteWindow.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteWindow.java index 08af7be48c..2a5560a2a6 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteWindow.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteWindow.java @@ -45,8 +45,11 @@ import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.events.ShellEvent; +import org.eclipse.swt.events.ShellListener; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -61,6 +64,9 @@ import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IPartListener2; +import org.eclipse.ui.IPropertyListener; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IViewReference; import org.eclipse.ui.IViewSite; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPart; @@ -70,6 +76,7 @@ import org.eclipse.ui.PlatformUI; import org.eclipse.ui.commands.ICommandService; import org.eclipse.ui.contexts.IContextActivation; import org.eclipse.ui.contexts.IContextService; +import org.eclipse.ui.internal.WorkbenchPage; import org.eclipse.ui.part.ViewPart; import com.raytheon.uf.viz.core.IDisplayPane; @@ -77,6 +84,7 @@ import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.drawables.IRenderableDisplay; import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.rsc.ResourceList; +import com.raytheon.viz.ui.EditorUtil; import com.raytheon.viz.ui.UiUtil; import com.raytheon.viz.ui.VizWorkbenchManager; import com.raytheon.viz.ui.editor.AbstractEditor; @@ -84,6 +92,7 @@ import com.raytheon.viz.ui.editor.ISelectedPanesChangedListener; import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager; import com.raytheon.viz.ui.perspectives.VizPerspectiveListener; import com.raytheon.viz.ui.tools.AbstractModalTool; +import com.raytheon.uf.viz.core.maps.display.VizMapEditor; /** * The PGEN View is used for all interaction with the objects in the PGEN @@ -204,6 +213,8 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, private AbstractEditor currentIsMultiPane = null; + private boolean isDetached; + /** * Constructor * @@ -231,7 +242,7 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, page = site.getPage(); page.addPartListener(this); - + /* * Get a list from registry of all elements that registered with the * gov.noaa.nws.ncep.ui.pgen.palette extension point @@ -305,14 +316,6 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, /* TODO: save on exit? dialog */ super.dispose(); - /* - * remove product manage/layer dialog - */ - PgenResource pgen = PgenSession.getInstance().getPgenResource(); - if (pgen != null) { - pgen.closeDialogs(); - } - /* * remove this palette from Pgen Session */ @@ -398,6 +401,17 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, if (current != null) PgenSession.getInstance().setResource(current); + comp.addControlListener(new ControlAdapter() { + @Override + public void controlResized(ControlEvent e) { + updateDetached(); + } + }); + + } + + private void updateDetached() { + isDetached = mainComp.getShell().getText().length() == 0; } /** @@ -570,10 +584,10 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, /* * Force a resize */ - Rectangle r = scroll.getClientArea(); + Rectangle r = scroll.getClientArea(); paletteComp.setSize(paletteComp.computeSize(r.width, SWT.DEFAULT)); paletteComp.layout(); - + // wait for buttons to be created disableUndoRedo(); } @@ -867,14 +881,20 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, // if ( part instanceof NCMapEditor &&((NCMapEditor) // part).getApplicationName().equals("NA")) { - if (PgenUtil.isNatlCntrsEditor(part)) { - + if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor) { PgenResource rsc = PgenUtil.findPgenResource((AbstractEditor) part); - if ((rsc == null) && (PgenUtil.getPgenMode() == PgenMode.SINGLE)) + + // if ( PgenSession.getInstance().getPgenResource().getDescriptor() != ) + + if ((rsc == null) && (PgenUtil.getPgenMode() == PgenMode.SINGLE)) { rsc = PgenUtil.createNewResource(); - if (rsc != null) + } + + if (rsc != null) { rsc.setCatFilter(new CategoryFilter( (currentCategory == null) ? "Any" : currentCategory)); + } + PgenSession.getInstance().setResource(rsc); AbstractEditor editor = (AbstractEditor) part; @@ -885,11 +905,16 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, PgenUtil.addSelectedPaneChangedListener(editor, this); } activatePGENContext(); + } else if (part instanceof VizMapEditor) { + PgenResource rsc = PgenUtil.findPgenResource((AbstractEditor) part); + if ((rsc == null) && (PgenUtil.getPgenMode() == PgenMode.SINGLE)) { + rsc = PgenUtil.createNewResource(); + } } else if (part instanceof PgenPaletteWindow) { activatePGENContext(); - + // found NCMapEditor // AbstractEditor editor = NmapUiUtils.getActiveNatlCntrsEditor(); AbstractEditor editor = PgenUtil.getActiveEditor(); @@ -926,7 +951,7 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, // ); partActivated(partRef); - if (PgenUtil.isNatlCntrsEditor(part)) { + if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor ) { AbstractEditor editor = (AbstractEditor) part; PgenResource rsc = PgenUtil.findPgenResource((AbstractEditor) part); @@ -975,7 +1000,11 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, * list in reverse so that active editor is processed last. */ for (int i = editors.length - 1; i >= 0; i--) { - unloadPgenResource(editors[i]); + // unloadPgenResource(editors[i]); + } + + for (AbstractEditor editor : PgenSession.getInstance().getEditors() ){ + unloadPgenResource(editor); } } @@ -1054,12 +1083,13 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, IWorkbenchPart part = partRef.getPart(false); // System.out.println("Something Hidden: "+part.getClass().getCanonicalName() // ); - - if (PgenUtil.isNatlCntrsEditor(part)) { + + if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor) { PgenResource pgen = PgenUtil .findPgenResource((AbstractEditor) part); if (pgen != null) { pgen.closeDialogs(); + pgen.deactivatePgenTools(); } } } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResource.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResource.java index aa76f09e78..5bfdcccaeb 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResource.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResource.java @@ -1743,22 +1743,26 @@ public class PgenResource extends } /** - * De-activate all PGEN tools + * De-activate all PGEN tools for all perspectives */ public void deactivatePgenTools() { - AbstractVizPerspectiveManager mgr = VizPerspectiveListener - .getCurrentPerspectiveManager(); - if (mgr != null) { - Iterator it = mgr.getToolManager() - .getSelectedModalTools().iterator(); - while (it.hasNext()) { - AbstractModalTool tool = it.next(); - if (tool != null && tool instanceof AbstractPgenTool) { - tool.deactivate(); - it.remove(); + + for (String pid : VizPerspectiveListener.getManagedPerspectives()){ + AbstractVizPerspectiveManager mgr = VizPerspectiveListener.getInstance().getPerspectiveManager(pid); + if (mgr != null) { + Iterator it = mgr.getToolManager() + .getSelectedModalTools().iterator(); + while (it.hasNext()) { + AbstractModalTool tool = it.next(); + if (tool != null && tool instanceof AbstractPgenTool) { + tool.deactivate(); + it.remove(); + } } } } + + } /** diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResourceData.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResourceData.java index c1b4eb0181..8c2fecb9ba 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResourceData.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResourceData.java @@ -116,6 +116,8 @@ public class PgenResourceData extends AbstractResourceData implements private boolean needsDisplay = false; private int numberOfResources = 0; + + private ArrayList rscList = new ArrayList(); // private static final String PRD_GRAPHIC = "xml"; @@ -142,7 +144,9 @@ public class PgenResourceData extends AbstractResourceData implements public PgenResource construct(LoadProperties loadProperties, IDescriptor descriptor) throws VizException { numberOfResources++; - return new PgenResource(this, loadProperties); + PgenResource rsc = new PgenResource(this, loadProperties); + rscList.add(rsc); + return rsc; } /* @@ -740,10 +744,13 @@ public class PgenResourceData extends AbstractResourceData implements */ public synchronized void cleanup(BufferedImage paneImage) { + closeDialogs(); numberOfResources--; - if (numberOfResources != 0) + if (numberOfResources != 0){ return; // not ready yet + } + commandMgr.flushStacks(); commandMgr.removeStackListener(this); @@ -751,14 +758,14 @@ public class PgenResourceData extends AbstractResourceData implements * remove Temp recovery file */ removeTempFile(); - - if (autosave) - storeAllProducts(); - // saveProducts(autoSaveFilename, multiSave); - + if (needsSaving) { promptToSave(paneImage); } + + if (autosave) + storeAllProducts(); + // saveProducts(autoSaveFilename, multiSave); if (PgenUtil.getPgenMode() == PgenMode.SINGLE) PgenUtil.resetResourceData(); diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/sigmet/SigmetInfo.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/sigmet/SigmetInfo.java index 2d819c03f6..97f2d8d759 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/sigmet/SigmetInfo.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/sigmet/SigmetInfo.java @@ -24,7 +24,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.geotools.data.Query; +import org.geotools.data.DefaultQuery; import org.geotools.data.shapefile.ShapefileDataStore; import org.geotools.feature.FeatureIterator; import org.geotools.referencing.GeodeticCalculator; @@ -60,7 +60,6 @@ import com.vividsolutions.jts.geom.Polygon; * 02/2012 #597 S. Gurung Moved snap functionalities to SnapUtil. Removed GUI snapping for Non ConvSigmet. * 02/2012 S. Gurung Moved back isSnapADC() and getNumOfCompassPts() to SigmetInfo from SnapUtil * 11/12 #893 J. Wu TTR635 - Fix volcano in alphabetical breakdown order. - * Mar 11, 2014 #2718 randerso Changes for GeoTools 10.5 * * * @author gzhang @@ -288,7 +287,7 @@ public class SigmetInfo { public static Polygon getIsolatedPolygon(Coordinate vertex, double widthInNautical, IMapDescriptor mapDescriptor){ Coordinate[] isolated = getIsolated(vertex, widthInNautical, mapDescriptor); Coordinate[] ip = new Coordinate[isolated.length+1]; - ip = (Coordinate[]) Arrays.copyOf(isolated, isolated.length); + ip = Arrays.copyOf(isolated, isolated.length); ip[ip.length-1] = isolated[0]; return getPolygon( ip,mapDescriptor ); } @@ -296,7 +295,7 @@ public class SigmetInfo { public static Polygon getSOLPolygon(Coordinate[] coors, String line, double width, IMapDescriptor mapDescriptor){ Coordinate[] ip = getSOLCoors(coors, line, width, mapDescriptor); Coordinate[] ipPlus = new Coordinate[ip.length+1]; - ipPlus = (Coordinate[]) Arrays.copyOf(ip, ipPlus.length); + ipPlus = Arrays.copyOf(ip, ipPlus.length); ipPlus[ipPlus.length-1] = ip[0]; return getPolygon( ipPlus,mapDescriptor ); } @@ -536,13 +535,18 @@ public class SigmetInfo { FeatureIterator featureIterator = null; HashMap firGeoMap = new HashMap(); - ShapefileDataStore shapefileDataStore=null; + ShapefileDataStore shapefileDataStore = null; String shapeField=null; try{ - File file = PgenStaticDataProvider.getProvider().getFirBoundsFile(); - shapefileDataStore = new ShapefileDataStore(file.toURI() - .toURL()); + File file = PgenStaticDataProvider.getProvider().getFirBoundsFile(); + shapefileDataStore = new ShapefileDataStore(file.toURI().toURL()); + shapefileDataStore.setMemoryMapped(false); + shapefileDataStore.setIndexCreationEnabled(true); + + // shapefileDataStore = new IndexedShapefileDataStore(file.toURI() + // .toURL(), null, false, true, + // org.geotools.data.shapefile.indexed.IndexType.QIX); shapeField = shapefileDataStore.getFeatureSource().getSchema().getGeometryDescriptor().getLocalName(); }catch(Exception e){ @@ -554,7 +558,7 @@ public class SigmetInfo { try { String[] types = shapefileDataStore.getTypeNames(); - Query query = new Query(); + DefaultQuery query = new DefaultQuery(); query.setTypeName(types[0]); String[] fields = new String[labelFields.length+1]; diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/AbstractPgenDrawingTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/AbstractPgenDrawingTool.java index 3ec88f93d9..d76f12305d 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/AbstractPgenDrawingTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/AbstractPgenDrawingTool.java @@ -18,8 +18,10 @@ import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PlatformUI; import com.raytheon.uf.viz.core.IDisplayPaneContainer; +import com.raytheon.uf.viz.core.maps.display.VizMapEditor; import com.raytheon.uf.viz.core.rsc.IInputHandler; import com.raytheon.viz.ui.EditorUtil; +import com.raytheon.viz.ui.editor.AbstractEditor; //import gov.noaa.nws.ncep.viz.ui.display.NCMapEditor; @@ -75,9 +77,11 @@ public abstract class AbstractPgenDrawingTool extends AbstractPgenTool { protected void activateTool() { IEditorPart ep = EditorUtil.getActiveEditor(); - if (!PgenUtil.isNatlCntrsEditor(ep)) { + if (!PgenUtil.isNatlCntrsEditor(ep) && !(ep instanceof VizMapEditor)) { // mapEditor = null; - return; + // drawingLayer = PgenUtil.findPgenResource((AbstractEditor)ep); + // if ( drawingLayer == null ) + return; } if (!super.isDelObj()) { diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/AbstractPgenTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/AbstractPgenTool.java index 8b5fa85f2e..830f85e6c5 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/AbstractPgenTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/AbstractPgenTool.java @@ -79,8 +79,9 @@ public abstract class AbstractPgenTool extends AbstractModalTool { PgenSession.getInstance().getPgenPalette().setActiveIcon(buttonName); // Get a PGEN Resource - drawingLayer = PgenSession.getInstance().getPgenResource(); - + // drawingLayer = PgenSession.getInstance().getPgenResource(); + drawingLayer = PgenUtil.findPgenResource(PgenUtil.getActiveEditor()); + if (this instanceof PgenDeleteObj) { delObjFlag = true; } else if ((this instanceof PgenSelectingTool) diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenCopyElement.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenCopyElement.java index aefa57a0cb..ede2463e0a 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenCopyElement.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenCopyElement.java @@ -8,21 +8,9 @@ package gov.noaa.nws.ncep.ui.pgen.tools; -import java.awt.Color; -import java.util.Iterator; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Event; -import org.geotools.coverage.grid.GridEnvelope2D; -import org.opengis.coverage.grid.GridEnvelope; - -import com.raytheon.uf.viz.core.IExtent; -import com.raytheon.uf.viz.core.PixelExtent; -import com.raytheon.uf.viz.core.rsc.IInputHandler; -import com.vividsolutions.jts.geom.Coordinate; - import gov.noaa.nws.ncep.ui.pgen.PgenUtil; import gov.noaa.nws.ncep.ui.pgen.annotation.Operation; +import gov.noaa.nws.ncep.ui.pgen.contours.Contours; import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent; import gov.noaa.nws.ncep.ui.pgen.elements.DECollection; import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement; @@ -31,9 +19,19 @@ import gov.noaa.nws.ncep.ui.pgen.elements.WatchBox; import gov.noaa.nws.ncep.ui.pgen.filter.OperationFilter; import gov.noaa.nws.ncep.ui.pgen.gfa.Gfa; import gov.noaa.nws.ncep.ui.pgen.gfa.GfaReducePoint; -import gov.noaa.nws.ncep.ui.pgen.contours.Contours; -import gov.noaa.nws.ncep.viz.common.SnapUtil; import gov.noaa.nws.ncep.ui.pgen.sigmet.SigmetInfo; +import gov.noaa.nws.ncep.viz.common.SnapUtil; + +import java.awt.Color; +import java.util.ArrayList; +import java.util.Iterator; + +import org.geotools.coverage.grid.GridEnvelope2D; +import org.geotools.referencing.CRS; +import org.opengis.coverage.grid.GridEnvelope; + +import com.raytheon.uf.viz.core.rsc.IInputHandler; +import com.vividsolutions.jts.geom.Coordinate; /** * Implements a modal map tool for the PGEN copy element function. @@ -57,6 +55,7 @@ import gov.noaa.nws.ncep.ui.pgen.sigmet.SigmetInfo; * 05/11 #808 J. Wu Update Gfa vor text * 05/12 #610 J. Wu Add warning when GFA FROM lines > 3 * 08/12 #760 B. Yin Check for world wrap + * 09/14 ? B. Yin Handle map bounds. * * * @@ -109,6 +108,7 @@ public class PgenCopyElement extends AbstractPgenTool { protected boolean simulate; + private boolean isMercator = false; /* * (non-Javadoc) @@ -121,7 +121,7 @@ public class PgenCopyElement extends AbstractPgenTool { if ( !isResourceEditable() ) return false; preempt = false; - + isMercator = (CRS.getMapProjection( mapEditor.getActiveDisplayPane().getDescriptor().getCRS())).getName().contains("Mercator"); // Check if mouse is in geographic extent Coordinate loc = mapEditor.translateClick(anX, aY); if ( loc == null || shiftDown || simulate ) return false; @@ -225,6 +225,15 @@ public class PgenCopyElement extends AbstractPgenTool { } if ( ghostEl != null ) { + + //save the original points + ArrayList originalPts = new ArrayList(); + for ( Coordinate coord : ghostEl.getPoints()){ + originalPts.add(new Coordinate(coord.x, coord.y, 0)); + } + + boolean hitBound = false; + // use screen coordinate to copy/move //double[] locScreen = mapEditor.translateInverseClick(loc); double[] ptScreen = mapEditor.translateInverseClick(ptSelected); @@ -242,17 +251,21 @@ public class PgenCopyElement extends AbstractPgenTool { double[] world = mapEditor.getActiveDisplayPane().screenToGrid(scnPt[0], scnPt[1], 0); - if ( world[0] > ((GridEnvelope2D)ge).getWidth() ) { + if ( isMercator && world[0] > ((GridEnvelope2D)ge).getWidth() ) { // System.out.println("idx=" + idx + " Out of Screen " + world[0] +" / " + ((GridEnvelope2D)ge).getWidth() ); world[0] -= ((GridEnvelope2D)ge).getWidth(); scnPt = mapEditor.getActiveDisplayPane().gridToScreen( world ); } - else if ( world[0] < 0 ){ - // System.out.println("idx=" + idx + " Out of Screen " + world[0] +" / " + ((GridEnvelope2D)ge).getWidth() ); + else if ( isMercator && world[0] < 0 ){ + // System.out.println("idx=" + idx + " Out of Screen " + world[0] +" / " + ((GridEnvelope2D)ge).getWidth() ); world[0] += ((GridEnvelope2D)ge).getWidth(); scnPt = mapEditor.getActiveDisplayPane().gridToScreen( world ); } - + else if ( world[0] > ((GridEnvelope2D)ge).getWidth() || world[0] < 0 || + world[1] < 0 || world[1] > ((GridEnvelope2D)ge).getHeight()){ + hitBound = true; + break; + } Coordinate cord = mapEditor.translateClick(scnPt[0], scnPt[1]); @@ -263,6 +276,14 @@ public class PgenCopyElement extends AbstractPgenTool { } + if ( hitBound ){ + //restore original points + for ( int idx = 0; idx < ghostEl.getPoints().size(); idx++ ){ + ghostEl.getPoints().get(idx).x = originalPts.get(idx).x; + ghostEl.getPoints().get(idx).y = originalPts.get(idx).y; + } + } + if ( elSelected instanceof Gfa ) { double[] scnPt = mapEditor.translateInverseClick( ((Gfa) elSelected).getGfaTextCoordinate() ); diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchBoxAddDelCntyHandler.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchBoxAddDelCntyHandler.java index f251197584..4c36240601 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchBoxAddDelCntyHandler.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchBoxAddDelCntyHandler.java @@ -16,11 +16,11 @@ import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResource; import java.util.List; -import org.geotools.data.simple.SimpleFeatureCollection; -import org.geotools.data.simple.SimpleFeatureIterator; import org.geotools.factory.CommonFactoryFinder; import org.geotools.factory.GeoTools; import org.geotools.feature.DefaultFeatureCollection; +import org.geotools.feature.FeatureCollection; +import org.geotools.feature.FeatureIterator; import org.geotools.feature.simple.SimpleFeatureBuilder; import org.geotools.feature.simple.SimpleFeatureTypeBuilder; import org.geotools.referencing.crs.DefaultGeographicCRS; @@ -45,7 +45,6 @@ import com.vividsolutions.jts.geom.Point; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 12/09 #159 B. Yin Initial Creation. - * Mar 11, 2014 #2718 randerso Changes for GeoTools 10.5 * * * @@ -61,7 +60,7 @@ public class PgenWatchBoxAddDelCntyHandler extends InputHandlerDefaultImpl { //feature collection used to find which county a location is in - static DefaultFeatureCollection counties; + static DefaultFeatureCollection counties; /** * Public constructor @@ -106,9 +105,9 @@ public class PgenWatchBoxAddDelCntyHandler extends InputHandlerDefaultImpl { Point click = gf.createPoint(loc); //apply filter - SimpleFeatureCollection fc = counties.subCollection(createFilter(click)); + FeatureCollection fc = counties.subCollection(createFilter(click)); - SimpleFeatureIterator featureIterator = fc.features(); + FeatureIterator featureIterator = fc.features(); //find the ID of the county the location is inside of String ugc = null; @@ -122,7 +121,6 @@ public class PgenWatchBoxAddDelCntyHandler extends InputHandlerDefaultImpl { break; } } - featureIterator.close(); boolean gotCnty = false; SPCCounty county = null; @@ -223,7 +221,7 @@ public class PgenWatchBoxAddDelCntyHandler extends InputHandlerDefaultImpl { */ private void createCountyFeatureCollection(){ - counties = new DefaultFeatureCollection(); + counties = new DefaultFeatureCollection(null, null); // create simple feature type SimpleFeatureTypeBuilder builder2 = new SimpleFeatureTypeBuilder(); From b76e139fade6bd852673f6d460df5a22fb814038 Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Mon, 6 Oct 2014 13:05:44 -0500 Subject: [PATCH 02/19] ensure osgi-inf is included in build so d2d can activate pgen Change-Id: I5a6dd3f71cd52ab44b098a666e4612368c444a95 Former-commit-id: 6280c9deb1499b92a2578b3ce414a7f89c26cdc6 --- ncep/gov.noaa.nws.ncep.staticdataprovider/build.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ncep/gov.noaa.nws.ncep.staticdataprovider/build.properties b/ncep/gov.noaa.nws.ncep.staticdataprovider/build.properties index 34d2e4d2da..c58ea2178c 100644 --- a/ncep/gov.noaa.nws.ncep.staticdataprovider/build.properties +++ b/ncep/gov.noaa.nws.ncep.staticdataprovider/build.properties @@ -1,4 +1,5 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ - . + .,\ + OSGI-INF/ From 5fc47fb52d489ca30289679e87108b1b838cc478 Mon Sep 17 00:00:00 2001 From: Bingfan Yin Date: Thu, 4 Dec 2014 13:38:50 -0500 Subject: [PATCH 03/19] VLab Issue #5413 - Changes for PGEN in D2D fourth try Change-Id: Iec34f20209748a661ee07d2960bd79132233cf1a Former-commit-id: 4d15f42f935cd71c1962292ecfacabfe49127027 --- .../noaa/nws/ncep/ui/pgen/PgenSession.java | 245 +++++++++++++++++- .../gov/noaa/nws/ncep/ui/pgen/PgenUtil.java | 9 +- .../nws/ncep/ui/pgen/attrdialog/AttrDlg.java | 2 + .../pgen/display/DisplayElementFactory.java | 9 + .../ui/pgen/palette/PgenPaletteWindow.java | 56 ++-- .../nws/ncep/ui/pgen/rsc/PgenResource.java | 14 +- .../ncep/ui/pgen/tools/AbstractPgenTool.java | 16 +- .../ncep/ui/pgen/tools/PgenSelectHandler.java | 1 + 8 files changed, 298 insertions(+), 54 deletions(-) diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenSession.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenSession.java index d6e71be2f0..30f9f56e9a 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenSession.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenSession.java @@ -7,18 +7,32 @@ */ package gov.noaa.nws.ncep.ui.pgen; -import java.util.ArrayList; -import java.util.List; - -import com.raytheon.uf.viz.core.maps.display.VizMapEditor; -import com.raytheon.viz.ui.editor.AbstractEditor; - +import gov.noaa.nws.ncep.ui.pgen.PgenUtil.PgenMode; import gov.noaa.nws.ncep.ui.pgen.controls.PgenCommandManager; +import gov.noaa.nws.ncep.ui.pgen.filter.CategoryFilter; import gov.noaa.nws.ncep.ui.pgen.palette.PgenPaletteWindow; import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResource; import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResourceData; +import gov.noaa.nws.ncep.ui.pgen.tools.AbstractPgenTool; -//import gov.noaa.nws.ncep.viz.ui.display.NmapUiUtils; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.ui.IPartListener2; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IViewReference; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchPartReference; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.internal.WorkbenchPage; + +import com.raytheon.uf.viz.core.IDisplayPane; +import com.raytheon.uf.viz.core.IRenderableDisplayChangedListener; +import com.raytheon.uf.viz.core.drawables.IRenderableDisplay; +import com.raytheon.uf.viz.core.maps.display.VizMapEditor; +import com.raytheon.viz.ui.editor.AbstractEditor; +import com.raytheon.viz.ui.editor.IMultiPaneEditor; /** * This singleton is intended to couple a PGEN Palette with a PGgenResource, so @@ -27,7 +41,21 @@ import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResourceData; * @author sgilbert * */ -public class PgenSession { + +/** + * Implements a drawing layer for PGEN products. + * + *
+ * SOFTWARE HISTORY
+ * Date       	Ticket#		Engineer	Description
+ * ------------	----------	-----------	--------------------------
+ * 12/14		R5413		B. Yin   	Added IPartListener2 and IRenderableDisplayChangedListener
+ * to make the swapping in D2D work
+ * 
+ */
+
+public class PgenSession implements IPartListener2,
+        IRenderableDisplayChangedListener {
 
     /*
      * The singleton instance
@@ -45,6 +73,12 @@ public class PgenSession {
     private PgenPaletteWindow palette = null;
 
     private List editors = new ArrayList();
+
+    /*
+     * Active PGEN tool
+     */
+    private AbstractPgenTool pgenTool = null;
+
     /*
      * Hide default constructor
      */
@@ -80,8 +114,9 @@ public class PgenSession {
         // set new PGEN resource
         pgenResource = rsc;
         // add the palette's stack listener to new resource's command Manager
-        if (pgenResource != null)
+        if (pgenResource != null && palette != null) {
             pgenResource.getCommandMgr().addStackListener(palette);
+        }
 
     }
 
@@ -155,8 +190,9 @@ public class PgenSession {
         palette = pal;
         // Register this palette's stack listener with the CommandManager, if
         // able
-        if (pgenResource != null)
+        if (pgenResource != null) {
             pgenResource.getCommandMgr().addStackListener(palette);
+        }
     }
 
     /**
@@ -197,13 +233,194 @@ public class PgenSession {
     public PgenPaletteWindow getPgenPalette() {
         return palette;
     }
-    
-    public void addEditor(AbstractEditor editor){
+
+    public void addEditor(AbstractEditor editor) {
         editors.add(editor);
     }
-    
-    public List getEditors(){
+
+    public List getEditors() {
         return editors;
     }
 
+    /*
+     * Remove PGEN handler when swapping to side view. Also open PGEN palette if
+     * there is a PGEN resource when swapping to main editor.
+     * 
+     * (non-Javadoc)
+     * 
+     * @see com.raytheon.uf.viz.core.IRenderableDisplayChangedListener#
+     * renderableDisplayChanged(com.raytheon.uf.viz.core.IDisplayPane,
+     * com.raytheon.uf.viz.core.drawables.IRenderableDisplay,
+     * com.raytheon.uf.viz
+     * .core.IRenderableDisplayChangedListener.DisplayChangeType)
+     */
+    @SuppressWarnings("restriction")
+    @Override
+    public void renderableDisplayChanged(IDisplayPane pane,
+            IRenderableDisplay newRenderableDisplay, DisplayChangeType type) {
+
+        if (type == DisplayChangeType.ADD
+                && newRenderableDisplay.getContainer() instanceof VizMapEditor) {
+
+            VizMapEditor editorChanged = (VizMapEditor) newRenderableDisplay
+                    .getContainer();
+
+            if (PgenUtil.getPgenMode() == PgenMode.SINGLE) { // for D2d
+                                                             // swapping, single
+                                                             // pane mode
+                if (pgenResource != null) {
+                    pgenResource.removeGhostLine();
+                    pgenResource.removeSelected();
+                }
+
+                PgenUtil.setSelectingMode();
+            }
+
+            else { // for D2d swapping, multi-pane mode
+
+                // clean up current pgen resource
+                if (pgenResource != null) {
+                    pgenResource.closeDialogs();
+                    pgenResource.deactivatePgenTools();
+                    pgenResource.getCommandMgr().removeStackListener(palette);
+                }
+
+                if (palette != null) {
+                    if (PgenUtil.findPgenResource(editorChanged) == null) {
+                        // editor does not have PGEN, close the palette
+
+                        PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+                                .getActivePage().hideView(palette);
+                        palette = null;
+                    } else {
+                        // editor has PGEN resource, reset to selecting mode
+                        pgenResource = PgenUtil.findPgenResource(editorChanged);
+                        pgenResource.setCatFilter(new CategoryFilter("Any"));
+                        palette.setCurrentCategory("Any");
+                        PgenUtil.setSelectingMode();
+                    }
+                } else {
+                    // palette is closed
+                    if (PgenUtil.findPgenResource(editorChanged) != null) {
+                        // editor has PGEN, open the palette
+                        IWorkbenchPage wpage = PlatformUI.getWorkbench()
+                                .getActiveWorkbenchWindow().getActivePage();
+
+                        IViewPart vpart = wpage.findView(PgenUtil.VIEW_ID);
+
+                        try {
+
+                            if (vpart == null) {
+
+                                vpart = wpage.showView(PgenUtil.VIEW_ID);
+                                IViewReference pgenViewRef = wpage
+                                        .findViewReference(PgenUtil.VIEW_ID);
+                                if (pgenViewRef != null
+                                        && wpage instanceof WorkbenchPage) {
+                                    ((WorkbenchPage) wpage)
+                                            .detachView(pgenViewRef);
+                                }
+                            } else {
+
+                                if (!wpage.isPartVisible(vpart)) {
+                                    vpart = wpage.showView(PgenUtil.VIEW_ID);
+                                    IViewReference pgenViewRef = wpage
+                                            .findViewReference(PgenUtil.VIEW_ID);
+                                    if (pgenViewRef != null
+                                            && wpage instanceof WorkbenchPage) {
+                                        ((WorkbenchPage) wpage)
+                                                .detachView(pgenViewRef);
+                                    }
+                                }
+                            }
+                            this.pgenResource = PgenUtil
+                                    .findPgenResource(editorChanged);
+                            this.pgenResource.setCatFilter(new CategoryFilter(
+                                    "Any"));
+                            this.palette.setCurrentCategory("Any");
+                            PgenUtil.setSelectingMode();
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+
+                    }
+                }
+            }
+        } else if (type == DisplayChangeType.REMOVE
+                && !(newRenderableDisplay.getContainer() instanceof AbstractEditor)) {
+            // remove to side view
+            // unregister pgen handlers
+
+            if (newRenderableDisplay.getContainer() instanceof IMultiPaneEditor) {
+                IMultiPaneEditor sideView = (IMultiPaneEditor) newRenderableDisplay
+                        .getContainer();
+                if (this.getPgenTool() != null) {
+                    sideView.unregisterMouseHandler(this.getPgenTool()
+                            .getMouseHandler());
+                }
+            }
+        }
+    }
+
+    @Override
+    public void partActivated(IWorkbenchPartReference partRef) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void partBroughtToTop(IWorkbenchPartReference partRef) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void partClosed(IWorkbenchPartReference partRef) {
+        IWorkbenchPart part = partRef.getPart(false);
+        if (part instanceof VizMapEditor) { // for D2D
+            if (PgenUtil.findPgenResource((VizMapEditor) part) != null) {
+                ((VizMapEditor) part)
+                        .removeRenderableDisplayChangedListener(this);
+            }
+        }
+    }
+
+    @Override
+    public void partDeactivated(IWorkbenchPartReference partRef) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void partOpened(IWorkbenchPartReference partRef) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void partHidden(IWorkbenchPartReference partRef) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void partVisible(IWorkbenchPartReference partRef) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void partInputChanged(IWorkbenchPartReference partRef) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public AbstractPgenTool getPgenTool() {
+        return pgenTool;
+    }
+
+    public void setPgenTool(AbstractPgenTool pgenTool) {
+        this.pgenTool = pgenTool;
+    }
+
 }
diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenUtil.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenUtil.java
index 6ad3a7b443..c9d44664a6 100644
--- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenUtil.java
+++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenUtil.java
@@ -145,6 +145,7 @@ import com.vividsolutions.jts.linearref.LocationIndexedLine;
  * 05/14         TTR998     J. Wu         Added pixelToLatlon().
  * 07/14                    Chin Chen     In latlonToPixel(), make sure not to add null pixel to its return pixel array
  * 08/14          TTR962      J. Wu       Add replaceWithDate to format output file with DD, MM, YYYY, HH.
+ * 12/14		R5413		B. Yin		  Add a listener for D2D swapping pane 
  * 
* * @author @@ -685,9 +686,15 @@ public class PgenUtil { AbstractEditor editor = getActiveEditor(); if (editor != null) { try { - if ( editor instanceof VizMapEditor || PgenUtil.isNatlCntrsEditor(editor)){ + if (PgenUtil.isNatlCntrsEditor(editor)){ PgenSession.getInstance().addEditor(editor); } + else if (editor instanceof VizMapEditor ){ + //Add a listener for D2d to make the swap work. + PgenSession.getInstance().addEditor(editor); + editor.addRenderableDisplayChangedListener(PgenSession.getInstance()); + } + switch (getPgenMode()) { case SINGLE: /* diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/attrdialog/AttrDlg.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/attrdialog/AttrDlg.java index 2e3a9c4962..3ee10aa2aa 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/attrdialog/AttrDlg.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/attrdialog/AttrDlg.java @@ -64,6 +64,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor; * 03/13 #928 B. Yin Make the button bar smaller. * 04/13 #874 B. Yin Handle collection when OK is pressed for multi-selection. * 04/13 TTR399 J. Wu Make the dialog compact + * 12/14 R5413 B. Yin Refresh editor after dialog close * * * @@ -156,6 +157,7 @@ public abstract class AttrDlg extends Dialog implements IAttribute { public void handleShellCloseEvent() { drawingLayer.removeSelected(); drawingLayer.removeGhostLine(); + mapEditor.refresh(); super.handleShellCloseEvent(); PgenUtil.setSelectingMode(); } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/display/DisplayElementFactory.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/display/DisplayElementFactory.java index 4dfb02a1e2..dddbfab647 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/display/DisplayElementFactory.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/display/DisplayElementFactory.java @@ -144,6 +144,7 @@ import com.vividsolutions.jts.operation.distance.DistanceOp; * 05/14 TTR 995 J. Wu Make contour label auto-placement an option. * 07/14 ? B. Yin Added support for dashed-line circle for TCM 12 feet sea. * 08/14 ? B. Yin Fixed world wrap for TCM track and zero circle issues. + * 12/14 R5413 B. Yin Dispose image and font in find*Ranges methods * * * @author sgilbert @@ -5910,6 +5911,10 @@ public class DisplayElementFactory { List textPos = new ArrayList(); textPos.add(new Coordinate(loc[0], loc[1])); + if ( font != null ){ + font.dispose(); + } + return new PgenRangeRecord(rngBox, textPos, false); } @@ -5983,6 +5988,10 @@ public class DisplayElementFactory { List symPos = new ArrayList(); symPos.add(sym.getLocation()); + if ( pic != null ){ + pic.dispose(); + } + return new PgenRangeRecord(rngBox, symPos, false); } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteWindow.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteWindow.java index 2a5560a2a6..b2427f4ee7 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteWindow.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteWindow.java @@ -45,11 +45,8 @@ import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.events.ShellEvent; -import org.eclipse.swt.events.ShellListener; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -64,9 +61,6 @@ import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IPartListener2; -import org.eclipse.ui.IPropertyListener; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IViewReference; import org.eclipse.ui.IViewSite; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPart; @@ -76,15 +70,14 @@ import org.eclipse.ui.PlatformUI; import org.eclipse.ui.commands.ICommandService; import org.eclipse.ui.contexts.IContextActivation; import org.eclipse.ui.contexts.IContextService; -import org.eclipse.ui.internal.WorkbenchPage; import org.eclipse.ui.part.ViewPart; import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.drawables.IRenderableDisplay; import com.raytheon.uf.viz.core.drawables.ResourcePair; +import com.raytheon.uf.viz.core.maps.display.VizMapEditor; import com.raytheon.uf.viz.core.rsc.ResourceList; -import com.raytheon.viz.ui.EditorUtil; import com.raytheon.viz.ui.UiUtil; import com.raytheon.viz.ui.VizWorkbenchManager; import com.raytheon.viz.ui.editor.AbstractEditor; @@ -92,7 +85,6 @@ import com.raytheon.viz.ui.editor.ISelectedPanesChangedListener; import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager; import com.raytheon.viz.ui.perspectives.VizPerspectiveListener; import com.raytheon.viz.ui.tools.AbstractModalTool; -import com.raytheon.uf.viz.core.maps.display.VizMapEditor; /** * The PGEN View is used for all interaction with the objects in the PGEN @@ -242,7 +234,7 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, page = site.getPage(); page.addPartListener(this); - + /* * Get a list from registry of all elements that registered with the * gov.noaa.nws.ncep.ui.pgen.palette extension point @@ -584,10 +576,10 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, /* * Force a resize */ - Rectangle r = scroll.getClientArea(); + Rectangle r = scroll.getClientArea(); paletteComp.setSize(paletteComp.computeSize(r.width, SWT.DEFAULT)); paletteComp.layout(); - + // wait for buttons to be created disableUndoRedo(); } @@ -884,8 +876,9 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor) { PgenResource rsc = PgenUtil.findPgenResource((AbstractEditor) part); - // if ( PgenSession.getInstance().getPgenResource().getDescriptor() != ) - + // if ( PgenSession.getInstance().getPgenResource().getDescriptor() + // != ) + if ((rsc == null) && (PgenUtil.getPgenMode() == PgenMode.SINGLE)) { rsc = PgenUtil.createNewResource(); } @@ -905,16 +898,9 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, PgenUtil.addSelectedPaneChangedListener(editor, this); } activatePGENContext(); - } else if (part instanceof VizMapEditor) { - PgenResource rsc = PgenUtil.findPgenResource((AbstractEditor) part); - if ((rsc == null) && (PgenUtil.getPgenMode() == PgenMode.SINGLE)) { - rsc = PgenUtil.createNewResource(); - } - } - - else if (part instanceof PgenPaletteWindow) { + } else if (part instanceof PgenPaletteWindow) { activatePGENContext(); - + // found NCMapEditor // AbstractEditor editor = NmapUiUtils.getActiveNatlCntrsEditor(); AbstractEditor editor = PgenUtil.getActiveEditor(); @@ -951,7 +937,7 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, // ); partActivated(partRef); - if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor ) { + if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor) { AbstractEditor editor = (AbstractEditor) part; PgenResource rsc = PgenUtil.findPgenResource((AbstractEditor) part); @@ -1000,11 +986,12 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, * list in reverse so that active editor is processed last. */ for (int i = editors.length - 1; i >= 0; i--) { - // unloadPgenResource(editors[i]); + // unloadPgenResource(editors[i]); } - - for (AbstractEditor editor : PgenSession.getInstance().getEditors() ){ - unloadPgenResource(editor); + + for (AbstractEditor editor : PgenSession.getInstance() + .getEditors()) { + unloadPgenResource(editor); } } @@ -1083,8 +1070,8 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, IWorkbenchPart part = partRef.getPart(false); // System.out.println("Something Hidden: "+part.getClass().getCanonicalName() // ); - - if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor) { + + if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor) { PgenResource pgen = PgenUtil .findPgenResource((AbstractEditor) part); if (pgen != null) { @@ -1433,4 +1420,13 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, public String getCurrentObject() { return currentObject; } + + /* + * Sets the category and its icon. + */ + public void setCurrentCategory(String currentCategory) { + this.resetIcon(this.currentCategory); + this.currentCategory = currentCategory; + this.setActiveIcon(currentCategory); + } } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResource.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResource.java index 5bfdcccaeb..e04297bd30 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResource.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResource.java @@ -51,6 +51,7 @@ import gov.noaa.nws.ncep.ui.pgen.sigmet.Sigmet; import gov.noaa.nws.ncep.ui.pgen.tca.TCAElement; import gov.noaa.nws.ncep.ui.pgen.tca.TropicalCycloneAdvisory; import gov.noaa.nws.ncep.ui.pgen.tools.AbstractPgenTool; +import gov.noaa.nws.ncep.ui.pgen.tools.InputHandlerDefaultImpl; import gov.noaa.nws.ncep.ui.pgen.tools.PgenSnapJet; import java.awt.Color; @@ -76,14 +77,18 @@ import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.map.MapDescriptor; import com.raytheon.uf.viz.core.rsc.AbstractVizResource; +import com.raytheon.uf.viz.core.rsc.IInputHandler; import com.raytheon.uf.viz.core.rsc.IResourceDataChanged; import com.raytheon.uf.viz.core.rsc.LoadProperties; +import com.raytheon.uf.viz.core.rsc.IInputHandler.InputPriority; import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener; import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability; import com.raytheon.viz.core.gl.IGLTarget; import com.raytheon.viz.ui.cmenu.IContextMenuProvider; import com.raytheon.viz.ui.editor.AbstractEditor; +import com.raytheon.viz.ui.editor.IMultiPaneEditor; import com.raytheon.viz.ui.input.EditableManager; +import com.raytheon.viz.ui.panes.PaneManager; import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager; import com.raytheon.viz.ui.perspectives.VizPerspectiveListener; import com.raytheon.viz.ui.tools.AbstractModalTool; @@ -144,6 +149,7 @@ import com.vividsolutions.jts.geom.Point; * 04/13 #874 B. Yin Added a method replaceElements with parameter parent. * 04/13 #977 S. Gilbert PGEN Database support * 11/13 TTR 752 J. Wu Add methods for CCFP text auto placement. + * 11/14 R5413 B. Yin Display PGEN in side view in D2D * * * @author B. Yin @@ -359,9 +365,9 @@ public class PgenResource extends public void paintInternal(IGraphicsTarget target, PaintProperties paintProps) throws VizException { IDisplayPaneContainer editor = getResourceContainer(); - if (editor instanceof AbstractEditor) {// && ((NCMapEditor) - // editor).getApplicationName().equals("NA") - // ) { + + //Draw in main editor and side view (IMultiPaneEditor) + if (editor instanceof AbstractEditor || editor instanceof IMultiPaneEditor) { DisplayElementFactory df = new DisplayElementFactory(target, descriptor); @@ -677,7 +683,7 @@ public class PgenResource extends private void drawSelected(IGraphicsTarget target, PaintProperties paintProps) { - if (!elSelected.isEmpty()) { + if ( !elSelected.isEmpty() && PgenSession.getInstance().getPgenPalette() != null ) { DisplayElementFactory df = new DisplayElementFactory(target, descriptor); List displayEls = new ArrayList(); diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/AbstractPgenTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/AbstractPgenTool.java index 830f85e6c5..cf80ccf181 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/AbstractPgenTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/AbstractPgenTool.java @@ -33,6 +33,7 @@ import com.raytheon.viz.ui.tools.AbstractModalTool; * 12/13 TTR899 J. Wu Set delObjFlag to false when any Pgen Action * button is clicked * 04/2014 TTR900 pswamy R-click cannot return to SELECT from Rotate and DEL_OBJ + * 12/2014 R5413 B. Yin Set PGEN tool in PGEN session * * * @@ -79,8 +80,8 @@ public abstract class AbstractPgenTool extends AbstractModalTool { PgenSession.getInstance().getPgenPalette().setActiveIcon(buttonName); // Get a PGEN Resource - // drawingLayer = PgenSession.getInstance().getPgenResource(); - drawingLayer = PgenUtil.findPgenResource(PgenUtil.getActiveEditor()); + drawingLayer = PgenSession.getInstance().getPgenResource(); + if (this instanceof PgenDeleteObj) { delObjFlag = true; @@ -103,11 +104,14 @@ public abstract class AbstractPgenTool extends AbstractModalTool { } this.inputHandler = getMouseHandler(); - if (this.inputHandler != null) + if (this.inputHandler != null){ mapEditor.registerMouseHandler(this.inputHandler); + } // Turn off, so tool doesn't exihibit toggle behavior setEnabled(false); + + PgenSession.getInstance().setPgenTool(this); } abstract public IInputHandler getMouseHandler(); @@ -131,9 +135,11 @@ public abstract class AbstractPgenTool extends AbstractModalTool { } - if (mapEditor != null && this.inputHandler != null) - mapEditor.unregisterMouseHandler(this.inputHandler); + if (mapEditor != null && this.inputHandler != null){ + mapEditor.unregisterMouseHandler(this.inputHandler); + } + PgenSession.getInstance().setPgenTool(null); } /** diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenSelectHandler.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenSelectHandler.java index 422d7c45f7..633ae96734 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenSelectHandler.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenSelectHandler.java @@ -261,6 +261,7 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl { PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getShell()).setWatchBox((WatchBox) elSelected); PgenUtil.loadWatchBoxModifyTool(elSelected); + return false; } else if (elSelected instanceof Tcm) { PgenUtil.loadTcmTool(elSelected); } From eee0d49bde8b519cfb22463c5463d6c53b365cb4 Mon Sep 17 00:00:00 2001 From: Bingfan Yin Date: Mon, 15 Dec 2014 09:00:40 -0500 Subject: [PATCH 04/19] VLab Issue #5413 - Changes for PGEN in D2D for mouse click commit 1a7bd6cd64d629e6e01b287cfa60b36bac081813 Author: Bingfan Yin Date: Mon Dec 15 08:45:20 2014 -0500 Set perspective ID in PGEN session from palette. commit bef2feeccf0adfa36ab578a35ecf6f48d604eaf0 Author: Bingfan Yin Date: Mon Dec 15 08:28:44 2014 -0500 Changes to resolve mouse conflicts for PGEN in D2D. Also prevent PGEN showing in other perspectives if PGEN is in single mode. Fixed the PGEN symbol size issue when swapping in D2D. Change-Id: Ie90747ce84a88c967da494fe90045eedd44ab50c Former-commit-id: a87c0d2064fa325fd8f550b37734aa9ca63c1f9e --- .../noaa/nws/ncep/ui/pgen/PgenSession.java | 72 +++++-- .../ncep/ui/pgen/filter/CategoryFilter.java | 9 +- .../ui/pgen/palette/PgenPaletteWindow.java | 49 ++--- .../nws/ncep/ui/pgen/rsc/PgenResource.java | 43 ++-- .../ncep/ui/pgen/rsc/PgenResourceGhost.java | 71 ++++--- .../ui/pgen/tools/PgenAddLabelHandler.java | 91 +++++--- .../ui/pgen/tools/PgenAddPointAltHandler.java | 3 + .../ui/pgen/tools/PgenAddPointHandler.java | 3 + .../ui/pgen/tools/PgenAvnTextDrawingTool.java | 27 ++- .../ncep/ui/pgen/tools/PgenConnectTool.java | 61 +++--- .../ncep/ui/pgen/tools/PgenCopyElement.java | 30 +-- .../nws/ncep/ui/pgen/tools/PgenDeleteObj.java | 18 ++ .../ncep/ui/pgen/tools/PgenDeletePart.java | 28 ++- .../ui/pgen/tools/PgenDeletePointHandler.java | 4 +- .../pgen/tools/PgenDualPointDrawingTool.java | 47 +++-- .../ncep/ui/pgen/tools/PgenExtrapTool.java | 198 +++++++++-------- .../ui/pgen/tools/PgenFlipDrawingElement.java | 199 ++++++++++-------- .../nws/ncep/ui/pgen/tools/PgenFromTool.java | 30 ++- .../ui/pgen/tools/PgenGfaDrawingTool.java | 156 ++++++++------ .../ncep/ui/pgen/tools/PgenGfaFormatTool.java | 19 +- .../ui/pgen/tools/PgenInterpolationTool.java | 106 ++++++---- .../pgen/tools/PgenJetBarbAddingHandler.java | 29 ++- .../tools/PgenJetBarbDeletingHandler.java | 23 +- .../ui/pgen/tools/PgenJetDrawingTool.java | 114 +++++----- .../pgen/tools/PgenJetHashAddingHandler.java | 24 ++- .../tools/PgenJetHashDeletingHandler.java | 26 ++- .../pgen/tools/PgenKinkLineDrawingTool.java | 34 ++- .../pgen/tools/PgenLabeledLineDelHandler.java | 20 +- .../tools/PgenLabeledLineDrawingTool.java | 168 ++++++++------- .../pgen/tools/PgenLabeledLineModifyTool.java | 102 ++++----- .../ncep/ui/pgen/tools/PgenModifyTool.java | 116 +++++----- .../ncep/ui/pgen/tools/PgenMoveElement.java | 25 ++- .../pgen/tools/PgenMultiPointDrawingTool.java | 148 +++++++------ .../ui/pgen/tools/PgenMultiSelectTool.java | 2 +- .../ui/pgen/tools/PgenOutlookDrawingTool.java | 161 +++++++------- .../ui/pgen/tools/PgenOutlookSetCont.java | 23 +- .../ncep/ui/pgen/tools/PgenRotateElement.java | 24 ++- .../ncep/ui/pgen/tools/PgenSelectHandler.java | 14 +- .../tools/PgenSinglePointDrawingTool.java | 94 +++++---- .../ui/pgen/tools/PgenSpenesDrawingTool.java | 92 ++++---- .../nws/ncep/ui/pgen/tools/PgenTcaTool.java | 24 ++- .../ui/pgen/tools/PgenTcmDrawingTool.java | 46 ++-- .../ui/pgen/tools/PgenTextDrawingTool.java | 77 ++++--- .../ui/pgen/tools/PgenVectorDrawingTool.java | 44 ++-- .../tools/PgenWatchBoxAddDelCntyHandler.java | 32 ++- .../pgen/tools/PgenWatchBoxDrawingTool.java | 52 ++--- .../ui/pgen/tools/PgenWatchBoxModifyTool.java | 123 +++++------ .../tools/PgenWatchStatusLineDrawingTool.java | 127 ++++++----- 48 files changed, 1842 insertions(+), 1186 deletions(-) diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenSession.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenSession.java index 30f9f56e9a..3a7171600e 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenSession.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenSession.java @@ -27,12 +27,20 @@ import org.eclipse.ui.IWorkbenchPartReference; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.internal.WorkbenchPage; +import com.raytheon.uf.common.status.IUFStatusHandler; +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.IRenderableDisplayChangedListener; import com.raytheon.uf.viz.core.drawables.IRenderableDisplay; +import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.maps.display.VizMapEditor; +import com.raytheon.uf.viz.core.rsc.AbstractVizResource; +import com.raytheon.uf.viz.core.rsc.ResourceList; import com.raytheon.viz.ui.editor.AbstractEditor; import com.raytheon.viz.ui.editor.IMultiPaneEditor; +import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager; +import com.raytheon.viz.ui.perspectives.VizPerspectiveListener; /** * This singleton is intended to couple a PGEN Palette with a PGgenResource, so @@ -50,10 +58,12 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 12/14 R5413 B. Yin Added IPartListener2 and IRenderableDisplayChangedListener - * to make the swapping in D2D work + * to make the swapping in D2D work + * 12/14 R5413 B. Yin Added exception handling, perspective id, and endSession. * */ +@SuppressWarnings("restriction") public class PgenSession implements IPartListener2, IRenderableDisplayChangedListener { @@ -79,11 +89,19 @@ public class PgenSession implements IPartListener2, */ private AbstractPgenTool pgenTool = null; + private static final IUFStatusHandler statusHandler = UFStatus + .getHandler(PgenSession.class); + + private String perspectiveId = ""; + /* * Hide default constructor */ private PgenSession() { - + AbstractVizPerspectiveManager pMngr = VizPerspectiveListener.getCurrentPerspectiveManager(); + if ( pMngr != null ){ + setPerspectiveId(pMngr.getPerspectiveId()); + } } /** @@ -254,7 +272,6 @@ public class PgenSession implements IPartListener2, * com.raytheon.uf.viz * .core.IRenderableDisplayChangedListener.DisplayChangeType) */ - @SuppressWarnings("restriction") @Override public void renderableDisplayChanged(IDisplayPane pane, IRenderableDisplay newRenderableDisplay, DisplayChangeType type) { @@ -265,12 +282,17 @@ public class PgenSession implements IPartListener2, VizMapEditor editorChanged = (VizMapEditor) newRenderableDisplay .getContainer(); - if (PgenUtil.getPgenMode() == PgenMode.SINGLE) { // for D2d - // swapping, single - // pane mode + if (PgenUtil.getPgenMode() == PgenMode.SINGLE) { + // for D2d swapping, single pane mode if (pgenResource != null) { pgenResource.removeGhostLine(); pgenResource.removeSelected(); + + // Make sure PGEN resource repaint in the new editor. + PgenResource rsc = PgenUtil.findPgenResource(editorChanged ); + if ( rsc != null ){ + rsc.resetAllElements(); + } } PgenUtil.setSelectingMode(); @@ -295,8 +317,8 @@ public class PgenSession implements IPartListener2, } else { // editor has PGEN resource, reset to selecting mode pgenResource = PgenUtil.findPgenResource(editorChanged); - pgenResource.setCatFilter(new CategoryFilter("Any")); - palette.setCurrentCategory("Any"); + pgenResource.setCatFilter(new CategoryFilter()); + palette.setCurrentCategory(PgenPaletteWindow.CATEGORY_ANY); PgenUtil.setSelectingMode(); } } else { @@ -335,13 +357,13 @@ public class PgenSession implements IPartListener2, } this.pgenResource = PgenUtil .findPgenResource(editorChanged); - this.pgenResource.setCatFilter(new CategoryFilter( - "Any")); - this.palette.setCurrentCategory("Any"); + this.pgenResource.setCatFilter(new CategoryFilter()); + this.palette.setCurrentCategory(PgenPaletteWindow.CATEGORY_ANY); PgenUtil.setSelectingMode(); } catch (Exception e) { - e.printStackTrace(); - } + statusHandler.handle(Priority.PROBLEM, + "Cannot open PGEN palette view", e); + } } } @@ -358,6 +380,18 @@ public class PgenSession implements IPartListener2, sideView.unregisterMouseHandler(this.getPgenTool() .getMouseHandler()); } + + // Make sure PGEN resource repaint in the new editor. + if (PgenUtil.getPgenMode() == PgenMode.SINGLE) { + ResourceList rscList = sideView.getActiveDisplayPane().getDescriptor().getResourceList(); + + for (ResourcePair rp : rscList) { + AbstractVizResource rsc = rp.getResource(); + if ( rsc instanceof PgenResource) { + ((PgenResource)rsc).resetAllElements(); + } + } + } } } } @@ -423,4 +457,16 @@ public class PgenSession implements IPartListener2, this.pgenTool = pgenTool; } + public String getPerspectiveId() { + return perspectiveId; + } + + public void setPerspectiveId(String perspectiveId) { + this.perspectiveId = perspectiveId; + } + + public void endSession(){ + instance = null; + } + } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/filter/CategoryFilter.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/filter/CategoryFilter.java index 143ab1e8a0..c2c470fca3 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/filter/CategoryFilter.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/filter/CategoryFilter.java @@ -18,6 +18,7 @@ import gov.noaa.nws.ncep.ui.pgen.elements.Text; import gov.noaa.nws.ncep.ui.pgen.elements.labeledlines.LabeledLine; import gov.noaa.nws.ncep.ui.pgen.elements.tcm.Tcm; import gov.noaa.nws.ncep.ui.pgen.gfa.Gfa; +import gov.noaa.nws.ncep.ui.pgen.palette.PgenPaletteWindow; import gov.noaa.nws.ncep.ui.pgen.tca.TCAElement; /** @@ -36,6 +37,10 @@ public class CategoryFilter implements ElementFilter { public CategoryFilter(String category) { this.category = category; } + + public CategoryFilter(){ + this.category = PgenPaletteWindow.CATEGORY_ANY; + } @Override public boolean accept(AbstractDrawableComponent adc) { @@ -88,14 +93,14 @@ public class CategoryFilter implements ElementFilter { (adc.getParent() instanceof LabeledLine || adc.getParent().getParent() instanceof LabeledLine )) { //cannot select individual from LabeledLine collection - if ( category.equalsIgnoreCase("ANY")){ + if ( category.equalsIgnoreCase(PgenPaletteWindow.CATEGORY_ANY)){ return true; } else { return false; } } - else if ( category.equalsIgnoreCase("any") || + else if ( category.equalsIgnoreCase(PgenPaletteWindow.CATEGORY_ANY) || adc.getPgenCategory().equalsIgnoreCase(category) ) { if ( category.equalsIgnoreCase("Lines") ) { if ( adc.getParent() instanceof Jet || diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteWindow.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteWindow.java index b2427f4ee7..aa871179f4 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteWindow.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteWindow.java @@ -111,6 +111,7 @@ import com.raytheon.viz.ui.tools.AbstractModalTool; * 01/10 ? S. Gilbert Initial Creation. * 08/13 TTR696/774 J. Wu Reset title/Close product manage dialog. * 11/13 #1081 B. Yin Get selected DE to change front/line type. + * 12/14 R5413 B. Yin Removed unused variables, loops. * * * @@ -204,8 +205,8 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, private IContextActivation pgenContextActivation; private AbstractEditor currentIsMultiPane = null; - - private boolean isDetached; + + public static final String CATEGORY_ANY = "Any"; /** * Constructor @@ -393,17 +394,6 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, if (current != null) PgenSession.getInstance().setResource(current); - comp.addControlListener(new ControlAdapter() { - @Override - public void controlResized(ControlEvent e) { - updateDetached(); - } - }); - - } - - private void updateDetached() { - isDetached = mainComp.getShell().getText().length() == 0; } /** @@ -609,6 +599,16 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, IEditorPart editor = VizWorkbenchManager.getInstance() .getActiveEditor(); + + //Set perspective ID in session + if ( PgenSession.getInstance().getPerspectiveId() == null || + PgenSession.getInstance().getPerspectiveId().isEmpty()){ + AbstractVizPerspectiveManager pMngr = VizPerspectiveListener.getCurrentPerspectiveManager(); + if ( pMngr != null ){ + PgenSession.getInstance().setPerspectiveId(pMngr.getPerspectiveId()); + } + } + if (editor instanceof AbstractEditor) {// && ((NCMapEditor) // editor).getApplicationName().equals("NA") // ) { @@ -874,6 +874,13 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, // part).getApplicationName().equals("NA")) { if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor) { + + //Prevent PGEN going to another perspective + AbstractVizPerspectiveManager pMngr = VizPerspectiveListener.getCurrentPerspectiveManager(); + if ( pMngr != null && pMngr.getPerspectiveId() != PgenSession.getInstance().getPerspectiveId() ){ + return; + } + PgenResource rsc = PgenUtil.findPgenResource((AbstractEditor) part); // if ( PgenSession.getInstance().getPgenResource().getDescriptor() @@ -885,7 +892,7 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, if (rsc != null) { rsc.setCatFilter(new CategoryFilter( - (currentCategory == null) ? "Any" : currentCategory)); + (currentCategory == null) ? CATEGORY_ANY : currentCategory)); } PgenSession.getInstance().setResource(rsc); @@ -977,22 +984,12 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, if (VizPerspectiveListener.getCurrentPerspectiveManager() == null) return; // workbench probably closing - AbstractEditor[] editors = UiUtil.getEditors(PlatformUI - .getWorkbench().getActiveWorkbenchWindow(), - VizPerspectiveListener.getCurrentPerspectiveManager() - .getPerspectiveId()); - /* - * UiUtil.getEditors returns active editor first. Run through - * list in reverse so that active editor is processed last. - */ - for (int i = editors.length - 1; i >= 0; i--) { - // unloadPgenResource(editors[i]); - } - for (AbstractEditor editor : PgenSession.getInstance() .getEditors()) { unloadPgenResource(editor); } + + PgenSession.getInstance().endSession(); } // if ( currentIsMultiPane != null ) diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResource.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResource.java index e04297bd30..5ea63ae8a6 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResource.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResource.java @@ -51,7 +51,6 @@ import gov.noaa.nws.ncep.ui.pgen.sigmet.Sigmet; import gov.noaa.nws.ncep.ui.pgen.tca.TCAElement; import gov.noaa.nws.ncep.ui.pgen.tca.TropicalCycloneAdvisory; import gov.noaa.nws.ncep.ui.pgen.tools.AbstractPgenTool; -import gov.noaa.nws.ncep.ui.pgen.tools.InputHandlerDefaultImpl; import gov.noaa.nws.ncep.ui.pgen.tools.PgenSnapJet; import java.awt.Color; @@ -77,10 +76,8 @@ import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.map.MapDescriptor; import com.raytheon.uf.viz.core.rsc.AbstractVizResource; -import com.raytheon.uf.viz.core.rsc.IInputHandler; import com.raytheon.uf.viz.core.rsc.IResourceDataChanged; import com.raytheon.uf.viz.core.rsc.LoadProperties; -import com.raytheon.uf.viz.core.rsc.IInputHandler.InputPriority; import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener; import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability; import com.raytheon.viz.core.gl.IGLTarget; @@ -88,7 +85,6 @@ import com.raytheon.viz.ui.cmenu.IContextMenuProvider; import com.raytheon.viz.ui.editor.AbstractEditor; import com.raytheon.viz.ui.editor.IMultiPaneEditor; import com.raytheon.viz.ui.input.EditableManager; -import com.raytheon.viz.ui.panes.PaneManager; import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager; import com.raytheon.viz.ui.perspectives.VizPerspectiveListener; import com.raytheon.viz.ui.tools.AbstractModalTool; @@ -150,6 +146,7 @@ import com.vividsolutions.jts.geom.Point; * 04/13 #977 S. Gilbert PGEN Database support * 11/13 TTR 752 J. Wu Add methods for CCFP text auto placement. * 11/14 R5413 B. Yin Display PGEN in side view in D2D + * 12/14 R5413 B. Yin Added resetAllElements(), reset ghost, removed "Any". * * * @author B. Yin @@ -217,7 +214,7 @@ public class PgenResource extends selectedSymbol = new HashMap(); displayMap = new ConcurrentHashMap(); filters = new ElementFilterCollection(); - setCatFilter(new CategoryFilter("any")); + setCatFilter(new CategoryFilter()); // Register this new resource with the Session PgenSession.getInstance().setResource(this); @@ -365,9 +362,10 @@ public class PgenResource extends public void paintInternal(IGraphicsTarget target, PaintProperties paintProps) throws VizException { IDisplayPaneContainer editor = getResourceContainer(); - - //Draw in main editor and side view (IMultiPaneEditor) - if (editor instanceof AbstractEditor || editor instanceof IMultiPaneEditor) { + + // Draw in main editor and side view (IMultiPaneEditor) + if (editor instanceof AbstractEditor + || editor instanceof IMultiPaneEditor) { DisplayElementFactory df = new DisplayElementFactory(target, descriptor); @@ -545,6 +543,8 @@ public class PgenResource extends if (this.ghost == null) { this.ghost = new PgenResourceGhost(); + } else { + this.ghost.dispose(); } // this.ghost = ghost; this.ghost.setGhostLine(ghost); @@ -683,7 +683,8 @@ public class PgenResource extends private void drawSelected(IGraphicsTarget target, PaintProperties paintProps) { - if ( !elSelected.isEmpty() && PgenSession.getInstance().getPgenPalette() != null ) { + if (!elSelected.isEmpty() + && PgenSession.getInstance().getPgenPalette() != null) { DisplayElementFactory df = new DisplayElementFactory(target, descriptor); List displayEls = new ArrayList(); @@ -1377,6 +1378,20 @@ public class PgenResource extends } } + + /** + * Releases the resources held by all DEs to refresh all. + * + * @param adc + */ + public void resetAllElements(){ + for ( Product prd : this.resourceData.getProductList() ){ + for ( Layer layer : prd.getLayers()) { + this.resetADC(layer); + } + } + } + /** * Finds the nearest element in the a DECollection to the input point. * @@ -1752,9 +1767,10 @@ public class PgenResource extends * De-activate all PGEN tools for all perspectives */ public void deactivatePgenTools() { - - for (String pid : VizPerspectiveListener.getManagedPerspectives()){ - AbstractVizPerspectiveManager mgr = VizPerspectiveListener.getInstance().getPerspectiveManager(pid); + + for (String pid : VizPerspectiveListener.getManagedPerspectives()) { + AbstractVizPerspectiveManager mgr = VizPerspectiveListener + .getInstance().getPerspectiveManager(pid); if (mgr != null) { Iterator it = mgr.getToolManager() .getSelectedModalTools().iterator(); @@ -1767,8 +1783,7 @@ public class PgenResource extends } } } - - + } /** diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResourceGhost.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResourceGhost.java index 0b35850439..1c84efd4e9 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResourceGhost.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResourceGhost.java @@ -23,7 +23,6 @@ import gov.noaa.nws.ncep.ui.pgen.display.AbstractElementContainer; import gov.noaa.nws.ncep.ui.pgen.display.DefaultElementContainer; import gov.noaa.nws.ncep.ui.pgen.display.DisplayElementFactory; import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent; -import gov.noaa.nws.ncep.ui.pgen.elements.DECollection; import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement; import java.util.HashMap; @@ -38,36 +37,38 @@ import com.raytheon.uf.viz.core.map.IMapDescriptor; * Ghost drawing for the pgen resource. * *
- *
+ * 
  * SOFTWARE HISTORY
- *
+ * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Jun 15, 2012            bgonzale     Initial creation
- *
+ * Dec 10, 2014	R5413		byin		Added dispose method.
+ * 
  * 
- * + * * @author bgonzale - * @version 1.0 + * @version 1.0 */ public class PgenResourceGhost { public AbstractDrawableComponent component; + Map componentMap = new HashMap(); - + /** * Draw the ghost + * * @param target * @param paintProps * @param df * @param descriptor */ - public void draw( IGraphicsTarget target, PaintProperties paintProps, - DisplayElementFactory df, IMapDescriptor descriptor){ - df.setLayerDisplayAttr( false, null, false ); + public void draw(IGraphicsTarget target, PaintProperties paintProps, + DisplayElementFactory df, IMapDescriptor descriptor) { + df.setLayerDisplayAttr(false, null, false); if (component != null) { - Iterator iterator = component - .createDEIterator(); + Iterator iterator = component.createDEIterator(); int count = 0; while (iterator.hasNext()) { DrawableElement element = iterator.next(); @@ -76,21 +77,27 @@ public class PgenResourceGhost { } } } - + /** - * Creates displayables for an element using an ElementContainer and call the - * displayables' draw() method to draw the element. - * @param target Graphic target - * @param paintProps Paint properties - * @param df Display element factory - * @param el Input drawable element + * Creates displayables for an element using an ElementContainer and call + * the displayables' draw() method to draw the element. + * + * @param target + * Graphic target + * @param paintProps + * Paint properties + * @param df + * Display element factory + * @param el + * Input drawable element * @praram descriptor */ - private void drawElement( IGraphicsTarget target, PaintProperties paintProps, - DisplayElementFactory df, DrawableElement el, IMapDescriptor descriptor){ + private void drawElement(IGraphicsTarget target, + PaintProperties paintProps, DisplayElementFactory df, + DrawableElement el, IMapDescriptor descriptor) { Object key = createKey(el); - AbstractElementContainer graphic = componentMap.get(key); - + AbstractElementContainer graphic = componentMap.get(key); + if (graphic == null) { graphic = new DefaultElementContainer(el, descriptor, target); componentMap.put(key, graphic); @@ -99,16 +106,26 @@ public class PgenResourceGhost { } graphic.draw(target, paintProps, null, true); } - + private Object createKey(DrawableElement el) { - return el.getPgenCategory()+ ":"+el.getPgenType(); + return el.getPgenCategory() + ":" + el.getPgenType(); } /** * Sets the ghost line for the PGEN drawing layer. - * @param ghost + * + * @param ghost */ public void setGhostLine(AbstractDrawableComponent ghost) { - this.component = ghost; + this.component = ghost; + } + + /* + * Release resources held by the ghost elements. + */ + public void dispose() { + for (AbstractElementContainer aec : componentMap.values()) { + aec.dispose(); + } } } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenAddLabelHandler.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenAddLabelHandler.java index de5b32d653..dd014aa9f3 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenAddLabelHandler.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenAddLabelHandler.java @@ -172,38 +172,6 @@ public class PgenAddLabelHandler extends InputHandlerDefaultImpl { } else if ( button == 3 ) { - if ( ghostLabel != null ){ - - if(prevTool.getLabeledLine().getName().contains("CCFP_SIGMET")){ - addCcfpLabel(loc, prevTool.getLabeledLine()); - cleanUp(); - return true; - } - else{ - - if ( !pts.isEmpty()){ - // addLabel( pts.get(pts.size()-1), prevTool.getLabeledLine() ); - addLabel( pts.get(pts.size()-1), (LabeledLine)lineSelected.getParent() ); - - } - else { - lineSelected = null; - ghostLabel = null; - drawingLayer.removeGhostLine(); - mapEditor.refresh(); - } - } - pts.clear(); - } - else { - //clean up and exit - lineSelected = null; - drawingLayer.removeGhostLine(); - mapEditor.refresh(); - - prevTool.resetMouseHandler(); - dlg.resetLabeledLineBtns(); - } return true; @@ -296,8 +264,65 @@ public class PgenAddLabelHandler extends InputHandlerDefaultImpl { @Override public boolean handleMouseDownMove(int x, int y, int mouseButton) { if ( !drawingLayer.isEditable()|| shiftDown ) return false; - else return true; } + else return true; + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, int) + */ + @Override + public boolean handleMouseUp(int x, int y, int mouseButton) { + if ( !drawingLayer.isEditable() || shiftDown ) return false; + + // Check if mouse is in geographic extent + Coordinate loc = mapEditor.translateClick(x, y); + if ( loc == null ) { + return true; + } + + if ( mouseButton == 3 ){ + if ( ghostLabel != null ){ + + if(prevTool.getLabeledLine().getName().contains("CCFP_SIGMET")){ + addCcfpLabel(loc, prevTool.getLabeledLine()); + cleanUp(); + return true; + } + else{ + + if ( !pts.isEmpty()){ + // addLabel( pts.get(pts.size()-1), prevTool.getLabeledLine() ); + addLabel( pts.get(pts.size()-1), (LabeledLine)lineSelected.getParent() ); + + } + else { + lineSelected = null; + ghostLabel = null; + drawingLayer.removeGhostLine(); + mapEditor.refresh(); + } + } + pts.clear(); + } + else { + //clean up and exit + lineSelected = null; + drawingLayer.removeGhostLine(); + mapEditor.refresh(); + + prevTool.resetMouseHandler(); + dlg.resetLabeledLineBtns(); + } + return true; + } + else { + return false; + } + } + /** * Create label for line ln at location loc. * @param loc diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenAddPointAltHandler.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenAddPointAltHandler.java index 11cf86abb6..488e712cc6 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenAddPointAltHandler.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenAddPointAltHandler.java @@ -151,6 +151,9 @@ public class PgenAddPointAltHandler extends InputHandlerDefaultImpl { return preempt; } + else if ( button == 3 ){ + return true; + } else{ diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenAddPointHandler.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenAddPointHandler.java index 6bf431bb49..6a8d47b8e4 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenAddPointHandler.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenAddPointHandler.java @@ -154,6 +154,9 @@ public class PgenAddPointHandler extends InputHandlerDefaultImpl { return preempt; } + else if ( button == 3 ){ + return true; + } else{ return false; diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenAvnTextDrawingTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenAvnTextDrawingTool.java index e2da038fa9..df12c605ce 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenAvnTextDrawingTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenAvnTextDrawingTool.java @@ -115,12 +115,7 @@ public class PgenAvnTextDrawingTool extends AbstractPgenDrawingTool { } else if ( button == 3 ) { - // The following methods are called when the tool is deactivated - // and are not needed here - //drawingLayer.removeGhostLine(); - //mapEditor.refresh(); - //attrDlg.close(); - PgenUtil.setSelectingMode(); + return true; @@ -168,6 +163,26 @@ public class PgenAvnTextDrawingTool extends AbstractPgenDrawingTool { if ( shiftDown || !isResourceEditable()) return false; else return true; } + + /* + * (non-Javadoc) + * + * @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, int) + */ + @Override + public boolean handleMouseUp(int x, int y, int mouseButton) { + if ( !isResourceEditable()|| shiftDown ) return false; + + // prevent the click going through to other handlers + // in case adding labels to symbols or fronts. + if ( mouseButton == 3 ) { + PgenUtil.setSelectingMode(); + return true; + } + else { + return false; + } + } } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenConnectTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenConnectTool.java index 6ad2ffa5f1..d897fa9175 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenConnectTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenConnectTool.java @@ -306,32 +306,7 @@ public class PgenConnectTool extends AbstractPgenDrawingTool { } else if (button == 3) { - if (secondEl != null) { - // reselect the second element - ghostEl = createGhostElement(firstEl, nearPt, loc); - drawingLayer.setGhostLine(ghostEl); - - secondEl = null; - secondJet = null; - } else { - - if (firstEl != null) { - // unselect the first element but stay in "Connect" mode - drawingLayer.removeGhostLine(); - drawingLayer.removeSelected(); - nearPt = 0; - firstEl = null; - firstJet = null; - } else { - // Exit "Connect" mode & set selecting mode - PgenUtil.setSelectingMode(); - } - - } - - mapEditor.refresh(); - - return false; + return true; } else { // Button 2 - ignore @@ -383,6 +358,40 @@ public class PgenConnectTool extends AbstractPgenDrawingTool { if (!isResourceEditable()) { return false; } + + Coordinate loc = mapEditor.translateClick(x, y); + if (loc == null) { + return true; + } + + if (button == 3) { + + if (secondEl != null) { + // reselect the second element + ghostEl = createGhostElement(firstEl, nearPt, loc); + drawingLayer.setGhostLine(ghostEl); + + secondEl = null; + secondJet = null; + } else { + + if (firstEl != null) { + // unselect the first element but stay in "Connect" mode + drawingLayer.removeGhostLine(); + drawingLayer.removeSelected(); + nearPt = 0; + firstEl = null; + firstJet = null; + } else { + // Exit "Connect" mode & set selecting mode + PgenUtil.setSelectingMode(); + } + + } + + mapEditor.refresh(); + } + return true; } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenCopyElement.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenCopyElement.java index ede2463e0a..d74c4bc325 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenCopyElement.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenCopyElement.java @@ -148,18 +148,6 @@ public class PgenCopyElement extends AbstractPgenTool { } else if ( button == 3 ) { - if ( drawingLayer.getSelectedComp() != null ){ - // de-select element - drawingLayer.removeSelected(); - drawingLayer.removeGhostLine(); - ghostEl = null; - mapEditor.refresh(); - } - else { - // set selecting mode - PgenUtil.setSelectingMode(); - } - return true; } @@ -344,6 +332,24 @@ public class PgenCopyElement extends AbstractPgenTool { if ( !isResourceEditable()|| shiftDown || simulate ) return false; + if ( button == 3 ) { + + if ( drawingLayer.getSelectedComp() != null ){ + // de-select element + drawingLayer.removeSelected(); + drawingLayer.removeGhostLine(); + ghostEl = null; + mapEditor.refresh(); + } + else { + // set selecting mode + PgenUtil.setSelectingMode(); + } + + return true; + + } + if ( ghostEl != null ) { // reset color for the el and add it to PGEN resource diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenDeleteObj.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenDeleteObj.java index 386dcdd698..95826531fd 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenDeleteObj.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenDeleteObj.java @@ -60,6 +60,24 @@ public class PgenDeleteObj extends AbstractPgenTool { if (!isResourceEditable()) return false; + if (button == 3) { + return true; + } + + return false; + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.viz.ui.input.IInputHandler#handleMouseDown(int, + * int, int) + */ + @Override + public boolean handleMouseUp(int x, int y, int button) { + if (!isResourceEditable()) + return false; + if (button == 3) { // set selecting mode PgenUtil.setSelectingMode(); diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenDeletePart.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenDeletePart.java index 9176097de9..80af800225 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenDeletePart.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenDeletePart.java @@ -242,15 +242,7 @@ public class PgenDeletePart extends PgenSelectingTool { } else if ( button == 3 ) { - - // reset - ptSelected = false; - drawingLayer.removeGhostLine(); - drawingLayer.removeSelected(); - lil = null; - mapEditor.refresh(); - PgenUtil.setSelectingMode(); - + return true; } @@ -281,7 +273,23 @@ public class PgenDeletePart extends PgenSelectingTool { */ @Override public boolean handleMouseUp(int x, int y, int button){ - return false; + if (!isResourceEditable()) + return false; + + if (button == 3) { + // reset + ptSelected = false; + drawingLayer.removeGhostLine(); + drawingLayer.removeSelected(); + lil = null; + mapEditor.refresh(); + PgenUtil.setSelectingMode(); + + return true; + } + else { + return false; + } } /** diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenDeletePointHandler.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenDeletePointHandler.java index be9afe72ca..1277dcb187 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenDeletePointHandler.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenDeletePointHandler.java @@ -126,7 +126,9 @@ public class PgenDeletePointHandler extends PgenSelectHandler{ return true; } - + else if ( button == 3 ){ + return true; + } else{ return false; diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenDualPointDrawingTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenDualPointDrawingTool.java index 1be38b59e3..b2f3bbd2af 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenDualPointDrawingTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenDualPointDrawingTool.java @@ -135,21 +135,6 @@ public class PgenDualPointDrawingTool extends AbstractPgenDrawingTool { } else if ( button == 3 ) { - drawingLayer.removeGhostLine(); - mapEditor.refresh(); - - if ( points.size() == 0 ) { - -// NmapUiUtils.setPanningMode(); - PgenUtil.setSelectingMode(); - - } - else { - - points.clear(); - - } - return true; } @@ -205,7 +190,6 @@ public class PgenDualPointDrawingTool extends AbstractPgenDrawingTool { } - return false; } @@ -216,7 +200,36 @@ public class PgenDualPointDrawingTool extends AbstractPgenDrawingTool { else return true; } - + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if (!isResourceEditable()) + return false; + + if (button == 3) { + drawingLayer.removeGhostLine(); + mapEditor.refresh(); + + if ( points.size() == 0 ) { + + PgenUtil.setSelectingMode(); + + } + else { + + points.clear(); + + } + + return true; + } + else { + return false; + } + } + /* * Check if the given starting angle is less than the ending angle */ diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenExtrapTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenExtrapTool.java index cf61efe16d..79c5345f4e 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenExtrapTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenExtrapTool.java @@ -36,49 +36,49 @@ import gov.noaa.nws.ncep.ui.pgen.filter.OperationFilter; * @author J. Wu */ public class PgenExtrapTool extends AbstractPgenDrawingTool { - + /** * Input handler for mouse events. */ public PgenExtrapTool(){ - - super(); - + + super(); + } - + /** * Returns the current mouse handler. * @return */ public IInputHandler getMouseHandler() { - - if ( this.mouseHandler == null ) { - - this.mouseHandler = new PgenExtrapHandler(); - + + if ( this.mouseHandler == null ) { + + this.mouseHandler = new PgenExtrapHandler(); + } return this.mouseHandler; - - } - - + + } + + /** * Implements input handler for mouse events. * @author jwu * */ public class PgenExtrapHandler extends InputHandlerDefaultImpl { - - private boolean preempt; - - /** - * Current extrapolation dialog. - */ - private PgenExtrapDlg extrapDlg = null; - - private OperationFilter extrapFilter = new OperationFilter( Operation.EXTRAPOLATE ); - + + private boolean preempt; + + /** + * Current extrapolation dialog. + */ + private PgenExtrapDlg extrapDlg = null; + + private OperationFilter extrapFilter = new OperationFilter( Operation.EXTRAPOLATE ); + /* * (non-Javadoc) * @@ -87,86 +87,102 @@ public class PgenExtrapTool extends AbstractPgenDrawingTool { */ @Override public boolean handleMouseDown( int anX, int aY, int button ) { - if ( !isResourceEditable() ) return false; + if ( !isResourceEditable() ) return false; - preempt = false; - - // Check if mouse is in geographic extent - Coordinate loc = mapEditor.translateClick(anX, aY); - if ( loc == null || shiftDown ) return false; - - if ( button == 1 ) { + preempt = false; + + // Check if mouse is in geographic extent + Coordinate loc = mapEditor.translateClick(anX, aY); + if ( loc == null || shiftDown ) return false; + + if ( button == 1 ) { if ( drawingLayer.getSelectedComp() == null ) { - - // Get the nearest element and set it as the selected element. - AbstractDrawableComponent elSelected = drawingLayer.getNearestComponent( loc, extrapFilter, true ); - drawingLayer.setSelected( elSelected ); - if ( elSelected != null ) preempt = true; - - } - else { - - extrapDlg = (PgenExtrapDlg)attrDlg; - - AbstractDrawableComponent elem = drawingLayer.getSelectedComp(); - - AbstractDrawableComponent newDE = PgenToolUtils.extrapElement( elem, - extrapDlg.getDirection(), extrapDlg.getDistance() ); - boolean getNewDE = true; - if ( newDE instanceof WatchBox ){ - getNewDE = PgenWatchBoxModifyTool.resnapWatchBox(mapEditor, (WatchBox)newDE, (WatchBox)newDE); - } - - if ( getNewDE ){ - if ( extrapDlg.isCopy() ) { - drawingLayer.addElement( newDE ); - } - else { - drawingLayer.replaceElement( drawingLayer.getSelectedComp(), newDE ); - } - } - - drawingLayer.removeSelected(); - - } - - mapEditor.refresh(); - - return preempt; - - } - else if ( button == 3 ) { - - if ( drawingLayer.getSelectedComp() != null ) { - - drawingLayer.removeSelected(); - mapEditor.refresh(); - + // Get the nearest element and set it as the selected element. + AbstractDrawableComponent elSelected = drawingLayer.getNearestComponent( loc, extrapFilter, true ); + drawingLayer.setSelected( elSelected ); + if ( elSelected != null ) preempt = true; + } else { - - // set selecting mode - PgenUtil.setSelectingMode(); - + + extrapDlg = (PgenExtrapDlg)attrDlg; + + AbstractDrawableComponent elem = drawingLayer.getSelectedComp(); + + AbstractDrawableComponent newDE = PgenToolUtils.extrapElement( elem, + extrapDlg.getDirection(), extrapDlg.getDistance() ); + + boolean getNewDE = true; + if ( newDE instanceof WatchBox ){ + getNewDE = PgenWatchBoxModifyTool.resnapWatchBox(mapEditor, (WatchBox)newDE, (WatchBox)newDE); + } + + if ( getNewDE ){ + if ( extrapDlg.isCopy() ) { + drawingLayer.addElement( newDE ); + } + else { + drawingLayer.replaceElement( drawingLayer.getSelectedComp(), newDE ); + } + } + + drawingLayer.removeSelected(); + } - - return true; - + + mapEditor.refresh(); + + return preempt; + + } + else if ( button == 3 ) { + + return true; + } else { - return false; + return false; } - + } - @Override - public boolean handleMouseDownMove(int x, int y, int mouseButton) { - if ( !isResourceEditable() || shiftDown ) return false; - else return preempt; - } + @Override + public boolean handleMouseDownMove(int x, int y, int mouseButton) { + if ( !isResourceEditable() || shiftDown ) return false; + else return preempt; + } + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if (!isResourceEditable()) + return false; + + if (button == 3) { + + if ( drawingLayer.getSelectedComp() != null ) { + + drawingLayer.removeSelected(); + mapEditor.refresh(); + + } + else { + + // set selecting mode + PgenUtil.setSelectingMode(); + + } + + return true; + } + else { + return false; + } + } } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenFlipDrawingElement.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenFlipDrawingElement.java index 8bfdedd8d4..38f8ecaf69 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenFlipDrawingElement.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenFlipDrawingElement.java @@ -40,52 +40,52 @@ import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResource; */ public class PgenFlipDrawingElement extends AbstractPgenTool { - - //private Log log = LogFactory.getLog(getClass()); - + + //private Log log = LogFactory.getLog(getClass()); + /** * Input handler for mouse events. */ protected IInputHandler flipHandler; - + public PgenFlipDrawingElement(){ - - super(); - + + super(); + } - + /** * Returns the current mouse handler. * @return */ public IInputHandler getMouseHandler() { if ( this.flipHandler == null ) { - this.flipHandler = new PgenFlipHandler(drawingLayer, mapEditor); + this.flipHandler = new PgenFlipHandler(drawingLayer, mapEditor); } return this.flipHandler; } - + /** * Implements input handler for mouse events. * @author Michael Gao * */ public class PgenFlipHandler extends InputHandlerDefaultImpl { - - private PgenResource flipPgenSource; -// private NCMapEditor flipNCMapEditor; - private AbstractEditor flipNCMapEditor; - private boolean preempt; - private OperationFilter flipFilter; - -// public PgenFlipHandler(PgenResource _flipPgenSource, NCMapEditor _flipNCMapEditor) { + + private PgenResource flipPgenSource; + // private NCMapEditor flipNCMapEditor; + private AbstractEditor flipNCMapEditor; + private boolean preempt; + private OperationFilter flipFilter; + + // public PgenFlipHandler(PgenResource _flipPgenSource, NCMapEditor _flipNCMapEditor) { public PgenFlipHandler(PgenResource _flipPgenSource, AbstractEditor _flipNCMapEditor) { - flipPgenSource = _flipPgenSource; - flipNCMapEditor = _flipNCMapEditor; - flipFilter = new OperationFilter( Operation.FLIP ); - } - + flipPgenSource = _flipPgenSource; + flipNCMapEditor = _flipNCMapEditor; + flipFilter = new OperationFilter( Operation.FLIP ); + } + /* * (non-Javadoc) * @@ -94,54 +94,73 @@ public class PgenFlipDrawingElement extends AbstractPgenTool { */ @Override public boolean handleMouseDown(int anX, int aY, int button) { - if ( !isResourceEditable() ) return false; + if ( !isResourceEditable() ) return false; - preempt = false; - // Check if mouse is in geographic extent - Coordinate loc = flipNCMapEditor.translateClick(anX, aY); - if ( loc == null || shiftDown ) return false; - - //DrawableElement selectedDrawableElement = flipPgenSource.getSelectedDE(); - AbstractDrawableComponent selectedDrawableElement = flipPgenSource.getSelectedComp(); + preempt = false; + // Check if mouse is in geographic extent + Coordinate loc = flipNCMapEditor.translateClick(anX, aY); + if ( loc == null || shiftDown ) return false; - if ( button == 1 ) { - /* - * create a new DrawableElement with reversed points based on the selectedDrawableElement - */ - AbstractDrawableComponent reversedDrawableElement = null; - if ( selectedDrawableElement instanceof Cloud ){ - reversedDrawableElement = selectedDrawableElement.copy(); - DrawableElement de = flipPgenSource.getNearestElement( loc, (Cloud)reversedDrawableElement ); - if ( de != null && de instanceof Line ){ - ((Cloud)reversedDrawableElement).add(PgenToolUtils.createReversedDrawableElement(de)); - ((Cloud)reversedDrawableElement).remove(de); - } - else { - return false; - } - } - else { - reversedDrawableElement = PgenToolUtils.createReversedDrawableElement(selectedDrawableElement); - } - - leftMouseButtonDownHandler(flipPgenSource, selectedDrawableElement, reversedDrawableElement, loc); - flipNCMapEditor.refresh(); - if ( selectedDrawableElement != null ) preempt = true; + //DrawableElement selectedDrawableElement = flipPgenSource.getSelectedDE(); + AbstractDrawableComponent selectedDrawableElement = flipPgenSource.getSelectedComp(); + + if ( button == 1 ) { + /* + * create a new DrawableElement with reversed points based on the selectedDrawableElement + */ + AbstractDrawableComponent reversedDrawableElement = null; + if ( selectedDrawableElement instanceof Cloud ){ + reversedDrawableElement = selectedDrawableElement.copy(); + DrawableElement de = flipPgenSource.getNearestElement( loc, (Cloud)reversedDrawableElement ); + if ( de != null && de instanceof Line ){ + ((Cloud)reversedDrawableElement).add(PgenToolUtils.createReversedDrawableElement(de)); + ((Cloud)reversedDrawableElement).remove(de); + } + else { + return false; + } + } + else { + reversedDrawableElement = PgenToolUtils.createReversedDrawableElement(selectedDrawableElement); + } + + leftMouseButtonDownHandler(flipPgenSource, selectedDrawableElement, reversedDrawableElement, loc); + flipNCMapEditor.refresh(); + if ( selectedDrawableElement != null ) preempt = true; } else if ( button == 3 ) { - rightMouseButtonDownHandler(flipPgenSource, selectedDrawableElement, flipNCMapEditor); + return true; } - return preempt; + return preempt; } - - @Override - public boolean handleMouseDownMove(int x, int y, int mouseButton) { - if ( !isResourceEditable() || shiftDown ) return false; - return preempt; - } - /* + @Override + public boolean handleMouseDownMove(int x, int y, int mouseButton) { + if ( !isResourceEditable() || shiftDown ) return false; + return preempt; + } + + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if (!isResourceEditable()) + return false; + + if (button == 3) { + AbstractDrawableComponent selectedDrawableElement = flipPgenSource.getSelectedComp(); + rightMouseButtonDownHandler(flipPgenSource, selectedDrawableElement, flipNCMapEditor); + + return true; + } + else { + return false; + } + } + + /* * If the selectedDrawableElement is valid, reverse the Coordinate points of the * DrawableElement and then set the reversed points back to the DrawableElement. Otherwise, * retrieve the nearest DrawableElement object using the current mouse location @@ -151,21 +170,21 @@ public class PgenFlipDrawingElement extends AbstractPgenTool { * @return */ private void leftMouseButtonDownHandler(PgenResource thePgenSource, - AbstractDrawableComponent selectedDrawableElement, - AbstractDrawableComponent reversedDrawableElement, - Coordinate currentMouselocation) { - if ( selectedDrawableElement == null ) { - // Get the nearest element and set it as the selected element. - selectedDrawableElement = thePgenSource.getNearestComponent( currentMouselocation, flipFilter, true ); - if(selectedDrawableElement == null) - return; - thePgenSource.setSelected( selectedDrawableElement ); - } else { - thePgenSource.replaceElement(selectedDrawableElement, reversedDrawableElement); - thePgenSource.setSelected( reversedDrawableElement ); - } + AbstractDrawableComponent selectedDrawableElement, + AbstractDrawableComponent reversedDrawableElement, + Coordinate currentMouselocation) { + if ( selectedDrawableElement == null ) { + // Get the nearest element and set it as the selected element. + selectedDrawableElement = thePgenSource.getNearestComponent( currentMouselocation, flipFilter, true ); + if(selectedDrawableElement == null) + return; + thePgenSource.setSelected( selectedDrawableElement ); + } else { + thePgenSource.replaceElement(selectedDrawableElement, reversedDrawableElement); + thePgenSource.setSelected( reversedDrawableElement ); + } } - + /* * If a valid selectedDrawableElement still exists, de-select the element, * Otherwise, change the action mode to Selecting Mode from the Flip Mode @@ -175,20 +194,20 @@ public class PgenFlipDrawingElement extends AbstractPgenTool { * @return */ private void rightMouseButtonDownHandler(PgenResource thePpgenSource, -// AbstractDrawableComponent selectedDrawableElement, NCMapEditor theNCMapEditor) { - AbstractDrawableComponent selectedDrawableElement, AbstractEditor theNCMapEditor) { - if ( selectedDrawableElement != null ){ - // de-select element - thePpgenSource.removeSelected(); - selectedDrawableElement = null; - theNCMapEditor.refresh(); - } - else { - // set selecting mode - PgenUtil.setSelectingMode(); - } + // AbstractDrawableComponent selectedDrawableElement, NCMapEditor theNCMapEditor) { + AbstractDrawableComponent selectedDrawableElement, AbstractEditor theNCMapEditor) { + if ( selectedDrawableElement != null ){ + // de-select element + thePpgenSource.removeSelected(); + selectedDrawableElement = null; + theNCMapEditor.refresh(); + } + else { + // set selecting mode + PgenUtil.setSelectingMode(); + } } - + } } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenFromTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenFromTool.java index 240e59b5a7..7ade5cb3e7 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenFromTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenFromTool.java @@ -110,13 +110,6 @@ public class PgenFromTool extends AbstractPgenDrawingTool { */ else if ( button == 3 ) { - /* - * return to Pgen Select mode - */ - drawingLayer.removeSelected(); - PgenUtil.setSelectingMode(); - - mapEditor.refresh(); return true; } @@ -131,6 +124,29 @@ public class PgenFromTool extends AbstractPgenDrawingTool { if ( !isResourceEditable() ) return false; return preempt; } + + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if (!isResourceEditable()) + return false; + + if (button == 3) { + /* + * return to Pgen Select mode + */ + drawingLayer.removeSelected(); + PgenUtil.setSelectingMode(); + + mapEditor.refresh(); + return true; + } + else { + return false; + } + } } } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenGfaDrawingTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenGfaDrawingTool.java index 64d852cf58..cd5c53b488 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenGfaDrawingTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenGfaDrawingTool.java @@ -212,73 +212,7 @@ public class PgenGfaDrawingTool extends AbstractPgenDrawingTool { } else if ( button == 3 ) { - //exit drawing text mode - if ( startGfaText ) { - startGfaText = false; - - if ( ((Gfa)elem).getGfaTextCoordinate() == null ){ - //if right click before adding the text - ((Gfa)elem).setGfaTextCoordinate(loc); - drawingLayer.addElement(elem); - validateGfa( (Gfa)elem) ; - mapEditor.refresh(); - points.clear(); - } - else { - //change to selecting mode to move points - PgenUtil.setSelectingMode(elem); - elem = null; - return true; - } - } - - if ( points.size() == 0 ) { - - closeAttrDlg(attrDlg); - attrDlg = null; - drawingLayer.removeSelected((Gfa)elem); - elem = null; - PgenUtil.setSelectingMode(); - - - } - else if ( points.size() < 2 ){ - removeClearRefresh(); - } - else { - //Use pgenType value to decide if the DrawableType should be TRACK or LINE - - if (drawableType == DrawableType.GFA && points.size() == 2 ) { - removeClearRefresh(); - return true; - } - if(!((GfaAttrDlg)attrDlg).validateRequiredFields()) return false; - - if(((IGfa)attrDlg).getGfaFcstHr().indexOf("-") > -1) { - // snap - points = SnapUtil.getSnapWithStation(points,SnapUtil.VOR_STATION_LIST,10,16); - } - - // create a new DrawableElement. - elem = def.create( drawableType, (IAttribute)attrDlg, - pgenCategory, pgenType, points, drawingLayer.getActiveLayer()); - - //set the hour filter - if ( PgenFilterDlg.isFilterDlgOpen()){ - PgenFilterDlg.getInstance(null).setHourChkBox(((Gfa)elem).getForecastHours(), true); - } - - //set from line - String vorText = Gfa.buildVorText( (Gfa)elem ); - ((Gfa)elem).setGfaVorText( vorText ); - ((GfaAttrDlg)attrDlg).setVorText( vorText ); - - startGfaText = true; - attrDlg.setAttrForDlg(attrDlg); // update the parameters in GfaAttrDlg - - return true; - } - + return true; } else if ( button == 2 ){ @@ -404,6 +338,94 @@ public class PgenGfaDrawingTool extends AbstractPgenDrawingTool { return false; } + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if (!isResourceEditable() || shiftDown ) + return false; + + Coordinate loc = mapEditor.translateClick(x, y); + if ( loc == null ) return true; + + if (button == 3) { + //exit drawing text mode + if ( startGfaText ) { + startGfaText = false; + + if ( ((Gfa)elem).getGfaTextCoordinate() == null ){ + //if right click before adding the text + ((Gfa)elem).setGfaTextCoordinate(loc); + drawingLayer.addElement(elem); + validateGfa( (Gfa)elem) ; + mapEditor.refresh(); + points.clear(); + } + else { + //change to selecting mode to move points + PgenUtil.setSelectingMode(elem); + elem = null; + return true; + } + } + + if ( points.size() == 0 ) { + + closeAttrDlg(attrDlg); + attrDlg = null; + drawingLayer.removeSelected((Gfa)elem); + elem = null; + PgenUtil.setSelectingMode(); + + + } + else if ( points.size() < 2 ){ + removeClearRefresh(); + } + else { + //Use pgenType value to decide if the DrawableType should be TRACK or LINE + DrawableType drawableType = getDrawableType(pgenType); + + if (drawableType == DrawableType.GFA && points.size() == 2 ) { + removeClearRefresh(); + return true; + } + if(!((GfaAttrDlg)attrDlg).validateRequiredFields()) return false; + + if(((IGfa)attrDlg).getGfaFcstHr().indexOf("-") > -1) { + // snap + points = SnapUtil.getSnapWithStation(points,SnapUtil.VOR_STATION_LIST,10,16); + } + + // create a new DrawableElement. + elem = def.create( drawableType, (IAttribute)attrDlg, + pgenCategory, pgenType, points, drawingLayer.getActiveLayer()); + + //set the hour filter + if ( PgenFilterDlg.isFilterDlgOpen()){ + PgenFilterDlg.getInstance(null).setHourChkBox(((Gfa)elem).getForecastHours(), true); + } + + //set from line + String vorText = Gfa.buildVorText( (Gfa)elem ); + ((Gfa)elem).setGfaVorText( vorText ); + ((GfaAttrDlg)attrDlg).setVorText( vorText ); + + startGfaText = true; + attrDlg.setAttrForDlg(attrDlg); // update the parameters in GfaAttrDlg + + return true; + } + + return true; + } + else { + return false; + } + } + + public void clearPoints(){ points.clear(); } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenGfaFormatTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenGfaFormatTool.java index 4e3fa2e2aa..09bc4f6795 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenGfaFormatTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenGfaFormatTool.java @@ -108,7 +108,6 @@ public class PgenGfaFormatTool extends AbstractPgenDrawingTool { } else if (button == 3) { - PgenUtil.setSelectingMode(); return true; } else { @@ -120,6 +119,24 @@ public class PgenGfaFormatTool extends AbstractPgenDrawingTool { public boolean handleMouseDownMove(int x, int y, int mouseButton) { return false; } + + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if (!isResourceEditable()) + return false; + + if (button == 3) { + + PgenUtil.setSelectingMode(); + return true; + } + else { + return false; + } + } } public StringBuilder generate(PgenResource drawingLayer, diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenInterpolationTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenInterpolationTool.java index 27242d150e..564b951042 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenInterpolationTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenInterpolationTool.java @@ -190,53 +190,7 @@ public class PgenInterpolationTool extends AbstractPgenDrawingTool { * Right mouse button pressed */ else if ( button == 3 ) { - - switch (status) { - case START: - /* - * return to Pgen Select mode - */ - PgenUtil.setSelectingMode(); - break; - case SELECTED_1: - /* - * Remove currently selected element from selected list - */ - drawingLayer.removeSelected(); - status = SELECT_STATUS.START; - break; - case VERIFIED_1: - /* - * Remove currently verified element from selected list - */ - interpDlg.enableStartTime(); - interpDlg.enableEndTime(); - drawingLayer.removeSelected(); - status = SELECT_STATUS.START; - break; - case SELECTED_2: - /* - * Remove second selected element from selected list - */ - drawingLayer.removeSelected( selectedEls.get(1) ); - status = SELECT_STATUS.VERIFIED_1; - break; - case VERIFIED_2: - /* - * remove all elements from the selected list - */ - drawingLayer.removeSelected(); - interpDlg.enableStartTime(); - interpDlg.enableEndTime(); - interpDlg.disarm(); // Disable Interpolation button - status = SELECT_STATUS.START; - break; - } - - mapEditor.refresh(); - //System.out.println("Button 3333333 status = "+status); return true; - } else { @@ -244,6 +198,66 @@ public class PgenInterpolationTool extends AbstractPgenDrawingTool { } } + + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if (!isResourceEditable()) + return false; + + if (button == 3) { + switch (status) { + case START: + /* + * return to Pgen Select mode + */ + PgenUtil.setSelectingMode(); + break; + case SELECTED_1: + /* + * Remove currently selected element from selected list + */ + drawingLayer.removeSelected(); + status = SELECT_STATUS.START; + break; + case VERIFIED_1: + /* + * Remove currently verified element from selected list + */ + interpDlg.enableStartTime(); + interpDlg.enableEndTime(); + drawingLayer.removeSelected(); + status = SELECT_STATUS.START; + break; + case SELECTED_2: + /* + * Remove second selected element from selected list + */ + drawingLayer.removeSelected( selectedEls.get(1) ); + status = SELECT_STATUS.VERIFIED_1; + break; + case VERIFIED_2: + /* + * remove all elements from the selected list + */ + drawingLayer.removeSelected(); + interpDlg.enableStartTime(); + interpDlg.enableEndTime(); + interpDlg.disarm(); // Disable Interpolation button + status = SELECT_STATUS.START; + break; + } + + mapEditor.refresh(); + //System.out.println("Button 3333333 status = "+status); + return true; + } + else { + return false; + } + } } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetBarbAddingHandler.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetBarbAddingHandler.java index 0a2e6a92c7..2b4305ab79 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetBarbAddingHandler.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetBarbAddingHandler.java @@ -14,6 +14,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor; import com.vividsolutions.jts.geom.Coordinate; +import gov.noaa.nws.ncep.ui.pgen.PgenUtil; //import gov.noaa.nws.ncep.ui.display.InputHandlerDefaultImpl; import gov.noaa.nws.ncep.ui.pgen.attrdialog.JetAttrDlg; import gov.noaa.nws.ncep.ui.pgen.display.IText.DisplayType; @@ -110,12 +111,7 @@ public class PgenJetBarbAddingHandler extends InputHandlerDefaultImpl { } else if ( button == 3 ) { - drawingLayer.removeGhostLine(); - mapEditor.refresh(); - - if ( jetDlg != null )((JetAttrDlg)jetDlg).closeBarbDlg(); - - prevTool.resetMouseHandler(); + return true; } @@ -157,6 +153,27 @@ public class PgenJetBarbAddingHandler extends InputHandlerDefaultImpl { else return true; } + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if ( !drawingLayer.isEditable() || shiftDown ) return false; + + if (button == 3) { + drawingLayer.removeGhostLine(); + mapEditor.refresh(); + + if ( jetDlg != null )((JetAttrDlg)jetDlg).closeBarbDlg(); + + prevTool.resetMouseHandler(); + return true; + } + else { + return false; + } + } + /** * Create the wind info(barb and FL text) at location loc. * @param loc diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetBarbDeletingHandler.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetBarbDeletingHandler.java index ae28eb9cd2..5c97bb1239 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetBarbDeletingHandler.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetBarbDeletingHandler.java @@ -136,10 +136,6 @@ public class PgenJetBarbDeletingHandler extends InputHandlerDefaultImpl { } else if ( button == 3 ) { - drawingLayer.removeGhostLine(); - mapEditor.refresh(); - - prevTool.resetMouseHandler(); return true; } @@ -151,6 +147,25 @@ public class PgenJetBarbDeletingHandler extends InputHandlerDefaultImpl { } + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if ( !drawingLayer.isEditable() || shiftDown ) return false; + + if (button == 3) { + drawingLayer.removeGhostLine(); + mapEditor.refresh(); + + prevTool.resetMouseHandler(); + return true; + } + else { + return false; + } + } + @Override public boolean handleMouseDownMove(int x, int y, int mouseButton) { if ( !drawingLayer.isEditable() || shiftDown ) return false; diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetDrawingTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetDrawingTool.java index ed611cf8b1..840a91e09b 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetDrawingTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetDrawingTool.java @@ -184,54 +184,7 @@ public class PgenJetDrawingTool extends PgenMultiPointDrawingTool } else if ( button == 3 ) { - - if ( points.size() == 0 ) { - - drawingLayer.removeGhostLine(); - mapEditor.refresh(); - attrDlg.close(); - attrDlg = null; - PgenUtil.setSelectingMode(); - - } - else if ( points.size() < 2 ){ - - drawingLayer.removeGhostLine(); - points.clear(); - - mapEditor.refresh(); - - } - else { - - // create a new Jet. - elem = def.create( DrawableType.JET, (IAttribute)attrDlg, - pgenCategory, pgenType, points, drawingLayer.getActiveLayer()); - - jet = (Jet)elem; - - jet.setSnapTool(new PgenSnapJet(drawingLayer.getDescriptor(), mapEditor, (JetAttrDlg)attrDlg)); - - // add the jet to PGEN resource - drawingLayer.addElement( jet ); - - //reset the jet line attributes - AbstractDrawableComponent adc = AttrSettings.getInstance().getSettings().get( pgenType ); - if ( adc != null && adc instanceof Jet ){ - ((Jet)adc).getJetLine().update(attrDlg); - } - - drawingLayer.removeGhostLine(); - points.clear(); - - mapEditor.refresh(); - - ((JetAttrDlg)attrDlg).setJetDrawingTool(PgenJetDrawingTool.this); - ((JetAttrDlg)attrDlg).enableBarbBtns(true); - - } - - return true; + return true; } else{ @@ -282,5 +235,70 @@ public class PgenJetDrawingTool extends PgenMultiPointDrawingTool if ( !isResourceEditable() || shiftDown ) return false; else return true; } + + + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if ( !drawingLayer.isEditable() || shiftDown ) return false; + + if (button == 3) { + + if ( points.size() == 0 ) { + + drawingLayer.removeGhostLine(); + mapEditor.refresh(); + attrDlg.close(); + attrDlg = null; + PgenUtil.setSelectingMode(); + + } + else if ( points.size() < 2 ){ + + drawingLayer.removeGhostLine(); + points.clear(); + + mapEditor.refresh(); + + } + else { + + // create a new Jet. + elem = def.create( DrawableType.JET, (IAttribute)attrDlg, + pgenCategory, pgenType, points, drawingLayer.getActiveLayer()); + + jet = (Jet)elem; + + jet.setSnapTool(new PgenSnapJet(drawingLayer.getDescriptor(), mapEditor, (JetAttrDlg)attrDlg)); + + // add the jet to PGEN resource + drawingLayer.addElement( jet ); + + //reset the jet line attributes + AbstractDrawableComponent adc = AttrSettings.getInstance().getSettings().get( pgenType ); + if ( adc != null && adc instanceof Jet ){ + ((Jet)adc).getJetLine().update(attrDlg); + } + + drawingLayer.removeGhostLine(); + points.clear(); + + mapEditor.refresh(); + + ((JetAttrDlg)attrDlg).setJetDrawingTool(PgenJetDrawingTool.this); + ((JetAttrDlg)attrDlg).enableBarbBtns(true); + + } + + + return true; + } + else { + return false; + } + } + } } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetHashAddingHandler.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetHashAddingHandler.java index fd3a2d4a22..01d495e33c 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetHashAddingHandler.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetHashAddingHandler.java @@ -95,10 +95,6 @@ public class PgenJetHashAddingHandler extends InputHandlerDefaultImpl { } else if ( button == 3 ) { - drawingLayer.removeGhostLine(); - mapEditor.refresh(); - - prevTool.resetMouseHandler(); return true; } @@ -109,7 +105,27 @@ public class PgenJetHashAddingHandler extends InputHandlerDefaultImpl { } } + + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if ( !drawingLayer.isEditable() || shiftDown ) return false; + if (button == 3) { + drawingLayer.removeGhostLine(); + mapEditor.refresh(); + + prevTool.resetMouseHandler(); + return true; + } + else { + return false; + } + } + + /* * (non-Javadoc) * diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetHashDeletingHandler.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetHashDeletingHandler.java index cc21e8200d..16643550d1 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetHashDeletingHandler.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenJetHashDeletingHandler.java @@ -125,11 +125,7 @@ public class PgenJetHashDeletingHandler extends InputHandlerDefaultImpl { } else if ( button == 3 ) { - - drawingLayer.removeGhostLine(); - mapEditor.refresh(); - - prevTool.resetMouseHandler(); + return true; } @@ -140,7 +136,27 @@ public class PgenJetHashDeletingHandler extends InputHandlerDefaultImpl { } } + + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if ( !drawingLayer.isEditable() || shiftDown ) return false; + if (button == 3) { + + drawingLayer.removeGhostLine(); + mapEditor.refresh(); + + prevTool.resetMouseHandler(); + return true; + } + else { + return false; + } + } + @Override public boolean handleMouseDownMove(int x, int y, int mouseButton) { if ( !drawingLayer.isEditable() || shiftDown ) return false; diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenKinkLineDrawingTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenKinkLineDrawingTool.java index 58a63cc4e1..53b824477e 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenKinkLineDrawingTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenKinkLineDrawingTool.java @@ -128,15 +128,6 @@ public class PgenKinkLineDrawingTool extends AbstractPgenDrawingTool { } else if (button == 3) { - drawingLayer.removeGhostLine(); - mapEditor.refresh(); - - if (points.size() == 0) { - PgenUtil.setSelectingMode(); - } else { - points.clear(); - } - return true; } else if (button == 2) { @@ -150,7 +141,32 @@ public class PgenKinkLineDrawingTool extends AbstractPgenDrawingTool { } } + + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if ( !drawingLayer.isEditable() || shiftDown ) return false; + if (button == 3) { + + drawingLayer.removeGhostLine(); + mapEditor.refresh(); + + if (points.size() == 0) { + PgenUtil.setSelectingMode(); + } else { + points.clear(); + } + + return true; + } + else { + return false; + } + } + /* * (non-Javadoc) * diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenLabeledLineDelHandler.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenLabeledLineDelHandler.java index f1453a8189..18a756c7bf 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenLabeledLineDelHandler.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenLabeledLineDelHandler.java @@ -8,6 +8,7 @@ package gov.noaa.nws.ncep.ui.pgen.tools; +import gov.noaa.nws.ncep.ui.pgen.PgenUtil; import gov.noaa.nws.ncep.ui.pgen.attrdialog.AttrDlg; import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent; import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement; @@ -153,8 +154,6 @@ public class PgenLabeledLineDelHandler extends InputHandlerDefaultImpl { } else if ( button == 3 ) { - dlg.resetLabeledLineBtns(); - prevTool.resetMouseHandler(); return true; } @@ -165,7 +164,24 @@ public class PgenLabeledLineDelHandler extends InputHandlerDefaultImpl { } } + + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if ( !drawingLayer.isEditable() || shiftDown ) return false; + if (button == 3) { + dlg.resetLabeledLineBtns(); + prevTool.resetMouseHandler(); + return true; + } + else { + return false; + } + } + @Override public boolean handleMouseDownMove(int x, int y, int mouseButton) { if ( !drawingLayer.isEditable() || shiftDown ) return false; diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenLabeledLineDrawingTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenLabeledLineDrawingTool.java index 82de2358e6..162bf5d67d 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenLabeledLineDrawingTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenLabeledLineDrawingTool.java @@ -181,82 +181,6 @@ public class PgenLabeledLineDrawingTool extends AbstractPgenDrawingTool return true; } else if (button == 3) { - - if (points.size() == 0) { - - if (attrDlg.isAddLineMode()) { - // add mode - attrDlg.resetLabeledLineBtns(); - } else { - // clean up - closeAttrDlg(attrDlg, pgenType); - attrDlg = null; - PgenUtil.setSelectingMode(); - } - - labeledLine = null; - - } else if (points.size() < 2) { - - drawingLayer.removeGhostLine(); - points.clear(); - - mapEditor.refresh(); - - } else { - - // add the labeled line to PGEN resource - if (attrDlg.isAddLineMode()) { - elem = def.createLabeledLine(pgenCategory, pgenType, - (IAttribute) attrDlg, points, null, - drawingLayer.getActiveLayer()); - - drawingLayer.addElement(elem); - labeledLine = (LabeledLine) elem; - AttrSettings.getInstance().setSettings(elem); - } - - if ("CCFP_SIGMET".equals(pgenType)) { - - elem = def.createLabeledLine(pgenCategory, pgenType, - (IAttribute) attrDlg, points, null, - drawingLayer.getActiveLayer()); - - drawingLayer.addElement(elem); - labeledLine = (LabeledLine) elem; - - if (ccdlg.isAreaType()) {// avoid 2 Sigmet elements - // issue - // If auto placement is on, add label directly. - if (!PgenUtil.getTextAutoPlacement()) { - /* - * return true;avoid right click cause no - * showing issue - */ - ccfpTxtFlag = true; - setAddingLabelHandler(); - } else { - Text t = new Text(); - Label lbl = new Label(t); - lbl.setParent(labeledLine); - setCcfpText( - labeledLine, - ((gov.noaa.nws.ncep.ui.pgen.sigmet.Ccfp) labeledLine) - .getAreaLine(), t, lbl); - - labeledLine.addLabel(lbl); - } - } - } - - drawingLayer.removeGhostLine(); - if (!ccfpTxtFlag) - points.clear(); - - mapEditor.refresh(); - - } - return true; } else if (button == 2) { @@ -335,6 +259,98 @@ public class PgenLabeledLineDrawingTool extends AbstractPgenDrawingTool points.clear(); } + /* + * (non-Javadoc) + * + * @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, int) + */ + @Override + public boolean handleMouseUp(int x, int y, int mouseButton) { + if ( !isResourceEditable() || shiftDown ) return false; + + if ( mouseButton == 3 ){ + if (points.size() == 0) { + + if (attrDlg.isAddLineMode()) { + // add mode + attrDlg.resetLabeledLineBtns(); + } else { + // clean up + closeAttrDlg(attrDlg, pgenType); + attrDlg = null; + PgenUtil.setSelectingMode(); + } + + labeledLine = null; + + } else if (points.size() < 2) { + + drawingLayer.removeGhostLine(); + points.clear(); + + mapEditor.refresh(); + + } else { + + // add the labeled line to PGEN resource + if (attrDlg.isAddLineMode()) { + elem = def.createLabeledLine(pgenCategory, pgenType, + (IAttribute) attrDlg, points, null, + drawingLayer.getActiveLayer()); + + drawingLayer.addElement(elem); + labeledLine = (LabeledLine) elem; + AttrSettings.getInstance().setSettings(elem); + } + + if ("CCFP_SIGMET".equals(pgenType)) { + + elem = def.createLabeledLine(pgenCategory, pgenType, + (IAttribute) attrDlg, points, null, + drawingLayer.getActiveLayer()); + + drawingLayer.addElement(elem); + labeledLine = (LabeledLine) elem; + + if (ccdlg.isAreaType()) {// avoid 2 Sigmet elements + // issue + // If auto placement is on, add label directly. + if (!PgenUtil.getTextAutoPlacement()) { + /* + * return true;avoid right click cause no + * showing issue + */ + ccfpTxtFlag = true; + setAddingLabelHandler(); + } else { + Text t = new Text(); + Label lbl = new Label(t); + lbl.setParent(labeledLine); + setCcfpText( + labeledLine, + ((gov.noaa.nws.ncep.ui.pgen.sigmet.Ccfp) labeledLine) + .getAreaLine(), t, lbl); + + labeledLine.addLabel(lbl); + } + } + } + + drawingLayer.removeGhostLine(); + if (!ccfpTxtFlag) + points.clear(); + + mapEditor.refresh(); + + } + return true; + } + else { + return false; + } + } + + /** * Returns the Labeled Line in the current layer with input * type(Turb/Cloud). diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenLabeledLineModifyTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenLabeledLineModifyTool.java index 60e8cbedf1..bdbc8a090b 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenLabeledLineModifyTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenLabeledLineModifyTool.java @@ -185,57 +185,7 @@ public class PgenLabeledLineModifyTool extends PgenSelectingTool implements return false; } - //clean up else if ( button == 3 ) { - - if ( attrDlg.isAddLineMode()){ - if ( points.size() == 0 ) { - attrDlg.resetLabeledLineBtns(); - } - else if ( points.size() < 2 ){ - drawingLayer.removeGhostLine(); - points.clear(); - mapEditor.refresh(); - - } - else { - //add line to labeled line collection - // LabeledLine newll = def.createLabeledLine( labeledLine.getPgenCategory(), labeledLine.getPgenType(), - // (IAttribute)attrDlg, points, labeledLine.copy(), drawingLayer.getActiveLayer()); - - LabeledLine newll = def.createLabeledLine( pgenCategory, PgenLabeledLineModifyTool.this.pgenType, (IAttribute)attrDlg, - points, null, drawingLayer.getActiveLayer()); - - // drawingLayer.replaceElement(labeledLine, newll); - drawingLayer.addElement( newll ); - labeledLine = newll; - - drawingLayer.removeGhostLine(); - points.clear(); - - //re-set selected - // resetSelected(); - - drawingLayer.setSelected(newll); - - mapEditor.refresh(); - - } - } - else { - // Close the attribute dialog and do the cleanup. - if ( attrDlg != null ) { - attrDlg.close(); - } - - attrDlg = null; - - drawingLayer.removeGhostLine(); - ptSelected2 = false; ptSelected = false; - drawingLayer.removeSelected(); - mapEditor.refresh(); - PgenUtil.setSelectingMode(); - } return true; } @@ -510,6 +460,58 @@ public class PgenLabeledLineModifyTool extends PgenSelectingTool implements } } + else if ( button ==3 ) { + + if ( attrDlg.isAddLineMode()){ + if ( points.size() == 0 ) { + attrDlg.resetLabeledLineBtns(); + } + else if ( points.size() < 2 ){ + drawingLayer.removeGhostLine(); + points.clear(); + mapEditor.refresh(); + + } + else { + //add line to labeled line collection + // LabeledLine newll = def.createLabeledLine( labeledLine.getPgenCategory(), labeledLine.getPgenType(), + // (IAttribute)attrDlg, points, labeledLine.copy(), drawingLayer.getActiveLayer()); + + LabeledLine newll = def.createLabeledLine( pgenCategory, PgenLabeledLineModifyTool.this.pgenType, (IAttribute)attrDlg, + points, null, drawingLayer.getActiveLayer()); + + // drawingLayer.replaceElement(labeledLine, newll); + drawingLayer.addElement( newll ); + labeledLine = newll; + + drawingLayer.removeGhostLine(); + points.clear(); + + //re-set selected + // resetSelected(); + + drawingLayer.setSelected(newll); + + mapEditor.refresh(); + + } + } + else { + // Close the attribute dialog and do the cleanup. + if ( attrDlg != null ) { + attrDlg.close(); + } + + attrDlg = null; + + drawingLayer.removeGhostLine(); + ptSelected2 = false; ptSelected = false; + drawingLayer.removeSelected(); + mapEditor.refresh(); + PgenUtil.setSelectingMode(); + } + return true; + } //make sure the arrow line won't go through the text box. if(labeledLine instanceof Ccfp) ((Ccfp)labeledLine).moveText2Last(); diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenModifyTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenModifyTool.java index 4c9945b74e..fb457a6217 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenModifyTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenModifyTool.java @@ -177,6 +177,67 @@ public class PgenModifyTool extends AbstractPgenTool { } else if (button == 3) { + return true; + } + + else { + return false; + } + + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.viz.ui.input.IInputHandler#handleMouseMove(int, + * int) + */ + @Override + public boolean handleMouseMove(int x, int y) { + if (!isResourceEditable()) + return false; + + // Check if mouse is in geographic extent + Coordinate loc = mapEditor.translateClick(x, y); + if (loc == null) + return false; + + // create the ghost element and put it in the drawing layer + if (clickPts != null && clickPts.size() >= 1) { + + ArrayList newPts = new ArrayList( + clickPts); + newPts.add(loc); + + pml.setClickPts(latlonToPixel(newPts + .toArray(new Coordinate[newPts.size()]))); + + ModifyLine(); + + ghostEl.setColors(new Color[] { ghostColor, + new java.awt.Color(255, 255, 255) }); + drawingLayer.setGhostLine(ghostEl); + mapEditor.refresh(); + + } + + return true; + + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, + * int) + */ + @Override + public boolean handleMouseUp(int x, int y, int button) { + if (!isResourceEditable() || shiftDown) + return false; + + if ( button == 3 ) { + if (drawingLayer.getSelectedDE() != null) { if (clickPts != null && !clickPts.isEmpty()) { @@ -265,68 +326,15 @@ public class PgenModifyTool extends AbstractPgenTool { PgenUtil.setSelectingMode(); } - + return true; } - else { return false; } } - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.ui.input.IInputHandler#handleMouseMove(int, - * int) - */ - @Override - public boolean handleMouseMove(int x, int y) { - if (!isResourceEditable()) - return false; - - // Check if mouse is in geographic extent - Coordinate loc = mapEditor.translateClick(x, y); - if (loc == null) - return false; - - // create the ghost element and put it in the drawing layer - if (clickPts != null && clickPts.size() >= 1) { - - ArrayList newPts = new ArrayList( - clickPts); - newPts.add(loc); - - pml.setClickPts(latlonToPixel(newPts - .toArray(new Coordinate[newPts.size()]))); - - ModifyLine(); - - ghostEl.setColors(new Color[] { ghostColor, - new java.awt.Color(255, 255, 255) }); - drawingLayer.setGhostLine(ghostEl); - mapEditor.refresh(); - - } - - return true; - - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, - * int) - */ - @Override - public boolean handleMouseUp(int x, int y, int button) { - - return false; - - } - @Override public boolean handleMouseDownMove(int x, int y, int mouseButton) { if (!isResourceEditable() || shiftDown) diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenMoveElement.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenMoveElement.java index a5b5874ac1..cc760e6ba1 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenMoveElement.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenMoveElement.java @@ -13,6 +13,7 @@ import java.util.Iterator; import com.raytheon.uf.viz.core.rsc.IInputHandler; import com.vividsolutions.jts.geom.Coordinate; +import gov.noaa.nws.ncep.ui.pgen.PgenUtil; import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent; import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement; import gov.noaa.nws.ncep.ui.pgen.elements.WatchBox; @@ -74,9 +75,27 @@ public class PgenMoveElement extends PgenCopyElement { @Override public boolean handleMouseUp(int x, int y, int button) { - if ( !isResourceEditable() || shiftDown || simulate ) return false; - - if ( ghostEl != null ) { + if ( !isResourceEditable() || shiftDown || simulate ) return false; + + if ( button == 3 ) { + + if ( drawingLayer.getSelectedComp() != null ){ + // de-select element + drawingLayer.removeSelected(); + drawingLayer.removeGhostLine(); + ghostEl = null; + mapEditor.refresh(); + } + else { + // set selecting mode + PgenUtil.setSelectingMode(); + } + + return true; + + } + + if ( ghostEl != null ) { AbstractDrawableComponent comp = drawingLayer.getSelectedComp(); // reset color for the el and add it to PGEN resource diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenMultiPointDrawingTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenMultiPointDrawingTool.java index 875cf73daa..dd37455f8d 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenMultiPointDrawingTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenMultiPointDrawingTool.java @@ -198,72 +198,7 @@ public class PgenMultiPointDrawingTool extends AbstractPgenDrawingTool { } else if ( button == 3 ) { - - if ( points.size() == 0 ) { - - closeAttrDlg(attrDlg, pgenType); - attrDlg = null; - PgenUtil.setSelectingMode(); - - } - else if ( points.size() < 2 ){ - - drawingLayer.removeGhostLine(); - points.clear(); - - mapEditor.refresh(); - - } - else { - //Use pgenType value to decide if the DrawableType should be TRACK or LINE - DrawableType drawableType = getDrawableType(pgenType); -// log.debug("PgenMultiPointDrawingTool, before call def.create, drawableType=" + drawableType + ", pgenType="+pgenType); - - /*if(drawableType == DrawableType.CONV_SIGMET && ("NCON_SIGMET".equals(pgenType))) //"CONV_SIGMET".equals(pgenType)|| - points = SnapUtil.getSnapWithStation(points, SnapUtil.VOR_STATION_LIST, 10, 8);*/ - - // create a new DrawableElement. - elem = def.create( drawableType, (IAttribute)attrDlg, - pgenCategory, pgenType, points, drawingLayer.getActiveLayer()); - - attrDlg.setDrawableElement((DrawableElement)elem); - AttrSettings.getInstance().setSettings((DrawableElement)elem); - - if("CCFP_SIGMET".equals(pgenType)){//avoid 2 Sigmet elements issue - ccfpTxtFlag = true; - return true;//avoid right click cause no showing issue - - } - else if ( elem != null && elem.getPgenCategory().equalsIgnoreCase("Front") - && ((FrontAttrDlg)attrDlg).labelEnabled()){ - - DECollection dec = new DECollection("labeledFront"); - dec.setPgenCategory(pgenCategory); - dec.setPgenType(pgenType); - dec.addElement(elem); - drawingLayer.addElement(dec); - - PgenUtil.setDrawingTextMode( true, ((FrontAttrDlg)attrDlg).useFrontColor(), "", dec ); - elem = null; - }else{ - // add the product to PGEN resource - drawingLayer.addElement( elem ); - } - - - if(isTrackElement(drawableType)) { - displayTrackExtrapPointInfoDlg((TrackAttrDlg)attrDlg, (Track)elem); - } - - drawingLayer.removeGhostLine(); - - if( ! ccfpTxtFlag) - points.clear(); - - mapEditor.refresh(); - - } - + return true; } @@ -280,6 +215,87 @@ public class PgenMultiPointDrawingTool extends AbstractPgenDrawingTool { } + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if ( !drawingLayer.isEditable() || shiftDown ) return false; + + if (button == 3) { + + if ( points.size() == 0 ) { + + closeAttrDlg(attrDlg, pgenType); + attrDlg = null; + PgenUtil.setSelectingMode(); + + } + else if ( points.size() < 2 ){ + + drawingLayer.removeGhostLine(); + points.clear(); + + mapEditor.refresh(); + + } + else { + //Use pgenType value to decide if the DrawableType should be TRACK or LINE + DrawableType drawableType = getDrawableType(pgenType); +// log.debug("PgenMultiPointDrawingTool, before call def.create, drawableType=" + drawableType + ", pgenType="+pgenType); + + /*if(drawableType == DrawableType.CONV_SIGMET && ("NCON_SIGMET".equals(pgenType))) //"CONV_SIGMET".equals(pgenType)|| + points = SnapUtil.getSnapWithStation(points, SnapUtil.VOR_STATION_LIST, 10, 8);*/ + + // create a new DrawableElement. + elem = def.create( drawableType, (IAttribute)attrDlg, + pgenCategory, pgenType, points, drawingLayer.getActiveLayer()); + + attrDlg.setDrawableElement((DrawableElement)elem); + AttrSettings.getInstance().setSettings((DrawableElement)elem); + + if("CCFP_SIGMET".equals(pgenType)){//avoid 2 Sigmet elements issue + ccfpTxtFlag = true; + return true;//avoid right click cause no showing issue + + } + else if ( elem != null && elem.getPgenCategory().equalsIgnoreCase("Front") + && ((FrontAttrDlg)attrDlg).labelEnabled()){ + + DECollection dec = new DECollection("labeledFront"); + dec.setPgenCategory(pgenCategory); + dec.setPgenType(pgenType); + dec.addElement(elem); + drawingLayer.addElement(dec); + + PgenUtil.setDrawingTextMode( true, ((FrontAttrDlg)attrDlg).useFrontColor(), "", dec ); + elem = null; + }else{ + // add the product to PGEN resource + drawingLayer.addElement( elem ); + } + + + if(isTrackElement(drawableType)) { + displayTrackExtrapPointInfoDlg((TrackAttrDlg)attrDlg, (Track)elem); + } + + drawingLayer.removeGhostLine(); + + if( ! ccfpTxtFlag) + points.clear(); + + mapEditor.refresh(); + + } + + return true; + } + else { + return false; + } + } + @Override public boolean handleMouseDownMove(int aX, int aY, int button) { if ( !isResourceEditable() || shiftDown ) return false; diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenMultiSelectTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenMultiSelectTool.java index 0095182771..94da424719 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenMultiSelectTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenMultiSelectTool.java @@ -156,7 +156,7 @@ public class PgenMultiSelectTool extends AbstractPgenDrawingTool { // Keep in multi-selecting mode // PgenUtil.setSelectingMode(); } - return false; + return true; } else { diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenOutlookDrawingTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenOutlookDrawingTool.java index f32a4ee8d7..ea569dc7b0 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenOutlookDrawingTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenOutlookDrawingTool.java @@ -166,7 +166,6 @@ public class PgenOutlookDrawingTool extends AbstractPgenDrawingTool { public boolean handleMouseDown(int anX, int aY, int button) { if ( !isResourceEditable() ) return false; - DECollection dec = null; // Check if mouse is in geographic extent Coordinate loc = mapEditor.translateClick(anX, aY); @@ -181,77 +180,6 @@ public class PgenOutlookDrawingTool extends AbstractPgenDrawingTool { } else if ( button == 3 ) { - if ( points.size() == 0 ) { - - attrDlg.close(); - attrDlg = null; - PgenUtil.setSelectingMode(); - - } - else if ( points.size() < 2 ){ - - drawingLayer.removeGhostLine(); - points.clear(); - - mapEditor.refresh(); - - } - else { - String lineType = ((OutlookAttrDlg)attrDlg).getLineType(); - // create a new DrawableElement. - // if (((OutlookAttrDlg)attrDlg).getOutlookType().equalsIgnoreCase("TROPICAL") - // || ((OutlookAttrDlg)attrDlg).getOutlookType().equalsIgnoreCase("FLOOD")) - // elem = (DrawableElement)def.create( DrawableType.LINE, (IAttribute)attrDlg, - // "Lines", "LINE_SOLID", points, drawingLayer.getActiveLayer()); - // else - elem = (DrawableElement)def.create( DrawableType.LINE, (IAttribute)attrDlg, - "Lines", lineType, points, drawingLayer.getActiveLayer()); - //if (((IMultiPoint)attrDlg).getFillFlag()) ((Line)elem).setFillPattern(attrDlg.getFillPattern()); - - dec = new DECollection(Outlook.OUTLOOK_LABELED_LINE); - dec.setPgenCategory("MET"); - - otlk = getCurrentOtlk(((OutlookAttrDlg)attrDlg).getOutlookType()); - - Outlook newOtlk = def.createOutlook( ((OutlookAttrDlg)attrDlg).getOutlookType(), - elem, dec, otlk ); - - newOtlk.update( (OutlookAttrDlg)attrDlg ); - - // create a new outlook - if ( otlk == null || !otlk.getPgenType().equalsIgnoreCase(((OutlookAttrDlg)attrDlg).getOutlookType()) ){ - drawingLayer.addElement( newOtlk ); - } - else { - drawingLayer.replaceElement(otlk, newOtlk); - } - - otlk = newOtlk; - - attrDlg.setDrawableElement(elem); - - drawingLayer.removeGhostLine(); - points.clear(); - - mapEditor.refresh(); - - //set TextDrawingtool or SymbolDrawingTool - //bring up the text or the symbol dialog - if ( ((OutlookAttrDlg)attrDlg).addLabel() ) { - if ( ((OutlookAttrDlg)attrDlg).addText() ) { - lbl = ((OutlookAttrDlg)attrDlg).getLblTxt(); - PgenUtil.setDrawingTextMode( true, ((OutlookAttrDlg)attrDlg).useLineColor(), - lbl, dec ); - } - else if ( ((OutlookAttrDlg)attrDlg).addSymbol() ) { - - PgenUtil.setDrawingSymbolMode( ((OutlookAttrDlg)attrDlg).getSymbolCat(), - ((OutlookAttrDlg)attrDlg).getSymbolType(), - ((OutlookAttrDlg)attrDlg).useLineColor(), dec ); - } - } - } - return true; } @@ -267,7 +195,94 @@ public class PgenOutlookDrawingTool extends AbstractPgenDrawingTool { } } - + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if ( !drawingLayer.isEditable() || shiftDown ) return false; + + if (button == 3) { + DECollection dec = null; + + if ( points.size() == 0 ) { + + attrDlg.close(); + attrDlg = null; + PgenUtil.setSelectingMode(); + + } + else if ( points.size() < 2 ){ + + drawingLayer.removeGhostLine(); + points.clear(); + + mapEditor.refresh(); + + } + else { + String lineType = ((OutlookAttrDlg)attrDlg).getLineType(); + // create a new DrawableElement. + // if (((OutlookAttrDlg)attrDlg).getOutlookType().equalsIgnoreCase("TROPICAL") + // || ((OutlookAttrDlg)attrDlg).getOutlookType().equalsIgnoreCase("FLOOD")) + // elem = (DrawableElement)def.create( DrawableType.LINE, (IAttribute)attrDlg, + // "Lines", "LINE_SOLID", points, drawingLayer.getActiveLayer()); + // else + elem = (DrawableElement)def.create( DrawableType.LINE, (IAttribute)attrDlg, + "Lines", lineType, points, drawingLayer.getActiveLayer()); + //if (((IMultiPoint)attrDlg).getFillFlag()) ((Line)elem).setFillPattern(attrDlg.getFillPattern()); + + dec = new DECollection(Outlook.OUTLOOK_LABELED_LINE); + dec.setPgenCategory("MET"); + + otlk = getCurrentOtlk(((OutlookAttrDlg)attrDlg).getOutlookType()); + + Outlook newOtlk = def.createOutlook( ((OutlookAttrDlg)attrDlg).getOutlookType(), + elem, dec, otlk ); + + newOtlk.update( (OutlookAttrDlg)attrDlg ); + + // create a new outlook + if ( otlk == null || !otlk.getPgenType().equalsIgnoreCase(((OutlookAttrDlg)attrDlg).getOutlookType()) ){ + drawingLayer.addElement( newOtlk ); + } + else { + drawingLayer.replaceElement(otlk, newOtlk); + } + + otlk = newOtlk; + + attrDlg.setDrawableElement(elem); + + drawingLayer.removeGhostLine(); + points.clear(); + + mapEditor.refresh(); + + //set TextDrawingtool or SymbolDrawingTool + //bring up the text or the symbol dialog + if ( ((OutlookAttrDlg)attrDlg).addLabel() ) { + if ( ((OutlookAttrDlg)attrDlg).addText() ) { + lbl = ((OutlookAttrDlg)attrDlg).getLblTxt(); + PgenUtil.setDrawingTextMode( true, ((OutlookAttrDlg)attrDlg).useLineColor(), + lbl, dec ); + } + else if ( ((OutlookAttrDlg)attrDlg).addSymbol() ) { + + PgenUtil.setDrawingSymbolMode( ((OutlookAttrDlg)attrDlg).getSymbolCat(), + ((OutlookAttrDlg)attrDlg).getSymbolType(), + ((OutlookAttrDlg)attrDlg).useLineColor(), dec ); + } + } + } + + return true; + } + else { + return false; + } + } + /* * (non-Javadoc) * diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenOutlookSetCont.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenOutlookSetCont.java index c05df93ade..993de8d8d0 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenOutlookSetCont.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenOutlookSetCont.java @@ -162,10 +162,6 @@ public class PgenOutlookSetCont extends AbstractPgenDrawingTool{ } else if ( button == 3 ) { - drawingLayer.removeSelected(); - PgenUtil.loadOutlookDrawingTool(); - dec = null; - return true; } @@ -176,7 +172,26 @@ public class PgenOutlookSetCont extends AbstractPgenDrawingTool{ } } + + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if ( !drawingLayer.isEditable() || shiftDown ) return false; + if (button == 3) { + + drawingLayer.removeSelected(); + PgenUtil.loadOutlookDrawingTool(); + dec = null; + + return true; + } + else { + return false; + } + } @Override public boolean handleMouseDownMove(int x, int y, int mouseButton) { if ( !isResourceEditable() ) return false; diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenRotateElement.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenRotateElement.java index fae18d731b..394727cf6e 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenRotateElement.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenRotateElement.java @@ -288,9 +288,31 @@ public class PgenRotateElement extends AbstractPgenDrawingTool { mapEditor.refresh(); } + return true; } + else if (button == 3) { - return false; + if (trackExtrapPointInfoDlg != null) { + trackExtrapPointInfoDlg.close(); + trackExtrapPointInfoDlg = null; + } + + if (drawingLayer.getSelectedDE() != null) { + drawingLayer.removeGhostLine(); + ptSelected = false; + drawingLayer.removeSelected(); + mapEditor.refresh(); + + } else { + // set selecting mode + PgenUtil.setSelectingMode(); + } + + return true; + } + else { + return false; + } } /** diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenSelectHandler.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenSelectHandler.java index 633ae96734..327560644a 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenSelectHandler.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenSelectHandler.java @@ -261,7 +261,7 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl { PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getShell()).setWatchBox((WatchBox) elSelected); PgenUtil.loadWatchBoxModifyTool(elSelected); - return false; + return false; } else if (elSelected instanceof Tcm) { PgenUtil.loadTcmTool(elSelected); } @@ -475,7 +475,11 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl { } - else { + else if (button == 3 && pgenrsc.getSelectedDE() != null) { + // Right button click does not fall through to other handlers if + // there is pgen element is selected + return true; + } else { return false; @@ -1047,12 +1051,16 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl { } trackExtrapPointInfoDlg = null; + if (pgenrsc.getSelectedDE() != null) { + preempt = true; + } + pgenrsc.removeGhostLine(); ptSelected = false; pgenrsc.removeSelected(); mapEditor.refresh(); - // return false; + return preempt; } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenSinglePointDrawingTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenSinglePointDrawingTool.java index 30b5c91338..2087d400c1 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenSinglePointDrawingTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenSinglePointDrawingTool.java @@ -184,44 +184,6 @@ public class PgenSinglePointDrawingTool extends AbstractPgenDrawingTool { } else if ( button == 3 ) { - if ( elem != null && ((SymbolAttrDlg)attrDlg).labelEnabled()){ - drawingLayer.removeGhostLine(); - mapEditor.refresh(); - - String defaultTxt = ""; - if ( attrDlg instanceof VolcanoAttrDlg ){ - defaultTxt = ((VolcanoAttrDlg)attrDlg).getVolText(); - dec.setCollectionName("Volcano"); - } - - //in case the label is enabled after symbol is placed. - if (dec == null && ((SymbolAttrDlg)attrDlg).labelEnabled()){ - dec = new DECollection("labeledSymbol"); - dec.setPgenCategory(pgenCategory); - dec.setPgenType(pgenType); - dec.addElement(elem); - drawingLayer.replaceElement(elem, dec); - } - - PgenUtil.setDrawingTextMode( true, ((LabeledSymbolAttrDlg)attrDlg).useSymbolColor(), defaultTxt, dec ); - dec = null; - elem = null; - - } - else { - if ( prevElem != null){ - usePrevColor = false; - if ( prevElem.getParent().getPgenCategory().equalsIgnoreCase("OUTLOOK")){ - PgenUtil.loadOutlookDrawingTool(); - } - prevElem = null; - } - else { - elem = null; - PgenUtil.setSelectingMode(); - } - } - return true; } @@ -274,6 +236,62 @@ public class PgenSinglePointDrawingTool extends AbstractPgenDrawingTool { else return true; } + + /* + * (non-Javadoc) + * + * @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, int) + */ + @Override + public boolean handleMouseUp(int x, int y, int mouseButton) { + if ( !isResourceEditable() || shiftDown ) return false; + + if ( mouseButton == 3 ){ + // prevent the click going through to other handlers + // in case adding labels to symbols or fronts. + if ( elem != null && ((SymbolAttrDlg)attrDlg).labelEnabled()){ + drawingLayer.removeGhostLine(); + mapEditor.refresh(); + + String defaultTxt = ""; + if ( attrDlg instanceof VolcanoAttrDlg ){ + defaultTxt = ((VolcanoAttrDlg)attrDlg).getVolText(); + dec.setCollectionName("Volcano"); + } + + //in case the label is enabled after symbol is placed. + if (dec == null && ((SymbolAttrDlg)attrDlg).labelEnabled()){ + dec = new DECollection("labeledSymbol"); + dec.setPgenCategory(pgenCategory); + dec.setPgenType(pgenType); + dec.addElement(elem); + drawingLayer.replaceElement(elem, dec); + } + + PgenUtil.setDrawingTextMode( true, ((LabeledSymbolAttrDlg)attrDlg).useSymbolColor(), defaultTxt, dec ); + dec = null; + elem = null; + + } + else { + if ( prevElem != null){ + usePrevColor = false; + if ( prevElem.getParent().getPgenCategory().equalsIgnoreCase("OUTLOOK")){ + PgenUtil.loadOutlookDrawingTool(); + } + prevElem = null; + } + else { + elem = null; + PgenUtil.setSelectingMode(); + } + } + return true; + } + else { + return false; + } + } } /** diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenSpenesDrawingTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenSpenesDrawingTool.java index 1129918e9a..d3d55a220e 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenSpenesDrawingTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenSpenesDrawingTool.java @@ -111,48 +111,13 @@ public class PgenSpenesDrawingTool extends AbstractPgenDrawingTool { } else if ( button == 3 ) { - - if ( points.size() == 0 ) { - - if (attrDlg != null) attrDlg.close(); - attrDlg = null; - PgenUtil.setSelectingMode(); - - } - else if ( points.size() < 2 ){ - - drawingLayer.removeGhostLine(); - points.clear(); - - mapEditor.refresh(); - - } - else { - - // create a line - elem = def.create( DrawableType.SPENES, (IAttribute)attrDlg, - pgenCategory, pgenType, points, drawingLayer.getActiveLayer()); - - attrDlg.setDrawableElement((DrawableElement)elem); - // AttrSettings.getInstance().setSettings((DrawableElement)elem); - - // add the product to PGEN resource - drawingLayer.addElement( elem ); - - //System.out.println(USState.statesInGeometry(((Spenes)elem).toJTSPolygon())); - drawingLayer.removeGhostLine(); - points.clear(); - - mapEditor.refresh(); - - } - + return true; } else if ( button == 2 ){ - return true; + return false; } else{ @@ -203,6 +168,59 @@ public class PgenSpenesDrawingTool extends AbstractPgenDrawingTool { return true; } + + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if ( !drawingLayer.isEditable() || shiftDown ) return false; + + if (button == 3) { + + if ( points.size() == 0 ) { + + if (attrDlg != null) attrDlg.close(); + attrDlg = null; + PgenUtil.setSelectingMode(); + + } + else if ( points.size() < 2 ){ + + drawingLayer.removeGhostLine(); + points.clear(); + + mapEditor.refresh(); + + } + else { + + // create a line + elem = def.create( DrawableType.SPENES, (IAttribute)attrDlg, + pgenCategory, pgenType, points, drawingLayer.getActiveLayer()); + + attrDlg.setDrawableElement((DrawableElement)elem); + // AttrSettings.getInstance().setSettings((DrawableElement)elem); + + // add the product to PGEN resource + drawingLayer.addElement( elem ); + + //System.out.println(USState.statesInGeometry(((Spenes)elem).toJTSPolygon())); + drawingLayer.removeGhostLine(); + points.clear(); + + mapEditor.refresh(); + + } + + return true; + } + else { + return false; + } + } + + private void clearPoints(){ points.clear(); } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenTcaTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenTcaTool.java index e020e41482..04b88dc332 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenTcaTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenTcaTool.java @@ -413,6 +413,22 @@ public class PgenTcaTool extends AbstractPgenDrawingTool { // right mouse button pressed else if (button == 3) { + return true; + + } else + return false; + + } + + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if ( !drawingLayer.isEditable() || shiftDown ) return false; + + if (button == 3) { + switch (mode) { case IDLE: @@ -456,12 +472,12 @@ public class PgenTcaTool extends AbstractPgenDrawingTool { } return true; - - } else + } + else { return false; - + } } - + /* * (non-Javadoc) * diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenTcmDrawingTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenTcmDrawingTool.java index cc2ba78b37..c8d8abbc85 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenTcmDrawingTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenTcmDrawingTool.java @@ -124,21 +124,7 @@ public class PgenTcmDrawingTool extends AbstractPgenDrawingTool { } else if ( button == 3 ) { - - drawingLayer.removeGhostLine(); - mapEditor.refresh(); - - if ( points.size() == 0 ) { - - PgenUtil.setSelectingMode(); - - } - else { - - points.clear(); - - } - + return true; } @@ -154,7 +140,37 @@ public class PgenTcmDrawingTool extends AbstractPgenDrawingTool { } } + + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if ( !drawingLayer.isEditable() || shiftDown ) return false; + if (button == 3) { + + drawingLayer.removeGhostLine(); + mapEditor.refresh(); + + if ( points.size() == 0 ) { + + PgenUtil.setSelectingMode(); + + } + else { + + points.clear(); + + } + + return true; + } + else { + return false; + } + } + /* * (non-Javadoc) * diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenTextDrawingTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenTextDrawingTool.java index a39fbb41b4..98d5408fc4 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenTextDrawingTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenTextDrawingTool.java @@ -272,32 +272,6 @@ public class PgenTextDrawingTool extends AbstractPgenDrawingTool { } else if ( button == 3 ) { - drawingLayer.removeGhostLine(); - mapEditor.refresh(); - - if (addLabelToSymbol){ - addLabelToSymbol = false; - usePrevColor = false; - if ( prevElem.getName().equalsIgnoreCase("labeledSymbol") ){ - if ( prevElem.getPrimaryDE() instanceof Symbol ) { - PgenUtil.setDrawingSymbolMode( prevElem.getPrimaryDE().getPgenCategory(), prevElem.getPgenType(), false, null ); - } - else if ( prevElem.getPrimaryDE() instanceof ComboSymbol ){ - PgenUtil.setDrawingSymbolMode( "Combo", prevElem.getPgenType(), false, null ); - } - } - else if ( prevElem instanceof DECollection && prevElem.getPgenCategory().equalsIgnoreCase("Front") ){ - PgenUtil.setDrawingFrontMode((Line)prevElem.getPrimaryDE()); - } - else if ( prevElem.getName().equalsIgnoreCase(Outlook.OUTLOOK_LABELED_LINE)){ - PgenUtil.loadOutlookDrawingTool(); - } - prevElem = null; - } - else { - PgenUtil.setSelectingMode(); - } - return true; } @@ -379,7 +353,56 @@ public class PgenTextDrawingTool extends AbstractPgenDrawingTool { if ( !isResourceEditable()|| shiftDown ) return false; else return true; } - + + /* + * (non-Javadoc) + * + * @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, int) + */ + @Override + public boolean handleMouseUp(int x, int y, int mouseButton) { + if ( !isResourceEditable()|| shiftDown ) return false; + + // prevent the click going through to other handlers + // in case adding labels to symbols or fronts. + if ( mouseButton == 3 ) { + + drawingLayer.removeGhostLine(); + mapEditor.refresh(); + + if (addLabelToSymbol){ + addLabelToSymbol = false; + usePrevColor = false; + if ( prevElem.getName().equalsIgnoreCase("labeledSymbol") ){ + if ( prevElem.getPrimaryDE() instanceof Symbol ) { + PgenUtil.setDrawingSymbolMode( prevElem.getPrimaryDE().getPgenCategory(), prevElem.getPgenType(), false, null ); + } + else if ( prevElem.getPrimaryDE() instanceof ComboSymbol ){ + PgenUtil.setDrawingSymbolMode( "Combo", prevElem.getPgenType(), false, null ); + } + } + else if ( prevElem instanceof DECollection && prevElem.getPgenCategory().equalsIgnoreCase("Front") ){ + PgenUtil.setDrawingFrontMode((Line)prevElem.getPrimaryDE()); + } + else if ( prevElem.getName().equalsIgnoreCase(Outlook.OUTLOOK_LABELED_LINE)){ + PgenUtil.loadOutlookDrawingTool(); + } + prevElem = null; + } + else { + PgenUtil.setSelectingMode(); + } + + return true; + + } + else{ + + return false; + + } + } + } /** * Check if a point is at right or left of the line. diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenVectorDrawingTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenVectorDrawingTool.java index 828fc61865..9d3e59573a 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenVectorDrawingTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenVectorDrawingTool.java @@ -154,20 +154,6 @@ public class PgenVectorDrawingTool extends AbstractPgenDrawingTool { } else if ( button == 3 ) { - drawingLayer.removeGhostLine(); - mapEditor.refresh(); - - if ( points.size() > 0 ) { - - points.clear(); - - } - else { - - attrDlg.close(); - - PgenUtil.setSelectingMode(); - } return true; } @@ -213,7 +199,37 @@ public class PgenVectorDrawingTool extends AbstractPgenDrawingTool { return false; } + + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if ( !drawingLayer.isEditable() || shiftDown ) return false; + if (button == 3) { + + drawingLayer.removeGhostLine(); + mapEditor.refresh(); + + if ( points.size() > 0 ) { + + points.clear(); + + } + else { + + attrDlg.close(); + + PgenUtil.setSelectingMode(); + } + return true; + } + else { + return false; + } + } + @Override public boolean handleMouseDownMove(int x, int y, int mouseButton) { if (!isResourceEditable() || shiftDown ) return false; diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchBoxAddDelCntyHandler.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchBoxAddDelCntyHandler.java index 4c36240601..b456aa542e 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchBoxAddDelCntyHandler.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchBoxAddDelCntyHandler.java @@ -193,23 +193,35 @@ public class PgenWatchBoxAddDelCntyHandler extends InputHandlerDefaultImpl { } else if ( button == 3 ) { - - wbTool.resetMouseHandler(); - ((WatchBoxAttrDlg)wbTool.attrDlg).getWatchInfoDlg().enableAllButtons(true); - ((WatchBoxAttrDlg)wbTool.attrDlg).enableDspBtn(true); - ((WatchBoxAttrDlg)wbTool.attrDlg).buttonBar.setEnabled(true); - - return true; - + return true; } else{ - return false; - } } + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if ( !drawingLayer.isEditable() || shiftDown ) return false; + + if (button == 3) { + + wbTool.resetMouseHandler(); + ((WatchBoxAttrDlg)wbTool.attrDlg).getWatchInfoDlg().enableAllButtons(true); + ((WatchBoxAttrDlg)wbTool.attrDlg).enableDspBtn(true); + ((WatchBoxAttrDlg)wbTool.attrDlg).buttonBar.setEnabled(true); + + return true; + } + else { + return false; + } + } + @Override public boolean handleMouseDownMove(int x, int y, int mouseButton) { if ( !drawingLayer.isEditable() || shiftDown ) return false; diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchBoxDrawingTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchBoxDrawingTool.java index 66ce6f3f12..707006f27d 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchBoxDrawingTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchBoxDrawingTool.java @@ -163,32 +163,11 @@ public class PgenWatchBoxDrawingTool extends AbstractPgenDrawingTool { } else if ( button == 3 ) { - - if ( points.size() == 0 ) { - - attrDlg.close(); - attrDlg = null; - PgenUtil.setSelectingMode(); - - } - else if ( points.size() < 2 ){ - - drawingLayer.removeGhostLine(); - points.clear(); - - mapEditor.refresh(); - - } - return true; - } else{ - return false; - } - } /* @@ -246,12 +225,35 @@ public class PgenWatchBoxDrawingTool extends AbstractPgenDrawingTool { points.clear(); mapEditor.refresh(); - - } + return true; } - - return true; + else if ( button == 3 ) { + + if ( points.size() == 0 ) { + + attrDlg.close(); + attrDlg = null; + PgenUtil.setSelectingMode(); + + } + else if ( points.size() < 2 ){ + + drawingLayer.removeGhostLine(); + points.clear(); + + mapEditor.refresh(); + + } + + return true; + + } + else{ + + return false; + + } } /* diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchBoxModifyTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchBoxModifyTool.java index bf1b898024..a8641f2a98 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchBoxModifyTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchBoxModifyTool.java @@ -133,29 +133,11 @@ public class PgenWatchBoxModifyTool extends PgenSelectingTool { } // clean up else if ( button == 3 ) { - - // Close the attribute dialog and do the cleanup. - if ( PgenWatchBoxModifyTool.this.attrDlg != null ) { - PgenWatchBoxModifyTool.this.attrDlg.close(); - } - - PgenWatchBoxModifyTool.this.attrDlg = null; - - drawingLayer.removeGhostLine(); - ptSelected = false; - drawingLayer.removeSelected(); - mapEditor.refresh(); - PgenUtil.setSelectingMode(); - return true; - } else{ - return false; - } - } /* @@ -230,55 +212,76 @@ public class PgenWatchBoxModifyTool extends PgenSelectingTool { */ @Override public boolean handleMouseUp(int x, int y, int button) { - firstDown = null; - if ( !isResourceEditable() ) return false; + firstDown = null; + if ( !isResourceEditable() ) return false; - // Finish the editing - if (button == 1 && drawingLayer != null ){ - - // Create a copy of the currently editing watch box - WatchBox el = (WatchBox) drawingLayer.getSelectedDE(); + // Finish the editing + if (button == 1 && drawingLayer != null ){ - if ( el != null ){ - - WatchBox newEl = (WatchBox)el.copy(); + // Create a copy of the currently editing watch box + WatchBox el = (WatchBox) drawingLayer.getSelectedDE(); - if ( ptSelected ) { + if ( el != null ){ - ptSelected = false; - - // re-snap the new watch box - resnapWatchBox( mapEditor, (WatchBox)ghostEl, newEl ); - ((WatchBoxAttrDlg)PgenWatchBoxModifyTool.this.attrDlg).setWatchBox(newEl); - WatchInfoDlg infoDlg = ((WatchBoxAttrDlg)PgenWatchBoxModifyTool.this.attrDlg).getWatchInfoDlg(); - if ( infoDlg != null && infoDlg.getShell()!= null ){ - if ( ! infoDlg.isCountyLock()){ - newEl.clearCntyList(); - infoDlg.clearCwaPane(); - } - infoDlg.setStatesWFOs(); - } - - // Replace the selected watch box with this new watch box - drawingLayer.replaceElement(el, newEl); - - // Set this new element as the currently selected element - // Collections do not need to reset. - if ( !(drawingLayer.getSelectedComp() instanceof DECollection )){ - drawingLayer.setSelected(newEl); - } + WatchBox newEl = (WatchBox)el.copy(); - drawingLayer.removeGhostLine(); + if ( ptSelected ) { - } - - mapEditor.refresh(); + ptSelected = false; - } - } - - return true; - + // re-snap the new watch box + resnapWatchBox( mapEditor, (WatchBox)ghostEl, newEl ); + ((WatchBoxAttrDlg)PgenWatchBoxModifyTool.this.attrDlg).setWatchBox(newEl); + WatchInfoDlg infoDlg = ((WatchBoxAttrDlg)PgenWatchBoxModifyTool.this.attrDlg).getWatchInfoDlg(); + if ( infoDlg != null && infoDlg.getShell()!= null ){ + if ( ! infoDlg.isCountyLock()){ + newEl.clearCntyList(); + infoDlg.clearCwaPane(); + } + infoDlg.setStatesWFOs(); + } + + // Replace the selected watch box with this new watch box + drawingLayer.replaceElement(el, newEl); + + // Set this new element as the currently selected element + // Collections do not need to reset. + if ( !(drawingLayer.getSelectedComp() instanceof DECollection )){ + drawingLayer.setSelected(newEl); + } + + drawingLayer.removeGhostLine(); + + } + + mapEditor.refresh(); + + } + return true; + } + else if ( button == 3 ) { + + // Close the attribute dialog and do the cleanup. + if ( PgenWatchBoxModifyTool.this.attrDlg != null ) { + PgenWatchBoxModifyTool.this.attrDlg.close(); + } + + PgenWatchBoxModifyTool.this.attrDlg = null; + + drawingLayer.removeGhostLine(); + ptSelected = false; + drawingLayer.removeSelected(); + mapEditor.refresh(); + PgenUtil.setSelectingMode(); + + return true; + + } + else{ + + return false; + + } } } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchStatusLineDrawingTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchStatusLineDrawingTool.java index 9a284f4f2b..a51b6dbd22 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchStatusLineDrawingTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenWatchStatusLineDrawingTool.java @@ -139,73 +139,84 @@ public class PgenWatchStatusLineDrawingTool extends AbstractPgenDrawingTool{ } else if ( button == 3 ) { - - if ( points.size() == 0 ) { - - //close the line attr dialog - if ( attrDlg != null ) attrDlg.close(); - attrDlg = null; - - //return to watch modifying tool - PgenUtil.loadWatchBoxModifyTool(wb); - - //set the watch element as selected - drawingLayer.setSelected(wb); - - //open and initialize watch box attr dialog - WatchBoxAttrDlg wbdlg = WatchBoxAttrDlg.getInstance(null); - wbdlg.openSpecDlg( false ); - wbdlg.setDrawableElement(wb); - wbdlg.setMouseHandlerName("Pgen Select"); - wbdlg.setAttrForDlg( (IAttribute)wb ); - wbdlg.enableButtons(); - wbdlg.setPgenCategory(wb.getPgenCategory()); - wbdlg.setPgenType( wb.getPgenType() ); - wbdlg.setDrawingLayer( drawingLayer ); - wbdlg.setMapEditor( mapEditor ); - - - } - else if ( points.size() < 2 ){ - - drawingLayer.removeGhostLine(); - points.clear(); - - mapEditor.refresh(); - - } - else { - - - // create a status line - Line statusLine = new Line(null, attrDlg.getColors(), attrDlg.getLineWidth(), - 1.0, false, false, points, ((ILine)attrDlg).getSmoothFactor(),FillPattern.SOLID, - "Lines","POINTED_ARROW"); - - // add the line to watch DECollection - ((DECollection)wb.getParent()).add(statusLine); - - drawingLayer.removeGhostLine(); - points.clear(); - mapEditor.refresh(); - - } - - return true; - + return true; } else if ( button == 2 ){ - return true; - } else{ - return false; - } } + + + /* + * overrides the function in selecting tool + */ + @Override + public boolean handleMouseUp(int x, int y, int button){ + if ( !drawingLayer.isEditable() || shiftDown ) return false; + + if (button == 3) { + + if ( points.size() == 0 ) { + + //close the line attr dialog + if ( attrDlg != null ) attrDlg.close(); + attrDlg = null; + + //return to watch modifying tool + PgenUtil.loadWatchBoxModifyTool(wb); + + //set the watch element as selected + drawingLayer.setSelected(wb); + + //open and initialize watch box attr dialog + WatchBoxAttrDlg wbdlg = WatchBoxAttrDlg.getInstance(null); + wbdlg.openSpecDlg( false ); + wbdlg.setDrawableElement(wb); + wbdlg.setMouseHandlerName("Pgen Select"); + wbdlg.setAttrForDlg( (IAttribute)wb ); + wbdlg.enableButtons(); + wbdlg.setPgenCategory(wb.getPgenCategory()); + wbdlg.setPgenType( wb.getPgenType() ); + wbdlg.setDrawingLayer( drawingLayer ); + wbdlg.setMapEditor( mapEditor ); + + + } + else if ( points.size() < 2 ){ + + drawingLayer.removeGhostLine(); + points.clear(); + + mapEditor.refresh(); + + } + else { + + // create a status line + Line statusLine = new Line(null, attrDlg.getColors(), attrDlg.getLineWidth(), + 1.0, false, false, points, ((ILine)attrDlg).getSmoothFactor(),FillPattern.SOLID, + "Lines","POINTED_ARROW"); + + // add the line to watch DECollection + ((DECollection)wb.getParent()).add(statusLine); + + drawingLayer.removeGhostLine(); + points.clear(); + mapEditor.refresh(); + + } + return true; + } + else { + return false; + } + } + + /* * (non-Javadoc) * From bfcb36eeac37a8e42c45932fbfae5855a6632ec5 Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Tue, 20 Jan 2015 11:52:37 -0600 Subject: [PATCH 05/19] ensure PGEN appears in thinclient D2D Tools menu Change-Id: Ib02d9f5f3c63edd963129e742da9c3b3e09e89fa Former-commit-id: 173c250aa3fd9d3e5b35283b10eb5f37a4732a3a --- .../localization/menus/tools/baseToolsMenu.xml | 2 +- ncep/gov.noaa.nws.ncep.ui.pgen/plugin.xml | 17 +++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/cave/com.raytheon.viz.awipstools/localization/menus/tools/baseToolsMenu.xml b/cave/com.raytheon.viz.awipstools/localization/menus/tools/baseToolsMenu.xml index 05ba77e34e..69fc7f87bc 100644 --- a/cave/com.raytheon.viz.awipstools/localization/menus/tools/baseToolsMenu.xml +++ b/cave/com.raytheon.viz.awipstools/localization/menus/tools/baseToolsMenu.xml @@ -59,7 +59,7 @@ + menuText="LAPS tools..." id="lapsTools" /> diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/plugin.xml b/ncep/gov.noaa.nws.ncep.ui.pgen/plugin.xml index 8e2890bc70..277850d1ab 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/plugin.xml +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/plugin.xml @@ -588,21 +588,14 @@ - + + label="PGEN"> - - - - - - + + From b14d970ba781bc50e5676603e9202efdfc6a1264 Mon Sep 17 00:00:00 2001 From: Bingfan Yin Date: Fri, 30 Jan 2015 11:43:41 -0500 Subject: [PATCH 06/19] VLab Issue #5413 - Fixed several issues for PGEN in D2D 1. Open D2D procedure when PGEN is up. 2. PGEN interpolation tool exception. 3. Clear button does not close PGEN palette. 4. PGEN contour circle dialog issue. 5. Switch perspective when PGEN is running. Change-Id: I92f0b71043ab415b088ad933398208fc53287dbc Former-commit-id: 62d796b74b9ca1b5b0239c4e322808e2300b874e --- .../noaa/nws/ncep/ui/pgen/PgenSession.java | 14 +++++++++- .../gov/noaa/nws/ncep/ui/pgen/PgenUtil.java | 4 +-- .../ui/pgen/attrdialog/ContoursAttrDlg.java | 27 +++++++++++++++++++ .../ui/pgen/palette/PgenPaletteAction.java | 23 ++++++++++++++++ .../ui/pgen/palette/PgenPaletteWindow.java | 10 ++++++- .../ncep/ui/pgen/rsc/PgenResourceData.java | 16 +++++++++-- .../ui/pgen/tools/PgenInterpolationTool.java | 16 ++++++++++- 7 files changed, 103 insertions(+), 7 deletions(-) diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenSession.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenSession.java index 3a7171600e..b44e167e6d 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenSession.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenSession.java @@ -59,7 +59,8 @@ import com.raytheon.viz.ui.perspectives.VizPerspectiveListener; * ------------ ---------- ----------- -------------------------- * 12/14 R5413 B. Yin Added IPartListener2 and IRenderableDisplayChangedListener * to make the swapping in D2D work - * 12/14 R5413 B. Yin Added exception handling, perspective id, and endSession. + * 12/14 R5413 B. Yin Added exception handling, perspective id, and endSession. + * 01/15 R5413 B. Yin Added closePalette method. * */ @@ -468,5 +469,16 @@ public class PgenSession implements IPartListener2, public void endSession(){ instance = null; } + + public void closePalette(){ + if ( palette != null ){ + if ( PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getActivePage() != null ){ + PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getActivePage().hideView(palette); + removePalette(); + } + } + } } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenUtil.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenUtil.java index c9d44664a6..1367e4ea53 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenUtil.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenUtil.java @@ -2078,9 +2078,9 @@ public class PgenUtil { ResourceList rscList = disp.getDescriptor().getResourceList(); for (ResourcePair rp : rscList) { - AbstractVizResource rsc = rp.getResource(); + AbstractVizResource rsc = rp.getResource(); - if (rsc.getClass() == rscClass) { + if ( rsc != null && rsc.getClass() == rscClass) { return rsc; } } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/attrdialog/ContoursAttrDlg.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/attrdialog/ContoursAttrDlg.java index affe9a9579..da4830c743 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/attrdialog/ContoursAttrDlg.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/attrdialog/ContoursAttrDlg.java @@ -116,6 +116,7 @@ import com.vividsolutions.jts.geom.Coordinate; * 05/14 TTR1008 J. Wu Set default contour parameters through settings_tbl.xml. * 05/14 TTR990 J. Wu Set default attributes for different contour labels. * 08/14 ? J. Wu "Edit" line color should go to contoursAttrSettings to take effect.. + * 01/15 R5413 B. Yin Added open methods for circle and line dialogs. * * * @@ -2300,6 +2301,19 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, this.close(); } + /** + * Open the dialog if it doesn't exist. + */ + @Override + public int open() { + + if (this.getShell() == null || this.getShell().isDisposed()) { + return super.open(); + } else { + return CANCEL; + } + } + /** * closes the line attribute dialog only */ @@ -2469,6 +2483,19 @@ public class ContoursAttrDlg extends AttrDlg implements IContours, } this.close(); } + + /** + * Open the dialog if it doesn't exist. + */ + @Override + public int open() { + + if (this.getShell() == null || this.getShell().isDisposed()) { + return super.open(); + } else { + return CANCEL; + } + } /** * closes the circle attribute dialog only diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteAction.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteAction.java index b7fc35af78..0f905d764a 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteAction.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteAction.java @@ -9,6 +9,7 @@ package gov.noaa.nws.ncep.ui.pgen.palette; import gov.noaa.nws.ncep.ui.pgen.PGenRuntimeException; +import gov.noaa.nws.ncep.ui.pgen.PgenSession; import gov.noaa.nws.ncep.ui.pgen.PgenStaticDataProvider; import gov.noaa.nws.ncep.ui.pgen.PgenUtil; //import gov.noaa.nws.ncep.viz.ui.display.NCMapEditor; @@ -28,6 +29,8 @@ import org.eclipse.ui.internal.WorkbenchPage; import com.raytheon.uf.viz.core.maps.display.VizMapEditor; import com.raytheon.viz.ui.EditorUtil; import com.raytheon.viz.ui.editor.AbstractEditor; +import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager; +import com.raytheon.viz.ui.perspectives.VizPerspectiveListener; public class PgenPaletteAction extends AbstractHandler { @@ -48,6 +51,26 @@ public class PgenPaletteAction extends AbstractHandler { return null; } + AbstractVizPerspectiveManager pMngr = VizPerspectiveListener.getCurrentPerspectiveManager(); + if ( pMngr != null && pMngr.getPerspectiveId() != PgenSession.getInstance().getPerspectiveId() ){ + + if (PgenSession.getInstance().getPgenPalette() == null ){ + //if PGEN palette is closed + PgenSession.getInstance().setPerspectiveId(pMngr.getPerspectiveId() ); + } + else { + // if PGEN palette is open in another perspective + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + MessageBox mb = new MessageBox(shell, SWT.ICON_WARNING + | SWT.OK); + + int idxLastDot = PgenSession.getInstance().getPerspectiveId().lastIndexOf('.'); + mb.setMessage( "A PGEN session is alreadly running in perspective " + PgenSession.getInstance().getPerspectiveId().substring(++idxLastDot) + "!"); + mb.open(); + return null; + } + } + /* * The viewID string is in the XML file for PGEN extension point. */ diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteWindow.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteWindow.java index aa871179f4..c6a23a37d1 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteWindow.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteWindow.java @@ -112,6 +112,7 @@ import com.raytheon.viz.ui.tools.AbstractModalTool; * 08/13 TTR696/774 J. Wu Reset title/Close product manage dialog. * 11/13 #1081 B. Yin Get selected DE to change front/line type. * 12/14 R5413 B. Yin Removed unused variables, loops. + * 01/15 R5413 B. Yin Set perspective ID and editor for PGEN session. * * * @@ -391,8 +392,15 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener, * the PgenSession */ PgenResource current = PgenUtil.findPgenResource(null); - if (current != null) + if (current != null) { PgenSession.getInstance().setResource(current); + PgenUtil.setSelectingMode(); + + AbstractEditor actEditor = PgenUtil.getActiveEditor(); + if ( actEditor != null && !PgenSession.getInstance().getEditors().contains(actEditor)){ + PgenSession.getInstance().getEditors().add(actEditor); + } + } } diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResourceData.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResourceData.java index 8c2fecb9ba..63c30780d5 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResourceData.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResourceData.java @@ -44,6 +44,11 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.swt.graphics.Image; @@ -55,6 +60,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; 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.rsc.AbstractResourceData; import com.raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType; @@ -73,6 +79,8 @@ import com.vividsolutions.jts.geom.Coordinate; * @author sgilbert * */ +@XmlRootElement +@XmlAccessorType(XmlAccessType.NONE) public class PgenResourceData extends AbstractResourceData implements CommandStackListener { private static final transient IUFStatusHandler statusHandler = UFStatus @@ -745,6 +753,8 @@ public class PgenResourceData extends AbstractResourceData implements public synchronized void cleanup(BufferedImage paneImage) { closeDialogs(); + PgenSession.getInstance().closePalette(); + numberOfResources--; if (numberOfResources != 0){ return; // not ready yet @@ -767,10 +777,12 @@ public class PgenResourceData extends AbstractResourceData implements storeAllProducts(); // saveProducts(autoSaveFilename, multiSave); - if (PgenUtil.getPgenMode() == PgenMode.SINGLE) + if (PgenUtil.getPgenMode() == PgenMode.SINGLE){ PgenUtil.resetResourceData(); + } + deactivatePgenTools(); - + } /** diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenInterpolationTool.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenInterpolationTool.java index 564b951042..384dfde9bd 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenInterpolationTool.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/tools/PgenInterpolationTool.java @@ -43,6 +43,7 @@ import gov.noaa.nws.ncep.ui.pgen.gfa.Gfa; * 04/11 #? B. Yin Re-factor IAttribute * 11/12 #? J. Wu Added GFA * 07/13 #? J. Wu Interpolate GFA's top/bottom + * 01/15 R5413 B. Yin Clear status when de-activate. * * * @author S. Gilbert @@ -76,7 +77,20 @@ public class PgenInterpolationTool extends AbstractPgenDrawingTool { verifySymbol = new Symbol(null, new Color[] { new Color(255,0,0) }, 1.0f, 1.0, false, null, "Marker", "FILLED_BOX" ); } - + + /* + * (non-Javadoc) + * + * @see com.raytheon.viz.ui.tools.AbstractModalTool#deactivateTool() + */ + // @Override + public void deactivateTool() { + + status = SELECT_STATUS.START; + super.deactivateTool(); + + } + /** * Creates and returns the current mouse handler. * @return From a44b6f1766bf012a589d6da75f72d4ef0de8cee2 Mon Sep 17 00:00:00 2001 From: Bingfan Yin Date: Fri, 30 Jan 2015 11:53:54 -0500 Subject: [PATCH 07/19] VLab Issue #5413 - Added three files modified but not committed last time. Change-Id: Ifc790ecffca5a2dde99f771824a188241962c3dd Former-commit-id: e2179266b509b73155abaaed5b046b5cf349c376 --- .../src/gov/noaa/nws/ncep/ui/pgen/PgenUtil.java | 4 +++- .../nws/ncep/ui/pgen/palette/PgenPaletteAction.java | 13 +++++++++++++ .../noaa/nws/ncep/ui/pgen/rsc/PgenResourceData.java | 11 ++++++++--- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenUtil.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenUtil.java index 1367e4ea53..f6368f187a 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenUtil.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/PgenUtil.java @@ -146,7 +146,9 @@ import com.vividsolutions.jts.linearref.LocationIndexedLine; * 07/14 Chin Chen In latlonToPixel(), make sure not to add null pixel to its return pixel array * 08/14 TTR962 J. Wu Add replaceWithDate to format output file with DD, MM, YYYY, HH. * 12/14 R5413 B. Yin Add a listener for D2D swapping pane - * + * 12/14 R5413 B. Yin Check null in findResource + * + * * @author * @version 1 diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteAction.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteAction.java index 0f905d764a..725e7342fe 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteAction.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/palette/PgenPaletteAction.java @@ -32,6 +32,19 @@ import com.raytheon.viz.ui.editor.AbstractEditor; import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager; import com.raytheon.viz.ui.perspectives.VizPerspectiveListener; +/** + * + *
+ * SOFTWARE HISTORY
+ * Date       	Ticket#		Engineer	Description
+ * ------------	----------	-----------	--------------------------
+ * 01/15		#5413		B. Yin   	Added meesage box if PGEN is running in another perspective
+ *
+ * 
+ * + * @author ? + */ + public class PgenPaletteAction extends AbstractHandler { @SuppressWarnings("restriction") diff --git a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResourceData.java b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResourceData.java index 63c30780d5..bb803c34a9 100644 --- a/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResourceData.java +++ b/ncep/gov.noaa.nws.ncep.ui.pgen/src/gov/noaa/nws/ncep/ui/pgen/rsc/PgenResourceData.java @@ -46,7 +46,6 @@ import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import org.eclipse.jface.dialogs.MessageDialog; @@ -60,7 +59,6 @@ import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; 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.rsc.AbstractResourceData; import com.raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType; @@ -75,10 +73,17 @@ import com.vividsolutions.jts.geom.Coordinate; * Contains all the PGEN Products, layers, and Elements behind the PgenResource. * Also holds the command manager to undo/redo changes to the data in the * productlist + *
+ * SOFTWARE HISTORY
+ * Date       	Ticket#		Engineer	Description
+ * ------------	----------	-----------	--------------------------
+ * 01/15		#5413		B. Yin   	Close PGEN palette in cleanup
+ * 
+ * 
* * @author sgilbert - * */ + @XmlRootElement @XmlAccessorType(XmlAccessType.NONE) public class PgenResourceData extends AbstractResourceData implements From aec617b1ebd2330c296fa869ce521887c37182ad Mon Sep 17 00:00:00 2001 From: Joshua Watson Date: Thu, 5 Feb 2015 09:26:20 -0500 Subject: [PATCH 08/19] VLab Issue #5238 - serverConfig.py - changed parmsGFSLAMPGrid to GFSLAMPGridPARMS, changed serverConfig.Vis to Vis on that same line. pqact.conf.template - fixed typo on line 223 FLE to FILE, line 286 missing a period in pattern; fixes #5238 Change-Id: Ia83e3576613683fa58a7631150d2d3132937a7b4 Former-commit-id: 12e0aeea9fa6b2dc7de297aee0ff7d1de3a99111 --- rpms/awips2.core/Installer.ldm/patch/etc/pqact.conf.template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpms/awips2.core/Installer.ldm/patch/etc/pqact.conf.template b/rpms/awips2.core/Installer.ldm/patch/etc/pqact.conf.template index dde5cceab9..dc85a93ddf 100644 --- a/rpms/awips2.core/Installer.ldm/patch/etc/pqact.conf.template +++ b/rpms/awips2.core/Installer.ldm/patch/etc/pqact.conf.template @@ -221,7 +221,7 @@ HDS ^([LM].[ABCDEFGHMNRST].{1,3}) (KWB.) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/([ # that edit also removed the HPCGuide data. Josh Watson NGRID ^([LM][ABCDFGH]U...) (KWBN) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/([^/]*)/#([^/]*)/([0-9]{8})([0-9]{4})(F[0-9]{3})/([^/]*) - FLE -overwrite -log -close -edex /data_store/\6/(\3:yyyy)(\3:mm)\3/\4/\7/GRID\8/\(10)Z_\(11)_\(12)-\1_\2_\3\4\5_(seq).\6.%Y%m%d%H + FILE -overwrite -log -close -edex /data_store/\6/(\3:yyyy)(\3:mm)\3/\4/\7/GRID\8/\(10)Z_\(11)_\(12)-\1_\2_\3\4\5_(seq).\6.%Y%m%d%H # DR 17426 # 2.5km CONUS GMOS @@ -283,7 +283,7 @@ NGRID ^([LM].[EF].{1,3}) (KWBD) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/([^/]*)/#([ # The noaaportIngester does not yet read a grib2 SBN file with more than one message. NGRID ^(L...[0-9][0-9]) (KMDL) (..)(..)(..) FILE -overwrite -log -close -edex /data_store/grib2/(\3:yyyy)(\3:mm)\3/\4/LAMP/GRID184/\1_\2_\3\4\5_(seq).grib2.%Y%m%d%H -NGRID ^(L[CDEF]U[0-9][0-9]) (KWNO) (..)(..)(..) +NGRID ^(L[CDEF]U.[0-9][0-9]) (KWNO) (..)(..)(..) FILE -overwrite -log -close -edex /data_store/grib2/(\3:yyyy)(\3:mm)\3/\4/LAMP/GRID184/\1_\2_\3\4\5_(seq).grib2.%Y%m%d%H # AWIPS1: GRID ^L[UV]I.*KWBJ* /Grid/SBN/rawGrib2 From de9a5fd3b3738229d9aaec49acfbf15eb8baf768 Mon Sep 17 00:00:00 2001 From: David Friedman Date: Thu, 5 Feb 2015 16:21:48 +0000 Subject: [PATCH 09/19] ASM #17066 - afoslookup entry for site KEY is missing Change-Id: I8f2ac59c416a2a9f5f28fb72993c5947fb96c126 Former-commit-id: 49c3a36159f66eb35b70bb76f210b36b2c7140f9 --- .../res/scripts/afosLookupLoader.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.text/res/scripts/afosLookupLoader.sql b/edexOsgi/com.raytheon.uf.common.dataplugin.text/res/scripts/afosLookupLoader.sql index cb386f3e6c..a8c10561a7 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.text/res/scripts/afosLookupLoader.sql +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.text/res/scripts/afosLookupLoader.sql @@ -266,6 +266,7 @@ insert into afoslookup (origin, ccc) values ('KJEF','STL'); insert into afoslookup (origin, ccc) values ('KJFK','NYC'); insert into afoslookup (origin, ccc) values ('KJKL','SDF'); insert into afoslookup (origin, ccc) values ('KKCI','MKC'); +insert into afoslookup (origin, ccc) values ('KKEY','MIA'); insert into afoslookup (origin, ccc) values ('KKRF','MKC'); insert into afoslookup (origin, ccc) values ('KLAF','IND'); insert into afoslookup (origin, ccc) values ('KLAN','ARB'); From 05c119663f364f7d22e7e5c89d1edf758363c663 Mon Sep 17 00:00:00 2001 From: Joshua Watson Date: Fri, 6 Feb 2015 16:06:37 -0500 Subject: [PATCH 10/19] VLab Issue #6363 - Fixed malformed xml in GFSLAMPGridded.xml, changed ClgHgt to CigHgt in serverConfig.py and GFSLAMPGrid.py smart init; fixes #6363 Change-Id: Ibee986bdef73cdb6883fdd50e725d28d3838c848 Former-commit-id: 0017f74dfa8ce2c3dd386ea89547ec76f87bfdff --- .../fields/planview-timeseries/sfc2d/GFSLAMPGridded.xml | 2 +- .../utility/edex_static/base/config/gfe/serverConfig.py | 4 ++-- .../utility/edex_static/base/smartinit/GFSLAMPGrid.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cave/com.raytheon.viz.volumebrowser/localization/menus/volumebrowser/fields/planview-timeseries/sfc2d/GFSLAMPGridded.xml b/cave/com.raytheon.viz.volumebrowser/localization/menus/volumebrowser/fields/planview-timeseries/sfc2d/GFSLAMPGridded.xml index 730632dce7..a28ae1b6b3 100644 --- a/cave/com.raytheon.viz.volumebrowser/localization/menus/volumebrowser/fields/planview-timeseries/sfc2d/GFSLAMPGridded.xml +++ b/cave/com.raytheon.viz.volumebrowser/localization/menus/volumebrowser/fields/planview-timeseries/sfc2d/GFSLAMPGridded.xml @@ -21,7 +21,7 @@ - contribute xsi:type="menuItem" menuText="Temp Anl Uncertainty" + diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py index 774d429d85..2debb5cca5 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py @@ -391,7 +391,7 @@ AstroTide = ("AstroTide", SCALAR, "ft", "Astro Tide", 20.0, -8.0, 1, NO) StormSurge = ("StormSurge", SCALAR, "ft", "Storm Surge", 30.0, -5.0, 1, NO) # Parm for Aviation/GFSLAMPGrid -ClgHgt=("ClgHgt",SCALAR,"ft","Ceiling Height",25000.0,-100.0,0,NO) +CigHgt=("CigHgt",SCALAR,"ft","Ceiling Height",25000.0,-100.0,0,NO) #--------------------------------------------------------------------------- # @@ -2055,7 +2055,7 @@ ENPwave_parms = [([WindWaveHeight, WaveHeight, SurfHeight, Wind], TC6), ([Swell, Swell2, Period, Period2], TC6)] # GFSLAMPGrid -GFSLAMPGridPARMS=[([Temp, Td, Vis, ClgHgt],TC1)] +GFSLAMPGridPARMS=[([Temp, Td, Vis, CigHgt],TC1)] #--------------------------------------------------------------------------- # Databases for a site. diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/GFSLAMPGrid.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/GFSLAMPGrid.py index f5a1128746..82a0ba8351 100755 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/GFSLAMPGrid.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/GFSLAMPGrid.py @@ -12,7 +12,7 @@ class GFSLAMPForecaster(Forecaster): def __init__(self): Forecaster.__init__(self, "GFSLAMP","GFSLAMP") - def calcClgHgt(self, cc_CLG): + def calcCigHgt(self, cc_CLG): ceil = cc_CLG * 3.280839 ceil = where(less(cc_CLG, 0), -99., ceil) return ceil From cecc02d5b1780f90088373802c67b0da0ae3bd7d Mon Sep 17 00:00:00 2001 From: Michael Gamazaychikov Date: Tue, 10 Feb 2015 10:33:48 -0500 Subject: [PATCH 11/19] ASM #17103 - New dx3/4 hardware can drive EDEX OoM. Change-Id: I0e466f39b50661cc0909158611aab2f7fdda06ba Former-commit-id: e4444751f61adccf1cb62adf0f6cb1abc4ab6384 --- edexOsgi/build.edex/esb/etc/ingest.sh | 2 +- edexOsgi/build.edex/esb/etc/ingestDat.sh | 2 +- edexOsgi/build.edex/esb/etc/ingestGrib.sh | 2 +- edexOsgi/build.edex/esb/etc/request.sh | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/edexOsgi/build.edex/esb/etc/ingest.sh b/edexOsgi/build.edex/esb/etc/ingest.sh index e191a924ac..10c0952327 100644 --- a/edexOsgi/build.edex/esb/etc/ingest.sh +++ b/edexOsgi/build.edex/esb/etc/ingest.sh @@ -20,7 +20,7 @@ ## export INIT_MEM=512 # in Meg -export MAX_MEM=896 # in Meg +export MAX_MEM=1280 # in Meg export EDEX_DEBUG_PORT=5006 export EDEX_JMX_PORT=1617 diff --git a/edexOsgi/build.edex/esb/etc/ingestDat.sh b/edexOsgi/build.edex/esb/etc/ingestDat.sh index b6569bde6b..65b2bfb0af 100644 --- a/edexOsgi/build.edex/esb/etc/ingestDat.sh +++ b/edexOsgi/build.edex/esb/etc/ingestDat.sh @@ -19,7 +19,7 @@ # further licensing information. ## export INIT_MEM=256 # in Meg -export MAX_MEM=1792 # in Meg +export MAX_MEM=1856 # in Meg export METADATA_POOL_MAX=25 export EDEX_DEBUG_PORT=5008 diff --git a/edexOsgi/build.edex/esb/etc/ingestGrib.sh b/edexOsgi/build.edex/esb/etc/ingestGrib.sh index 7874cfbeb0..38dcb21d00 100644 --- a/edexOsgi/build.edex/esb/etc/ingestGrib.sh +++ b/edexOsgi/build.edex/esb/etc/ingestGrib.sh @@ -19,7 +19,7 @@ # further licensing information. ## export INIT_MEM=128 # in Meg -export MAX_MEM=512 # in Meg +export MAX_MEM=544 # in Meg export METADATA_POOL_MAX=10 export EDEX_DEBUG_PORT=5007 diff --git a/edexOsgi/build.edex/esb/etc/request.sh b/edexOsgi/build.edex/esb/etc/request.sh index 536081a2f2..265186eb3a 100644 --- a/edexOsgi/build.edex/esb/etc/request.sh +++ b/edexOsgi/build.edex/esb/etc/request.sh @@ -20,9 +20,9 @@ ## export INIT_MEM=128 # in Meg if [ "$EDEX_ARCH" == "64-bit" ]; then - export MAX_MEM=2048 # in Meg + export MAX_MEM=2144 # in Meg else - export MAX_MEM=1280 # in Meg + export MAX_MEM=1376 # in Meg fi export SERIALIZE_POOL_MAX_SIZE=24 export SERIALIZE_STREAM_INIT_SIZE_MB=2 From ea046bedd33a4f81f6efacd8d2d282e67ace1da5 Mon Sep 17 00:00:00 2001 From: Michael Gamazaychikov Date: Tue, 10 Feb 2015 14:46:10 -0500 Subject: [PATCH 12/19] ASM #16736 - OHD's RunReportAlarm Service does not notify EDEX's AlarmAlertNotification Observer. Change-Id: Ib5c6bb89c57022b61260adbaa08760e5df05ad61 Former-commit-id: 20efa852dcc64c80890abed6b2882a205b37cf43 --- .../ohd/reportalarm/RunReportAlarmSrv.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/reportalarm/RunReportAlarmSrv.java b/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/reportalarm/RunReportAlarmSrv.java index 2578eb3705..00946dbe15 100644 --- a/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/reportalarm/RunReportAlarmSrv.java +++ b/edexOsgi/com.raytheon.uf.edex.ohd/src/com/raytheon/uf/edex/ohd/reportalarm/RunReportAlarmSrv.java @@ -150,19 +150,16 @@ public final class RunReportAlarmSrv { private static void saveProductToTextDb(final String productText, final String productId) throws Exception { TextDB textdb = new TextDB(); - long statusCode = textdb.writeProduct(productId, productText, true, + long insertTime = textdb.writeProduct(productId, productText, true, null); - // Set the current time and send product alarm alert. - Date d = new Date(System.currentTimeMillis()); - d.setTime(statusCode); - AlarmAlertUtil.sendProductAlarmAlert(productId, - String.valueOf(d.getTime()), - true); - - if (statusCode != Long.MIN_VALUE) { - statusHandler.info("Product successfully sent"); + if (insertTime != Long.MIN_VALUE) { + // Set the write time and send product alarm alert. + Date d = new Date(); + d.setTime(insertTime); + AlarmAlertUtil.sendProductAlarmAlert(productId, d, true); + statusHandler.info("Saved product to textdb successfully."); } else { - statusHandler.error("Product send error detected."); + statusHandler.error("Error detected saving product to textdb."); } } } From 56627a901294b32264d4f0f6c687d5c908c3beae Mon Sep 17 00:00:00 2001 From: Joshua Watson Date: Wed, 11 Feb 2015 09:04:44 -0500 Subject: [PATCH 13/19] VLab Issue #6421 - Source in GFSLAMPGrid.py smart init changed to GFSLAMPGrid. Visibility calculation streamlined; fixes #6421 Change-Id: Ic63cb16c30aff1705d9753017a43ba9c59b02d51 Former-commit-id: c570ea9f982665f3cb560c665cea6357c11841ce --- .../utility/edex_static/base/smartinit/GFSLAMPGrid.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/GFSLAMPGrid.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/GFSLAMPGrid.py index 82a0ba8351..2472317bc1 100755 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/GFSLAMPGrid.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/GFSLAMPGrid.py @@ -8,17 +8,17 @@ ################################################################################ # Import existing model database initialization parameters from Init import * -class GFSLAMPForecaster(Forecaster): +class GFSLAMPGridForecaster(Forecaster): def __init__(self): - Forecaster.__init__(self, "GFSLAMP","GFSLAMP") + Forecaster.__init__(self, "GFSLAMPGrid","GFSLAMPGrid") def calcCigHgt(self, cc_CLG): - ceil = cc_CLG * 3.280839 + ceil = cc_CLG / 0.3048 ceil = where(less(cc_CLG, 0), -99., ceil) return ceil def calcVis(self, vis_SFC): - return (vis_SFC * 3.2808) / 5279.85564 + return (vis_SFC / 0.3048 / 5280.0) def calcT(self, t_FHAG2): return self.KtoF(t_FHAG2) @@ -30,4 +30,4 @@ class GFSLAMPForecaster(Forecaster): # Set this file up to run with SmartInitialization def main(): - GFSLAMPForecaster().run() + GFSLAMPGridForecaster().run() From c6c9209f84ec864726fd6936d60d9632bd43be4f Mon Sep 17 00:00:00 2001 From: David Friedman Date: Wed, 11 Feb 2015 15:10:34 +0000 Subject: [PATCH 14/19] ASM #17092 - Add cronOTRs.xml to radar NDM files Change-Id: I46bf0728607737509ad97f6d2ed1803b3b10eeff Former-commit-id: fc9eb096ce16005be0a80eff3b4728f279f75cf5 --- .../com/raytheon/rcm/event/ConfigEvent.java | 5 +- .../raytheon/rcm/coll/RequestScheduler.java | 51 +++++++++++++++---- .../config/std/StandardConfigProvider.java | 10 ++++ .../res/spring/rpgenvdata-spring.xml | 4 ++ 4 files changed, 59 insertions(+), 11 deletions(-) diff --git a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/ConfigEvent.java b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/ConfigEvent.java index 7475d52aa8..e8e3d65d54 100755 --- a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/ConfigEvent.java +++ b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/event/ConfigEvent.java @@ -37,13 +37,16 @@ import com.raytheon.rcm.config.RadarConfig; * 2009-04-22 #1693 D. Friedman Initial checkin * ... * 2014-02-03 DR 14762 D. Friedman Add Category enum + * 2015-02-11 DR 17092 D. Friedman Handle NDM cronOTRs.xml updates. * * */ @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class ConfigEvent { - public static enum Category { GLOBAL_CONFIG, RADAR_CONFIG, PROD_DISTRIBUTION, NATIONAL_RPS_LISTS } + public static enum Category { + GLOBAL_CONFIG, RADAR_CONFIG, PROD_DISTRIBUTION, NATIONAL_RPS_LISTS, CRON_OTRS + } private String radarID; // null indicates global configuration change. private RadarConfig oldConfig; diff --git a/RadarServer/com.raytheon.rcm.server/src/com/raytheon/rcm/coll/RequestScheduler.java b/RadarServer/com.raytheon.rcm.server/src/com/raytheon/rcm/coll/RequestScheduler.java index c6623619bd..0eacd2223a 100644 --- a/RadarServer/com.raytheon.rcm.server/src/com/raytheon/rcm/coll/RequestScheduler.java +++ b/RadarServer/com.raytheon.rcm.server/src/com/raytheon/rcm/coll/RequestScheduler.java @@ -27,6 +27,7 @@ import org.quartz.impl.StdSchedulerFactory; import com.raytheon.rcm.config.Configuration; import com.raytheon.rcm.config.RadarConfig; import com.raytheon.rcm.config.Util; +import com.raytheon.rcm.event.ConfigEvent; import com.raytheon.rcm.event.OtrEvent; import com.raytheon.rcm.event.RadarEventAdapter; import com.raytheon.rcm.event.RadarEventListener; @@ -37,6 +38,19 @@ import com.raytheon.rcm.request.Request; import com.raytheon.rcm.server.Log; import com.raytheon.rcm.server.RadarServer; +/** + * Represents the standard configuration model of the AWIPS 2 RadarServer. + * + *
+ *
+ * SOFTWARE HISTORY
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * ...
+ * 2015-02-11   DR 17092   D. Friedman Handle NDM cronOTRs.xml updates.
+ * 
+ * + */ public class RequestScheduler extends RadarEventAdapter { // Quartz job detail properties @@ -46,8 +60,6 @@ public class RequestScheduler extends RadarEventAdapter { private RadarServer radarServer; private OTRManager otrManager; - private CronOTRConfiguration cronConfig; - private Scheduler scheduler; private Random random = new Random(); @@ -70,16 +82,29 @@ public class RequestScheduler extends RadarEventAdapter { OTRManager.class.getSimpleName()); return; } - + + loadConfiguration(); + } + + private synchronized void loadConfiguration() { + if (scheduler != null) { + try { + scheduler.shutdown(); + } catch (SchedulerException e) { + Log.errorf("Error stopping cron-OTR scheduler: %s", e); + } + } + try { scheduler = StdSchedulerFactory.getDefaultScheduler(); scheduler.start(); } catch (SchedulerException e) { - Log.errorf("Failed to start cron-OTR scheduler: %s", e); + Log.errorf("Failed to start cron-OTR scheduler: %s", e); scheduler = null; } - + if (scheduler != null) { + CronOTRConfiguration cronConfig = null; InputStream ins = null; try { ins = radarServer.getConfiguration().getDropInData("cronOTRs.xml"); @@ -91,7 +116,7 @@ public class RequestScheduler extends RadarEventAdapter { } catch (Exception e) { Log.errorf("Error loading cron-OTR configuration: %s", e); } - + if (cronConfig != null) { int jobIndex = 1; // Used to generate unique JobDetail names for (CronOTR cronOTR : cronConfig.cronOTRList) { @@ -104,7 +129,7 @@ public class RequestScheduler extends RadarEventAdapter { cronOTR.getCron(), e); continue; } - + JobDetail jd = new JobDetail(name, null, CronOTRJob.class); JobDataMap jdm = jd.getJobDataMap(); jdm.put(SCHEDULER, this); @@ -112,10 +137,10 @@ public class RequestScheduler extends RadarEventAdapter { try { scheduler.scheduleJob(jd, trigger); } catch (Exception e) { - Log.errorf("Error schedule cron \"%s\": %s", + Log.errorf("Error scheduling cron \"%s\": %s", cronOTR.getCron(), e); } - + jobIndex++; } } @@ -179,7 +204,13 @@ public class RequestScheduler extends RadarEventAdapter { runCron(cronOTR); } - + + public void handleConfigEvent(ConfigEvent event) { + if (event.getCategory() == ConfigEvent.Category.CRON_OTRS) { + loadConfiguration(); + } + } + /** * This class declared public only so that it can be instantiated by * Quartz. diff --git a/RadarServer/com.raytheon.rcm.server/src/com/raytheon/rcm/config/std/StandardConfigProvider.java b/RadarServer/com.raytheon.rcm.server/src/com/raytheon/rcm/config/std/StandardConfigProvider.java index 07a6ce68f1..2c5b05a584 100755 --- a/RadarServer/com.raytheon.rcm.server/src/com/raytheon/rcm/config/std/StandardConfigProvider.java +++ b/RadarServer/com.raytheon.rcm.server/src/com/raytheon/rcm/config/std/StandardConfigProvider.java @@ -40,6 +40,8 @@ import com.raytheon.rcm.config.LinkType; import com.raytheon.rcm.config.RadarConfig; import com.raytheon.rcm.config.StandardProductDistInfoDB; import com.raytheon.rcm.config.awips1.Awips1ConfigProvider; +import com.raytheon.rcm.event.ConfigEvent; +import com.raytheon.rcm.event.RadarEventListener; import com.raytheon.rcm.server.Log; @@ -54,6 +56,7 @@ import com.raytheon.rcm.server.Log; * ------------ ---------- ----------- -------------------------- * ... * 2014-02-03 DR 14762 D. Friedman Handle updated NDM config files. + * 2015-02-11 DR 17092 D. Friedman Handle NDM cronOTRs.xml updates. * * */ @@ -62,6 +65,7 @@ public class StandardConfigProvider implements ConfigurationProvider { private static String WSR_88D_PROD_LIST_NAME = "prodList.txt"; private static String TDWR__PROD_LIST_NAME = "tdwrProdList.txt"; private static String WMO_SITE_INFO_NAME = "wmoSiteInfo.txt"; + private static String CRON_OTRS_NAME = "cronOTRs.xml"; private static JAXBContext jaxbContext; private static Unmarshaller u; @@ -266,6 +270,12 @@ public class StandardConfigProvider implements ConfigurationProvider { loadProdListDB(); } else if (WMO_SITE_INFO_NAME.equals(name)) { updateRegionCode(); + } else if (CRON_OTRS_NAME.equals(name)) { + RadarEventListener target = config.getConfigurationEventTarget(); + if (target != null) { + ConfigEvent ev = new ConfigEvent(ConfigEvent.Category.CRON_OTRS); + target.handleConfigEvent(ev); + } } else if (Pattern.matches("^rps-.*OP.*$", name)) { config.notifyNationalRpsLists(); } else { diff --git a/edexOsgi/com.raytheon.edex.rpgenvdata/res/spring/rpgenvdata-spring.xml b/edexOsgi/com.raytheon.edex.rpgenvdata/res/spring/rpgenvdata-spring.xml index e61b917ac3..13088cf66f 100644 --- a/edexOsgi/com.raytheon.edex.rpgenvdata/res/spring/rpgenvdata-spring.xml +++ b/edexOsgi/com.raytheon.edex.rpgenvdata/res/spring/rpgenvdata-spring.xml @@ -32,6 +32,10 @@ + + + + From 6573bd267207f75b96f11254277b9e9ed5ba0e10 Mon Sep 17 00:00:00 2001 From: "Shawn.Hooper" Date: Wed, 11 Feb 2015 12:40:33 -0500 Subject: [PATCH 15/19] ASM #16804 - Check in the required library files Change-Id: Ib84d554ef4723072f8272327b7d00a737ba1405a Former-commit-id: 22fc7ef208aaef87d2ef366f9ae8c0840379139c --- .../lib/native/linux32/library.ohd.pproc.so.REMOVED.git-id | 2 +- .../edex/lib/native/linux32/library.ohd.pproc.so.REMOVED.git-id | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nativeLib/files.native/awipsShare/hydroapps/lib/native/linux32/library.ohd.pproc.so.REMOVED.git-id b/nativeLib/files.native/awipsShare/hydroapps/lib/native/linux32/library.ohd.pproc.so.REMOVED.git-id index 5c80d880d0..8c5d587645 100644 --- a/nativeLib/files.native/awipsShare/hydroapps/lib/native/linux32/library.ohd.pproc.so.REMOVED.git-id +++ b/nativeLib/files.native/awipsShare/hydroapps/lib/native/linux32/library.ohd.pproc.so.REMOVED.git-id @@ -1 +1 @@ -049e7b47e9c8ce3a9839dac563a90ce743b2446c \ No newline at end of file +b0ccb6afd656a3d8b4e26247bfa669f5f9e31291 \ No newline at end of file diff --git a/nativeLib/files.native/edex/lib/native/linux32/library.ohd.pproc.so.REMOVED.git-id b/nativeLib/files.native/edex/lib/native/linux32/library.ohd.pproc.so.REMOVED.git-id index 5c80d880d0..8c5d587645 100644 --- a/nativeLib/files.native/edex/lib/native/linux32/library.ohd.pproc.so.REMOVED.git-id +++ b/nativeLib/files.native/edex/lib/native/linux32/library.ohd.pproc.so.REMOVED.git-id @@ -1 +1 @@ -049e7b47e9c8ce3a9839dac563a90ce743b2446c \ No newline at end of file +b0ccb6afd656a3d8b4e26247bfa669f5f9e31291 \ No newline at end of file From 0ba143cc43eee18614297f193f80485e7593b5b6 Mon Sep 17 00:00:00 2001 From: "Shawn.Hooper" Date: Wed, 11 Feb 2015 13:55:20 -0500 Subject: [PATCH 16/19] ASM #14246 - Check-in updated transmit_rfc_qpe script Change-Id: I26751d39d2b31a345276da722c7a25a9ff8f9508 Former-commit-id: 72dd2f411e10e1eb6a934adf05d7df179b570ded --- .../awipsShare/hydroapps/precip_proc/bin/transmit_rfc_qpe | 5 +---- .../hydroapps/precip_proc/local/bin/transmit_rfc_qpe | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) mode change 100755 => 100644 nativeLib/files.native/awipsShare/hydroapps/precip_proc/bin/transmit_rfc_qpe mode change 100755 => 100644 nativeLib/files.native/awipsShare/hydroapps/precip_proc/local/bin/transmit_rfc_qpe diff --git a/nativeLib/files.native/awipsShare/hydroapps/precip_proc/bin/transmit_rfc_qpe b/nativeLib/files.native/awipsShare/hydroapps/precip_proc/bin/transmit_rfc_qpe old mode 100755 new mode 100644 index 70d65e4a47..1d3c0ff303 --- a/nativeLib/files.native/awipsShare/hydroapps/precip_proc/bin/transmit_rfc_qpe +++ b/nativeLib/files.native/awipsShare/hydroapps/precip_proc/bin/transmit_rfc_qpe @@ -49,14 +49,11 @@ # export PRODUCT_ID=CCCCQPEBIN -export FXA_HOME=/awips/fxa - # # Set up the D2D environment... -. $FXA_HOME/readenv.sh RUN_FROM_DIR=`dirname $0` -. $RUN_FROM_DIR/../../../set_hydro_env +. $RUN_FROM_DIR/../../set_hydro_env export GAQ_LOG_DIR=$(get_apps_defaults gaq_log_dir) export MPE_SEND_QPE_TO_SBN=$(get_apps_defaults mpe_send_qpe_to_sbn) export MPE_SAVE_GRIB=$(get_apps_defaults mpe_save_grib) diff --git a/nativeLib/files.native/awipsShare/hydroapps/precip_proc/local/bin/transmit_rfc_qpe b/nativeLib/files.native/awipsShare/hydroapps/precip_proc/local/bin/transmit_rfc_qpe old mode 100755 new mode 100644 index 70d65e4a47..1d3c0ff303 --- a/nativeLib/files.native/awipsShare/hydroapps/precip_proc/local/bin/transmit_rfc_qpe +++ b/nativeLib/files.native/awipsShare/hydroapps/precip_proc/local/bin/transmit_rfc_qpe @@ -49,14 +49,11 @@ # export PRODUCT_ID=CCCCQPEBIN -export FXA_HOME=/awips/fxa - # # Set up the D2D environment... -. $FXA_HOME/readenv.sh RUN_FROM_DIR=`dirname $0` -. $RUN_FROM_DIR/../../../set_hydro_env +. $RUN_FROM_DIR/../../set_hydro_env export GAQ_LOG_DIR=$(get_apps_defaults gaq_log_dir) export MPE_SEND_QPE_TO_SBN=$(get_apps_defaults mpe_send_qpe_to_sbn) export MPE_SAVE_GRIB=$(get_apps_defaults mpe_save_grib) From 0163ec2871aa4dd718287601397f1e4acdb9ef16 Mon Sep 17 00:00:00 2001 From: Jason Burks Date: Wed, 11 Feb 2015 20:06:54 +0000 Subject: [PATCH 17/19] VLab Issue #6412 - Fixed the problem with ParameterLookup not being registered. As per Nate Jensen recommendation updated the spring configuration to depepnd-on getParameterHandlerRegistered. Also based on his recommendation removed parts from constructor and added them to the decode method that get singleton references for paramlookup and variable dictionary lookup. fixes #6412 Change-Id: Ie3554842b9f029dd62ff73f5edc928bc03e012e4 Former-commit-id: 2ca313195e2e610d4a198884f45dde37ebecfbc6 --- .../res/spring/lma-ingest.xml | 3 ++- .../sport/edex/plugin/lma/LmaDecoder.java | 22 +++++-------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/edexOsgi/gov.nasa.msfc.sport.edex.plugin.lma/res/spring/lma-ingest.xml b/edexOsgi/gov.nasa.msfc.sport.edex.plugin.lma/res/spring/lma-ingest.xml index f33e729fac..0fee28a97e 100755 --- a/edexOsgi/gov.nasa.msfc.sport.edex.plugin.lma/res/spring/lma-ingest.xml +++ b/edexOsgi/gov.nasa.msfc.sport.edex.plugin.lma/res/spring/lma-ingest.xml @@ -8,11 +8,12 @@ - + + Date: Thu, 12 Feb 2015 17:32:05 -0500 Subject: [PATCH 18/19] ASM #15083 - Updates to allow nwps to be released in the gfesuite-server rpm Change-Id: I9ab3fca601120954ebe229d3a4f0871b7b43af28 Former-commit-id: 2c62f45654b0531349fef5e7523c67c94236ce1a --- edexOsgi/com.raytheon.uf.tools.gfesuite/deploy.xml | 13 +++++++++++++ .../Installer.gfesuite-server/component.spec | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/edexOsgi/com.raytheon.uf.tools.gfesuite/deploy.xml b/edexOsgi/com.raytheon.uf.tools.gfesuite/deploy.xml index b2facf28c0..6a2f6ea9e6 100644 --- a/edexOsgi/com.raytheon.uf.tools.gfesuite/deploy.xml +++ b/edexOsgi/com.raytheon.uf.tools.gfesuite/deploy.xml @@ -54,6 +54,7 @@ + @@ -68,8 +69,10 @@ + + @@ -101,6 +104,16 @@ + + + + + + + + + diff --git a/rpms/awips2.core/Installer.gfesuite-server/component.spec b/rpms/awips2.core/Installer.gfesuite-server/component.spec index 5d322ca3fb..bec10fc43a 100644 --- a/rpms/awips2.core/Installer.gfesuite-server/component.spec +++ b/rpms/awips2.core/Installer.gfesuite-server/component.spec @@ -101,9 +101,13 @@ rm -rf ${RPM_BUILD_ROOT} /awips2/GFESuite/bin/* %dir /awips2/GFESuite/hti/bin /awips2/GFESuite/hti/bin/* +%dir /awips2/GFESuite/nwps/bin +/awips2/GFESuite/nwps/bin/* %defattr(755,awips,fxalpha,777) %dir /awips2/GFESuite/hti/etc /awips2/GFESuite/hti/etc/* +%dir /awips2/GFESuite/nwps/domains +/awips2/GFESuite/nwps/domains/* %defattr(644,awips,fxalpha,755) %dir /awips2/GFESuite/bin/src /awips2/GFESuite/bin/src/* From 9d46bf24dc79497f03b581d9a0ccb85919b402bf Mon Sep 17 00:00:00 2001 From: "Sean.Webb" Date: Tue, 17 Feb 2015 12:04:37 -0500 Subject: [PATCH 19/19] ASM #17142 - Fixed nwps dir permissions Change-id: Ibd843098cea02d3f1ea6b75d3e715d804c5c1e37 Former-commit-id: fc7258495581cd1d241f55aba2a8e60053575571 --- rpms/awips2.core/Installer.gfesuite-server/component.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rpms/awips2.core/Installer.gfesuite-server/component.spec b/rpms/awips2.core/Installer.gfesuite-server/component.spec index bec10fc43a..982dd077b4 100644 --- a/rpms/awips2.core/Installer.gfesuite-server/component.spec +++ b/rpms/awips2.core/Installer.gfesuite-server/component.spec @@ -96,6 +96,9 @@ rm -rf ${RPM_BUILD_ROOT} %dir /awips2 %dir /awips2/GFESuite /awips2/GFESuite/* +%defattr(644,awips,fxalpha,775) +%dir /awips2/GFESuite/nwps +/awips2/GFESuite/nwps/* %defattr(755,awips,fxalpha,755) %dir /awips2/GFESuite/bin /awips2/GFESuite/bin/*