Archived

This topic is now archived and is closed to further replies.

Guest ridgell

String manipulation (rotation)

Recommended Posts

I was wondering if I could illicit a little tutorial about manipulating strings, in particular rotation.I have searched the net, and the forum here (thought I am not as adept a searcher in the new format as I was with the old one) and cant find the answers.I have looked at the big formatted strings in text based HUDS (special fonts) but what I would like is a more rudimentary explanation/understanding. I can rotate ploylines & bitmaps as good as any. I do not understand how the length of a string is measured or fixed and how to assign the axis of rotation of a string within an assigned field. For example rotating a single line string with 2 or 3 off-center numbers in a circle in an arbitrary field...say 400x400.

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

I was wondering if I could illicit a little tutorial about manipulating strings, in particular rotation.I have searched the net, and the forum here (thought I am not as adept a searcher in the new format as I was with the old one) and cant find the answers.I have looked at the big formatted strings in text based HUDS (special fonts) but what I would like is a more rudimentary explanation/understanding. I can rotate ploylines & bitmaps as good as any. I do not understand how the length of a string is measured or fixed and how to assign the axis of rotation of a string within an assigned field. For example rotating a single line string with 2 or 3 off-center numbers in a circle in an arbitrary field...say 400x400.
Hi Ridgell Here is some code from my HSI its got rotate and 2 shifts in it maybe there is something in it to help you. <Position X="0" Y="0"/> <Text X="52" Y="18" Length="5" BackgroundColor="0x101010" Font="Arial" FontWeight="400" Color="#00FF00" Adjust="Left" Bright="Yes" VerticalAdjust="Center" Multiline="No"> <String>%((A:NAV2 RADIAL, degrees) d360)%R-%!03d!%</String> <Axis X="26" Y="9"/> </Text> <Rotate> <Value>(A:PLANE HEADING DEGREES GYRO, radians) (A:GPS Ground Magnetic Track, radians) - </Value> </Rotate> <Shift> <Value>(A:NAV2 RADIAL, radians) pi + (A:GPS MAGVAR, radians) - (A:GPS Ground Magnetic Track, radians) - /-/ cos (L:Nav2dist,nmiles) * /-/ (L:HSI RANGE, number) 50 min 12 max 80 / /</Value> <Scale Y="1.5"> </Scale> </Shift><Shift> <Value>(A:NAV2 RADIAL, radians) pi + (A:GPS MAGVAR, radians) - (A:GPS Ground Magnetic Track, radians) - /-/ sin (L:Nav2dist,nmiles) * /-/ (L:HSI RANGE, number) 50 min 12 max 80 / /</Value> <Scale X="1.5"> </Scale> </Shift> </Element> This rotates nav2 radial number around the HSI while keeping the text horizontal and pivoting in the text center.

Share this post


Link to post
Share on other sites

I'm curious why so few people use the "Code" feature of this new forum software when posting code or XML script snippets? In the past we didn't have such a neat feature, but now that we do few bother to use it :( The neatest part of wrapping code/scripts with the "code" tags is that all formatting is preserved, and it makes cutting/pasting from the forum much easier...For example, which of these is the easiest to read? :( <Macro Name="ProcedureScrollDown"> (@g:currentGroup) @kPROCPageGroup == if{ (@g:blinkingField) 1 == (@g:blinkingFieldEnabled1) 0 == and if{ 2 (>@g:blinkingField) } (@g:blinkingField) 2 == (@g:blinkingFieldEnabled2) 0 == and if{ 3 (>@g:blinkingField) } (@g:blinkingField) 3 == (@g:blinkingFieldEnabled3) 0 == and if{ 2 (>@g:blinkingField) } (@g:blinkingField) 2 == (@g:blinkingFieldEnabled2) 0 == and if{ 1 (>@g:blinkingField) } } </Macro>

	<Macro Name="ProcedureScrollDown">		(@g:currentGroup) @kPROCPageGroup == if{			(@g:blinkingField) 1 == (@g:blinkingFieldEnabled1) 0 == and if{ 2 (>@g:blinkingField) }			(@g:blinkingField) 2 == (@g:blinkingFieldEnabled2) 0 == and if{ 3 (>@g:blinkingField) }			(@g:blinkingField) 3 == (@g:blinkingFieldEnabled3) 0 == and if{ 2 (>@g:blinkingField) }			(@g:blinkingField) 2 == (@g:blinkingFieldEnabled2) 0 == and if{ 1 (>@g:blinkingField) }		}	</Macro>

Share this post


Link to post
Share on other sites

Here is Paul's XML script formatted and wrapped in the forum's "code" tags:

<Element>	 <Position X="0" Y="0"/> 		<Text X="52" Y="18" Length="5" BackgroundColor="0x101010" Font="Arial" FontWeight="400" Color="#00FF00"			Adjust="Left" Bright="Yes" VerticalAdjust="Center" Multiline="No">   			<String>%((A:NAV2 RADIAL, degrees) d360)%R-%!03d!%</String>			<Axis X="26" Y="9"/>		</Text>		<Rotate>			<Value>				(A:PLANE HEADING DEGREES GYRO, radians) 				(A:GPS Ground Magnetic Track, radians) - 			</Value>		</Rotate>		<Shift> 			<Value>				(A:NAV2 RADIAL, radians) pi + 				(A:GPS MAGVAR, radians) - 				(A:GPS Ground Magnetic Track, radians) - /-/ cos 				(L:Nav2dist,nmiles) * /-/ 				(L:HSI RANGE, number) 50 min 12 max 80 / /			</Value>			<Scale Y="1.5"> </Scale> 		</Shift>		<Shift> 			<Value>				(A:NAV2 RADIAL, radians) pi + 				(A:GPS MAGVAR, radians) - 				(A:GPS Ground Magnetic Track, radians) - /-/ sin 				(L:Nav2dist,nmiles) * /-/ 				(L:HSI RANGE, number) 50 min 12 max 80 / /			</Value>			<Scale X="1.5"> </Scale> 		</Shift>  </Element>

Share this post


Link to post
Share on other sites