Giter VIP home page Giter VIP logo

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  avatar

mars3d's Issues

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

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

尝试监听如下方法:

  • 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 均效果不佳, 会产生闪屏 / 视角错位等错误.

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

mars3d.Map

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

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)

例子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)

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事件 开始的时候仅触发一次

GeoJsonLayer图层透明度设置问题

当在geojsonlayer构造参数symbol设置透明度后,重新设置图层透明度好像有透明度叠加效果

graphicLayer = new mars3d.layer.GeoJsonLayer({ name: "全国省界", url: "//data.mars3d.cn/file/geojson/areas/100000_full.json", format: simplifyGeoJSON, // 用于自定义处理geojson symbol: { type: "polyline", styleOptions: { opacity:0.3, width: 2, color:"#f00" } }, flyTo: true })
graphicLayer.opacity = 1

1

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功能是没有问题的

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

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)

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

config.json导出问题

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

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

向 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

遮罩图层仅支持一个吗?

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

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

问题

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

原因

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

declare module "cesium" {
    ...
}

期望其改为

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

建议控制台不要默认输出

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

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.