How to use the @supermap/iclient-common.LonLat function in @supermap/iclient-common

To help you get started, we’ve selected a few @supermap/iclient-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SuperMap / iClient-JavaScript / src / openlayers / overlay / Graph.js View on Github external
// 图形参考位置  (reSetLocation 会更新 chartBounds)
                var shapeROP_m = chart_m.resetLocation();
                // 添加图形
                var shapes_m = chart_m.shapes;
                for (var n = 0, slen_n = shapes_m.length; n < slen_n; n++) {
                    shapes_m[n].refOriginalPosition = shapeROP_m;
                    this.renderer.addShape(shapes_m[n]);
                }
            }
        } else {
            // 压盖判断所需 chartsBounds 集合
            var chartsBounds = [];
            var extent = this.map.getView().calculateExtent();
            var mapBounds = new Bounds(extent[0], extent[1], extent[2], extent[3]);
            // 获取地图像素 bounds
            var mapPxLT = this.getLocalXY(new LonLat(mapBounds.left, mapBounds.top));
            var mapPxRB = this.getLocalXY(new LonLat(mapBounds.right, mapBounds.bottom));
            var mBounds = new Bounds(mapPxLT[0], mapPxRB[1], mapPxRB[0], mapPxLT[1]);
            // 压盖处理 & 添加图形
            for (var i = 0, len = charts.length; i < len; i++) {
                var chart = charts[i];
                // 图形参考位置  (reSetLocation 会更新 chartBounds)
                var shapeROP = chart.resetLocation();
                // 图表框
                var cbs = chart.chartBounds;
                var cBounds = [{
                    "x": cbs.left,
                    "y": cbs.top
                }, {
                    "x": cbs.left,
                    "y": cbs.bottom
                }, {
github SuperMap / iClient-JavaScript / src / leaflet / overlay / GraphThemeLayer.js View on Github external
_addNoOverlayShape: function () {
        var me = this;
        // 压盖判断所需 chartsBounds 集合
        var mapBounds = me._map.getBounds();
        var crs = this._map.options.crs;
        if (this.options.alwaysMapCRS) {
            mapBounds = L.bounds(crs.project(mapBounds.getSouthWest()), crs.project(mapBounds.getNorthEast()));
        }
        mapBounds = CommontypesConversion.toSuperMapBounds(mapBounds);
        var charts = me.charts;
        var chartsBounds = [];
        // 获取地图像素 bounds
        var mapPxLT = me.getLocalXY(new LonLat(mapBounds.left, mapBounds.top));
        var mapPxRB = me.getLocalXY(new LonLat(mapBounds.right, mapBounds.bottom));
        var mBounds = new Bounds(mapPxLT[0], mapPxRB[1], mapPxRB[0], mapPxLT[1]);

        // 压盖处理 & 添加图形
        for (var i = 0, len = charts.length; i < len; i++) {
            var chart = charts[i];
            // 图形参考位置  (reSetLocation 会更新 chartBounds)
            var shapeROP = chart.resetLocation();
            // 图表框
            var cbs = chart.chartBounds;
            var cBounds = [
                {"x": cbs.left, "y": cbs.top},
                {"x": cbs.left, "y": cbs.bottom},
                {"x": cbs.right, "y": cbs.bottom},
                {"x": cbs.right, "y": cbs.top},
                {"x": cbs.left, "y": cbs.top}
github SuperMap / iClient-JavaScript / src / openlayers / overlay / Graph.js View on Github external
var shapeROP_m = chart_m.resetLocation();
                // 添加图形
                var shapes_m = chart_m.shapes;
                for (var n = 0, slen_n = shapes_m.length; n < slen_n; n++) {
                    shapes_m[n].refOriginalPosition = shapeROP_m;
                    this.renderer.addShape(shapes_m[n]);
                }
            }
        } else {
            // 压盖判断所需 chartsBounds 集合
            var chartsBounds = [];
            var extent = this.map.getView().calculateExtent();
            var mapBounds = new Bounds(extent[0], extent[1], extent[2], extent[3]);
            // 获取地图像素 bounds
            var mapPxLT = this.getLocalXY(new LonLat(mapBounds.left, mapBounds.top));
            var mapPxRB = this.getLocalXY(new LonLat(mapBounds.right, mapBounds.bottom));
            var mBounds = new Bounds(mapPxLT[0], mapPxRB[1], mapPxRB[0], mapPxLT[1]);
            // 压盖处理 & 添加图形
            for (var i = 0, len = charts.length; i < len; i++) {
                var chart = charts[i];
                // 图形参考位置  (reSetLocation 会更新 chartBounds)
                var shapeROP = chart.resetLocation();
                // 图表框
                var cbs = chart.chartBounds;
                var cBounds = [{
                    "x": cbs.left,
                    "y": cbs.top
                }, {
                    "x": cbs.left,
                    "y": cbs.bottom
                }, {
                    "x": cbs.right,
github SuperMap / iClient-JavaScript / src / openlayers / overlay / HeatMap.js View on Github external
convertFastToPixelPoints(resolution) {
        var data = [], x, y, k, maxTemp, minTemp, maxWeightTemp;

        //热点半径
        this.useRadius = this.useGeoUnit ? parseInt(this.radius / resolution) : this.radius;

        for (var i = 0; i < this.features.length; i++) {
            var feature = this.features[i];
            var point = feature.geometry;
            //过滤,只显示当前范围
            // if (mapBounds.contains(point.x, point.y)) {
            var pixelPoint = this.getLocalXY(new LonLat(point.x, point.y));
            if (this.featureWeight) {
                pixelPoint.weight = feature.attributes[this.featureWeight];//point.value;
                if (!this.maxWeight) {
                    //找出最大最小权重值
                    maxTemp = maxTemp ? maxTemp : pixelPoint.weight;
                    minTemp = minTemp ? minTemp : pixelPoint.weight;
                    maxTemp = Math.max(maxTemp, pixelPoint.weight);
                    minTemp = Math.min(minTemp, pixelPoint.weight);
                }
            } else {
                pixelPoint.weight = 1;
            }

            x = Math.floor(pixelPoint[0]);
            y = Math.floor(pixelPoint[1]);
            k = pixelPoint.weight;
github SuperMap / iClient-JavaScript / src / leaflet / overlay / GraphThemeLayer.js View on Github external
_addNoOverlayShape: function () {
        var me = this;
        // 压盖判断所需 chartsBounds 集合
        var mapBounds = me._map.getBounds();
        var crs = this._map.options.crs;
        if (this.options.alwaysMapCRS) {
            mapBounds = L.bounds(crs.project(mapBounds.getSouthWest()), crs.project(mapBounds.getNorthEast()));
        }
        mapBounds = CommontypesConversion.toSuperMapBounds(mapBounds);
        var charts = me.charts;
        var chartsBounds = [];
        // 获取地图像素 bounds
        var mapPxLT = me.getLocalXY(new LonLat(mapBounds.left, mapBounds.top));
        var mapPxRB = me.getLocalXY(new LonLat(mapBounds.right, mapBounds.bottom));
        var mBounds = new Bounds(mapPxLT[0], mapPxRB[1], mapPxRB[0], mapPxLT[1]);

        // 压盖处理 & 添加图形
        for (var i = 0, len = charts.length; i < len; i++) {
            var chart = charts[i];
            // 图形参考位置  (reSetLocation 会更新 chartBounds)
            var shapeROP = chart.resetLocation();
            // 图表框
            var cbs = chart.chartBounds;
            var cBounds = [
                {"x": cbs.left, "y": cbs.top},
                {"x": cbs.left, "y": cbs.bottom},
                {"x": cbs.right, "y": cbs.bottom},
                {"x": cbs.right, "y": cbs.top},
                {"x": cbs.left, "y": cbs.top}
            ];
github SuperMap / iClient-JavaScript / src / mapboxgl / overlay / HeatMapLayer.js View on Github external
if (dw / mapCanvas.width > dh / mapCanvas.height) {
            resolution = dw / mapCanvas.width;
        } else {
            resolution = dh / mapCanvas.height;
        }

        //热点半径
        this.useRadius = this.useGeoUnit ? parseInt(this.radius / resolution) : this.radius;

        for (var i = 0; i < this.features.length; i++) {
            var feature = this.features[i];
            var point = feature.geometry;

            //可通过bounds过滤需绘制的features以优化性能,但mapboxgl旋转获取得bounds不适

            var pixelPoint = this.getPixelXY(new LonLat(point.x, point.y));
            if (this.featureWeight) {
                pixelPoint.weight = feature.attributes[this.featureWeight];//point.value;
                if (!this.maxWeight) {
                    //找出最大最小权重值
                    maxTemp = maxTemp ? maxTemp : pixelPoint.weight;
                    minTemp = minTemp ? minTemp : pixelPoint.weight;
                    maxTemp = Math.max(maxTemp, pixelPoint.weight);
                    minTemp = Math.min(minTemp, pixelPoint.weight);
                }
            } else {
                pixelPoint.weight = 1;
            }

            x = Math.floor(pixelPoint.x);
            y = Math.floor(pixelPoint.y);
            k = pixelPoint.weight;