@@ -53,9 +53,6 @@ const PAINT_MAP = {
5353 'circle-opacity' : 1 ,
5454 'circle-blur' : 0 ,
5555 'circle-translate' : [ 0 , 0 ] ,
56- 'circle-translate-anchor' : 'map' ,
57- 'circle-pitch-scale' : 'map' ,
58- 'circle-pitch-alignment' : 'viewport' ,
5956 'circle-stroke-width' : 0 ,
6057 'circle-stroke-color' : '#000' ,
6158 'circle-stroke-opacity' : 1
@@ -71,8 +68,7 @@ const PAINT_MAP = {
7168 'fill-color' : '#3fb1e3' ,
7269 'fill-translate' : [ 0 , 0 ] ,
7370 'fill-antialias' : true ,
74- 'fill-outline-color' : '#3fb1e3' ,
75- 'fill-translate-anchor' : 'map'
71+ 'fill-outline-color' : '#3fb1e3'
7672 }
7773} ;
7874
@@ -81,7 +77,7 @@ export class FGBLayer {
8177 this . id = options && options . layerID ? options . layerID : CommonUtil . createUniqueID ( 'FGBLayer_' ) ;
8278 this . layerId = this . id + 'outer' ;
8379 this . sourceId = this . layerId ;
84- this . options = options ;
80+ this . options = options || { } ;
8581 this . strategy = options . strategy || 'bbox' ;
8682 this . url = options . url ;
8783 this . loadedExtentsRtree_ = new RBush ( ) ;
@@ -112,13 +108,7 @@ export class FGBLayer {
112108 extent = this . extent ;
113109 }
114110 }
115- const formatBounds = extent . length ? {
116- minX : extent [ 0 ] ,
117- minY : extent [ 1 ] ,
118- maxX : extent [ 2 ] ,
119- maxY : extent [ 3 ]
120- } : { } ;
121- this . _handleFeatures ( formatBounds ) ;
111+ this . _handleFeatures ( extent ) ;
122112 }
123113
124114 moveLayer ( id , beforeId ) {
@@ -142,8 +132,9 @@ export class FGBLayer {
142132 type : 'geojson' ,
143133 data : features
144134 } ) ;
135+ } else {
136+ this . map . getSource ( this . sourceId ) . setData ( features ) ;
145137 }
146- this . map . getSource ( this . sourceId ) . setData ( features ) ;
147138 if ( ! this . map . getLayer ( this . layerId ) ) {
148139 const layer = Object . assign ( {
149140 id : this . layerId ,
@@ -159,22 +150,13 @@ export class FGBLayer {
159150 async _updateFeatures ( ) {
160151 const bounds = this . map . getBounds ( ) . toArray ( ) ;
161152 const extentToLoad = [ bounds [ 0 ] [ 0 ] , bounds [ 0 ] [ 1 ] , bounds [ 1 ] [ 0 ] , bounds [ 1 ] [ 1 ] ] ;
162- const loadedExtentsRtree = this . loadedExtentsRtree_ ;
163153 const alreadyLoaded = this . _forEachInExtent ( extentToLoad , ( object ) => {
164154 return this . _containsExtent ( object . extent , extentToLoad ) ;
165155 } ) ;
166156 if ( ! alreadyLoaded ) {
167157 let iter = await this . _loadData ( extentToLoad ) ;
168158 const features = await this . iterateFeatures ( iter ) ;
169159 this . map . getSource ( this . sourceId ) . setData ( features ) ;
170- const item = {
171- minX : extentToLoad [ 0 ] ,
172- minY : extentToLoad [ 1 ] ,
173- maxX : extentToLoad [ 2 ] ,
174- maxY : extentToLoad [ 3 ] ,
175- value : { extent : extentToLoad . slice ( ) }
176- } ;
177- loadedExtentsRtree . insert ( item ) ;
178160 }
179161 }
180162
@@ -197,10 +179,19 @@ export class FGBLayer {
197179
198180 async _loadData ( bounds ) {
199181 let fgbStream ;
200- let rect = bounds ;
201- if ( ! Object . keys ( bounds ) . length ) {
182+ let rect = {
183+ minX : bounds [ 0 ] ,
184+ minY : bounds [ 1 ] ,
185+ maxX : bounds [ 2 ] ,
186+ maxY : bounds [ 3 ]
187+ } ;
188+ if ( ! bounds . length ) {
202189 fgbStream = await this . _getStream ( this . url ) ;
190+ } else {
191+ rect . value = { extent : bounds . slice ( ) } ;
192+ this . loadedExtentsRtree_ . insert ( rect ) ;
203193 }
194+
204195 return await deserialize ( ( fgbStream && fgbStream . body ) || this . url , rect , ( headerMeta ) => {
205196 this . layerType = GEOMETRY_TYPE_MAP [ headerMeta . geometryType ] ;
206197 } ) ;
0 commit comments