Coder Social home page Coder Social logo

marsgis / mars3d Goto Github PK

View Code? Open in Web Editor NEW
920.0 45.0 131.0 179.56 MB

【Mars3D平台 】主仓库,包含所有开源仓库清单导航

Home Page: http://mars3d.cn

License: Apache License 2.0

cesium 3dgis webgis mars3d marsgis cesiumjs webgl gis

mars3d's Introduction

🌎 一款基于WebGL技术实现的三维地球客户端开发平台

Npm version Npm downloads GitHub stars star

English |中文

当前仓库包含SDK更新日志、和其他仓库导航。

Github:https://github.com/marsgis/mars3d

国内Gitee:https://gitee.com/marsgis/mars3d

更新日志: CHANGE.md

功能示例

对平台每个功能编写的案例代码,可以阅读每个示例代码来学习各功能,与官网功能示例一致效果。

说明 教程 视频 Github源码 国内Gitee源码
原生JS版 查看 查看 mars3d-es5-example mars3d-es5-example
Vue版 查看 查看 mars3d-vue-example mars3d-vue-example
React版 查看 查看 mars3d-react-example mars3d-react-example

最简项目模板

提供了面向不同技术栈的最简项目模板,您可以直接使用或参考这些项目模板,了解SDK类库在不同技术栈项目中如何引入使用,快速搭建开发自己的项目。

说明 视频 Github源码 国内Gitee源码
原生JS技术栈 查看 mars3d-es5-template mars3d-es5-template
Vue技术栈 查看 mars3d-vue-template mars3d-vue-template
React技术栈 查看 mars3d-react-template mars3d-react-template
Angular技术栈 查看 mars3d-angular-template mars3d-angular-template
CS桌面端程序 查看 mars3d-electron mars3d-electron

基础项目

基础项目是具备一个GIS项目常见功能的项目模板,只用更换数据及叠加业务即可完成项目交付。 如果需要更多功能可以考虑购买付费项目模板

说明 教程 视频 Github源码 国内Gitee源码
基础项目 原生JS版 查看 查看 mars3d-es5-project mars3d-es5-project
基础项目 Vue版 查看 查看 mars3d-vue-project mars3d-vue-project
基础项目 Vue版+admin管理 mars3d-vue-project-admin mars3d-vue-project-admin
三维地球APP项目 查看 查看 mars3d-vue-app mars3d-vue-app
基础项目 React版 查看 查看 mars3d-react-project mars3d-react-project

其他

说明 Github 国内Gitee
部分开源插件 mars3d-plugin mars3d-plugin

平台介绍

Mars3D平台火星科技研发的一款基于 WebGL 技术实现的三维客户端开发平台,基于Cesium优化提升与B/S架构设计,支持多行业扩展的轻量级高效能GIS开发平台,能够免安装、无插件地在浏览器中高效运行,并可快速接入与使用多种GIS数据和三维模型,呈现三维空间的可视化,完成平台在不同行业的灵活应用。

学习资料

反馈问题

为了方便交流及留存,所有bug及建议均统一提交至:github issues国内gitee issues

平台相关效果

功能示例: image

基础项目:在线体验

image

电子沙盘项目:在线体验

image

智慧园区项目:在线体验

image

综合态势项目:在线体验

image

版权说明

  1. Mars3D平台由火星科技自主研发,拥有所有权利。
  2. 任何个人或组织可以在遵守相关要求下可以免费无限制使用。

mars3d's People

Contributors

muyao1987 avatar xiao-jiexi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mars3d's Issues

mars3d.Map

mars3d.Map 能否先实例化,再设置dom

查看例子过程中随机会出现一个渲染错误

image
WebGL发生渲染错误,渲染已经停止,请刷新页面。
TypeError: Failed to execute 'shaderSource' on 'WebGLRenderingContext': parameter 1 is not of type 'WebGLShader'.

TypeError: Failed to execute 'shaderSource' on 'WebGLRenderingContext': parameter 1 is not of type 'WebGLShader'.
at createAndLinkProgram (http://127.0.0.1:8080/lib/Cesium/Cesium.js:1:966425)
at reinitialize (http://127.0.0.1:8080/lib/Cesium/Cesium.js:1:969903)
at initialize$b (http://127.0.0.1:8080/lib/Cesium/Cesium.js:1:969835)
at ShaderProgram._bind (http://127.0.0.1:8080/lib/Cesium/Cesium.js:1:973648)
at beginDraw (http://127.0.0.1:8080/lib/Cesium/Cesium.js:1:2592249)
at Context.draw (http://127.0.0.1:8080/lib/Cesium/Cesium.js:1:2593798)
at DrawCommand.execute (http://127.0.0.1:8080/lib/Cesium/Cesium.js:1:930877)
at ComputeEngine.execute (http://127.0.0.1:8080/lib/Cesium/Cesium.js:1:2560769)
at ComputeCommand.execute (http://127.0.0.1:8080/lib/Cesium/Cesium.js:1:1506762)
at executeComputeCommands (http://127.0.0.1:8080/lib/Cesium/Cesium.js:1:3317680)

Super expression must either be null or a function

react项目webpack配置,运行时包这个错误
Uncaught TypeError: Super expression must either be null or a function
at _0x49bb40. (mars3d.js:25)
at mars3d.js:30
at Module. (mars3d.js:30)
at _0x1a2b01 (mars3d.js:25)

建议控制台不要默认输出

应该提供用户开关的选项或者提供自定义输出信息的能力,使用console.log输出变量不会被GC有可能会导致内存泄漏,3d场景下还是蛮重要的

new mars3d.graphic.Popup(options) 中的 timeRender 设置无效

使用new mars3d.graphic.Popup(options) 创建一个graphic,其中options中的timeRender设置为true,html设置为回调函数,html并不会实时更新(html回调函数只会触发一次) 如下:

...
const showHtml = (event) => {
			console.log('e', event)
			return " 我是layer上绑定的Popup" + new Date().toLocaleTimeString()
}
const graphicPopup = new mars3d.graphic.Popup({
			className: 'mesh_popup',
			id,
			name: EntityType.POPUP,
			position: graphic.center,
			style: {
				html: showHtml,
				closeButton: false,
				horizontalOrigin: mars3d.Cesium.HorizontalOrigin.CENTER,
				verticalOrigin: mars3d.Cesium.VerticalOrigin.BOTTOM,
				offsetY: 4,
				timeRender: true
			} as any
		})
graphicLayer.addGraphic(graphicPopup)
...

但是使用bindPopup功能是没有问题的

向 GraphicLayer 添加 PolygonPrimitive 对象时报错

描述

在向 GraphicLayer 添加 PolygonPrimitive 对象时报错,错误如下图:
image

示例代码:

const positions = [
  new Cartesian3(-2877753.8912436897, 4848831.729657154, 2971314.4878532737),
  new Cartesian3(-2877782.6632767506, 4848822.004413433, 2971302.1542773163),
  new Cartesian3(-2877798.206913736, 4848827.3474626485, 2971278.564903176),
]
const polygonPrimitive = new mars3d.graphic.PolygonPrimitive({
	positions,
	style: {
		color: '#d40000',
		opacity: 0.4,
		outline: true,
		outlineColor: '#d40000',
		outlineOpacity: 1,
		clampToGround: true
	}
})

// graphicLayer 的创建过程省略
graphicLayer.addGraphic(polygonPrimitive)

版本信息

mars3d: v3.1.20
mars3d-cesium: 1.89.0

mars3d3.6.15版本 mars3d-cesium1.112版本开发环境下全局使用Cesium报错

1.问题描述:

// 引入cesium基础库
import "mars3d-cesium/Build/Cesium/Widgets/widgets.css"
import * as Cesium from "mars3d-cesium"
// 导入mars3d主库
import "mars3d/dist/mars3d.css"
import * as mars3d from "mars3d"

在HelloWorld.vue文件中console.log(Cesium)报错:Cesium is not defined.
image

引用 mars3d-cesium 时,提示:找不到类型定义模块

问题

在代码中试图引入 mars3d-cesium 时,ts会报错,找不到类型定义模块
image

原因

node_modules/mars3d-cesium/Build/Cesium/Cesium.d.ts 中定义的模块是

declare module "cesium" {
    ...
}

期望其改为

declare module "mars3d-cesium" {
    ...
}

FixedRoute固定轨迹路线,事件监听异常

参考官方示例

  fixedRoute.on(mars3d.EventType.endItem, (event) => {
    console.log('经过第'+fixedRoute._flyok_index+'个点', fixedRoute)
  })
  fixedRoute.on(mars3d.EventType.stop, (event) => {
    console.log('路线走完了', fixedRoute)
  })
  fixedRoute.on(mars3d.EventType.end, (event) => {
    console.log('路线走完了', fixedRoute)
  })

问题

监听endItem事件 开始 触发了两次

以及 监听 stopend 均在路线结束的时候无法触发、或者是监听错了事件?

期望

监听endItem事件 开始的时候仅触发一次

map.addLayer API 返回的 Promise 不会完成

调用 map.addLayer(layer) API 返回的 Promise 对象永远不会被 resolvereject.

最小复现代码:

<style scoped>
</style>

<template>
    <div>
        <div id="mars3dContainer" class="mars3d-container"></div>
    </div>
</template>

<script setup>
import {markRaw, onMounted, onUnmounted} from 'vue'
// 引入cesium基础库
import 'mars3d-cesium/Build/Cesium/Widgets/widgets.css'
import * as Cesium from 'mars3d-cesium'
// 导入mars3d主库
import 'mars3d/dist/mars3d.css'
import * as mars3d from 'mars3d'

let Map = null
onMounted(async () => {
    let map = new mars3d.Map('mars3dContainer')
    Map = markRaw(map)
    let layer = new mars3d.layer.GraphicLayer()
    console.log('开始添加图层')
    let result = await map.addLayer(layer)
    console.log('完成添加图层')
})
onUnmounted(() =>
{
    Map.destroy()
    Map = null
})
</script>

测试时, 后续的 console.log 调用永远不会执行.

测试环境 --
vue 3.2.47
@vitejs/plugin-vue 4.1.0
mars3d 3.5.0
vite-plugin-mars3d 2.0.3
浏览器 Chrome 111.0.5563.110

遮罩图层仅支持一个吗?

经过测试,遮罩层只能是在数据为单独一个面的情况下使用,如果在数据为多个面的情况(使用场景:某些行政区包括多个面)下,加载遮罩的geojson会导致程序无法正常显示,大佬是否有进一步优化此功能?

config.json导出问题

请问在图层管理中编辑完图层后,全部的config.json数据可以导出来吗

请问能否获取到各类事件实例并调整事件参数或取消事件?

现有需求限制摄像机视角锁定在固定经纬度 / 固定朝向范围 / 固定高度范围.

尝试监听如下方法:

  • map.on(mars3d.EventType.cameraMoveStart, fun, this)
  • map.on(mars3d.EventType.cameraChanged, fun, this)
  • map.on(mars3d.EventType.cameraMoveEnd, fun, this)

发现传入 fun 内的参数不是 undefined 就是一个 number 类型值, 无法直接调整目标相机视角等参数.
另外在这些事件的监听器内尝试调用 map.camera.setView 等 API 均效果不佳, 会产生闪屏 / 视角错位等错误.

请问有无方法可以在监听器方法内获取事件实例?
或有无方法获取到即将提交到事件总线的事件实例?
另外能否修改获取到的事件实例成员参数以调整本次事件过程?

例子g20_3dtiles_edit报错

Cesium.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'newValue')
at HTMLInputElement. (addmodel.html:309)
at HTMLInputElement.dispatch (jquery-2.1.4.min.js:3)
at HTMLInputElement.r.handle (jquery-2.1.4.min.js:3)
at Object.trigger (jquery-2.1.4.min.js:3)
at HTMLInputElement. (jquery-2.1.4.min.js:3)
at Function.each (jquery-2.1.4.min.js:2)
at n.fn.init.each (jquery-2.1.4.min.js:2)
at n.fn.init.trigger (jquery-2.1.4.min.js:3)
at n.fn.init.n.fn. [as change] (jquery-2.1.4.min.js:4)
at _0x1cac4e. (addmodel.html:385)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.