IActiveView
This interface manages the main application window in ArcMap and all drawing operations.
该接口管理ArcMap中的主应用程序窗口和所有绘图操作。
In ArcMap, two objects implement this interface: PageLayout and Map. These two objects correspond to the two different views in ArcMap: layout and data view. Only one view can be active at a time and this is termed the active view. IMxDocument::ActiveView holds a reference to the current active view object (a Map or the PageLayout). For example, if the ArcMap application is in layout mode, IMxDocument::ActiveView returns an IActiveView reference to the PageLayout object. Alternatively, if the application is in data view, this propery returns a reference to the focus map.
在ArcMap中,有两个对象实现了这个接口。PageLayout和Map。这两个对象对应于ArcMap中的两个不同视图:布局和数据视图。在同一时间只能有一个视图处于活动状态,这被称为活动视图。 IMxDocument::ActiveView持有对当前活动视图对象(地图或PageLayout)的一个引用。例如,如果ArcMap应用程序处于布局模式,IMxDocument::ActiveView返回对PageLayout对象的IActiveView引用。或者,如果应用程序处于数据视图中,该属性会返回对焦点地图的引用。
ArcMap has view commands which allow users to toggle between layout view and data view. These commands appear on the View menu and on the scroll bar.
ArcMap有一些视图命令,允许用户在布局视图和数据视图之间进行切换。这些命令出现在视图菜单和滚动条上。
An ArcMap document can contain many Maps. Make sure you have the desired object when working with this interface. Otherwise, operations such as drawing may not be occurring in the application window as you expect. For example, a Map obtained through IMxDocument::Maps is not guaranteed to be the focus map. If you know you want a reference to the focus map, use IMxDocument::FocusMap. Similarly, if you know you want a reference to the page layout, use IMxDocument::PageLayout instead. You can change the document’s active view by setting IMxDocument::ActiveView.
一个ArcMap文档可以包含许多地图。在使用这个界面时,请确保你有所需的对象。否则,绘图等操作可能不会像您预期的那样在应用程序窗口中发生。例如,通过IMxDocument::Maps获得的地图不能保证是焦点地图。如果你知道你想要一个对焦点地图的引用,使用IMxDocument::FocusMap。 类似地,如果你知道你想要一个对页面布局的引用,使用IMxDocument::PageLayout代替。你可以通过设置来改变文档的活动视图
ActiveView.PartialRefresh
The main application window is controlled by a view (IActiveView). ArcMap currently has two view objects: Map (data view) and PageLayout (layout view). Each view has a ScreenDisplay object which performs drawing operations. The ScreenDisplay object also makes it possible for clients to create any number of caches. A cache is an off screen bitmap representing the application’s window. Instead of drawing directly to the screen, graphics are drawn into caches, then the caches are drawn on the screen. When the application’s window is obscured and requires redrawing, it is done so from the caches instead of from a database. In this way, caches improve drawing performance - bitmap rendering is faster than reading and displaying data from a database.
主应用程序窗口由一个视图(IActiveView)控制。 ArcMap目前有两个视图对象。地图(数据视图)和PageLayout(布局视图)。 每个视图都有一个ScreenDisplay对象,用于执行绘图操作。ScreenDisplay对象也使得客户可以创建任意数量的缓存。 缓存是一个屏幕外的位图,代表应用程序的窗口。 图形不是直接绘制到屏幕上,而是被绘制到缓存中,然后缓存被绘制到屏幕上。 当应用程序的窗口被遮挡而需要重新绘制时,就从缓存中而不是从数据库中进行。 通过这种方式,缓存提高了绘制性能–位图渲染比从数据库中读取和显示数据要快。
In general, the Map creates three caches: one for all the layers, another if there are annotation or graphics, and a third cache if there is a feature selection. A layer can create its own private cache if it sets ILayer::Cached equal to TRUE. In this case, the Map will create a separate cache for the layer and groups the layers above and below it into different caches.
一般来说,地图会创建三个缓存:一个用于所有图层,另一个用于有注释或图形的情况,第三个缓存用于有特征选择的情况。 如果一个图层设置ILayer::Cached等于TRUE,它可以创建自己的私有缓存。 在这种情况下,地图将为该层创建一个单独的缓存,并将其上方和下方的层分组到不同的缓存中。
IActiveView::PartialRefresh uses its knowledge of the cache layout to invalidate as little as possible. IActiveView::Refresh , on the other hand, invalidates all the caches which is very inefficient. Use PartialRefresh whenever possible.
IActiveView::PartialRefresh利用其对缓存布局的了解,尽可能少地使其失效。 另一方面,IActiveView::Refresh会使所有的缓存失效,这是非常低效的。 尽可能地使用PartialRefresh。
Both PartialRefresh and Refresh call IScreenDisplay::Invalidate which sets a flag clients watch for. Clients draw a cache from scratch (the database) if its flag is set to true, and from cache if the flag is set to false.
PartialRefresh和Refresh都会调用IScreenDisplay::Invalidate,它设置了一个客户端关注的标志。 如果标志被设置为 “true”,客户端就会从头开始绘制缓存(数据库),如果标志被设置为 “false”,客户端就会从缓存中绘制缓存。
The following table shows the phases each view supports and what they map to:
phase | Map | Layout |
---|
esriViewBackground | Map grids | Page/snap grid | esriViewGeography | Layers | Unused | *esriViewGeoSelection | Feature selection | Unused | esriViewGraphics | Labels/graphics | Graphics | esriViewGraphicSelection | Graphic selection | Element selection | esriViewForeground | Unused | Snap guides |
To specify multiple draw phases, combine individual phases together using a bitwise OR. This is equivalent to adding together the integer enumeration values. For example, pass 6 to invalidate both the esriViewGeography (2) and esriViewGeoSelection (4) phases.
要指定多个抽奖阶段,可以用位数OR将各个阶段组合在一起。这相当于把整数的枚举值加在一起。例如,通过6来使esriViewGeography(2)和esriViewGeoSelection(4)阶段失效。
Use the data parameter to invalidate just a specific piece of data. For example, if a layer is loaded and its cache property is set to TRUE, this layer alone can be invalidated. A tracking layer is a good example of this.
使用数据参数,只对某一特定数据进行无效处理。 例如,如果一个图层被加载并且它的缓存属性被设置为 “true”,那么这个图层就可以被废止。 一个跟踪层就是一个很好的例子。
The envelope parameter specifies a region to invalidate. For example, if a graphic element is added, it is usually only necessary to invalidate the immediate area surrounding the new graphic.
包络参数指定了一个要作废的区域。 例如,如果添加了一个图形元素,通常只需要废止新图形周围的直接区域。
Both the data and envelope parameters are optional.
数据和包络参数都是可选的。
*When selecting features, you must call PartialRefresh twice, once before and once after the selection operation.
*当选择特征时,你必须调用PartialRefresh两次,一次在选择操作之前,另一次在选择操作之后。
|