Geometry 有没有一种方法可以让我保持正方形,但在openlayers中调整它的大小?

Geometry 有没有一种方法可以让我保持正方形,但在openlayers中调整它的大小?,geometry,openlayers,gwt-openlayers,Geometry,Openlayers,Gwt Openlayers,我得到了四个不同的坐标,在openlayers地图上形成了一个正方形。但是我想知道,是否有可能不打破正方形的形状,而是抓住其中一个角并调整正方形的大小(使其变大/变小) 我的座标如下: var x_1 = 28.0244307; var y_1 = -25.8635238; var x_2 = 28.0244307; var y_2 = -25.8835238; var x_3 = 28.0444307; var y_3 = -25.8835238; var x_4 = 28.044430

我得到了四个不同的坐标,在openlayers地图上形成了一个正方形。但是我想知道,是否有可能不打破正方形的形状,而是抓住其中一个角并调整正方形的大小(使其变大/变小)

我的座标如下:

var x_1 = 28.0244307;
var y_1 = -25.8635238;

var x_2 = 28.0244307;
var y_2 = -25.8835238;

var x_3 = 28.0444307;
var y_3 = -25.8835238;

var x_4 = 28.0444307;
var y_4 = -25.8635238;
然后代码将调整其大小,但它正在破坏方形:

var coords = [
                [x_1, y_1],
                [x_2, y_2],
                [x_3, y_3],
                [x_4, y_4],
                [x_1, y_1]
            ];

            var polygon = new ol.geom.Polygon([coords]);

            var feature = new ol.Feature(polygon);

            polygon.transform('EPSG:4326', 'EPSG:3857');

            var vectorSource = this.vectorSource;
            vectorSource.addFeature(feature);

            var select = new ol.interaction.Select();

            var modify = new ol.interaction.Modify({
                    features: select.getFeatures(),
                });

            var snap = new ol.interaction.Snap({
                source: vectorSource,
            });

            this.map.addInteraction(select);
            this.map.addInteraction(modify);
            this.map.addInteraction(snap);

只需使用4个点创建一个多边形,即可在样式中使用a仅显示这些点。
然后使用ol ext修改形状