@@ -4,8 +4,7 @@ import SampleControl from './OpenMapSamplesControl';
44import Sample from "openmapsamples/lib/Sample" ;
55import Layer from "openmapsamples/lib/Layer" ;
66import { ExamplePlaceData , ExampleTransportationData } from "openmapsamples/lib/SampleData/ExampleSampleData" ;
7- import { default as highwayAttributesSample , sampleData as highwayAttributesSampleData } from "openmapsamples/samples/OpenMapTiles/HighwayAttributes" ;
8- import { default as highwayLinkAttributesSample , sampleData as highwayLinkAttributesSampleData } from "openmapsamples/samples/OpenMapTiles/HighwayLinkAttributes" ;
7+ import { default as OpenMapTilesSamples } from "openmapsamples/samples/OpenMapTiles" ;
98// import MaplibreInspect from "maplibre-gl-inspect";
109// import "maplibre-gl-inspect/dist/maplibre-gl-inspect.css";
1110
@@ -29,34 +28,8 @@ async function main() {
2928 // Add our sample data.
3029 let sampleControl = new SampleControl ( ) ;
3130
32- // Add our Highway Attributes sample.
33- sampleControl . addSample ( highwayAttributesSample ) ;
34- // Set a custom row-hight callback to give more space to motorways at high zooms.
35- // This isn't needed for all styles, but the osm-standard style
36- // inflates widths of motorways and trunk at high zooms.
37- highwayAttributesSampleData . setRowHeightCallback ( function ( zoom , row , numRows ) {
38- if ( zoom > 18 && row < 1 ) {
39- return 24 / numRows / Math . pow ( 2 , zoom - 4 ) ;
40- } else if ( zoom > 16 && row < 1 ) {
41- return 22 / numRows / Math . pow ( 2 , zoom - 4 ) ;
42- } else {
43- return 20 / numRows / Math . pow ( 2 , zoom - 4 ) ;
44- }
45- } ) ;
46-
47- // Add our Highway Link Attributes sample.
48- sampleControl . addSample ( highwayLinkAttributesSample ) ;
49- // Set a custom row-hight callback to give more space to motorways at high zooms.
50- // This isn't needed for all styles, but the osm-standard style
51- // inflates widths of motorways and trunk at high zooms.
52- highwayLinkAttributesSampleData . setRowHeightCallback ( function ( zoom , row , numRows ) {
53- if ( zoom > 18 && row < 2 ) {
54- return 24 / numRows / Math . pow ( 2 , zoom - 4 ) ;
55- } else if ( zoom > 16 && row < 2 ) {
56- return 22 / numRows / Math . pow ( 2 , zoom - 4 ) ;
57- } else {
58- return 20 / numRows / Math . pow ( 2 , zoom - 4 ) ;
59- }
31+ OpenMapTilesSamples . forEach ( ( sample , i ) => {
32+ sampleControl . addSample ( sample ) ;
6033 } ) ;
6134
6235 let sample = sampleControl . addSample (
0 commit comments