From cd596f4eed33b6e5b15462643c6fac7bdd3ef018 Mon Sep 17 00:00:00 2001 From: frechett Date: Tue, 5 Nov 2019 23:57:34 +0100 Subject: [PATCH 1/8] locationHandlers are not being saved #53 The com.bbn.openmap.layer.location.LocationLayer locationHandlers are not being saved, the property value is always blank. --- .../com/bbn/openmap/layer/location/LocationLayer.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/openmap/com/bbn/openmap/layer/location/LocationLayer.java b/src/openmap/com/bbn/openmap/layer/location/LocationLayer.java index 72995f21..1ea25279 100644 --- a/src/openmap/com/bbn/openmap/layer/location/LocationLayer.java +++ b/src/openmap/com/bbn/openmap/layer/location/LocationLayer.java @@ -581,14 +581,22 @@ public Properties getProperties(Properties props) { props.put(prefix + AllowPartialsProperty, new Boolean(declutterMatrix.isAllowPartials()).toString()); } - StringBuffer handlerList = new StringBuffer(); + StringBuilder handlerList = new StringBuilder(); // Need to hand this off to the location handlers, and build a // list of marker names to use in the LocationLayer property // list. if (dataHandlers != null) { + String handler; for (LocationHandler dataHandler : dataHandlers) { dataHandler.getProperties(props); + handler = dataHandler.getPropertyPrefix(); + if (handler != null && !(handler = handler.trim()).isEmpty()) { + if (handlerList.length() != 0) { + handlerList.append(' '); + } + handlerList.append(handler); + } } } From cbc1098800fbb761b64157b370de7f45e3748077 Mon Sep 17 00:00:00 2001 From: frechett Date: Wed, 6 Nov 2019 02:44:36 +0100 Subject: [PATCH 2/8] locationHandlers are not being saved #53 The com.bbn.openmap.layer.location.LocationLayer locationHandlers are not being saved, the property value is always blank. Modified to remove the scope character from the location handler prefix --- .../openmap/layer/location/LocationLayer.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/openmap/com/bbn/openmap/layer/location/LocationLayer.java b/src/openmap/com/bbn/openmap/layer/location/LocationLayer.java index 1ea25279..63fc2a51 100644 --- a/src/openmap/com/bbn/openmap/layer/location/LocationLayer.java +++ b/src/openmap/com/bbn/openmap/layer/location/LocationLayer.java @@ -588,14 +588,22 @@ public Properties getProperties(Properties props) { // list. if (dataHandlers != null) { String handler; + int len; for (LocationHandler dataHandler : dataHandlers) { dataHandler.getProperties(props); handler = dataHandler.getPropertyPrefix(); - if (handler != null && !(handler = handler.trim()).isEmpty()) { - if (handlerList.length() != 0) { - handlerList.append(' '); + if (handler != null) { + handler = handler.trim(); + len = handler.length(); + if (handler.charAt(len - 1) == '.') { + len--; + } + if (len > 0) { + if (handlerList.length() != 0) { + handlerList.append(' '); + } + handlerList.append(handler, 0, len); } - handlerList.append(handler); } } } From 33f38c02b898b60b6b89a4894286f05d84407aec Mon Sep 17 00:00:00 2001 From: frechett Date: Wed, 6 Nov 2019 20:33:09 +0100 Subject: [PATCH 3/8] Modified default alpha to true to be compatible with old ColorFactory.createColor(int, boolean) which always passed true for alpha: return (Color) OMColor.alphaValueConstructor.newInstance(new Object[] { new Integer(value), new Boolean(true) }); --- src/openmap/com/bbn/openmap/util/PropUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openmap/com/bbn/openmap/util/PropUtils.java b/src/openmap/com/bbn/openmap/util/PropUtils.java index 772de377..63657bb9 100644 --- a/src/openmap/com/bbn/openmap/util/PropUtils.java +++ b/src/openmap/com/bbn/openmap/util/PropUtils.java @@ -582,7 +582,7 @@ public static long longFromProperties(Properties p, String propName, long defaul */ public static Color parseColorFromProperties(Properties p, String propName, String dfault) throws NumberFormatException { - return ColorFactory.parseColorFromProperties(p, propName, dfault, false); + return ColorFactory.parseColorFromProperties(p, propName, dfault, true); } /** @@ -657,7 +657,7 @@ public static Color parseColor(String colorString, boolean forceAlpha) * @see ColorFactory#parseColor(String, boolean) */ public static Color parseColor(String colorString) throws NumberFormatException { - return ColorFactory.parseColor(colorString, false); + return ColorFactory.parseColor(colorString, true); } /** From 7c936cad7c9913eee9284bc5f06a59e3e3292451 Mon Sep 17 00:00:00 2001 From: frechett Date: Wed, 6 Nov 2019 20:38:50 +0100 Subject: [PATCH 4/8] Version 5.1.15a --- src/openmap/com/bbn/openmap/MapBean.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openmap/com/bbn/openmap/MapBean.java b/src/openmap/com/bbn/openmap/MapBean.java index c7c494bb..73dfe7c7 100644 --- a/src/openmap/com/bbn/openmap/MapBean.java +++ b/src/openmap/com/bbn/openmap/MapBean.java @@ -151,7 +151,7 @@ public class MapBean extends JComponent /** * OpenMap version. */ - public static final String version = "5.1.15"; + public static final String version = "5.1.15a"; /** * Suppress the copyright message on initialization. From bdc8b9e213f6d4e5f2d18491aa111de47d559d9c Mon Sep 17 00:00:00 2001 From: Kevin Frechette Date: Mon, 10 Apr 2023 11:28:24 -0400 Subject: [PATCH 5/8] Exception when drawing raster --- src/openmap/com/bbn/openmap/MapBean.java | 2 +- .../openmap/omGraphics/OMScalingRaster.java | 95 ++++++++++++------- 2 files changed, 62 insertions(+), 35 deletions(-) diff --git a/src/openmap/com/bbn/openmap/MapBean.java b/src/openmap/com/bbn/openmap/MapBean.java index 73dfe7c7..8e5e87f3 100644 --- a/src/openmap/com/bbn/openmap/MapBean.java +++ b/src/openmap/com/bbn/openmap/MapBean.java @@ -151,7 +151,7 @@ public class MapBean extends JComponent /** * OpenMap version. */ - public static final String version = "5.1.15a"; + public static final String version = "5.1.15b"; /** * Suppress the copyright message on initialization. diff --git a/src/openmap/com/bbn/openmap/omGraphics/OMScalingRaster.java b/src/openmap/com/bbn/openmap/omGraphics/OMScalingRaster.java index aa5c478a..8c6564fb 100644 --- a/src/openmap/com/bbn/openmap/omGraphics/OMScalingRaster.java +++ b/src/openmap/com/bbn/openmap/omGraphics/OMScalingRaster.java @@ -563,44 +563,71 @@ public void render(Graphics graphics) { * @param loc the pixel location of the image. */ protected void renderImage(Graphics g, Image image, Point loc) { + if (image == null) { + if (DEBUG) { + logger.fine("ignoring null bitmap image"); + } + return; + } + if (!(g instanceof Graphics2D)) { + if (DEBUG) { + logger.fine("ignoring graphics (" + g.getClass() + ")"); + } + return; + } + final Rectangle visibleImageArea = getClippedRectangle(); + if (visibleImageArea == null) { + if (DEBUG) { + logger.fine("ignoring null visible image area"); + } + return; + } + try { + drawImage((Graphics2D) g, visibleImageArea, image, loc); + } catch (Exception ex) { + logger.warning(ex.toString()); + logger.info(getClass().getName() + "[x=" + x + ",y=" + y + ",width=" + width + + ",height=" + height + "]" + "[vx=" + visibleImageArea.x + ",vy=" + + visibleImageArea.y + ",vwidth=" + visibleImageArea.width + ",vheight=" + + visibleImageArea.height + "]"); + } + } - Rectangle visibleImageArea = getClippedRectangle(); - - if (image != null) { - - if (visibleImageArea != null) { - - if (DEBUG) { - logger.fine("drawing " + visibleImageArea + " image at " + loc.x + ", " - + loc.y); - } + /** + * Draw the image. + * + * @param g + * @param g the Graphics object to render the image into. Assumes this is a + * derivative of the Graphics passed into the OMGraphic, and can be + * modified without worrying about passing settings on to other + * OMGraphics. + * @param image the image to render. + * @param loc the pixel location of the image. + * @throws Exception if error. + */ + protected void drawImage(final Graphics2D g, final Rectangle visibleImageArea, + final Image image, final Point loc) + throws Exception { + if (DEBUG) { + logger.fine("drawing " + visibleImageArea + " image at " + loc.x + ", " + loc.y); + } + if (image instanceof BufferedImage) { + g.drawImage(((BufferedImage) image).getSubimage(visibleImageArea.x, visibleImageArea.y, visibleImageArea.width, visibleImageArea.height), scalingXFormOp, loc.x, loc.y); + } else { - if (g instanceof Graphics2D) { - if (image instanceof BufferedImage) { - ((Graphics2D) g).drawImage(((BufferedImage) image).getSubimage(visibleImageArea.x, visibleImageArea.y, visibleImageArea.width, visibleImageArea.height), scalingXFormOp, loc.x, loc.y); - } else { - - int sx1 = visibleImageArea.x; - int sy1 = visibleImageArea.y; - int sx2 = sx1 + visibleImageArea.width; - int sy2 = sy1 + visibleImageArea.height; - - int dx1 = loc.x; - int dy1 = loc.y; - Point2D d2 = scalingXFormOp.getPoint2D(new Point2D.Double(dx1 - + visibleImageArea.width, dy1 - + visibleImageArea.height), new Point2D.Double()); - int dx2 = (int) d2.getX(); - int dy2 = (int) d2.getY(); - - ((Graphics2D) g).drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, this); - } - } // else what? Never seen this test fail with Java2D + int sx1 = visibleImageArea.x; + int sy1 = visibleImageArea.y; + int sx2 = sx1 + visibleImageArea.width; + int sy2 = sy1 + visibleImageArea.height; - } + int dx1 = loc.x; + int dy1 = loc.y; + Point2D d2 = scalingXFormOp.getPoint2D(new Point2D.Double(dx1 + + visibleImageArea.width, dy1 + visibleImageArea.height), new Point2D.Double()); + int dx2 = (int) d2.getX(); + int dy2 = (int) d2.getY(); - } else if (DEBUG) { - logger.fine("ignoring null bitmap image"); + g.drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, this); } } From acad74b5356bfd1c35b5b68727115b2c1cbe19b5 Mon Sep 17 00:00:00 2001 From: Kevin Frechette Date: Mon, 10 Apr 2023 11:51:06 -0400 Subject: [PATCH 6/8] version 5.1.15b --- .gitignore | 3 ++- build.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 78010540..6c4de905 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ /package /nbproject/private/ /build/ -/dist/ \ No newline at end of file +/dist/ +src/corba/com/bbn/openmap/corba diff --git a/build.xml b/build.xml index c6dd5352..a29b36f8 100644 --- a/build.xml +++ b/build.xml @@ -18,7 +18,7 @@ **/*.gif, **/*.png, **/IntersectionTest.java" /> - + From 4d62ca8bf4c701bd76bd1cd886c9a6ef47b9a370 Mon Sep 17 00:00:00 2001 From: Kevin Frechette Date: Mon, 10 Apr 2023 14:30:06 -0400 Subject: [PATCH 7/8] Add libzip target --- .gitignore | 3 +++ build.xml | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/.gitignore b/.gitignore index 6c4de905..bfef843e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ +.DS_Store /classes /package /nbproject/private/ /build/ /dist/ +*.jar +*.zip src/corba/com/bbn/openmap/corba diff --git a/build.xml b/build.xml index a29b36f8..a9b7ee79 100644 --- a/build.xml +++ b/build.xml @@ -221,5 +221,14 @@ + + + + + + + + + From 600a246cdf4a8965629b62c75a55423f3f78cd85 Mon Sep 17 00:00:00 2001 From: Kevin Frechette Date: Mon, 10 Apr 2023 14:42:55 -0400 Subject: [PATCH 8/8] Add libzip target --- build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.xml b/build.xml index a9b7ee79..87bcdad7 100644 --- a/build.xml +++ b/build.xml @@ -227,7 +227,7 @@ - +