VLab Issue #3223 - NSHARP: Improve selection operation

Change-Id: I4d0e92d1db24b3136f60fa224c908dfc020afa1d

Former-commit-id: ba4869af46 [formerly 5fcb45a629] [formerly 9a457213bb] [formerly e3aedaa1d6 [formerly 9a457213bb [formerly 16fcc171c65d79d5698feeb3ff0ace49c31d976f]]]
Former-commit-id: e3aedaa1d6
Former-commit-id: c9da8cd134141da14e27b89961b37aff9bce21eb [formerly b1e1d9178a]
Former-commit-id: c4b73eb02e
This commit is contained in:
Stephen Gilbert 2014-03-07 19:07:28 -05:00
parent fee37acf0c
commit fb4c74e0cd
3 changed files with 3609 additions and 3725 deletions

View file

@ -20,7 +20,10 @@
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.rsc.NsharpSkewTPaneResource;
import gov.noaa.nws.ncep.ui.nsharp.display.rsc.NsharpTimeStnPaneResource;
import gov.noaa.nws.ncep.ui.nsharp.view.NsharpShowTextDialog;
@ -76,7 +79,7 @@ public class NsharpTimeStnPaneMouseHandler extends NsharpAbstractMouseHandler{
Coordinate c = editor.translateClick(x, y);
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
timeStnRsc.getRscHandler().handleUserClickOnTimeLine(c);
timeStnRsc.getRscHandler().handleUserClickOnTimeLine(c,shiftDown);// FixMark:clickOnTimeStnPane
handleMouseMove(x,y);
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) {
//stn id line has been touched, and may be changed
timeStnRsc.getRscHandler().handleUserClickOnStationId(c);
timeStnRsc.getRscHandler().handleUserClickOnStationId(c,shiftDown);// FixMark:clickOnTimeStnPane
handleMouseMove(x,y);
}
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
timeStnRsc.getRscHandler().handleUserClickOnSndLine(c);
timeStnRsc.getRscHandler().handleUserClickOnSndLine(c,shiftDown);// FixMark:clickOnTimeStnPane
handleMouseMove(x,y);
}
@ -106,6 +109,31 @@ public class NsharpTimeStnPaneMouseHandler extends NsharpAbstractMouseHandler{
}
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
* 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>
*
@ -175,7 +176,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
this.cursorTopWindBarb = cursorTopWindBarb;
}
public boolean isJustMoveToSidePane() {
public boolean isJustMoveToSidePane() {
return justMoveToSidePane;
}
@ -797,7 +798,7 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
WGraphics world, RGB iicolor, List<NcSoundingLayer> sndLys, double xPosition, double botPress)throws VizException {
if(sndLys.size()< 4)
return;
//ArrayList<List<LineStroke>> windList = new ArrayList<List<LineStroke>>();
//ArrayList<List<LineStroke>> windList = new ArrayList<List<LineStroke>>();
List<windPickedElement> layerStateList = new ArrayList<windPickedElement>();
float lastHeight = -9999;
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.
spd=0.1f;
curWbSize = 1;
}
}
else
continue;
}
}
/* TBDWB
else if(windBarbMagnify==true && cursorTopWindBarb == true && currentWindBarbSoundingLayerIndex == this.soundingLys.indexOf(layer)){
curWbSize = wbSize*2;
@ -1417,9 +1418,12 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
protected void paintInternal(IGraphicsTarget target,
PaintProperties paintProps) throws VizException {
this.paintProps = paintProps;
if(soundingLys==null)
return;
super.paintInternal(target, paintProps);
if(soundingLys==null){
drawNoDataMessage(target);// FixMark:clickOnTimeStnPane
return;
}
//System.out.println("skew paintInternal zoomL="+currentZoomLevel);
if(rscHandler== null)
return;
@ -2071,6 +2075,27 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
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
// It will chop off lower part of marks. Therefore use this draw function.
@SuppressWarnings("deprecation")