ArcGIS API for iOS implements layer Display Control

Source: Internet
Author: User

ArcGIS API for iOS implements layer Display Control in two granularities: Service display control and layer display control.

1) Service Display Control

The service display control is implemented using agsmapview class. Each uiviewcontroller interface has an agsmapview object instance if a map is loaded. Set hidden = true for this agsmapview instance. For example, agstiledmapservicelayer * tiledlayer = [[agstiledmapservicelayer alloc] initwithurl: [nsurl urlwithstring: ktiledemapzonemapservice Url];
Uiview * emapzonetiledmap = [self. mapview addmaplayer: tiledlayer withname: @ "tiled layer"];
Emapzonetiledmap. Hidden = no; 2) display control of services in the map view
The display control of a single map service is implemented using agsdynamiclayerview or agstiledlayerview, for example:
Nsdictionary * dict = self. mapview. maplayerviews;
Nsarray * arr = [dict allvalues];
For (INT I = 0; I <[arr count]; I ++ ){
Agsdynamiclayerview * maplayerview = [arr objectatindex: I];
If (display control conditions ){
Maplayerview. Hidden = true;
}
}
3) display control of multiple layers in a single service
Nsurl * url = [nsurl urlwithstring: @ "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer"]; agsdynamicmapservicelaye R *
Layer = [agsdynamicmapservicelaye R dynamicmapservicelayerwi Thurl: url];
// Only display 'ushigh' (ID = 0) and 'states' (ID = 1) Layer
Layer. visiblelayers = [nsarray arraywithobjects: [nsnumber numberwithint: 0], [nsnumber numberwithint: 1], nil];
Determine whether the layer is visible by setting visiblelayers.

4) Summary

The object model diagram is as follows:

In fact, both agsmapview and agslayerview objects are subclasses of uiview, so the final control is whether the uiview is visible. In this way, you can control the layer display by setting whether the uiview is hidden.

Related Article

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.