Giter Site home page Giter Site logo

pasu / examplesforcesium Goto Github PK

View Code? Open in Web Editor NEW
9.0 6.0 4.0 63.77 MB

My personal examples for Cesium, hopefully may it help you to build this beautiful world~

Home Page: https://pasu.github.io/ExamplesforCesium/examples/examples.html

License: Apache License 2.0

CSS 1.51% JavaScript 7.89% HTML 21.75% Python 68.85%
cesiumjs demo cookbook cesium

examplesforcesium's People

Contributors

pasu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

examplesforcesium's Issues

关于googlemap.js的改进

大佬,我昨天研究了一下openstreetmap的调用js,也看了您写的googlemap.js的插件。
有以下想法:
0.首先我拿到的google无偏影像图源是这样的,
<url><![CDATA[http://mt{$serverpart}.google.cn/vt/lyrs=s&hl=zh-CN&x={$x}&y={$y}&z={$z}]]></url>
<serverParts>0 1 2 3</serverParts>

1.osm和googlemap的切片方式都是相同的,都是直接加载的xyz形式图源。有没有什么办法能通过修改creatosm这个官方库达到加载google无偏影像的做法呢,然而这样做是不是涉及修改源代码,还要再进行编译呢。
2.关于googlemap.js,我看到您调用的地址也是xyz格式,带了一个key,恕我太渣,并没有看懂是个怎么调用的,昨晚试图修改成我自己的xyz图源,也没有成功...您看我上面提供的这个图源地址能否直接带入您修改的插件呢。

比较疑惑的是leaflet这样轻量级的库都可以原生支持xyz图源,而大哥cesium确没有这个玩意儿,有点儿蛋疼。
还请您不吝赐教~

改进加载google影像及其他在线图源的方法

研究了下几个api,发现不用自己写方法。
主要是这个api,new Cesium.UrlTemplateImageryProvider(options)

这个用法很万金油,适合大多数在线图源,以及自己本地部署的瓦片(需要gdal或gdal标准的软件比如maptiler,切出来的瓦片)
1.加载google在线影像

const googledom = new Cesium.UrlTemplateImageryProvider({
        url : 'http://mt1.google.cn/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}'
      });
   const imageprovider2 = new Cesium.ProviderViewModel({
         name: "google",
         iconUrl: 'Images/logo.png',
         creationFunction: function(){ return googledom;}       
       });

2.加载本地瓦片

const ljdom = new Cesium.UrlTemplateImageryProvider({
        url : '/ljdom/{z}/{x}/{y}.png',
      });
const imageprovider = new Cesium.ProviderViewModel({
         name: "lj",
         iconUrl: 'Images/logo.png',
         creationFunction: function(){ return ljdom;}       
       });

期待您的更新

您好 我看您这里已经好久没更新了 是不是太忙 期待您的书

大佬,请问下动态画线的问题

我想实现动态画线的功能,即线随着鼠标移动来画,在3D tiles模型上点击量取距离,并成功实现了,以下是我的代码。
我的问题是,这样实现的动态画线功能会非常卡。请问是代码写得不对还是有什么可以优化的方法吗。

//移动事件,即时画直线
    var linePrimitive;
    handler.setInputAction(movement=>{
      if(isclick==false){
        return;
      }
      var feature = viewer.scene.pick(movement.endPosition);
      if (!Cesium.defined(feature)) {
        console.log("未选中3dtiles");
        return;
      }
      var cartesian;
      var height;
      if (scene.pickPositionSupported) {
        cartesian = scene.pickPosition(movement.endPosition);
        if (Cesium.defined(cartesian)) {
          var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
          height = cartographic.height;
          console.log(height);
        }
      }

      var tempLength=Cesium.Cartesian3.distance(pointArr[pointIndex-1],cartesian);
      this.length=tempLength.toFixed(2);
      //this.height=cartesian-heightArr[pointIndex-1];
      var temp=heightArr[pointIndex-1];
      var tempHeight=height.toFixed(2)-temp.toFixed(2);
      this.height=Number(tempHeight.toFixed(2));
      //var moveCartesian=viewer.scene.globe.pick(viewer.camera.getPickRay(movement.endPosition),viewer.scene);//移动时的坐标转换成世界坐标;
        //不能removeAll,方法会删除模型
        scene.primitives.remove(linePrimitive);//清除上一次画的图形
        linePrimitive = new Cesium.Primitive({
          geometryInstances : new Cesium.GeometryInstance({
            geometry : new Cesium.PolylineGeometry({
              //positions : Cesium.Cartesian3.fromArray(pointArr[0],moveCartesian),
              positions : [pointArr[pointIndex-1],cartesian],
              width : 5,//线宽
              vertexFormat : Cesium.PolylineColorAppearance.VERTEX_FORMAT
            }),
            attributes : {
              color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.CORNFLOWERBLUE),//color  必须设置 不然没有效果
            }
          }),
          appearance : new Cesium.PolylineColorAppearance({
            translucent : false
          })
        });
        scene.primitives.add(linePrimitive);

    },Cesium.ScreenSpaceEventType.MOUSE_MOVE);

大神,能帮忙看看如何解码rest接口获取的地理元素吗/need help on encoding geometry

您好,我阅读了您在i3sdownloader.py 中的代码, 但是没有找到在rest接口中通过 ./nodes/0/geometries/0 获取二进制的地理元素, 然后解码的相关代码, 似乎是二进制的geometry 可以直接用于 scenelayer 渲染? 如果我想还原这部分3d数据,应该如何操作呢?
我在i3s的 specification 中找到了 关于geometry 部分的描述, 不过仍然不清楚应该如何操作才能获得我们通用的 三维 obj 或者是 ewkt 之类的数据。
https://github.com/Esri/i3s-spec/blob/master/docs/1.7/IntegratedMesh_ReadMe.md
不知道您是否能提供一些建议?

hi, I just read your code in i3sdownloader.py, but not lucky, I didn't find code on decoding binary data of geometries from restapi. Could you have a look?

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.