Skip to content

Commit

Permalink
chore: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
hongfaqiu committed Jul 31, 2024
1 parent f636fc7 commit 1181b86
Show file tree
Hide file tree
Showing 118 changed files with 17,483 additions and 10,566 deletions.
94 changes: 47 additions & 47 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
name: Release
on:
push:
branches:
- master
- next
- next-major
- alpha
- beta

permissions:
packages: write
contents: write

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
cache: pnpm

- name: Install dependencies
run: pnpm install --no-frozen-lockfile

- name: Build
run: pnpm run build

- name: Test
run: pnpm run test

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: pnpm release
name: Release
on:
push:
branches:
- master
- next
- next-major
- alpha
- beta

permissions:
packages: write
contents: write

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
cache: pnpm

- name: Install dependencies
run: pnpm install --no-frozen-lockfile

- name: Build
run: pnpm run build

- name: Test
run: pnpm run test

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: pnpm release
6 changes: 3 additions & 3 deletions doc/.dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ export default defineConfig({
socialLinks: {
github: 'https://github.com/hongfaqiu/cesium-extends',
},
logo: "/logo.svg"
logo: '/logo.svg',
},
alias: {
'@': path.resolve(__dirname, 'src'),
cesium: path.resolve(__dirname, 'node_modules/cesium')
cesium: path.resolve(__dirname, 'node_modules/cesium'),
},
copy: [
{ from: path.join(cesiumSource, cesiumWorkers), to: 'dist/cesium/Workers' },
Expand All @@ -24,5 +24,5 @@ export default defineConfig({
define: {
CESIUM_BASE_URL: '/cesium',
},
jsMinifier: 'terser'
jsMinifier: 'terser',
});
9 changes: 2 additions & 7 deletions doc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
# doc 1.0.0 (2023-04-04)


### Features

* initial ([e21d004](https://github.com/hongfaqiu/cesium-extends/commit/e21d00448ca613d6b168e59368fae4ba815950d3))




- initial ([e21d004](https://github.com/hongfaqiu/cesium-extends/commit/e21d00448ca613d6b168e59368fae4ba815950d3))

### Dependencies

* **cesium-extends:** upgraded to 1.0.0
- **cesium-extends:** upgraded to 1.0.0
10 changes: 4 additions & 6 deletions doc/src/components/Map/compass.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,17 @@ const Map: React.FC<MapProps> = () => {
};

useEffect(() => {
viewer = initMap('cesiumContainer')
viewer = initMap('cesiumContainer');

CompassObj.current = new Compass(viewer);

return () => {
reset();
viewer?.destroy()
}
viewer?.destroy();
};
}, []);

return (
<div id="cesiumContainer"/>
);
return <div id="cesiumContainer" />;
};

export default Map;
55 changes: 31 additions & 24 deletions doc/src/components/Map/drawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ import { CartesiantoLonlat } from '@/utils/funcs';
interface MapProps {}

const Map: React.FC<MapProps> = () => {
const viewer = useRef<Viewer>()
const viewer = useRef<Viewer>();
const DrawerTool = useRef<Drawer>();

useEffect(() => {
viewer.current = initMap('cesiumContainer')
viewer.current = initMap('cesiumContainer');
DrawerTool.current = new Drawer(viewer.current, {
tips: {
init: '点击绘制',
start: '左键添加点,右键移除点,双击结束绘制',
}
},
});

return () => {
DrawerTool.current?.destroy();
DrawerTool.current = undefined;
viewer.current?.destroy()
}
viewer.current?.destroy();
};
}, []);

const startDraw = (type: StartOption['type']) => {
Expand All @@ -34,51 +34,58 @@ const Map: React.FC<MapProps> = () => {
DrawerTool.current?.start({
type: type,
onEnd: (entity, positions) => {
console.log(entity, positions.map(pos => CartesiantoLonlat(pos, viewer.current as Viewer)))
console.log(
entity,
positions.map((pos) =>
CartesiantoLonlat(pos, viewer.current as Viewer),
),
);
},
});
}
};

const clear = () => {
DrawerTool.current?.reset();
}
};

const operations: {
type: StartOption['type'],
type: StartOption['type'];
label: string;
}[] = [
{
type: 'POINT',
label: '点'
label: '点',
},
{
type: 'POLYLINE',
label: '线'
label: '线',
},
{
type: 'POLYGON',
label: '多边形'
label: '多边形',
},
{
type: 'CIRCLE',
label: '圆形'
label: '圆形',
},
{
type: 'RECTANGLE',
label: '矩形'
label: '矩形',
},
]
];

return <div id="cesiumContainer">
<div className='draw-tools'>
{operations.map((op) => (
<button key={op.type} onClick={() => startDraw(op.type)}>
{op.label}
</button>
))}
<button onClick={clear}>清除</button>
return (
<div id="cesiumContainer">
<div className="draw-tools">
{operations.map((op) => (
<button key={op.type} onClick={() => startDraw(op.type)}>
{op.label}
</button>
))}
<button onClick={clear}>清除</button>
</div>
</div>
</div>
);
};

export default Map;
42 changes: 28 additions & 14 deletions doc/src/components/Map/geojson-render/bubble-auto.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { DataSource, Viewer } from 'cesium';
import React, { useEffect } from 'react';
import { renderGeoJson, GeoJsonPrimitiveLayer, renderPrimitiveGeoJson, GeoJsonStyle, GeoJsonRenderConfig, updateDataSourcePosition } from 'cesium-extends';
import {
renderGeoJson,
GeoJsonPrimitiveLayer,
renderPrimitiveGeoJson,
GeoJsonStyle,
GeoJsonRenderConfig,
updateDataSourcePosition,
} from 'cesium-extends';
import { GeoJsonDataSource } from 'cesium';

import { initMap } from '@/utils/initMap';
Expand All @@ -18,22 +25,30 @@ const config: GeoJsonRenderConfig = {
'section-num': 10,
'label-size': [2, 40],
'circle-stroke-width': 1,
'circle-stroke-color': 'white'
}
}
}
'circle-stroke-color': 'white',
},
},
};

async function addGeojsonByDataSource(viewer: Viewer, url: string, config: GeoJsonRenderConfig) {
async function addGeojsonByDataSource(
viewer: Viewer,
url: string,
config: GeoJsonRenderConfig,
) {
const dataSource: DataSource = await GeoJsonDataSource.load(url);
updateDataSourcePosition(dataSource);
await renderGeoJson(dataSource, config);
await viewer.dataSources.add(dataSource);
return dataSource;
}

async function addGeojsonByPrimitive(viewer: Viewer, url: string, config: GeoJsonRenderConfig) {
async function addGeojsonByPrimitive(
viewer: Viewer,
url: string,
config: GeoJsonRenderConfig,
) {
const primitiveLayer = await primitiveObj.load(url);
await renderPrimitiveGeoJson(primitiveObj, config)
await renderPrimitiveGeoJson(primitiveObj, config);
viewer.scene.primitives.add(primitiveLayer.primitiveCollection);
viewer.scene.primitives.lowerToBottom(primitiveLayer.primitiveCollection);

Expand All @@ -42,17 +57,16 @@ async function addGeojsonByPrimitive(viewer: Viewer, url: string, config: GeoJso

let viewer: Viewer;
const Map: React.FC = () => {

useEffect(() => {
viewer = initMap('cesiumContainer')
addGeojsonByDataSource(viewer, '/earthquack.geojson', config)
viewer = initMap('cesiumContainer');
addGeojsonByDataSource(viewer, '/earthquack.geojson', config);

return () => {
viewer?.destroy()
}
viewer?.destroy();
};
}, []);

return <div id="cesiumContainer"/>;
return <div id="cesiumContainer" />;
};

export default Map;
Loading

0 comments on commit 1181b86

Please sign in to comment.