首先,理解几个知识点

#PolygonGraphics(options)感谢以前还不算差的英语,考研71分好像,至少现在读英文API能大概知道什么意思...真的是大概

API的描述:Describes a polygon defined by an hierarchy of linear rings which make up the outer shape and any nested holes. The polygon conforms to the curvature of the globe and can be placed on the surface or at altitude and can optionally be extruded into a volume.

PolygonGraphics(多边形面图形)是由各个层次的线所组成的面构成(外边、内边),这个多边形能够适应球体,能够被设置在球体表面或者特定高度,也能够放置(缩放)在特定空间。 NameTypeDescriptionoptions Object optional Object with the following properties: NameTypeDefaultDescriptionshow true optional A boolean Property specifying the visibility of the polygon.

hierarchy optional A Property specifying the PolygonHierarchy.

height 0 optional A numeric Property specifying the altitude of the polygon relative to the ellipsoid surface.

heightReference HeightReference.NONE optional A Property specifying what the height is relative to.位置高程参考

extrudedHeight optional A numeric Property specifying the altitude of the polygon's extruded face relative to the ellipsoid surface.

extrudedHeightReference HeightReference.NONE optional A Property specifying what the extrudedHeight is relative to.拉升高度参考

stRotation 0.0 optional A numeric property specifying the rotation of the polygon texture counter-clockwise from north.

granularity粒子 Cesium.Math.RADIANS_PER_DEGREE optional A numeric Property specifying the angular distance between each latitude and longitude point.

fill true optional A boolean Property specifying whether the polygon is filled with the provided material.

material填充材质 Color.WHITE optional A Property specifying the material used to fill the polygon.

outline外 false optional A boolean Property specifying whether the polygon is outlined.

outlineColor Color.BLACK optional A Property specifying the Color of the outline.

outlineWidth 1.0 optional A numeric Property specifying the width of the outline.

perPositionHeight false optional A boolean specifying whether or not the the height of each position is used.

closeTop封顶 Boolean true optional When false, leaves off the top of an extruded polygon open.

closeBottom封底 Boolean true optional When false, leaves off the bottom of an extruded polygon open.

arcType弧形状,球体上两点之间点连线是有多种方式的,不是平面,一般用大地线,也就是最短路径线 ArcType.GEODESIC optional The type of line the polygon edges must follow.

shadows阴影 ShadowMode.DISABLED optional An enum Property specifying whether the polygon casts or receives shadows from each light source.

distanceDisplayCondition距离显示 optional A Property specifying at what distance from the camera that this polygon will be displayed.

classificationType贴地形还是贴3dtiles ClassificationType.BOTH optional An enum Property specifying whether this polygon will classify terrain, 3D Tiles, or both when on the ground.

zIndex类似html5的显示层次 0 optional A property specifying the zIndex used for ordering ground geometry. Only has an effect if the polygon is constant and neither height or extrudedHeight are specified.

#PolygonGeometry

API是这么写的A description of a polygon on the ellipsoid. The polygon is defined by a polygon hierarchy. Polygon geometry can be rendered with both Primitive and GroundPrimitive.

球体上的多边形,多边形可以是层次嵌套,多边形几何实例可以使用primitive方式或者GroundPrimitive渲染,所以polygonGeometry是球体实例,只能用primitive方式渲染,使用entity方式生成实例时候就不要来查geometry的API了。

boundingSphere类,api的定义:A bounding sphere with a center and a radius.

Cesium.BoundingSphere.fromPoints(positions,

#distanceDisplayCondition与scaleByDistance

distanceDisplayCondition:new0,100000),在这个范围内可见

scaleByDistance:new1000.51000000.6),在(小于)100米时候scale为0.5,100-100000(大于)米之间逐渐放大到0.6

#最基础的实现,先实现显示注记

var jsonPromise = new Cesium.GeoJsonDataSource.load("./data/jxgeojson.json"); jsonPromise.then(function(datasource){ viewer.dataSources.add(datasource); var entities = datasource.entities.values; for (let i = 0; i < entities.length; i++) { var entity = entities[i];    //名称用加载数据的一项属性 entity.name = entity.properties.XZQMC;    //获取此时此刻的点集 var pointsArray = entity.polygon.hierarchy.getValue(Cesium.JulianDate.now()).positions;    //获取entity的polygon的中心点 var centerpoint = Cesium.BoundingSphere.fromPoints(pointsArray).center; //将entity的position设置为centerpoint,这里很好奇一个polygon没有position么,    //如果没有设置,确实为undefined     entity.position = centerpoint;    //设置标签名称 entity.label={ text:entity.name } } })

#改进显示注记

jsonPromise.then(function(datasource){ viewer.dataSources.add(datasource); var entities = datasource.entities.values; for (let i = 0; i < entities.length; i++) { var entity = entities[i]; if(Cesium.defined(entity.polygon))//设置entity.polygon的样式 { entity.polygon.material=new Cesium.Color.fromRandom({maximumRed:0.8,maximumBlue:0.8,maximumGreen:0.7,alpha:0.5}); //ClassificationType:Whether a classification affects terrain, 3D Tiles or both. entity.polygon.classificationType=Cesium.ClassificationType.TERRAIN; entity.name = entity.properties.XZQMC; } var pointsArray = entity.polygon.hierarchy.getValue(Cesium.JulianDate.now()).positions; var centerpoint = Cesium.BoundingSphere.fromPoints(pointsArray).center; entity.position = centerpoint; entity.label={ text:entity.name, scale:1, showBackground:true, //水平朝向,就是这个label放在position的左,中,右 horizontalOrigin:Cesium.HorizontalOrigin.LEFT, verticalOrigin:Cesium.VerticalOrigin.CENTER, distanceDisplayCondition:new Cesium.DistanceDisplayCondition(0,10000),       //远近-大小的关系设置 scaleByDistance:new Cesium.NearFarScalar(0.5, 0.5, 3, 0.5) } } })

来源:博客园

作者:巴蒂goal

链接:https://www.cnblogs.com/xiaoguniang0204/p/11752500.html

cesium添加填充_cesium实现注记功能相关推荐

  1. cesium添加填充_Cesium中级教程1 - 空间数据可视化(一)

    Cesium中文网:http://cesiumcn.org/| 国内快速访问:http://cesium.coinidea.com/ 本教程将教读者如何使用Cesium的实体(Entity)API绘制 ...

  2. cesium添加填充_cesium编程中级(四)使用渐变纹理

    能帮我看看问题出在哪么 redWalls 这个墙怎么也调用不了getColorRamp1这个canvas var redWalls = viewer.entities.add({ name: 'the ...

  3. 【ArcGIS微课1000例】0053:注记(水平、沿直线、跟随要素、牵引线、弯曲注记)的创建与编辑

    文章目录 一.创建注记 1.创建注记要素类 2. 水平注记 3. 沿直线 4. 随沿要素 5. 沿引线 6. 弯曲 二.修改注记 1. 复制粘贴 2. 移动注记 3. 旋转注记 4. 删除注记 5. ...

  4. Cesium最新版使用天地图地形及注记服务

    天地图三维地名服务和地形服务需要利用 cesium 开源三维地球API与天地图扩展插件共同使用,目前支持cesuim1.52.1.58.1.63.1. 天地图调用demo: http://lbs.ti ...

  5. ArcGIS地图制作的注记、格网添加

    1.如何避免地图注记重复标记 在制图过程中,我们可能会发现,在同一区域上有多个注记重复标记,这无疑是十分影响地图阅读使用的,同时也十分的不美观,使得图面十分繁复,为避免相关情况出现,我们可以选择进行以 ...

  6. 天地图默认为卫星图包括地名标记方法,天地图添加各类注记或图层方法

    通过官网的介绍,天地图默认是加载矢量图的,那么当我们默认使用影像底图的时候只有影像底图,没有地名注记,开发文档没有明确说明如何添加,经过个人理解,可以通过下面的方法添加注记. 根据地图API定义图层服 ...

  7. c# cad二次开发实现注记搜索跟扩展属性搜索,并点击即可定位到位置,添加了界面操作

    c# cad二次开发实现注记搜索跟扩展属性搜索,并点击即可定位到位置,添加了界面操作 在这里插入图片描述 using Autodesk.AutoCAD.DatabaseServices; using ...

  8. Cesium 实景三维道路 注记 — 不迷茫、有安全感的三维注记系统

    路网注记是浏览实景三维模型的重要语义数据,二维影像通过叠加路网注记层的方式实现,该方式在三维场景中并不适用,出现文字扭曲变形或压盖问题.   图:实景三维模型压盖路网 图:实景三维模型上方显示路网扭曲 ...

  9. Mapgis6.7 林相图自动注记 .

    林业行业制作林相图是一件比较复杂的事.Mapgis注释和子图分别对应arcmap中的标注和符号,区文件填充颜色对应arcmap中的渲染.由于mapgis中上注释文本和子图号都只能手工一个个去上.如果能 ...

最新文章

  1. 微软MVP社区活动(西宁站)
  2. freemarker的${!}
  3. Android调用系统软件打开文件(包括apk文件)
  4. java.lang.OutOfMemoryError---at java.lang.StringBuilder.append
  5. esxi usb插口_酷暑大作战 | USB-C风扇新体验
  6. 数据结构与算法(C#版)第二章 C#语言与面向对象技术(下)V1.0
  7. 诗与远方:无题(十一)
  8. 【英语学习】【Level 07】U04 Rest and Relaxation L4 A room fit for a king
  9. 开发者编程时应该围着“程序”转吗?
  10. 字符串中第一次重复出现的数及第一次不重复出现的数
  11. ARP表和MAC表的区别
  12. 关于python变量使用下列说法中错误的是_关于Python中的全局变量和局部变量,以下描述中错误的是...
  13. html弹窗复制,js复制弹窗美化
  14. 计算机科学导论课后总结_1
  15. oracle rac查看节点及宕库
  16. 本地计算机无法启动dhcp服务,Windows10无法启用dhcp服务怎么办?
  17. 锂电池常规认证-各国认证大全
  18. Python3 图片文字识别翻译——调用百度AI、百度翻译和有道翻译的API
  19. 普罗米修斯Prometheus+Grafana,监控搭建与界面基础配置
  20. chef infra安装和使用入门

热门文章

  1. python上传图片到钉钉_python实现钉钉群机器人报告推送
  2. 2022/03/03js作业第一个不同宽度变色第二个是输入几年几月几日判断是今年的第几天(不算闰年2月为28日)
  3. 8.认识robots.txt到爬取信息
  4. IDM下载视频按钮不见了
  5. 用python3制作视频字幕,生成双英文双语字幕txt和srt文件使用百度和有道翻译自封装翻译接口,可以秒杀付费工具,字幕脚本为qiweb3远程 2022年5月29日
  6. 自定义 showToast 组件,可直接使用,附源代码和使用说明
  7. 趣图:Python 程序员转 Java
  8. UI设计中线面结合图标设计总结
  9. Excel表格中重要的数据如何隐藏不显示
  10. Greenplum在HTAP场景下的优化和应用