AnsweredAssumed Answered

AGSGraphicsLayer addGraphic: Too Slow

Question asked by geonetadmin on Mar 4, 2013
Latest reply on Mar 5, 2013 by bernese
Original User: iqubalhusain

I am trying to create an application which supports "drawing style" annotations. To do this I setup a touch delegate from the map view. Between the previous and next point I create a AGSGraphic and load it onto the graphics layer.

- (void) addPointToMapFrom:(AGSPoint *) pp to:(AGSPoint *) cp;
{
    //Create Simple for Polyline
    AGSSimpleLineSymbol *lineSymbol = [AGSSimpleLineSymbol simpleLineSymbol];
    lineSymbol.width = 3.0;
    lineSymbol.color = self.roleColor; 
    
    //Create Polyline Geometry
    AGSMutablePolyline *polyline = [[AGSMutablePolyline alloc] initWithSpatialReference:self.mapView.spatialReference];
    [polyline addPathToPolyline]; 
    [polyline addPointToPath:pp];
    [polyline addPointToPath:cp];
    
    //Add to graphics layer 
    AGSGraphic *graphic = [AGSGraphic graphicWithGeometry:polyline symbol:lineSymbol attributes:nil infoTemplateDelegate:nil];
    [self.graphicsLayer addGraphic:graphic];

   

}




Unfortunately this is extremely slow and there is noticeable lag as the user draws on the screen. Will I need to use a UIView to accomplish this?

Attachments

Outcomes