World Coordinate System Overview
The customizable coordinate system of the control is defined as the world coordinate system (WCS). By default, the world is set to (0,0) for the bottom left of the control, and (100,100) for the top right, and is a square world (the top or left may actually be larger than 100 depending on the size of the CAD control object, see more below about the square world).
WorldSet can be used to change the entire system, or the individual boundaries can be changed with WorldBottom, WorldLeft, WorldRight, and WorldTop. Panning and zooming can be accomplished by manipulating the world coordinate system.
Panning is accomplished by changing the sets of horizontal or vertical boundaries. For example, to pan
the default settings "up" a quarter of the view, the WorldBottom property needs to be
set to -25, and WorldTop to 75 (or alternatively, call WorldSet passing 0, 75, 100, -25).
The WorldPan
method has been provided as a wrapper to changing the boundary values manually.
The world can also be panned with the mouse by setting ViewMouseTool
to -2.
The WorldZoom
method can zoom the control view programmatically and the zoom realtime tool allows you to zoom with the
mouse by setting the ViewMouseTool
to -4.
Zooming is accomplished by changing all four boundaries. For example, to zoom the default settings
"in" 25%, call WorldSet passing 12.5, 87.5, 87.5, 12.5. Or, to zoom the default settings
"out" 25%, call WorldSet passing -12.5, 112.5, 112.5, -12.5.
The world can also be zoomed with the mouse within a rectangle boundary by setting ViewMouseTool
to -3.
At this time, the smallest the WCS can be set to is a difference of .75 world coords for the distance between the horziontal boundaries or vertical boundaries. Zooming will be prevented at this point.
A square world is one in which the distance between coordinates horizontally is the same as the distance vertically. This property can be set with WorldSquare and is true by default.
When the WCS is set, the values of the boundaries may not make up a square world. To account for this, the control will automatically change the boundaries necessary to enforce the squareness of the world.
For instance, when the control is first added, the world is (0,0) for the bottom left, and (100,100) for the top right. But the actual size of the CAD view will most likely not be square. Say, if the actual size were wider than taller, the top boundary would remain 100, but the right boundary would adjust to a greater value as necessary to make the world square. Likewise, if the actual size of the view were taller than wider, the right boundary would remain 100, while the top boundary would adjust to a greater value.
When the WCS is not square, the control will not adjust the boundary values, and the distance between coordinates can differ horizontally from vertically.
For this effect to work, WorldSquare must be called before WorldSet.
Conversions
Conversion routines are provided to translate values to/from world coords to pixels.
See Also
![]() |
Last modified on: Tuesday, February 04, 2003