• 2010年8月02日_周一_map control


    /*******************************************************************************/

    //developing application

    //developint web application using the web adf

    //web controls

    //map control

    //2010年8月02日周一

    /*******************************************************************************/

    Developing Web Applications with the Web ADF - Web controls

    使用web adf 框架下的web 控件开发web 程序

    Map control

    地图控件

    The Map control is designed to display geographic data from one or more resources provided by different data source types.   The Map control must be associated with a MapResourceManager to define the resources displayed within the map.  The MapResourceManager also provides a way to set the Transparency(透明度) settings for the resources, each of which is treated as a separate layer within the map.   The Map control blends the resources together and renders a single image.  Advanced map tool functionality enables continuous panning and zooming capabilities without reloading the Web page that contains the map (in other words, a full postback is not required).  In addition, game style navigation provides scroll-wheel zoom and keyboard navigation options at runtime.  A number of other Web ADF controls buddy with the map control to enhance the user experience with the map, such as the Toolbar, Navigation, MapTips, and ZoomLevel controls. 
    地图控件被设计为用来展示地理数据,这些数据是来自由不同数据源类型的数据组成的一个或者多个资源。地图控件必须和一个mapresourceManager控件想关联来决定在地图上面进行展示的资源。mapResourceManager控件提供了一个方法设置资源的透明度,mapResourceManager控件把每一个资源都看做map控件里面的每一个单独的图层。 Map控件将这些资源混合在一起,然后生成一个独立的图像,先进的地图工具功能够让我们实现地图的平移以及缩的能力,而不用重新加载包含地图控件的页面(换句话说,一个完全的页面回发是没有必要的)。另外,在程序运行期间,游戏风格的导航提供来滚轮缩放和键盘导航的选择。 很多和地图控件绑定的其他 web adf 控件增强了地图的用户体验,比如:工具条,导航条,地图提示,级别缩放控件。


    Assembly: ESRI.ArcGIS.ADF.Web.UI.WebControls.dll
    Class: ESRI.ArcGIS.ADF.Web.UI.WebControls.Map

    Using the Map control

    Add the controls to the page


    Open or create a Web site within Visual Studio.NET.   Open a Web form in design mode, select the Toolbox, and expand the ArcGIS Web Controls tab.  Drag and drop a MapResourceManager and a Map control on the Web form.  Add one or more resources to the MapResourceManager.  See the Add Resources section in the MapResourceManager control topic for information on how to do this.  You should see the following in Visual Studio:
    在VS.NET下打开或者创建一个web 站点。 在设计视图模式下打开站点,选择工具箱,然后展开ArcGIS Web Controls 页签。拖拽一个MapresourceManager控件以及一个map控件到页面,向mapResourceManager控件里面添加一个或者多个子地图资源,查看mapResourceManager控件下的 Add Resource 部分获取这个方面更多的信息。在VS里面将会如下所示:


      

    Set Map properties

    设置地图控件属性

    Select the Map control.  In the Properties page:

    //选择地图控件,打开其属性窗口

    Set the MapResourceManager property to the name of the MapResourceManager created and configured in the previous steps. 

    Set the PrimaryMapResource property to a ResourceItem in the MapResourceManager.  The ResourceItem cannot be a Graphics Layer.   See the discussion on defining a Primary Map Resource for more details.  

    设置map控件的mapResourceManager属性为我们在上一步创建并配置的MapResourceManager控件的名称。

    设置map控件的PrimaryMapResource属性为mapResourceManager控件中的一个资源项。 这个资源项不能是几何图层。更多的消息请查看 defining a primary map resource

    Resize the map control to an acceptable size.  Left click and hold over a handle on a side or a corner of the control and drag the control to an acceptable size.   By default, the position of controls added in Visual Studio 2005 at design time is not set.  As a result, the controls are permitted(允许) to flow from left to right within a line, and from top to bottom within the page.  See the section(部分,章节) about control positioning in the Visual Studio Integration topic for more information.
    重新设置map控件的大小到一个合适的大小,单击坐标左键并悬停在控件的某一边或者控件的某一个角落,然后拖动地图控件到一个合适的大小。默认情况下,在VS2005里面添加的控件的位置在设计的时候是没有经过设置的。结果,控件就被允许从左边到右边从顶部到底部浮动成一行。更多的关于控件位置设置的信息请查看 Visual Studio Intergration 中的章节
    Additional properties can be configured to change how the map behaves at runtime.  See the Properties section below for more detailed information.

    更多的属性可以设置,来改变运行状态下的地图行为。更多详细的信息请查看下面的属性章节

    Specify buddy Controls
    指定绑定的控件
    The map is usually the central control for any Web-based GIS application.  As a result, it is often buddied with other supplementary(增加的,补充的) controls.  The Map itself does not specifically define a buddy control.  On the contrary(相反的), other controls included with the Web ADF buddy to the map.  This includes the Toc, MapTips, OverviewMap, ZoomLevel, Navigation, Toolbar, and task controls.  All are used to enhance map control interaction.     

    Members
    地图控件是任何基于web GIS 的程序的最重要的控件。 结果,她经常和一些补充的控件想绑定。Map控件本身并不特别的定义一个相绑定的控件。相反的,其他包含Web ADF的控件绑定到地图控件。他们包括TOC控件,mapTip控件,OverViewMap控件,级别缩放控件,导航控件,工具条控件,和任务控件。所有的他们都是用来增加地图控件的交互功能的。
    Properties
    属性
    The following table provides a list of properties and events of interest.  For complete reference information, see the Map control in the library reference section.

    下面的表格提供来一个属性和事件的列表,更完全的引用信息,查看引用库里面的map控件部分

    Property Name

     Type

    Description(描述)

    EnableContinuousCallback

    bool

    Whether images will be fetched(拿来) continuously during panning of the map or only when panning is complete.

    在平移地图的时候,图像是连续的获取还是当平移动作完成后在获取图像

    EnableTileCaching

    bool

    Whether tiles(瓦片) that have been retrieved(重新获取、重新得到) during panning of the map will be cached until the scale is changed.

    在平移地图过程中重新获取的地图切片是否被缓存起来,一直到地图显示比例改变后。

    EnableZoomAnimation

    (animation:活跃)

    bool

    Whether animation will happen for fixed zoom operations.

    ImageBlendingMode

    ImageBlendingMode

    Whether images will be blended on the web server or on the browser.

    图像在web 服务器端进行混合,还是在浏览器端混合

    ImageFormat

    Format of output image.

    图片输出地格式

    InitialExtent

    InitialExtent

    The initial extent at which the Map first renders.

    地图初始化的时候显示的范围

    MapResourceManager

    string

    The ID of the MapResourceManager whose resources will be displayed on the map.

    MapResourceManager控件的ID,这个控件的资源将在地图控件上进行展示

    PreferredTileHeight

    int

    The preferred tile height to request if the resources are not bound to a tile caching scheme.

    PreferredTileWidth

    int

    The preferred tile width to request if the resources are not bound to a tile caching scheme.

    PrimaryMapResource

    string

    The primary MapResource whose properties other MapResources will adhere(粘着、附和着) to for blending to take place.   This property cannot be a Graphics Layer.  If the property is empty the last resource item will be used.

    首要的地图资源,其他的地图资源都要粘着这个资源然后混合在一起。 这个属性不能是几何图层,如果这个属性值是空的,那么最有一个资源项将会被使用。

    Rotation

    double

    The rotation of the map in degrees. If value is a NaN, the primary map resource's rotation is used. Otherwise, the rotation is applied. 0 is a valid rotation value and can be used to change the default rotation of the primary map resource. When rotation is applied, all resources in the map should support map rotation.

    地图旋转的度数,如果他的值不是一个数字,地图的首要资源的旋转将会被使用,否则,这个旋转值将会被使用

    0也是一个有效的值,她也可以用来改变首要地图资源的旋转值。  当旋转被应用后,地图中的所有的资源都应该支持地图旋。

    ScrollWheelZoom

    bool

    Whether the map can be zoomed using the mouse scroll wheel.

    设置:使用鼠标滚轮是否能够缩放地图

    ToolItems

    MapToolItemCollection

    Map Tool Item collection.

    地图工具项集合

    UseMimeData

    bool

    Set true to store output images in session and stream them to the client or to store them on the file system instead.

    集中将输入的图片保存在session中并将他们以流的方式发送到客户端或者将他们保存在文件系统里面。

    VirtualDirectory

    string

    The path to the virtual directory in which images can be written, for example, ~/output/.

    虚拟目录的路径,我们可以写入图像的位置,比如:~/output/

    Events

    事件

    Event Type 

    Description

    Circle

    Raised when the control processes a tool associated with the Circle Client Tool Action.

    DragImage

    Raised when the control processes a tool associated with the DragImage Client Tool Action.

    DragRectangle

    Raised when the control processes a tool associated with the DragRectangle Client Tool Action.

    ExtentChanged

    Occurs when the extent of this control has changed.

    Line

    Raised when the control processes a tool associated with the Line Client Tool Action.

    MapClick

    Occurs when the control is clicked.

    Oval

    Raised when the control processes a tool associated with the Oval Client Tool Action.

    Point

    Raised when the control processes a tool associated with the Point Client Tool Action.

    Polygon

    Raised when the control processes a tool associated with the Polygon Client Tool Action.

    Polyline

    Raised when the control processes a tool associated with the Polyline Client Tool Action.

    Refreshed

    Occurs when the Map is fully refreshed. Does not occur if only one resource is refreshed with browser blending.

    Resized

    Occurs when the Map control is resized.

    ResourceRefreshed

    Occurs when a map resource is refreshed. May be used to detect single-resource refreshing with browser blending.

    RotationAngleChanged

    Occurs when the rotation of the map has changed.

    ScaleChanged

    Occurs when the scale of the Map is changed.

    TilingSchemeInitialized

    Occurs when the Map is done initializing the TilingScheme.


    Discussion
      

    Default Keyboard and Mouse Shortcuts

    Keyboard\Mouse Shortcut

    Map Action

    SHIFT, left mouse click, hold, and drag box

    Zoom In

    CTRL, left mouse click, hold, and drag box

    Zoom Out

    Left mouse click, hold, and drag

    Pan

    NumLock disabled, use keypad

    Pan

    Arrow keys, Home, End, Page Up, Page Down

    Pan

    NumLock enabled, +

    Zoom In

    NumLock enabled, -

    Zoom Out

    Refreshing Map Content //刷新地图内容

    When the content of a Map has changed, the layer visibility was toggled(固定,栓牢), or custom graphics were added or removed?  you can choose one of two methods to programmatically refresh the Map: Refresh or RefreshResource.   The Map.Refresh() method will trigger a complete redraw of all resources in the Map and can be quite time consuming, especially if only one resource changed.   Map.RefreshResource() will provide the most efficient means for refreshing map content.  When the Map control uses browser blending to combine map images, a call to RefreshResource() will only refresh the resource that requires it.   When the Map control uses web-tier blending, a call to RefreshResource() will actually(实际上,事实上) call Refresh() on the Map and all contents will be rerendered.   In general, the RefreshResource() method contains internal logic to interrogate(审问、询问)map blending mode and determine if an individual resource or all resources need to be redrawn.     

    Set Initial Extent of a Map during Application Startup
    当一个地图控件的内容发生改变,图层的可见性被固定,或者客户自定的图形被添加或者删除?你可以选择两个方法中的一个通过编程来刷新地图:refresh或者refreshResource. Map.Refresh()方法将会触发一个完全重绘地图控件的事件,并且相当的耗时,尤其是只有一个资源发生变化。  Map.RefreshResource()方法将会提供刷新地图最高效的方法。但地图控件使用浏览器混合合并地图图像,一个RefreshResource()方法的调用将会紧紧刷新那些需要刷新的部分。当地图控件使用web 层混合的时候,调用RefreshResource()方法实际上会调用map地图控件的Refresh()方法,并且所有的内容都会被重新绘制。 一般来说,RefreshResource()方法包含内部的逻辑来询问地图混合的模型,在程序开始的时候,设置地图初始化显示的范围。
    At design time, the InitialExtent property of a Map control can be set to Default or Full.   Default uses the extent of the primary map resource.  Full uses an extent that includes all resources in the map.  To explicitly set the extent of the map control upon application initialization, you will need to add the appropriate code to the PreRender event of the page or map.  The following example uses a custom Web ADF envelope to define the initial extent of the map.  Note that the initial extent only needs to be set on the initial request to the application, not on every subsequent postback:
    在设的时候,map控件的initialExtent的属性可以被设置为默认的或者全图显示。默认的是使用首要的地图资源的现实范围。全图显示,就是一个包含地图中所有要素的一个显示范围。在地图初始化的时候,为来明确的指定地图控件显示的范围,你需要向页面或者地图的PreRender()事件里面添加代码来设置这个属性。 下面的例子:使用了一个自定义的Web ADF evelope对象来定义地图的一个初始化的范围。 需要注意的是,初始化范围仅仅需要在应用程序的初始化请求中设置,而不是在所有的每一个页面回发中


    [C#]

    protected void Page_PreRender(object sender, EventArgs ea){

      if (!Page.IsPostBack)//当页面第一次加载的时候

    {

        ESRI.ArcGIS.ADF.Web.Geometry.Envelope initextent = new ESRI.ArcGIS.ADF.Web.Geometry.Envelope(-110, 30,-100, 40);

        Map1.Extent = initextent;

      }

    }


    [VB]

    Protected Sub Page_PreRender(sender As object, ea As EventArgs)

      If Not Page.IsPostBack Then

        Dim initextent As New ESRI.ArcGIS.ADF.Web.Geometry.Envelope(-110, 30,-100, 40)

        Map1.Extent = initextent

      EndIf

    End Sub

      

    Create a Single Blended Map Image
    //创建一个单独的地图混合图层

    On Microsoft Windows platforms, GDI (Graphics Device Interface) is used to draw graphics on windows, form and other displayed media.  GDI consists of(2:由) a set of C++ classes.  The Microsoft .NET Framework provides access to GDI capabilities via GDI+ which consists of a set of .NET classes designed to enhance rendering and manipulation of graphics and images.   GDI+ can also be used to merge (or blend) multiple images into a single image.  
    //在微软的平台下,GDI(图形设备接口)是用来在窗口绘制图形,表格和其他的可以展示的多媒体。
    A Web ADF Map control uses one map functionality for each map resource to generate a map image, so a Map that works with multiple resources generates multiple images.  For each map extent, all generated map images are either blended in the browser or the Web-tier.  In either case the end user sees what appears to be one map when in fact it may consist of many overlapping(与**重叠,重叠) images.  In some cases, it may be necessary to blend all map images into a single image for use outside of the Map control.  For example, generating a printable map from a Map control that contains multiple map resources will often require programmatically merging(结合,合并)all map images into one.  In .NET you can use GDI+ to generate a single blended image.     The following code sample iterates(反复申说) through (遍历) the MapFunctionality instances in a Map to generate a single blended map image.  The imgwidth and imgheight determine the size of the map image in pixels. When finished, the GDI+ System.Drawing.Bitmap referenced by variable newimg contains the blended map.
    一个web adf 地图控件使用一个地图功能函数为每一个字符资源生成一个地图图像,因此一个和多个地图资源工作的地图控件可以生成多个图像。对于每一个地图显示范围,所有生成的地图图像不是在浏览器里面混合,就是在web 层进行混合。在任何一种情况下,用户看到的地图实际上可能由很多的重叠的图像组成。  在一些情况下,可能需要将所有的地图图层混合成一个单独的图像供在地图控件的外部使用。比如:从map控件里面生成一个打印的图像,地图控件包含多个地图资源,她会经常要求使用代码来将所有的地图图层合并成为一个。 在.NET平台下,你可以使用GDI+来生成一个单独的混合图层。下面的代码实例:遍历来一个地图中的mapFunctionalities实例来生成一个单独的地图图像。imgwidth and imgheight以像素为单位定义了地图图像的大小。 当完成后,GDI+ System.Drawing.Bitmap 引用的变量包含了新生成的地图混合图像。


    [C#]

    ArrayList bitmaps = new ArrayList();

    foreach (IMapFunctionality mf in Map1.GetFunctionalities())

    {

        mf.DisplaySettings.ImageDescriptor.Height = imgheight;

        mf.DisplaySettings.ImageDescriptor.Width = imgwidth;

        mf.DisplaySettings.ImageDescriptor.TransparentBackground = true;

        mf.DisplaySettings.ImageDescriptor.ImageFormat = ESRI.ArcGIS.ADF.Web.ImageFormat.PNG8;

        ESRI.ArcGIS.ADF.Web.MapImage mi = mf.DrawExtent(Map1.Extent);

        bitmaps.Add(mi.GetImage());

    }

    System.Drawing.Bitmap newimg = new System.Drawing.Bitmap(imgwidth, imgheight);

    System.Drawing.Graphics imggraphics = System.Drawing.Graphics.FromImage(newimg);

    imggraphics.FillRectangle(new System.Drawing.SolidBrush(System.Drawing.Color.LightGray), 0, 0, imgwidth, imgheight);

    for (int j = bitmaps.Count-1; j >=0; j--)

    {

        System.Drawing.Bitmap bmp = (System.Drawing.Bitmap)bitmaps[j];

        imggraphics.DrawImage(bmp, 0, 0, imgwidth, imgheight);

    }

    Set a Spatial Reference(设置一个空间参考)

    The spatial(空间) reference(2:空间参考) of a map control is set during application initialization and cannot be changed at runtime.  The primary resource of a map control determines the spatial reference of the map.  Thus to set the spatial reference of the map, define the appropriate coordinate system for the primary map resource.   Secondary map resources will be reprojected into the map's spatial reference, if the data source supports reprojecting on the fly. 

    Defining a Primary Map Resource
    地图控件的空间参考是在程序初始化的时候进行设置的,并且在运行的时候是不能改变的,地图控件的首要资源决定来地图的空间参考,因此设置地图的空间参考,为首要的地图资源定义坐标系统的属性。第二个地图资源将会重投影为地图的控件参考,如果数据源支持重投影的话。

    定义一个首要地图资源。        
    A Map's primary map resource is used to define the spatial reference, rotation (if present), initial extent, scale, and zoom levels.   The PrimaryMapResource property can be explicitly set to a map resource item or left blank.  If blank, the following logic is used to determine the primary map resource for you:

    一个地图的首要地图资源被用来定义控件参考,旋转(如果出现的话),比例尺,和缩放级别。PrimaryMapResource属性可以被明确的设置为地图的资源项或者留下为空白,如果为空白的话,后面的逻辑将会为你定义首要的地图字资源

    Map Resources

    Primary Map Resource

    1 dynamic or 1 cached resource

    If only one resource is present, it is the primary map resource.

    2 dynamic resources

    The last resource in the resource items collection. 

    2 cached resources

    The first cached resource in the resource items collection.

    1 dynamic and 1 cached resource

    The first cached resource in the resource items collection.

    If you are overlaying multiple cached services with different spatial references or scales, choose as the Primary Map Resource the service whose spatial reference you want used in the map. The Zoom Level control will only include the scale levels from this service.  Images from the other cached service will be drawn dynamically to match the coordinate system and scales of the Primary Map Resource. In other words, the cache from the non-Primary Map Resource will not be used. 
    如果你要重叠拥有同一个参考以及匹配比例的缓存后的服务,那么,你可以选择任何一个缓存的服务作为首要的地图资源,在这个剧本中,缩放级别控件的级别将会包括来自所有缓存服务的比例级别来自其他缓存服务的图像将会被动态的绘制来匹配坐标系统和首要地图资源的比例。 换句话说,来自于非首要地图资源的的缓存就不会被使用。


    If you are overlaying a cached service with a dynamic service, you should generally choose the cached service as the Primary Map Resource.  If the dynamic service is the Primary Map Resource, the cached service will be treated as a dynamic service, thus sacrificing the performance benefit of the cache.
    如果你使用一个动态的服务来覆盖缓存服务,那么一般应该选择一个缓存服务作为首要的地图服务。如果那个那个动态的服务即使那个首要地图资源,那么缓存服务就被当做动态服务来对待,因此,牺牲了缓存的性能优势。


    Do not set the Primary Map Resource to a Graphics Layer map resource item.  Graphics Layers represent Web ADF Graphics Datasets which are designed to be utilized programmatically at runtime.  As a result, a Graphics Layer does not have the spatial properties (e.g. spatial reference, scale, etc.) the Map needs to initialize and function properly.   Also, if you have not explicitly defined a Primary Map Resource, make sure the last resource item is not a Graphics Layer.     

    不要设置一个首要地图资源作为一个graphics图层的地图资源项。Graphics图层代表一个web adf graphics 数据集,这个数据集被设计为在运行的状态下使用代码利用。结果,一个Graphic 图层没有空间属性坐标系,一次地图控件也不能用来进行初始化工作,还有,如果你没有明确的定义一个首要地图资源,那么保证那个最后的资源项不是一个graphics 图层。

     

    Rotate Map Content
    //旋转地图内容
    The Rotation property of the Map control can be used to specify(具体指定), in degrees, the rotation of resources in the Map. A value of NaN means that the rotation of the PrimaryMapResource will be applied; 0 will unrotate rotated resources and leave other resources alone; values greater or less than 0 will rotate resources, throwing an exception if unrotatable resources are present. Map rotation is supported for ArcGIS Server (both Internet and Local) and Web ADF Graphics data sources.
    map 控件的Rotation属性可以被用用来具体的指定,使用度数,使用地图中旋转的资源。 一个不是数字的值意味着首要地图资源的旋转属性将会得到应用。 0将不旋转旋转资源,并且不涉及其他的资源。比0大或者小的值都将旋转要素,如果遇到一个不支持旋转的要素,将会抛出一个异常。地图旋转支持ArcGIS Server资源(网络上的,后者本地的)以及web adf graphics 数据源


    If the Map control has a rotation value greater or less than 0:

    The presence(出席,到场) of non-rotatable resources will return an exception in the Web page at runtime. The exception will indicate which resource does not support rotation.

    如果地图控件有一个旋转值,它比0大或者比0小:

    不支持旋转资源的出现将会在页面运行的时候抛出一个异常。 这个异常将会指定那个资源不支持旋转。

    The ContinuousCallback and EnableTileCaching properties on the Map control will be disabled.

    If the Map Rotation property is NaN, the rotation of the PrimaryMapResource (PMR) can be used. Since a Web ADF Graphics resource cannot be a PMR, only a rotation value specified for a data frame in an ArcGIS Server map service can be used. Map rotation can also be set on the fly at runtime.
    地图控件上的ContinuousCallback 和 EnableTileCaching 属性将会设置为不可用状态。

    如果地图控件的rotation属性值不是一个数字,primarymapresource的旋转值将会被使用。因为一个web adf 的Graphics 资源不是一个PMR,在一个ArcGIS Server 的地图服务上面仅仅一个为数据框架指定的旋转值可以被使用。地图旋转值也可以在运行的状态在fly上设置。


    As long as the resources in the Map control support rotation, Map contents will be updated. Again, if a resource does not support rotation, an exception will returned in the Web page indicating which resource.  The following code snippet(片段) which illustrates how to change the Rotation property programmatically on a Map control:

    Map1.Reset();

    Map1.Rotation = 45;

    Rotating an ArcGIS Server cached map service requires that dynamic map images are generated - the cached map tiles will not be used. As a result, many of the performance benefits of a cached map service are negated(否定).  Web ADF controls that work with the Map also support rotation, such as the Navigation, Magnifier, and OverviewMap controls.

    Image Blending Mode

    只要在地图控件上的资源支持旋转,地图的内容就被更新。 如果一个资源不支持旋转,那么就会在页面抛出一个异常指出那么资源不支持旋转。下面的代码判断介绍了如何在地图控件上编码改变旋转属性。。

    Map1.Reset();

    Map1.Rotation=45;

    旋转一个ArcGIS Server缓存地图服务要求动态地图图像的生成,缓存的地图瓦片都不能被使用。结果,很多地图缓存的优势都被否定掉了。和map控件一起工作的web adf 控件也支持旋转,比如:导航,Magnifier,鹰眼图控件



    The ImageBlendingMode property on a Map control determines how map images from each resource are drawn. This property only has an effect when multiple resources (services) are used in a Map. A graphics layer counts as a resource for drawing purposes.
    map控件的ImageBlendingMode 属性定义了来自每一个资源的地图图片如何绘制。 这个属性只有当使用多个数据源(数据服务)在地图上使用的时候才有用。 一个Graphics图层的数目作为一个资源用于绘制目的。


    Two options are available for ImageBlendingMode: Browser and WebTier. The Browser option, which is the default, causes the browser to retrieve the map images separately for each resource. The images might be retrieved via static URLs or as streamed MIME data. The browser then draws the images for each resource (service), one on top of the other. The advantage of browser blending is that a resource can be refreshed without refreshing other resources. For example, feature selection highlights can be drawn on a graphics layer without refreshing the underlying map.
    两个选项可以用于ImageBlendingMode:浏览器,或者web层。 浏览器选项是默认的选项,她单独的为每一个地图资源重新获取地图图像。图像可能用通过固定的URL或者流MIME数据的形式被重复获取

    然后浏览器为每一个资源绘制图象,一个覆盖在另个上面。 用浏览器进行混合的优势是:一个资源可以在不刷新其他资源的情况下被刷新。 比如:高亮显示的要素可以在graphic图层绘制而不用刷新下面的地图。


    The image below illustrates browser blending. In this case, the web application uses map services on two different servers. The browser retrieves each map separately, and superimposes them together so that they appear as a single map to the user.

    下面的图片说明了浏览器混合图像的原理。 在这种情况下,web app 使用分布在两个不同的服务器上的地图资源。浏览器单独的重新获取每一个地图,然后将他们粘合在一起,因此用户看起来就像一个单独的地图。




    The second option,  WebTier blending, causes the Web ADF on the server to retrieves all the map images from map services used in the website. The web application merges the images form  all resources into a single image. The merged image is then sent to the browser. The following graphic illustrates web-tier blending.
    第二个选项:web层混合。 服务器端的web adf 重新从将要在站点中使用的地图服务中获取所有的地图图像,web app 将从所有资源获取的图片混合为一个单独的图像。这个混合的图像然后被发送到浏览器。下面的图像说明来web 层的混合。


    It is recommended to use Browser blending unless you have a specific reason to have the server blend map images.

    建议你使用浏览器端的混合服务,除非你有一个特殊的原因来让服务器混合你的地图图像。

    Resource centric tiling scheme

    To display map data within a Map control, map resources either generate an image on the fly or retrieve a cached image tile.  Each resource can define and utilize a tiling scheme to provide more effective and efficient interaction with the resource in the map.     
    为来在地图控件上展示地图数据,地图资源要么在fly上生成一个图像,要么重新获取缓存中的图像瓦片。 每一个资源都被定义和利用一个瓦片的主题来提供更多高效的在地图及进行交互的资源。


    Non-cached (dynamic) map resources have the option of using a dynamic tiling scheme or not.  A dynamic tiling scheme(计划,方案) is constructed on the fly at runtime using the extent, size and scale of the map.  As long as the scale remains the same, the tiling scheme remains valid and continues to manage the retrieval of dynamic map images.   This benefits resources that generate map images relatively quickly and application scenarios in which end-user will pan frequently.    Browser cache will be used to render dynamic images already generated for a tile in the scheme(计划).  If a non-cached resource does not enable dynamic tiling, each extent change in the map will generate a new dynamic map image and browser cache will not be utilized.   You choose to enable or disable dynamic tiling when you create a map resource item (e.g. at design-time using the MapResourceManager control).  The table below lists the default tiling scheme settings for each data source type:

    非缓存(动态)地图资源有一个选项,选择使用一个动态的瓦片主题或者不使用。一个动态的瓦片计划就是运行的时候在fly上使用内容,大小和地图的比例构建的。只要地图比例是相同的,瓦片计划仍然是可以获取的,并且管理动态地图图像的重新获取。这个将会使资源获益,她生的地图图像的速度相对来说更快,在应用程序里面用户可以更加频繁的移动地图。浏览器缓冲可以被用来提供已经在计划中为tile生成的动态地图图像。如果非缓存的地图资源不能够使用动态的瓦片,地图中每一个地图范围的改变都会生成一个新的动态地图图像,浏览器的缓存是不能使用它的。当你创建一个地图资源项的时候,你选择是否使用动态图片。下面的表格列出了为每一个数据类型设置的默认瓦片计划

    Data Source Type

    Dynamic Tiling Default

    ArcGIS Server Local

    Disabled

    ArcGIS Server Internet

    Disabled

    ArcIMS

    Enabled

    ArcWeb

    Disabled

    OGC\WMS

    Disabled

    Graphics

    Enabled


    Cached (tiled) map resources always utilize the tiling scheme defined by the map service host.   The scheme information provided by the service includes the spatial reference, full extent, tile image properties, and cached levels of detail, each of which defines a scale and number of rows and columns.  The map resource item uses this information along with the Map control extent to determine which cache tiles need to be retrieved.  Since the number of levels remains the same regardless of the map extent, map tiles can be cached by the browser in multiple levels.  This enhances the performance of cached services in the Map because once a map tile is cached by the browser it can be reused.  

    缓存(瓦片)地图资源已经利用了有地图服务器的定义的瓦片计划。 由服务提供的计划信息包括空间参考系,全图显示范围,标题图像属性,以及缓存级别的细节,每一个都定义了级别的数目以及行和列的数量。地图资源项使用这个信息和地图控件的显示范围来决定哪一个缓存瓦片需要重新获取。因为级别的数量仍然保持一致而不用管地图的现实范围,地图瓦片可以被浏览器在多级别的情况下进行缓存。这个增强了地图缓存服务的体验,因为一旦一个地图瓦片被浏览器缓存,那么她就可以被重复的使用。


    The diagram below illustrates the runtime behavior of resource items with different tiling schemes during a simple pan operation on the map.  The pre and post pan extent of the map view is displayed as orange boxes at the bottom of the diagram.  Each resource item type shows the pre (gray) and post (green) map images retrieved from a remote server.  For non-cached (dynamic) resources that have dynamic tiling enabled, the pre pan map view establishes the tiling scheme for th resource and requests one map image (gray).   After the pan event, three map image are generated because the map view extent intersects three tiles in the scheme.    For non-cached resources that do not  have tiling enabled, each map view extent will generate one new map image.  For cached resources, cached map tiles that intersect the map view extent will be retrieved.  In this example, four tiles are requested before the pan.  Two tiles are requested after the pan event.                     
    下面的图像解释了程序运行状态下拥有不同的瓦片计划的资源项在一个简单的地图平移操作中的表现。上一个和下一个地图范围的视图以黄色箱的形式在地图图表的底部进行展示。

    Cached Tile Retrieval

    The Map control may obtain map images from an ArcGIS Server map service as pre-created tiles, rather than dynamically drawing the map on the server. See Map Caches in Server Help for information on map caching. How the tile is retrieved depends on four factors:

    //地图控件可能会从一个ArcGISServer地图服务获取地图图像作为以前创建的图层,而不是在服务器上动态绘制的地图。瓦片是如何获取的基于下面的四个元素:

    Whether the Map control's ImageBlendingMode property is set to browser blending or web-tier blending. Note that if only one resource (service) is added the to the map, or only one resource is currently visible, then the browser-blending approach is used even if web-tier blending is enabled.

    1:地图控件的ImageBlendingMode属性设置为browser混合还是web层混合。 需要注意的是:如果一个资源被添加到地图或者只有一个地图资源在当前的地图状态下是可见的,那么使用 browser-lending

    即使此时 web-tier混合是处于可用的状态。

    Whether a cache virtual directory was configured for the service in ArcCatalog or Manager.

    //是否在catelog中为service创建了一个缓存的虚拟路径或者对其进行管理

    Connection method to the service: ArcGIS Server Local or ArcGIS Server Internet.

    服务的连接方法:ArcGIS Server local 或者 ArcGIS Server internet

    Security settings. If a cache virtual directory is configured, tile retrieval(取回,补偿) differs depending on whether the virtual directory is secured to require authentication(鉴定、鉴名望). If security is applied, the web application can get tiles whether it provides credentials(证明,资格) or not, but the way it retrieves tiles differs. If no cache virtual directory is configured, and if using an ArcGIS Server Internet connection, retrieval differs depending on whether the web service is secured to require authentication. If authentication is required, but the web application or browser fail to provide correct credentials(证明) for the tile virtual directory, then the tile can still be retrieved, but through a different and typically less efficient mechanism(办法、途径).

    The following graphic shows how the browser and web application retrieve map tiles based on these factors. Some retrieval approaches(方法,方式) are more efficient than others. See the tables that follow for details on each tile-retrieval mechanism.
    //安全设置:如果配置了缓存的虚拟路径,瓦片的获取是不同的,这个主要是根据虚拟目录对于请求的鉴定是否是安全的。  如果安全措施得以应用,web application 可以获取而不用管她是否提供了证明,但是他们重新获取瓦片的方式是不同的。  如果缓存的虚拟目录没有被配置,并且使用一个ArcGISSerever的网络连接,基于web 服务在对于请求的验证是否安全,重新获取的方式也是不同的。如果要求验证,但是web app应用程序或者浏览器没有为瓦片虚拟路径提供正确的证明,那么瓦片仍然可以获取,但是通过一个不同的、典型的效率较低的方法和途径。

    下面的图表展示了浏览器以及web app 如何通过这些因素重新获取地图瓦片。 一些从新获取的方法比其他的方法更加高效。

    JAVASCRIPT: indicates that the browser retrieves the map tile directly from the Web server, without interacting with the Web application.

    TILE HANDLER: indicates that the browser requests the tile from an HTTP Handler (TileHandler.ashx) within the Web application. The handler retrieves the tile using the information in the request query string. It also accesses information in the user session.

    JavaScript:指出,浏览器直接从web 服务器端重新获取地图瓦片,而没有和web应用程序进行交互。

    TILE HANDLER:指出,浏览器在在web app中从一个HTTP处理中请求瓦片。 处理器使用查询请字符串中的信息重新获取瓦片。它也从用户session中访问信息。


    In each tab

    le below, access methods are listed in decreasing order of expected efficiency.

    Tile retrieval: Browser blending

    JAVASCRIPT:
    Virtual Directory

    Browser retrieves the image directly by its URL using JavaScript. This is probably the most common scenario when defaults are used to set up the map service and web application, and no security is applied to the map service. It is also typically the fastest way to retrieve map tiles.

    JAVASCRIPT:
    Tile Web Service

    Browser calls an HTTP handler on the Web service running on the ArcGIS Server machine that reads the image from disk and sends back the image as a stream of bytes.

    TILE HANDLER:
    Virtual Directory

    Browser calls an HTTP handler (TileHandler.ashx) on the Web ADF server that uses credentials to access a secured virtual directory and sends back the image as a stream of bytes.

    TILE HANDLER:
    Tile Web Service

    Browser calls an HTTP handler (TileHandler.ashx) on ADF server that uses credentials to access an HTTP handler on ArcGIS Server machine. The handler on The ArcGIS Server machine reads the image from disk and streams back the image as a series of bytes.

    TILE HANDLER:
    GetMapTile

    Browser calls an HTTP handler (TileHandler.ashx) on ADF server that in turn calls a web service method that returns image bytes. The HTTP handler streams back the bytes of the image. In this case, the ArcGIS Server Object Manager and Server Object Container are used to retrieve the tile.

    Tile retrieval: Web tier blending

    WEB TIER:
    Virtual directory

    During page life cycle, the image is read from the virtual directory and is blended to overlay with other resources (layers) in the map. The blended image is then sent to the browser.

    WEB TIER:
    Tile Web service

    During page life cycle, the image is retrieved from an HTTP handler on the ArcGIS Server machine. The handler on the ArcGIS Server machine reads the image from disk and streams back the bytes. The image is blended to overlay with other resources (layers) in the map. The blended image is then sent to the browser.

    WEB TIER:
    GetMapTile

    During page life cycle, the image is retrieved through a Web service method that returns image bytes. The image is blended to overlay with other resources (layers) in the map. The blended image is then sent to the browser.


     

    Using the MapHandler


    By default, map draw operations do not iterate(重申、重述) through the page lifecycle.  Instead an HTTP handler, ESRI.ArcGIS.ADF.Web.UI.WebControls.MapHandler, is solely responsible for managing map draw operations.  Other actions, such as those initiated from map tools, commands, map events, or toc changes, still iterate through the page lifecycle.   The MapHandler enhances map draw performance by skipping the page lifecycle when drawing the map, which reduces the amount of processing overhead(管理费用).   The EnableMapHandler property on the Map control enables you to choose whether you use the MapHandler or iterate through the page lifecycle for map draw operations.  
    默认情况下,地图绘制操作在页面的生命周期中没有重申。 取代一个HTTP HANDERW,ESRI.ARCGIS.ADF.WEB.UI.WEBCONTROLS.MAPHANDLER是唯一的负责管理地图绘制操作的。其他的动作,比如,地图工具条、命令、地图事件、或者toc 改变等的初始化, 仍然在页面生命周期中反复申诉。mapHandler在绘制地图的时候,通过跳过页面的生命周期来增强地图绘制操作,这样就降低来处理成本的数量。地地图控件的EnableMapHandler属性使你有一个选择:对于地图的绘制操作,你是使用MapHandler还是在页面生命周期中反复申诉。


    One scenario where you may choose to iterate through(生命周期) the page lifecycle is when using pre-9.3 patterns for managing shallowly stateful(宏伟的、威严的) operations.  For example, in 9.2, managing stateful changes to a pooled server object (shallowly stateful) was possible, given the ability to access server context at the appropriate time to modify and reset the server object.  Since all Web requests associated with Web ADF components in a Web application traversed(横渡、横越) the page lifecycle (including map draw, queries, toc changes) managing server object merely involved managing when to modify the server object in the lifecycle.  Setting the EnableMapHandler property to false will enable this pattern to function in 9.3.  
    有这么一个场景,你可能遍历页面的生命周期,使用9.3以前的版本来管理宏伟的操作。比如:在9.2中,管理一个池化服务器对象宏观的改变时可行的,提供访问server context的能力定义或者重新设置server对象。  因为所有和web adf 组件相关的web请求在web应用程序中都是越过页面的生命周期,当在生命周期内重新定义服务对象的时候,server对象的管理仅仅和管理相关。在9.3版本,设置EnableMapHandler 属性值为false将能够使这个类型可用。


    In this scenario, you may choose to take advantage of the performance enhancement offered by the MapHandler.   The MapHandler offers a set of events to override and modify resources before and after map draw.   To override the events, create a new class, derive from the MapHandler class, define the events to override, and add a reference to the custom MapHandler in the Web.config file.  Changes to server object state will need to be duplicated(重复,复制品) or shared for map draw and all other Web requests.  If the code used to manage shallowly stateful operations is packaged in a single class or assembly, events in both the custom MapHandler and page lifecycle can share the same code logic.  See the ArcGIS_AddDynamicData sample for an example of this technique.

    在这个场景中,你能选择利用由mapHandler提供的增强的性能。在地图绘制的前后,MapHandler  提供了一系列的事件来重载和重定义资源。 为了重载事件,创建一个新的类,继承MapHandler类,定义重载的事件,并在web.config文件里面添加一个自定义的MapHandler类的引用。  Sever对象状态的改变需要被反复复制或者分享地图绘制和其他控件的web 请求。 如果用来管理状态操作的代码被封装成一个单独的类或者Assembly,在自定义Maphandler和页面生命周期里面的事件可以分享相同的代码逻辑。 查看这种技术的一个例子:ArcGIS_AddDynamicData

  • 相关阅读:
    Java中的Set List HashSet互转
    Java数组如何转为List集合
    Map
    Jave中的日期
    mybatis plus 条件构造器queryWrapper学习
    Error running 'JeecgSystemApplication': Command line is too long. Shorten command line for JeecgSystemApplication or also for Spring Boot default configuration.
    RBAC权限系统分析、设计与实现
    html拼接时onclick事件传递json对象
    PostgreSQL 大小写问题 一键修改表名、字段名为小写 阅读模式
    openssl创建的自签名证书,使用自签发证书--指定使用多域名、泛域名及直接使用IP地址
  • 原文地址:https://www.cnblogs.com/xingchen/p/1790714.html
Copyright © 2020-2023  润新知