cesium api克隆和开发如何使用requirejs什么是铯的依赖

时间:2014-06-26 10:16:00

标签: javascript requirejs cesium

我想克隆cesium git并更改javascript文件。我不想添加缩小文件是Build / Cesium.js我想使用separeted javascript文件。 我的代码

   <script data-main="scripts/main" src="../ThirdParty/requirejs-2.1.9/require.js"></script>

  <style>
      @import url(../Source/Widgets/widgets.css);
  </style>
</head>
<body>
  <div id="cesiumContainer"></div>
  <script>
  require(["Widgets/Viewer/Viewer"], function(util) {
    //This function is called when scripts/helper/util.js is loaded.
    //If util.js calls define(), then this function is not fired until
    //util's dependencies have loaded, and the util argument will hold
    //the module value for "helper/util".
    var viewer = new Cesium.Viewer('cesiumContainer');
});

错误:

GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Cesium.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Cesium
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/GlobeFS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/GlobeFS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/GlobeFSDepth.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/GlobeFSDepth
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/GlobeFSPole.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/GlobeFSPole
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/GlobeVS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/GlobeVS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/GlobeVSDepth.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/GlobeVSDepth
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/GlobeVSPole.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/GlobeVSPole
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/SkyAtmosphereFS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/SkyAtmosphereFS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/SkyAtmosphereVS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/SkyAtmosphereVS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/SkyBoxFS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/SkyBoxFS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/SkyBoxVS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/SkyBoxVS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/SunFS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/SunFS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/SunTextureFS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/SunTextureFS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/SunVS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/SunVS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/BillboardCollectionFS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/BillboardCollectionFS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/BillboardCollectionVS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/BillboardCollectionVS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/CustomSensorVolumeFS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/CustomSensorVolumeFS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/CustomSensorVolumeVS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/CustomSensorVolumeVS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/SensorVolume.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/SensorVolume
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Materials/BumpMapMaterial.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Materials/BumpMapMaterial
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Materials/CheckerboardMaterial.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Materials/CheckerboardMaterial
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Materials/DotMaterial.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Materials/DotMaterial
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Materials/FadeMaterial.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Materials/FadeMaterial
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Materials/FresnelMaterial.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Materials/FresnelMaterial
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Materials/GridMaterial.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Materials/GridMaterial
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Materials/NormalMapMaterial.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Materials/NormalMapMaterial
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Materials/PolylineArrowMaterial.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Materials/PolylineArrowMaterial
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Materials/PolylineGlowMaterial.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Materials/PolylineGlowMaterial
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Materials/PolylineOutlineMaterial.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Materials/PolylineOutlineMaterial
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Materials/ReflectionMaterial.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Materials/ReflectionMaterial
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Materials/RefractionMaterial.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Materials/RefractionMaterial
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Materials/RimLightingMaterial.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Materials/RimLightingMaterial
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Materials/StripeMaterial.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Materials/StripeMaterial
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Materials/Water.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Materials/Water
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/PolylineCommon.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/PolylineCommon
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/PolylineFS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/PolylineFS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/PolylineVS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/PolylineVS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Appearances/AllMaterialAppearanceFS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Appearances/AllMaterialAppearanceFS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Appearances/AllMaterialAppearanceVS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Appearances/AllMaterialAppearanceVS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Appearances/BasicMaterialAppearanceFS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Appearances/BasicMaterialAppearanceFS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Appearances/BasicMaterialAppearanceVS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Appearances/BasicMaterialAppearanceVS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Appearances/TexturedMaterialAppearanceFS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Appearances/TexturedMaterialAppearanceFS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Appearances/TexturedMaterialAppearanceVS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Appearances/TexturedMaterialAppearanceVS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Appearances/PerInstanceColorAppearanceFS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Appearances/PerInstanceColorAppearanceFS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Appearances/PerInstanceColorAppearanceVS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Appearances/PerInstanceColorAppearanceVS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Appearances/PerInstanceFlatColorAppearanceFS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Appearances/PerInstanceFlatColorAppearanceVS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Appearances/PolylineColorAppearanceVS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Appearances/PolylineColorAppearanceVS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Appearances/PolylineMaterialAppearanceVS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Appearances/PolylineMaterialAppearanceVS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/EllipsoidFS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/EllipsoidFS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/EllipsoidVS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/EllipsoidVS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/ViewportQuadVS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/ViewportQuadVS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/PostProcessFilters/FXAA.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/PostProcessFilters/FXAA
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/AdjustTranslucentFS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/AdjustTranslucentFS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/CompositeOITFS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/CompositeOITFS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/PostProcessFilters/AdditiveBlend.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/PostProcessFilters/AdditiveBlend
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/PostProcessFilters/BrightPass.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/PostProcessFilters/BrightPass
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/PostProcessFilters/GaussianBlur1D.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/PostProcessFilters/GaussianBlur1D
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/PostProcessFilters/PassThrough.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/PostProcessFilters/PassThrough
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/ReprojectWebMercatorFS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/ReprojectWebMercatorFS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/ReprojectWebMercatorVS.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/ReprojectWebMercatorVS
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET file:///C:/Users/eesirik/Desktop/cesium-master/Apps/scripts/Shaders/Builtin/CzmBuiltins.js net::ERR_FILE_NOT_FOUND require.js:1881
Uncaught Error: Script error for: Shaders/Builtin/CzmBuiltins
http://requirejs.org/docs/errors.html#scripterror 

它说需要Cesium.js,但我想在开发模式下工作。

2 个答案:

答案 0 :(得分:1)

大多数Cesium Sandcastle示例都是功能齐全的RequireJS应用程序,您可以将其用作如何正确引用Source树作为AMD模块的示例。

例如:

https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Apps/Sandcastle/gallery/Cesium%20Widget.html

记下设置require.config的{​​{1}}号召唤。然后,当需要baseUrl模块时,可以在Cesium文件夹中找到它。

Source

答案 1 :(得分:1)

位于Apps \ CesiumViewer中的CesiumViewer参考应用程序是一个独立的基于requireJS的Cesium应用程序,您可以将其作为起点。