Remove right-handed polygon handling in renderer
Since ol.render.Feature assumes right-handed polygons anyway, this extra optimization is not needed.
This commit is contained in:
@@ -25,11 +25,6 @@ ol.format.Feature = function() {
|
|||||||
*/
|
*/
|
||||||
this.defaultDataProjection = null;
|
this.defaultDataProjection = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* @protected
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
this.rightHandedPolygons = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -59,14 +54,6 @@ ol.format.Feature.prototype.getReadOptions = function(source, opt_options) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {boolean}
|
|
||||||
*/
|
|
||||||
ol.format.Feature.prototype.getRightHandedPolygons = function() {
|
|
||||||
return this.rightHandedPolygons;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the `defaultDataProjection` on the options, if no `dataProjection`
|
* Sets the `defaultDataProjection` on the options, if no `dataProjection`
|
||||||
* is set.
|
* is set.
|
||||||
|
|||||||
@@ -74,8 +74,6 @@ ol.format.MVT = function(opt_options) {
|
|||||||
*/
|
*/
|
||||||
this.layers_ = options.layers ? options.layers : null;
|
this.layers_ = options.layers ? options.layers : null;
|
||||||
|
|
||||||
this.rightHandedPolygons = true;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.format.MVT, ol.format.Feature);
|
goog.inherits(ol.format.MVT, ol.format.Feature);
|
||||||
|
|
||||||
|
|||||||
@@ -1180,12 +1180,6 @@ ol.render.canvas.PolygonReplay = function(tolerance, maxExtent, resolution) {
|
|||||||
miterLimit: undefined
|
miterLimit: undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
this.rightHanded_ = false;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.render.canvas.PolygonReplay, ol.render.canvas.Replay);
|
goog.inherits(ol.render.canvas.PolygonReplay, ol.render.canvas.Replay);
|
||||||
|
|
||||||
@@ -1318,9 +1312,7 @@ ol.render.canvas.PolygonReplay.prototype.drawPolygonGeometry =
|
|||||||
state.miterLimit, state.lineDash]);
|
state.miterLimit, state.lineDash]);
|
||||||
}
|
}
|
||||||
var ends = polygonGeometry.getEnds();
|
var ends = polygonGeometry.getEnds();
|
||||||
var flatCoordinates = this.rightHanded_ ?
|
var flatCoordinates = polygonGeometry.getOrientedFlatCoordinates();
|
||||||
polygonGeometry.getFlatCoordinates() :
|
|
||||||
polygonGeometry.getOrientedFlatCoordinates();
|
|
||||||
var stride = polygonGeometry.getStride();
|
var stride = polygonGeometry.getStride();
|
||||||
this.drawFlatCoordinatess_(flatCoordinates, 0, ends, stride);
|
this.drawFlatCoordinatess_(flatCoordinates, 0, ends, stride);
|
||||||
this.endGeometry(polygonGeometry, feature);
|
this.endGeometry(polygonGeometry, feature);
|
||||||
@@ -1405,16 +1397,6 @@ ol.render.canvas.PolygonReplay.prototype.getBufferedMaxExtent = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {boolean} rightHanded Whether polygons are assumed to follow
|
|
||||||
* the right-hand rule.
|
|
||||||
*/
|
|
||||||
ol.render.canvas.PolygonReplay.prototype.setRightHanded =
|
|
||||||
function(rightHanded) {
|
|
||||||
this.rightHanded_ = rightHanded;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
@@ -1833,13 +1815,10 @@ ol.render.canvas.TextReplay.prototype.setTextStyle = function(textStyle) {
|
|||||||
* @param {ol.Extent} maxExtent Max extent.
|
* @param {ol.Extent} maxExtent Max extent.
|
||||||
* @param {number} resolution Resolution.
|
* @param {number} resolution Resolution.
|
||||||
* @param {number=} opt_renderBuffer Optional rendering buffer.
|
* @param {number=} opt_renderBuffer Optional rendering buffer.
|
||||||
* @param {boolean=} opt_rightHandedPolygons Assume that polygons follow the
|
|
||||||
* right-hand rule.
|
|
||||||
* @struct
|
* @struct
|
||||||
*/
|
*/
|
||||||
ol.render.canvas.ReplayGroup = function(
|
ol.render.canvas.ReplayGroup = function(
|
||||||
tolerance, maxExtent, resolution, opt_renderBuffer,
|
tolerance, maxExtent, resolution, opt_renderBuffer) {
|
||||||
opt_rightHandedPolygons) {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -1884,13 +1863,6 @@ ol.render.canvas.ReplayGroup = function(
|
|||||||
*/
|
*/
|
||||||
this.hitDetectionTransform_ = goog.vec.Mat4.createNumber();
|
this.hitDetectionTransform_ = goog.vec.Mat4.createNumber();
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
this.rightHandedPolygons_ = opt_rightHandedPolygons ?
|
|
||||||
opt_rightHandedPolygons : false;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1979,10 +1951,6 @@ ol.render.canvas.ReplayGroup.prototype.getReplay =
|
|||||||
' constructor missing from ol.render.canvas.BATCH_CONSTRUCTORS_');
|
' constructor missing from ol.render.canvas.BATCH_CONSTRUCTORS_');
|
||||||
replay = new Constructor(this.tolerance_, this.maxExtent_,
|
replay = new Constructor(this.tolerance_, this.maxExtent_,
|
||||||
this.resolution_);
|
this.resolution_);
|
||||||
if (replayType == ol.render.ReplayType.POLYGON) {
|
|
||||||
goog.asserts.assertInstanceof(replay, ol.render.canvas.PolygonReplay);
|
|
||||||
replay.setRightHanded(this.rightHandedPolygons_);
|
|
||||||
}
|
|
||||||
replays[replayType] = replay;
|
replays[replayType] = replay;
|
||||||
}
|
}
|
||||||
return replay;
|
return replay;
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ goog.require('ol.geom.GeometryType');
|
|||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {ol.geom.GeometryType} type Geometry type.
|
* @param {ol.geom.GeometryType} type Geometry type.
|
||||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
* @param {Array.<number>} flatCoordinates Flat coordinates. These always need
|
||||||
|
* to be right-handed for polygons.
|
||||||
* @param {Array.<number>|Array.<Array.<number>>} ends Ends or Endss.
|
* @param {Array.<number>|Array.<Array.<number>>} ends Ends or Endss.
|
||||||
* @param {Object.<string, *>} properties Properties.
|
* @param {Object.<string, *>} properties Properties.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -191,8 +191,7 @@ ol.renderer.canvas.VectorTileLayer.prototype.createReplayGroup = function(tile,
|
|||||||
var tileResolution = pixelSpace ? source.getTilePixelRatio() : resolution;
|
var tileResolution = pixelSpace ? source.getTilePixelRatio() : resolution;
|
||||||
replayState.dirty = false;
|
replayState.dirty = false;
|
||||||
var replayGroup = new ol.render.canvas.ReplayGroup(0, extent,
|
var replayGroup = new ol.render.canvas.ReplayGroup(0, extent,
|
||||||
tileResolution, layer.getRenderBuffer(),
|
tileResolution, layer.getRenderBuffer());
|
||||||
tile.getFormat().getRightHandedPolygons());
|
|
||||||
var squaredTolerance = ol.renderer.vector.getSquaredTolerance(
|
var squaredTolerance = ol.renderer.vector.getSquaredTolerance(
|
||||||
tileResolution, pixelRatio);
|
tileResolution, pixelRatio);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user