MapX常见问题解答Word下载.docx
《MapX常见问题解答Word下载.docx》由会员分享,可在线阅读,更多相关《MapX常见问题解答Word下载.docx(12页珍藏版)》请在冰豆网上搜索。
3.关于Infotip-信息提示。
1.由Map1.InfotipSupport=True设置使能Infotip.
2.由Map1.InfotipPopupDelay=500(millisecond)设置延迟时间。
3.由LabelProperties.DataField来设置用做InfoTip的字段
4.如何在MapX下读取属性值。
有三种方法:
1.由Layer对象的KeyField属性来设立要读取属性值的字段名。
接着,由Feature对象的keyValue读取此行的属性值。
2.将图层加入到Datasets,由Dataset对象的Value(x,y)属性,通过设置行号,列号来获得属性值。
3.将图层加入到Datasets,之后由RowValues(ftr)获取整行的值。
DimdsAsMapXLib.Dataset,lyrAsMapXLib.layer
DimftrsAsFeatures
DimftrAsFeature
DimrvAsRowValue
DimrvsAsRowValues
DimDsNameAsString'
数据集名
DimDsRowsAsLong,DsColsAsLong
DimiAsLong,jAsLong
Setds=Formmain.Map1.Datasets.Item(DsName)
Setlyr=ds.layer
Setftrs=lyr.AllFeatures
DsCols=ds.Fields.Count
DsCols=DsCols+1
DsRows=ftrs.Count
Gridl.Rows=DsRows+1
Gridl.Cols=DsCols
Gridl.Row=0
Fori=0ToDsCols-1
Gridl.Col=i
Gridl.Text=ds.Fields.ltem(i+1).Name
Nexti
Grid1.Col=DsCols-1
Grid1.Text="
Fkey"
lyr.BeginAccessmiAccessRead
i=1
ForEachftrInftrs
Setrvs=ds.RowValues(ftr)
j=0
ForEachrvInrvs
IfNotIsNull(rv.Value)ThenGrid1.TextArray(i*DsCols+j)=Trim(rv.Value)
j=j+1
Next
Grid1.TextArray(i*DsCols+j)=ftr.FeatureKey
i=i+1
lyr.EndAccessmiAccessEnd
Setftr=Nothing
Setftrs=Nothing
Setds=Nothing
Setrv=Nothing
Setrvs=Nothing
Setlyr=Nothing
注意:
BeginAccess,以及EndAccess可以明显的提高属性读取的速度。
5.关于查找
两种方式:
1.使用Find对象的Search方法。
在mapx3.5中只能作到完全匹配查找,在MapX4.0中SearchEx方法则可以
找到多个匹配的记录,其结果由FindResult.Matches获取。
详细请参看有关Find.SearchEx方法的文档以及示例。
2.使用Layer对象的OBJECTSearch(strWhere)方法。
其参数为SQL查询的WHERE子句。
例如:
Setftrs=lyr.Search("
Character_Namelike"
"
%市
;
模糊查询
Character_Name="
北京市
nnn+
Setftrs=lyrUSA.Search("
TOTPOP>
1000000"
1。
字符串外加两个双引号。
2。
首先将图层加入数据集Datasets才能使用查询
6.自定义范围专题图
DimdsAsNewMapXLib.Dataset
DimthmAsNewMapXLib.Theme
Setds=Formmain.Map1.Datasets(ToolBars.Combo2.Text)
Setthm=ds.Themes.add(0,"
aa"
"
False)
thm.Legend.Compact=Falsethm.AutoRecompute=False'
thm.ComputeTheme=Falsethm.DataMax=700thm.DataMin=100thm.ThemeProperties.AllowEmptyRanges=Truethm.ThemeProperties.NumRanges=7thm.ThemeProperties.DistMethod=miCustomRangesthm.ThemeProperties.RangeCategories⑴.Max=150thm.ThemeProperties.RangeCategories
(1).Min=50thm.ThemeProperties.RangeCategories
(2).Max=250thm.ThemeProperties.RangeCategories
(2).Min=150thm.ThemeProperties.RangeCategories(3).Max=350thm.ThemeProperties.RangeCategories(3).Min=250thm.ThemeProperties.RangeCategories(4).Max=450thm.ThemeProperties.RangeCategories(4).Min=350thm.ThemeProperties.RangeCategories(5).Max=550thm.ThemeProperties.RangeCategories(5).Min=450thm.ThemeProperties.RangeCategories(6).Max=650thm.ThemeProperties.RangeCategories(6).Min=550thm.ThemeProperties.RangeCategories(7).Max=750thm.ThemeProperties.RangeCategories(7).Min=650'
thm.ComputeTheme=True
thm.AutoRecompute=True
thm.Visible=True
7.用MapX输出表格
用mapx直接输出图象是可以的,但是输出数据,可以有以下两种方式:
输出为文本文件,然后由VB读取
2。
转换为VB中的groud
8.mapxtreme2.0forNT下,非地球坐标系出现的问题
假设line.tab地图的投影为非地球坐标系,单位为米,边界为(-40,030.15474,-10,007.53869)(40,030.15474,
10,007.53869)。
(1)对地图的处理。
a.文件/另存为,在弹出的另存为对话框上点击投影按钮,确认,弹出边界对话框,将原来的边界值乘以1.609
再添入,即-40030.15474*1.609=-64408.51898。
四个边界值作同样处理。
b.输入文件名如linenew.tab,确认.
(2)在geosetmanager中调入文件linenew.tab.设置其视野范围。
如果实际设置为0至U0.19,则输入到对话框
中时为0至U0.19*1.609.但在设置zoom(视野值)时的范围仍为0-0.19.
9.如何实现测距
a.//创建测距工具
globalconstcalculatedistance=1
PrivateSubForm_Load()
map1.CreateCustomTool(calcilatedistance,miToolTypepoly,microsscursor)
EndSub
PrivateSubDistances_Click()
map1.currenttool=calculatetool
b.//在mapx的PolyToolUsed事件中,
用Distance(x1,y1,x2,y2)计算距离,由状态条中或label显示。
PrivateSubMap1_PolyToolUsed(ByValToolNumAsInteger,ByValFlagsAsLong,ByValpointsAsObject,ByValbShiftAsBoolean,ByValbCtrlAsBoolean,EnableDefaultAsBoolean)
DimDisSumAsDouble
DimDisAsDouble
DimnAsInteger
DimptsAsNewMapXLib.points
Dimx1AsDouble,y1AsDouble,x2AsDouble,y2AsDouble
Setpts=points
DisSum=0
MDIForm1.StatusBar1.Panels.ltem(3).Text=Format(Str(DisSum),"
#,##0.000000"
)
SelectCaseFlags
CasemiPolyToolBegin
CasemiPolyToolInProgress
IfToolNum=CalculateDistanceThen
Fori=1Topts.Count-1
x1=pts.Item(i).X
y1=pts.Item(i).Y
x2=pts.Item(i+1).X
y3=pts.Item(i+1).Y
Dis=Map1.Distance(x1,y1,x2,y2)
DisSum=DisSum+Dis
MDIForm1.StatusBar1.Panels.Item(3).Text=Format(Str(DisSum),"
EndIf
CasemiPolyToolEnd
EndSelect
10.printmap方法中w,h,x,y的单位:
himetricunit代表什么意