Callout and Attachment

863
5
10-05-2011 07:02 AM
MiraMuliati
New Contributor
Hi, I am new to ArcGIS API for IOS.

Currently, I am working on a project that show a callout and related attachment on feature layer. My application has some active featureserver layers. I perform identify task on the mapserver related to those featureserver. When I get AGSIdentifyResult on didExecuteWithIdentifyResults function, How do I know which featureserver the result.feature come from?
0 Kudos
5 Replies
EddieJesinsky
New Contributor
http://help.arcgis.com/en/arcgismobile/10.0/apis/iOS/2.0/reference/interface_a_g_s_graphic.html

You can access the featureLayer that the feature has come from by using the layer property: result.feature.layer
0 Kudos
MiraMuliati
New Contributor

You can access the featureLayer that the feature has come from by using the layer property: result.feature.layer


Thx, Eddie. What i have in my mind is i will call queryAttachmentInfosForObjectId on the feature layer related to AGSIdentifyResult in didExecuteWithIdentifyResults.

result.feature.layer returns AGSGraphicsLayer. How could i get AGSFeatureLayer related to this?
0 Kudos
EddieJesinsky
New Contributor
you can just cast it

AGSFeatureLayer *featureLayer = (AGSFeatureLayer *)result.feature.layer;
0 Kudos
MiraMuliati
New Contributor
you can just cast it

AGSFeatureLayer *featureLayer = (AGSFeatureLayer *)result.feature.layer;


Oh, Ok! I will give it a try. Thx again Ed.. 🙂
0 Kudos
MiraMuliati
New Contributor
I got exception when casting AGSGraphicLayer to AGSFeatureLayer and call objectIdForFeature on casted AGSFeatureLayer. According to API reference, AGSFeatureLayer is subclass of AGSGraphicLayer. Is it possible to cast superclass to subclass?

Thus, I save all active feature layer in featureLayerArray and in didExecuteWithIdentifyResults i have :
for (AGSIdentifyResult* result in results) {

        ...
        // Retrieve attachment
        int objectId = -99;
        for (AGSFeatureLayer* currentFeatureLayer in self.featureLayerArray) {
            objectId = [currentFeatureLayer objectIdForFeature:result.feature];
            NSLog(@"objectID : %d", objectId);
        }


The problem is i always get objectID = 0. Why?
0 Kudos