阅读:1834回复:6
中文的KeyValue出错
<P>在Layer上添加一个Feature,如果Feature的KeyValue赋值字符串中有中文,则把这个Feature添加到Layer时会抛出Exception。不知道要怎么样才能给KeyValue赋中文值?</P>
<P>望路过的高手不吝指教,先谢了。</P> |
|
1楼#
发布于:2005-04-06 11:30
使用中文版就好了。
|
|
2楼#
发布于:2005-04-06 14:34
多谢2位热心指点,我找个中文的来试试
|
|
3楼#
发布于:2005-04-07 11:37
我也遇到了,可能是版本问题.
|
|
4楼#
发布于:2005-04-14 16:47
大家知不知道怎么通过KeyValue查找出在某图层中自己创建的多个图元并删除掉???
|
|
5楼#
发布于:2005-04-19 11:46
"<b>中文的KeyValue出错"这个问题与版本无关吧,我用的是MapX5,给Feature赋值中文、英文都可以,因此,你还是没有找到问题的实质,建议将代码贴出来,不然也没可讨论的依据!</b>
|
|
|
6楼#
发布于:2005-04-19 15:15
<P>我也遇到相同问题,后来下了中文版 mapx4.5 ,可以附中文了,但是每次关闭程序是都会提示错误:</P>
<P>"Exception EInvalid0p in module Utility.dll at 000107d6. Invalid floating point operation."</P> <P>代码如下:</P> <P>(部分)</P> <P>procedure TForm1.FormCreate(Sender: TObject); var tmpgo1,tmpgo2,tmpgo3,dbpath,s3,s1,s2:string; i:integer; xx,yy:extended; pnt:CMapxpoint; feafrc:CMapxFeatureFactory; newstyle:CMapxstyle; Ftr:CMapxFeature; newPoints:CMapXpoints; begin Map1.Geoset := ExtractFilePath(Application.ExeName) + 'Maps\map.gst'; Map1.SearchPath := ExtractFilePath(Application.ExeName) + 'Maps\'; with tmpsql do begin Close; sql.clear; SQL.Add('select * from railway order by 线路代码'); open; end; if tmpsql.RecordCount=0 then exit; //设置元件属性 Lyr1:=map1.Layers.CreateLayer('Lyr1',emptyparam,emptyparam,emptyparam,emptyparam); //添加图层 Lyr1.Editable:=True; pnt:=copoint.Create; newPoints:=CoPoints.Create; feafrc:=map1.FeatureFactory; Lyr1.LabelProperties.Style.TextFontColor:=clgreen; newstyle:=Costyle.Create; newstyle.SymbolType:=miSymbolTypeBitmap ; newstyle.SymbolBitmapName:='HOUS3-32.bmp'; tmpsql.First; while not tmpsql.Eof do begin RzTreeView1.Items.Add(RzTreeView1.Selected,tmpsql['线路名称']+'#'+tmpsql['线路代码']); s1:=tmpsql['线路代码']; with com do begin close; sql.Clear; s3:='select * from config inner join stations on config.车站代码=stations.车站代码 where (config.线路代码='+#$27+s1+#$27+' )'+'order by config.顺序号'; SQL.Add(s3); open; end; if com.RecordCount<2 then begin showmessage('组成线的车站数必须大于1'); exit; end; com.First; i:=0;</P> <P>/////////////////////主要在以下部分 while not com.Eof do begin xx:=equdata(strtofloat(com['经度']));//把**度**.****分转换为***.******度 yy:=equdata(strtofloat(com['纬度'])); pnt.Set_(xx,yy); i:=i+1; newPoints.Add(pnt,i); Ftr:= feafrc.CreateSymbol(pnt,newstyle); Ftr.KeyValue:=com['车站名'];//为汉字 Lyr1.AddFeature(Ftr,emptyparam); com.Next; end; map1.DefaultStyle.LineWidth := 2; map1.DefaultStyle.LineStyle:=75; map1.DefaultStyle.LineColor:=clblack; Lyr1.AddFeature(map1.FeatureFactory.CreateLine(newPoints, map1.DefaultStyle), EmptyParam ); newPoints.RemoveAll; tmpsql.Next; end; Lyr1.AutoLabel:=true;//自动标注 Lyr1.Visible:=true;//可见 Lyr1.Zoommin:=0; Lyr1.ZoomMax:=6000; Lyr1.Editable:=false;</P> <P>end;</P> [此贴子已经被作者于2005-4-20 8:31:09编辑过]
|
|