[OpenMap Users] shape layer rendering hints

From: Tore Halset <halset_at_email.domain.hidden>
Date: Thu Jun 17 2010 - 06:53:56 EDT

Hello.

In OpenMap trunk, a ShapeLayer is inited with a BufferedImageRenderPolicy that has a RenderingHints Map with no rows. That RenderingHints object is then applied to the Graphics2D during rendering resulting in removing any other rendering hints.

The result for me is that the ShapeLayer is drawn without antialiasing and more importantly, preventing other layers from using antialiasing.

Has this been changed lately? The openmap.jar I built from OpenMap trunk as of 20100105 does not have this problem.

The attached patch solve this problem for me.

Regards,
 - Tore.

Index: src/openmap/com/bbn/openmap/layer/policy/RenderingHintsRenderPolicy.java
===================================================================
--- src/openmap/com/bbn/openmap/layer/policy/RenderingHintsRenderPolicy.java (revision 2187)
+++ src/openmap/com/bbn/openmap/layer/policy/RenderingHintsRenderPolicy.java (working copy)
@@ -25,6 +25,8 @@
 import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
+import java.awt.RenderingHints.Key;
+import java.util.Map;
 import java.util.Properties;
 import java.util.Vector;
 import java.util.logging.Level;
@@ -132,7 +134,11 @@
 
     public void setRenderingHints(Graphics g) {
         if (renderingHints != null && g instanceof Graphics2D) {
- ((Graphics2D) g).setRenderingHints(renderingHints);
+ Graphics2D g2 = (Graphics2D) g;
+ for (Map.Entry<Object, Object> entry : renderingHints.entrySet()) {
+ Key key = (Key) entry.getKey();
+ g2.setRenderingHint(key, entry.getValue());
+ }
         }
     }
 

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Jun 17 07:02:25 2010

This archive was generated by hypermail 2.1.8 : Thu Jun 17 2010 - 07:02:26 EDT