阅读:3211回复:13
怎么样选择独立图元啊?
Pt.Set 0, 0
Set MobileFtr = Map1.Layers.Item(1).AddFeature(Map1.FeatureFactory.CreateSymbol(Pt, NewStyle1)) MobileFtr.Keyvalue = "A12356" Map1.Layers.Item("1").AutoLabel = True 我用这种方法在地图上建立了多个独立的图元。 现在我想用Map1.CurrentTool = miSelectTool选择这个图元。那么怎么样用鼠标点击某图元后得到该图元的Keyvalue值? |
|
1楼#
发布于:2004-03-02 16:29
Set F = Map1.FeatureFactory.CreateRegion(Points, Map1.DefaultStyle) 加上以下语句: Set fNew = Map1.Layers(ToolBars.Combo3.ListIndex + 1).AddFeature(F) fNew.Update |
|
2楼#
发布于:2004-02-17 09:13
好,太帅了!问题彻底解决~~
thanks |
|
3楼#
发布于:2004-02-16 15:03
如果不是用选择工具,只是用鼠标点某处:
以下为我的一个程序中的一段代码: procedure TFrmMain.Map1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var MapX: Double; MapY: Double; XX, YY: single; Pnt: CMapXPoint; fs: CMapXFeatures; Pnt: CMapXPoint; fs: CMapXFeatures; begin pnt := CoPoint.Create; XX := x; //强制转换 YY := y; Map1.ConvertCoord(XX, YY, MapX, MapY, miScreenToMap); Pnt.Set_(MapX, MapY); fs := Map1.Layers.item(1).SearchAtPoint(Pnt); .... end; |
|
|
4楼#
发布于:2004-02-16 14:59
如果是选择的话
set ftr =map1.layers.item(1).selection.item(1) |
|
|
5楼#
发布于:2004-02-16 11:58
Dim obj As MapXLib.Feature
Dim objs As MapXLib.Features Dim lyr As MapXLib.Layer Set lyr = Map1.Layers.Item(1) lyr.KeyField='name' Set objs = lyr.AllFeatures For Each obj In objs MsgBox obj.Keyvalue Next 上面的代码只是把所有的对象列出来,但是如何得到鼠标点到的哪一个对象呢? |
|
6楼#
发布于:2004-02-13 12:06
thanks a lot.
|
|
7楼#
发布于:2004-02-12 21:25
therefore,you can add it to both features and selection.
Just try the codes that echo2003 offered you. |
|
|
8楼#
发布于:2004-02-12 21:21
以下是引用gdmaple在2004-2-10 18:04:39的发言: I have been confused by your question. Since you have used the function CreateSymbol that created a stand-alone feature,and then added it to a layer,it is a stand-alone feature no longer!!!! It is a feature that belongs to a layer!!! |
|
|
9楼#
发布于:2004-02-12 17:24
你用如下代码试试,也可以看看MAPX的FINGD和SEARCH的相关帮助!
Dim obj As MapXLib.Feature Dim objs As MapXLib.Features Dim lyr As MapXLib.Layer Set lyr = Map1.Layers.Item(1) lyr.KeyField='name' Set objs = lyr.AllFeatures For Each obj In objs MsgBox obj.Keyvalue Next |
|
上一页
下一页