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

Michael Barton michael.barton at asu.edu
Thu Sep 21 13:03:03 EDT 2006


Maciej has the right idea. Let's start with how the zoom out box works in
the "normal" context and deal with the "abnormal" context later.

The zoom out box DOES respect the form of the box drawn... BUT not in the
same way that the zoom in box does.

In many ways, it is analogous to what happens in the display window when you
resize it. Like the display window, the "goal" of the zoom box algorithm is
to fit the current region into the box. In this sense, it very much respects
the form of the box.

To do this, it expands the region in every direction in proportion to the
distance between the box extent and the corresponding region extent (e.g.,
proportionate to the distance between the east edge of the box and the east
region extent). The new region geometry is determined by the box
geometry...***relative to the original region geometry***. So, if the south
side of the box is a long way from the south edge of the region (i.e., near
the top of the display), the region is extended a long way in the south
dimension. This is the only way to get the original display to fit into the
box.

But to complicate things, the resultant region must then be rendered into a
graphic that is itself resized to fit into the display window. So think what
happens if the window geometry, region geometry, and zoom box geometry are
all different. The region geometry is extended and changed to fit into the
zoom box, then the graphic output from the new region is resized to fit into
the window. Unlike the zoom in box, the final result can look quite a bit
different from the zoom out box, original region, or window.

So how is this actually used in practice? Say you have a regional map,
zoomed in to a city. You'd like to zoom out to the larger region and have
the city end up in the upper left corner of your map. Create a zoom out box
of the size you want--that is, such that the current display will fit
inside--in the upper left corner of your display. The currently displayed
map, with the city in the center, will appear within the area of the zoom
out box. 

On the other hand, if you just want to zoom out from your current view, like
reducing the zoom on a camera's telephoto lens, just click the zoom out tool
without drawing a box. Then it simply increases the region extents by a
constant amount in all directions each time you click. In the example above,
your city would remain in the center and you would see more and more of its
surrounding region.

I'll stop here to see if this clarifies things or totally confuses people
before dealing with the special of case of what happens if you try to use a
zoom box that extends outside the defined region boundary in GRASS. This
tool can be quite useful, but it not nearly as straightforward as the zoom
in box. Please be aware that this has been as difficult for me to get my
head around as for others. I've just been struggling with expressing this
agorithmically for longer.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton


> From: Moritz Lennert <mlennert at club.worldonline.be>
> Date: Thu, 21 Sep 2006 11:22:54 +0200
> To: Michael Barton <michael.barton at asu.edu>
> Cc: Maciej Sieczka <tutey at o2.pl>, Michael Barton <c.michael.barton at gmail.com>,
> grass-dev <grass-dev at grass.itc.it>
> Subject: Re: [GRASS-dev] Re: gis.m zooming: 2 new bugs
> 
> Just saw that Maciej has already responded in the same direction, but
> posting this anyway, in case it helps:
> 
> Michael Barton wrote:
>> Somehow we are not communicating here.
> 
> I agree. Therefore, let me try to figure out what really is the problem
> here.
> 
> As far as I understand it, zoom-out by box never respects the form of
> the box you draw, be it within or without the region. See
> 
> http://moritz.homelinux.org/grass/grass_zooming.html
> 
> for a demonstration.
> 
> As you can see, even with no empty space on the canvas (i.e. the region
> filling the canvas completely), the shape of the region which is
> displayed after zoom-out has nothing to do with the shape of the box.
> This is completely different from the zoom-in behaviour, where the shape
> of the box is respected.
> 
> This is one issue.
> 
> The other issue, as far as I understand, is the fact that if you draw a
> zoom-in box across the empty part of the canvas (i.e. a part where
> theoretically there is map data, but the way the region is defined, this
> map data is not displayed) the resulting displayed map, includes the
> part that was not displayed before, but which was within the zooming box.
> 
> The zooming out by box does not behave this way. Obviously, after a
> zoom-out you would expect to see more of the map than what you saw
> before. This is not always the case as you can see here:
> 
> http://moritz.homelinux.org/grass/zoom_out.html
> 
> Notice the red area. It appears in the zoom-in, but it doesn't in the
> zoom-out: not very "logical"...
> 
> Maybe this helps,
> 
> Moritz
> 
> 
>> 
>> 
>>> From: Maciej Sieczka <tutey at o2.pl>
>>> Date: Thu, 21 Sep 2006 07:44:04 +0200
>>> To: Michael Barton <michael.barton at asu.edu>
>>> Cc: Michael Barton <c.michael.barton at gmail.com>, grass-dev
>>> <grass-dev at grass.itc.it>, Moritz Lennert <mlennert at club.worldonline.be>
>>> Subject: Re: [GRASS-dev] Re: gis.m zooming: 2 new bugs
>>> 
>>> No. The E-W extent should change the same way the N-S does. This is the
>>> case now for box-zoom-out (GOOD), but only when the zoom box doesn't
>>> overlap the map canvas outside the current region (BAD).
>>> This should be
>>> fixed - so that the region geometry reflects the zoom box geometry
>>> exactly, no matter if the zoom box overlaps the map canvas outside the
>>> current region or not. Box-zoom-in behaves correctly in this regard.
>>> Box-zoom-out should do the same.
>> 
>> Let me try again. Zooming in makes a map (total extents) smaller. Then the
>> graphic image of the map must be expanded to fill the display window. The
>> map *looks* magnified, even though it is smaller than before.
>> 
>> Zooming out makes a map bigger (total extents). Then the graphic image must
>> be shrunk to fit into the display window. Hence the map *looks* reduced,
>> even though it is bigger than before. One must be careful not to confuse the
>> region geometry (NSEW extents) with the part the region that holds a visible
>> raster or vector or the apparent size and shape of the visible portion of a
>> region within the display window.
>> 
>> Zoom in and zoom out boxes work completely differently from each other. The
>> zoom in box makes the new region the size and shape of the box. The zoom out
>> box defines a region that the original extents must fit into and expands the
>> region in order to make this happen.
>> 
>> At the time of your first report a couple days ago, the zoom out box worked
>> exactly the same in all directions, regardless of whether it was larger than
>> the region or not.
>> 
>> Extending a zoom out box beyond the bounds of the current region
>> conceptually doesn't make sense (like asking, How large is blue?). The
>> region already fits inside the box, so it makes no sense to expand the
>> region so that the original extents fit inside the box. In this case, the
>> zoom out algorithm, working perfectly correctly and consistently in all
>> directions, can produce visual results that are not very useful.
>> 
>> For changing the region, using a zoom out box that extends beyond the region
>> bounds, the only meaningful computational alternatives are the following:
>> 
>> 1. let inappropriate use of a zoom out box continue to produce logically
>> consistent and completely predictable, but not very useful results on the
>> display;
>> 
>> 2. generate an error dialog when someone tries to draw zoom out box that
>> extends beyond a region boundary;
>> 
>> 3. change the zoom out box behavior when it is drawn beyond a region
>> boundary (i.e., a region extent is already inside the box) so that it no
>> longer behaves like a zoom out box but sets the region in a different way. I
>> see 2 reasonable ways to change the behavior of a zoom out box when it goes
>> out of bounds.
>> 
>> 3a. Where the zoom out box extends beyond the region bounds, it simply does
>> not do anything. That is, it does not change the region. The part of the
>> zoom out box that remains within the region bounds will change the region
>> accordingly (i.e., expand it so that the original extents will fit into the
>> box) and the other extents will simply stay the way they were. This is
>> pretty straightforward behavior conceptually and not overly difficult to
>> describe. The new region does fit inside the box, but may not fill it in all
>> directions. This is the way it is now.
>> 
>> 3b. Where the zoom out box extends beyond the region bounds, it changes to
>> behave like a zoom in box. That is, the box itself defines the new region
>> extents in the out of bounds part and the region expands to completely fill
>> the box in that dimension. Where it remains within the region bounds it
>> still behaves like a zoom out box (i.e., expand the region in that dimension
>> so that the original extents will fit into the box). This is conceptually
>> more complicated and harder to explain from scratch, but perhaps more
>> satisfying to some in that the region fills the box in all directions,
>> regardless of how it started out. This produces visual effects similar to,
>> but not exactly the same as 3a.
>> 
>> There are no other options AFAICT. It is not a matter of being unwilling to
>> make changes. It's just that these are all the possible algorithms that
>> produce reasonably meaningful region changing behavior with a zoom out box.
>> However, if someone can come up with a different algorithm, more power to
>> them.
>> 
>> Michael
>> 
>> 
>> 
>> __________________________________________
>> Michael Barton, Professor of Anthropology
>> School of Human Evolution & Social Change
>> Center for Social Dynamics & Complexity
>> Arizona State University
>> 
>> phone: 480-965-6213
>> fax: 480-965-7671
>> www: http://www.public.asu.edu/~cmbarton
>> 
> 




More information about the grass-dev mailing list