RE: [OpenMap Users] Visibility and OMScalingRaster

From: Peter Solderitsch <>
Date: Thu, 2 Dec 2004 17:22:03 -0500

As a follow-up: I appear to be able to fix this by subclassing
OMScalingIcon (or OMScalingRaster, depending on your needs), and
overriding the scaleTo() method as follows:

protected void scaleTo(Projection thisProj) {

      if (this.bitmap == null) {
         this.shape = null;

YMMV, but it doesn't seem to "break" anything to do this, since the
shape object is regenerated anyway the next time the projection changes.


-----Original Message-----
From: Peter Solderitsch
Sent: Thursday, December 02, 2004 5:01 PM
Cc: 'Don Dietrick'
Subject: RE: [OpenMap Users] Visibility and OMScalingRaster

Sorry to have to bring back a subject from a few months ago, but even
with OpenMap 4.6.1 I'm still having problems that I believe is related
to the scaleTo() method in OMScalingRaster.

When you have a scaling raster or scaling icon on your map and change
the projection (by panning or zooming) such that in the very next
projection, the scaling raster is no longer in the map's x,y space, if
you try to do a "find closest" on a list containing that graphic, it
will be reported at its last 'displayed' x,y location... My hunch in
perusing the code is that getShape() for the graphic is returning a
shape that isn't really "there" any more, and it's not getting nulled
out properly in the scaleTo() method (which, as demonstrated below, has
had prior similar issues related to visibility).

If you have a scaling raster or icon on your map, and then change the
projection such that the icon remains on the map but in a different x,y
location, no problem. It is only when the graphic goes entirely off

Any ideas?


-----Original Message-----
From: Don Dietrick []
Sent: Friday, September 24, 2004 4:03 PM
To: Peter Solderitsch
Subject: Re: [OpenMap Users] Visibility and OMScalingRaster

Hi Peter,

Thanks for pointing this out. I actually think it's wrong that the
visibility is changed at all. Instead, the internal bitmap image
should be set to null if the scaled image doesn't overlap with the
projection window, which would signal the superclass render method to
not bother trying to render it.

The problem with using the visibility variable is that if the layer
author makes an OMScalingRaster invisible for some reason, and the
OMScalingRaster is offscreen, when it comes back on screen it will be
made visible again automatically, even though the author didn't change
the visibility setting.

I've made the change and tested it, I'm going to be updating the
repository shortly.

- Don

On Sep 24, 2004, at 2:05 PM, Peter Solderitsch wrote:

> All,
> Apologies if this has been brought up before, but I didn't see
> anything about it in the mailing list archives.
> I believe that OMScalingRaster (and its subclasses, like
> OMScalingIcon) have a bug that prevents objects of that type to ever
> be successfully set as invisible.
> I've been trying to track down behavior where I would set an
> OMGraphicList as invisible, and all the graphics in the list except
> for the scaling rasters would be correctly invisible, but the rasters
> remained on screen. Doing some digging, it looks to me like the
> scaleTo(Projection) method in does not make an
> attempt to preserve the visibility set on the graphic prior to the
> scaleTo() method being called; rather, it always sets visibility to
> 'true'.
> I fixed my immediate need by subclassing OMScalingIcon (which was the
> class I was using), and overriding scaleTo() to first remember the
> prior visibility state, and then re-set the visibility after the
> super.scaleTo() has been called. However, I believe this is probably

> a
> good candidate to get fixed in the main source branch.
> Thanks,
> -Peter
> --
> [To unsubscribe to this list send an email to "" with
> the following text in the BODY of the message "unsubscribe
> openmap-users"]

Don Dietrick,
BBN Technologies, Cambridge, MA =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

[To unsubscribe to this list send an email to "" with the
following text in the BODY of the message "unsubscribe openmap-users"]
[To unsubscribe to this list send an email to ""
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Dec 02 2004 - 17:22:31 EST

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