npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lijuhong1981/cesium.utils

v0.4.1

Published

Cesium 公共工具库:Cesium 类扩展(revisions)、值解析(parses)、坐标/矩阵变换、通用工具函数

Downloads

112

Readme

cesium-utils

Cesium 公共工具库。

目录结构

src/
├── index.js          # 库入口
├── revisions/        # Cesium 类的扩展/补丁(monkey-patch)
├── parses/           # 值解析工具(字符串/数字 → Cesium 类型)
├── additions/        # 坐标/矩阵变换族 + Geographic/PropertyType 类型
└── utils/            # Scratch 缓存 + 通用工具函数

使用

方式一:ES Module(npm 引入)

适用于用打包工具(webpack / vite / rollup 等)构建的项目。cesium 作为 peerDependency 由使用方提供,确保扩展与使用方共享同一个 Cesium 实例,monkey-patch 才能全局生效。

npm install @lijuhong1981/cesium.utils cesium
import * as CesiumUtils from '@lijuhong1981/cesium.utils';
// 或按需引入
import { Geographic, parseToCartesian3 } from '@lijuhong1981/cesium.utils';

方式二:浏览器全局(<script> 标签)

适用于不用打包工具、直接通过 <script> 标签加载 Cesium(全局 window.Cesium)的项目。使用本库的 UMD 产物,它会把 revisions 的补丁自动应用到全局 Cesium 上。

<script src="Cesium/Cesium.js"></script>
<script src="cesium.utils.min.js"></script>
<script>
  // 此时 revisions 的 monkey-patch 已作用于全局 Cesium
  const c3 = CesiumUtils.parseToCartesian3([120, 30, 100]);
  const geo = new CesiumUtils.Geographic(120, 30, 100);
</script>

也可通过 CDN 直接引入:

<script src="https://unpkg.com/@lijuhong1981/cesium.utils/dist/cesium.utils.min.js"></script>

产物说明:

| 文件 | 格式 | 说明 | | --- | --- | --- | | dist/cesium.utils.umd.js | UMD | 未压缩,便于调试,全局名 CesiumUtils | | dist/cesium.utils.min.js | UMD | 压缩版,供 CDN / 生产使用 | | dist/cesium.utils.esm.js | ESM | 单文件打包版 |

构建

npm run build   # rollup 打包,输出到 dist/

cesium 在打包时作为 external,映射到全局 Cesium;@lijuhong1981/* 等依赖会一并打入产物。

依赖

  • cesium(peer,>=1.107.0)
  • @lijuhong1981/jsmath / jscheck / jslib / jsdestroy(公共基础包)

API 文档

文档使用 JSDoc + docdash 生成:

npm install
npm run docs   # 生成到 docs/ 目录

打开 docs/index.html 查看。文档覆盖:

  • revisions/:Cesium 类扩展(@class + @memberof 归到对应 Cesium 类下)
  • parses/:解析函数
  • additions/:变换类与 Geographic 类型
  • utils/:工具函数(Scratch 缓存已排除)

模块说明

  • revisions/:25 个 Cesium 类扩展(BoundingSphere、Camera、Cartesian、Matrix、Rectangle 等)。
  • parses/:45 个解析函数。
  • additions/:Geographic、GeographicTransform、ModelMatrixTransforms、StTransforms、TranslationRotationScaleTransform、PropertyChangedListener、GeometryInstanceAttributes、PropertyType。
  • utils/:Scratch + 12 个通用函数。

暂未迁入

  • revisions/IntersectionTests.revise.js:依赖第四层 PCI3DTileset,且引用了未定义的 Check/PCI3MXTileset/InnerWorker/WorkerMessageType。
  • revisions/ 中 4 个未导出文件:Model / ModelNode / ParticleSystem / ScreenSpaceCameraController。
  • materials/、tiles/、defines/ 其余、draws/、primitives/、domUI/、additions/ 中的业务类。
  • utils/ 中与媒体播放 / DOM / 部署地址相关的工具。