Domanda

I've been going around in circles trying to get the Cesium dependencies not to import when they're imported from the "combined" Cesium.js.

I've got this code to a stage where it's correctly finding the path of Cesium files, but it is loading up 100's of them, instead of only the combined Build/Cesium.js and the CesiumViewerWidget (which doesn't seem to be included in combined). e.g. One of the many files it loads is Source/Core/Clock.js which is built into Build/Cesium.js.

How can I tell dojo or CesiumViewerWidget to assume the core dependencies are already there?

I'm running this with Rails, hence the /assets/ path.

The code I'm working with:

<script src="/assets/cesium/Build/Cesium.js" type="text/javascript"></script>
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.8.0/dojo/dojo.js" type="text/javascript"></script>

require({
    baseUrl: '/assets/cesium/Source/Widgets',
    packages: [
        // {name: 'Cesium', location: '../../Build/Cesium'},
        {name: 'Widgets/Dojo/CesiumViewerWidget'},
        // {name: 'dojo/on', location: 'dojo/on'},
        // {name: 'dojo/dom', location: 'dojo/dom'},
        // {name: 'dojo/io-query', location: 'dojo/io-query'}
    ]},
    [
        'Widgets/Dojo/CesiumViewerWidget',
        'dojo/on', 'dojo/dom', 'dojo/io-query'
    ], function(CesiumViewerWidget, on, dom, ioQuery) {
})
È stato utile?

Soluzione

After asking on the cesium-dev mailing list, I got an answer.

Basically, the combined Cesium.js is not meant to work with the dojo require() dependencies. It is a matter of removing the dependencies and using the global Cesium object that is available when including the combined Cesium.js file.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top