Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

locationHandlers are not being saved #53 #54

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
.DS_Store
/classes
/package
/nbproject/private/
/build/
/dist/
/dist/
*.jar
*.zip
src/corba/com/bbn/openmap/corba
11 changes: 10 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
**/*.gif, **/*.png, **/IntersectionTest.java" />
<property name="mac.app" value="OpenMap.app" />
<property name="jar.excludes" value="${general.excludes}, **/*.java" />
<property name="openmap_version" value="5.1.15" />
<property name="openmap_version" value="5.1.15b" />
<property name="openmap.ext" value="${openmap.home}/src/ext" />
<property name="openmap.src" value="${openmap.home}/src/openmap" />
<property name="svg.src" value="${openmap.home}/src/svg" />
@@ -221,5 +221,14 @@
<zip destfile="${openmap.zip}" basedir="${openmap_mac_package.dir}" includes="**" />
</target>

<target name="libzip" description="Create a OpenMap library package zip file." depends="clean,package">
<copy todir="${openmap_package.dir}/OpenMap">
<fileset dir="${openmap_mac_package.dir}/openmap-${openmap_version}">
<exclude name="${install_excludes}" />
</fileset>
</copy>
<zip destfile="${openmap_package.dir}/OpenMap_v${openmap_version}.zip" basedir="${openmap_package.dir}" includes="OpenMap/**" />
<delete dir="${openmap_package.dir}/OpenMap" />
</target>
</project>

2 changes: 1 addition & 1 deletion src/openmap/com/bbn/openmap/MapBean.java
Original file line number Diff line number Diff line change
@@ -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.15b";

/**
* Suppress the copyright message on initialization.
18 changes: 17 additions & 1 deletion src/openmap/com/bbn/openmap/layer/location/LocationLayer.java
Original file line number Diff line number Diff line change
@@ -581,14 +581,30 @@ 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;
int len;
for (LocationHandler dataHandler : dataHandlers) {
dataHandler.getProperties(props);
handler = dataHandler.getPropertyPrefix();
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);
}
}
}
}

95 changes: 61 additions & 34 deletions src/openmap/com/bbn/openmap/omGraphics/OMScalingRaster.java
Original file line number Diff line number Diff line change
@@ -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);
}
}

4 changes: 2 additions & 2 deletions src/openmap/com/bbn/openmap/util/PropUtils.java
Original file line number Diff line number Diff line change
@@ -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);
}

/**