【问题标题】:OpenLayers 4 - Local Names incorrect in Visual StudioOpenLayers 4 - Visual Studio 中的本地名称不正确
【发布时间】:2018-04-30 17:08:36
【问题描述】:

我正在 Visual Studio 2017 中创建一个简单的地图应用程序。我正在使用 Openlayers v4.6.4 来显示地图数据并将叠加多边形添加到地图上。

由于 OpenLayers 4 是一个 JS 库,我主要使用 Internet Explorer,因为它允许我在 Visual Studio 2017 上的 javascript 文件中添加断点。

然而,我注意到与 OpenLayers 相关的任何类的本地名称(例如要素或几何图形)都不正确,并且似乎只是随机字符。

例如,我有一个在地图上放置多边形时调用的以下代码:

   //  Event called when the user has finished drawing a polygon/point
    draw.on('drawend', function (e) {

        map.removeInteraction(draw); // Exits drawing mode and enters scroll mode

        var geom = e.feature.getGeometry();
        var format = ol.format.WKT;

        var geomWKT2 = format.writeGeometry(geom);

        // Declare a proxy to reference the hub. 
        var chat = $.connection.chatHub;

        // Update all client windows with the feature just drawn
        $.connection.hub.start().done(function () { // Start the connection.
            // Call the Send method on the hub. 
            chat.server.send(geomWKT, 'Luke');
        });
   })

但是,当我在 Visual Studio 调试器中查看此代码时,本地名称仅在 e.feature 之前是正确的,之后名称变得不可读:

e.Feature

geometry

图片中的地名肯定应该有更准确的描述吧?

任何帮助将不胜感激。

【问题讨论】:

    标签: javascript visual-studio openlayers local javascript-debugger


    【解决方案1】:

    您正在使用ol.js,这是缩小版。为了减小文件大小,变量已减少到 1 或 2 个字母。

    要进行调试,您应该改用ol-debug.js,它更大但更易于阅读。

    【讨论】:

    • 感谢您的回答,这就是问题所在!
    猜你喜欢
    • 1970-01-01
    • 2019-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-15
    • 1970-01-01
    • 2014-02-24
    • 1970-01-01
    相关资源
    最近更新 更多