Skip to content
本页目录

TXGeoPolygon: ​

线对象主要是坐标点集在地图上的渲染模式,最基本的构成是坐标点集。

一般用于展示图斑、范围区域、面状方案,主要属性为样式符号(填充色、不透明度、轮廓线风格、依附模式、拉伸、填充等),属性信息等。

该类经常和TXPolygonStyle类以及TXPoint类配套使用。

属性信息支持用html标签实现符号化样式

示例代码 ​

Python
polygon = TXGeoPolygon()

方法:AddPoints ​

设置多边形的坐标集合

参数:points ​

坐标集合,PointList类的实例

返回:无 ​

示例代码: ​

Python
positions = PointList()
position = TXPoint()
position.x = lon
position.y = lat
position.z = alt
# 添加坐标点
positions.push_back(position)
# 重复此过程
...
# 添加坐标集合
polygon.AddPoints(positions)

方法:GetPoints ​

获取多边形的坐标集合

参数:无 ​

返回:多边形的坐标集合 ​

示例代码: ​

Python
positions = polygon.GetPoints()

方法:SetStyle ​

设置多边形的样式

参数:style ​

多边形样式,TXPolygonStyle类的实例

返回:无 ​

示例代码: ​

Python
polygon_style = TXPolygonStyle()
# 设置多边形的具体样式,填充色、轮廓线样式等
fill_color = TXColor(0, 0, 205, 255)
polygon_style.SetFillColor(fill_color)
...
polygon.SetStyle(polygon_style)

方法:GetStyle ​

获取多边形的样式

参数:无 ​

返回:style ​

多边形样式

示例代码: ​

Python
style = polygon.GetStyle()
# 获取具体的样式:填充色、轮廓线样式等
fill_color = style.GetFillColor()

方法:SetAltitudeMode ​

设置多边形的高度模式

参数:altitudeType ​

高度模式类型,分紧贴地表、相对海拔、绝对海拔、依附模型四种

返回:无 ​

示例代码: ​

Python
# AltitudeType_ClampToGround
# AltitudeType_RelativeToGround
# AltitudeType_Absolute
# AltitudeType_ClampToModel
polygon.SetAltitudeMode(AltitudeType_Absolute)

方法:GetAltitudeMode ​

获取多边形的高度模式

参数:无 ​

返回:altitudeType ​

高度模式类型,分紧贴地表、相对海拔、绝对海拔、依附模型四种

示例代码: ​

Python
altitude_mode = polygon.GetAltitudeMode()

方法:SetName

设置多边形的名称

参数:name ​

返回:无 ​

示例代码: ​

Python
polygon.SetName('Test')

方法:GetName ​

获取多边形的名称

参数:无 ​

返回:name ​

示例代码: ​

Python
name = polygon.GetName()

方法:SetVisible ​

设置多边形是否可见

参数:visible ​

返回:无 ​

示例代码: ​

Python
polygon.SetVisible(True)

方法:IsVisible ​

获取多边形是否可见

参数:无 ​

返回:visible ​

示例代码: ​

Python
visible = polygon.IsVisible()

方法:SetHighlight ​

设置多边形是否高亮

参数:highlight ​

返回:无 ​

示例代码: ​

Python
polygon.SetHighlight(True)

方法:IsHighlight ​

获取多边形是否高亮

参数:无 ​

返回:highlight ​

示例代码: ​

Python
highlight = polygon.IsHighlight()

方法:SetDescription ​

设置多边形的描述信息

参数:description ​

返回:无 ​

示例代码: ​

Python
polygon.SetDescription('你好 python')

方法:GetDescription ​

获取多边形的描述信息

参数:无 ​

返回:description ​

示例代码: ​

Python
description = polygon.GetDescription()