Omaha #4375: Prevent Damage Path tool from creating vertices too close to a current vertex, fix ConcurrentModificationException on init.
Change-Id: Icbe56d770f5675fd55d6db8a35b17664b77ae6a8 Former-commit-id: 9fab39412385d87c923de7406b03347139352cde
This commit is contained in:
parent
f56c255ebd
commit
ab91a73c50
2 changed files with 12 additions and 16 deletions
|
@ -76,6 +76,8 @@ import com.vividsolutions.jts.geom.Polygon;
|
|||
* Jun 03, 2015 4375 dgilling Support changes to PolygonLayer for
|
||||
* multiple polygon support.
|
||||
* Jun 08, 2015 4355 dgilling Fix NullPointerException in loadJob.
|
||||
* Jun 12, 2015 4375 dgilling Fix ConcurrentModificationException in
|
||||
* initInternal.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -119,10 +121,6 @@ public class DamagePathLayer<T extends DamagePathResourceData> extends
|
|||
.valueOf(System.getProperty("damage.path.localization.level",
|
||||
LocalizationLevel.USER.name()));
|
||||
|
||||
/*
|
||||
* TODO: If we support multiple polygons in the future then the jobs will
|
||||
* need to be smart enough to load/save different files.
|
||||
*/
|
||||
private final Job loadJob = new Job("Loading Damage Path") {
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
|
@ -136,7 +134,10 @@ public class DamagePathLayer<T extends DamagePathResourceData> extends
|
|||
.error("The damage path file was invalid. The polygon has been reset.");
|
||||
setDefaultPolygon();
|
||||
}
|
||||
} else {
|
||||
setDefaultPolygon();
|
||||
}
|
||||
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
};
|
||||
|
@ -158,21 +159,13 @@ public class DamagePathLayer<T extends DamagePathResourceData> extends
|
|||
dir.addFileUpdatedObserver(this);
|
||||
|
||||
loadJob.setSystem(true);
|
||||
loadJob.schedule();
|
||||
saveJob.setSystem(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||
super.initInternal(target);
|
||||
LocalizationFile prevFile = getValidDamagePathFile();
|
||||
if (polygons.isEmpty() && prevFile != null) {
|
||||
/*
|
||||
* only get here if there is no previous file, otherwise loadJob
|
||||
* will load the polygon
|
||||
*/
|
||||
setDefaultPolygon();
|
||||
}
|
||||
loadJob.schedule();
|
||||
}
|
||||
|
||||
private void setDefaultPolygon() {
|
||||
|
|
|
@ -57,6 +57,8 @@ import com.vividsolutions.jts.geom.Polygon;
|
|||
* Jan 19, 2015 3974 njensen Initial creation
|
||||
* Mar 31, 2015 3977 nabowle Require non-empty coordinates in resetPolygon
|
||||
* May 15, 2015 4375 dgilling Support multiple polygons.
|
||||
* Jun 12, 2015 4375 dgilling Only show AddVertexAction when on polygon's
|
||||
* edge and not near a current vertex.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -224,12 +226,13 @@ public class PolygonLayer<T extends AbstractResourceData> extends
|
|||
public void addContextMenuItems(IMenuManager menuManager, int x, int y) {
|
||||
int edgePolygonIdx = uiInput.pointOnEdge(x, y);
|
||||
boolean onEdge = (edgePolygonIdx >= 0);
|
||||
if (onEdge) {
|
||||
menuManager.add(new AddVertexAction(edgePolygonIdx, x, y, uiInput));
|
||||
}
|
||||
|
||||
int[] indices = uiInput.pointOnVertex(x, y);
|
||||
boolean onVertex = (indices != null);
|
||||
|
||||
if (onEdge && !onVertex) {
|
||||
menuManager.add(new AddVertexAction(edgePolygonIdx, x, y, uiInput));
|
||||
}
|
||||
if (onVertex) {
|
||||
int polygonIndex = indices[0];
|
||||
int vertexIndex = indices[1];
|
||||
|
|
Loading…
Add table
Reference in a new issue