Merge "Omaha #3242 fix errors that can occur if a user zooms or pans while the time series is still loading" into omaha_14.4.1
Former-commit-id: 968613aaa91648a8e860eff88293744ddc00464c
This commit is contained in:
commit
9a76fd4db0
2 changed files with 24 additions and 5 deletions
|
@ -28,7 +28,7 @@ import com.raytheon.viz.ui.input.PanHandler;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* A pan handler for time series.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
|
@ -36,6 +36,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Oct 16, 2009 mschenke Initial creation
|
* Oct 16, 2009 mschenke Initial creation
|
||||||
|
* Jun 14, 2014 3242 njensen Null safety checks
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -94,6 +95,7 @@ public class TimeSeriesPanHandler extends AbstractGraphInputHandler {
|
||||||
IGraph graphToUse = desc.getGraphResource().getClosestGraph(grid);
|
IGraph graphToUse = desc.getGraphResource().getClosestGraph(grid);
|
||||||
|
|
||||||
if (graphToUse != null
|
if (graphToUse != null
|
||||||
|
&& graphToUse.getExtent() != null
|
||||||
&& graphToUse.getExtent().contains(
|
&& graphToUse.getExtent().contains(
|
||||||
new double[] { grid.x, grid.y, grid.z })) {
|
new double[] { grid.x, grid.y, grid.z })) {
|
||||||
this.graph = graphToUse;
|
this.graph = graphToUse;
|
||||||
|
@ -150,6 +152,7 @@ public class TimeSeriesPanHandler extends AbstractGraphInputHandler {
|
||||||
*
|
*
|
||||||
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, int)
|
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, int)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean handleMouseUp(int x, int y, int button) {
|
public boolean handleMouseUp(int x, int y, int button) {
|
||||||
IDisplayPaneContainer editor = display.getContainer();
|
IDisplayPaneContainer editor = display.getContainer();
|
||||||
if (button != 1) {
|
if (button != 1) {
|
||||||
|
|
|
@ -38,7 +38,9 @@ import com.raytheon.viz.ui.input.preferences.MousePreferenceManager;
|
||||||
import com.vividsolutions.jts.geom.Coordinate;
|
import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* A zoom handler for time series. Time series needs a special zoom handler
|
||||||
|
* since the axes will redraw as the user zooms in and out.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
|
@ -47,6 +49,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Oct 16, 2009 mschenke Initial creation
|
* Oct 16, 2009 mschenke Initial creation
|
||||||
* Dec 11, 2013 DR 16795 D. Friedman Transform pixel coordinate for zoom
|
* Dec 11, 2013 DR 16795 D. Friedman Transform pixel coordinate for zoom
|
||||||
|
* Jun 18, 2014 3242 njensen Null safety checks
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -126,7 +129,7 @@ public class TimeSeriesZoomHandler extends AbstractGraphInputHandler {
|
||||||
hiddenGraphs.push(graphToHide);
|
hiddenGraphs.push(graphToHide);
|
||||||
} else {
|
} else {
|
||||||
IGraph graph = desc.getGraphResource().getClosestGraph(grid);
|
IGraph graph = desc.getGraphResource().getClosestGraph(grid);
|
||||||
if (graph.getExtent().contains(new double[] { grid.x, grid.y })) {
|
if (graphContainsCoordinate(graph, grid)) {
|
||||||
graph.zoom((int) Math.pow(2, zoomIndex - totalGraphs + 1), grid);
|
graph.zoom((int) Math.pow(2, zoomIndex - totalGraphs + 1), grid);
|
||||||
} else {
|
} else {
|
||||||
zoomIndex--;
|
zoomIndex--;
|
||||||
|
@ -148,7 +151,7 @@ public class TimeSeriesZoomHandler extends AbstractGraphInputHandler {
|
||||||
if (zoomIndex > 0) {
|
if (zoomIndex > 0) {
|
||||||
if (zoomIndex >= totalGraphs) {
|
if (zoomIndex >= totalGraphs) {
|
||||||
IGraph graph = desc.getGraphResource().getClosestGraph(grid);
|
IGraph graph = desc.getGraphResource().getClosestGraph(grid);
|
||||||
if (graph.getExtent().contains(new double[] { grid.x, grid.y })) {
|
if (graphContainsCoordinate(graph, grid)) {
|
||||||
graph.zoom((int) Math.pow(2, zoomIndex - totalGraphs), grid);
|
graph.zoom((int) Math.pow(2, zoomIndex - totalGraphs), grid);
|
||||||
} else {
|
} else {
|
||||||
zoomIndex++;
|
zoomIndex++;
|
||||||
|
@ -169,7 +172,8 @@ public class TimeSeriesZoomHandler extends AbstractGraphInputHandler {
|
||||||
if (grid == null) {
|
if (grid == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
/* Convert from the overall display coordinate space to the coordinate
|
/*
|
||||||
|
* Convert from the overall display coordinate space to the coordinate
|
||||||
* space for our resource.
|
* space for our resource.
|
||||||
*/
|
*/
|
||||||
DirectPosition2D dp = new DirectPosition2D(grid.x, grid.y);
|
DirectPosition2D dp = new DirectPosition2D(grid.x, grid.y);
|
||||||
|
@ -185,4 +189,16 @@ public class TimeSeriesZoomHandler extends AbstractGraphInputHandler {
|
||||||
return grid;
|
return grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether or not the coordinate is in the extent of a graph
|
||||||
|
*
|
||||||
|
* @param graph
|
||||||
|
* @param coord
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean graphContainsCoordinate(IGraph graph, Coordinate coord) {
|
||||||
|
return (graph != null && graph.getExtent() != null && graph.getExtent()
|
||||||
|
.contains(new double[] { coord.x, coord.y }));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue