Add per-batch extents
This commit is contained in:
@@ -1,12 +1,11 @@
|
|||||||
// FIXME store coordinates in batchgroup?
|
|
||||||
// FIXME flattened coordinates
|
// FIXME flattened coordinates
|
||||||
// FIXME per-batch extent tests
|
|
||||||
|
|
||||||
goog.provide('ol.replay.canvas.BatchGroup');
|
goog.provide('ol.replay.canvas.BatchGroup');
|
||||||
|
|
||||||
goog.require('goog.array');
|
goog.require('goog.array');
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.object');
|
goog.require('goog.object');
|
||||||
|
goog.require('ol.extent');
|
||||||
goog.require('ol.replay');
|
goog.require('ol.replay');
|
||||||
goog.require('ol.replay.IBatch');
|
goog.require('ol.replay.IBatch');
|
||||||
goog.require('ol.replay.IBatchGroup');
|
goog.require('ol.replay.IBatchGroup');
|
||||||
@@ -54,6 +53,12 @@ ol.replay.canvas.Batch = function() {
|
|||||||
*/
|
*/
|
||||||
this.pixelCoordinates_ = [];
|
this.pixelCoordinates_ = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {ol.Extent}
|
||||||
|
*/
|
||||||
|
this.extent_ = ol.extent.createEmpty();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -66,10 +71,13 @@ ol.replay.canvas.Batch = function() {
|
|||||||
ol.replay.canvas.Batch.prototype.appendCoordinates =
|
ol.replay.canvas.Batch.prototype.appendCoordinates =
|
||||||
function(coordinates, close) {
|
function(coordinates, close) {
|
||||||
var end = this.coordinates.length;
|
var end = this.coordinates.length;
|
||||||
|
var extent = this.extent_;
|
||||||
var i, ii;
|
var i, ii;
|
||||||
for (i = 0, ii = coordinates.length; i < ii; ++i) {
|
for (i = 0, ii = coordinates.length; i < ii; ++i) {
|
||||||
this.coordinates[end++] = coordinates[i][0];
|
var coordinate = coordinates[i];
|
||||||
this.coordinates[end++] = coordinates[i][1];
|
this.coordinates[end++] = coordinate[0];
|
||||||
|
this.coordinates[end++] = coordinate[1];
|
||||||
|
ol.extent.extendCoordinate(extent, coordinate);
|
||||||
}
|
}
|
||||||
if (close) {
|
if (close) {
|
||||||
this.coordinates[end++] = coordinates[0][0];
|
this.coordinates[end++] = coordinates[0][0];
|
||||||
@@ -154,6 +162,14 @@ ol.replay.canvas.Batch.prototype.drawMultiPolygonGeometry = goog.abstractMethod;
|
|||||||
ol.replay.canvas.Batch.prototype.finish = goog.nullFunction;
|
ol.replay.canvas.Batch.prototype.finish = goog.nullFunction;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {ol.Extent} Extent.
|
||||||
|
*/
|
||||||
|
ol.replay.canvas.Batch.prototype.getExtent = function() {
|
||||||
|
return this.extent_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user