Code example: New LXP

The label expression below can be used to abbreviate advanced/callout annotation.

Function FindLabel ( [IAPNAVAID_LBL], [LABELSTATUS_CODE] )

ValueArray = Split([IAPNAVAID_LBL], "||")
 
LABELSTATUS_CODE_arr =Split( [LABELSTATUS_CODE] ,"<>") 

OBJECTID= ValueArray(0)
OBJECTID_arr= Split(OBJECTID ,"<>") 

PRIMARYNAVAID_CODE=ValueArray(2) 
if IsNull(PRIMARYNAVAID_CODE) or PRIMARYNAVAID_CODE ="" Then 
         PRIMARYNAVAID_CODE_arr= Split(" " ,"<>") 
else
 PRIMARYNAVAID_CODE_arr= Split(PRIMARYNAVAID_CODE ,"<>") 
end if

SystemSubtype= ValueArray(3) 
SystemSubtype_arr= Split(SystemSubtype,"<>") 

Ident_Txt= ValueArray(4) 
Ident_Txt_arr=Split(Ident_Txt ,"<>") 

Frequency_Val= ValueArray(5)
Frequency_Val_arr= Split( Frequency_Val,"<>")
 
Channel_Txt= ValueArray(6) 
Channel_Txt_arr= Split( Channel_Txt,"<>")

Voice_Code= ValueArray(7) 
Voice_Code_arr= Split(Voice_Code,"<>") 

ComponentSubtype= ValueArray(8) 
ComponentSubtype_arr=Split( ComponentSubtype,"<>") 

Name_Txt= ValueArray(9)
Name_Txt_arr= Split(Name_Txt ,"<>") 

LAT_TXT= ValueArray(10)
LAT_TXT_arr= Split(LAT_TXT ,"<>") 

LONG_TXT= ValueArray(11)
LONG_TXT_arr= Split(LONG_TXT ,"<>") 

ROLEFIX_CODE= ValueArray(12) 
ROLEFIX_CODE_arr= Split(ROLEFIX_CODE ,"<>")

FindLabel = "<MultipleTextElement>" & TextBackground
(PRIMARYNAVAID_CODE_arr) & TextElement (OBJECTID_arr,
SystemSubtype_arr, Ident_Txt_arr, Frequency_Val_arr,
Channel_Txt_arr, Voice_Code_arr, ComponentSubtype_arr,
Name_Txt_arr, LAT_TXT_arr, LONG_TXT_arr, ROLEFIX_CODE_arr,
LABELSTATUS_CODE_arr) & "</MultipleTextElement>" 
End Function

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

Function Background (PRIMARYNAVAID_CODE_arr) 
If PRIMARYNAVAID_CODE_arr(0) = "1" Then 
   Width = "0.7" 
Else 
   Width ="0.2" 
End If 
Background = "<BackgroundRoundness='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 

FunctionPlacement 
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_arr, SystemSubtype_arr,
Ident_Txt_arr, Frequency_Val_arr, Channel_Txt_arr, Voice_Code_arr,
ComponentSubtype_arr, Name_Txt_arr, LAT_TXT_arr, LONG_TXT_arr,
ROLEFIX_CODE_arr, LABELSTATUS_CODE_arr) 
TextElement = TopTextElement (OBJECTID_arr, SystemSubtype_arr, Ident_Txt_arr,
              Frequency_Val_arr, Channel_Txt_arr, Voice_Code_arr,
              ComponentSubtype_arr, Name_Txt_arr, ROLEFIX_CODE_arr,
              LABELSTATUS_CODE_arr) _ 
            & MiddleTextElement (OBJECTID_arr,SystemSubtype_arr, Ident_Txt_arr, Frequency_Val_arr,
              Channel_Txt_arr, Voice_Code_arr, ComponentSubtype_arr,
              Name_Txt_arr, LAT_TXT_arr, LONG_TXT_arr, LABELSTATUS_CODE_arr)_
            & BottomTextElement (OBJECTID_arr, SystemSubtype_arr,
              Ident_Txt_arr, Frequency_Val_arr, Channel_Txt_arr, Voice_Code_arr,
              ComponentSubtype_arr, Name_Txt_arr) _ 
            & RightTextElement (OBJECTID_arr, SystemSubtype_arr, Ident_Txt_arr, Frequency_Val_arr,
              Channel_Txt_arr, Voice_Code_arr, ComponentSubtype_arr,
              Name_Txt_arr) _ 
            & LeftTextElement (OBJECTID_arr, SystemSubtype_arr, Ident_Txt_arr, Frequency_Val_arr,
              Channel_Txt_arr, Voice_Code_arr, ComponentSubtype_arr, Name_Txt_arr) 
End Function

Function TopTextElement (OBJECTID_arr, SystemSubtype_arr,
Ident_Txt_arr, Frequency_Val_arr, Channel_Txt_arr, Voice_Code_arr,
ComponentSubtype_arr, Name_Txt_arr, ROLEFIX_CODE_arr,
LABELSTATUS_CODE_arr) 
SFONT = "<fnt name='Tw Cen MT' size='7'>" 
EFONT = "</fnt>" 
strRole = ROLEFIX_CODE_arr(0)

If LABELSTATUS_CODE_arr(0) = "Abbreviate IAF" Then 
 TopTextElement = "" 
Else 
 TopTextElement = "<TopTextElement>" & SFONT & strRole & vbnewline & EFONT & "</TopTextElement>"
End If 

End Function

Function MiddleTextElement (OBJECTID_arr, SystemSubtype_arr,
Ident_Txt_arr, Frequency_Val_arr, Channel_Txt_arr, Voice_Code_arr,
ComponentSubtype_arr, Name_Txt_arr, LAT_TXT_arr, LONG_TXT_arr,
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 

if strFreqUnd = 1 then 
          strFreq = "<und>" & strFreq & "</und>" 
end if 

'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) = "Abbreviate Channel" 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 & "'" 
else if NOT dmsLatDeg < 10 AND dmsLatMin < 10 then
         strLat = latHemi & dmsLatDeg & chr(176) & "0" & dmsLatMin & "'" 
else if 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) = "Abbreviate Channel" 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) = "Abbreviate Coordinates" 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_arr, SystemSubtype_arr, Ident_Txt_arr, Frequency_Val_arr, Channel_Txt_arr, Voice_Code_arr,
ComponentSubtype_arr, Name_Txt_arr) BottomTextElement = "" 
End Function

Function LeftTextElement (OBJECTID_arr, SystemSubtype_arr, Ident_Txt_arr, Frequency_Val_arr, Channel_Txt_arr, Voice_Code_arr,
ComponentSubtype_arr, Name_Txt_arr) LeftTextElement = "" 
End Function 

Function RightTextElement (OBJECTID_arr, SystemSubtype_arr, Ident_Txt_arr, Frequency_Val_arr,
Channel_Txt_arr, Voice_Code_arr, ComponentSubtype_arr, Name_Txt_arr) RightTextElement = "" 
End Function 

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






9/30/2010