欢迎您来到GIS动力

加入收藏 免费注册 用户登陆 帮助中心
首页 新闻动态 技术专栏 银杏树下 学习考研 软件下载 求职招聘 许愿瓶 节日祝福 用户中心 精彩推荐 资源搜索 地图
专栏导航: AO开发 | SO开发 | ArcGIS桌面 | 超图桌面 | 开发语言 | 数据库 | WebGIS | 银杏文学 | 研究生考题 | FreeMap 谈天说地
   您现在位于: 首页技术专栏SuperMap应用与开发SO开发 → 正文
跟踪文本
07-11-02 09:52:08 作者: 出处:超图

功能简介:

    示范在supermap Objects 中的鼠标点击处加入一个文本到跟踪层上。


操作说明:

    点击"这里测试"按钮,在地图窗口中用鼠标进行点击,在点击处即可出文本, "背景透明"和"固定大小"使文本以不同方式显示。

数据来源:..\Data\World目录下的World.sdb和World.sdd两个文件

    所用SuperMap Objects 组件、对象的主要属性和方法:

控 件 及 对 象 属  性 方  法
SuperWorkspace Datasource OpenDatasource
SuperMap  Layers  
soTrackingLayer   Addevents

功能实现:

  • 加入文本过程:

 Private Sub SuperMap1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
'在鼠标点击处加入一个文本到TrackingLayer上,其中:文本的内容和大小在程序中写定,也可以修改。
If SuperMap1.Action = 100000 Then
Dim objGeoPoint As New soGeoPoint
Dim objStyle As New soStyle
SuperMap1.TrackingLayer.ClearEvents

'设置文本定位点的颜色、大小和符号类别
objStyle.PenColor = vbRed 
objStyle.SymbolSize = 30 
objStyle.SymbolStyle = 1 

'设置此点的坐标
o
bjGeoPoint.x = SuperMap1.PixelToMapX(ScaleX(x, vbTwips, vbPixels))
objGeoPoint.y = SuperMap1.PixelToMapY(ScaleY(y, vbTwips, vbPixels))

'加入点到TrackingLayer上
SuperMap1.TrackingLayer.AddEvent objGeoPoint, objStyle, ""

Dim objGeoText As New soGeoText 
Dim objTextPart As New soTextPart 


'设置文本的内容,可以修改
objTextPart.Text = "SuperMap"

'设置文本的定位点
objTextPart.x = objGeoPoint.x
objTextPart.y = objGeoPoint.y


'设置文本的旋转角度
objTextPart.Rotation = 0
'把文本子对象加入到文本对象中
objGeoText.AddPart objTextPart

Dim objGeoTextStyle As New soTextStyle '文本风格对象
With objGeoTextStyle
.Color = vbBlue 
.FontHeight = 4000000 
.Align = sctBottomCenter 
End With


Set objGeoText.TextStyle = objGeoTextStyle '设置文本的风格
'加入文本到TrackingLayer上
SuperMap1.TrackingLayer.AddEvent objGeoText, Nothing, ""
SuperMap1.TrackingLayer.Refresh
End If

'释放对象变量
Set objGeoTextStyle = Nothing
Set objTextPart = Nothing
Set objGeoText = Nothing
Set objGeoPoint = Nothing
Set objStyle = Nothing
End Sub

  • 加入文本示意图


(本文已被浏览 次)
发布人:admin
推荐给好友:发送给好友
上篇新闻:
下篇新闻:
相关评论
发表我的评论
  • 尊重网上道德,遵守《全国人大常委会关于维护互联网安全的决定》及中华人民共和国其他各项有关法律法;
  • 本站有权保留或删除您发表的任何评论内容;
  •   相关文章  

    关于我们 友情链接 ┋ 与我在线 ┋ 管理 ┋ TOP
    网站当前版本:GisPower CMS V3.0
    『GIS 动力』- http://www.gispower.org/
    联系我们:webmaster#gispower.org
    Copyright (c) 2003-2007 GisPOwer.Org. All Rights Reserved.

                   滇ICP备05006901号