diff --git a/cave/com.raytheon.uf.viz.damagepath/src/com/raytheon/uf/viz/damagepath/DamagePathLayer.java b/cave/com.raytheon.uf.viz.damagepath/src/com/raytheon/uf/viz/damagepath/DamagePathLayer.java index cbe1684d25..6286f20639 100644 --- a/cave/com.raytheon.uf.viz.damagepath/src/com/raytheon/uf/viz/damagepath/DamagePathLayer.java +++ b/cave/com.raytheon.uf.viz.damagepath/src/com/raytheon/uf/viz/damagepath/DamagePathLayer.java @@ -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. * * * @@ -119,10 +121,6 @@ public class DamagePathLayer 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 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 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() { diff --git a/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/polygon/PolygonLayer.java b/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/polygon/PolygonLayer.java index b5d1fa18bf..7ac7641bdb 100644 --- a/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/polygon/PolygonLayer.java +++ b/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/polygon/PolygonLayer.java @@ -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. * * * @@ -224,12 +226,13 @@ public class PolygonLayer 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];