Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
AlitaBernachot committed Sep 8, 2024
1 parent bb455d9 commit 5925d48
Show file tree
Hide file tree
Showing 21 changed files with 1,133 additions and 106 deletions.
3 changes: 2 additions & 1 deletion buildtools/webpack.examples.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import path from 'path';
import fs from 'fs';
import glob from 'fast-glob';

Check warning on line 3 in buildtools/webpack.examples.js

View workflow job for this annotation

GitHub Actions / main

Using exported name 'glob' as identifier for default export
// eslint-disable-next-line no-use-before-define
import HtmlWebpackPlugin from 'html-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import { fileURLToPath } from 'url';
import {fileURLToPath} from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));

const plugins = [];
Expand Down
17 changes: 17 additions & 0 deletions disableHashPlugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// import {Namer} from '@parcel/plugin';
// import path from 'path';

// export default new Namer({
// name({bundle}) {
// if (bundle.type === 'js' || bundle.type === 'html'|| bundle.type === 'css') {
// const mainEntry = bundle.getMainEntry();
// if (mainEntry) {
// const filePath = mainEntry.filePath;
// return path.basename(filePath);
// }
// }

// // Allow the next namer to handle this bundle.
// return null;
// }
// });
2 changes: 1 addition & 1 deletion examples/3dtiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ scene.camera.flyTo({
//##REMOVE## Keep this tag, split code here for code sandbox

import {initCodeSandbox} from './_code-sandbox.js';
initCodeSandbox('rawjs/customProj.js', 'rawjs/_proj21781.js');
initCodeSandbox('rawjs/customProj.js', 'rawjs/_proj21781.js');
51 changes: 24 additions & 27 deletions examples/_code-sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function initCodeSandbox(indexJsPath, ...filesPathes) {
const response = await fetch(indexJsPath);
const txtData = await response.text();
let indexJsContent = txtData.split('//##REMOVE##')[0];

indexJsContent = indexJsContent.replaceAll(/(olcs\/.*?).ts('?;?)/ig, '$1.js$2');

const additionalJsFiles = {};
Expand All @@ -19,8 +19,6 @@ export async function initCodeSandbox(indexJsPath, ...filesPathes) {
const txtDataFile = await responseFile.text();

additionalJsFiles[filePath.replace('./', '').replace('rawjs', '')] = {content: txtDataFile};

console.log("additionalJsFiles", additionalJsFiles)
}

initCodeSandboxButton({indexJsContent, additionalJsFiles});
Expand Down Expand Up @@ -121,45 +119,45 @@ function initCodeSandboxButton(options) {
'source': 'index.html',
'main': 'index.html',
'scripts': {
"build": "vite build",
"start": "npm run build && serve dist",
'build': 'vite build',
'start': 'npm run build && serve dist',
},
"devDependencies": {
"serve": "14.2.3",
"vite": "^3.2.3",
"@babel/core": "^7.24.4",
"@babel/plugin-proposal-class-properties": "^7.18.6"
'devDependencies': {
'serve': '14.2.3',
'vite': '^3.2.3',
'@babel/core': '^7.24.4',
'@babel/plugin-proposal-class-properties': '^7.18.6'
},
"dependencies": {
"olcs": "latest",
"proj4": "2.9.0",
"cesium": "1.108",
"ol": "8.1.0"
'dependencies': {
'olcs': 'latest',
'proj4': '2.9.0',
'cesium': '1.108',
'ol': '8.1.0'
}
},
},
'.babelrc': {
content: '{ "plugins": ["@babel/plugin-proposal-class-properties"] }'
},
'data/geojson/countries.geojson': {
"isBinary": true,
content: "https://openlayers.org/ol-cesium/examples/data/geojson/countries.geojson"
'isBinary': true,
content: 'https://openlayers.org/ol-cesium/examples/data/geojson/countries.geojson'
},
'data/geojson/buildings.geojson': {
"isBinary": true,
content: "https://openlayers.org/ol-cesium/examples/data/geojson/buildings.geojson"
'isBinary': true,
content: 'https://openlayers.org/ol-cesium/examples/data/geojson/buildings.geojson'
},
'data/geojson/vector_data.geojson': {
"isBinary": true,
content: "https://openlayers.org/ol-cesium/examples/data/geojson/vector_data.geojson"
'isBinary': true,
content: 'https://openlayers.org/ol-cesium/examples/data/geojson/vector_data.geojson'
},
'data/icon.png': {
"isBinary": true,
content: "https://openlayers.org/ol-cesium/examples/data/icon.png"
'isBinary': true,
content: 'https://openlayers.org/ol-cesium/examples/data/icon.png'
},
'data/Box.gltf': {
"isBinary": true,
content: "https://openlayers.org/ol-cesium/examples/data/Box.gltf"
'isBinary': true,
content: 'https://openlayers.org/ol-cesium/examples/data/Box.gltf'
},
'index.js': {
content: indexJsContent,
Expand All @@ -178,8 +176,7 @@ function initCodeSandboxButton(options) {
};
}


// dans npm prepare : extraire les versions à utiliser et faire un fichier json avec ces versions
// Ce fichier json doit etre lu, faire un fetch de ce fichier
// ce fichier ne peut pas etre commit
// à rajouter dans gitinore
// à rajouter dans gitinore
2 changes: 1 addition & 1 deletion examples/buildings.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ map.on('click', (e) => {
//##REMOVE## Keep this tag, split code here for code sandbox

import {initCodeSandbox} from './_code-sandbox.js';
initCodeSandbox('rawjs/buildings.js');
initCodeSandbox('rawjs/buildings.js');
2 changes: 0 additions & 2 deletions examples/exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import olSourceOSM from 'ol/source/OSM.js';
import olLayerTile from 'ol/layer/Tile.js';
import olMap from 'ol/Map.js';

const Cesium = window.Cesium;

const ol2d = new olMap({
layers: [
new olLayerTile({
Expand Down
1 change: 0 additions & 1 deletion examples/fillstyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ const map = new olMap({
})
});

const Cesium = window.Cesium;
const ol3d = new OLCesium({map, target: 'mapCesium'});
const scene = ol3d.getCesiumScene();
ol3d.setEnabled(true);
Expand Down
1 change: 0 additions & 1 deletion examples/groundvectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ const map = new olMap({
})
});

const Cesium = window.Cesium;
vectorLayer.set('altitudeMode', 'clampToGround');
const ol3d = new OLCesium({map, target: 'map3d'});
const scene = ol3d.getCesiumScene();
Expand Down
6 changes: 2 additions & 4 deletions examples/image-static.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/imageWMS.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ const ol3d = new OLCesium({
return Cesium.JulianDate.now();
}
});
const scene = ol3d.getCesiumScene();
ol3d.getCesiumScene();
ol3d.setEnabled(true);

document.getElementById('enable').addEventListener('click', () => ol3d.setEnabled(!ol3d.getEnabled()));

//##REMOVE## Keep this tag, split code here for code sandbox

import {initCodeSandbox} from './_code-sandbox.js';
initCodeSandbox('rawjs/imageWMS.js');
initCodeSandbox('rawjs/imageWMS.js');
20 changes: 10 additions & 10 deletions examples/kml.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ const ol3d = new OLCesium({map: ol2d});
const scene = ol3d.getCesiumScene();

ol3d.getDataSources().add(
Cesium.KmlDataSource.load(
"https://api3.geo.admin.ch/ogcproxy?url=" +
"https%3A%2F%2Fdav0.bgdi.admin.ch%2Fbazl_web%2FActive_Obstacles.kmz",
{
camera: scene.camera,
canvas: scene.canvas
}
)
Cesium.KmlDataSource.load(
'https://api3.geo.admin.ch/ogcproxy?url=' +
'https%3A%2F%2Fdav0.bgdi.admin.ch%2Fbazl_web%2FActive_Obstacles.kmz',
{
camera: scene.camera,
canvas: scene.canvas
}
)
);

document.getElementById('enable').addEventListener('click', () => ol3d.setEnabled(!ol3d.getEnabled()));

//##REMOVE## Keep this tag, split code here for code sandbox

import { initCodeSandbox } from './_code-sandbox.js';
initCodeSandbox('rawjs/kml.js');
import {initCodeSandbox} from './_code-sandbox.js';
initCodeSandbox('rawjs/kml.js');
1 change: 0 additions & 1 deletion examples/layer-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const ol2d = new olMap({
})
});

const Cesium = window.Cesium;
const ol3d = new OLCesium({map: ol2d, target: 'mapCesium'});
ol3d.setEnabled(true);

Expand Down
2 changes: 0 additions & 2 deletions examples/mvt.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import Style from 'ol/style/Style.js';
import OSMSource from 'ol/source/OSM.js';
import './_proj21781.js';

const Cesium = window.Cesium;

const projection = getProjection('EPSG:3857');
console.assert(projection);

Expand Down
17 changes: 8 additions & 9 deletions examples/overlay.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global $ */
import OLCesium from 'olcs';
import olMap from 'ol/Map.js';
import olSourceOSM from 'ol/source/OSM.js';
Expand Down Expand Up @@ -59,18 +60,16 @@ class OverlayHandler {
eventHandler.setInputAction(this.onClickHandlerCS.bind(this), Cesium.ScreenSpaceEventType['LEFT_CLICK']);

const clickForm = document.getElementById('click-action-form');
clickForm.onchange = function(event) {
const checked = $('input[name="click-action"]:checked').val();
clickForm.onchange = () => {
const checked = document.querySelector('input[name="click-action"]:checked')?.value;
this.options.add = checked === 'add';

console.log("checked", checked)
}.bind(this);
};

const typeForm = document.getElementById('overlay-type-form');
typeForm.onchange = function(event) {
const checked = $('input[name="overlay-type"]:checked').val();
typeForm.onchange = (event) => {
const checked = document.querySelector('input[name="overlay-type"]:checked')?.value;
this.options.boostrap = checked === 'popover';
}.bind(this);
};
}

onClickHandlerOL(event) {
Expand Down Expand Up @@ -172,4 +171,4 @@ document.getElementById('enable').addEventListener('click', () => ol3d.setEnable
//##REMOVE## Keep this tag, split code here for code sandbox

import {initCodeSandbox} from './_code-sandbox.js';
initCodeSandbox('rawjs/overlay.js');
initCodeSandbox('rawjs/overlay.js');
8 changes: 3 additions & 5 deletions examples/print.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import olSourceOSM from 'ol/source/OSM.js';
import olLayerTile from 'ol/layer/Tile.js';
import olMap from 'ol/Map.js';


const Cesium = window.Cesium;
const ol2d = new olMap({
layers: [
new olLayerTile({
Expand Down Expand Up @@ -49,7 +47,7 @@ function scalingOptions() {
}
autoDrawMask(scene, () => scalingOptions().scaling);

document.querySelector("#takeScreenshot").addEventListener("click", window.takeScreenshot);
document.querySelector('#takeScreenshot').addEventListener('click', window.takeScreenshot);

window['takeScreenshot'] = async function() {
const r = scalingOptions();
Expand All @@ -60,10 +58,10 @@ window['takeScreenshot'] = async function() {
img.src = value;
img.width = r.width / (canvas.width / canvas.clientWidth);
img.height = r.height / (canvas.height / canvas.clientHeight);
document.querySelector("#screenshots").append(img);
document.querySelector('#screenshots').append(img);
};

//##REMOVE## Keep this tag, split code here for code sandbox

import {initCodeSandbox} from './_code-sandbox.js';
initCodeSandbox('rawjs/print.js');
initCodeSandbox('rawjs/print.js');
3 changes: 2 additions & 1 deletion examples/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,5 @@ map.on('click', (e) => {
//##REMOVE## Keep this tag, split code here for code sandbox

import {initCodeSandbox} from './_code-sandbox.js';
initCodeSandbox('rawjs/selection.js');
initCodeSandbox('rawjs/selection.js');

4 changes: 1 addition & 3 deletions examples/sidebyside.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import olMap from 'ol/Map.js';
import {transform} from 'ol/proj.js';
import olView from 'ol/View.js';

const Cesium = window.Cesium;

const view = new olView({
center: transform([25, 20], 'EPSG:4326', 'EPSG:3857'),
zoom: 3,
Expand All @@ -33,4 +31,4 @@ document.getElementById('enable').addEventListener('click', () => ol3d.setEnable
//##REMOVE## Keep this tag, split code here for code sandbox

import {initCodeSandbox} from './_code-sandbox.js';
initCodeSandbox('rawjs/sidebyside.js');
initCodeSandbox('rawjs/sidebyside.js');
2 changes: 0 additions & 2 deletions examples/tracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import olFeature from 'ol/Feature.js';
import olGeomPoint from 'ol/geom/Point.js';
import olMap from 'ol/Map.js';

const Cesium = window.Cesium;

const point = new olGeomPoint([700000, 200000, 100000]);

const iconFeature = new olFeature({
Expand Down
5 changes: 2 additions & 3 deletions examples/vectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,13 @@ const cervinFeature = new olFeature({
});
cervinFeature.getGeometry().set('altitudeMode', 'clampToGround');


const modelFeatures = [-1, -1 / 2, 0, 1 / 2, 1, 3 / 2].map(
factor => new olFeature({
geometry: new olGeomPoint([852641, 5776749, 4500]),
'rotation': factor * Math.PI
})
);


const iconStyle = new olStyleStyle({
image: new olStyleIcon(/** @type {olx.style.IconOptions} */ ({
anchor: [0.5, 46],
Expand Down Expand Up @@ -122,6 +120,7 @@ modelFeatures.forEach((feature) => {
cesiumOptions: {
url: './data/Box.gltf',
modelMatrix: createMatrixAtCoordinates(center, rotation),
// eslint-disable-next-line no-use-before-define
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
minimumPixelSize: 64
}
Expand Down Expand Up @@ -411,4 +410,4 @@ ol3d.enableAutoRenderLoop();
//##REMOVE## Keep this tag, split code here for code sandbox

import {initCodeSandbox} from './_code-sandbox.js';
initCodeSandbox('rawjs/vectors.js');
initCodeSandbox('rawjs/vectors.js');
Loading

0 comments on commit 5925d48

Please sign in to comment.