Omaha #4194 fix damage path issues

Change-Id: I0a8d08518590daa6e0f1c6c47437616cdeaddf17

Former-commit-id: c2cf4add2f32c87ab26246c7a68420fa6df7b5a0
This commit is contained in:
Nate Jensen 2015-03-04 13:39:53 -06:00
parent 4c7732f81a
commit b7a8f60ac1
2 changed files with 24 additions and 0 deletions

View file

@ -40,6 +40,7 @@ import com.vividsolutions.jts.geom.util.AffineTransformation;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 19, 2015 3974 njensen Initial creation
* Mar 04, 2015 4194 njensen Block other input on middle click drag on edges
*
* </pre>
*
@ -67,6 +68,9 @@ public class PolygonInputAdapter extends RscInputAdapter<PolygonLayer<?>> {
/** is the entire polygon being dragged */
protected boolean draggingPolygon = false;
/** is the mouse middle clicking on a vertex or edge */
protected boolean middleClicking = false;
public PolygonInputAdapter(PolygonLayer<?> layer) {
super(layer);
}
@ -95,6 +99,7 @@ public class PolygonInputAdapter extends RscInputAdapter<PolygonLayer<?>> {
addVertex(x, y);
blockOtherHandlers = true;
}
middleClicking = blockOtherHandlers;
}
}
return blockOtherHandlers;
@ -117,6 +122,13 @@ public class PolygonInputAdapter extends RscInputAdapter<PolygonLayer<?>> {
dragPolygon(diffX, diffY);
}
}
} else if (mouseButton == 2) {
/*
* this can occur if the user meant to middle click and then
* accidentally dragged a bit, so let's treat it as just a
* middle click if it originally was on an edge or vertex
*/
blockOtherHandlers = middleClicking;
}
}
return blockOtherHandlers;
@ -139,6 +151,8 @@ public class PolygonInputAdapter extends RscInputAdapter<PolygonLayer<?>> {
draggingPolygon = false;
dragPolygon(diffX, diffY);
}
} else if (mouseButton == 2) {
middleClicking = false;
}
}

View file

@ -39,6 +39,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 26, 2015 3974 njensen Initial creation
* Mar 04, 2015 4194 njensen Fix removing first vertex of a LinearRing
*
* </pre>
*
@ -204,6 +205,15 @@ public class PolygonUtil {
System.arraycopy(coords, index + 1, newLine, index, newLine.length
- index);
if (isRing) {
if (index == 0) {
/*
* first point and last point in a ring always match, so if
* we removed the first point we need to update the last to
* be the new first point
*/
newLine[newLine.length - 1] = new Coordinate(newLine[0].x,
newLine[0].y, newLine[0].z);
}
return FACTORY.createLinearRing(newLine);
} else {
return FACTORY.createLineString(newLine);