Design pattern for adding attributes to AGSGraphic

2730
0
10-06-2011 03:28 AM
PaulLohr
Occasional Contributor III
I have a problem with the way I've setup the pushing of attributes into an AGSGraphic.

Here is what I am doing:

    
NSMutableArray *myGraphicArray = [[NSMutableArray alloc] init];
    
    // myMarkerPointArray is an NSMutableArray of AGSPoint objects.
    for ( AGSPoint *item in myMarkerPointArray )
        {
                       // textFileMgmt1.points contains an NSMutableArray containing three NSMutableDictionaries
of attributes
   for ( NSMutableDictionary *itemDictionary in textFileMgmt1.points )
    
                            {
    
            AGSGraphic *myGraphic = [[AGSGraphic alloc] initWithGeometry:item
                                                                symbol:myMarkerSymbol
                                                            attributes:itemDictionary 
                                                  infoTemplateDelegate:self.template];
    [myGraphicArray addObject:myGraphic];
    [myGraphic release];
                                }
   
            
   
        }


The result of this code is each AGSPoint gets assigned attributes three times (currently there are three objects in myMarkerPointArray). Of course the attributes should only be assigned once. Being that I have to parse two arrays at once and I'm an amateur, I don't know how to handle this. I looked for a solution in the GraphicsDemo sample but did not find anything.

Thank you for any help,
Paul Lohr
0 Kudos
0 Replies