50楼#
发布于:2005-08-22 20:41
<img src="images/post/smile/dvbbs/em03.gif" />hao
|
|
51楼#
发布于:2005-09-06 16:14
有没有后悔功能的程序?
|
|
52楼#
发布于:2005-09-26 15:46
<P>这里关于属性数据绑定的例子很少啊!我现在就实现最普通的normal绑定,却不知道该怎么设置,请高手指教!bindlayerobj:= CoBindLayer.Create;<BR> bindlayerobj.LayerType:= miBindLayerTypeNormal; <BR> bindlayerobj.LayerName:='全国地图';<BR> map1.Datasets.add(midatasetADO,ADOQuery2.Recordset,'market','MAPINFO_ID',EmptyParam,bindlayerobj,EmptyParam,False);</P>
<P>其中的'MAPINFO_ID'字段为用来进行[匹配的字段,就是属性数据库中的id号,到底该如何设置啊?我这样设置,报错误为:不能自动的匹配geofield字段或者是bindlayer,这样是为什么啊?</P><img src="images/post/smile/dvbbs/em08.gif" /><img src="images/post/smile/dvbbs/em08.gif" /><img src="images/post/smile/dvbbs/em08.gif" /> |
|
53楼#
发布于:2005-10-14 13:28
<P>//图元移动</P>
<P>procedure TForm1.Map1MouseMove(Sender: TObject; Shift: TShiftState; X,<BR> Y: Integer);<BR> var singlex,singley:single;lon, lat,x1,y1: Double;<BR> ftr:cmapxfeature;<BR>begin<BR> singleX := X;<BR> singleY := Y;<BR> Map1.ConvertCoord(singleX, singleY, lon,lat, miScreenToMap);<BR> statusbar1.Panels[0].Text :='X:'+floattostr(lon)+' Y:='+floattostr(lat);<BR> <BR> x2:=lon;<BR> y2:=lat;</P> <P>if po_move then<BR>begin</P> <P><BR> pnt := CoPoint.Create;</P> <P> // ftr:=map1.Layers[3].AllFeatures;<BR> pnt.Set_(lon, lat);<BR> fs := Map1.Layers.Item[3].SearchAtPoint(pnt,emptyparam);<BR> if fs.Count > 0 then<BR> begin<BR> // name := fs.Item[1].Name;<BR> ftr:=fs.Item[1];<BR> x1:= lon-ftr.CenterX ;<BR> y1:= lat- ftr.CenterY ;<BR> ftr.Offset(x1,y1);<BR> ftr.Update(emptyparam,emptyparam);<BR> map1.Layers.Item[3].Refresh ;<BR><BR>end; end;<BR> end;</P> <P>小弟不才,建一个QQ群大家共解迷津 QQ群号:7922457</P> |
|
54楼#
发布于:2005-12-05 17:10
<img src="images/post/smile/dvbbs/em01.gif" />
|
|
55楼#
发布于:2006-02-09 20:59
<P>procedure TForm1.Map1ToolUsed(ASender: TObject; ToolNum: Smallint; X1, Y1,<BR> X2, Y2, Distance: Double; Shift, Ctrl: WordBool;<BR> var EnableDefault: WordBool);<BR>var<BR> pt:CMapXPoint;<BR> Lyr:CMapXLayer;<BR> ftr:CMapXFeature;<BR> feaFac:CMapXFeatureFactory;<BR> newStyle:CMapXStyle;<BR>begin<BR> //邦定<BR> lyr:=Map1.Layers['China Major cities'];<BR> feaFac:=map1.FeatureFactory;<BR> //设置点对象样式<BR> newstyle:=CoStyle.Create;<BR> newstyle.SymbolType:=miSymbolTypeBitmap;<BR> newstyle.SymbolBitmapSize:=24;<BR> newstyle.SymbolBitmapTransparent:=false;<BR> newstyle.SymbolBitmapName:='YIEL2-32.BMP';<BR> //禁止自动刷新<BR> Map1.AutoRedraw:=false;<BR> //置当前图层为可写状态<BR> lyr.Editable:=true;<BR> //创建点对象<BR> pt:=CoPoint.Create;<BR> pt.Set_(map1.CenterX,map1.CenterY);<BR> //添加进当前图层<BR> ftr:=feafac.CreateSymbol(pt,NewStyle); //创建符号<BR> ftr:=feafac.CreateSymbol(pt,map1.DefaultStyle);<BR> //添加<BR> lyr.AddFeature(ftr,EmptyParam);<BR> lyr.Refresh;<BR> map1.AutoRedraw:=true;<BR> lyr.Editable:=false;<BR> //释放<BR> pt._Release;<BR>end;</P>
<P>出现"指定图层为只读图层,只读图层不可编辑”的错误是怎么回事?</P> |
|
56楼#
发布于:2006-04-14 16:18
<P>procedure TForm1.Button1Click(Sender: TObject);<BR>var<BR> Ftr :feature;<BR> pts1:points;<BR> pt:point;</P>
<P>begin<BR> Ftr.Attach(Map1);<BR> Ftr.Type_:= miFeatureTypeLine;</P> <P> // Make a new region feature with two triangles<BR> pt.Set_(Map1.CenterX + 10, Map1.CenterY);<BR> pts1.Add(pt,emptyparam);<BR> pt.Set_(Map1.CenterX + 10, Map1.CenterY + 5);<BR> pts1.Add(pt,emptyparam);<BR> pt.Set_(Map1.CenterX + 15, Map1.CenterY);<BR> pts1.Add(pt,emptyparam);<BR> pt.Set_(Map1.CenterX + 20, Map1.CenterY);<BR> pts1.Add(pt,emptyparam);</P> <P> // Add the two triangles to the new region<BR> Ftr.parts.add(pts1);<BR> //ftr:=map1.FeatureFactory.CreateLine(pts1,emptyparam);<BR> //map1.Layers.Item(1).addfeature(ftr,emptyparam);</P> <P><BR> //Add the region to a temporary layer<BR> Map1.Layers.Item(1).addfeature(Ftr,emptyparam);<BR>end;<BR>为什么会出现错误/,用同样的方法在vb中就能实现????</P> <P>请高手解答!!Ftr.Attach(Map1);会出错,为什么,<BR></P> |
|
57楼#
发布于:2006-04-24 21:57
各位大侠,我现在用mapx开发一个显示实时雨量信息的程序,程序每小时刷新一次,对有雨的站点,显示为下雨的图片,并且显示具体的数据,我用下面的方法来实现:<BR> lyr :=Map1.Layers.Item['rain'];<BR> lyr.KeyField:='id';<BR> //把查找的图层的值给一个图层<BR> ds := map1.Datasets.Add(miDataSetLayer, lyr ,EmptyParam, EmptyParam, EmptyParam, EmptyParam,<BR> EmptyParam, EmptyParam); //向地图的数据集中加入查找到的图层<BR> lyr.Find.FindDataset := ds; //字段数据集<BR> lyr.Find.FindField := ds.Fields.Item[2];//数据集字段<BR> str := Format('%s',['99876']); //要查找的id号<BR> ft := lyr.Find.Search(str,EmptyParam);//找到的图元 (如果找到两个的话就有问题)<BR> ftt:=ft.Layer.GetFeatureByID(ft.FeatureID );<BR> X:=ftt.CenterX;<BR> Y:=ftt.Centery;<BR> map1.Annotations.AddSymbol(x,y).Graphic.Style..SymbolBitmapName:='LITE1-32.bmp' ;//LITE1-32.bmp文件在C:\Program Files\MapInfo\MapX 5.0\CUSTSYMB目录下<BR>程序运行没问题,可是总不能显示为我要的图片,而是缺省的样式。<BR>想问一下:<BR> 1、 如果实现在Annotations上显示自定义图片?<BR> 2、 如果不能实现,有没有其他的方法。<BR> 3、 我的目标是:在查找的图元上显示一个自定义图片和相关的数据,并且能刷新。<BR> 4、 另外显示文字的时候,文字的大小好象随着图片的方法和缩小而变化,能让它不变大变小吗?map1.Annotations.AddText('89.10',X,Y,miPositionTC).Graphic.Style.TextFontColor :=clred//89.10往往会覆盖在标注的图片上,并且随图片放大而放大。
|
|
58楼#
发布于:2007-04-24 21:26
<BR> m_FlowPenTool:=TFlowPen.Create; <BR> m_FlowPenTool.CreateFlowPenTool(Map1); <BR><BR>Map1.CurrentTool:=m_FlowPenTool.GetToolNum(); <BR><BR>
|
|
59楼#
发布于:2007-09-12 10:35
<P>//对查找到的图元,进行字段读取/修改<BR>Var<BR> lyr : CMapXLayer;<BR> finds: CMapXFeatures;<BR> i,j:integer;<BR> rv: CMapxRowvalue;<BR>rvs: CMapxRowvalues;<BR>ds:CMapxDataset;</P>
<P>begin</P> <P> lyr:=map1.Layers.Item[edit1.text];<BR> DS:=map1.DataSets.Add(miDatasetLayer,lyr,emptyparam,emptyparam, emptyparam,emptyparam,emptyparam,emptyparam);<BR> finds:=lyr.Search('city="'+edit3.Text+'"',emptyparam);<BR> i:=finds.Count;<BR> while (i>0) do<BR> begin<BR> map1.ZoomTo(strtofloat(edit4.text),finds.Item[1].CenterX, finds.Item[1].CenterY);<BR> lyr.Selection.Replace(finds);</P> <P><BR> rvs:=ds.Rowvalues[finds.Item];<BR> for j:=1 to ds.Fields.Count do<BR> begin<BR> showmessage(rvs.Item[j].value);<BR> end;</P> <P> rvs.Item[1].value:=99; //为第一个字段赋值(本例图元有三个属性)<BR> rvs.Item[2].value:='bbb';//为第二个字段赋值<BR> rvs.Item[3].value:='cccc';//为第三个字段赋值</P> <P><BR> finds.Item.Update(true,rvs);<BR> i:=i-1;</P> <P> end;<BR> if finds.Count=0 then showmessage('没找到');<BR>end;</P> |
|