@@ -199,11 +199,18 @@ ol.render.webgl.ImageReplay = function(tolerance, maxExtent) {
199
199
this . verticesBuffer_ = null ;
200
200
201
201
/**
202
- * Start indices per feature.
203
- * @type {Array.<Array.<?>> }
202
+ * Start index per feature (the index).
203
+ * @type {Array.<number> }
204
+ * @private
205
+ */
206
+ this . startIndices_ = [ ] ;
207
+
208
+ /**
209
+ * Start index per feature (the feature).
210
+ * @type {Array.<ol.Feature> }
204
211
* @private
205
212
*/
206
- this . startIndexForFeature_ = [ ] ;
213
+ this . startIndicesFeature_ = [ ] ;
207
214
208
215
/**
209
216
* @type {number|undefined }
@@ -406,7 +413,8 @@ ol.render.webgl.ImageReplay.prototype.drawMultiLineStringGeometry =
406
413
*/
407
414
ol . render . webgl . ImageReplay . prototype . drawMultiPointGeometry =
408
415
function ( multiPointGeometry , feature ) {
409
- this . startIndexForFeature_ . push ( [ this . indices_ . length , feature ] ) ;
416
+ this . startIndices_ . push ( this . indices_ . length ) ;
417
+ this . startIndicesFeature_ . push ( feature ) ;
410
418
var flatCoordinates = multiPointGeometry . getFlatCoordinates ( ) ;
411
419
var stride = multiPointGeometry . getStride ( ) ;
412
420
this . drawCoordinates_ (
@@ -426,7 +434,8 @@ ol.render.webgl.ImageReplay.prototype.drawMultiPolygonGeometry =
426
434
*/
427
435
ol . render . webgl . ImageReplay . prototype . drawPointGeometry =
428
436
function ( pointGeometry , feature ) {
429
- this . startIndexForFeature_ . push ( [ this . indices_ . length , feature ] ) ;
437
+ this . startIndices_ . push ( this . indices_ . length ) ;
438
+ this . startIndicesFeature_ . push ( feature ) ;
430
439
var flatCoordinates = pointGeometry . getFlatCoordinates ( ) ;
431
440
var stride = pointGeometry . getStride ( ) ;
432
441
this . drawCoordinates_ (
@@ -723,26 +732,25 @@ ol.render.webgl.ImageReplay.prototype.drawHitDetectionReplay_ =
723
732
goog . webgl . UNSIGNED_INT : goog . webgl . UNSIGNED_SHORT ;
724
733
var elementSize = context . hasOESElementIndexUint ? 4 : 2 ;
725
734
726
- var i , groupStart , groupEnd , numItems , featureInfo , start , end ;
727
- var featureIndex = this . startIndexForFeature_ . length - 1 ;
735
+ var i , groupStart , groupEnd , numItems , start , end ;
736
+ var featureIndex = this . startIndices_ . length - 1 ;
728
737
for ( i = this . hitDetectionTextures_ . length - 1 ; i >= 0 ; -- i ) {
729
738
gl . bindTexture ( goog . webgl . TEXTURE_2D , this . hitDetectionTextures_ [ i ] ) ;
730
739
groupStart = ( i > 0 ) ? this . hitDetectionGroupIndices_ [ i - 1 ] : 0 ;
731
740
end = this . hitDetectionGroupIndices_ [ i ] ;
732
741
733
742
// draw all features for this texture group
734
743
while ( featureIndex >= 0 &&
735
- this . startIndexForFeature_ [ featureIndex ] [ 0 ] >= groupStart ) {
736
- featureInfo = this . startIndexForFeature_ [ featureIndex ] ;
737
- start = featureInfo [ 0 ] ;
744
+ this . startIndices_ [ featureIndex ] >= groupStart ) {
745
+ start = this . startIndices_ [ featureIndex ] ;
738
746
numItems = end - start ;
739
747
var offsetInBytes = start * elementSize ;
740
748
741
749
gl . clear ( gl . COLOR_BUFFER_BIT | gl . DEPTH_BUFFER_BIT ) ;
742
750
gl . drawElements (
743
751
goog . webgl . TRIANGLES , numItems , elementType , offsetInBytes ) ;
744
752
745
- var result = featureCallback ( /** @type { ol.Feature } */ ( featureInfo [ 1 ] ) ) ;
753
+ var result = featureCallback ( this . startIndicesFeature_ [ featureIndex ] ) ;
746
754
if ( result ) {
747
755
return result ;
748
756
}
0 commit comments