How to use the @supermap/iclient-common.GeometryPoint 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 / mapboxgl / core / Util.js View on Github external
static toSuperMapPolygon(lnglatBounds) {
        const west = lnglatBounds.getWest();
        const east = lnglatBounds.getEast();
        const sourth = lnglatBounds.getSouth();
        const north = lnglatBounds.getNorth();
        return new Polygon([
            new LinearRing([
                new GeometryPoint(west, sourth),
                new GeometryPoint(east, sourth),
                new GeometryPoint(east, north),
                new GeometryPoint(west, north)
            ])
        ]);
    }
github SuperMap / iClient-JavaScript / src / openlayers / overlay / HeatMap.js View on Github external
toiClientFeature(features) {
        if (!Util.isArray(features)) {
            features = [features];
        }
        let featuresTemp = [], geometry, attributes;
        for (let i = 0, len = features.length; i < len; i++) {
            if (features[i] instanceof ol.Feature) {
                //热点图支支持传入点对象要素
                if (features[i].getGeometry() instanceof ol.geom.Point) {
                    geometry = new GeometryPoint(features[i].getGeometry().getCoordinates()[0], features[i].getGeometry().getCoordinates()[1]);
                    //固定属性字段为 "Properties"
                    attributes = features[i].getProperties()["Properties"] ? features[i].getProperties()["Properties"] : {};
                    featuresTemp.push(new GeometryVector(geometry, attributes));
                }
            } else if (["FeatureCollection", "Feature", "Geometry"].indexOf(features[i].type) != -1) {
                let format = new GeoJSONFormat();
                featuresTemp = featuresTemp.concat(format.read(features[i]));
            } else if (features[i].geometry && features[i].geometry.parts) {
                //iServer服务器返回数据格式
                featuresTemp.push(ServerFeature.fromJson(features[i]).toFeature());
            } else {
                throw new Error(`Features[${i}]'s type does not match, please check.`);
            }
        }
        return featuresTemp;
    }
github SuperMap / iClient-JavaScript / src / openlayers / overlay / VectorTileSuperMapRest.js View on Github external
recordset.features.map(function(feature) {
                                    var points = [];
                                    var startIndex = 0;
                                    for (var i = 0; i < feature.geometry.parts.length; i++) {
                                        var partPointsLength = feature.geometry.parts[i] * 2;
                                        for (var j = 0, index = startIndex; j < partPointsLength; j += 2, index += 2) {
                                            points.push(new GeometryPoint(feature.geometry.points[index], feature.geometry.points[index + 1]));
                                        }
                                        startIndex += partPointsLength;
                                    }
                                    feature.geometry.points = points;
                                    return feature;
                                });
                                return recordset;
github SuperMap / iClient-JavaScript / src / leaflet / overlay / HeatMapLayer.js View on Github external
toFeature: function () {
        var geometry = this.geometry;
        var points = [];
        if (geometry instanceof L.LatLng) {
            points = [geometry.lng, geometry.lat];
        } else if (geometry instanceof L.Point) {
            points = [geometry.x, geometry.y];
        } else if (geometry instanceof L.CircleMarker) {
            var latLng = geometry.getLatLng();
            points = [latLng.lng, latLng.lat];
        } else {
            points = geometry;
        }
        if (points.length === 2) {
            geometry = new GeometryPoint(points[0], points[1]);
        }

        return new Vector(geometry, this.attributes);
    }
github SuperMap / iClient-JavaScript / src / mapboxgl / services / QueryService.js View on Github external
if (params.bounds instanceof Array) {
                params.bounds = new Bounds(params.bounds[0], params.bounds[1], params.bounds[2], params.bounds[3]);
            }
            if (params.bounds instanceof mapboxgl.LngLatBounds) {
                params.bounds = new Bounds(
                    params.bounds.getSouthWest().lng,
                    params.bounds.getSouthWest().lat,
                    params.bounds.getNorthEast().lng,
                    params.bounds.getNorthEast().lat
                );
            }
        }

        if (params.geometry) {
            if (params.geometry instanceof mapboxgl.LngLat) {
                params.geometry = new GeometryPoint(params.geometry.lng, params.geometry.lat);
            }

            if (params.geometry instanceof mapboxgl.Point) {
                params.geometry = new GeometryPoint(params.geometry.x, params.geometry.y);
            }

            if (params.geometry instanceof mapboxgl.LngLatBounds) {
                params.geometry = Util.toSuperMapPolygon(params.geometry);
            }

            if (!(params.geometry instanceof Geometry)) {
                params.geometry = Util.toSuperMapGeometry(params.geometry);
            }
        }
        return params;
    }
github SuperMap / iClient-JavaScript / src / leaflet / overlay / theme / ThemeFeature.js View on Github external
let geometry = this.geometry;
        const points = [];
        let geojsonObject
        if (geometry.toGeoJSON) {
            geojsonObject = geometry.toGeoJSON();
            geojsonObject.properties = this.attributes;
            return new GeoJSON().read(geojsonObject)[0];
        }
        if (geometry.length === 3) {
            geometry = new GeoText(geometry[1], geometry[0], geometry[2]);
        } else if (geometry.length === 2) {
            geometry = new GeometryPoint(points[0], points[1]);
        } else if (geometry instanceof L.LatLng) {
            geometry = new GeometryPoint(geometry.lng, geometry.lat);
        } else if (geometry instanceof L.Point) {
            geometry = new GeometryPoint(geometry.x, geometry.y);
        } else if (geometry instanceof L.CircleMarker) {
            var latLng = geometry.getLatLng();
            geometry = new GeometryPoint(latLng.lng, latLng.lat);
        }
        return new Vector(geometry, this.attributes);
    },
github SuperMap / iClient-JavaScript / src / mapboxgl / overlay / theme / ThemeFeature.js View on Github external
toFeature() {
        var geometry = Util.toSuperMapGeometry(this.geometry);
        var points = [];
        if (this.geometry instanceof mapboxgl.LngLat) {
            points = [this.geometry.lng, this.geometry.lat];
        } else if (this.geometry instanceof mapboxgl.Point) {
            points = [this.geometry.x, this.geometry.y];
        } else if (this.geometry.length === 3) {
            geometry = new GeoText(this.geometry[0], this.geometry[1], this.geometry[2]);
        }
        if (points.length > 1) {
            geometry = new Point(points[0], points[1]);
        }
        return new Vector(geometry, this.attributes);
    }
}
github SuperMap / iClient-JavaScript / src / leaflet / mapping / WebMap.js View on Github external
} else {
                        addFeatures(sFeaturesArr);
                    }
                }, function () {});
            } else {
                var newFeautures = [],
                    features = layerInfo.features;
                for (var i = 0, len = features.length; i < len; i++) {
                    var feature = features[i];
                    var sqlResult = jsonsql({
                        attr: feature.attributes
                    }, sql);
                    if (sqlResult.length > 0) {
                        var lon = feature.geometry.points[0].x,
                            lat = feature.geometry.points[0].y;
                        var point = new Point(lon, lat);
                        var vector = new Vector(point, feature.attributes, feature.style);
                        newFeautures.push(vector);
                    }
                }
                addFeatures(newFeautures);
            }
        } else if (isRestData) {
            var dataSourceName = layerInfo.datasourceName;
            subLayers = layerInfo.subLayers && JSON.parse(layerInfo.subLayers);
            if (subLayers.length && subLayers.length > 0) {
                subLayer = subLayers[0];
            } else {
                subLayer = subLayers;
            }
            layerName = subLayer && subLayer.name;
            this.getFeaturesBySQL(layerInfo.url, dataSourceName, layerName, themeSettings.filter, DataFormat.ISERVER, (getFeaturesEventArgs) => {
github SuperMap / iClient-JavaScript / src / mapboxgl / core / Util.js View on Github external
static toSuperMapPolygon(lnglatBounds) {
        const west = lnglatBounds.getWest();
        const east = lnglatBounds.getEast();
        const sourth = lnglatBounds.getSouth();
        const north = lnglatBounds.getNorth();
        return new Polygon([
            new LinearRing([
                new GeometryPoint(west, sourth),
                new GeometryPoint(east, sourth),
                new GeometryPoint(east, north),
                new GeometryPoint(west, north)
            ])
        ]);
    }