正在加载图片...
1070 SOME O-O TECHNIQUES FOR GRAPHICAL INTERACTIVE APPLICATIONS $32.3 The four basic concepts-WORLD,FIGURE,WINDOW,DEVICE transpose readily to general graphical applications,where the world may contain arbitrary figures of interest to a certain computer application,rather than just representations of geographical objects.Rectangular areas of the world(windows)will be displayed on rectangular areas of the device (the computer screen). The figure on the previous page shows the three planes:world (bottom),window (middle)and device(top).The notion of window plays a central role,as each window is associated both with an area of the world and with an area of the device.Windows also cause the only significant extension to the basic map concepts:support for hierarchically nested windows.Our windows will be permitted to have subwindows,with no limit on the nesting level.(No nesting appears in the figure.) Coordinates We need two coordinate systems:device coordinates and world coordinates.Device coordinates measure the positions of displayed items on the device.On computer screens, they are often measured in pixels;a pixel (picture element)is the size of a small dot. usually the smallest displayable item. There is no standard for the unit of world coordinates,and there should not be since the world coordinate system is best left for application developers to decide:an astronomer may wish to work in light years,a cartographer in kilometers,a biologist in millimeters or microns. Because a window captures part of a world,it will have a certain world position (defined by the x and y world coordinates of its top left corner)and a certain extent (horizontal and vertical lengths ofthe parts of the world covered).The world position and the extent are expressed in world coordinate units. Because the window is displayed on part of a device,it has a certain device position (defined by the x and y device coordinates of its top left corner)and a certain size on the device,all expressed in device coordinate units.For a window with no parent,the position is defined with respect to the device;for a subwindow,the position is always defined relative to the parent.Thanks to this convention,any application that uses windows may run with the whole screen to itself as well as in a previously allocated window. Operations on windows To take care of the hierarchical nature of windows we make class WINDOWV an heir of class TWO WAY TREE,an implementation of trees.As a result,all hierarchical operations are readily available as tree operations:add a subwindow(child),reattach to a different enclosing window (parent)and so on.To set the world and device positions of a window,we will use one of the following procedures(all with two arguments): Set absolute position Move,relative to current position Position in world go pan Position on device place proportional move proportional place pixel move pixel1070 SOME O-O TECHNIQUES FOR GRAPHICAL INTERACTIVE APPLICATIONS §32.3 The four basic concepts — WORLD, FIGURE, WINDOW, DEVICE — transpose readily to general graphical applications, where the world may contain arbitrary figures of interest to a certain computer application, rather than just representations of geographical objects. Rectangular areas of the world (windows) will be displayed on rectangular areas of the device (the computer screen). The figure on the previous page shows the three planes: world (bottom), window (middle) and device (top). The notion of window plays a central role, as each window is associated both with an area of the world and with an area of the device. Windows also cause the only significant extension to the basic map concepts: support for hierarchically nested windows. Our windows will be permitted to have subwindows, with no limit on the nesting level. (No nesting appears in the figure.) Coordinates We need two coordinate systems: device coordinates and world coordinates. Device coordinates measure the positions of displayed items on the device. On computer screens, they are often measured in pixels; a pixel (picture element) is the size of a small dot, usually the smallest displayable item. There is no standard for the unit of world coordinates, and there should not be since the world coordinate system is best left for application developers to decide: an astronomer may wish to work in light years, a cartographer in kilometers, a biologist in millimeters or microns. Because a window captures part of a world, it will have a certain world position (defined by the x and y world coordinates of its top left corner) and a certain extent (horizontal and vertical lengths of the parts of the world covered). The world position and the extent are expressed in world coordinate units. Because the window is displayed on part of a device, it has a certain device position (defined by the x and y device coordinates of its top left corner) and a certain size on the device, all expressed in device coordinate units. For a window with no parent, the position is defined with respect to the device; for a subwindow, the position is always defined relative to the parent. Thanks to this convention, any application that uses windows may run with the whole screen to itself as well as in a previously allocated window. Operations on windows To take care of the hierarchical nature of windows we make class WINDOW an heir of class TWO_WAY_TREE, an implementation of trees. As a result, all hierarchical operations are readily available as tree operations: add a subwindow (child), reattach to a different enclosing window (parent) and so on. To set the world and device positions of a window, we will use one of the following procedures (all with two arguments): Set absolute position Move, relative to current position Position in world go pan Position on device place_proportional place_pixel move_proportional move_pixel
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有