Arcgis API for iOS extension Agsdynamiclayer new legacy API Comparison

Source: Internet
Author: User

agsdynamiclayer (forsubclasseyesonly)  Category Referencedescriptionthis category organizes the methods that is relevant to subclassing a dynamic layer. Developer can create custom dynamic layers by paying special attention to the methods of this category when Subclassing AG Sdynamiclayer.  sub-classes must provide valid values  for Agslayer :: Spatialreference, Agslayer::fullenvelope, and Agslayer::initialenvelope properties. Other properties on Agslayer is optional. Since   10.1.1   See also Agslayer ( forsubclasseyesonly) Instance methods (void)-RequestImageWithWidth:height:envelope: Timeextent: (void)-Setimagedata:forenvelope:  propertiesnsoperationqueue * Queue BOOL Wraparoundsuppor Ted 

1, according to the new API (Since10.1.1) See the instance method has changed, so you need to rewrite the corresponding method requestImageWithWidth:height:envelope:timeExtent: and Setimagedata:forenvelope:;

2, not verbose, the new extension code reference affixed:

#import "CustomDynamicLayer.h"@interfaceCustomdynamiclayer () @property (nonatomic, Strong, ReadWrite) Agsenvelope*Fullenvelope, @property (nonatomic, Strong, ReadWrite) agsspatialreference*spatialreference;@end@implementationCustomdynamiclayer@synthesizeFullenvelope =_fullenvelope;@synthesizeSpatialreference =_spatialreference;#pragmaMark-init methods-(ID) Initwithfullenvelope: (agsenvelope*) Fullenvelope { self=[Super Init]; if(self) {_spatialreference=fullenvelope.spatialreference; _fullenvelope=Fullenvelope;    [Self layerdidload]; }    returnSelf ;}#pragmaMark-request image-(void) Requestimagewithwidth: (nsinteger) Width height: (nsinteger) Height envelope: (agsenvelope*) env timeextent: ( agstimeextent*) timeextent {//get an image, the actual project has Nameid,url and other forms to express uiimage,
such as uiimage* img = [UIImage imagewithdata:[nsdata datawithcontentsofurl:[nsurl Urlwithstring:imgurl]];UIImage *img = [UIImage imagenamed:@"Esri_campus"]; //If request envelope Instersect with full envelope//of layer then only set image data if([env IntersectsWithEnvelope:self.fullEnvelope]) {[Self Setimagedata:uiimagepngrepresentation (IMG) forenvelop E:self.fullenvelope]; } Else{[self setimagedata:nil forEnvelope:self.fullEnvelope]; }}@end

3, the old version of the API methods are different, through the "Agsdynamiclayerdrawingoperation" class extension, Source:

#import "CustomDynamicLayer.h"@classagslayers;@implementationCustomdynamiclayer@synthesizeUrl=_url,imageid=_imageid,envelope=_envelope;#pragmamark-init-(ID) Initwithurl: (nsurl*) URL imageId: (nsstring*) imageId envelope: (agsenvelope*) Envelope {if(self =[self init]) {self. URL=URL; Self.imageid=imageId; Self.envelope=_envelope; _loaded=YES; }    returnSelf ;}#pragmaMark--(Agsunits) units {returnAgsunitsunknown;}-(agsspatialreference*) spatialreference {returnself.envelope.spatialReference;}-(agsenvelope*) Fullenvelope {returnSelf.envelope;}-(agsenvelope*) Initialenvelope {returnSelf.envelope;}#pragmaMark Agsdynamiclayer-(void) Imagerequestoperation: (nsoperation<agsdynamiclayerdrawingoperation>*) op didgetimage: (UIImage *) Image {NSLog (@"Image:%@", image); [Self.exportdelegate dynamiclayer:self Exportmapimageoperation:op didfinishwithimage:image];}- (void) Imagerequestoperation: (nsoperation<agsdynamiclayerdrawingoperation>*) op didfailwitherror: (NSError *) Error {NSLog (@"Error:%@", error); if([self.exportdelegate respondstoselector: @selector (dynamicLayer:exportMapImageOperation:didFailWithError:)]    ) {[Self.exportdelegate dynamiclayer:self exportmapimageoperation:op Didfailwitherror:error]; }}-(nsoperation<agsdynamiclayerdrawingoperation>*) Exportmapimage: (agsexportimageparams*) Exportimageparams {if(Exportimageparams.envelope = = Nil | |cgsizeequaltosize (Cgsizezero, exportimageparams.size)) {        returnNil; } nsmutabledictionary*exportparams =[nsmutabledictionary Dictionarywithobjectsandkeys:@"PNG",@"type", Self.imageid,@"ID", nil]; Agsdynamiclayerimagerequestoperation*operation =[[Agsdynamiclayerimagerequestoperation alloc] initwithurl:self. URL resource:@""Queryparameters:exportparams]; Operation.target=Self ; Operation.action=@selector (imagerequestoperation:didgetimage:); Operation.erroraction=@selector (imagerequestoperation:didfailwitherror:); Operation.exportimageparams=Exportimageparams;    [[Agsrequestoperation Sharedoperationqueue] addoperation:operation]; return[Operation Autorelease];}#pragmamark-dealloc-(void) dealloc{self. URL=Nil; Self.imageid=Nil; Self.envelope=Nil; [Super Dealloc];}@end

Content for reference.

Currently, for Js\flex\android\ios, there are calls to the online map, day map, and so on, according to the corresponding API version of the relevant method overload.

Arcgis API for iOS extension Agsdynamiclayer new legacy API Comparison

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.