new mars3d.graphic.RectangleCombine({生成演示数据代码pt1与pt2详解

这篇具有很好参考价值的文章主要介绍了new mars3d.graphic.RectangleCombine({生成演示数据代码pt1与pt2详解。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

new mars3d.graphic.RectangleCombine({生成演示数据代码pt1与pt2详解,Mars3d,vue,app,3d,前端,javascript,vue.js

示例链接:

1.new mars3d.graphic.RectangleCombine({功能示例(Vue版) | Mars3D三维可视化平台 | 火星科技

2.new mars3d.graphic.RectangleEntity({功能示例(Vue版) | Mars3D三维可视化平台 | 火星科技

相关的api文档说明:

1.mars3d.PointUtil.getPositionByDirectionAndLen(根据观察点的方向角度和距离,计算目标点坐标。

new mars3d.graphic.RectangleCombine({生成演示数据代码pt1与pt2详解,Mars3d,vue,app,3d,前端,javascript,vue.js

new mars3d.graphic.RectangleCombine({生成演示数据代码pt1与pt2详解,Mars3d,vue,app,3d,前端,javascript,vue.js

2.相关方法:生成演示数据的时候,可以测试打点查看该数据效果:

pt1与pt2的作用如果不明白一般建议是打点展示。

new mars3d.graphic.RectangleCombine({生成演示数据代码pt1与pt2详解,Mars3d,vue,app,3d,前端,javascript,vue.js

new mars3d.graphic.RectangleCombine({生成演示数据代码pt1与pt2详解,Mars3d,vue,app,3d,前端,javascript,vue.js

new mars3d.graphic.RectangleCombine({生成演示数据代码pt1与pt2详解,Mars3d,vue,app,3d,前端,javascript,vue.js

new mars3d.graphic.RectangleCombine({生成演示数据代码pt1与pt2详解,Mars3d,vue,app,3d,前端,javascript,vue.js

以下是演示打点展示的代码:

// 生成演示数据(测试数据量)

export function addRandomGraphicByCount(count) {

  graphicLayer.clear()

  graphicLayer.enabledEvent = false // 关闭事件,大数据addGraphic时影响加载时间

  const bbox = [116.984788, 31.625909, 117.484068, 32.021504]

  const result = mars3d.PolyUtil.getGridPoints(bbox, count, 30)

  console.log("生成的测试网格坐标", result)

  const arrData = []

  for (let j = 0; j < result.points.length; ++j) {

    const position = result.points[j]

    console.log("result.points",position)

    const index = j + 1

    const pt1 = mars3d.PointUtil.getPositionByDirectionAndLen(position, 45, result.radius)

    const pt2 = mars3d.PointUtil.getPositionByDirectionAndLen(position, 200, result.radius)

    arrData.push({

      positions: [pt1, position, pt2],

      style: {

        color: Cesium.Color.fromRandom({ alpha: 0.6 })

      },

      attr: { index }

    })

    const graphic1 = new mars3d.graphic.PointEntity({

    position: position,

    style: {

      color: "#ff0000",

      pixelSize: 10,

      outlineColor: "#ffffff",

      outlineWidth: 2,

      label: {

        text: "我是{ index }",

        font_size: 18,

        color: "#ffffff",

        pixelOffsetY: -10,

        distanceDisplayCondition: true,

        distanceDisplayCondition_far: 500000,

        distanceDisplayCondition_near: 0

      }

    },

    attr: { index }

  })

  graphicLayer.addGraphic(graphic1)

    const graphicp1 = new mars3d.graphic.BillboardEntity({

    position: pt1,

    style: {

      image: "img/marker/lace-blue.png",

      horizontalOrigin: Cesium.HorizontalOrigin.CENTER,

      verticalOrigin: Cesium.VerticalOrigin.BOTTOM,

        label: {

        text: "我是pt1",

        font_size: 18,

        color: "#ffffff",

        pixelOffsetY: -10,

        distanceDisplayCondition: true,

        distanceDisplayCondition_far: 500000,

        distanceDisplayCondition_near: 0

      }

    },

    attr: { index }

  })

  graphicLayer.addGraphic(graphicp1)

      const graphicp2 = new mars3d.graphic.BillboardEntity({

    position: pt2,

    style: {

      image: "img/marker/lace-blue.png",

      horizontalOrigin: Cesium.HorizontalOrigin.CENTER,

      verticalOrigin: Cesium.VerticalOrigin.BOTTOM,

        label: {

        text: "我是pt2",

        font_size: 18,

        color: "#ffffff",

        pixelOffsetY: -10,

        distanceDisplayCondition: true,

        distanceDisplayCondition_far: 500000,

        distanceDisplayCondition_near: 0

      }

    },

    attr: { index }

  })

  graphicLayer.addGraphic(graphicp2)

  }

  // 多个面对象的合并渲染。

  const graphic = new mars3d.graphic.RectangleCombine({

    instances: arrData,

    // style: {

    //   outline: true,

    //   outlineWidth: 3,

    //   outlineColor: "#ffffff",

    // },

    // 高亮时的样式

    highlight: {

      type: mars3d.EventType.click,

      color: Cesium.Color.YELLOW.withAlpha(0.9)

    }

  })

  graphicLayer.addGraphic(graphic)



 

  // 演示:平滑移动高度

  // let height = 0

  // setInterval(() => {

  //   if (height > 10000 || graphic.isDestroy) {

  //     return

  //   }

  //   height += 1

  //   graphic.offsetHeight = height

  // }, 10)

  graphicLayer.enabledEvent = true // 恢复事件

  return result.points.length

}

new mars3d.graphic.RectangleCombine({生成演示数据代码pt1与pt2详解,Mars3d,vue,app,3d,前端,javascript,vue.js

new mars3d.graphic.RectangleCombine({生成演示数据代码pt1与pt2详解,Mars3d,vue,app,3d,前端,javascript,vue.js

new mars3d.graphic.RectangleCombine({生成演示数据代码pt1与pt2详解,Mars3d,vue,app,3d,前端,javascript,vue.js文章来源地址https://www.toymoban.com/news/detail-818904.html

到了这里,关于new mars3d.graphic.RectangleCombine({生成演示数据代码pt1与pt2详解的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包赞助服务器费用

相关文章

  • new mars3d.layer.XyzLayer({的rectangle瓦片数据的矩形区域范围说明

    new mars3d.layer.XyzLayer({的rectangle瓦片数据的矩形区域范围说明

    new mars3d.layer.XyzLayer({的rectangle瓦片数据的矩形区域范围说明 2.这个xyz图层的矩形区域范围rectangle从图层文件中无法获取,但是看图层文件可以知道这个是12-21级的数据。   3.一般这个图层数据文件服务会有提供相应的rectangle范围,在服务的xml文件内,可以看到这个数据值。如

    2024年04月25日
    浏览(10)
  • Mars3D使用教程

    Mars3D使用教程

    1、使用npm安装依赖库 //安装mars3d主库 ​ //安装mars3d插件(按需安装) ​ //安装copy-webpack-plugin 插件在第3步中使用,根据webpack版本安装,不匹配的版本可能出错,版本需要5.0 “copy-webpack-plugin”: “^5.0.0”, 2.在main.js全局导入 或者 在使用mars3d的文件中导入(这一步可以跳过,

    2024年02月02日
    浏览(11)
  • mars3d绘制区域范围(面+边框)

    mars3d绘制区域范围(面+边框)

    1、图例(绿色面区域+白色边框)  2、代码 1)、绘制区域ts文件 解释: 1、new mars3d.layer.GeoJsonLayer      生成矢量图层 2、styleField       \\\"levels\\\" 是在json文件中区分不同级别景区的标志,值为1、2、3等 3、styleFieldOptions       根据styleField获取到的值进行区分,划分不同颜色的

    2024年02月15日
    浏览(12)
  • Vue2项目使用mars3d

    或参考webpack.config.js写法进行修改

    2024年02月14日
    浏览(28)
  • vue3 mars3d 天地图

                    npm i mars3d                  npm i mars3d-heatmap (热力图,需要的话安装)                 npm i -D copy-webpack-plugin                 增加mars3d目录配置,修改vue.config.js中configureWebpack里的内容如下:  使用: 最后附上天地图mapUrl地址

    2024年02月15日
    浏览(13)
  • Mars3D/Cesium + VUE3

    不定期更新 参考官网: http://mars3d.cn/dev/guide/start/import.html#_3-3-vite-%E6%8A%80%E6%9C%AF%E6%A0%88%E6%97%B6-%E7%9A%84%E9%A1%B9%E7%9B%AE%E9%85%8D%E7%BD%AE%E4%BF%AE%E6%94%B9 :已亲测vite框架,可以运行,具体见下main 1、插件 vite-plugin-mars3d vite中需要

    2024年02月14日
    浏览(13)
  • Mars3D Studio 的使用方法

    Mars3D Studio 的使用方法

    mars3d Studio 是 mars3d 研发团队于近期研发上线的一款 场景可视化编辑平台。拥有资源存档、团队协作、定制材质等丰富的功能。可以实现零代码构建一个可视化三维场景。 (1)数据上传:目前支持 tif 影像上传、 3dtitles 、 gltf 小模型上传以及矢量数据( shp、gesojson、kml ) 下

    2023年04月16日
    浏览(9)
  • [mars3d 学习] 最近升级版本造成的问题

    [mars3d 学习] 最近升级版本造成的问题

    1、mars3d升级3.5以上,使用的时候报错; 需要看下 Mars3D三维可视化平台 | 火星科技 版本更新日志; 使用将Cesium的版本升级到1.103 2、升级Cesium到1.103,之后打包又会报错 - error in ./node_modules/mars3d-Cesium/Build/Cesium/index.js 哦,是因为cesium1.96改变了代码打包方式;在vue2中就会存在

    2024年02月17日
    浏览(38)
  • Mars3d项目启动上的一些坑

    Mars3d项目启动上的一些坑

    最近新入职了一家公司,公司新开了有个未来城市的项目,需要用到3D城市建模,公司老总选了Mars3d作为前端框架,项目分给我了,又是一个全新的领域,开搞吧! 下面是自己遇到的几个小问题,记录一下: 1 npm install copy-webpack-plugin --save -dev 时报错 解决办法:npm install cop

    2024年02月05日
    浏览(13)
  • vue3使用Mars3D写区块地图

    vue3使用Mars3D写区块地图

    因为我也是第一次使用,所以我是把插件和源文件都引入了,能使用启动 源文件 下载地址: http://mars3d.cn/download.html 放入位置 在index.html中引入 引入插件 我是封装的组件,代码的使用和意义 我直接放在备注中 大体布局 父组件 添加地图内部数据和地图外部数据的方法 ,我都

    2024年01月20日
    浏览(32)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包