File tree Expand file tree Collapse file tree
legacy/plugins/maps/public
connected_components/map/mb
plugins/maps/common/descriptor_types Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -235,12 +235,12 @@ export class MBMapContainer extends React.Component {
235235 //clamping ot -89/89 latitudes since Mapboxgl does not seem to handle bounds that contain the poles (logs errors to the console when using -90/90)
236236 const lnLatBounds = new mapboxgl . LngLatBounds (
237237 new mapboxgl . LngLat (
238- clampToLonBounds ( goto . bounds . min_lon ) ,
239- clampToLatBounds ( goto . bounds . min_lat )
238+ clampToLonBounds ( goto . bounds . minLon ) ,
239+ clampToLatBounds ( goto . bounds . minLat )
240240 ) ,
241241 new mapboxgl . LngLat (
242- clampToLonBounds ( goto . bounds . max_lon ) ,
243- clampToLatBounds ( goto . bounds . max_lat )
242+ clampToLonBounds ( goto . bounds . maxLon ) ,
243+ clampToLatBounds ( goto . bounds . maxLat )
244244 )
245245 ) ;
246246 //maxZoom ensure we're not zooming in too far on single points or small shapes
Original file line number Diff line number Diff line change 33 * or more contributor license agreements. Licensed under the Elastic License;
44 * you may not use this file except in compliance with the Elastic License.
55 */
6- import { LayerDescriptor } from '../../common/descriptor_types' ;
6+ import { LayerDescriptor , MapExtent , MapFilters } from '../../common/descriptor_types' ;
77import { ISource } from './sources/source' ;
88import { DataRequest } from './util/data_request' ;
99import { SyncContext } from '../actions/map_actions' ;
1010
1111export interface ILayer {
12+ getBounds ( mapFilters : MapFilters ) : Promise < MapExtent > ;
1213 getDataRequest ( id : string ) : DataRequest | undefined ;
1314 getDisplayName ( source ?: ISource ) : Promise < string > ;
1415 getId ( ) : string ;
@@ -25,6 +26,7 @@ export interface ILayerArguments {
2526
2627export class AbstractLayer implements ILayer {
2728 constructor ( layerArguments : ILayerArguments ) ;
29+ getBounds ( mapFilters : MapFilters ) : Promise < MapExtent > ;
2830 getDataRequest ( id : string ) : DataRequest | undefined ;
2931 getDisplayName ( source ?: ISource ) : Promise < string > ;
3032 getId ( ) : string ;
Original file line number Diff line number Diff line change @@ -320,12 +320,12 @@ export class AbstractLayer {
320320 return sourceDataRequest && sourceDataRequest . hasData ( ) ;
321321 }
322322
323- async getBounds ( ) {
323+ async getBounds ( /* mapFilters: MapFilters */ ) {
324324 return {
325- min_lon : - 180 ,
326- max_lon : 180 ,
327- min_lat : - 89 ,
328- max_lat : 89 ,
325+ minLon : - 180 ,
326+ maxLon : 180 ,
327+ minLat : - 89 ,
328+ maxLat : 89 ,
329329 } ;
330330 }
331331
Original file line number Diff line number Diff line change @@ -175,10 +175,10 @@ export class AbstractESSource extends AbstractVectorSource {
175175 }
176176
177177 return {
178- min_lon : esBounds . top_left . lon ,
179- max_lon : esBounds . bottom_right . lon ,
180- min_lat : esBounds . bottom_right . lat ,
181- max_lat : esBounds . top_left . lat ,
178+ minLon : esBounds . top_left . lon ,
179+ maxLon : esBounds . bottom_right . lon ,
180+ minLat : esBounds . bottom_right . lat ,
181+ maxLat : esBounds . top_left . lat ,
182182 } ;
183183 }
184184
Original file line number Diff line number Diff line change 88import { FeatureCollection } from 'geojson' ;
99import { AbstractSource , ISource } from './source' ;
1010import { IField } from '../fields/field' ;
11- import { ESSearchSourceResponseMeta } from '../../../common/descriptor_types' ;
11+ import {
12+ ESSearchSourceResponseMeta ,
13+ MapExtent ,
14+ VectorSourceRequestMeta ,
15+ } from '../../../common/descriptor_types' ;
1216
1317export type GeoJsonFetchMeta = ESSearchSourceResponseMeta ;
1418
@@ -18,6 +22,7 @@ export type GeoJsonWithMeta = {
1822} ;
1923
2024export interface IVectorSource extends ISource {
25+ getBoundsForFilters ( searchFilters : VectorSourceRequestMeta ) : MapExtent ;
2126 getGeoJsonWithMeta (
2227 layerName : 'string' ,
2328 searchFilters : unknown [ ] ,
@@ -29,6 +34,7 @@ export interface IVectorSource extends ISource {
2934}
3035
3136export class AbstractVectorSource extends AbstractSource implements IVectorSource {
37+ getBoundsForFilters ( searchFilters : VectorSourceRequestMeta ) : MapExtent ;
3238 getGeoJsonWithMeta (
3339 layerName : 'string' ,
3440 searchFilters : unknown [ ] ,
Original file line number Diff line number Diff line change @@ -167,10 +167,10 @@ export class VectorLayer extends AbstractLayer {
167167 features : visibleFeatures ,
168168 } ) ;
169169 return {
170- min_lon : bbox [ 0 ] ,
171- min_lat : bbox [ 1 ] ,
172- max_lon : bbox [ 2 ] ,
173- max_lat : bbox [ 3 ] ,
170+ minLon : bbox [ 0 ] ,
171+ minLat : bbox [ 1 ] ,
172+ maxLon : bbox [ 2 ] ,
173+ maxLat : bbox [ 3 ] ,
174174 } ;
175175 }
176176
Original file line number Diff line number Diff line change @@ -33,16 +33,8 @@ export type MapCenterAndZoom = MapCenter & {
3333 zoom : number ;
3434} ;
3535
36- // TODO replace with map_descriptors.MapExtent. Both define the same thing but with different casing
37- type MapBounds = {
38- min_lon : number ;
39- max_lon : number ;
40- min_lat : number ;
41- max_lat : number ;
42- } ;
43-
4436export type Goto = {
45- bounds ?: MapBounds ;
37+ bounds ?: MapExtent ;
4638 center ?: MapCenterAndZoom ;
4739} ;
4840
You can’t perform that action at this time.
0 commit comments