Commit Graph

260 Commits

Author SHA1 Message Date
Marco Hutter af3625979a Remove unused eslint disable directives 2025-10-21 17:23:23 +02:00
jjspace 09a719b8fb
run prettier v3 2024-09-20 11:24:24 -04:00
Adam Wirth ec8a897d4e
Remove duplicated file extension check
Looks like it was checking \.gpx$ twice. Is there some other file suffix to replace it with?
2024-08-15 15:29:06 -04:00
Jeshurun Hembd 72a4215236
Merge branch 'main' into no-ready-promises 2023-03-29 14:30:32 -05:00
Gabby Getz a121a0a145 Fix built viewer 2023-03-29 10:21:19 -04:00
Gabby Getz 8429a2212a ImageryLayer.fromProviderAsync, baseLayer 2023-02-17 17:21:35 -05:00
Gabby Getz b6b0663e49 Async event handler for terrain providers 2023-02-08 15:40:57 -05:00
Gabby Getz 0286bf29e4 Tweak viewer app 2023-01-26 16:38:44 -05:00
Gabby Getz f956e6eb60 Cleanup async terrain handling 2023-01-19 16:14:11 -05:00
Gabby Getz cb4b4abe89 Cleanup viewer 2023-01-11 17:14:59 -05:00
Gabby Getz 7bd1fc268b Deprecate ready and readyPromise for terrainProviders 2023-01-11 13:55:48 -05:00
Gabby Getz 16a9c80d41 Fix up build output names and apps 2022-05-27 15:27:47 -04:00
Gabby Getz 355dd42838 Updated build process 2022-05-24 08:54:14 -04:00
Gabby Getz 4bb802402c combine output 2022-05-11 17:26:50 -04:00
Gabby Getz ff559c7109 build workers, third party, and combine with eslint 2022-05-11 16:53:41 -04:00
Gabby Getz 31c154a299 Remove when.js and replace with native promises
There were a few areas in Source where a function was assumed to be executed synchronously when a function was resolved. Native Promises however, by spec, will resolve at the end of a frame. There were also some strange handling of promise rejection in imagery providers that I cleaned up a bit in order to make them testable.

- In LabelCollection and EntityCluster, order of execution adjustment where made.
- Added TextureAtlas.addImageSync to support the order of execution fix in LabelCollection
- ArcGisMapServerImageryProvider.readyPromise will not reject if there is a failure unless the request cannot be retried.
- SingleTileImageryProvider.readyPromise will not reject if there is a failure unless the request cannot be retried.

The majority of the changes lie in the Specs, where unresolved promises weren’t being awaited before finishing executions, and where resolved promises are assumed to be synchronous all over the place and needed a good amount of fixes. Another issue which came up was calling Promise.reject in the body of a spec can cause node to halt execution when running via the command line.
2022-03-16 09:38:39 -04:00
Sanjeet Suhag e0251c6bd3 Merge branch 'main' of https://github.com/CesiumGS/cesium into feature/rebased-gpx 2022-02-07 10:33:05 -05:00
Peter Gagliardi 2fa7015313 string concatenation -> template literals 2022-02-02 15:40:21 -05:00
Sanjeet Suhag 591b413dc4 Merge branch 'main' of https://github.com/CesiumGS/cesium into feature/rebased-gpx 2022-01-31 11:25:09 -05:00
Gabby Getz 8143df4436 var -> const/let 2022-01-21 11:26:25 -05:00
Daniel Krupka ef68d58d2a Use viewer.container in demo apps 2021-10-14 13:40:11 -04:00
Daniel Krupka 043724e5bc Enable screenOverlay in demo apps 2021-10-13 11:53:09 -04:00
jtorresfabra dc1a79a270 Rebase gpx branch 2020-09-17 10:08:55 +02:00
andre-nunes 96fa24fc4a Add GpxDataSource to CesiumViewer 2020-09-15 12:26:39 +02:00
Matthew Amato 2fd0e8f7e4 Format all code with prettier 2020-04-16 20:31:36 -04:00
Matthew Amato d77b34870d Use eslint-disable-next-line instead of eslint-disable-line
`eslint-disable-line` is not recommend by prettier because it puts
trailing comments on a new line. Use `eslint-disable-next-line` instead.

This is needed ahead of formatting so that eslint passes without code
changes right after the formatter is run.
2020-04-16 09:46:25 -04:00
Matthew Amato 4741df604b Remove import.meta.url usage
import.meta.url is only at stage 3 of the standards and tools like webpack
and babel do not have good support. Not all browser do either.  I ran into
problems just trying to update the cesium-webpack-example because of it
and Edge won't even part JS code with import.meta.url in it.

This PR removes import.meta.url usage and just does a little extra work
so that all of our developer setups properly set CESIUM_BASE_URL. Most ES6
development setups would require setting CESIUM_BASE_URL anyway, so this
doesn't change much of anything for our end users.

Folks using combined versions of Cesium.js are unaffected.

I also tightened up our regex for `getBaseUrlFromCesiumScript` because
Cesium.js is always named Cesium.js if it is available, which wasn't the
case years ago when this code was written.  This should prevent accidental
detection of the wrong script, for example `CesiumViewer.js` would get
selected as a false positive.  This type of check is only valid for
non-ES6 module usage anyway, since there is no `script` tag inserter for
individual ES6 modules.

Fixes #8251 You can now load Cesium Viewer unbuilt in Edge (but it takes
forever)
2019-10-24 13:59:10 -04:00
Matthew Amato aabd27a760 Migrate Cesium to ES6 Modules
See https://github.com/AnalyticalGraphicsInc/cesium/pull/8224 for details.

eslint
There are a handful of new .eslintrc.json files, mostly to identify the files that are still AMD modules (Sandcastle/Workers). These are needed because you can't change the parser type with a comment directive (since the parser is the thing reading the file). We can finally detect unusued modules! So those have all been cleaned up as well.

requirejs -> rollup & clean-css
requirejs, almond, and karma-requirejs have all been removed. We now use rollup for building and minifying (via uglify) JS code and clean-css for css. These changes are fairly straight-forward and just involve calling rollup instead of requirejs in the build process.

Overall build time is significantly faster. CI is ~11 minutes compared to ~17 in master. Running makeZipFile on my machine takes 69 seconds compared to 112 seconds in master. There's probably plenty of room for additional optimization here too.

We wrote an published a small npm module, rollup-plugin-strip-pragma, for stripping the requirejs pragmas we use out of the release builds. This is maintained in the Tools/rollup-plugin-strip-pragma directory.

As for what we produce. The built version of Cesium is now a UMD module. So it should work anywhere that hasn't made the jump to ES6 yet. For users that were already using the "legacy" combined/minified approach, nothing changes.

One awesome thing about roll-up is that it compiles all of the workers at once and automatically detects shared codes and generates separate bundles under the hood. This means the size of our worker modules shrink dramatically and Cesium itself will load them much faster. The total minified/gzipped size of all workers in master is 2.6 MB compared to 225 KB in this branch! This should be most noticeable on demos like Geometry & Appearances which load lots of workers for the various geometry typs.

roll-up is also used to build Cesium Viewer, which is now an ES6 app.

We use clean-css via gulp and it is also a straightforward change from requirejs that requires no special mention.

Workers
While the spec allows for ES6 Web Workers, no browser actually supports them yet. That means we needed a way to get our workers into non-ES6 form. Thankfully, roll-up can generate AMD modules, which means we now have a build step to compile our Worker source code back into AMD and use the existing TaskProcessor to load and execute them. This build step is part of the standard build task and is called createWorkers. During development, these "built" workers are un-optimized so you can still debug them and read the code.

Since there is a build step, that means if you are changing code that affects a worker, you need to re-run build, or you can use the build-watch task to do it automatically.

The ES6 versions of Worker code has moved into Source/WorkersES6 and we build the workers into their "old home" of Source/Workers. cesiumWorkerBootstrapper and transferTypedArrayTest which were already non-AMD ES5 scripts remain living in the Workers directory.

Surprisingly little was changed about TaskProcessor or the worker system in general, especially considering that I thought this would be one of the major hurdles.

ThirdParty
A lot of our ThirdParty either already had a hand-written wrapper for AMD (which I updated to ES6) or had UMD which created problems when importing the same code in both Node and the browser. I basically had to update the wrapper of every third-party library to fix these problems. In some cases I updated the library version itself (Autolinker, topojson). Nothing to be too concerned about, but future clean-up would be using npm versions of these libraries and auto-generating the wrappers as needed so we don't hand-edit things.

Sandcastle
Sandcastle is eternal and manages to live another day in it's ancient requirejs/dojo 1.x form. Sandcastle now automatically uses the ES6 version of Cesium if it is available and fallsback to the ES5 unminified version if it is now. The built version of Sandcastle always uses CesiumUnminified, just like master. This means Sandcastle still works in IE11 if you run the combine step first (or use the relase zip)

Removed Cesium usage from Sandcastle proper, since it wasn't really needed
Generate a VERSION propertyin the gallery index since Cesium is no longer being included.
Remove requirejs from Sandcastle bucket
Update bucket to use the built version of Cesium if it is available by fallbackto the ES6 version during development.
Standalone.html was also updated
There's a bit of room for further clean-up here, but I think this gets us into master. I did not rename bucket-requirejs.html because I'm pretty sure it would break previously shared demos. We can put in some backwards compatible code later on if we want. (But I'd rather just see a full Sandcastle rewrite).

Specs
Specs are now all ES6, except for TestWorkers, which remain standard JS worker modules. This means you can no longer run the unbuilt unit tests in IE11. No changes for Chrome and Firefox.

Since the specs use ES6 modules and built Cesium is an ES5 UMD, I added a build-specs build step which generates a combined ES5 version of the specs which rely on Cesium as a global variable. We then inject these files into jasmine instead of the standard specs and everything works exactly as it did before. SpecRunner.html has been updated to inject the correct version of the script depending on the build/release query parameters.

The Specs must always use Cesium by importing Source/Cesium.js, this is so we can replace it with the built Cesium as describe above.

There's a bunch of room for clean-up here, such as unifying our two copies of jasmine into a single helper file, but I didn't want to start doing that clean-up as part of this already overly big PR. The important thing is that we can still test the built version and still test on IE/Edge as needed.

I also found and fixed two bugs that were causing failing unit tests, one in BingMapsImageryProviderSpec.js (which was overwriting createImage andnot setting it back) and ShadowVolumeAppearance.js (which had a module level caching bug). I think these may have been the cause of random CI failures in master as well, but only time will tell.

For coverage, we had to switch to karma-coverage-istanbul-instrumenter for native ES6 support, but that's it.

Finally, I updated appveryor to build Cesium and run the built tests under IE. We still don't fail the build for IE, but we should probably fix that if we want to keep it going.

NodeJS
When NODE_ENV is production, we now require in the minified CesiumJS directly, which works great because it's now a UMD module. Otherwise, we use the excellant esmpackage to load individual modules, it was a fairly straightforward swap from our old requirejs usage. We could probably drop esm too if we don't care about debugging or if we provie source maps at some point.
2019-10-03 11:51:23 -04:00
hpinkos 4d6d478f97 Merge branch 'master' into no-imagery-functions 2019-01-04 10:27:13 -05:00
Scott Hunter adc8cccf28 Add additional query parameter options to CesiumViewer.
sourceType=czml/geojson/kml specifies the type of data to allow loading
URLs which don't have a file extension (such as a web service).

flyTo=false optionally disables the automatic flyTo after loading data.
2018-03-14 09:45:44 -04:00
Matthew Amato 7844a5f0c3 STK World Terrain -> Cesium World Terrain
1. Remove all `STK World Terrain` usage/references and replace them with
`Cesium World Terrain`.
2. Add new `createWorldTerrain` helper function for creating the world
terrain. Same defaults for extensions as CesiumTerrainProvider(no normals
or water).
3. Replace all World Terrain examples and doc with `createWorldTerrain`.
We were needlessly setting `requestWaterMask` and `requestVertexNormals`
to true in most examples, so I just changed it to use the default behavior
to simplify the code.
4. Add a deprecation warning and deprecation Credit when `assets.agi.com`
is detected. Note that this includes ArcticDEM and PAMap, which are still
being used in this PR but will be replaced in a follow-up PR after this
is merged.
2018-02-26 15:05:04 -05:00
hpinkos 99881167b8 cleanup 2018-02-13 11:14:18 -05:00
hpinkos 2c7febcbc2 createOpenStreetMapImageryProvider -> OpenStreetMapImageryProvider
createTileMapServiceImageryProvider -> TileMapServiceImageryProvider
2018-02-09 15:25:42 -05:00
hpinkos 93d1d37c15 Fixes #6192 2018-02-08 17:26:17 -05:00
ggetz f9c0578b0c Updated CHANGES.md, add requestRender mode to CesiumViewer.js 2018-01-26 10:14:18 -05:00
hpinkos a6d1767d88 Fixes #5691 2017-08-01 11:57:00 -04:00
Ottavio Hartman 337ad9d7eb Remove global define and global defineSuite 2017-06-28 17:10:51 -04:00
Ottavio Hartman 9ec947c0ab Move rule to shared config and update CHANGES.md 2017-06-23 09:26:29 -04:00
Ottavio Hartman 41e95c3bc1 Fix merge conflicts 2017-06-23 09:22:53 -04:00
Ottavio Hartman 6916eeab6b Re-add rule to index.js. Fix errors in Shadows.html 2017-06-19 16:32:08 -04:00
Ottavio Hartman b2de61ab64 Merge remote-tracking branch 'upstream/master' into block_scoped_var 2017-06-19 15:07:07 -04:00
Ottavio M. Hartman f0e619be14 Merge branch 'master' into no_use_before_define 2017-06-19 14:49:53 -04:00
Ottavio Hartman 7a734ccc60 Enable block-scoped-var rule 2017-06-16 12:53:12 -04:00
Ottavio Hartman 80cfed7224 Enable no-use-before-define rule for classes and variables. Fix or suppress errors 2017-06-15 18:18:54 -04:00
Ottavio Hartman 02b0766785 Add no-alert rule and suppress ESLint errors inline 2017-06-15 17:12:41 -04:00
Frederic Junod 8ba5ce1797 Remove unused require 2016-11-22 16:44:04 +01:00
Tom Fili 4a9b916cd8 Removed deprecation warnings in KmlDataSource and we now throw if camera or canvas isn't passed in. 2016-06-01 10:37:15 -04:00
Sanuj 04216d0204 Replace "use strict" by 'use strict' 2016-02-09 11:07:51 +05:30
hpinkos c0de75c3f9 Copy from tiffanylu/cesium tileMapServiceImageryProvider branch 2016-01-22 14:58:52 -05:00
Matthew Amato 328bfd3d8f Initial changes required to publish Cesium to NPM
1. Clean up code so `Source/Cesium.js` loads cleanly in a Node app.
Not all functionality is supported or tested.
2. Remove some unecessary jsHint global configurations
3. Add `.npmignore` so we include the minimum needed to use Cesium in a browser or from within Node.
4. Update NPM modules to latest version.
5. `requirejs` is now a non-dev dependancy for publishing to NPM.
6. Add `index.js` for requiring Cesium as an NPM module.
7. Update package.json with info needed for NPM publishing.
2015-11-24 17:35:57 -05:00