Many kudos to Russell Lawley's qik_percents.mbx on which most of this
code is based.
HTH,
Rob
'*************************************************************
'THEME DIALOG AND SETUP
'*************************************************************
SUB stdTheme
'OnError GoTo ThemeError
sIniFile = ApplicationDirectory$() + "aurchem.ini"
winID = FrontWindow()
winType = WindowInfo(winID,WIN_INFO_TYPE)
if winID = 0 then
note "Open a MAP window first"
exit sub
end if
If (wintype <> WIN_MAPPER) Then
note "Select an open MAP window first"
exit sub
end if
sTableList = MakeTabsList$(3)
sTableName = ""
sColumnlist = ""
Dialog Title "APPLY AURCHEM THEME" Calling fillColumnListBox
Control GroupBox Title "Range Type:" Position 5,5 Width 100 Height 38
Control RadioGroup Title "Fixed (Rock);Percentile (Geochem)" Value 1
Into nSampleType ID 100 Position 12,16 Width 80 Calling fillColumnListBox
Control GroupBox Title "Colour Ranges For:" Position 5,50 Width 220
Height 80
Control StaticText Title "Table:" Position 10,62
Control StaticText Title "Column:" Position 120,62
Control ListBox Position 10,72 Width 100 Height 50 Title From
Variable sTablelist Value 1 ID 101 Calling fillColumnListBox
Control ListBox Position 120,72 Width 100 Height 50 Title From
Variable sColumnList Value 1 ID 102 Calling selectColumn
Control OKButton
Control CancelButton
If CommandInfo(CMD_INFO_DLG_OK) Then
' Spacer
Else
Exit Sub
End if
' Calculate Range Breaks
If nSampleType = 1 Then
sDefaultSymbol = GetIni("Main", "fixedsymbol", "34", sIniFile)
Select aDataCol From sTableName Into percenttemp Order By
aDataCol
nRows = Tableinfo("percenttemp",tab_info_nrows)
Fetch first From percenttemp
nValueMin = percenttemp.col1
Fetch last From percenttemp
nValueMax = percenttemp.col1
nBreak(1)= nValueMin
nBreak(9)= nValueMax
sBreak = GetIni("Main", "fixedbreak", "1,10,20,30,40,50,60",
sIniFile)
nStep = 8
For counter = 2 to nStep
nBreak(counter) = GetListItem$(sBreak,counter-1,",")
Next
Else
sDefaultSymbol = GetIni("Main", "percentsymbol", "34", sIniFile)
Select aDataCol From sTableName Into percenttemp Order By
aDataCol
nRows = Tableinfo("percenttemp",tab_info_nrows)
Fetch first From percenttemp
nValueMin = percenttemp.col1
Fetch last From percenttemp
nValueMax = percenttemp.col1
nBreak(1)= nValueMin
nBreak(9)= nValueMax
sBreak = GetIni("Main", "percentbreak",
"90,95,96,97,98,99,99.5", sIniFile)
nStep = 8
FOR counter = 2 TO nStep
nStepVal = GetListItem$(sBreak,counter-1,",")
nRowNum = round(nStepVal*nRows/100,1)
Fetch rec(nRowNum) FROM percenttemp
nBreak(counter) = percenttemp.col1
Next
End If
' Build Thematic Command
sSymbol(1) = " Symbol (49,12632256,12) ,"
sSymbol(2) = " Symbol ("+sDefaultSymbol+",16752895,8) ,"
sSymbol(3) = " Symbol ("+sDefaultSymbol+",9445631,8) ,"
sSymbol(4) = " Symbol ("+sDefaultSymbol+",255,8) ,"
sSymbol(5) = " Symbol ("+sDefaultSymbol+",65280,12) ,"
sSymbol(6) = " Symbol ("+sDefaultSymbol+",16776960,12) ,"
sSymbol(7) = " Symbol ("+sDefaultSymbol+",16744448,12) ,"
sSymbol(8) = " Symbol ("+sDefaultSymbol+",16711680,12)"
sStatementStart = "shade window " + winID + " " + sTableName + "
with " + sDataCol + " ranges apply all use all Symbol (49,12632256,12) "
sStatementMid = ""
sStatementEnd = " default Brush (2,8421504,16777215) # use 2 round
1 inflect off Symbol (0,0,0) at 5 by 0 color 1 #"
For counter = 1 to nStep
sStatementMid = sStatementMid + nBreak(counter) + ": " +
nBreak(counter +1) + sSymbol(counter)
Next
sStatement = sStatementStart + sStatementMid + sStatementEnd
'Print sStatement
Run Command sStatement
If nSampleType = 1 Then
Set Legend window WinID layer prev display on shades off symbols on
lines off count off title "Samples - Rock (Au ppm)" Font ("Arial",0,9,0)
subtitle "Samples - Downhole Intersections (AU ppm)" Font
("Arial",0,9,0) ascending off ranges Font ("Arial",0,8,0) auto display
off ,auto display on ,auto display on ,auto display on ,auto display on
,auto display on ,auto display on ,auto display on ,auto display on
Else
Set legend window WinID layer prev display on shades off symbols on
lines off count off title "Samples - Soil (AU ppm)" Font ("Arial",0,9,0)
subtitle "Pecentiles (90,95,96,97,98,99,99.5)" Font ("Arial",0,8,0)
ascending off ranges Font ("Arial",0,8,0) auto display off ,auto display
on ,auto display on ,auto display on ,auto display on ,auto display on
,auto display on ,auto display on ,auto display on
End If
Open Window Legend
Run Menu Command M_Query_Unselect
Close Table percenttemp
EXIT Sub
ThemeError:
Note "Something bad happened"
END SUB
'*************************************************************
> .
>
>