Giter VIP home page Giter VIP logo

Comments (11)

linrong avatar linrong commented on May 15, 2024

并且我使用ol5.3.3和"ol5-wind": "^1.0.0-alpha.2"时运行错误:

Uncaught (in promise) TypeError: data.checkFields is not a function
    at OlWind.push../node_modules/ol5-wind/dist/ol-wind.esm.js.OlWind.setData (ol-wind.esm.js:1488)
    at new OlWind (ol-wind.esm.js:1363)
    at index.vue?0f4e:59

from wind-layer.

linrong avatar linrong commented on May 15, 2024

"ol5-wind": "^1.0.0-alpha.2"的问题出现在
ol-wind-esm.js 1488

    /**
     * set layer data
     * @param data
     * @returns {BMapWind}
     */
    OlWind.prototype.setData = function (data) {
        if (data  && data.checkFields()) {
            this.field = data;
        }
        else if (isArray(data)) {
            this.field = formatData(data);
        }
        else {
            console.error('Illegal data');
        }
        var map = this.getMap();
        if (map && this.canvas && this.field) {
            this.render(this.canvas);
        }
        return this;
    };

应该修改为

    /**
     * set layer data
     * @param data
     * @returns {BMapWind}
     */
    OlWind.prototype.setData = function (data) {
        if (data && data.checkFields && data.checkFields()) {
            this.field = data;
        }
        else if (isArray(data)) {
            this.field = formatData(data);
        }
        else {
            console.error('Illegal data');
        }
        var map = this.getMap();
        if (map && this.canvas && this.field) {
            this.render(this.canvas);
        }
        return this;
    };

缺少一个data.checkFields判断

from wind-layer.

linrong avatar linrong commented on May 15, 2024

但还时有问题,ol5-wind只能显示在当前的世界,在经度0为不显示的分隔线

from wind-layer.

sakitam-fdd avatar sakitam-fdd commented on May 15, 2024

@linrong 收到,目前还处于alpha版本,不建议生产环境用,如果自己测试有BUG我先记录下来,最近可能没有时间处理

from wind-layer.

linrong avatar linrong commented on May 15, 2024

0.1.2版本的ol6也会背景变白,覆盖住地图的显示,我觉得应该是renderer.js的问题,但我却不知道怎么修改

from wind-layer.

sakitam-fdd avatar sakitam-fdd commented on May 15, 2024

@linrong 高清屏上没有这个问题,你可以从pixelRadio这块入手

from wind-layer.

linrong avatar linrong commented on May 15, 2024

@sakitam-fdd 基于0.1.2版本的ol6,我目前发现问题如图:
8cQdij.png
风场数据覆盖了地图的显示

目前我是使用的设备为:
win10 1920x1080 谷歌浏览器版本80.0.3987.132 / EDGE 都出现问题
win7 笔记本 1366x768 谷歌浏览器 出现此问题
iphone8 谷歌浏览器 显示正常

在win10调试中我获得的devicePixelRatio 和 frameState.pixelRatio 都为 1

请问上面的信息能够说明是pixelRadio的问题嘛?或者你有其他方面的建议?
谢谢你的回复

from wind-layer.

wwfeng990 avatar wwfeng990 commented on May 15, 2024

@sakitam-fdd 基于0.1.2版本的ol6,我目前发现问题如图:

风场数据覆盖了地图的显示
目前我是使用的设备为:
win10 1920x1080 谷歌浏览器版本80.0.3987.132 / EDGE 都出现问题
win7 笔记本 1366x768 谷歌浏览器 出现此问题
iphone8 谷歌浏览器 显示正常
在win10调试中我获得的devicePixelRatio 和 frameState.pixelRatio 都为 1
请问上面的信息能够说明是pixelRadio的问题嘛?或者你有其他方面的建议?
谢谢你的回复

这个问题的关键是地图(layer)和风场(layer)共用同一个convas。所以在创建风场(layer)要新生成一个convas。
解决方法:renderer.js中,重新定义成员函数:
useContainer (target, transform, opacity) {
target = null;
super.useContainer(target, transform, opacity);
}
强制在新的convas作图。

from wind-layer.

sakitam-fdd avatar sakitam-fdd commented on May 15, 2024

@wwfeng990 强制使用新的canvas图层时可行的,但是这块也不完全是由于这个问题;ol其实本身没有 animate layer这个概念,如果做动态图层官方推荐的是使用 map.render() 来实时重绘所有图层,但是这样显然性能不好;另外就是由于在有些情况下会进行图层复用,现在是由于图层复用但是context没做隔离,其实还可以wind-core单独使用一个离屏画布进行粒子绘制,在postrender回调中将粒子画布同步到ol图层上,但是这样相对来说要麻烦一些。如果有兴趣可以发个pr,感谢

from wind-layer.

linrong avatar linrong commented on May 15, 2024

@wwfeng990 感谢你提供的方法,目前测试修改可以使用,但还是会有一些问题,当我设置风场和晨昏线同时显示时,风场的动画会被阻止,风场使用GeoJSON.Terminator/仿照leaflet的插件的。不过目前我还是使用ol5进行开发,所以暂时这个问题对我影响不是很大
@sakitam-fdd 对于白屏的问题我提供一些别的信息

  • 浏览器出现地图覆盖白底,设置电脑显示设置的缩放比例>100%可以正常,目前在多台电脑验证
  • 谷歌浏览器的移动端调试中无论如何设置比例都是正常的

from wind-layer.

sakitam-fdd avatar sakitam-fdd commented on May 15, 2024

@linrong 收到

from wind-layer.

Related Issues (20)

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.