pml

Design pattern for adding attributes to AGSGraphic

Discussion created by pml on Oct 6, 2011
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

Outcomes