[GRASS-dev] Re: gis.m zooming: 2 new bugs

Maciej Sieczka tutey at o2.pl
Wed Sep 20 14:57:46 EDT 2006


Michael Barton wrote:

>> Michael Barton wrote:
>>> The box zoom-in and zoom-out CANNOT operate the same mathematically, as I
>>> tried to explain below. It is impossible. Given that, the question is what
>>> kind of result do you want to see. Currently, both update the region in both
>>> dimensions exactly as defined by the zoom box.

> Maciej Sieczka wrote:
>> That's not true. Box-zoom-in indeed always updates the region geometry
>> exactly following the zoom box (OK), but the box-zoom-out fails to do
>> that *if* the zoom box overlaps the part of map canvas where nothing is
>> rendered (BAD).

Michael Barton wrote:

> Zooming in decreases the region extents while zooming out increases the
> extents.
> 
> You are not following the math.

Well, that's not very kind of you, and beyond the meritum first of all.

> A zoom in box uses the geographic
> coordinates of the box extents to directly set the new region extents. This
> is IMPOSSIBLE to do with a zoom out box. Rather the box defines a region,
> and new larger extents must be calculated such that the original extents fit
> inside the region defined by the zoom out box. To zoom out, you must make
> the region bigger than what you can see. You cannot draw a box on the screen
> that is bigger than the screen (or at least I don't think that anyone would
> want to do this). So the box cannot directly define the extents.

I realize that the zoom box doesn't define the extents directly. But it
does define the geometry directly. So if the geometry is set wrong, the
resulting region extent is wrong too. And currently the box-zoom-out
sets the region geometry wrong (ie. different than the zoom box that is
drawn by the user) if the box zoom includes a part of an empty map
canvas. *This* should be fixed.

>>> You suggest that it gives visually undesirable results. Updating the region
>>> "properly" is meaningless> (sorry). This depends on what is meant by
>>> "properly".

>> "properly" means that the box-zoom update the region geometry according
>> to the geometry of the zoom box. Currently this is only the case for
>> box-zoom-in - no matter if the zoom box overlaps the part of map canvas
>> where nothing is rendered or not. In case of box-zoom-out however, if
>> the zoom box overlaps the part of map canvas where nothing is rendered,
>> the resulting region geometry fails to reflect the geomtery of the zoom
>> box, which is "wrong".

> Currently the new region defined by a zoom out box DOES reflect the geometry
> of the zoom box. This is why it looks weird to you. You are giving it weird
> geometry.

What weird geometry?

> You are essentially telling it to increase the region extents
> so that the current region gets smaller.
> It almost sounds like you are saying
> that if you try to zoom "out" to an area smaller than your box the result
> should be to zoom "in", that is a tool designed to INCREASE region extents
> should REDUCE the region extents in these circumstances. This seems like a
> completely unexpected behavior of a tool that is supposed to INCREASE the
> region extents.

That's not what I mean. I mean that the geometry must be preserved
exactly the way I set it by drawing the zoom box. Currently in gis.m,
using box-zoom-out, this geometry is preserved OK only when I don't
include a part of an empty map canvas in my zoom box. But if I do that,
the part of my zoom box that overlaps this empty canvas is not taken
into account, so the geometry is set wrong (ie. not the way I drew the
zoom box), thus the resulting region extent is also wrong.

Is it impossible to fix that?

> It would help to know if you are actually trying to achieve some kind of
> meaningful result and what that is, or if you are just trying out tools in
> various circumstances.

No, I'm not teasing you for fun.

> I'm have set the zoom out box tool to treat the case of a zoom out box
> larger than the current region as undefined, so that it does not change the
> display region in that dimension (it won't produce an error). This will
> probably give you the visual effects you are looking for, but I'm not sure.

IMO the patch should be reverted. It doesn't fix the problem. The issue
is that geometry is not handled properly if the zoom box overlaps an
empty map canvas when box-zooming-out, which, as result, leads to a
bogus region.

As such situation (zooming over an empty map canvas) is handled OK in
the box-zoom-in, I suppose it could also be fixed for box-zoom-out.

If I still haven't made myself clear in this email, please ask me on.

Maciek




More information about the grass-dev mailing list