AnsweredAssumed Answered

Rotating an AGSTextSymbol in XCode

Question asked by dvb922 on Nov 20, 2016
Latest reply on Nov 29, 2016 by DGoyal-esristaff

Hi

I'm using the ArcGIS Runtime SDK XCode 8 with 10.2.5 for iOS. I'm having strange problems about AGSTextSymbols rotation.
Here is my code:

 

        

        AGSCompositeSymbol *csl = [AGSCompositeSymbol compositeSymbol];

        

        NSString *str_length=[NSString stringWithFormat:@"%.2f m", [geometryEngine lengthOfGeometry:polyline]];

        AGSTextSymbol *textSym = [[AGSTextSymbol alloc] initWithText:[NSString stringWithFormat:@"%@", str_length] color:[UIColor brownColor]];

        textSym.fontSize=22;     

        double an = (double) ((180 * atan(((p1.x - p.x) / (p1.y - p.y)))) / 3.14);

        if (an < 0)

        {an += 90;

        }

        else{

        an = an - 90;

        }

        [textSym setAngle:an];

        [csl addSymbol:textSym];

       AGSGraphic *mygraphic = [[AGSGraphic alloc]  initWithGeometry:polyline symbol:csl attributes:nil];

        [myGraphicsLayer addGraphic:mygraphic];

 

As you can see in the screenshot. the text  rotates in a strange manner.
I need to help me. Thanks in advance!

Outcomes