When I use ol.Feature.getGeometry().j to retrieve an array of all coordinates [x, y, x, y, x, y...], it works well for points and polygons. This method allows me to move features quickly and smoothly. However, using .j is not the recommended way to access this array. What is the best alternative method?
I prefer not to use getCoordinates() as it returns a different instance of arrays for points and polygons. Additionally, I am wary of using .j because it may change in later versions, requiring me to make adjustments.
To achieve this functionality, I am using ol.js 3.5.0 and jQuery in the example code below:
var x = 5, y = -10;
var l = feature.getGeometry().j, n = [], b = true;
$.each(l, function(i, v) {
if (b) {
n.push(v + x);
b = false;
} else {
n.push(v + y);
b = true;
}
});
feature.getGeometry().j = n;