VLab Issue #3223 - NSHARP: Improve selection operation

Change-Id: I4d0e92d1db24b3136f60fa224c908dfc020afa1d

Former-commit-id: 9a457213bb [formerly 9a457213bb [formerly 16fcc171c65d79d5698feeb3ff0ace49c31d976f]]
Former-commit-id: e3aedaa1d6
Former-commit-id: b1e1d9178a
This commit is contained in:
Stephen Gilbert 2014-03-07 19:07:28 -05:00
parent 40a62c63cd
commit 05328b9103
3 changed files with 3609 additions and 3725 deletions

View file

@ -20,7 +20,10 @@
package gov.noaa.nws.ncep.ui.nsharp.display; package gov.noaa.nws.ncep.ui.nsharp.display;
import org.eclipse.swt.SWT;
import gov.noaa.nws.ncep.ui.nsharp.display.map.NsharpMapResource; import gov.noaa.nws.ncep.ui.nsharp.display.map.NsharpMapResource;
import gov.noaa.nws.ncep.ui.nsharp.display.rsc.NsharpSkewTPaneResource;
import gov.noaa.nws.ncep.ui.nsharp.display.rsc.NsharpTimeStnPaneResource; import gov.noaa.nws.ncep.ui.nsharp.display.rsc.NsharpTimeStnPaneResource;
import gov.noaa.nws.ncep.ui.nsharp.view.NsharpShowTextDialog; import gov.noaa.nws.ncep.ui.nsharp.view.NsharpShowTextDialog;
@ -76,7 +79,7 @@ public class NsharpTimeStnPaneMouseHandler extends NsharpAbstractMouseHandler{
Coordinate c = editor.translateClick(x, y); Coordinate c = editor.translateClick(x, y);
if(timeStnRsc.getTimeLineRectangle().contains((int) c.x, (int) c.y) == true && this.mode == Mode.TIMELINE_DOWN) { if(timeStnRsc.getTimeLineRectangle().contains((int) c.x, (int) c.y) == true && this.mode == Mode.TIMELINE_DOWN) {
//data time line has been touched, and may be changed //data time line has been touched, and may be changed
timeStnRsc.getRscHandler().handleUserClickOnTimeLine(c); timeStnRsc.getRscHandler().handleUserClickOnTimeLine(c,shiftDown);// FixMark:clickOnTimeStnPane
handleMouseMove(x,y); handleMouseMove(x,y);
NsharpShowTextDialog textarea = NsharpShowTextDialog.getAccess(); NsharpShowTextDialog textarea = NsharpShowTextDialog.getAccess();
@ -87,12 +90,12 @@ public class NsharpTimeStnPaneMouseHandler extends NsharpAbstractMouseHandler{
} }
else if(timeStnRsc.getStnIdRectangle().contains((int) c.x, (int) c.y) == true && this.mode == Mode.STATIONID_DOWN) { else if(timeStnRsc.getStnIdRectangle().contains((int) c.x, (int) c.y) == true && this.mode == Mode.STATIONID_DOWN) {
//stn id line has been touched, and may be changed //stn id line has been touched, and may be changed
timeStnRsc.getRscHandler().handleUserClickOnStationId(c); timeStnRsc.getRscHandler().handleUserClickOnStationId(c,shiftDown);// FixMark:clickOnTimeStnPane
handleMouseMove(x,y); handleMouseMove(x,y);
} }
else if(timeStnRsc.getSndRectangle().contains((int) c.x, (int) c.y) == true && this.mode == Mode.SNDTYPE_DOWN) { else if(timeStnRsc.getSndRectangle().contains((int) c.x, (int) c.y) == true && this.mode == Mode.SNDTYPE_DOWN) {
//stn id line has been touched, and may be changed //stn id line has been touched, and may be changed
timeStnRsc.getRscHandler().handleUserClickOnSndLine(c); timeStnRsc.getRscHandler().handleUserClickOnSndLine(c,shiftDown);// FixMark:clickOnTimeStnPane
handleMouseMove(x,y); handleMouseMove(x,y);
} }
@ -106,6 +109,31 @@ public class NsharpTimeStnPaneMouseHandler extends NsharpAbstractMouseHandler{
} }
return false; return false;
} }
// FixMark:clickOnTimeStnPane
@Override
public boolean handleKeyDown(int keyCode) {
//System.out.println("key down="+(char)keyCode+ " code ="+keyCode);
if ((keyCode & SWT.SHIFT) != 0) {
shiftDown = true;
return true;
}
return false;
}
@Override
public boolean handleKeyUp(int keyCode) {
//String s = "key up="+(char)keyCode;
//System.out.println(s+ " code ="+keyCode);
if (getPaneDisplay() == null) {
return false;
}
if (keyCode == SWT.SHIFT) {
shiftDown = false;
return true;
}
return false;
}
//End FixMark:clickOnTimeStnPane
} }

View file

@ -11,6 +11,7 @@ package gov.noaa.nws.ncep.ui.nsharp.display.rsc;
* ------- ------- -------- ----------- * ------- ------- -------- -----------
* 04/23/2012 229 Chin Chen Initial coding * 04/23/2012 229 Chin Chen Initial coding
* May 08, 2013 1847 bsteffen Allow painting with no Wind Data. * May 08, 2013 1847 bsteffen Allow painting with no Wind Data.
* 02/03/2014 1106 Chin Chen Need to be able to use clicking on the Src,Time, or StnId to select display
* *
* </pre> * </pre>
* *
@ -175,7 +176,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
this.cursorTopWindBarb = cursorTopWindBarb; this.cursorTopWindBarb = cursorTopWindBarb;
} }
public boolean isJustMoveToSidePane() { public boolean isJustMoveToSidePane() {
return justMoveToSidePane; return justMoveToSidePane;
} }
@ -797,7 +798,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
WGraphics world, RGB iicolor, List<NcSoundingLayer> sndLys, double xPosition, double botPress)throws VizException { WGraphics world, RGB iicolor, List<NcSoundingLayer> sndLys, double xPosition, double botPress)throws VizException {
if(sndLys.size()< 4) if(sndLys.size()< 4)
return; return;
//ArrayList<List<LineStroke>> windList = new ArrayList<List<LineStroke>>(); //ArrayList<List<LineStroke>> windList = new ArrayList<List<LineStroke>>();
List<windPickedElement> layerStateList = new ArrayList<windPickedElement>(); List<windPickedElement> layerStateList = new ArrayList<windPickedElement>();
float lastHeight = -9999; float lastHeight = -9999;
RGB icolor = iicolor;//graphConfigProperty.getWindBarbColor(); RGB icolor = iicolor;//graphConfigProperty.getWindBarbColor();
@ -897,10 +898,10 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
//Chin::if we want pgen to draw un-picked wind as a circle, then set this. //Chin::if we want pgen to draw un-picked wind as a circle, then set this.
spd=0.1f; spd=0.1f;
curWbSize = 1; curWbSize = 1;
} }
else else
continue; continue;
} }
/* TBDWB /* TBDWB
else if(windBarbMagnify==true && cursorTopWindBarb == true && currentWindBarbSoundingLayerIndex == this.soundingLys.indexOf(layer)){ else if(windBarbMagnify==true && cursorTopWindBarb == true && currentWindBarbSoundingLayerIndex == this.soundingLys.indexOf(layer)){
curWbSize = wbSize*2; curWbSize = wbSize*2;
@ -1417,9 +1418,12 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
protected void paintInternal(IGraphicsTarget target, protected void paintInternal(IGraphicsTarget target,
PaintProperties paintProps) throws VizException { PaintProperties paintProps) throws VizException {
this.paintProps = paintProps; this.paintProps = paintProps;
if(soundingLys==null)
return;
super.paintInternal(target, paintProps); super.paintInternal(target, paintProps);
if(soundingLys==null){
drawNoDataMessage(target);// FixMark:clickOnTimeStnPane
return;
}
//System.out.println("skew paintInternal zoomL="+currentZoomLevel); //System.out.println("skew paintInternal zoomL="+currentZoomLevel);
if(rscHandler== null) if(rscHandler== null)
return; return;
@ -2071,6 +2075,27 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
dacpeTraceRscShape.compile(); dacpeTraceRscShape.compile();
} }
//start FixMark:clickOnTimeStnPane
private void drawNoDataMessage(IGraphicsTarget target){
IExtent ext = descriptor.getRenderableDisplay().getExtent();
double xmin = ext.getMinX(); //Extent's viewable envelope min x and y
double xmax = ext.getMaxX();
double xDefault = world.mapX(NsharpConstants.left);
if(xmin <xDefault)
xmin = xDefault;
double x = xmin + 15 * currentZoomLevel * xRatio;
x= (xmax-xmin)/4;
double y = world.mapY(NsharpWxMath.getSkewTXY(300, 0).y);
try {
target.drawString(font12,"Data is not loaded at selected current time line/station/source", x,y, 0.0, TextStyle.BOXED,
NsharpConstants.color_red, HorizontalAlignment.LEFT,
VerticalAlignment.MIDDLE, null);
} catch (VizException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// end FixMark:clickOnTimeStnPane
// Chin: to handle dynamically moving height mark within viewable zone when zooming, I could not use wireframeShape successfully // Chin: to handle dynamically moving height mark within viewable zone when zooming, I could not use wireframeShape successfully
// It will chop off lower part of marks. Therefore use this draw function. // It will chop off lower part of marks. Therefore use this draw function.
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")