WorldWindJava icon indicating copy to clipboard operation
WorldWindJava copied to clipboard

SurfaceImageLayer addImage method does not remove a previous image with the same name

Open sdall2000 opened this issue 5 years ago • 0 comments

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.

sdall2000 avatar Sep 11 '20 16:09 sdall2000