Local Pan and Zoom vs. MAPEXTENT

PLP Staff



Local pan and zoom, introduced in PC ARC/INFO 3.4.2, provide a quick and convenient way to navigate the graphic display. The method by which graphic elements are stored facilitates rapid redrawing and windowing in all graphic modules, not to mention undoing graphics in ArcplotW (you can't do this in Host ARC/INFO!):

Figure 1

While useful for quickly zooming in to examine and manipulate features in ArceditW (as well as RouteW and AllocatW), local pan and zoom do have their limitations. For example, if your edit parameters (EDITD, SNAPD, GRAIN, and WEED) are set to DEFAULT[1], they will not automatically reduce as you zoom in. Also, there's a limit to the resolution of the display list graphics, and zooming in to more minute areas will lead to greater degradation of graphic display and cursor behavior. Another performance consideration is that reducing the map extent reduces the number of features that need to be regenerated when the DRAW command is executed.

Zoom Behavior with Coverage Shown Below

Figure 2

Local Pan and Zoom MAPEXTENT
Figure 3

Figure 4

Pointing Device Mouse only, independent of COORDINATE device Mouse, digitizer, or keyboard
Display Automatically Regenerated Yes No
Dynamic Edit Parameters No Yes
Non-scaling Symbols COLOR and HARDWARE only Yes
Non-scaling ID Text No Yes
Panning and Zooming Features draw within current MAPEXTENT only Can zoom or pan outside current MAPEXTENT
Windowing Yes No
Zoom Previous Yes No
Returns Focus to Text Window No Yes

But the fact remains that MAPEXTENT is a clumsy command to use, and is generally best implemented in an SML routine. Back in the 3.4D+ days, one of the first SMLs I ever wrote was to pan and zoom the map extent—I assigned the routine to a function key using &setkey, thus allowing me to pan and zoom with only two keystrokes. The following is an updated version:

&routine z

SHOW MAPE -11 -12 -13 -14
&if &eq %-11 900000000 &do
   &type "Map extent not defined"
   &return
&end
&if &eq "x%39" "x" &do
   &sv 39 39
&end
&if &nr %39 39 49 &do
   &sv 39 39
&end
&if &eq "x%-1" "x" &do
   &key 1 "Pan <1>/<2> Point | Zoom <B>ox <O>ut <F>ull <P>revious"
   &extract 1 1 1
&else
   &extract 1 -1 1
&end
&if &eq %1 1 &do
   &cv -7 ( %-13 - %-11 ) / 2 + %-11
   &cv -8 ( %-14 - %-12 ) / 2 + %-12
   &type "Point to new centerpoint:"
   &getxym -5 -6 -20
   WIN FOCUS T
   &cv -1 %-11 + %-5 - %-7
   &cv -2 %-12 + %-6 - %-8
   &cv -3 %-13 + %-5 - %-7
   &cv -4 %-14 + %-6 - %-8
   MAPE %-1 %-2 %-3 %-4
&elseif &eq %1 2 &do
   &type "Enter Point 1:"
   &getxym -5 -6 -20
   &type "Enter Point 2:"
   &getxym -8 -9 -20 1
   WIN FOCUS T
   &cv -1 %-11 + ( %-5 - %-8 )
   &cv -2 %-12 + ( %-6 - %-9 )
   &cv -3 %-13 + ( %-5 - %-8 )
   &cv -4 %-14 + ( %-6 - %-9 )
   MAPE %-1 %-2 %-3 %-4
&elseif &eq %1 B &do
   &if &eq "x%-2" "x" &do
      MAPE *
   &else
      MAPE %-2 %-3 %-4 %-5
   &end
   WIN FOCUS T
&elseif &eq %1 O &do
   MAPE zoom 0.5
&elseif &eq %1 F &do
   MAPE DEF
&elseif &eq %1 P &do
   &value -1 %39
   MAPE %-1
   &dec 39
   DRAW
   &return
&else
   &return
&end
&if &eq %39 49 &do
   &sv -2 41
   &sv -3 40
   &while &rn %-2 41 49 &do
      &value -4 %-2
      &value %-3 -4
      &inc -2
      &inc -3
   &end
&end
&if &ne %39 49 &do
   &inc 39
&end
&sv %39 "%-11 %-12 %-13 %-14"
SHOW MAPE -11 -12 -13 -14
DRAW
&return
Use COMPSML Z N to generate an SML from the routine. It reserves variables 39-49 as a map extent stack and pointer, enabling up to ten levels of zoom previous, and shifts the contents of the stack when it's full. Note also the ability to pass values to the box option; this is utilized by the following routine.

Faking MAPE SEL

Host ARC/INFO's MAPEXTENT command has a SELECT option, setting the map extent equal to the extent of a selected set of features. The following routine emulates that function:

&routine msel

&define editf -8 &var
&define numsel -9 &var
&define nump -10 &var
&define xmin -11 &var
&define ymin -12 &var
&define xmax -13 &var
&define ymax -14 &var
&define x -15 &var
&define y -16 &var
&define i -17 &var
&define id -18 &var
&define temp -19 &var

SHOW EDITF [editf]
&if &eq [editf] ANNOTATION &do
   &sv [editf] ANNO
&end
SHOW NUMBER SELECT [numsel]
&if &eq [numsel] 0 &do
   &return ERROR
&end
&sv [i] 1

&rem **** get initial point

SHOW SELECT %[i] [id]
&if &eq [editf] ARC &or &eq [editf] ANNO &do
   SHOW %[editf] %[id] NPNTS [nump]
   SHOW %[editf] %[id] POINT 1 [xmin] [ymin]
&else
   SHOW %[editf] %[id] COORDINATE [xmin] [ymin]
&end
&value [xmax] [xmin]
&value [ymax] [ymin]

&rem **** find minimum and maximum points in selected set

&while &rn [i] 1 [numsel] &do
   SHOW SELECT %[i] [id]
   &if &eq [editf] ARC &or &eq [editf] ANNO &do
      SHOW %[editf] %[id] NPNTS [nump]
      SHOW %[editf] %[id] POINT 1 [x] [y]
      &cv [xmin] [xmin] min [x]
      &cv [ymin] [ymin] min [y]
      &cv [xmax] [xmax] max [x]
      &cv [ymax] [ymax] max [y]
      &if &ne [nump] 1 &do
         SHOW %[editf] %[id] POINT %[nump] [x] [y]
         &cv [xmin] [xmin] min [x]
         &cv [ymin] [ymin] min [y]
         &cv [xmax] [xmax] max [x]
         &cv [ymax] [ymax] max [y]
         &if &ne [nump] 2 &do
            SHOW %[editf] %[id] POINT %<[nump] / 2 rnd> [x] [y]
            &cv [xmin] [xmin] min [x]
            &cv [ymin] [ymin] min [y]
            &cv [xmax] [xmax] max [x]
            &cv [ymax] [ymax] max [y]
         &end
      &end
   &else
      SHOW %[editf] %[id] COORDINATE [x] [y]
      &cv [xmin] [xmin] min [x]
      &cv [ymin] [ymin] min [y]
      &cv [xmax] [xmax] max [x]
      &cv [ymax] [ymax] max [y]
   &end
   &inc [i]
&end

&rem **** adjust final extent

&if &eq [xmin] [xmax] &do
   SHOW MAPE -1 -2 -3 -4
   &cv [temp] %-3 - %-1 / 2
   &cv [xmin] [xmin] - [temp]
   &cv [xmax] [xmax] + [temp]
&else
   &cv [temp] ( [xmax] - [xmin] ) / 20
   &cv [xmin] [xmin] - [temp]
   &cv [xmax] [xmax] + [temp]
&end

&if &eq [ymin] [ymax] &do
   SHOW MAPE -1 -2 -3 -4
   &cv [temp] %-4 - %-2 / 2
   &cv [ymin] [ymin] - [temp]
   &cv [ymax] [ymax] + [temp]
&else
   &cv [temp] ( [ymax] - [ymin] ) / 20
   &cv [ymin] [ymin] - [temp]
   &cv [ymax] [ymax] + [temp]
&end

&r z b [xmin] [ymin] [xmax] [ymax]

&return OK
Again, use COMPSML MSEL N to generate an SML from the routine. Since it's too slow to check every point in an arc, the routine only checks the endpoints and middle point (if any) of each arc—this way, at least part(s) of the arc(s) will be seen. If either the width or the height of the resulting extent is zero, the current map extent width or height is used; otherwise, the extent of the selected features is increased by ten percent.

(By the way, older versions of both routines are used in WEDIT.)


[1]The DEFAULT option, new to 3.5, may be used explicitly to restore dynamic parameters.

PLP