Arcgis api for flex Development (3) Use of Map Browsing controls

Source: Internet
Author: User

Arcgis api for flex Development (3) Use of Map Browsing controls
Map Browsing includes enlarging, downgrading, roaming, resetting, upper-level windows, and lower-level windows.
In arcgis api for flex, esri has encapsulated a map view.
It can be used directly and requires dozens of lines of code to complete complex tasks.
First, create a Navigation control based on the previous lecture. Use the <esri: Navigation> label
You can.
<Esri: Navigation id = "navToolbar" map = "{myMap}"/>
Set the map attribute of the <esri: Navigation> label to the map to be controlled, that is, bind the control
Map.
Then we create a toolbar to control map browsing.
<Mx: ControlBar horiz paddingBottom = "0" paddingTop = "0">
<Mx: Button label = "zoom in" click = "navToolbar. activate
(Navigation. ZOOM_IN) "/>
<Mx: Button label = "zoom out" click = "navToolbar. activate
(Navigation. ZOOM_OUT) "/>
<Mx: Button label = "Roaming" click = "navToolbar. activate
(Navigation. PAN) "/>
<Mx: Button label = "upper-level window" click = "navToolbar. zoomToPrevExtent
() "Enabled = "{! NavToolbar. isFirstExtent} "/>
<Mx: Button label = "lower-level window"
Click = "navToolbar. zoomToNextExtent ()" enabled = "{!
NavToolbar. isLastExtent} "/>
<Mx: Button label = "reset" click = "navToolbar. zoomToFullExtent ()"/>
The click message response function of the button directly calls the <esri: Navigation> control function.
. Zoom in and zoom out. roaming calls functions of the activation tool. Response Functions of the remaining three buttons
Call the <esri: Navigation> Control zoomToPrevExtent, zoomToNextExtent,
The zoomToFullExtent function is OK.

Code
<? Xml version = "1.0" encoding = "UTF-8"?>
<Mx: Application
Xmlns: mx = "http://www.adobe.com/2006/mxml"
Xmlns: esri = "http://www.esri.com/2008/ags"
PageTitle = "Using ArcGIS API for Flex to connect to a cached ArcGIS
Online service"
StyleName = "plain">
<Esri: Navigation id = "navToolbar" map = "{myMap}"/>
<Esri: SpatialReference id = "sr" wkid = "4326" type = "codeph" text = "codeph"/>
<Mx: ControlBar horizontalGap = "0" paddingBottom = "0" paddingTop = "0">
<Mx: Button label = "zoom in" click = "navToolbar. activate
(Navigation. ZOOM_IN) "/>
<Mx: Button label = "zoom out" click = "navToolbar. activate
(Navigation. ZOOM_OUT) "/>
<Mx: Button label = "Roaming" click = "navToolbar. activate
(Navigation. PAN) "/>
<Mx: Button label = "upper-level window" click = "navToolbar. zoomToPrevExtent
() "Enabled = "{! NavToolbar. isFirstExtent} "/>
<Mx: Button label = "lower-level window"
Click = "navToolbar. zoomToNextExtent ()" enabled = "{!
NavToolbar. isLastExtent} "/>
<Mx: Button label = "reset" click = "navToolbar. zoomToFullExtent ()"/>
</Mx: ControlBar>
<Esri: Map crosshairVisible = "true" id = "myMap">
<Esri: extent>
<Esri: Extent id = "esriMapExtent" X min = "116"
Ymin = "39.5" xmax = "116.5" ymax = "40.5"/>
</Esri: extent>
<Esri: ArcGISTiledMapServiceLayer

Url = "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap
_ World_2D/MapServer "/>
<Esri: GraphicsLayer id = "myGraphicsLayer"
SpatialReference = "{sr}"/>
</Esri: Map>
</Mx: Application>

Original address: http://bbs.esrichina-bj.cn/ESRI/viewthread.php? Tid = 35575 & extra = page % 3D4% 26amp % 3 Borderby % 3 Ddateline

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.