Mats, You
said :
"I have a point map layer, consisting of
train stations. I'd like to use a variant array of station data and create an
unbound dataset, binding the data to the train stations. I think I've succeeded
to create the dataset correctly, but when I create a GradSymbol theme, the data
doesn't show in the map (I'd like to get a symbol to the side of each and every
station in the variant array). What am I doing wrong?"
Following is the code for a Visual Basic 5/Mapx 3
program that successfully builds an unbound dataset and then uses it to add a
GradSymbol theme. Consider compiling it, then if it works, adapting it to
suit your needs.
A Geoset called OZ with two layers (Australia Capitals,
Australia) was defined for this example. The
Australia Capitals table is a point layer and contains a geofield (the
geographic feature name column) called
"Place_name".
initiates the thematic mapping.
Here's the code:
Option Explicit
Const strDatasetName = "Dataset1"
Const intDataRows = 4
Dim vntData(1 To 4, 1 To 2) As Variant
Const strDatasetName = "Dataset1"
Const intDataRows = 4
Dim vntData(1 To 4, 1 To 2) As Variant
Private Sub Command1_Click()
Dim objFlds As New MapXLib.Fields
Dim objDs As MapXLib.Dataset
Dim objThm As MapXLib.Theme
' Describe the structure of the dataset
objFlds.Add "CityName", "CityName", miAggregationIndividual, miTypeString
objFlds.Add "CityPopn", "CityPopn", miAggregationSum, miTypeNumeric
' Add the dataset "Dataset1".
' The data set is bound on field "CityName"
' to map layer with layername="Australia Capitals" and geofield="Place_Name"
Set objDs = objMap1.Datasets.Add(miDataSetUnbound, Nothing, _
strDatasetName, "CityName", , "Australia Capitals", objFlds)
' The data set is bound on field "CityName"
' to map layer with layername="Australia Capitals" and geofield="Place_Name"
Set objDs = objMap1.Datasets.Add(miDataSetUnbound, Nothing, _
strDatasetName, "CityName", , "Australia Capitals", objFlds)
'Create a GradSymbol theme based on the
"CityPopn" column in the dataset
Set objThm = objDs.Themes.Add(miThemeGradSymbol, "CityPopn", "Theme1")
' set symbol style
With objThm.ThemeProperties
.SymbolStyle.SymbolFont.Name = "MapInfo Symbols"
.SymbolStyle.SymbolFont.Size = 36
.SymbolStyle.SymbolFontColor = miColorRed
.SymbolStyle.SymbolCharacter = 35 ' circle
.SymbolStyle.SymbolFontHalo = True
.DataValue = 4000000 ' value for 36 pt symbol
End With
Set objThm = objDs.Themes.Add(miThemeGradSymbol, "CityPopn", "Theme1")
' set symbol style
With objThm.ThemeProperties
.SymbolStyle.SymbolFont.Name = "MapInfo Symbols"
.SymbolStyle.SymbolFont.Size = 36
.SymbolStyle.SymbolFontColor = miColorRed
.SymbolStyle.SymbolCharacter = 35 ' circle
.SymbolStyle.SymbolFontHalo = True
.DataValue = 4000000 ' value for 36 pt symbol
End With
End Sub
Private Sub Form_Load()
vntData(1, 1) = "Canberra"
vntData(1, 2) = 350000
vntData(2, 1) = "Sydney"
vntData(2, 2) = 4000000
vntData(3, 1) = "Melbourne"
vntData(3, 2) = 3500000
vntData(4, 1) = "Brisbane"
vntData(4, 2) = 1500000
End Sub
Private Sub objMap1_RequestData(ByVal DataSetName As String, _
ByVal Row As Long, ByVal Field As Integer, Value As Variant, Done As Boolean)
If DataSetName <> strDatasetName Or Row > intDataRows Then
Done = True
Else
Value = vntData(Row, Field)
End If
End Sub
Private Sub Form_Load()
vntData(1, 1) = "Canberra"
vntData(1, 2) = 350000
vntData(2, 1) = "Sydney"
vntData(2, 2) = 4000000
vntData(3, 1) = "Melbourne"
vntData(3, 2) = 3500000
vntData(4, 1) = "Brisbane"
vntData(4, 2) = 1500000
End Sub
Private Sub objMap1_RequestData(ByVal DataSetName As String, _
ByVal Row As Long, ByVal Field As Integer, Value As Variant, Done As Boolean)
If DataSetName <> strDatasetName Or Row > intDataRows Then
Done = True
Else
Value = vntData(Row, Field)
End If
End Sub
I'd be happy to e-mail the complete app to you if that
would help. Just ask.
David M
Haycraft
Phone/Fax: 61 + 2 + 6231 8104
Information Analysis Assocs P/L Mobile: 0412 001 134
ACN 085 516 105 Email: [EMAIL PROTECTED]
1 Cumming Place, Wanniassa
A.C.T. 2903, Australia A MapInfo Partner
Information Analysis Assocs P/L Mobile: 0412 001 134
ACN 085 516 105 Email: [EMAIL PROTECTED]
1 Cumming Place, Wanniassa
A.C.T. 2903, Australia A MapInfo Partner
