Change getUid return type from number to string

This commit is contained in:
Frederic Junod
2018-10-17 08:58:50 +02:00
parent a85099a36b
commit 041836c645
33 changed files with 78 additions and 92 deletions
+1 -3
View File
@@ -597,9 +597,7 @@ class CanvasReplay extends VectorContext {
switch (type) {
case CanvasInstruction.BEGIN_GEOMETRY:
feature = /** @type {import("../../Feature.js").default|import("../Feature.js").default} */ (instruction[1]);
if ((skipFeatures &&
skippedFeaturesHash[getUid(feature).toString()]) ||
!feature.getGeometry()) {
if ((skipFeatures && skippedFeaturesHash[getUid(feature)]) || !feature.getGeometry()) {
i = /** @type {number} */ (instruction[2]);
} else if (opt_hitExtent !== undefined && !intersects(
opt_hitExtent, feature.getGeometry().getExtent())) {
+4 -6
View File
@@ -255,7 +255,7 @@ class WebGLCircleReplay extends WebGLReplay {
* @inheritDoc
*/
drawHitDetectionReplayOneByOne(gl, context, skippedFeaturesHash, featureCallback, opt_hitExtent) {
let i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex;
let i, start, end, nextStyle, groupStart, feature, featureIndex;
featureIndex = this.startIndices.length - 2;
end = this.startIndices[featureIndex + 1];
for (i = this.styleIndices_.length - 1; i >= 0; --i) {
@@ -269,9 +269,8 @@ class WebGLCircleReplay extends WebGLReplay {
this.startIndices[featureIndex] >= groupStart) {
start = this.startIndices[featureIndex];
feature = this.startIndicesFeature[featureIndex];
featureUid = getUid(feature).toString();
if (skippedFeaturesHash[featureUid] === undefined &&
if (skippedFeaturesHash[getUid(feature)] === undefined &&
feature.getGeometry() &&
(opt_hitExtent === undefined || intersects(
/** @type {Array<number>} */ (opt_hitExtent),
@@ -300,7 +299,7 @@ class WebGLCircleReplay extends WebGLReplay {
* @param {Object} skippedFeaturesHash Ids of features to skip.
*/
drawReplaySkipping_(gl, context, skippedFeaturesHash) {
let i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex, featureStart;
let i, start, end, nextStyle, groupStart, feature, featureIndex, featureStart;
featureIndex = this.startIndices.length - 2;
end = start = this.startIndices[featureIndex + 1];
for (i = this.styleIndices_.length - 1; i >= 0; --i) {
@@ -314,9 +313,8 @@ class WebGLCircleReplay extends WebGLReplay {
this.startIndices[featureIndex] >= groupStart) {
featureStart = this.startIndices[featureIndex];
feature = this.startIndicesFeature[featureIndex];
featureUid = getUid(feature).toString();
if (skippedFeaturesHash[featureUid]) {
if (skippedFeaturesHash[getUid(feature)]) {
if (start !== end) {
this.drawElements(gl, context, start, end);
}
+4 -6
View File
@@ -536,7 +536,7 @@ class WebGLLineStringReplay extends WebGLReplay {
* @param {Object} skippedFeaturesHash Ids of features to skip.
*/
drawReplaySkipping_(gl, context, skippedFeaturesHash) {
let i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex, featureStart;
let i, start, end, nextStyle, groupStart, feature, featureIndex, featureStart;
featureIndex = this.startIndices.length - 2;
end = start = this.startIndices[featureIndex + 1];
for (i = this.styleIndices_.length - 1; i >= 0; --i) {
@@ -548,9 +548,8 @@ class WebGLLineStringReplay extends WebGLReplay {
this.startIndices[featureIndex] >= groupStart) {
featureStart = this.startIndices[featureIndex];
feature = this.startIndicesFeature[featureIndex];
featureUid = getUid(feature).toString();
if (skippedFeaturesHash[featureUid]) {
if (skippedFeaturesHash[getUid(feature)]) {
if (start !== end) {
this.drawElements(gl, context, start, end);
gl.clear(gl.DEPTH_BUFFER_BIT);
@@ -572,7 +571,7 @@ class WebGLLineStringReplay extends WebGLReplay {
* @inheritDoc
*/
drawHitDetectionReplayOneByOne(gl, context, skippedFeaturesHash, featureCallback, opt_hitExtent) {
let i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex;
let i, start, end, nextStyle, groupStart, feature, featureIndex;
featureIndex = this.startIndices.length - 2;
end = this.startIndices[featureIndex + 1];
for (i = this.styleIndices_.length - 1; i >= 0; --i) {
@@ -584,9 +583,8 @@ class WebGLLineStringReplay extends WebGLReplay {
this.startIndices[featureIndex] >= groupStart) {
start = this.startIndices[featureIndex];
feature = this.startIndicesFeature[featureIndex];
featureUid = getUid(feature).toString();
if (skippedFeaturesHash[featureUid] === undefined &&
if (skippedFeaturesHash[getUid(feature)] === undefined &&
feature.getGeometry() &&
(opt_hitExtent === undefined || intersects(
/** @type {Array<number>} */ (opt_hitExtent),
+4 -6
View File
@@ -927,7 +927,7 @@ class WebGLPolygonReplay extends WebGLReplay {
* @inheritDoc
*/
drawHitDetectionReplayOneByOne(gl, context, skippedFeaturesHash, featureCallback, opt_hitExtent) {
let i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex;
let i, start, end, nextStyle, groupStart, feature, featureIndex;
featureIndex = this.startIndices.length - 2;
end = this.startIndices[featureIndex + 1];
for (i = this.styleIndices_.length - 1; i >= 0; --i) {
@@ -939,9 +939,8 @@ class WebGLPolygonReplay extends WebGLReplay {
this.startIndices[featureIndex] >= groupStart) {
start = this.startIndices[featureIndex];
feature = this.startIndicesFeature[featureIndex];
featureUid = getUid(feature).toString();
if (skippedFeaturesHash[featureUid] === undefined &&
if (skippedFeaturesHash[getUid(feature)] === undefined &&
feature.getGeometry() &&
(opt_hitExtent === undefined || intersects(
/** @type {Array<number>} */ (opt_hitExtent),
@@ -970,7 +969,7 @@ class WebGLPolygonReplay extends WebGLReplay {
* @param {Object} skippedFeaturesHash Ids of features to skip.
*/
drawReplaySkipping_(gl, context, skippedFeaturesHash) {
let i, start, end, nextStyle, groupStart, feature, featureUid, featureIndex, featureStart;
let i, start, end, nextStyle, groupStart, feature, featureIndex, featureStart;
featureIndex = this.startIndices.length - 2;
end = start = this.startIndices[featureIndex + 1];
for (i = this.styleIndices_.length - 1; i >= 0; --i) {
@@ -982,9 +981,8 @@ class WebGLPolygonReplay extends WebGLReplay {
this.startIndices[featureIndex] >= groupStart) {
featureStart = this.startIndices[featureIndex];
feature = this.startIndicesFeature[featureIndex];
featureUid = getUid(feature).toString();
if (skippedFeaturesHash[featureUid]) {
if (skippedFeaturesHash[getUid(feature)]) {
if (start !== end) {
this.drawElements(gl, context, start, end);
gl.clear(gl.DEPTH_BUFFER_BIT);
+4 -6
View File
@@ -244,7 +244,7 @@ class WebGLTextureReplay extends WebGLReplay {
for (i = 0; i < ii; ++i) {
image = images[i];
uid = getUid(image).toString();
uid = getUid(image);
if (uid in texturePerImage) {
texture = texturePerImage[uid];
} else {
@@ -371,8 +371,7 @@ class WebGLTextureReplay extends WebGLReplay {
this.startIndices[featureIndex] <= groupEnd) {
const feature = this.startIndicesFeature[featureIndex];
const featureUid = getUid(feature).toString();
if (skippedFeaturesHash[featureUid] !== undefined) {
if (skippedFeaturesHash[getUid(feature)] !== undefined) {
// feature should be skipped
if (start !== end) {
// draw the features so far
@@ -402,7 +401,7 @@ class WebGLTextureReplay extends WebGLReplay {
* @inheritDoc
*/
drawHitDetectionReplayOneByOne(gl, context, skippedFeaturesHash, featureCallback, opt_hitExtent) {
let i, groupStart, start, end, feature, featureUid;
let i, groupStart, start, end, feature;
let featureIndex = this.startIndices.length - 1;
const hitDetectionTextures = this.getHitDetectionTextures();
for (i = hitDetectionTextures.length - 1; i >= 0; --i) {
@@ -415,9 +414,8 @@ class WebGLTextureReplay extends WebGLReplay {
this.startIndices[featureIndex] >= groupStart) {
start = this.startIndices[featureIndex];
feature = this.startIndicesFeature[featureIndex];
featureUid = getUid(feature).toString();
if (skippedFeaturesHash[featureUid] === undefined &&
if (skippedFeaturesHash[getUid(feature)] === undefined &&
feature.getGeometry() &&
(opt_hitExtent === undefined || intersects(
/** @type {Array<number>} */ (opt_hitExtent),