WorldWindJava
WorldWindJava copied to clipboard
SurfaceImageLayer addImage method does not remove a previous image with the same name
Looking at the code, it appears that the two addImage variants that accept a name, buffered image, and bounding box (either a Sector or LatLon list) were meant to delete a previous image with the same name.
However when I was using this class, that behavior was not observed and my images would stack.
I believe I see the issue. Line 277 (for addImage(String, BufferedImage, Sector) is incorrectly calling this.imageTable.contains(name) instead of this.imageTable.containsKey(name).
Same for line 384 (for addImage(String, BufferedImage, List<? extends LatLon>)
I believe changing those two lines to "containsKey" should fix the issue.