Code example: Original VST expression

This is an example of an original VST expression that can be modified to abbreviate advanced/callout annotation.

Function Generate([OBJECTID], [OBJECTID_arr], [LABELSTATUS_CODE], [LABELSTATUS_CODE_arr], [PRIMARYNAVAID_CODE], [PRIMARYNAVAID_CODE_arr], [SystemSubtype], [SystemSubtype_arr], [Ident_Txt], [Ident_Txt_arr], [Frequency_Val], [Frequency_Val_arr], [Channel_Txt], [Channel_Txt_arr], [Voice_Code], [Voice_Code_arr], [ComponentSubtype], [ComponentSubtype_arr], [Name_Txt], [Name_Txt_arr], [LAT_TXT], [LAT_TXT_arr], [LONG_TXT], [LONG_TXT_arr], [ROLEFIX_CODE], [ROLEFIX_CODE_arr])

Generate = "<MultipleTextElement>" & TextBackground ([PRIMARYNAVAID_CODE], [PRIMARYNAVAID_CODE_arr]) & TextElement ([OBJECTID], [OBJECTID_arr], [SystemSubtype], [SystemSubtype_arr],
[Ident_Txt], [Ident_Txt_arr], [Frequency_Val], [Frequency_Val_arr], [Channel_Txt], [Channel_Txt_arr], [Voice_Code], [Voice_Code_arr],
[ComponentSubtype], [ComponentSubtype_arr], [Name_Txt], [Name_Txt_arr], [LAT_TXT], [LAT_TXT_arr], [LONG_TXT],
[LONG_TXT_arr], [ROLEFIX_CODE], [ROLEFIX_CODE_arr], [LABELSTATUS_CODE], [LABELSTATUS_CODE_arr]) & "</MultipleTextElement>" 
End Function

Function TextBackground ([PRIMARYNAVAID_CODE], [PRIMARYNAVAID_CODE_arr]) TextBackground = "<TextBackground
Units = 'Points'>" & Background ([PRIMARYNAVAID_CODE], [PRIMARYNAVAID_CODE_arr]) & Callout & Shadow & Margins
& Placement & "</TextBackground>" 
End Function

Function Background ([PRIMARYNAVAID_CODE], [PRIMARYNAVAID_CODE_arr]) 
If [PRIMARYNAVAID_CODE_arr](0) = "1" Then
   Width = "0.7" 
Else 
   Width = "0.2" 
End If 
Background = "<Background Roundness='0'><Symbol><Outline Width='" & Width & "'><CLR Red='0' Green='0' Blue ='0'></CLR></Outline></Symbol></Background>"
End Function

Function Callout 
Callout = "<Callout Tolerance='10.0' Snap='True' Truncated='100'><Symbol><Outline Width='0.2'><CLR Red='0' Green='0' Blue ='0'></CLR></Outline><Fill><CLR Red='0' Green='0' Blue ='0'></CLR></Fill><Arrowhead Size='0'><CLR Red='0' Green='0' Blue ='87'></CLR></Arrowhead></Symbol></Callout>"
End Function

Function Shadow 
Shadow = "<Shadow HorizontalOffset ='0' VerticalOffset ='0'><Symbol><Outline Width='0.2'><CLR Red='0' Green='0' Blue ='0'></CLR></Outline><Fill><CLR Red='0' Green='0' Blue ='0'></CLR></Fill></Symbol></Shadow>"
End Function

Function Margins 
Margins = "<Margins Top='2.0' Bottom='2.0' Left='2.0' Right='2.0'></Margins>" 
End Function

Function Placement 
Placement = "<ElementPlacement><Top Style='Box' SplitOffset='0' HAlign='Center' VAlign='Center'></Top><Middle Style='Outside' SplitOffset='0' HAlign='Center' VAlign='Baseline'></Middle><Left Style='TopCorner'
SplitOffset='2.0' HAlign='Center' VAlign='Baseline'></Left><Right Style='Center' SplitOffset='0' HAlign='Center' VAlign='Baseline'></Right><Bottom Style='Box' SplitOffset='0' HAlign='Center' VAlign='Baseline'></Bottom></ElementPlacement>" 
End Function

Function TextElement ([OBJECTID], [OBJECTID_arr], [SystemSubtype], [SystemSubtype_arr], [Ident_Txt], [Ident_Txt_arr], [Frequency_Val], [Frequency_Val_arr], [Channel_Txt], [Channel_Txt_arr], [Voice_Code], [Voice_Code_arr], [ComponentSubtype], [ComponentSubtype_arr], [Name_Txt], [Name_Txt_arr], [LAT_TXT], [LAT_TXT_arr], [LONG_TXT], [LONG_TXT_arr], [ROLEFIX_CODE], [ROLEFIX_CODE_arr], [LABELSTATUS_CODE], [LABELSTATUS_CODE_arr])

TextElement = TopTextElement ([OBJECTID], [OBJECTID_arr], [SystemSubtype], [SystemSubtype_arr], [Ident_Txt], [Ident_Txt_arr], [Frequency_Val], [Frequency_Val_arr], [Channel_Txt], [Channel_Txt_arr], 
                    [Voice_Code],[Voice_Code_arr], [ComponentSubtype], [ComponentSubtype_arr], [Name_Txt], [Name_Txt_arr], [ROLEFIX_CODE], [ROLEFIX_CODE_arr], [LABELSTATUS_CODE], [LABELSTATUS_CODE_arr]) _ 
                  & MiddleTextElement ([OBJECTID], [OBJECTID_arr], [SystemSubtype], [SystemSubtype_arr], [Ident_Txt], [Ident_Txt_arr], [Frequency_Val], [Frequency_Val_arr], [Channel_Txt], [Channel_Txt_arr], 
                    [Voice_Code], [Voice_Code_arr], [ComponentSubtype], [ComponentSubtype_arr], [Name_Txt], [Name_Txt_arr],[LAT_TXT], [LAT_TXT_arr], [LONG_TXT], [LONG_TXT_arr], [LABELSTATUS_CODE], 
                    [LABELSTATUS_CODE_arr])_ 
                  & BottomTextElement ([OBJECTID], [OBJECTID_arr], [SystemSubtype], [SystemSubtype_arr], [Ident_Txt],[Ident_Txt_arr], [Frequency_Val], [Frequency_Val_arr],
                    [Channel_Txt], [Channel_Txt_arr], [Voice_Code], [Voice_Code_arr], [ComponentSubtype], [ComponentSubtype_arr], [Name_Txt],
                    [Name_Txt_arr]) _ 
                  & RightTextElement ([OBJECTID], [OBJECTID_arr], [SystemSubtype], [SystemSubtype_arr], [Ident_Txt], [Ident_Txt_arr], [Frequency_Val], [Frequency_Val_arr],
                    [Channel_Txt], [Channel_Txt_arr], [Voice_Code], [Voice_Code_arr],
                    [ComponentSubtype], [ComponentSubtype_arr], [Name_Txt], [Name_Txt_arr]) _ 
                  & LeftTextElement ([OBJECTID], [OBJECTID_arr], [SystemSubtype], [SystemSubtype_arr], [Ident_Txt], [Ident_Txt_arr], [Frequency_Val], [Frequency_Val_arr],
                   [Channel_Txt], [Channel_Txt_arr], [Voice_Code], [Voice_Code_arr], [ComponentSubtype], [ComponentSubtype_arr], [Name_Txt], [Name_Txt_arr]) 
End Function

Function TopTextElement ([OBJECTID], [OBJECTID_arr], [SystemSubtype], [SystemSubtype_arr], [Ident_Txt], [Ident_Txt_arr], [Frequency_Val], [Frequency_Val_arr], [Channel_Txt],
[Channel_Txt_arr], [Voice_Code], [Voice_Code_arr], [ComponentSubtype], [ComponentSubtype_arr], [Name_Txt], [Name_Txt_arr], [ROLEFIX_CODE], [ROLEFIX_CODE_arr], [LABELSTATUS_CODE], [LABELSTATUS_CODE_arr]) 
SFONT = "<fnt name='Tw Cen MT' size='7'>" 
EFONT = "</fnt>" 
strRole = [ROLEFIX_CODE_arr](0)

If [LABELSTATUS_CODE_arr](0) = "1" Then 
    TopTextElement = "" 
Else
    TopTextElement = "<TopTextElement>" & SFONT & strRole & vbnewline & EFONT & "</TopTextElement>" 
End If

End Function

Function MiddleTextElement ([OBJECTID], [OBJECTID_arr], [SystemSubtype], [SystemSubtype_arr], [Ident_Txt], [Ident_Txt_arr], [Frequency_Val], [Frequency_Val_arr], [Channel_Txt],
[Channel_Txt_arr], [Voice_Code], [Voice_Code_arr], [ComponentSubtype], [ComponentSubtype_arr], [Name_Txt], [Name_Txt_arr], [LAT_TXT], [LAT_TXT_arr], [LONG_TXT], [LONG_TXT_arr], [LABELSTATUS_CODE], [LABELSTATUS_CODE_arr]) 
SFONT = "<fnt name='Tw Cen MT' size='7'>" 
EFONT = "</fnt>"

strFreqUnd = 0 
select case [SystemSubtype_arr](0) 
case 1 'Marker

case 2 'LocatorMarker = Marker + NDB 

case 3 'NDB 
strName = [Name_Txt_arr](0) 
         strIdent = [Ident_Txt_arr](0) 
         strFreq = [Frequency_Val_arr](0) 
         if [Voice_Code_arr](0) = 0 then 
                   strFreqUnd = 1 
end if 
case 4 'NDBDME = NDB + DME 
         i = 0 
         do while i < ubound([ComponentSubtype_arr]) + 1 
                  if [ComponentSubtype_arr](i) = 2 then 
                           strIdent = [Ident_Txt_arr](i) 
                           strName = [Name_Txt_arr](i)
                           strChan = "Chan " & [Channel_Txt_arr](i) 
                  end if 
                  if[ComponentSubtype_arr](i) = 1 then 
                          strFreq = [Frequency_Val_arr](i)
                  end if if [Voice_Code_arr](i) = 0 then 
                          strFreqUnd = 1 
                  end if 
                  i = i + 1 
        loop 
case 5 'DME 
         strName = [Name_Txt_arr](0) 
         strIdent = [Ident_Txt_arr](0) 
         strFreq = "" strChan = "Chan " & [Channel_Txt_arr](0)
case 6 'VORDME = VOR + DME 
         i = 0 
         do while i < ubound([ComponentSubtype_arr]) + 1 
                  if [ComponentSubtype_arr](i) = 2 then 
                           strIdent = [Ident_txt_arr](i) 
                           strName = [Name_Txt_arr](i)
                           strChan = "Chan " & [Channel_txt_arr](i) 
                  end if 
                  if [ComponentSubtype_arr](i) = 3 then 
                           strFreq = [Frequency_Val_arr](i)
                  end if 
                  if [Voice_Code_arr](i) = 0 then 
                           strFreqUnd = 1 
                  end if 
                  i = i + 1 
         loop 
case 7 'VOR 
         strIdent = [Ident_Txt_arr](0) 
         strName = [Name_Txt_arr](0) 
         strFreq = [Frequency_Val_arr](0) 
         strChan = ""
case 8 'VORTAC = VOR + TACAN 
         do while i < ubound([ComponentSubtype_arr]) + 1 
                  if [ComponentSubtype_arr](i) = 3 then 
                            strIdent = [Ident_Txt_arr](i) 
                            strName = [Name_Txt_arr](i)
                            strFreq = [Frequency_Val_arr](i) 
                  end if 
                  if [Voice_Code_arr](i) = 0 then 
                            strFreqUnd = 1 
                  end if 
                  if [ComponentSubtype_arr](i) = 4 then
                            strChan = "Chan " & [Channel_Txt_arr](i) 
                  end if 
                  i = i + 1 
           loop
case 9 'TACAN 
         strIdent = [Ident_Txt_arr](0) 
         strName = [Name_Txt_arr](0) 
         strFreq = "" 
         strChan = "Chan " & [Channel_Txt_arr](0) 
case 10 'MLSElevation

case 11 'MLS 
          do while i < ubound([ComponentSubtype_arr]) + 1 
                   if [ComponentSubtype_arr](i) = 2 then 
                            strIdent = [Ident_Txt_arr](i)
                            strName = [Name_Txt_arr](i) 
                            strChan = "Chan " & [Channel_Txt_arr](i) 
                   end if 
                   if [ComponentSubtype_arr](i) = 6 then
                            strFreq = [Frequency_Val_arr](i) 
                   end if 
                   if [Voice_Code_arr](i) = 0 then 
                            strFreqUnd = 1 
                   end if 
                   i = i + 1 
           loop 
case 12 'MLSAzimuth 
case 13 'LocalizerApproachSystem 
          strIdent = [Ident_Txt_arr](0) 
          strName = "LOCALIZER" 
          do while i < ubound([ComponentSubtype_arr]) + 1 
                   if [ComponentSubtype_arr](i) = 7 then 
                            strFreq = [Frequency_Val_arr](i)
                   end if 
                   if [Voice_Code_arr](i) = 0 then 
                            strFreqUnd = 1 
                   end if 
                   if [ComponentSubtype_arr](i) = 2 then 
                            strChan = "Chan " & [Channel_Txt_arr](i) 
                   end if 
                   i = i + 1 
           loop 
case 14 'ILS 
          strName = "LOCALIZER" 
          do while i < ubound([ComponentSubtype_arr]) + 1 
                   if [ComponentSubtype_arr](i) = 7 then 
                            strIdent = [Ident_Txt_arr](i)
                            strFreq = [Frequency_Val_arr](i) 
                   end if 
                   if [Voice_Code_arr](i) = 0 then 
                            strFreqUnd = 1 
                   end if 
                   if [ComponentSubtype_arr](i) = 2 then
                            strChan = "Chan " & [Channel_Txt_arr](i) 
                   end if 
                   i = i + 1 
           loop
'case 15 'GlidePath 

end select

'logic to determine whether to keep the name 
if strName = "" then 
         outStr = strIdent & VerticalMorseCode & strIdent & "</fnt></VMC>" 
         outStr = outStr & vbcrlf & strFreq 
elseif strChan = "" or [LABELSTATUS_CODE_arr](0) = "2" then
         outStr = strName 
         outStr = outStr & vbcrlf & strFreq & " " & strIdent 
         outStr = outStr & VerticalMorseCode & strIdent & "</fnt></VMC>" 
else 
         outStr = strName
         outStr = outStr & vbcrlf & strFreq & " " & strIdent
         outStr = outStr & VerticalMorseCode & strIdent fnt></VMC>" 
         outStr = outStr & vbcrlf & strChan 
end if

'determine hemisphere 
if [LAT_TXT_arr](0) < 0 then 
         latHemi = "S"
else 
         latHemi = "N" 
end if 

if [LONG_TXT_arr](0) < 0 then 
         longHemi = "W" 
else 
         longHemi = "E" 
end if

'make decimal degree values positive 
decLat = abs([LAT_TXT_arr](0))
decLong = abs([LONG_TXT_arr](0)) 

'get degree information from decimal degree value 
dmsLatDeg = int(decLat) 
dmsLongDeg = int(decLong) 

'get decimal value 
decLatMin = decLat - dmsLatDeg
decLongMin = decLong - dmsLongDeg 

'turn decimal value into minutes
dmsLatMin = round(decLatMin * 60, 2) 
dmsLongMin = round(decLongMin * 60, 2)

if dmsLatDeg < 10 AND NOT dmsLatMin < 10 then 
         strLat = latHemi & "0" & dmsLatDeg & chr(176) & dmsLatMin & "'" 
elseif NOT dmsLatDeg < 10 AND dmsLatMin < 10 then
         strLat = latHemi & dmsLatDeg & chr(176) & "0" & dmsLatMin & "'" 
elseif dmsLatDeg < 10 AND dmsLatMin < 10 then 
         strLat = latHemi & "0" & dmsLatDeg & chr(176) & "0" & dmsLatMin & "'" 
else 
         strLat = latHemi & dmsLatDeg & chr(176) & dmsLatMin & "'" 
end if 
if dmsLongDeg < 10 AND NOT dmslongMin < 10 then 
         strLong = longHemi & "0" & dmsLongDeg & chr(176) & dmsLongMin & "'" 
elseif NOT dmsLongDeg < 10 AND dmsLongMin < 10 then
         strLong = longHemi & dmsLongDeg & chr(176) & "0" & dmsLongMin & "'" 
elseif dmsLongDeg < 10 AND dmsLongMin < 10 then 
         strLong = longHemi & "0" & dmsLongDeg & chr(176) & "0" & dmsLongMin & "'" 
else 
         strLong = longHemi & dmsLongDeg & chr(176) & dmsLongMin & "'"
end if 
         strDesig = strLat & vbnewline & strLong

If [LABELSTATUS_CODE_arr](0) = "2" Then 
MiddleTextElement = "<MiddleTextElement>" & SFONT & outStr & vbnewline & strDesig & vbnewline & EFONT & "</MiddleTextElement>" 'MiddleTextElement = "<MiddleTextElement>" & SFONT & strName & vbcrlf
& strFreq & " " & strIdent & VerticalMorseCode & strIdent & vbnewline & strDesig & 'vbnewline & EFONT & "</MiddleTextElement>"

Elseif [LABELSTATUS_CODE_arr](0) = "3" Then 
MiddleTextElement = "<MiddleTextElement>" & SFONT & outStr & EFONT & "</MiddleTextElement>" 
Else 
MiddleTextElement = "<MiddleTextElement>" & SFONT & outStr & vbnewline & strDesig & vbnewline & EFONT & "</MiddleTextElement>"

End If 
'MiddleTextElement = "<MultipleTextElement>" & TextBackground & MiddleText & "</MultipleTextElement>" 
End Function

Function BottomTextElement ([OBJECTID], [OBJECTID_arr], [SystemSubtype], [SystemSubtype_arr], [Ident_Txt], [Ident_Txt_arr], [Frequency_Val], [Frequency_Val_arr], [Channel_Txt], [Channel_Txt_arr], [Voice_Code], [Voice_Code_arr], [ComponentSubtype], [ComponentSubtype_arr], [Name_Txt], [Name_Txt_arr]) 
BottomTextElement = "" 
End Function

Function LeftTextElement ([OBJECTID], [OBJECTID_arr], [SystemSubtype], [SystemSubtype_arr], [Ident_Txt], [Ident_Txt_arr], [Frequency_Val], [Frequency_Val_arr], [Channel_Txt], [Channel_Txt_arr], [Voice_Code], [Voice_Code_arr], [ComponentSubtype], [ComponentSubtype_arr], [Name_Txt], [Name_Txt_arr]) 
LeftTextElement = "" 
End Function

Function RightTextElement ([OBJECTID], [OBJECTID_arr], [SystemSubtype], [SystemSubtype_arr], [Ident_Txt], [Ident_Txt_arr], [Frequency_Val], [Frequency_Val_arr], [Channel_Txt], [Channel_Txt_arr], [Voice_Code], [Voice_Code_arr], [ComponentSubtype], [ComponentSubtype_arr], [Name_Txt], [Name_Txt_arr]) 
RightTextElement = "" 
End Function

Function VerticalMorseCode 
VerticalMorseCode = "<VMC><fnt
name='PLTS Aeronautical VMC' size ='6'>" 

End Function


7/31/2012