爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 3248|回复: 6

[混合编程] KML之样式

[复制链接]

新浪微博达人勋

发表于 2019-1-11 10:29:30 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
<Style>标签是十分重要的,它决定了在谷歌地球上作图的线型、颜色等,

所有的样式标签都需要<Style>标签做容器,
<Style>相当于一个容器标签。
泛Style元素包括:
1、BalloonStyle
2、IconStyle
3、LabelStyle
4、LineStyle
5、ListStyle
6、PolyStyle
以下做仔细介绍.......
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2019-1-11 10:51:33 | 显示全部楼层
构造一个样式,id为sh_icon5_copy1
<Style id="sh_icon5_copy1">


<IconStyle>
<scale>0.77</scale>
<Icon>
<href>

                               
登录/注册后可看大图
</href>

</Icon>
</IconStyle>


<LabelStyle>
<scale>0.9</scale>
</LabelStyle>


</Style>
以上样式的引用格式为:
<styleUrl>#sh_icon5_copy1</styleUrl>

密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2019-1-11 11:33:03 | 显示全部楼层
<color>颜色标签,值为8位数字,aabbggrr,默认值ffffffff(白色)
----------------------------------
数值意义为:
aa=alpha通道:把0-255转为16进制,00为全透明,ff为全不透明
bb=蓝通道:把0-255转为16进制
gg=绿通道:把0-255转为16进制
rr=红通道:把0-255转为16进制
----------------------------------
这里需要把十进制转16进制,IDL代码如:
IDL> print,10,format='(Z)'
      A
IDL> print,255,format='(Z)'
     FF

目前没看到有直接的转换函数,应该是有的,如果不好找,就做个离散映射表即可。

----------------------------------
取色模式<colorMode>有2个:
normal------按<color>的取色设置来;
random------随机取色(没啥用吧?!)

密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2019-1-11 11:43:32 | 显示全部楼层
线条样式标签<LineStyle>,定义颜色、粗细等属性;<width>表示粗细,整数,默认值1,单位像素(Pixel);
单位是像素,那么粗细不会因缩放地图而改变。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2019-1-14 09:29:18 | 显示全部楼层
飞鸽截图20190114092616.png 固定开头:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Document>
文件名:
<name>ao</name>
1、定义样式:
<Style id="style1">


<IconStyle id="style2">
<heading>180</heading>
<Icon>
<href>

                               
登录/注册后可看大图
</href>

</Icon>
</IconStyle>


<PointStyle id="style3">
<Icon>
<href>

                               
登录/注册后可看大图
</href>

</Icon>
</PointStyle>


</Style>




2、创建地标:
<Placemark>
<name>point1</name>
引用样式:
<styleUrl>#style1</styleUrl>
<Point>
连线到地面:
<extrude>1</extrude>
<altitudeMode>absolute</altitudeMode>
<coordinates>119.71,32.65,200</coordinates>
</Point>
</Placemark>


</Document>
</kml>


密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2019-1-14 09:53:07 | 显示全部楼层
本帖最后由 15195775117 于 2019-1-14 10:07 编辑

飞鸽截图20190114094559.png

固定开头:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Document>
文件名:
<name>ao</name>
新建地标:
<Placemark>
<name>tracks</name>
<description>Linestyle</description>
新建样式:
<Style id="Style">
(不知为何有3个?)
<LineStyle id="StyleLine">
<color>ff00ffff</color>
<width>8</width>
</LineStyle>


<PolyStyle id="StylePoly">
<color>7f00ff00</color>
</PolyStyle>
</Style>
新建连线:
<LineString id="StyleLine">
<extrude>1</extrude>
<tessellate>1</tessellate>
<altitudeMode>absolute</altitudeMode>
<coordinates>
119.71,32.65,1000
119.71,32.66,2000
119.66,32.68,3000
119.63,32.63,4000
119.66,32.58,5000
119.70,32.62,6000
119.72,32.65,7000
</coordinates>
</LineString>




</Placemark>


</Document>
</kml>




密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2019-1-14 15:32:09 | 显示全部楼层
修改点式图标样式
飞鸽截图20190114152953.png

固定开头:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Document>
文件名:
<name>ao</name>
定义样式,样式只能通过定义+引用,不可在地标内设置
<Style id="style9">
<IconStyle>
缩放大小:
<scale>10</scale>
设置图标:
<Icon>
<href>

                               
登录/注册后可看大图
</href>

</Icon>
</IconStyle>
</Style>
新建地标:
<Placemark>
<name>test1</name>
引用样式:
<styleUrl>#style9</styleUrl>
<Point>
<coordinates>120.8,32.5,0</coordinates>
</Point>
</Placemark>


</Document>
</kml>


密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表