Add ol.geom.SimpleGeometry#getLastCoordinate
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
@exportSymbol ol.geom.SimpleGeometry
|
||||
@exportProperty ol.geom.SimpleGeometry.prototype.getExtent
|
||||
@exportProperty ol.geom.SimpleGeometry.prototype.getFirstCoordinate
|
||||
@exportProperty ol.geom.SimpleGeometry.prototype.getLastCoordinate
|
||||
@exportProperty ol.geom.SimpleGeometry.prototype.getLayout
|
||||
@exportProperty ol.geom.SimpleGeometry.prototype.getSimplifiedGeometry
|
||||
@exportProperty ol.geom.SimpleGeometry.prototype.transform
|
||||
|
||||
@@ -115,6 +115,14 @@ ol.geom.SimpleGeometry.prototype.getFlatCoordinates = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.Coordinate} Last point.
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.getLastCoordinate = function() {
|
||||
return this.flatCoordinates.slice(this.flatCoordinates.length - this.stride);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.geom.GeometryLayout} Layout.
|
||||
* @todo stability experimental
|
||||
|
||||
@@ -184,6 +184,14 @@ describe('ol.geom.LineString', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('#getLastCoordinate', function() {
|
||||
|
||||
it('returns the expected result', function() {
|
||||
expect(lineString.getLastCoordinate()).to.eql([7, 5]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('#getSimplifiedGeometry', function() {
|
||||
|
||||
it('returns the expectedResult', function() {
|
||||
|
||||
Reference in New Issue
Block a user