From 544e470b41f2f6feb5e72dd11c9484d81821bb31 Mon Sep 17 00:00:00 2001 From: Chin Chen Date: Thu, 29 Jan 2015 08:24:56 -0500 Subject: [PATCH] VLab Issue #5930 - NSHARP Hodograph Does Not Loop in D2D Lite Configuration Change-Id: I20213e4e2bbcd7b69006d17c8dd61a273f52a13c Former-commit-id: d6afb5e45a17d6b2fdffae00590731cc4477bf61 [formerly 0ef94ede96853e5b6eaec50a7c7728299a661421] [formerly d6afb5e45a17d6b2fdffae00590731cc4477bf61 [formerly 0ef94ede96853e5b6eaec50a7c7728299a661421] [formerly 5da7d7e78bf30ce9d678398b97580ddb510449fa [formerly 132751d6236f2bdede08f52072fc963743b1ba34]]] Former-commit-id: 5da7d7e78bf30ce9d678398b97580ddb510449fa Former-commit-id: db9f2fe96782f1b583e4bebe177e50db5a95691c [formerly de9cb710bf40e65ebc87368f837ddc27b6b261a1] Former-commit-id: 76ea481366115fde5e3f5153d7a5b2c9eb44c313 --- .../display/NsharpAbstractPaneDescriptor.java | 79 ++++++++++++++++--- .../ncep/ui/nsharp/display/NsharpEditor.java | 36 ++++++--- .../display/NsharpHodoPaneDescriptor.java | 53 ++++++++++++- .../display/NsharpSkewTPaneDescriptor.java | 70 ++-------------- 4 files changed, 151 insertions(+), 87 deletions(-) diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpAbstractPaneDescriptor.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpAbstractPaneDescriptor.java index 2bbad12a99..d33f29f61f 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpAbstractPaneDescriptor.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpAbstractPaneDescriptor.java @@ -13,7 +13,10 @@ * 05/02/2012 229 Chin Chen Initial coding for multiple display panes implementation * 03/11/2013 972 Greg Hull rm paneNumber * 03/11/2013 2491 bsteffen extend IDescriptor derictly for better serialization detection. - + * 01/13/2015 DR#17008, + * task#5930 Chin Chen NSHARP Hodograph Does Not Loop in D2D Lite Configuration + * moved "setFrameCoordinator()" from NsharpSkewTPaneDescriptor to here, + * so it can be used by other descriptor * * * @@ -24,6 +27,7 @@ package gov.noaa.nws.ncep.ui.nsharp.display; import gov.noaa.nws.ncep.ui.nsharp.display.rsc.NsharpAbstractPaneResource; import gov.noaa.nws.ncep.ui.nsharp.display.rsc.NsharpResourceHandler; +import gov.noaa.nws.ncep.viz.ui.display.NCLoopProperties; import java.util.List; @@ -34,15 +38,14 @@ import org.geotools.referencing.crs.DefaultEngineeringCRS; import com.raytheon.uf.viz.core.PixelExtent; import com.raytheon.uf.viz.core.datastructure.LoopProperties; +import com.raytheon.uf.viz.core.drawables.FrameCoordinator; import com.raytheon.uf.viz.core.drawables.IDescriptor; +import com.raytheon.uf.viz.core.drawables.IFrameCoordinator; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.viz.core.graphing.GraphDescriptor; @XmlAccessorType(XmlAccessType.NONE) public class NsharpAbstractPaneDescriptor extends GraphDescriptor implements IDescriptor { -// @XmlElement -// protected int paneNumber; - protected NsharpResourceHandler rscHandler=null; @@ -53,14 +56,6 @@ public class NsharpAbstractPaneDescriptor extends GraphDescriptor implements public void setRscHandler(NsharpResourceHandler rscHandler) { this.rscHandler = rscHandler; } - -// public int getPaneNumber() { -// return paneNumber; -// } -// -// public void setPaneNumber(int paneNumber) { -// this.paneNumber = paneNumber; -// } public NsharpAbstractPaneDescriptor() { super(); @@ -106,4 +101,64 @@ public class NsharpAbstractPaneDescriptor extends GraphDescriptor implements e.printStackTrace(); } } + //DR17008 + protected void setFrameCoordinator() { + frameCoordinator = new FrameCoordinator(this) { + @Override + /* + * Chin Note: this function handles keyboard up/down/left/right arrow keys for station and time line stepping. + */ + public void changeFrame( + IFrameCoordinator.FrameChangeOperation operation, + IFrameCoordinator.FrameChangeMode mode) { + if(rscHandler == null) + return; + //System.out.println("NsharpSkewTPaneDescriptor changeFrame(operation) called op="+operation+" mode"+mode); + if(mode == IFrameCoordinator.FrameChangeMode.SPACE_ONLY){ + //up/down arrow keys for stepping stations + //editor.getRscHandler().setSteppingStnIdList(operation); + rscHandler.setSteppingStnIdList(operation); + } else if(mode == IFrameCoordinator.FrameChangeMode.TIME_ONLY || mode == IFrameCoordinator.FrameChangeMode.TIME_AND_SPACE){ + //left/right arrow keys for stepping time lines + //editor.getRscHandler().setSteppingTimeLine(operation, mode); + rscHandler.setSteppingTimeLine(operation, mode); + } + } + /* + * (non-Javadoc) + * @see com.raytheon.uf.viz.core.drawables.FrameCoordinator#changeFrame(com.raytheon.uf.viz.core.datastructure.LoopProperties) + * This function handling nsharp looping. + * Chin: 12.8.1: let skewtPaneDescriptor handle looping. All other pane descriptor will do nothing. Otherwise, we will looping X times faster when we + * have X number of panes configured and each pane move frame once. + * + */ + @Override + public void changeFrame(LoopProperties loopProperties) { + if(rscHandler == null) + return; + + long waitTime = Long.MAX_VALUE; + //System.out.println("NsharpSkewTPaneDescriptor changeFrame(loop) called, loopDirection= "+loopDirection + " fwd="+loopProperties.getFwdFrameTime()+ + // " back="+loopProperties.getRevFrameTime() + " 1st dt="+loopProperties.getFirstFrameDwell()+ " lasDt="+loopProperties.getLastFrameDwell()); + if(loopProperties.getMode() == LoopProperties.LoopMode.Forward || loopProperties.getMode() == LoopProperties.LoopMode.Cycle) + waitTime = loopProperties.getFwdFrameTime(); + else + waitTime = loopProperties.getRevFrameTime(); + int frameSize= rscHandler.getTimeElementListSize(); + int curFrameIndex = rscHandler.getCurrentTimeElementListIndex(); + if(curFrameIndex == 0) + waitTime = loopProperties.getFirstFrameDwell(); + else if(curFrameIndex == frameSize-1) + waitTime = loopProperties.getLastFrameDwell(); + + loopProperties.drawAfterWait(waitTime); + //System.out.println("wait time="+waitTime); + if (loopProperties.isShouldDraw()) { + rscHandler.setLoopingDataTimeLine(loopProperties); + //System.out.println("loopinp step"); + } + } + + }; + } } diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpEditor.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpEditor.java index f8a020eab7..35db1031d9 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpEditor.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpEditor.java @@ -18,6 +18,8 @@ package gov.noaa.nws.ncep.ui.nsharp.display; * 06/14/2011 11-5 Chin Chen migration * 03/11/2013 972 Greg Hull rm paneNum and editorNum; rm AbstractNcEditor * 03/25/2013 972 Greg Hull rm unused Add/RemoveListeners. + * 01/13/2015 DR#17008, + * task#5930 Chin Chen NSHARP Hodograph Does Not Loop in D2D Lite Configuration * * * @@ -178,7 +180,7 @@ public class NsharpEditor extends AbstractEditor implements private int futureHeightHint; private int futureWidthHint; - + private String paneConfigurationName; private IRenderableDisplay[] displayArray; @@ -1382,13 +1384,17 @@ public class NsharpEditor extends AbstractEditor implements DISPLAY_SPC_GRAPHS = -1; } else if (paneConfigurationName // d2dlite start .equals(NsharpConstants.PANE_LITE_D2D_CFG_STR)) { - if (rscHandler != null - && rscHandler.getCurrentGraphMode() == NsharpConstants.GRAPH_HODO) { - DISPLAY_HODO = 0; + //5930 + NsharpPaletteWindow win = NsharpPaletteWindow.getInstance(); + if (win != null && + win.getCurrentGraphMode() == NsharpConstants.GRAPH_HODO) { + //#5930if (rscHandler != null + // && rscHandler.getCurrentGraphMode() == NsharpConstants.GRAPH_HODO) { + DISPLAY_HODO = 0 ; DISPLAY_TIMESTN = DISPLAY_HODO + 1; DISPLAY_SKEWT = -1; } else { - DISPLAY_SKEWT = 0; + DISPLAY_SKEWT = 0; DISPLAY_TIMESTN = DISPLAY_SKEWT + 1; DISPLAY_HODO = -1; } @@ -1459,8 +1465,12 @@ public class NsharpEditor extends AbstractEditor implements // d2dlite start } else if (paneConfigurationName .equals(NsharpConstants.PANE_LITE_D2D_CFG_STR)) { - if (rscHandler != null - && rscHandler.getCurrentGraphMode() == NsharpConstants.GRAPH_HODO) { + //5930 + NsharpPaletteWindow win = NsharpPaletteWindow.getInstance(); + if (win != null && + win.getCurrentGraphMode() == NsharpConstants.GRAPH_HODO) { + //#5930 if (rscHandler != null + //&& rscHandler.getCurrentGraphMode() == NsharpConstants.GRAPH_HODO) { displayArray[DISPLAY_HODO] = new NsharpHodoPaneDisplay( new PixelExtent(NsharpConstants.HODO_DISPLAY_REC), DISPLAY_HODO); @@ -1610,9 +1620,11 @@ public class NsharpEditor extends AbstractEditor implements nsharpComp = new Composite[DISPLAY_TOTAL]; displayPane = new VizDisplayPane[DISPLAY_TOTAL]; - EditorInput edInput = new EditorInput(new NCLoopProperties(), + //EditorInput edInput = new EditorInput(new NsharpLoopProperties(), + // displayArray); + //CHIN task#5930 use same loop properties + EditorInput edInput = new EditorInput(this.editorInput.getLoopProperties(), displayArray); - this.setInput(edInput); this.displaysToLoad = displayArray; for (IRenderableDisplay display : displayArray) { @@ -2130,4 +2142,10 @@ public class NsharpEditor extends AbstractEditor implements // + // pane.toString()+" newRenderableDisplay="+newRenderableDisplay.toString()); } + + public String getPaneConfigurationName() { + return paneConfigurationName; + } + + } \ No newline at end of file diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpHodoPaneDescriptor.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpHodoPaneDescriptor.java index b52bf3cb3d..d6ac487932 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpHodoPaneDescriptor.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpHodoPaneDescriptor.java @@ -11,6 +11,8 @@ * Date Ticket# Engineer Description * ------- ------- -------- ----------- * 05/02/2012 229 Chin Chen Initial coding for multiple display panes implementation + * 01/13/2015 DR#17008, + * task#5930 Chin Chen NSHARP Hodograph Does Not Loop in D2D Lite Configuration * * * @@ -19,7 +21,9 @@ */ package gov.noaa.nws.ncep.ui.nsharp.display; +import gov.noaa.nws.ncep.ui.nsharp.NsharpConstants; import gov.noaa.nws.ncep.ui.nsharp.display.rsc.NsharpHodoPaneResource; +import gov.noaa.nws.ncep.viz.common.ui.NmapCommon; import java.util.List; @@ -28,19 +32,36 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; import com.raytheon.uf.viz.core.PixelExtent; +import com.raytheon.uf.viz.core.drawables.IFrameCoordinator; +import com.raytheon.uf.viz.d2d.core.time.D2DTimeMatcher; +import com.raytheon.viz.ui.perspectives.VizPerspectiveListener; @XmlAccessorType(XmlAccessType.NONE) @XmlType(name = "nsharpHodoPaneDescriptor") public class NsharpHodoPaneDescriptor extends NsharpAbstractPaneDescriptor { public NsharpHodoPaneDescriptor(PixelExtent pe) { super(pe); - //System.out.println("NsharpHodoPaneDescriptor created " + this.toString()); + if((NsharpEditor.getActiveNsharpEditor() != null) && (NsharpEditor.getActiveNsharpEditor().getPaneConfigurationName().equals(NsharpConstants.PANE_LITE_D2D_CFG_STR))) + { + setTimeMatcher(new D2DTimeMatcher()); + setFrameCoordinator(); + } } public NsharpHodoPaneDescriptor(PixelExtent pe, int paneNumber) { super(pe, paneNumber); + if((NsharpEditor.getActiveNsharpEditor() != null) && (NsharpEditor.getActiveNsharpEditor().getPaneConfigurationName().equals(NsharpConstants.PANE_LITE_D2D_CFG_STR))) + { + setTimeMatcher(new D2DTimeMatcher()); + setFrameCoordinator(); + } } public NsharpHodoPaneDescriptor() { super(); + if((NsharpEditor.getActiveNsharpEditor() != null) && (NsharpEditor.getActiveNsharpEditor().getPaneConfigurationName().equals(NsharpConstants.PANE_LITE_D2D_CFG_STR))) + { + setTimeMatcher(new D2DTimeMatcher()); + setFrameCoordinator(); + } } public NsharpHodoPaneResource getHodoResource() { List list = resourceList @@ -50,5 +71,35 @@ public class NsharpHodoPaneDescriptor extends NsharpAbstractPaneDescriptor { } return null; } + @SuppressWarnings("deprecation") + @Override + /* + * Chin Note: this function handles time line stepping from NC Perspective tool bar left/right/first/last arrow Buttons. + */ + public void changeFrame(FrameChangeOperation operation, FrameChangeMode mode) { + synchronized (this) { + //Chin Note: there are multiple (6) panes. + //We only need to step one timeline. Therefore, we handle stepping by skewt pane. + //However, for D2D LITE display configuration, when switched to HODO pane, skewT pane is no longer + //in charge. therefore, we have to handle this special case here by HODO pane. + + if((rscHandler == null) ||(!rscHandler.getPaneConfigurationName().equals(NsharpConstants.PANE_LITE_D2D_CFG_STR))) + return; + + if( VizPerspectiveListener.getCurrentPerspectiveManager()!= null){ + //System.out.println("changeFrame: current perspective ="+VizPerspectiveListener.getCurrentPerspectiveManager().getPerspectiveId()); + if(!VizPerspectiveListener.getCurrentPerspectiveManager().getPerspectiveId().equals(NmapCommon.NatlCntrsPerspectiveID)){ + if(mode != FrameChangeMode.TIME_ONLY) + return; + } + } + + // we will have to do conversion here + IFrameCoordinator.FrameChangeOperation dop = IFrameCoordinator.FrameChangeOperation.valueOf(operation.name()); + IFrameCoordinator.FrameChangeMode dmode = IFrameCoordinator.FrameChangeMode.valueOf(mode.name()); + rscHandler.setSteppingTimeLine(dop, dmode); + + } + } } diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpSkewTPaneDescriptor.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpSkewTPaneDescriptor.java index 8bf47918b0..8bf1a70bca 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpSkewTPaneDescriptor.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/NsharpSkewTPaneDescriptor.java @@ -11,6 +11,10 @@ * Date Ticket# Engineer Description * ------- ------- -------- ----------- * 05/02/2012 229 Chin Chen Initial coding for multiple display panes implementation + * 01/13/2015 DR#17008, + * task#5930 Chin Chen NSHARP Hodograph Does Not Loop in D2D Lite Configuration + * moved "setFrameCoordinator()" to NsharpAbstractPaneDescriptor, + * so it can be used by other descriptor * * * @@ -29,8 +33,6 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; import com.raytheon.uf.viz.core.PixelExtent; -import com.raytheon.uf.viz.core.datastructure.LoopProperties; -import com.raytheon.uf.viz.core.drawables.FrameCoordinator; import com.raytheon.uf.viz.core.drawables.IFrameCoordinator; import com.raytheon.uf.viz.d2d.core.time.D2DTimeMatcher; import com.raytheon.viz.ui.perspectives.VizPerspectiveListener; @@ -54,69 +56,7 @@ public class NsharpSkewTPaneDescriptor extends NsharpAbstractPaneDescriptor { setTimeMatcher(new D2DTimeMatcher()); setFrameCoordinator(); } - - private void setFrameCoordinator() { - frameCoordinator = new FrameCoordinator(this) { - @Override - /* - * Chin Note: this function handles keyboard up/down/left/right arrow keys for station and time line stepping. - */ - public void changeFrame( - IFrameCoordinator.FrameChangeOperation operation, - IFrameCoordinator.FrameChangeMode mode) { - //NsharpEditor editor = NsharpEditor.getActiveNsharpEditor() ; - //if(editor== null || editor.getRscHandler()==null) - // return; - if(rscHandler == null) - return; - //System.out.println("NsharpSkewTPaneDescriptor changeFrame(operation) called op="+operation+" mode"+mode); - if(mode == IFrameCoordinator.FrameChangeMode.SPACE_ONLY){ - //up/down arrow keys for stepping stations - //editor.getRscHandler().setSteppingStnIdList(operation); - rscHandler.setSteppingStnIdList(operation); - } else if(mode == IFrameCoordinator.FrameChangeMode.TIME_ONLY || mode == IFrameCoordinator.FrameChangeMode.TIME_AND_SPACE){ - //left/right arrow keys for stepping time lines - //editor.getRscHandler().setSteppingTimeLine(operation, mode); - rscHandler.setSteppingTimeLine(operation, mode); - } - } - /* - * (non-Javadoc) - * @see com.raytheon.uf.viz.core.drawables.FrameCoordinator#changeFrame(com.raytheon.uf.viz.core.datastructure.LoopProperties) - * This function handling nsharp looping. - * Chin: 12.8.1: let skewtPaneDescriptor handle looping. All other pane descriptor will do nothing. Otherwise, we will looping X times faster when we - * have X number of panes configured and each pane move frame once. - * - */ - @Override - public void changeFrame(LoopProperties loopProperties) { - if(rscHandler == null) - return; - long waitTime = Long.MAX_VALUE; - //System.out.println("NsharpSkewTPaneDescriptor changeFrame(loop) called, loopDirection= "+loopDirection + " fwd="+loopProperties.getFwdFrameTime()+ - // " back="+loopProperties.getRevFrameTime() + " 1st dt="+loopProperties.getFirstFrameDwell()+ " lasDt="+loopProperties.getLastFrameDwell()); - if(loopProperties.getMode() == LoopProperties.LoopMode.Forward || loopProperties.getMode() == LoopProperties.LoopMode.Cycle) - waitTime = loopProperties.getFwdFrameTime(); - else - waitTime = loopProperties.getRevFrameTime(); - int frameSize= rscHandler.getTimeElementListSize(); - int curFrameIndex = rscHandler.getCurrentTimeElementListIndex(); - if(curFrameIndex == 0) - waitTime = loopProperties.getFirstFrameDwell(); - else if(curFrameIndex == frameSize-1) - waitTime = loopProperties.getLastFrameDwell(); - - loopProperties.drawAfterWait(waitTime); - - if (loopProperties.isShouldDraw()) { - rscHandler.setLoopingDataTimeLine(loopProperties); - - } - } - - }; - } - public NsharpSkewTPaneResource getSkewtResource() { + public NsharpSkewTPaneResource getSkewtResource() { List list = resourceList .getResourcesByTypeAsType(NsharpSkewTPaneResource.class); if (list != null && !list.isEmpty()) {