index.d.ts 98 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684
  1. import { BoundingSphere,
  2. Cartesian2,
  3. Cartesian3,
  4. Clock,
  5. ClockRange,
  6. ClockStep,
  7. Color,
  8. Credit,
  9. Ellipsoid,
  10. EllipsoidTerrainProvider,
  11. Event,
  12. Fullscreen,
  13. GeocoderService,
  14. GeographicProjection,
  15. HeadingPitchRange,
  16. Ion,
  17. JulianDate,
  18. MapProjection,
  19. Plane,
  20. Proxy,
  21. Rectangle,
  22. ReferenceFrame,
  23. Request,
  24. Resource,
  25. ScreenSpaceEventHandler,
  26. TerrainProvider,
  27. Transforms,
  28. WebMercatorProjection,
  29. buildModuleUrl,
  30. defined,
  31. DataSource,
  32. DataSourceClock,
  33. DataSourceCollection,
  34. DataSourceDisplay,
  35. Entity,
  36. EntityCollection,
  37. Camera,
  38. Cesium3DTile,
  39. Cesium3DTileColorBlendMode,
  40. Cesium3DTileFeature,
  41. Cesium3DTileset,
  42. ColorBlendMode,
  43. CreditDisplay,
  44. DebugModelMatrixPrimitive,
  45. Globe,
  46. ImageryLayer,
  47. ImageryLayerCollection,
  48. ImageryProvider,
  49. IonImageryProvider,
  50. Label,
  51. Light,
  52. MapMode2D,
  53. Model,
  54. Moon,
  55. OpenStreetMapImageryProvider,
  56. PostProcessStage,
  57. PostProcessStageCollection,
  58. Primitive,
  59. Scene,
  60. SceneMode,
  61. SceneTransforms,
  62. ShadowMap,
  63. ShadowMode,
  64. SkyAtmosphere,
  65. SkyBox,
  66. Sun,
  67. Terrain,
  68. TileMapServiceImageryProvider,
  69. TimeDynamicPointCloud,
  70. VoxelPrimitive,
  71. createWorldImagery,
  72. CesiumWidget } from "@cesium/engine";
  73. declare module "@cesium/widgets" {
  74. /**
  75. * Options to control the setting up of a WebGL Context.
  76. * <p>
  77. * <code>allowTextureFilterAnisotropic</code> defaults to true, which enables
  78. * anisotropic texture filtering when the WebGL extension is supported.
  79. * Setting this to false will improve performance, but hurt visual quality,
  80. * especially for horizon views.
  81. * </p>
  82. * @property [requestWebgl1 = false] - If true and the browser supports it, use a WebGL 1 rendering context
  83. * @property [allowTextureFilterAnisotropic = true] - If true, use anisotropic filtering during texture sampling
  84. * @property [webgl] - WebGL options to be passed on to canvas.getContext
  85. * @property [getWebGLStub] - A function to create a WebGL stub for testing
  86. */
  87. export type ContextOptions = {
  88. requestWebgl1?: boolean;
  89. allowTextureFilterAnisotropic?: boolean;
  90. webgl?: WebGLOptions;
  91. getWebGLStub?: (...params: any[]) => any;
  92. };
  93. /**
  94. * WebGL options to be passed on to HTMLCanvasElement.getContext().
  95. * See {@link https://registry.khronos.org/webgl/specs/latest/1.0/#5.2|WebGLContextAttributes}
  96. * but note the modified defaults for 'alpha', 'stencil', and 'powerPreference'
  97. *
  98. * <p>
  99. * <code>alpha</code> defaults to false, which can improve performance
  100. * compared to the standard WebGL default of true. If an application needs
  101. * to composite Cesium above other HTML elements using alpha-blending, set
  102. * <code>alpha</code> to true.
  103. * </p>
  104. */
  105. export type WebGLOptions = {
  106. alpha?: boolean;
  107. depth?: boolean;
  108. stencil?: boolean;
  109. antialias?: boolean;
  110. premultipliedAlpha?: boolean;
  111. preserveDrawingBuffer?: boolean;
  112. powerPreference?: "default" | "low-power" | "high-performance";
  113. failIfMajorPerformanceCaveat?: boolean;
  114. };
  115. /**
  116. * <span style="display: block; text-align: center;">
  117. * <img src="Images/AnimationWidget.png" width="211" height="142" alt="" />
  118. * <br />Animation widget
  119. * </span>
  120. * <br /><br />
  121. * The Animation widget provides buttons for play, pause, and reverse, along with the
  122. * current time and date, surrounded by a "shuttle ring" for controlling the speed of animation.
  123. * <br /><br />
  124. * The "shuttle ring" concept is borrowed from video editing, where typically a
  125. * "jog wheel" can be rotated to move past individual animation frames very slowly, and
  126. * a surrounding shuttle ring can be twisted to control direction and speed of fast playback.
  127. * Cesium typically treats time as continuous (not broken into pre-defined animation frames),
  128. * so this widget offers no jog wheel. Instead, the shuttle ring is capable of both fast and
  129. * very slow playback. Click and drag the shuttle ring pointer itself (shown above in green),
  130. * or click in the rest of the ring area to nudge the pointer to the next preset speed in that direction.
  131. * <br /><br />
  132. * The Animation widget also provides a "realtime" button (in the upper-left) that keeps
  133. * animation time in sync with the end user's system clock, typically displaying
  134. * "today" or "right now." This mode is not available in {@link ClockRange.CLAMPED} or
  135. * {@link ClockRange.LOOP_STOP} mode if the current time is outside of {@link Clock}'s startTime and endTime.
  136. * @example
  137. * // In HTML head, include a link to Animation.css stylesheet,
  138. * // and in the body, include: <div id="animationContainer"></div>
  139. *
  140. * const clock = new Cesium.Clock();
  141. * const clockViewModel = new Cesium.ClockViewModel(clock);
  142. * const viewModel = new Cesium.AnimationViewModel(clockViewModel);
  143. * const widget = new Cesium.Animation('animationContainer', viewModel);
  144. *
  145. * function tick() {
  146. * clock.tick();
  147. * requestAnimationFrame(tick);
  148. * }
  149. * requestAnimationFrame(tick);
  150. * @param container - The DOM element or ID that will contain the widget.
  151. * @param viewModel - The view model used by this widget.
  152. */
  153. export class Animation {
  154. constructor(container: Element | string, viewModel: AnimationViewModel);
  155. /**
  156. * Gets the parent container.
  157. */
  158. readonly container: Element;
  159. /**
  160. * Gets the view model.
  161. */
  162. readonly viewModel: AnimationViewModel;
  163. /**
  164. * @returns true if the object has been destroyed, false otherwise.
  165. */
  166. isDestroyed(): boolean;
  167. /**
  168. * Destroys the animation widget. Should be called if permanently
  169. * removing the widget from layout.
  170. */
  171. destroy(): void;
  172. /**
  173. * Resizes the widget to match the container size.
  174. * This function should be called whenever the container size is changed.
  175. */
  176. resize(): void;
  177. /**
  178. * Updates the widget to reflect any modified CSS rules for theming.
  179. * @example
  180. * //Switch to the cesium-lighter theme.
  181. * document.body.className = 'cesium-lighter';
  182. * animation.applyThemeChanges();
  183. */
  184. applyThemeChanges(): void;
  185. }
  186. /**
  187. * The view model for the {@link Animation} widget.
  188. * @param clockViewModel - The ClockViewModel instance to use.
  189. */
  190. export class AnimationViewModel {
  191. constructor(clockViewModel: ClockViewModel);
  192. /**
  193. * Gets or sets whether the shuttle ring is currently being dragged. This property is observable.
  194. */
  195. shuttleRingDragging: boolean;
  196. /**
  197. * Gets or sets whether dragging the shuttle ring should cause the multiplier
  198. * to snap to the defined tick values rather than interpolating between them.
  199. * This property is observable.
  200. */
  201. snapToTicks: boolean;
  202. /**
  203. * Gets the string representation of the current time. This property is observable.
  204. */
  205. timeLabel: string;
  206. /**
  207. * Gets the string representation of the current date. This property is observable.
  208. */
  209. dateLabel: string;
  210. /**
  211. * Gets the string representation of the current multiplier. This property is observable.
  212. */
  213. multiplierLabel: string;
  214. /**
  215. * Gets or sets the current shuttle ring angle. This property is observable.
  216. */
  217. shuttleRingAngle: number;
  218. /**
  219. * Gets or sets the default date formatter used by new instances.
  220. */
  221. static defaultDateFormatter: AnimationViewModel.DateFormatter;
  222. /**
  223. * Gets or sets the default array of known clock multipliers associated with new instances of the shuttle ring.
  224. */
  225. static defaultTicks: number[];
  226. /**
  227. * Gets or sets the default time formatter used by new instances.
  228. */
  229. static defaultTimeFormatter: AnimationViewModel.TimeFormatter;
  230. /**
  231. * Gets a copy of the array of positive known clock multipliers to associate with the shuttle ring.
  232. * @returns The array of known clock multipliers associated with the shuttle ring.
  233. */
  234. getShuttleRingTicks(): number[];
  235. /**
  236. * Sets the array of positive known clock multipliers to associate with the shuttle ring.
  237. * These values will have negative equivalents created for them and sets both the minimum
  238. * and maximum range of values for the shuttle ring as well as the values that are snapped
  239. * to when a single click is made. The values need not be in order, as they will be sorted
  240. * automatically, and duplicate values will be removed.
  241. * @param positiveTicks - The list of known positive clock multipliers to associate with the shuttle ring.
  242. */
  243. setShuttleRingTicks(positiveTicks: number[]): void;
  244. /**
  245. * Gets a command that decreases the speed of animation.
  246. */
  247. slower: Command;
  248. /**
  249. * Gets a command that increases the speed of animation.
  250. */
  251. faster: Command;
  252. /**
  253. * Gets the clock view model.
  254. */
  255. clockViewModel: ClockViewModel;
  256. /**
  257. * Gets the pause toggle button view model.
  258. */
  259. pauseViewModel: ToggleButtonViewModel;
  260. /**
  261. * Gets the reverse toggle button view model.
  262. */
  263. playReverseViewModel: ToggleButtonViewModel;
  264. /**
  265. * Gets the play toggle button view model.
  266. */
  267. playForwardViewModel: ToggleButtonViewModel;
  268. /**
  269. * Gets the realtime toggle button view model.
  270. */
  271. playRealtimeViewModel: ToggleButtonViewModel;
  272. /**
  273. * Gets or sets the function which formats a date for display.
  274. */
  275. dateFormatter: AnimationViewModel.DateFormatter;
  276. /**
  277. * Gets or sets the function which formats a time for display.
  278. */
  279. timeFormatter: AnimationViewModel.TimeFormatter;
  280. }
  281. export namespace AnimationViewModel {
  282. /**
  283. * A function that formats a date for display.
  284. * @param date - The date to be formatted
  285. * @param viewModel - The AnimationViewModel instance requesting formatting.
  286. */
  287. type DateFormatter = (date: JulianDate, viewModel: AnimationViewModel) => string;
  288. /**
  289. * A function that formats a time for display.
  290. * @param date - The date to be formatted
  291. * @param viewModel - The AnimationViewModel instance requesting formatting.
  292. */
  293. type TimeFormatter = (date: JulianDate, viewModel: AnimationViewModel) => string;
  294. }
  295. /**
  296. * <span style="display: block; text-align: center;">
  297. * <img src="Images/BaseLayerPicker.png" width="264" height="287" alt="" />
  298. * <br />BaseLayerPicker with its drop-panel open.
  299. * </span>
  300. * <br /><br />
  301. * The BaseLayerPicker is a single button widget that displays a panel of available imagery and
  302. * terrain providers. When imagery is selected, the corresponding imagery layer is created and inserted
  303. * as the base layer of the imagery collection; removing the existing base. When terrain is selected,
  304. * it replaces the current terrain provider. Each item in the available providers list contains a name,
  305. * a representative icon, and a tooltip to display more information when hovered. The list is initially
  306. * empty, and must be configured before use, as illustrated in the below example.
  307. * @example
  308. * // In HTML head, include a link to the BaseLayerPicker.css stylesheet,
  309. * // and in the body, include: <div id="baseLayerPickerContainer"
  310. * // style="position:absolute;top:24px;right:24px;width:38px;height:38px;"></div>
  311. *
  312. * //Create the list of available providers we would like the user to select from.
  313. * //This example uses 3, OpenStreetMap, The Black Marble, and a single, non-streaming world image.
  314. * const imageryViewModels = [];
  315. * imageryViewModels.push(new Cesium.ProviderViewModel({
  316. * name: "Open\u00adStreet\u00adMap",
  317. * iconUrl: Cesium.buildModuleUrl("Widgets/Images/ImageryProviders/openStreetMap.png"),
  318. * tooltip: "OpenStreetMap (OSM) is a collaborative project to create a free editable \
  319. * map of the world.\nhttp://www.openstreetmap.org",
  320. * creationFunction: function() {
  321. * return new Cesium.OpenStreetMapImageryProvider({
  322. * url: "https://a.tile.openstreetmap.org/"
  323. * });
  324. * }
  325. * }));
  326. *
  327. * imageryViewModels.push(new Cesium.ProviderViewModel({
  328. * name: "Earth at Night",
  329. * iconUrl: Cesium.buildModuleUrl("Widgets/Images/ImageryProviders/blackMarble.png"),
  330. * tooltip: "The lights of cities and villages trace the outlines of civilization \
  331. * in this global view of the Earth at night as seen by NASA/NOAA's Suomi NPP satellite.",
  332. * creationFunction: function() {
  333. * return Cesium.IonImageryProvider.fromAssetId(3812);
  334. * }
  335. * }));
  336. *
  337. * imageryViewModels.push(new Cesium.ProviderViewModel({
  338. * name: "Natural Earth\u00a0II",
  339. * iconUrl: Cesium.buildModuleUrl("Widgets/Images/ImageryProviders/naturalEarthII.png"),
  340. * tooltip: "Natural Earth II, darkened for contrast.\nhttp://www.naturalearthdata.com/",
  341. * creationFunction: function() {
  342. * return Cesium.TileMapServiceImageryProvider.fromUrl(
  343. * Cesium.buildModuleUrl("Assets/Textures/NaturalEarthII")
  344. * );
  345. * }
  346. * }));
  347. *
  348. * //Create a CesiumWidget without imagery, if you haven't already done so.
  349. * const cesiumWidget = new Cesium.CesiumWidget("cesiumContainer", { baseLayer: false });
  350. *
  351. * //Finally, create the baseLayerPicker widget using our view models.
  352. * const layers = cesiumWidget.imageryLayers;
  353. * const baseLayerPicker = new Cesium.BaseLayerPicker("baseLayerPickerContainer", {
  354. * globe: cesiumWidget.scene.globe,
  355. * imageryProviderViewModels: imageryViewModels
  356. * });
  357. * @param container - The parent HTML container node or ID for this widget.
  358. * @param options - Object with the following properties:
  359. * @param options.globe - The Globe to use.
  360. * @param [options.imageryProviderViewModels = []] - The array of ProviderViewModel instances to use for imagery.
  361. * @param [options.selectedImageryProviderViewModel] - The view model for the current base imagery layer, if not supplied the first available imagery layer is used.
  362. * @param [options.terrainProviderViewModels = []] - The array of ProviderViewModel instances to use for terrain.
  363. * @param [options.selectedTerrainProviderViewModel] - The view model for the current base terrain layer, if not supplied the first available terrain layer is used.
  364. */
  365. export class BaseLayerPicker {
  366. constructor(container: Element | string, options: {
  367. globe: Globe;
  368. imageryProviderViewModels?: ProviderViewModel[];
  369. selectedImageryProviderViewModel?: ProviderViewModel;
  370. terrainProviderViewModels?: ProviderViewModel[];
  371. selectedTerrainProviderViewModel?: ProviderViewModel;
  372. });
  373. /**
  374. * Gets the parent container.
  375. */
  376. container: Element;
  377. /**
  378. * Gets the view model.
  379. */
  380. viewModel: BaseLayerPickerViewModel;
  381. /**
  382. * @returns true if the object has been destroyed, false otherwise.
  383. */
  384. isDestroyed(): boolean;
  385. /**
  386. * Destroys the widget. Should be called if permanently
  387. * removing the widget from layout.
  388. */
  389. destroy(): void;
  390. }
  391. /**
  392. * The view model for {@link BaseLayerPicker}.
  393. * @param options - Object with the following properties:
  394. * @param options.globe - The Globe to use.
  395. * @param [options.imageryProviderViewModels = []] - The array of ProviderViewModel instances to use for imagery.
  396. * @param [options.selectedImageryProviderViewModel] - The view model for the current base imagery layer, if not supplied the first available imagery layer is used.
  397. * @param [options.terrainProviderViewModels = []] - The array of ProviderViewModel instances to use for terrain.
  398. * @param [options.selectedTerrainProviderViewModel] - The view model for the current base terrain layer, if not supplied the first available terrain layer is used.
  399. */
  400. export class BaseLayerPickerViewModel {
  401. constructor(options: {
  402. globe: Globe;
  403. imageryProviderViewModels?: ProviderViewModel[];
  404. selectedImageryProviderViewModel?: ProviderViewModel;
  405. terrainProviderViewModels?: ProviderViewModel[];
  406. selectedTerrainProviderViewModel?: ProviderViewModel;
  407. });
  408. /**
  409. * Gets or sets an array of ProviderViewModel instances available for imagery selection.
  410. * This property is observable.
  411. */
  412. imageryProviderViewModels: ProviderViewModel[];
  413. /**
  414. * Gets or sets an array of ProviderViewModel instances available for terrain selection.
  415. * This property is observable.
  416. */
  417. terrainProviderViewModels: ProviderViewModel[];
  418. /**
  419. * Gets or sets whether the imagery selection drop-down is currently visible.
  420. */
  421. dropDownVisible: boolean;
  422. /**
  423. * Gets the button tooltip. This property is observable.
  424. */
  425. buttonTooltip: string;
  426. /**
  427. * Gets the button background image. This property is observable.
  428. */
  429. buttonImageUrl: string;
  430. /**
  431. * Gets or sets the currently selected imagery. This property is observable.
  432. */
  433. selectedImagery: ProviderViewModel;
  434. /**
  435. * Gets or sets the currently selected terrain. This property is observable.
  436. */
  437. selectedTerrain: ProviderViewModel;
  438. /**
  439. * Gets the command to toggle the visibility of the drop down.
  440. */
  441. toggleDropDown: Command;
  442. /**
  443. * Gets the globe.
  444. */
  445. globe: Globe;
  446. }
  447. /**
  448. * A view model that represents each item in the {@link BaseLayerPicker}.
  449. * @param options - The object containing all parameters.
  450. * @param options.name - The name of the layer.
  451. * @param options.tooltip - The tooltip to show when the item is moused over.
  452. * @param options.iconUrl - An icon representing the layer.
  453. * @param [options.category] - A category for the layer.
  454. * @param options.creationFunction - A function or Command
  455. * that creates one or more providers which will be added to the globe when this item is selected.
  456. */
  457. export class ProviderViewModel {
  458. constructor(options: {
  459. name: string;
  460. tooltip: string;
  461. iconUrl: string;
  462. category?: string;
  463. creationFunction: ProviderViewModel.CreationFunction | Command;
  464. });
  465. /**
  466. * Gets the display name. This property is observable.
  467. */
  468. name: string;
  469. /**
  470. * Gets the tooltip. This property is observable.
  471. */
  472. tooltip: string;
  473. /**
  474. * Gets the icon. This property is observable.
  475. */
  476. iconUrl: string;
  477. /**
  478. * Gets the Command that creates one or more providers which will be added to
  479. * the globe when this item is selected.
  480. */
  481. readonly creationCommand: Command;
  482. /**
  483. * Gets the category
  484. */
  485. readonly category: string;
  486. }
  487. export namespace ProviderViewModel {
  488. /**
  489. * A function which creates one or more providers.
  490. */
  491. type CreationFunction = () => ImageryProvider | TerrainProvider | ImageryProvider[] | TerrainProvider[] | Promise<TerrainProvider> | Promise<TerrainProvider[]>;
  492. }
  493. /**
  494. * Inspector widget to aid in debugging 3D Tiles
  495. * @param container - The DOM element or ID that will contain the widget.
  496. * @param scene - the Scene instance to use.
  497. */
  498. export class Cesium3DTilesInspector {
  499. constructor(container: Element | string, scene: Scene);
  500. /**
  501. * Gets the parent container.
  502. */
  503. container: Element;
  504. /**
  505. * Gets the view model.
  506. */
  507. viewModel: Cesium3DTilesInspectorViewModel;
  508. /**
  509. * @returns true if the object has been destroyed, false otherwise.
  510. */
  511. isDestroyed(): boolean;
  512. /**
  513. * Destroys the widget. Should be called if permanently
  514. * removing the widget from layout.
  515. */
  516. destroy(): void;
  517. }
  518. /**
  519. * The view model for {@link Cesium3DTilesInspector}.
  520. * @param scene - The scene instance to use.
  521. * @param performanceContainer - The container for the performance display
  522. */
  523. export class Cesium3DTilesInspectorViewModel {
  524. constructor(scene: Scene, performanceContainer: HTMLElement);
  525. /**
  526. * Gets or sets the flag to enable performance display. This property is observable.
  527. */
  528. performance: boolean;
  529. /**
  530. * Gets or sets the flag to show statistics. This property is observable.
  531. */
  532. showStatistics: boolean;
  533. /**
  534. * Gets or sets the flag to show pick statistics. This property is observable.
  535. */
  536. showPickStatistics: boolean;
  537. /**
  538. * Gets or sets the flag to show resource cache statistics. This property is
  539. * observable.
  540. */
  541. showResourceCacheStatistics: boolean;
  542. /**
  543. * Gets or sets the flag to show the inspector. This property is observable.
  544. */
  545. inspectorVisible: boolean;
  546. /**
  547. * Gets or sets the flag to show the tileset section. This property is observable.
  548. */
  549. tilesetVisible: boolean;
  550. /**
  551. * Gets or sets the flag to show the display section. This property is observable.
  552. */
  553. displayVisible: boolean;
  554. /**
  555. * Gets or sets the flag to show the update section. This property is observable.
  556. */
  557. updateVisible: boolean;
  558. /**
  559. * Gets or sets the flag to show the logging section. This property is observable.
  560. */
  561. loggingVisible: boolean;
  562. /**
  563. * Gets or sets the flag to show the style section. This property is observable.
  564. */
  565. styleVisible: boolean;
  566. /**
  567. * Gets or sets the flag to show the tile info section. This property is observable.
  568. */
  569. tileDebugLabelsVisible: boolean;
  570. /**
  571. * Gets or sets the flag to show the optimization info section. This property is observable.
  572. */
  573. optimizationVisible: boolean;
  574. /**
  575. * Gets or sets the JSON for the tileset style. This property is observable.
  576. */
  577. styleString: string;
  578. /**
  579. * Gets or sets the JSON for the tileset enableDebugWireframe attribute. This property is observable.
  580. */
  581. hasEnabledWireframe: boolean;
  582. /**
  583. * Gets the names of the properties in the tileset. This property is observable.
  584. */
  585. readonly properties: string[];
  586. /**
  587. * Gets or sets the flag to enable dynamic screen space error. This property is observable.
  588. */
  589. dynamicScreenSpaceError: boolean;
  590. /**
  591. * Gets or sets the color blend mode. This property is observable.
  592. */
  593. colorBlendMode: Cesium3DTileColorBlendMode;
  594. /**
  595. * Gets or sets the flag to enable picking. This property is observable.
  596. */
  597. picking: boolean;
  598. /**
  599. * Gets or sets the flag to colorize tiles. This property is observable.
  600. */
  601. colorize: boolean;
  602. /**
  603. * Gets or sets the flag to draw with wireframe. This property is observable.
  604. */
  605. wireframe: boolean;
  606. /**
  607. * Gets or sets the flag to show bounding volumes. This property is observable.
  608. */
  609. showBoundingVolumes: boolean;
  610. /**
  611. * Gets or sets the flag to show content volumes. This property is observable.
  612. */
  613. showContentBoundingVolumes: boolean;
  614. /**
  615. * Gets or sets the flag to show request volumes. This property is observable.
  616. */
  617. showRequestVolumes: boolean;
  618. /**
  619. * Gets or sets the flag to suspend updates. This property is observable.
  620. */
  621. freezeFrame: boolean;
  622. /**
  623. * Gets or sets the flag to show debug labels only for the currently picked tile. This property is observable.
  624. */
  625. showOnlyPickedTileDebugLabel: boolean;
  626. /**
  627. * Gets or sets the flag to show tile geometric error. This property is observable.
  628. */
  629. showGeometricError: boolean;
  630. /**
  631. * Displays the number of commands, points, triangles and features used per tile. This property is observable.
  632. */
  633. showRenderingStatistics: boolean;
  634. /**
  635. * Displays the memory used per tile. This property is observable.
  636. */
  637. showMemoryUsage: boolean;
  638. /**
  639. * Gets or sets the flag to show the tile url. This property is observable.
  640. */
  641. showUrl: boolean;
  642. /**
  643. * Gets or sets the maximum screen space error. This property is observable.
  644. */
  645. maximumScreenSpaceError: number;
  646. /**
  647. * Gets or sets the dynamic screen space error density. This property is observable.
  648. */
  649. dynamicScreenSpaceErrorDensity: number;
  650. /**
  651. * Gets or sets the dynamic screen space error density slider value.
  652. * This allows the slider to be exponential because values tend to be closer to 0 than 1.
  653. * This property is observable.
  654. */
  655. dynamicScreenSpaceErrorDensitySliderValue: number;
  656. /**
  657. * Gets or sets the dynamic screen space error factor. This property is observable.
  658. */
  659. dynamicScreenSpaceErrorFactor: number;
  660. /**
  661. * Gets or sets the flag to enable point cloud shading. This property is observable.
  662. */
  663. pointCloudShading: boolean;
  664. /**
  665. * Gets or sets the geometric error scale. This property is observable.
  666. */
  667. geometricErrorScale: number;
  668. /**
  669. * Gets or sets the maximum attenuation. This property is observable.
  670. */
  671. maximumAttenuation: number;
  672. /**
  673. * Gets or sets the base resolution. This property is observable.
  674. */
  675. baseResolution: number;
  676. /**
  677. * Gets or sets the flag to enable eye dome lighting. This property is observable.
  678. */
  679. eyeDomeLighting: boolean;
  680. /**
  681. * Gets or sets the eye dome lighting strength. This property is observable.
  682. */
  683. eyeDomeLightingStrength: number;
  684. /**
  685. * Gets or sets the eye dome lighting radius. This property is observable.
  686. */
  687. eyeDomeLightingRadius: number;
  688. /**
  689. * Gets or sets the pick state
  690. */
  691. pickActive: boolean;
  692. /**
  693. * Gets or sets the flag to determine if level of detail skipping should be applied during the traversal.
  694. * This property is observable.
  695. */
  696. skipLevelOfDetail: boolean;
  697. /**
  698. * Gets or sets the multiplier defining the minimum screen space error to skip. This property is observable.
  699. */
  700. skipScreenSpaceErrorFactor: number;
  701. /**
  702. * Gets or sets the screen space error that must be reached before skipping levels of detail. This property is observable.
  703. */
  704. baseScreenSpaceError: number;
  705. /**
  706. * Gets or sets the constant defining the minimum number of levels to skip when loading tiles. This property is observable.
  707. */
  708. skipLevels: number;
  709. /**
  710. * Gets or sets the flag which, when true, only tiles that meet the maximum screen space error will ever be downloaded.
  711. * This property is observable.
  712. */
  713. immediatelyLoadDesiredLevelOfDetail: boolean;
  714. /**
  715. * Gets or sets the flag which determines whether siblings of visible tiles are always downloaded during traversal.
  716. * This property is observable
  717. */
  718. loadSiblings: boolean;
  719. /**
  720. * Gets the scene
  721. */
  722. readonly scene: Scene;
  723. /**
  724. * Gets the performance container
  725. */
  726. readonly performanceContainer: HTMLElement;
  727. /**
  728. * Gets the statistics text. This property is observable.
  729. */
  730. readonly statisticsText: string;
  731. /**
  732. * Gets the pick statistics text. This property is observable.
  733. */
  734. readonly pickStatisticsText: string;
  735. /**
  736. * Gets the resource cache statistics text. This property is observable.
  737. */
  738. readonly resourceCacheStatisticsText: string;
  739. /**
  740. * Gets the available blend modes
  741. */
  742. readonly colorBlendModes: object[];
  743. /**
  744. * Gets the editor error message
  745. */
  746. readonly editorError: string;
  747. /**
  748. * Gets or sets the tileset of the view model.
  749. */
  750. tileset: Cesium3DTileset;
  751. /**
  752. * Gets the current feature of the view model.
  753. */
  754. feature: Cesium3DTileFeature;
  755. /**
  756. * Gets the current tile of the view model
  757. */
  758. tile: Cesium3DTile;
  759. /**
  760. * Toggles the pick tileset mode
  761. */
  762. togglePickTileset(): void;
  763. /**
  764. * Toggles the inspector visibility
  765. */
  766. toggleInspector(): void;
  767. /**
  768. * Toggles the visibility of the tileset section
  769. */
  770. toggleTileset(): void;
  771. /**
  772. * Toggles the visibility of the display section
  773. */
  774. toggleDisplay(): void;
  775. /**
  776. * Toggles the visibility of the update section
  777. */
  778. toggleUpdate(): void;
  779. /**
  780. * Toggles the visibility of the logging section
  781. */
  782. toggleLogging(): void;
  783. /**
  784. * Toggles the visibility of the style section
  785. */
  786. toggleStyle(): void;
  787. /**
  788. * Toggles the visibility of the tile Debug Info section
  789. */
  790. toggleTileDebugLabels(): void;
  791. /**
  792. * Toggles the visibility of the optimization section
  793. */
  794. toggleOptimization(): void;
  795. /**
  796. * Trims tile cache
  797. */
  798. trimTilesCache(): void;
  799. /**
  800. * Compiles the style in the style editor.
  801. */
  802. compileStyle(): void;
  803. /**
  804. * Handles key press events on the style editor.
  805. */
  806. styleEditorKeyPress(): void;
  807. /**
  808. * @returns true if the object has been destroyed, false otherwise.
  809. */
  810. isDestroyed(): boolean;
  811. /**
  812. * Destroys the widget. Should be called if permanently
  813. * removing the widget from layout.
  814. */
  815. destroy(): void;
  816. /**
  817. * Generates an HTML string of the statistics
  818. * @param tileset - The tileset
  819. * @param isPick - Whether this is getting the statistics for the pick pass
  820. * @returns The formatted statistics
  821. */
  822. static getStatistics(tileset: Cesium3DTileset, isPick: boolean): string;
  823. }
  824. /**
  825. * Inspector widget to aid in debugging
  826. * @param container - The DOM element or ID that will contain the widget.
  827. * @param scene - The Scene instance to use.
  828. */
  829. export class CesiumInspector {
  830. constructor(container: Element | string, scene: Scene);
  831. /**
  832. * Gets the parent container.
  833. */
  834. container: Element;
  835. /**
  836. * Gets the view model.
  837. */
  838. viewModel: CesiumInspectorViewModel;
  839. /**
  840. * @returns true if the object has been destroyed, false otherwise.
  841. */
  842. isDestroyed(): boolean;
  843. /**
  844. * Destroys the widget. Should be called if permanently
  845. * removing the widget from layout.
  846. */
  847. destroy(): void;
  848. }
  849. /**
  850. * The view model for {@link CesiumInspector}.
  851. * @param scene - The scene instance to use.
  852. * @param performanceContainer - The instance to use for performance container.
  853. */
  854. export class CesiumInspectorViewModel {
  855. constructor(scene: Scene, performanceContainer: Element);
  856. /**
  857. * Gets or sets the show frustums state. This property is observable.
  858. */
  859. frustums: boolean;
  860. /**
  861. * Gets or sets the show frustum planes state. This property is observable.
  862. */
  863. frustumPlanes: boolean;
  864. /**
  865. * Gets or sets the show performance display state. This property is observable.
  866. */
  867. performance: boolean;
  868. /**
  869. * Gets or sets the shader cache text. This property is observable.
  870. */
  871. shaderCacheText: string;
  872. /**
  873. * Gets or sets the show primitive bounding sphere state. This property is observable.
  874. */
  875. primitiveBoundingSphere: boolean;
  876. /**
  877. * Gets or sets the show primitive reference frame state. This property is observable.
  878. */
  879. primitiveReferenceFrame: boolean;
  880. /**
  881. * Gets or sets the filter primitive state. This property is observable.
  882. */
  883. filterPrimitive: boolean;
  884. /**
  885. * Gets or sets the show tile bounding sphere state. This property is observable.
  886. */
  887. tileBoundingSphere: boolean;
  888. /**
  889. * Gets or sets the filter tile state. This property is observable.
  890. */
  891. filterTile: boolean;
  892. /**
  893. * Gets or sets the show wireframe state. This property is observable.
  894. */
  895. wireframe: boolean;
  896. /**
  897. * Gets or sets the index of the depth frustum to display. This property is observable.
  898. */
  899. depthFrustum: number;
  900. /**
  901. * Gets or sets the suspend updates state. This property is observable.
  902. */
  903. suspendUpdates: boolean;
  904. /**
  905. * Gets or sets the show tile coordinates state. This property is observable.
  906. */
  907. tileCoordinates: boolean;
  908. /**
  909. * Gets or sets the frustum statistic text. This property is observable.
  910. */
  911. frustumStatisticText: string;
  912. /**
  913. * Gets or sets the selected tile information text. This property is observable.
  914. */
  915. tileText: string;
  916. /**
  917. * Gets if a primitive has been selected. This property is observable.
  918. */
  919. hasPickedPrimitive: boolean;
  920. /**
  921. * Gets if a tile has been selected. This property is observable
  922. */
  923. hasPickedTile: boolean;
  924. /**
  925. * Gets if the picking primitive command is active. This property is observable.
  926. */
  927. pickPrimitiveActive: boolean;
  928. /**
  929. * Gets if the picking tile command is active. This property is observable.
  930. */
  931. pickTileActive: boolean;
  932. /**
  933. * Gets or sets if the cesium inspector drop down is visible. This property is observable.
  934. */
  935. dropDownVisible: boolean;
  936. /**
  937. * Gets or sets if the general section is visible. This property is observable.
  938. */
  939. generalVisible: boolean;
  940. /**
  941. * Gets or sets if the primitive section is visible. This property is observable.
  942. */
  943. primitivesVisible: boolean;
  944. /**
  945. * Gets or sets if the terrain section is visible. This property is observable.
  946. */
  947. terrainVisible: boolean;
  948. /**
  949. * Gets or sets the index of the depth frustum text. This property is observable.
  950. */
  951. depthFrustumText: string;
  952. /**
  953. * Gets the scene to control.
  954. */
  955. scene: Scene;
  956. /**
  957. * Gets the container of the PerformanceDisplay
  958. */
  959. performanceContainer: Element;
  960. /**
  961. * Gets the command to toggle the visibility of the drop down.
  962. */
  963. toggleDropDown: Command;
  964. /**
  965. * Gets the command to toggle the visibility of a BoundingSphere for a primitive
  966. */
  967. showPrimitiveBoundingSphere: Command;
  968. /**
  969. * Gets the command to toggle the visibility of a {@link DebugModelMatrixPrimitive} for the model matrix of a primitive
  970. */
  971. showPrimitiveReferenceFrame: Command;
  972. /**
  973. * Gets the command to toggle a filter that renders only a selected primitive
  974. */
  975. doFilterPrimitive: Command;
  976. /**
  977. * Gets the command to increment the depth frustum index to be shown
  978. */
  979. incrementDepthFrustum: Command;
  980. /**
  981. * Gets the command to decrement the depth frustum index to be shown
  982. */
  983. decrementDepthFrustum: Command;
  984. /**
  985. * Gets the command to toggle the visibility of tile coordinates
  986. */
  987. showTileCoordinates: Command;
  988. /**
  989. * Gets the command to toggle the visibility of a BoundingSphere for a selected tile
  990. */
  991. showTileBoundingSphere: Command;
  992. /**
  993. * Gets the command to toggle a filter that renders only a selected tile
  994. */
  995. doFilterTile: Command;
  996. /**
  997. * Gets the command to expand and collapse the general section
  998. */
  999. toggleGeneral: Command;
  1000. /**
  1001. * Gets the command to expand and collapse the primitives section
  1002. */
  1003. togglePrimitives: Command;
  1004. /**
  1005. * Gets the command to expand and collapse the terrain section
  1006. */
  1007. toggleTerrain: Command;
  1008. /**
  1009. * Gets the command to pick a primitive
  1010. */
  1011. pickPrimitive: Command;
  1012. /**
  1013. * Gets the command to pick a tile
  1014. */
  1015. pickTile: Command;
  1016. /**
  1017. * Gets the command to pick a tile
  1018. */
  1019. selectParent: Command;
  1020. /**
  1021. * Gets the command to pick a tile
  1022. */
  1023. selectNW: Command;
  1024. /**
  1025. * Gets the command to pick a tile
  1026. */
  1027. selectNE: Command;
  1028. /**
  1029. * Gets the command to pick a tile
  1030. */
  1031. selectSW: Command;
  1032. /**
  1033. * Gets the command to pick a tile
  1034. */
  1035. selectSE: Command;
  1036. /**
  1037. * Gets or sets the current selected primitive
  1038. */
  1039. primitive: Command;
  1040. /**
  1041. * Gets or sets the current selected tile
  1042. */
  1043. tile: Command;
  1044. /**
  1045. * @returns true if the object has been destroyed, false otherwise.
  1046. */
  1047. isDestroyed(): boolean;
  1048. /**
  1049. * Destroys the widget. Should be called if permanently
  1050. * removing the widget from layout.
  1051. */
  1052. destroy(): void;
  1053. }
  1054. /**
  1055. * A view model which exposes a {@link Clock} for user interfaces.
  1056. * @param [clock] - The clock object wrapped by this view model, if undefined a new instance will be created.
  1057. */
  1058. export class ClockViewModel {
  1059. constructor(clock?: Clock);
  1060. /**
  1061. * Gets the current system time.
  1062. * This property is observable.
  1063. */
  1064. systemTime: JulianDate;
  1065. /**
  1066. * Gets or sets the start time of the clock.
  1067. * See {@link Clock#startTime}.
  1068. * This property is observable.
  1069. */
  1070. startTime: JulianDate;
  1071. /**
  1072. * Gets or sets the stop time of the clock.
  1073. * See {@link Clock#stopTime}.
  1074. * This property is observable.
  1075. */
  1076. stopTime: JulianDate;
  1077. /**
  1078. * Gets or sets the current time.
  1079. * See {@link Clock#currentTime}.
  1080. * This property is observable.
  1081. */
  1082. currentTime: JulianDate;
  1083. /**
  1084. * Gets or sets the clock multiplier.
  1085. * See {@link Clock#multiplier}.
  1086. * This property is observable.
  1087. */
  1088. multiplier: number;
  1089. /**
  1090. * Gets or sets the clock step setting.
  1091. * See {@link Clock#clockStep}.
  1092. * This property is observable.
  1093. */
  1094. clockStep: ClockStep;
  1095. /**
  1096. * Gets or sets the clock range setting.
  1097. * See {@link Clock#clockRange}.
  1098. * This property is observable.
  1099. */
  1100. clockRange: ClockRange;
  1101. /**
  1102. * Gets or sets whether the clock can animate.
  1103. * See {@link Clock#canAnimate}.
  1104. * This property is observable.
  1105. */
  1106. canAnimate: boolean;
  1107. /**
  1108. * Gets or sets whether the clock should animate.
  1109. * See {@link Clock#shouldAnimate}.
  1110. * This property is observable.
  1111. */
  1112. shouldAnimate: boolean;
  1113. /**
  1114. * Gets the underlying Clock.
  1115. */
  1116. clock: Clock;
  1117. /**
  1118. * Updates the view model with the contents of the underlying clock.
  1119. * Can be called to force an update of the viewModel if the underlying
  1120. * clock has changed and <code>Clock.tick</code> has not yet been called.
  1121. */
  1122. synchronize(): void;
  1123. /**
  1124. * @returns true if the object has been destroyed, false otherwise.
  1125. */
  1126. isDestroyed(): boolean;
  1127. /**
  1128. * Destroys the view model. Should be called to
  1129. * properly clean up the view model when it is no longer needed.
  1130. */
  1131. destroy(): void;
  1132. }
  1133. /**
  1134. * A Command is a function with an extra <code>canExecute</code> observable property to determine
  1135. * whether the command can be executed. When executed, a Command function will check the
  1136. * value of <code>canExecute</code> and throw if false.
  1137. *
  1138. * This type describes an interface and is not intended to be instantiated directly.
  1139. * See {@link createCommand} to create a command from a function.
  1140. */
  1141. export class Command {
  1142. constructor();
  1143. /**
  1144. * Gets whether this command can currently be executed. This property is observable.
  1145. */
  1146. canExecute: boolean;
  1147. /**
  1148. * Gets an event which is raised before the command executes, the event
  1149. * is raised with an object containing two properties: a <code>cancel</code> property,
  1150. * which if set to false by the listener will prevent the command from being executed, and
  1151. * an <code>args</code> property, which is the array of arguments being passed to the command.
  1152. */
  1153. beforeExecute: Event;
  1154. /**
  1155. * Gets an event which is raised after the command executes, the event
  1156. * is raised with the return value of the command as its only parameter.
  1157. */
  1158. afterExecute: Event;
  1159. }
  1160. /**
  1161. * A single button widget for toggling fullscreen mode.
  1162. * @param container - The DOM element or ID that will contain the widget.
  1163. * @param [fullscreenElement = document.body] - The element or id to be placed into fullscreen mode.
  1164. */
  1165. export class FullscreenButton {
  1166. constructor(container: Element | string, fullscreenElement?: Element | string);
  1167. /**
  1168. * Gets the parent container.
  1169. */
  1170. container: Element;
  1171. /**
  1172. * Gets the view model.
  1173. */
  1174. viewModel: FullscreenButtonViewModel;
  1175. /**
  1176. * @returns true if the object has been destroyed, false otherwise.
  1177. */
  1178. isDestroyed(): boolean;
  1179. /**
  1180. * Destroys the widget. Should be called if permanently
  1181. * removing the widget from layout.
  1182. */
  1183. destroy(): void;
  1184. }
  1185. /**
  1186. * The view model for {@link FullscreenButton}.
  1187. * @param [fullscreenElement = document.body] - The element or id to be placed into fullscreen mode.
  1188. * @param [container] - The DOM element or ID that will contain the widget.
  1189. */
  1190. export class FullscreenButtonViewModel {
  1191. constructor(fullscreenElement?: Element | string, container?: Element | string);
  1192. /**
  1193. * Gets whether or not fullscreen mode is active. This property is observable.
  1194. */
  1195. isFullscreen: boolean;
  1196. /**
  1197. * Gets or sets whether or not fullscreen functionality should be enabled. This property is observable.
  1198. */
  1199. isFullscreenEnabled: boolean;
  1200. /**
  1201. * Gets the tooltip. This property is observable.
  1202. */
  1203. tooltip: string;
  1204. /**
  1205. * Gets or sets the HTML element to place into fullscreen mode when the
  1206. * corresponding button is pressed.
  1207. */
  1208. fullscreenElement: Element;
  1209. /**
  1210. * Gets the Command to toggle fullscreen mode.
  1211. */
  1212. command: Command;
  1213. /**
  1214. * @returns true if the object has been destroyed, false otherwise.
  1215. */
  1216. isDestroyed(): boolean;
  1217. /**
  1218. * Destroys the view model. Should be called to
  1219. * properly clean up the view model when it is no longer needed.
  1220. */
  1221. destroy(): void;
  1222. }
  1223. /**
  1224. * A widget for finding addresses and landmarks, and flying the camera to them. Geocoding is
  1225. * performed using {@link https://cesium.com/cesium-ion/|Cesium ion}.
  1226. * @param options - Object with the following properties:
  1227. * @param options.container - The DOM element or ID that will contain the widget.
  1228. * @param options.scene - The Scene instance to use.
  1229. * @param [options.geocoderServices] - The geocoder services to be used
  1230. * @param [options.autoComplete = true] - True if the geocoder should query as the user types to autocomplete
  1231. * @param [options.flightDuration = 1.5] - The duration of the camera flight to an entered location, in seconds.
  1232. * @param [options.destinationFound = GeocoderViewModel.flyToDestination] - A callback function that is called after a successful geocode. If not supplied, the default behavior is to fly the camera to the result destination.
  1233. */
  1234. export class Geocoder {
  1235. constructor(options: {
  1236. container: Element | string;
  1237. scene: Scene;
  1238. geocoderServices?: GeocoderService[];
  1239. autoComplete?: boolean;
  1240. flightDuration?: number;
  1241. destinationFound?: Geocoder.DestinationFoundFunction;
  1242. });
  1243. /**
  1244. * Gets the parent container.
  1245. */
  1246. container: Element;
  1247. /**
  1248. * Gets the parent container.
  1249. */
  1250. searchSuggestionsContainer: Element;
  1251. /**
  1252. * Gets the view model.
  1253. */
  1254. viewModel: GeocoderViewModel;
  1255. /**
  1256. * @returns true if the object has been destroyed, false otherwise.
  1257. */
  1258. isDestroyed(): boolean;
  1259. /**
  1260. * Destroys the widget. Should be called if permanently
  1261. * removing the widget from layout.
  1262. */
  1263. destroy(): void;
  1264. }
  1265. export namespace Geocoder {
  1266. /**
  1267. * A function that handles the result of a successful geocode.
  1268. * @param viewModel - The view model.
  1269. * @param destination - The destination result of the geocode.
  1270. */
  1271. type DestinationFoundFunction = (viewModel: GeocoderViewModel, destination: Cartesian3 | Rectangle) => void;
  1272. }
  1273. /**
  1274. * The view model for the {@link Geocoder} widget.
  1275. * @param options - Object with the following properties:
  1276. * @param options.scene - The Scene instance to use.
  1277. * @param [options.geocoderServices] - Geocoder services to use for geocoding queries.
  1278. * If more than one are supplied, suggestions will be gathered for the geocoders that support it,
  1279. * and if no suggestion is selected the result from the first geocoder service wil be used.
  1280. * @param [options.flightDuration] - The duration of the camera flight to an entered location, in seconds.
  1281. * @param [options.destinationFound = GeocoderViewModel.flyToDestination] - A callback function that is called after a successful geocode. If not supplied, the default behavior is to fly the camera to the result destination.
  1282. */
  1283. export class GeocoderViewModel {
  1284. constructor(options: {
  1285. scene: Scene;
  1286. geocoderServices?: GeocoderService[];
  1287. flightDuration?: number;
  1288. destinationFound?: Geocoder.DestinationFoundFunction;
  1289. });
  1290. /**
  1291. * Gets or sets a value indicating if this instance should always show its text input field.
  1292. */
  1293. keepExpanded: boolean;
  1294. /**
  1295. * True if the geocoder should query as the user types to autocomplete
  1296. */
  1297. autoComplete: boolean;
  1298. /**
  1299. * Gets and sets the command called when a geocode destination is found
  1300. */
  1301. destinationFound: Geocoder.DestinationFoundFunction;
  1302. /**
  1303. * Gets a value indicating whether a search is currently in progress. This property is observable.
  1304. */
  1305. isSearchInProgress: boolean;
  1306. /**
  1307. * Gets or sets the text to search for. The text can be an address, or longitude, latitude,
  1308. * and optional height, where longitude and latitude are in degrees and height is in meters.
  1309. */
  1310. searchText: string;
  1311. /**
  1312. * Gets or sets the the duration of the camera flight in seconds.
  1313. * A value of zero causes the camera to instantly switch to the geocoding location.
  1314. * The duration will be computed based on the distance when undefined.
  1315. */
  1316. flightDuration: number | undefined;
  1317. /**
  1318. * Gets the event triggered on flight completion.
  1319. */
  1320. complete: Event;
  1321. /**
  1322. * Gets the scene to control.
  1323. */
  1324. scene: Scene;
  1325. /**
  1326. * Gets the Command that is executed when the button is clicked.
  1327. */
  1328. search: Command;
  1329. /**
  1330. * Gets the currently selected geocoder search suggestion
  1331. */
  1332. selectedSuggestion: any;
  1333. /**
  1334. * Gets the list of geocoder search suggestions
  1335. */
  1336. suggestions: object[];
  1337. /**
  1338. * Destroys the widget. Should be called if permanently
  1339. * removing the widget from layout.
  1340. */
  1341. destroy(): void;
  1342. /**
  1343. * A function to fly to the destination found by a successful geocode.
  1344. */
  1345. static flyToDestination: Geocoder.DestinationFoundFunction;
  1346. /**
  1347. * @returns true if the object has been destroyed, false otherwise.
  1348. */
  1349. isDestroyed(): boolean;
  1350. /**
  1351. * Destroys the widget. Should be called if permanently
  1352. * removing the widget from layout.
  1353. */
  1354. destroy(): void;
  1355. }
  1356. /**
  1357. * A single button widget for returning to the default camera view of the current scene.
  1358. * @param container - The DOM element or ID that will contain the widget.
  1359. * @param scene - The Scene instance to use.
  1360. * @param [duration] - The time, in seconds, it takes to complete the camera flight home.
  1361. */
  1362. export class HomeButton {
  1363. constructor(container: Element | string, scene: Scene, duration?: number);
  1364. /**
  1365. * Gets the parent container.
  1366. */
  1367. container: Element;
  1368. /**
  1369. * Gets the view model.
  1370. */
  1371. viewModel: HomeButtonViewModel;
  1372. /**
  1373. * @returns true if the object has been destroyed, false otherwise.
  1374. */
  1375. isDestroyed(): boolean;
  1376. /**
  1377. * Destroys the widget. Should be called if permanently
  1378. * removing the widget from layout.
  1379. */
  1380. destroy(): void;
  1381. }
  1382. /**
  1383. * The view model for {@link HomeButton}.
  1384. * @param scene - The scene instance to use.
  1385. * @param [duration] - The duration of the camera flight in seconds.
  1386. */
  1387. export class HomeButtonViewModel {
  1388. constructor(scene: Scene, duration?: number);
  1389. /**
  1390. * Gets or sets the tooltip. This property is observable.
  1391. */
  1392. tooltip: string;
  1393. /**
  1394. * Gets the scene to control.
  1395. */
  1396. scene: Scene;
  1397. /**
  1398. * Gets the Command that is executed when the button is clicked.
  1399. */
  1400. command: Command;
  1401. /**
  1402. * Gets or sets the the duration of the camera flight in seconds.
  1403. * A value of zero causes the camera to instantly switch to home view.
  1404. * The duration will be computed based on the distance when undefined.
  1405. */
  1406. duration: number | undefined;
  1407. }
  1408. /**
  1409. * A widget for displaying information or a description.
  1410. * @param container - The DOM element or ID that will contain the widget.
  1411. */
  1412. export class InfoBox {
  1413. constructor(container: Element | string);
  1414. /**
  1415. * Gets the parent container.
  1416. */
  1417. container: Element;
  1418. /**
  1419. * Gets the view model.
  1420. */
  1421. viewModel: InfoBoxViewModel;
  1422. /**
  1423. * Gets the iframe used to display the description.
  1424. */
  1425. frame: HTMLIFrameElement;
  1426. /**
  1427. * @returns true if the object has been destroyed, false otherwise.
  1428. */
  1429. isDestroyed(): boolean;
  1430. /**
  1431. * Destroys the widget. Should be called if permanently
  1432. * removing the widget from layout.
  1433. */
  1434. destroy(): void;
  1435. }
  1436. /**
  1437. * The view model for {@link InfoBox}.
  1438. */
  1439. export class InfoBoxViewModel {
  1440. constructor();
  1441. /**
  1442. * Gets or sets the maximum height of the info box in pixels. This property is observable.
  1443. */
  1444. maxHeight: number;
  1445. /**
  1446. * Gets or sets whether the camera tracking icon is enabled.
  1447. */
  1448. enableCamera: boolean;
  1449. /**
  1450. * Gets or sets the status of current camera tracking of the selected object.
  1451. */
  1452. isCameraTracking: boolean;
  1453. /**
  1454. * Gets or sets the visibility of the info box.
  1455. */
  1456. showInfo: boolean;
  1457. /**
  1458. * Gets or sets the title text in the info box.
  1459. */
  1460. titleText: string;
  1461. /**
  1462. * Gets or sets the description HTML for the info box.
  1463. */
  1464. description: string;
  1465. /**
  1466. * Gets the SVG path of the camera icon, which can change to be "crossed out" or not.
  1467. */
  1468. cameraIconPath: string;
  1469. /**
  1470. * Gets the maximum height of sections within the info box, minus an offset, in CSS-ready form.
  1471. * @param offset - The offset in pixels.
  1472. */
  1473. maxHeightOffset(offset: number): string;
  1474. /**
  1475. * Gets an {@link Event} that is fired when the user clicks the camera icon.
  1476. */
  1477. cameraClicked: Event;
  1478. /**
  1479. * Gets an {@link Event} that is fired when the user closes the info box.
  1480. */
  1481. closeClicked: Event;
  1482. }
  1483. /**
  1484. * <p>The NavigationHelpButton is a single button widget for displaying instructions for
  1485. * navigating the globe with the mouse.</p><p style="clear: both;"></p><br/>
  1486. * @example
  1487. * // In HTML head, include a link to the NavigationHelpButton.css stylesheet,
  1488. * // and in the body, include: <div id="navigationHelpButtonContainer"></div>
  1489. *
  1490. * const navigationHelpButton = new Cesium.NavigationHelpButton({
  1491. * container : 'navigationHelpButtonContainer'
  1492. * });
  1493. * @param options - Object with the following properties:
  1494. * @param options.container - The DOM element or ID that will contain the widget.
  1495. * @param [options.instructionsInitiallyVisible = false] - True if the navigation instructions should initially be visible; otherwise, false.
  1496. */
  1497. export class NavigationHelpButton {
  1498. constructor(options: {
  1499. container: Element | string;
  1500. instructionsInitiallyVisible?: boolean;
  1501. });
  1502. /**
  1503. * Gets the parent container.
  1504. */
  1505. container: Element;
  1506. /**
  1507. * Gets the view model.
  1508. */
  1509. viewModel: NavigationHelpButtonViewModel;
  1510. /**
  1511. * @returns true if the object has been destroyed, false otherwise.
  1512. */
  1513. isDestroyed(): boolean;
  1514. /**
  1515. * Destroys the widget. Should be called if permanently
  1516. * removing the widget from layout.
  1517. */
  1518. destroy(): void;
  1519. }
  1520. /**
  1521. * The view model for {@link NavigationHelpButton}.
  1522. */
  1523. export class NavigationHelpButtonViewModel {
  1524. constructor();
  1525. /**
  1526. * Gets or sets whether the instructions are currently shown. This property is observable.
  1527. */
  1528. showInstructions: boolean;
  1529. /**
  1530. * Gets or sets the tooltip. This property is observable.
  1531. */
  1532. tooltip: string;
  1533. /**
  1534. * Gets the Command that is executed when the button is clicked.
  1535. */
  1536. command: Command;
  1537. /**
  1538. * Gets the Command that is executed when the mouse instructions should be shown.
  1539. */
  1540. showClick: Command;
  1541. /**
  1542. * Gets the Command that is executed when the touch instructions should be shown.
  1543. */
  1544. showTouch: Command;
  1545. }
  1546. /**
  1547. * Monitors performance of the application and displays a message if poor performance is detected.
  1548. * @param [options] - Object with the following properties:
  1549. * @param options.container - The DOM element or ID that will contain the widget.
  1550. * @param options.scene - The {@link Scene} for which to monitor performance.
  1551. * @param [options.lowFrameRateMessage = 'This application appears to be performing poorly on your system. Please try using a different web browser or updating your video drivers.'] - The
  1552. * message to display when a low frame rate is detected. The message is interpeted as HTML, so make sure
  1553. * it comes from a trusted source so that your application is not vulnerable to cross-site scripting attacks.
  1554. */
  1555. export class PerformanceWatchdog {
  1556. constructor(options?: {
  1557. container: Element | string;
  1558. scene: Scene;
  1559. lowFrameRateMessage?: string;
  1560. });
  1561. /**
  1562. * Gets the parent container.
  1563. */
  1564. container: Element;
  1565. /**
  1566. * Gets the view model.
  1567. */
  1568. viewModel: PerformanceWatchdogViewModel;
  1569. /**
  1570. * @returns true if the object has been destroyed, false otherwise.
  1571. */
  1572. isDestroyed(): boolean;
  1573. /**
  1574. * Destroys the widget. Should be called if permanently
  1575. * removing the widget from layout.
  1576. */
  1577. destroy(): void;
  1578. }
  1579. /**
  1580. * The view model for {@link PerformanceWatchdog}.
  1581. * @param [options] - Object with the following properties:
  1582. * @param options.scene - The Scene instance for which to monitor performance.
  1583. * @param [options.lowFrameRateMessage = 'This application appears to be performing poorly on your system. Please try using a different web browser or updating your video drivers.'] - The
  1584. * message to display when a low frame rate is detected. The message is interpeted as HTML, so make sure
  1585. * it comes from a trusted source so that your application is not vulnerable to cross-site scripting attacks.
  1586. */
  1587. export class PerformanceWatchdogViewModel {
  1588. constructor(options?: {
  1589. scene: Scene;
  1590. lowFrameRateMessage?: string;
  1591. });
  1592. /**
  1593. * Gets or sets the message to display when a low frame rate is detected. This string will be interpreted as HTML.
  1594. */
  1595. lowFrameRateMessage: string;
  1596. /**
  1597. * Gets or sets a value indicating whether the low frame rate message has previously been dismissed by the user. If it has
  1598. * been dismissed, the message will not be redisplayed, no matter the frame rate.
  1599. */
  1600. lowFrameRateMessageDismissed: boolean;
  1601. /**
  1602. * Gets or sets a value indicating whether the low frame rate message is currently being displayed.
  1603. */
  1604. showingLowFrameRateMessage: boolean;
  1605. /**
  1606. * Gets the {@link Scene} instance for which to monitor performance.
  1607. */
  1608. scene: Scene;
  1609. /**
  1610. * Gets a command that dismisses the low frame rate message. Once it is dismissed, the message
  1611. * will not be redisplayed.
  1612. */
  1613. dismissMessage: Command;
  1614. }
  1615. /**
  1616. * The ProjectionPicker is a single button widget for switching between perspective and orthographic projections.
  1617. * @example
  1618. * // In HTML head, include a link to the ProjectionPicker.css stylesheet,
  1619. * // and in the body, include: <div id="projectionPickerContainer"></div>
  1620. * // Note: This code assumes you already have a Scene instance.
  1621. *
  1622. * const projectionPicker = new Cesium.ProjectionPicker('projectionPickerContainer', scene);
  1623. * @param container - The DOM element or ID that will contain the widget.
  1624. * @param scene - The Scene instance to use.
  1625. */
  1626. export class ProjectionPicker {
  1627. constructor(container: Element | string, scene: Scene);
  1628. /**
  1629. * Gets the parent container.
  1630. */
  1631. container: Element;
  1632. /**
  1633. * Gets the view model.
  1634. */
  1635. viewModel: ProjectionPickerViewModel;
  1636. /**
  1637. * @returns true if the object has been destroyed, false otherwise.
  1638. */
  1639. isDestroyed(): boolean;
  1640. /**
  1641. * Destroys the widget. Should be called if permanently
  1642. * removing the widget from layout.
  1643. */
  1644. destroy(): void;
  1645. }
  1646. /**
  1647. * The view model for {@link ProjectionPicker}.
  1648. * @param scene - The Scene to switch projections.
  1649. */
  1650. export class ProjectionPickerViewModel {
  1651. constructor(scene: Scene);
  1652. /**
  1653. * Gets or sets whether the button drop-down is currently visible. This property is observable.
  1654. */
  1655. dropDownVisible: boolean;
  1656. /**
  1657. * Gets or sets the perspective projection tooltip. This property is observable.
  1658. */
  1659. tooltipPerspective: string;
  1660. /**
  1661. * Gets or sets the orthographic projection tooltip. This property is observable.
  1662. */
  1663. tooltipOrthographic: string;
  1664. /**
  1665. * Gets the currently active tooltip. This property is observable.
  1666. */
  1667. selectedTooltip: string;
  1668. /**
  1669. * Gets or sets the current SceneMode. This property is observable.
  1670. */
  1671. sceneMode: SceneMode;
  1672. /**
  1673. * Gets the scene
  1674. */
  1675. scene: Scene;
  1676. /**
  1677. * Gets the command to toggle the drop down box.
  1678. */
  1679. toggleDropDown: Command;
  1680. /**
  1681. * Gets the command to switch to a perspective projection.
  1682. */
  1683. switchToPerspective: Command;
  1684. /**
  1685. * Gets the command to switch to orthographic projection.
  1686. */
  1687. switchToOrthographic: Command;
  1688. /**
  1689. * Gets whether the scene is currently using an orthographic projection.
  1690. */
  1691. isOrthographicProjection: Command;
  1692. /**
  1693. * @returns true if the object has been destroyed, false otherwise.
  1694. */
  1695. isDestroyed(): boolean;
  1696. /**
  1697. * Destroys the view model.
  1698. */
  1699. destroy(): void;
  1700. }
  1701. /**
  1702. * <img src="Images/sceneModePicker.png" style="float: left; margin-right: 10px;" width="44" height="116" />
  1703. * <p>The SceneModePicker is a single button widget for switching between scene modes;
  1704. * shown to the left in its expanded state. Programatic switching of scene modes will
  1705. * be automatically reflected in the widget as long as the specified Scene
  1706. * is used to perform the change.</p><p style="clear: both;"></p><br/>
  1707. * @example
  1708. * // In HTML head, include a link to the SceneModePicker.css stylesheet,
  1709. * // and in the body, include: <div id="sceneModePickerContainer"></div>
  1710. * // Note: This code assumes you already have a Scene instance.
  1711. *
  1712. * const sceneModePicker = new Cesium.SceneModePicker('sceneModePickerContainer', scene);
  1713. * @param container - The DOM element or ID that will contain the widget.
  1714. * @param scene - The Scene instance to use.
  1715. * @param [duration = 2.0] - The time, in seconds, it takes for the scene to transition.
  1716. */
  1717. export class SceneModePicker {
  1718. constructor(container: Element | string, scene: Scene, duration?: number);
  1719. /**
  1720. * Gets the parent container.
  1721. */
  1722. container: Element;
  1723. /**
  1724. * Gets the view model.
  1725. */
  1726. viewModel: SceneModePickerViewModel;
  1727. /**
  1728. * @returns true if the object has been destroyed, false otherwise.
  1729. */
  1730. isDestroyed(): boolean;
  1731. /**
  1732. * Destroys the widget. Should be called if permanently
  1733. * removing the widget from layout.
  1734. */
  1735. destroy(): void;
  1736. }
  1737. /**
  1738. * The view model for {@link SceneModePicker}.
  1739. * @param scene - The Scene to morph
  1740. * @param [duration = 2.0] - The duration of scene morph animations, in seconds
  1741. */
  1742. export class SceneModePickerViewModel {
  1743. constructor(scene: Scene, duration?: number);
  1744. /**
  1745. * Gets or sets the current SceneMode. This property is observable.
  1746. */
  1747. sceneMode: SceneMode;
  1748. /**
  1749. * Gets or sets whether the button drop-down is currently visible. This property is observable.
  1750. */
  1751. dropDownVisible: boolean;
  1752. /**
  1753. * Gets or sets the 2D tooltip. This property is observable.
  1754. */
  1755. tooltip2D: string;
  1756. /**
  1757. * Gets or sets the 3D tooltip. This property is observable.
  1758. */
  1759. tooltip3D: string;
  1760. /**
  1761. * Gets or sets the Columbus View tooltip. This property is observable.
  1762. */
  1763. tooltipColumbusView: string;
  1764. /**
  1765. * Gets the currently active tooltip. This property is observable.
  1766. */
  1767. selectedTooltip: string;
  1768. /**
  1769. * Gets the scene
  1770. */
  1771. scene: Scene;
  1772. /**
  1773. * Gets or sets the the duration of scene mode transition animations in seconds.
  1774. * A value of zero causes the scene to instantly change modes.
  1775. */
  1776. duration: number;
  1777. /**
  1778. * Gets the command to toggle the drop down box.
  1779. */
  1780. toggleDropDown: Command;
  1781. /**
  1782. * Gets the command to morph to 2D.
  1783. */
  1784. morphTo2D: Command;
  1785. /**
  1786. * Gets the command to morph to 3D.
  1787. */
  1788. morphTo3D: Command;
  1789. /**
  1790. * Gets the command to morph to Columbus View.
  1791. */
  1792. morphToColumbusView: Command;
  1793. /**
  1794. * @returns true if the object has been destroyed, false otherwise.
  1795. */
  1796. isDestroyed(): boolean;
  1797. /**
  1798. * Destroys the view model.
  1799. */
  1800. destroy(): void;
  1801. }
  1802. /**
  1803. * A widget for displaying an indicator on a selected object.
  1804. * @param container - The DOM element or ID that will contain the widget.
  1805. * @param scene - The Scene instance to use.
  1806. */
  1807. export class SelectionIndicator {
  1808. constructor(container: Element | string, scene: Scene);
  1809. /**
  1810. * Gets the parent container.
  1811. */
  1812. container: Element;
  1813. /**
  1814. * Gets the view model.
  1815. */
  1816. viewModel: SelectionIndicatorViewModel;
  1817. /**
  1818. * @returns true if the object has been destroyed, false otherwise.
  1819. */
  1820. isDestroyed(): boolean;
  1821. /**
  1822. * Destroys the widget. Should be called if permanently
  1823. * removing the widget from layout.
  1824. */
  1825. destroy(): void;
  1826. }
  1827. /**
  1828. * The view model for {@link SelectionIndicator}.
  1829. * @param scene - The scene instance to use for screen-space coordinate conversion.
  1830. * @param selectionIndicatorElement - The element containing all elements that make up the selection indicator.
  1831. * @param container - The DOM element that contains the widget.
  1832. */
  1833. export class SelectionIndicatorViewModel {
  1834. constructor(scene: Scene, selectionIndicatorElement: Element, container: Element);
  1835. /**
  1836. * Gets or sets the world position of the object for which to display the selection indicator.
  1837. */
  1838. position: Cartesian3;
  1839. /**
  1840. * Gets or sets the visibility of the selection indicator.
  1841. */
  1842. showSelection: boolean;
  1843. /**
  1844. * Gets the visibility of the position indicator. This can be false even if an
  1845. * object is selected, when the selected object has no position.
  1846. */
  1847. isVisible: boolean;
  1848. /**
  1849. * Gets or sets the function for converting the world position of the object to the screen space position.
  1850. * @example
  1851. * selectionIndicatorViewModel.computeScreenSpacePosition = function(position, result) {
  1852. * return Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, position, result);
  1853. * };
  1854. */
  1855. computeScreenSpacePosition: SelectionIndicatorViewModel.ComputeScreenSpacePosition;
  1856. /**
  1857. * Updates the view of the selection indicator to match the position and content properties of the view model.
  1858. * This function should be called as part of the render loop.
  1859. */
  1860. update(): void;
  1861. /**
  1862. * Animate the indicator to draw attention to the selection.
  1863. */
  1864. animateAppear(): void;
  1865. /**
  1866. * Animate the indicator to release the selection.
  1867. */
  1868. animateDepart(): void;
  1869. /**
  1870. * Gets the HTML element containing the selection indicator.
  1871. */
  1872. container: Element;
  1873. /**
  1874. * Gets the HTML element that holds the selection indicator.
  1875. */
  1876. selectionIndicatorElement: Element;
  1877. /**
  1878. * Gets the scene being used.
  1879. */
  1880. scene: Scene;
  1881. }
  1882. export namespace SelectionIndicatorViewModel {
  1883. /**
  1884. * A function that converts the world position of an object to a screen space position.
  1885. * @param position - The position in WGS84 (world) coordinates.
  1886. * @param result - An object to return the input position transformed to window coordinates.
  1887. */
  1888. type ComputeScreenSpacePosition = (position: Cartesian3, result: Cartesian2) => Cartesian2;
  1889. }
  1890. /**
  1891. * A Knockout binding handler that creates a DOM element for a single SVG path.
  1892. * This binding handler will be registered as cesiumSvgPath.
  1893. *
  1894. * <p>
  1895. * The parameter to this binding is an object with the following properties:
  1896. * </p>
  1897. *
  1898. * <ul>
  1899. * <li>path: The SVG path as a string.</li>
  1900. * <li>width: The width of the SVG path with no transformations applied.</li>
  1901. * <li>height: The height of the SVG path with no transformations applied.</li>
  1902. * <li>css: Optional. A string containing additional CSS classes to apply to the SVG. 'cesium-svgPath-svg' is always applied.</li>
  1903. * </ul>
  1904. * @example
  1905. * // Create an SVG as a child of a div
  1906. * <div data-bind="cesiumSvgPath: { path: 'M 100 100 L 300 100 L 200 300 z', width: 28, height: 28 }"></div>
  1907. *
  1908. * // parameters can be observable from the view model
  1909. * <div data-bind="cesiumSvgPath: { path: currentPath, width: currentWidth, height: currentHeight }"></div>
  1910. *
  1911. * // or the whole object can be observable from the view model
  1912. * <div data-bind="cesiumSvgPath: svgPathOptions"></div>
  1913. */
  1914. export namespace SvgPathBindingHandler {
  1915. function register(): void;
  1916. }
  1917. /**
  1918. * The Timeline is a widget for displaying and controlling the current scene time.
  1919. * @param container - The parent HTML container node for this widget.
  1920. * @param clock - The clock to use.
  1921. */
  1922. export class Timeline {
  1923. constructor(container: Element, clock: Clock);
  1924. /**
  1925. * Gets the parent container.
  1926. */
  1927. container: Element;
  1928. /**
  1929. * @returns true if the object has been destroyed, false otherwise.
  1930. */
  1931. isDestroyed(): boolean;
  1932. /**
  1933. * Destroys the widget. Should be called if permanently
  1934. * removing the widget from layout.
  1935. */
  1936. destroy(): void;
  1937. /**
  1938. * Sets the view to the provided times.
  1939. * @param startTime - The start time.
  1940. * @param stopTime - The stop time.
  1941. */
  1942. zoomTo(startTime: JulianDate, stopTime: JulianDate): void;
  1943. /**
  1944. * Resizes the widget to match the container size.
  1945. */
  1946. resize(): void;
  1947. }
  1948. /**
  1949. * A view model which exposes the properties of a toggle button.
  1950. * @param command - The command which will be executed when the button is toggled.
  1951. * @param [options] - Object with the following properties:
  1952. * @param [options.toggled = false] - A boolean indicating whether the button should be initially toggled.
  1953. * @param [options.tooltip = ''] - A string containing the button's tooltip.
  1954. */
  1955. export class ToggleButtonViewModel {
  1956. constructor(command: Command, options?: {
  1957. toggled?: boolean;
  1958. tooltip?: string;
  1959. });
  1960. /**
  1961. * Gets or sets whether the button is currently toggled. This property is observable.
  1962. */
  1963. toggled: boolean;
  1964. /**
  1965. * Gets or sets the button's tooltip. This property is observable.
  1966. */
  1967. tooltip: string;
  1968. /**
  1969. * Gets the command which will be executed when the button is toggled.
  1970. */
  1971. command: Command;
  1972. }
  1973. /**
  1974. * A single button widget for toggling vr mode.
  1975. * @param container - The DOM element or ID that will contain the widget.
  1976. * @param scene - The scene.
  1977. * @param [vrElement = document.body] - The element or id to be placed into vr mode.
  1978. */
  1979. export class VRButton {
  1980. constructor(container: Element | string, scene: Scene, vrElement?: Element | string);
  1981. /**
  1982. * Gets the parent container.
  1983. */
  1984. container: Element;
  1985. /**
  1986. * Gets the view model.
  1987. */
  1988. viewModel: VRButtonViewModel;
  1989. /**
  1990. * @returns true if the object has been destroyed, false otherwise.
  1991. */
  1992. isDestroyed(): boolean;
  1993. /**
  1994. * Destroys the widget. Should be called if permanently
  1995. * removing the widget from layout.
  1996. */
  1997. destroy(): void;
  1998. }
  1999. /**
  2000. * The view model for {@link VRButton}.
  2001. * @param scene - The scene.
  2002. * @param [vrElement = document.body] - The element or id to be placed into VR mode.
  2003. */
  2004. export class VRButtonViewModel {
  2005. constructor(scene: Scene, vrElement?: Element | string);
  2006. /**
  2007. * Gets whether or not VR mode is active.
  2008. */
  2009. isVRMode: boolean;
  2010. /**
  2011. * Gets or sets whether or not VR functionality should be enabled.
  2012. */
  2013. isVREnabled: boolean;
  2014. /**
  2015. * Gets the tooltip. This property is observable.
  2016. */
  2017. tooltip: string;
  2018. /**
  2019. * Gets or sets the HTML element to place into VR mode when the
  2020. * corresponding button is pressed.
  2021. */
  2022. vrElement: Element;
  2023. /**
  2024. * Gets the Command to toggle VR mode.
  2025. */
  2026. command: Command;
  2027. /**
  2028. * @returns true if the object has been destroyed, false otherwise.
  2029. */
  2030. isDestroyed(): boolean;
  2031. /**
  2032. * Destroys the view model. Should be called to
  2033. * properly clean up the view model when it is no longer needed.
  2034. */
  2035. destroy(): void;
  2036. }
  2037. export namespace Viewer {
  2038. /**
  2039. * Initialization options for the Viewer constructor
  2040. * @property [animation = true] - If set to false, the Animation widget will not be created.
  2041. * @property [baseLayerPicker = true] - If set to false, the BaseLayerPicker widget will not be created.
  2042. * @property [fullscreenButton = true] - If set to false, the FullscreenButton widget will not be created.
  2043. * @property [vrButton = false] - If set to true, the VRButton widget will be created.
  2044. * @property [geocoder = true] - If set to false, the Geocoder widget will not be created.
  2045. * @property [homeButton = true] - If set to false, the HomeButton widget will not be created.
  2046. * @property [infoBox = true] - If set to false, the InfoBox widget will not be created.
  2047. * @property [sceneModePicker = true] - If set to false, the SceneModePicker widget will not be created.
  2048. * @property [selectionIndicator = true] - If set to false, the SelectionIndicator widget will not be created.
  2049. * @property [timeline = true] - If set to false, the Timeline widget will not be created.
  2050. * @property [navigationHelpButton = true] - If set to false, the navigation help button will not be created.
  2051. * @property [navigationInstructionsInitiallyVisible = true] - True if the navigation instructions should initially be visible, or false if the should not be shown until the user explicitly clicks the button.
  2052. * @property [scene3DOnly = false] - When <code>true</code>, each geometry instance will only be rendered in 3D to save GPU memory.
  2053. * @property [shouldAnimate = false] - <code>true</code> if the clock should attempt to advance simulation time by default, <code>false</code> otherwise. This option takes precedence over setting {@link Viewer#clockViewModel}.
  2054. * @property [clockViewModel = new ClockViewModel(clock)] - The clock view model to use to control current time.
  2055. * @property [selectedImageryProviderViewModel] - The view model for the current base imagery layer, if not supplied the first available base layer is used. This value is only valid if `baseLayerPicker` is set to true.
  2056. * @property [imageryProviderViewModels = createDefaultImageryProviderViewModels()] - The array of ProviderViewModels to be selectable from the BaseLayerPicker. This value is only valid if `baseLayerPicker` is set to true.
  2057. * @property [selectedTerrainProviderViewModel] - The view model for the current base terrain layer, if not supplied the first available base layer is used. This value is only valid if `baseLayerPicker` is set to true.
  2058. * @property [terrainProviderViewModels = createDefaultTerrainProviderViewModels()] - The array of ProviderViewModels to be selectable from the BaseLayerPicker. This value is only valid if `baseLayerPicker` is set to true.
  2059. * @property [imageryProvider = createWorldImagery()] - The imagery provider to use. This value is only valid if `baseLayerPicker` is set to false. Deprecated.
  2060. * @property [baseLayer = ImageryLayer.fromWorldImagery()] - The bottommost imagery layer applied to the globe. If set to <code>false</code>, no imagery provider will be added. This value is only valid if `baseLayerPicker` is set to false.
  2061. * @property [terrainProvider = new EllipsoidTerrainProvider()] - The terrain provider to use
  2062. * @property [terrain] - A terrain object which handles asynchronous terrain provider. Can only specify if options.terrainProvider is undefined.
  2063. * @property [skyBox] - The skybox used to render the stars. When <code>undefined</code>, the default stars are used. If set to <code>false</code>, no skyBox, Sun, or Moon will be added.
  2064. * @property [skyAtmosphere] - Blue sky, and the glow around the Earth's limb. Set to <code>false</code> to turn it off.
  2065. * @property [fullscreenElement = document.body] - The element or id to be placed into fullscreen mode when the full screen button is pressed.
  2066. * @property [useDefaultRenderLoop = true] - True if this widget should control the render loop, false otherwise.
  2067. * @property [targetFrameRate] - The target frame rate when using the default render loop.
  2068. * @property [showRenderLoopErrors = true] - If true, this widget will automatically display an HTML panel to the user containing the error, if a render loop error occurs.
  2069. * @property [useBrowserRecommendedResolution = true] - If true, render at the browser's recommended resolution and ignore <code>window.devicePixelRatio</code>.
  2070. * @property [automaticallyTrackDataSourceClocks = true] - If true, this widget will automatically track the clock settings of newly added DataSources, updating if the DataSource's clock changes. Set this to false if you want to configure the clock independently.
  2071. * @property [contextOptions] - Context and WebGL creation properties passed to {@link Scene}.
  2072. * @property [sceneMode = SceneMode.SCENE3D] - The initial scene mode.
  2073. * @property [mapProjection = new GeographicProjection()] - The map projection to use in 2D and Columbus View modes.
  2074. * @property [globe = new Globe(mapProjection.ellipsoid)] - The globe to use in the scene. If set to <code>false</code>, no globe will be added.
  2075. * @property [orderIndependentTranslucency = true] - If true and the configuration supports it, use order independent translucency.
  2076. * @property [creditContainer] - The DOM element or ID that will contain the {@link CreditDisplay}. If not specified, the credits are added to the bottom of the widget itself.
  2077. * @property [creditViewport] - The DOM element or ID that will contain the credit pop up created by the {@link CreditDisplay}. If not specified, it will appear over the widget itself.
  2078. * @property [dataSources = new DataSourceCollection()] - The collection of data sources visualized by the widget. If this parameter is provided,
  2079. * the instance is assumed to be owned by the caller and will not be destroyed when the viewer is destroyed.
  2080. * @property [shadows = false] - Determines if shadows are cast by light sources.
  2081. * @property [terrainShadows = ShadowMode.RECEIVE_ONLY] - Determines if the terrain casts or receives shadows from light sources.
  2082. * @property [mapMode2D = MapMode2D.INFINITE_SCROLL] - Determines if the 2D map is rotatable or can be scrolled infinitely in the horizontal direction.
  2083. * @property [projectionPicker = false] - If set to true, the ProjectionPicker widget will be created.
  2084. * @property [blurActiveElementOnCanvasFocus = true] - If true, the active element will blur when the viewer's canvas is clicked. Setting this to false is useful for cases when the canvas is clicked only for retrieving position or an entity data without actually meaning to set the canvas to be the active element.
  2085. * @property [requestRenderMode = false] - If true, rendering a frame will only occur when needed as determined by changes within the scene. Enabling reduces the CPU/GPU usage of your application and uses less battery on mobile, but requires using {@link Scene#requestRender} to render a new frame explicitly in this mode. This will be necessary in many cases after making changes to the scene in other parts of the API. See {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|Improving Performance with Explicit Rendering}.
  2086. * @property [maximumRenderTimeChange = 0.0] - If requestRenderMode is true, this value defines the maximum change in simulation time allowed before a render is requested. See {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|Improving Performance with Explicit Rendering}.
  2087. * @property [depthPlaneEllipsoidOffset = 0.0] - Adjust the DepthPlane to address rendering artefacts below ellipsoid zero elevation.
  2088. * @property [msaaSamples = 1] - If provided, this value controls the rate of multisample antialiasing. Typical multisampling rates are 2, 4, and sometimes 8 samples per pixel. Higher sampling rates of MSAA may impact performance in exchange for improved visual quality. This value only applies to WebGL2 contexts that support multisample render targets.
  2089. */
  2090. type ConstructorOptions = {
  2091. animation?: boolean;
  2092. baseLayerPicker?: boolean;
  2093. fullscreenButton?: boolean;
  2094. vrButton?: boolean;
  2095. geocoder?: boolean | GeocoderService[];
  2096. homeButton?: boolean;
  2097. infoBox?: boolean;
  2098. sceneModePicker?: boolean;
  2099. selectionIndicator?: boolean;
  2100. timeline?: boolean;
  2101. navigationHelpButton?: boolean;
  2102. navigationInstructionsInitiallyVisible?: boolean;
  2103. scene3DOnly?: boolean;
  2104. shouldAnimate?: boolean;
  2105. clockViewModel?: ClockViewModel;
  2106. selectedImageryProviderViewModel?: ProviderViewModel;
  2107. imageryProviderViewModels?: ProviderViewModel[];
  2108. selectedTerrainProviderViewModel?: ProviderViewModel;
  2109. terrainProviderViewModels?: ProviderViewModel[];
  2110. imageryProvider?: ImageryProvider | false;
  2111. baseLayer?: ImageryLayer | false;
  2112. terrainProvider?: TerrainProvider;
  2113. terrain?: Terrain;
  2114. skyBox?: SkyBox | false;
  2115. skyAtmosphere?: SkyAtmosphere | false;
  2116. fullscreenElement?: Element | string;
  2117. useDefaultRenderLoop?: boolean;
  2118. targetFrameRate?: number;
  2119. showRenderLoopErrors?: boolean;
  2120. useBrowserRecommendedResolution?: boolean;
  2121. automaticallyTrackDataSourceClocks?: boolean;
  2122. contextOptions?: ContextOptions;
  2123. sceneMode?: SceneMode;
  2124. mapProjection?: MapProjection;
  2125. globe?: Globe | false;
  2126. orderIndependentTranslucency?: boolean;
  2127. creditContainer?: Element | string;
  2128. creditViewport?: Element | string;
  2129. dataSources?: DataSourceCollection;
  2130. shadows?: boolean;
  2131. terrainShadows?: ShadowMode;
  2132. mapMode2D?: MapMode2D;
  2133. projectionPicker?: boolean;
  2134. blurActiveElementOnCanvasFocus?: boolean;
  2135. requestRenderMode?: boolean;
  2136. maximumRenderTimeChange?: number;
  2137. depthPlaneEllipsoidOffset?: number;
  2138. msaaSamples?: number;
  2139. };
  2140. /**
  2141. * A function that augments a Viewer instance with additional functionality.
  2142. * @param viewer - The viewer instance.
  2143. * @param options - Options object to be passed to the mixin function.
  2144. */
  2145. type ViewerMixin = (viewer: Viewer, options: any) => void;
  2146. }
  2147. /**
  2148. * A base widget for building applications. It composites all of the standard Cesium widgets into one reusable package.
  2149. * The widget can always be extended by using mixins, which add functionality useful for a variety of applications.
  2150. * @example
  2151. * // Initialize the viewer widget with several custom options and mixins.
  2152. * try {
  2153. * const viewer = new Cesium.Viewer("cesiumContainer", {
  2154. * // Start in Columbus Viewer
  2155. * sceneMode: Cesium.SceneMode.COLUMBUS_VIEW,
  2156. * // Use Cesium World Terrain
  2157. * terrain: Cesium.Terrain.fromWorldTerrain(),
  2158. * // Hide the base layer picker
  2159. * baseLayerPicker: false,
  2160. * // Use OpenStreetMaps
  2161. * baseLayer: new Cesium.ImageryLayer(OpenStreetMapImageryProvider({
  2162. * url: "https://a.tile.openstreetmap.org/"
  2163. * })),
  2164. * skyBox: new Cesium.SkyBox({
  2165. * sources: {
  2166. * positiveX: "stars/TychoSkymapII.t3_08192x04096_80_px.jpg",
  2167. * negativeX: "stars/TychoSkymapII.t3_08192x04096_80_mx.jpg",
  2168. * positiveY: "stars/TychoSkymapII.t3_08192x04096_80_py.jpg",
  2169. * negativeY: "stars/TychoSkymapII.t3_08192x04096_80_my.jpg",
  2170. * positiveZ: "stars/TychoSkymapII.t3_08192x04096_80_pz.jpg",
  2171. * negativeZ: "stars/TychoSkymapII.t3_08192x04096_80_mz.jpg"
  2172. * }
  2173. * }),
  2174. * // Show Columbus View map with Web Mercator projection
  2175. * mapProjection: new Cesium.WebMercatorProjection()
  2176. * });
  2177. * } catch (error) {
  2178. * console.log(error);
  2179. * }
  2180. *
  2181. * // Add basic drag and drop functionality
  2182. * viewer.extend(Cesium.viewerDragDropMixin);
  2183. *
  2184. * // Show a pop-up alert if we encounter an error when processing a dropped file
  2185. * viewer.dropError.addEventListener(function(dropHandler, name, error) {
  2186. * console.log(error);
  2187. * window.alert(error);
  2188. * });
  2189. * @param container - The DOM element or ID that will contain the widget.
  2190. * @param [options] - Object describing initialization options
  2191. */
  2192. export class Viewer {
  2193. constructor(container: Element | string, options?: Viewer.ConstructorOptions);
  2194. /**
  2195. * Gets the parent container.
  2196. */
  2197. readonly container: Element;
  2198. /**
  2199. * Manages the list of credits to display on screen and in the lightbox.
  2200. */
  2201. creditDisplay: CreditDisplay;
  2202. /**
  2203. * Gets the DOM element for the area at the bottom of the window containing the
  2204. * {@link CreditDisplay} and potentially other things.
  2205. */
  2206. readonly bottomContainer: Element;
  2207. /**
  2208. * Gets the CesiumWidget.
  2209. */
  2210. readonly cesiumWidget: CesiumWidget;
  2211. /**
  2212. * Gets the selection indicator.
  2213. */
  2214. readonly selectionIndicator: SelectionIndicator;
  2215. /**
  2216. * Gets the info box.
  2217. */
  2218. readonly infoBox: InfoBox;
  2219. /**
  2220. * Gets the Geocoder.
  2221. */
  2222. readonly geocoder: Geocoder;
  2223. /**
  2224. * Gets the HomeButton.
  2225. */
  2226. readonly homeButton: HomeButton;
  2227. /**
  2228. * Gets the SceneModePicker.
  2229. */
  2230. readonly sceneModePicker: SceneModePicker;
  2231. /**
  2232. * Gets the ProjectionPicker.
  2233. */
  2234. readonly projectionPicker: ProjectionPicker;
  2235. /**
  2236. * Gets the BaseLayerPicker.
  2237. */
  2238. readonly baseLayerPicker: BaseLayerPicker;
  2239. /**
  2240. * Gets the NavigationHelpButton.
  2241. */
  2242. readonly navigationHelpButton: NavigationHelpButton;
  2243. /**
  2244. * Gets the Animation widget.
  2245. */
  2246. readonly animation: Animation;
  2247. /**
  2248. * Gets the Timeline widget.
  2249. */
  2250. readonly timeline: Timeline;
  2251. /**
  2252. * Gets the FullscreenButton.
  2253. */
  2254. readonly fullscreenButton: FullscreenButton;
  2255. /**
  2256. * Gets the VRButton.
  2257. */
  2258. readonly vrButton: VRButton;
  2259. /**
  2260. * Gets the display used for {@link DataSource} visualization.
  2261. */
  2262. readonly dataSourceDisplay: DataSourceDisplay;
  2263. /**
  2264. * Gets the collection of entities not tied to a particular data source.
  2265. * This is a shortcut to [dataSourceDisplay.defaultDataSource.entities]{@link Viewer#dataSourceDisplay}.
  2266. */
  2267. readonly entities: EntityCollection;
  2268. /**
  2269. * Gets the set of {@link DataSource} instances to be visualized.
  2270. */
  2271. readonly dataSources: DataSourceCollection;
  2272. /**
  2273. * Gets the canvas.
  2274. */
  2275. readonly canvas: HTMLCanvasElement;
  2276. /**
  2277. * Gets the scene.
  2278. */
  2279. readonly scene: Scene;
  2280. /**
  2281. * Determines if shadows are cast by light sources.
  2282. */
  2283. shadows: boolean;
  2284. /**
  2285. * Determines if the terrain casts or shadows from light sources.
  2286. */
  2287. terrainShadows: ShadowMode;
  2288. /**
  2289. * Get the scene's shadow map
  2290. */
  2291. readonly shadowMap: ShadowMap;
  2292. /**
  2293. * Gets the collection of image layers that will be rendered on the globe.
  2294. */
  2295. readonly imageryLayers: ImageryLayerCollection;
  2296. /**
  2297. * The terrain provider providing surface geometry for the globe.
  2298. */
  2299. terrainProvider: TerrainProvider;
  2300. /**
  2301. * Gets the camera.
  2302. */
  2303. readonly camera: Camera;
  2304. /**
  2305. * Gets the post-process stages.
  2306. */
  2307. readonly postProcessStages: PostProcessStageCollection;
  2308. /**
  2309. * Gets the clock.
  2310. */
  2311. readonly clock: Clock;
  2312. /**
  2313. * Gets the clock view model.
  2314. */
  2315. readonly clockViewModel: ClockViewModel;
  2316. /**
  2317. * Gets the screen space event handler.
  2318. */
  2319. readonly screenSpaceEventHandler: ScreenSpaceEventHandler;
  2320. /**
  2321. * Gets or sets the target frame rate of the widget when <code>useDefaultRenderLoop</code>
  2322. * is true. If undefined, the browser's requestAnimationFrame implementation
  2323. * determines the frame rate. If defined, this value must be greater than 0. A value higher
  2324. * than the underlying requestAnimationFrame implementation will have no effect.
  2325. */
  2326. targetFrameRate: number;
  2327. /**
  2328. * Gets or sets whether or not this widget should control the render loop.
  2329. * If true the widget will use requestAnimationFrame to
  2330. * perform rendering and resizing of the widget, as well as drive the
  2331. * simulation clock. If set to false, you must manually call the
  2332. * <code>resize</code>, <code>render</code> methods
  2333. * as part of a custom render loop. If an error occurs during rendering, {@link Scene}'s
  2334. * <code>renderError</code> event will be raised and this property
  2335. * will be set to false. It must be set back to true to continue rendering
  2336. * after the error.
  2337. */
  2338. useDefaultRenderLoop: boolean;
  2339. /**
  2340. * Gets or sets a scaling factor for rendering resolution. Values less than 1.0 can improve
  2341. * performance on less powerful devices while values greater than 1.0 will render at a higher
  2342. * resolution and then scale down, resulting in improved visual fidelity.
  2343. * For example, if the widget is laid out at a size of 640x480, setting this value to 0.5
  2344. * will cause the scene to be rendered at 320x240 and then scaled up while setting
  2345. * it to 2.0 will cause the scene to be rendered at 1280x960 and then scaled down.
  2346. */
  2347. resolutionScale: number;
  2348. /**
  2349. * Boolean flag indicating if the browser's recommended resolution is used.
  2350. * If true, the browser's device pixel ratio is ignored and 1.0 is used instead,
  2351. * effectively rendering based on CSS pixels instead of device pixels. This can improve
  2352. * performance on less powerful devices that have high pixel density. When false, rendering
  2353. * will be in device pixels. {@link Viewer#resolutionScale} will still take effect whether
  2354. * this flag is true or false.
  2355. */
  2356. useBrowserRecommendedResolution: boolean;
  2357. /**
  2358. * Gets or sets whether or not data sources can temporarily pause
  2359. * animation in order to avoid showing an incomplete picture to the user.
  2360. * For example, if asynchronous primitives are being processed in the
  2361. * background, the clock will not advance until the geometry is ready.
  2362. */
  2363. allowDataSourcesToSuspendAnimation: boolean;
  2364. /**
  2365. * Gets or sets the Entity instance currently being tracked by the camera.
  2366. */
  2367. trackedEntity: Entity | undefined;
  2368. /**
  2369. * Gets or sets the object instance for which to display a selection indicator.
  2370. *
  2371. * If a user interactively picks a Cesium3DTilesFeature instance, then this property
  2372. * will contain a transient Entity instance with a property named "feature" that is
  2373. * the instance that was picked.
  2374. */
  2375. selectedEntity: Entity | undefined;
  2376. /**
  2377. * Gets the event that is raised when the selected entity changes.
  2378. */
  2379. readonly selectedEntityChanged: Event;
  2380. /**
  2381. * Gets the event that is raised when the tracked entity changes.
  2382. */
  2383. readonly trackedEntityChanged: Event;
  2384. /**
  2385. * Gets or sets the data source to track with the viewer's clock.
  2386. */
  2387. clockTrackedDataSource: DataSource;
  2388. /**
  2389. * Extends the base viewer functionality with the provided mixin.
  2390. * A mixin may add additional properties, functions, or other behavior
  2391. * to the provided viewer instance.
  2392. * @param mixin - The Viewer mixin to add to this instance.
  2393. * @param [options] - The options object to be passed to the mixin function.
  2394. */
  2395. extend(mixin: Viewer.ViewerMixin, options?: any): void;
  2396. /**
  2397. * Resizes the widget to match the container size.
  2398. * This function is called automatically as needed unless
  2399. * <code>useDefaultRenderLoop</code> is set to false.
  2400. */
  2401. resize(): void;
  2402. /**
  2403. * This forces the widget to re-think its layout, including
  2404. * widget sizes and credit placement.
  2405. */
  2406. forceResize(): void;
  2407. /**
  2408. * Renders the scene. This function is called automatically
  2409. * unless <code>useDefaultRenderLoop</code> is set to false;
  2410. */
  2411. render(): void;
  2412. /**
  2413. * @returns true if the object has been destroyed, false otherwise.
  2414. */
  2415. isDestroyed(): boolean;
  2416. /**
  2417. * Destroys the widget. Should be called if permanently
  2418. * removing the widget from layout.
  2419. */
  2420. destroy(): void;
  2421. /**
  2422. * Asynchronously sets the camera to view the provided entity, entities, or data source.
  2423. * If the data source is still in the process of loading or the visualization is otherwise still loading,
  2424. * this method waits for the data to be ready before performing the zoom.
  2425. *
  2426. * <p>The offset is heading/pitch/range in the local east-north-up reference frame centered at the center of the bounding sphere.
  2427. * The heading and the pitch angles are defined in the local east-north-up reference frame.
  2428. * The heading is the angle from y axis and increasing towards the x axis. Pitch is the rotation from the xy-plane. Positive pitch
  2429. * angles are above the plane. Negative pitch angles are below the plane. The range is the distance from the center. If the range is
  2430. * zero, a range will be computed such that the whole bounding sphere is visible.</p>
  2431. *
  2432. * <p>In 2D, there must be a top down view. The camera will be placed above the target looking down. The height above the
  2433. * target will be the range. The heading will be determined from the offset. If the heading cannot be
  2434. * determined from the offset, the heading will be north.</p>
  2435. * @param target - The entity, array of entities, entity collection, data source, Cesium3DTileset, point cloud, or imagery layer to view. You can also pass a promise that resolves to one of the previously mentioned types.
  2436. * @param [offset] - The offset from the center of the entity in the local east-north-up reference frame.
  2437. * @returns A Promise that resolves to true if the zoom was successful or false if the target is not currently visualized in the scene or the zoom was cancelled.
  2438. */
  2439. zoomTo(target: Entity | Entity[] | EntityCollection | DataSource | ImageryLayer | Cesium3DTileset | TimeDynamicPointCloud | Promise<Entity | Entity[] | EntityCollection | DataSource | ImageryLayer | Cesium3DTileset | TimeDynamicPointCloud | VoxelPrimitive>, offset?: HeadingPitchRange): Promise<boolean>;
  2440. /**
  2441. * Flies the camera to the provided entity, entities, or data source.
  2442. * If the data source is still in the process of loading or the visualization is otherwise still loading,
  2443. * this method waits for the data to be ready before performing the flight.
  2444. *
  2445. * <p>The offset is heading/pitch/range in the local east-north-up reference frame centered at the center of the bounding sphere.
  2446. * The heading and the pitch angles are defined in the local east-north-up reference frame.
  2447. * The heading is the angle from y axis and increasing towards the x axis. Pitch is the rotation from the xy-plane. Positive pitch
  2448. * angles are above the plane. Negative pitch angles are below the plane. The range is the distance from the center. If the range is
  2449. * zero, a range will be computed such that the whole bounding sphere is visible.</p>
  2450. *
  2451. * <p>In 2D, there must be a top down view. The camera will be placed above the target looking down. The height above the
  2452. * target will be the range. The heading will be determined from the offset. If the heading cannot be
  2453. * determined from the offset, the heading will be north.</p>
  2454. * @param target - The entity, array of entities, entity collection, data source, Cesium3DTileset, point cloud, or imagery layer to view. You can also pass a promise that resolves to one of the previously mentioned types.
  2455. * @param [options] - Object with the following properties:
  2456. * @param [options.duration = 3.0] - The duration of the flight in seconds.
  2457. * @param [options.maximumHeight] - The maximum height at the peak of the flight.
  2458. * @param [options.offset] - The offset from the target in the local east-north-up reference frame centered at the target.
  2459. * @returns A Promise that resolves to true if the flight was successful or false if the target is not currently visualized in the scene or the flight was cancelled. //TODO: Cleanup entity mentions
  2460. */
  2461. flyTo(target: Entity | Entity[] | EntityCollection | DataSource | ImageryLayer | Cesium3DTileset | TimeDynamicPointCloud | Promise<Entity | Entity[] | EntityCollection | DataSource | ImageryLayer | Cesium3DTileset | TimeDynamicPointCloud | VoxelPrimitive>, options?: {
  2462. duration?: number;
  2463. maximumHeight?: number;
  2464. offset?: HeadingPitchRange;
  2465. }): Promise<boolean>;
  2466. }
  2467. /**
  2468. * A mixin which adds the {@link Cesium3DTilesInspector} widget to the {@link Viewer} widget.
  2469. * Rather than being called directly, this function is normally passed as
  2470. * a parameter to {@link Viewer#extend}, as shown in the example below.
  2471. * @example
  2472. * const viewer = new Cesium.Viewer('cesiumContainer');
  2473. * viewer.extend(Cesium.viewerCesium3DTilesInspectorMixin);
  2474. * @param viewer - The viewer instance.
  2475. */
  2476. export function viewerCesium3DTilesInspectorMixin(viewer: Viewer): void;
  2477. /**
  2478. * A mixin which adds the CesiumInspector widget to the Viewer widget.
  2479. * Rather than being called directly, this function is normally passed as
  2480. * a parameter to {@link Viewer#extend}, as shown in the example below.
  2481. * @example
  2482. * const viewer = new Cesium.Viewer('cesiumContainer');
  2483. * viewer.extend(Cesium.viewerCesiumInspectorMixin);
  2484. * @param viewer - The viewer instance.
  2485. */
  2486. export function viewerCesiumInspectorMixin(viewer: Viewer): void;
  2487. /**
  2488. * A mixin which adds default drag and drop support for CZML files to the Viewer widget.
  2489. * Rather than being called directly, this function is normally passed as
  2490. * a parameter to {@link Viewer#extend}, as shown in the example below.
  2491. * @example
  2492. * // Add basic drag and drop support and pop up an alert window on error.
  2493. * const viewer = new Cesium.Viewer('cesiumContainer');
  2494. * viewer.extend(Cesium.viewerDragDropMixin);
  2495. * viewer.dropError.addEventListener(function(viewerArg, source, error) {
  2496. * window.alert('Error processing ' + source + ':' + error);
  2497. * });
  2498. * @param viewer - The viewer instance.
  2499. * @param [options] - Object with the following properties:
  2500. * @param [options.dropTarget = viewer.container] - The DOM element which will serve as the drop target.
  2501. * @param [options.clearOnDrop = true] - When true, dropping files will clear all existing data sources first, when false, new data sources will be loaded after the existing ones.
  2502. * @param [options.flyToOnDrop = true] - When true, dropping files will fly to the data source once it is loaded.
  2503. * @param [options.clampToGround = true] - When true, datasources are clamped to the ground.
  2504. * @param [options.proxy] - The proxy to be used for KML network links.
  2505. */
  2506. export function viewerDragDropMixin(viewer: Viewer, options?: {
  2507. dropTarget?: Element | string;
  2508. clearOnDrop?: boolean;
  2509. flyToOnDrop?: boolean;
  2510. clampToGround?: boolean;
  2511. proxy?: Proxy;
  2512. }): void;
  2513. /**
  2514. * A mixin which adds the {@link PerformanceWatchdog} widget to the {@link Viewer} widget.
  2515. * Rather than being called directly, this function is normally passed as
  2516. * a parameter to {@link Viewer#extend}, as shown in the example below.
  2517. * @example
  2518. * const viewer = new Cesium.Viewer('cesiumContainer');
  2519. * viewer.extend(Cesium.viewerPerformanceWatchdogMixin, {
  2520. * lowFrameRateMessage : 'Why is this going so <em>slowly</em>?'
  2521. * });
  2522. * @param viewer - The viewer instance.
  2523. * @param [options] - An object with properties.
  2524. * @param [options.lowFrameRateMessage = 'This application appears to be performing poorly on your system. Please try using a different web browser or updating your video drivers.'] - The
  2525. * message to display when a low frame rate is detected. The message is interpeted as HTML, so make sure
  2526. * it comes from a trusted source so that your application is not vulnerable to cross-site scripting attacks.
  2527. */
  2528. export function viewerPerformanceWatchdogMixin(viewer: Viewer, options?: {
  2529. lowFrameRateMessage?: string;
  2530. }): void;
  2531. /**
  2532. * A mixin which adds the {@link VoxelInspector} widget to the {@link Viewer} widget.
  2533. * Rather than being called directly, this function is normally passed as
  2534. * a parameter to {@link Viewer#extend}, as shown in the example below.
  2535. * @example
  2536. * var viewer = new Cesium.Viewer('cesiumContainer');
  2537. * viewer.extend(Cesium.viewerVoxelInspectorMixin);
  2538. * @param viewer - The viewer instance.
  2539. */
  2540. export function viewerVoxelInspectorMixin(viewer: Viewer): void;
  2541. /**
  2542. * Inspector widget to aid in debugging voxels
  2543. * @param container - The DOM element or ID that will contain the widget.
  2544. * @param scene - the Scene instance to use.
  2545. */
  2546. export class VoxelInspector {
  2547. constructor(container: Element | string, scene: Scene);
  2548. /**
  2549. * Gets the parent container.
  2550. */
  2551. container: Element;
  2552. /**
  2553. * Gets the view model.
  2554. */
  2555. viewModel: VoxelInspectorViewModel;
  2556. /**
  2557. * @returns true if the object has been destroyed, false otherwise.
  2558. */
  2559. isDestroyed(): boolean;
  2560. /**
  2561. * Destroys the widget. Should be called if permanently
  2562. * removing the widget from layout.
  2563. */
  2564. destroy(): void;
  2565. }
  2566. /**
  2567. * The view model for {@link VoxelInspector}.
  2568. * @param scene - The scene instance to use.
  2569. */
  2570. export class VoxelInspectorViewModel {
  2571. constructor(scene: Scene);
  2572. /**
  2573. * Gets the scene
  2574. */
  2575. readonly scene: Scene;
  2576. /**
  2577. * Gets or sets the primitive of the view model.
  2578. */
  2579. voxelPrimitive: VoxelPrimitive;
  2580. /**
  2581. * Toggles the inspector visibility
  2582. */
  2583. toggleInspector(): void;
  2584. /**
  2585. * Toggles the visibility of the display section
  2586. */
  2587. toggleDisplay(): void;
  2588. /**
  2589. * Toggles the visibility of the transform section
  2590. */
  2591. toggleTransform(): void;
  2592. /**
  2593. * Toggles the visibility of the bounds section
  2594. */
  2595. toggleBounds(): void;
  2596. /**
  2597. * Toggles the visibility of the clipping section
  2598. */
  2599. toggleClipping(): void;
  2600. /**
  2601. * Toggles the visibility of the shader section
  2602. */
  2603. toggleShader(): void;
  2604. /**
  2605. * Compiles the shader in the shader editor.
  2606. */
  2607. compileShader(): void;
  2608. /**
  2609. * Handles key press events on the shader editor.
  2610. */
  2611. shaderEditorKeyPress(): void;
  2612. /**
  2613. * @returns true if the object has been destroyed, false otherwise.
  2614. */
  2615. isDestroyed(): boolean;
  2616. /**
  2617. * Destroys the widget. Should be called if permanently
  2618. * removing the widget from layout.
  2619. */
  2620. destroy(): void;
  2621. }
  2622. /**
  2623. * Create a Command from a given function, for use with ViewModels.
  2624. *
  2625. * A Command is a function with an extra <code>canExecute</code> observable property to determine
  2626. * whether the command can be executed. When executed, a Command function will check the
  2627. * value of <code>canExecute</code> and throw if false. It also provides events for when
  2628. * a command has been or is about to be executed.
  2629. * @param func - The function to execute.
  2630. * @param [canExecute = true] - A boolean indicating whether the function can currently be executed.
  2631. */
  2632. export function createCommand(func: (...params: any[]) => any, canExecute?: boolean): void;
  2633. }