Best Development Practices and Patterns Using ArcGIS Runtime SDK ...

Report 7 Downloads 62 Views
Best Development Practices and Patterns Using ArcGIS Runtime SDK for iOS Al Pascual

SDK Platforms Android

JavaSE

QT

iOS

OS X

10.1.1

10.1.1

10.2 BETA

10.1.1

10.2 BETA

Java/ Android

Java Win/Linux

C++ Win/Linux

Objective-C

Objective-C

Cocoa Touch

Cocoa

Windows Mobile

WPF 10.1.1

10.1.1 .NET

.NET/XAML

Windows Phone

Windows Store

10.1.1

10.2 BETA

.NET/XAML

.NET/XAML

Core Runtime

Agenda



Design the app for the mobile form



How to become an Objective-C Jedi Master



How to be an ArcGIS Runtime SDK for iOS Ninja

Design form Best practices

http://rlv.zcache.com/graphic_designer_funny_pizza_t_ shirtr025786edf4ca46c1a6559ab52eab927b_va6lr_512.jpg

What is a mapping app? ArcView right?

Attribution: Will Click

Desktop to Mobile

iPad form

Map centric apps

Map first What map do you open and how does it look? What tools?

Attribution: Will Click

How present those tools? Toolbar? Default active tools?

Map-less apps

Tasks run in background

Use should never know

Threading; don’t interrupt their flow

Objective-C Best practices

http://userserve-ak.last.fm/serve/_/51319219/Yoda.jpg

The Dark Age of Objective-c



Before iOS development Objective-C didn’t progress



iOS pushed Apple to improve the language closer to C#



The low-level nature of Objective-C turned into an advantage again and it might at least partly be responsible for the generally better performance of iOS compared to its competitors

Automatic Reference Counting



ARC is your friend

ARC Gotchas



Dead by ARC is a common mistake



Loops and forcing ARC to release.



Let the compiler do the releasing for you.

Manage memory in Arc

• •

Let’s create a new project …

Let’s migrate an existing project …

Use the latest xCode 4.6.1



Settings upgrade

@property and @synthesize



Objective-C may change at every xCode release.



Accept the project changes

NSLog vs DebugLog



#if DEBUG



# define DBLog(fmt,...) NSLog(@"%@",[NSString stringWithFormat:(fmt), ##__VA_ARGS__]);



#else



# define DBLog(...)



#endif

ArcGIS Runtime SDK for iOS Ninja Tricks

http://blog.infinityweb.co.nz/wpcontent/uploads/2011/05/ninja-wanted.jpg

Projection and Reporjection



The world is 102100 (Web Mercator Auxiliar Sphere



Consume everything in 102100 or repoject graphics



// Spatial Reference you want to project to



AGSSpatialReference *sr = [AGSSpatialReference spatialReferenceWithWKID:4326];



AGSGeometry *newGeometry = [geometryEngine projectGeometry:oldGeometry toSpatialReference:sr];

Geometry Engine



Modifying Geometry Objects based on Topological Relationships -

Cuts, Clips, Buffer, etc …



Measuring Distance



Spatial Relationships -

Contains

-

Crosses

-

Intersects

-

Etc …

Number of Layers



More layers more time. Questions?



Let’s move on…..

JSON is your friend



// from json to object



NSString* jsonPointAsString = @"{ \"x\" : -118.4 , \"y\" : 45.2 , \"spatialReference\" : {\"wkid\" : 4326} }";



NSDictionary *json = [jsonPointAsString AGSJSONValue];



AGSPoint* point = [[AGSPoint alloc] initWithJSON:json];



// from object to json



json = [point encodeToJSON];



jsonPointAsString = [json AGSJSONRepresentation];

Graphics Layer Performance



Version 10.1.1 Update 1 instead of 10.1.1



Improves graphics layer performance.

AGSGraphic



AGSGraphic needs 3 things: -

Geometry

-

Symbol -

-

Simple, Ramps, Time based symbols, etc …

Attributes

Use WebMaps!



Multiple layers



Make changes without code changes.



Control Security.



NSURL* endpoint = [NSURL URLWithString:@"http://<my_arcgis_portal>/sharing"];



AGSWebMap* webmap = [[AGSWebMap alloc] initWithItemId:@"e229d715f7ca4fa980308549fb288165" sharingEndPoint:endpoint credential:credential];

Sketch Layer as user input!

• Build in user input • Allows the user to interact with: • Vertex • Mid point between vertices • Selected vertex • Area enclosed by the vertices • Line joining the vertices

Go Beyond …

http://images2.fanpop.com/images/photos/3900000/Voyager-star-trekvoyager-3982047-1024-768.jpg

CocoaControls



Existing OS controls for iOS



Cocoacontrols.com

GitHub



Social Coding, share and fork

Whats coming in Runtime 10.2 and beyond

Whats coming for Runtime…



10.2 -



Offline map use -

Being productive offline

-

Network/geocode/search

-

Performance (static/dynamic mode)

-

Security (OAuth, SAML)

-

Simplification of apis

-

New developer site (with better doc system)

Beyond -

Offline analysis

-

Local data support -

-

3D

Raster and Vector

ArcGIS Runtime Licensing SDK

Development

Deployment

WPF

EDN

Deployment Packs Basic and Standard

Java

EDN

Deployment Packs Basic and Standard

Qt

Beta

Deployment Packs Basic and Standard

iOS

Developers.ArcGIS.com Organization Subscriptions or Download Portal \ Server

Android

Developers.ArcGIS.com Organization Subscriptions or Download Portal \ Server

Win Phone

Developers.ArcGIS.com Organization Subscriptions or Download Portal \ Server

Windows Store

Beta

Organization Subscriptions or Portal \ Server

OS X

Beta

Organization Subscriptions Portal \ Server

Questions?

Feedback



Session ID #290

http://flowchainsensei.files.wordpress.com/2012/09/megaphone.jpg