VLab Issue #5930 - NSHARP Hodograph Does Not Loop in D2D Lite

Configuration

Change-Id: I20213e4e2bbcd7b69006d17c8dd61a273f52a13c

Former-commit-id: d6afb5e45a [formerly 0ef94ede96] [formerly d6afb5e45a [formerly 0ef94ede96] [formerly 5da7d7e78b [formerly 132751d6236f2bdede08f52072fc963743b1ba34]]]
Former-commit-id: 5da7d7e78b
Former-commit-id: db9f2fe967 [formerly de9cb710bf]
Former-commit-id: 76ea481366
This commit is contained in:
Chin Chen 2015-01-29 08:24:56 -05:00
parent 0a224087c8
commit 544e470b41
4 changed files with 151 additions and 87 deletions

View file

@ -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
*
* </pre>
*
@ -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");
}
}
};
}
}

View file

@ -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
*
* </pre>
*
@ -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;
}
}

View file

@ -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
*
* </pre>
*
@ -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<NsharpHodoPaneResource> 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);
}
}
}

View file

@ -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
*
* </pre>
*
@ -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<NsharpSkewTPaneResource> list = resourceList
.getResourcesByTypeAsType(NsharpSkewTPaneResource.class);
if (list != null && !list.isEmpty()) {