Re: [OpenMap Users] shape layer rendering hints

From: Don Dietrick <dfdietrick_at_gmail.com>
Date: Wed, 23 Jun 2010 10:59:11 -0400

Hi Tore,

I don't remember this changing, but thanks for submitting the patch.

It seems like rendering policies should be making these changes on a copy of the Graphics object, so that any change a layer makes only affects its rendering cycle. If a change should be applied across all layers, the hints should be applied to the MapBean. I'll check to make sure this is the case.

- Don


On Jun 17, 2010, at 6:53 AM, Tore Halset wrote:

> 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)
> _at_@ -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;
> _at_@ -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());
> + }
> }
> }
>
>
> <om5-rendering-hints.patch>

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Wed Jun 23 2010 - 11:00:24 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:09 EDT