@operato/weather 9.0.0-beta.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.md +337 -0
- package/assets/images/no-image.png +0 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/layers/base-weather-layer.d.ts +56 -0
- package/dist/src/layers/base-weather-layer.js +83 -0
- package/dist/src/layers/base-weather-layer.js.map +1 -0
- package/dist/src/layers/cloud-layer.d.ts +17 -0
- package/dist/src/layers/cloud-layer.js +203 -0
- package/dist/src/layers/cloud-layer.js.map +1 -0
- package/dist/src/layers/precipitation-layer.d.ts +27 -0
- package/dist/src/layers/precipitation-layer.js +344 -0
- package/dist/src/layers/precipitation-layer.js.map +1 -0
- package/dist/src/layers/solar-layer.d.ts +17 -0
- package/dist/src/layers/solar-layer.js +253 -0
- package/dist/src/layers/solar-layer.js.map +1 -0
- package/dist/src/layers/temperature-layer.d.ts +13 -0
- package/dist/src/layers/temperature-layer.js +230 -0
- package/dist/src/layers/temperature-layer.js.map +1 -0
- package/dist/src/layers/wind-layer.d.ts +60 -0
- package/dist/src/layers/wind-layer.js +311 -0
- package/dist/src/layers/wind-layer.js.map +1 -0
- package/dist/src/ox-weather.d.ts +112 -0
- package/dist/src/ox-weather.js +645 -0
- package/dist/src/ox-weather.js.map +1 -0
- package/dist/src/ox-wind.d.ts +91 -0
- package/dist/src/ox-wind.js +425 -0
- package/dist/src/ox-wind.js.map +1 -0
- package/dist/src/services/weather-service.d.ts +79 -0
- package/dist/src/services/weather-service.js +560 -0
- package/dist/src/services/weather-service.js.map +1 -0
- package/dist/src/types.d.ts +71 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/stories/data-weather.stories.d.ts +47 -0
- package/dist/stories/data-weather.stories.js +93 -0
- package/dist/stories/data-weather.stories.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +86 -0
- package/themes/app-theme.css +138 -0
- package/themes/calendar-theme.css +61 -0
- package/themes/dark.css +51 -0
- package/themes/form-theme.css +70 -0
- package/themes/grist-theme.css +175 -0
- package/themes/layout-theme.css +94 -0
- package/themes/light.css +51 -0
- package/themes/material-theme.css +23 -0
- package/themes/md-typescale-styles.css +100 -0
- package/themes/oops-theme.css +22 -0
- package/themes/report-theme.css +47 -0
- package/themes/spacing.css +23 -0
- package/themes/state-color.css +6 -0
- package/themes/tooltip-theme.css +11 -0
- package/translations/en.json +1 -0
- package/translations/ja.json +1 -0
- package/translations/ko.json +1 -0
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [9.0.0-beta.56](https://github.com/hatiolab/operato/compare/v9.0.0-beta.55...v9.0.0-beta.56) (2025-03-30)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### :rocket: New Features
|
|
10
|
+
|
|
11
|
+
* added ox-weather module ([7dcc41f](https://github.com/hatiolab/operato/commit/7dcc41f7eb52ee994c52b3918f42e368c53cc163))
|
|
12
|
+
* tuning ox-weather module ([c6aa02f](https://github.com/hatiolab/operato/commit/c6aa02f12305668fff7b97642b5f4af7b07f6816))
|
|
13
|
+
* tuning ox-weather module ([1e00c4b](https://github.com/hatiolab/operato/commit/1e00c4b92f750c3dc9c31aaf769df6b8d75c41ad))
|
|
14
|
+
* tuning ox-weather module ([7dcdd76](https://github.com/hatiolab/operato/commit/7dcdd766311fc5556544b28d32e7ac99c7bcca58))
|
|
15
|
+
* tuning ox-weather module ([9d88257](https://github.com/hatiolab/operato/commit/9d882579b9ef991f633c253f36c95263adf5f373))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### :bug: Bug Fix
|
|
19
|
+
|
|
20
|
+
* ox-wind ([c211a65](https://github.com/hatiolab/operato/commit/c211a65bf5cb202b3e065edc1d145add50e1f9f6))
|
|
21
|
+
* title for ox-grist stories and README.md ([38476a5](https://github.com/hatiolab/operato/commit/38476a5994b142f29205014aa0238a1724fd7de1))
|
package/README.md
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
# OX-Weather Component
|
|
2
|
+
|
|
3
|
+
OX-Weather는 지도 위에 실시간 기상 데이터를 시각화하는 강력한 웹 컴포넌트입니다. 다양한 기상 요소(풍향/풍속, 강수량, 기온, 일사량, 구름 등)를 직관적이고 아름다운 그래픽으로 표현합니다.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## 주요 기능
|
|
8
|
+
|
|
9
|
+
- **다중 레이어 시각화**: 동시에 여러 기상 요소를 레이어로 표시
|
|
10
|
+
- **고성능 렌더링**: WebGL 기반의 렌더링으로 부드러운 애니메이션과 대용량 데이터 처리
|
|
11
|
+
- **반응형 디자인**: 모바일부터 대형 화면까지 모든 기기에 최적화
|
|
12
|
+
- **실시간 데이터**: 자동 업데이트로 최신 기상 정보 제공
|
|
13
|
+
- **다양한 데이터 소스**: 여러 기상 API 서비스와 통합 (OpenWeatherMap, Weatherbit, 기상청 등)
|
|
14
|
+
- **사용자 지정 테마**: 다크 모드, 라이트 모드 및 맞춤형 색상 테마 지원
|
|
15
|
+
- **국제화**: 다국어 지원 및 단위 변환 기능
|
|
16
|
+
- **날씨 예보**: 현재 날씨뿐만 아니라 시간별, 일별 예보 제공
|
|
17
|
+
- **이벤트 알림**: 악천후 및 위험 기상 상황에 대한 알림 기능
|
|
18
|
+
- **맞춤형 시각화**: 색상 스키마, 레이어 투명도, 애니메이션 속도 등 조정 가능
|
|
19
|
+
|
|
20
|
+
## 설치
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @operato/weather
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 기본 사용법
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<script type="module">
|
|
30
|
+
import '@operato/weather/ox-weather.js'
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<ox-weather
|
|
34
|
+
latitude="37.5665"
|
|
35
|
+
longitude="126.9780"
|
|
36
|
+
zoom="7"
|
|
37
|
+
api-key="YOUR_API_KEY"
|
|
38
|
+
active-layers='["wind", "temperature", "precipitation"]'
|
|
39
|
+
></ox-weather>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## 레이어 유형
|
|
43
|
+
|
|
44
|
+
OX-Weather는 다음과 같은 기상 레이어를 지원합니다:
|
|
45
|
+
|
|
46
|
+
### 1. 바람 레이어 (Wind Layer)
|
|
47
|
+
|
|
48
|
+
- 바람의 방향과 속도를 파티클 애니메이션으로 표현
|
|
49
|
+
- 다양한 시각화 스타일: 파티클, 벡터, 흐름선(streamline)
|
|
50
|
+
- 속도에 따른 색상 변화
|
|
51
|
+
|
|
52
|
+
### 2. 기온 레이어 (Temperature Layer)
|
|
53
|
+
|
|
54
|
+
- 등온선(isothermal) 및 히트맵 표현
|
|
55
|
+
- 사용자 정의 색상 스키마
|
|
56
|
+
- 섭씨/화씨 단위 변환
|
|
57
|
+
|
|
58
|
+
### 3. 강수량 레이어 (Precipitation Layer)
|
|
59
|
+
|
|
60
|
+
- 비, 눈, 우박 등 강수 유형 구분
|
|
61
|
+
- 강수 강도에 따른 색상 및 애니메이션 변화
|
|
62
|
+
- 레이더 스타일 애니메이션
|
|
63
|
+
|
|
64
|
+
### 4. 일사량 레이어 (Solar Layer)
|
|
65
|
+
|
|
66
|
+
- 지역별 일사량 표시
|
|
67
|
+
- 시간에 따른 일사량 변화 애니메이션
|
|
68
|
+
- 태양광 발전 관련 정보 통합
|
|
69
|
+
|
|
70
|
+
### 5. 구름 레이어 (Cloud Layer)
|
|
71
|
+
|
|
72
|
+
- 구름량 및 운고 표시
|
|
73
|
+
- 구름 타입 구분 (적운, 층운, 권운 등)
|
|
74
|
+
- 반투명 시각화
|
|
75
|
+
|
|
76
|
+
## 고급 설정
|
|
77
|
+
|
|
78
|
+
```javascript
|
|
79
|
+
const weatherElement = document.querySelector('ox-weather')
|
|
80
|
+
|
|
81
|
+
// 지도 초점 변경
|
|
82
|
+
weatherElement.setView({
|
|
83
|
+
latitude: 35.6895,
|
|
84
|
+
longitude: 139.6917,
|
|
85
|
+
zoom: 8
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
// 날씨 데이터 소스 설정
|
|
89
|
+
weatherElement.configureDataSource({
|
|
90
|
+
provider: 'openweathermap', // 'weatherbit', 'meteomatics', 'custom'
|
|
91
|
+
apiKey: 'YOUR_API_KEY',
|
|
92
|
+
updateInterval: 600, // 초 단위
|
|
93
|
+
mockData: false // 개발용 목업 데이터 사용
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
// 레이어 설정
|
|
97
|
+
weatherElement.configureLayer('wind', {
|
|
98
|
+
visible: true,
|
|
99
|
+
opacity: 0.8,
|
|
100
|
+
style: 'particle', // 'particle', 'vector', 'streamline'
|
|
101
|
+
particleDensity: 'medium', // 'low', 'medium', 'high'
|
|
102
|
+
colorScheme: 'rainbow', // 'rainbow', 'bluered', 'monochrome'
|
|
103
|
+
animationSpeed: 1.2
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
// 이벤트 리스너
|
|
107
|
+
weatherElement.addEventListener('weather-data-update', e => {
|
|
108
|
+
console.log('날씨 데이터 업데이트됨', e.detail)
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
weatherElement.addEventListener('layer-toggle', e => {
|
|
112
|
+
const { layer, active } = e.detail
|
|
113
|
+
console.log(`${layer} 레이어 ${active ? '활성화' : '비활성화'}`)
|
|
114
|
+
})
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## API 참조
|
|
118
|
+
|
|
119
|
+
### 속성 (Properties)
|
|
120
|
+
|
|
121
|
+
| 속성 | 타입 | 설명 |
|
|
122
|
+
| ---------------- | ------ | --------------------------------------- |
|
|
123
|
+
| `latitude` | Number | 지도 중심 위도 |
|
|
124
|
+
| `longitude` | Number | 지도 중심 경도 |
|
|
125
|
+
| `zoom` | Number | 지도 줌 레벨 |
|
|
126
|
+
| `activeLayers` | Array | 활성화된 레이어 목록 |
|
|
127
|
+
| `apiKey` | String | 날씨 API 키 |
|
|
128
|
+
| `provider` | String | 날씨 데이터 제공자 |
|
|
129
|
+
| `theme` | String | 시각화 테마 ('light', 'dark', 'custom') |
|
|
130
|
+
| `units` | String | 측정 단위 ('metric', 'imperial') |
|
|
131
|
+
| `updateInterval` | Number | 데이터 업데이트 간격(초) |
|
|
132
|
+
| `forecastDays` | Number | 일기 예보 표시 일수 |
|
|
133
|
+
| `language` | String | UI 언어 코드 |
|
|
134
|
+
|
|
135
|
+
### 메서드 (Methods)
|
|
136
|
+
|
|
137
|
+
| 메서드 | 설명 |
|
|
138
|
+
| ------------------------------- | -------------------------- |
|
|
139
|
+
| `setView(options)` | 지도 보기 설정 |
|
|
140
|
+
| `configureDataSource(options)` | 데이터 소스 설정 |
|
|
141
|
+
| `configureLayer(type, options)` | 레이어별 설정 |
|
|
142
|
+
| `refresh()` | 날씨 데이터 수동 새로고침 |
|
|
143
|
+
| `exportData()` | 현재 날씨 데이터 내보내기 |
|
|
144
|
+
| `captureImage()` | 현재 뷰를 이미지로 캡처 |
|
|
145
|
+
| `addMarker(lat, lng, options)` | 지도에 마커 추가 |
|
|
146
|
+
| `setRegionFilter(geoJSON)` | 특정 지역으로 표시 제한 |
|
|
147
|
+
| `setTimeOffset(hours)` | 예보 시각 오프셋 설정 |
|
|
148
|
+
| `getWeatherAt(lat, lng)` | 특정 위치의 날씨 정보 조회 |
|
|
149
|
+
| `showForecast(lat, lng)` | 특정 위치의 예보 표시 |
|
|
150
|
+
|
|
151
|
+
### 이벤트 (Events)
|
|
152
|
+
|
|
153
|
+
| 이벤트 | 설명 |
|
|
154
|
+
| --------------------- | ---------------------------- |
|
|
155
|
+
| `weather-data-update` | 날씨 데이터 업데이트 시 발생 |
|
|
156
|
+
| `layer-toggle` | 레이어 토글 시 발생 |
|
|
157
|
+
| `map-click` | 지도 클릭 시 발생 |
|
|
158
|
+
| `view-change` | 지도 뷰 변경 시 발생 |
|
|
159
|
+
| `weather-alert` | 기상 경보 발생 시 |
|
|
160
|
+
| `loading-change` | 로딩 상태 변경 시 |
|
|
161
|
+
| `error` | 오류 발생 시 |
|
|
162
|
+
|
|
163
|
+
## 시각화 커스터마이징
|
|
164
|
+
|
|
165
|
+
OX-Weather는 CSS 변수를 통해 시각화를 사용자 정의할 수 있습니다.
|
|
166
|
+
|
|
167
|
+
```css
|
|
168
|
+
ox-weather {
|
|
169
|
+
--wind-color-scheme: 'bluered';
|
|
170
|
+
--temp-cold-color: #0077ff;
|
|
171
|
+
--temp-hot-color: #ff3300;
|
|
172
|
+
--precipitation-base-color: #00aaff;
|
|
173
|
+
--map-background: #f5f5f5;
|
|
174
|
+
--animation-speed: 1.2;
|
|
175
|
+
--layer-opacity: 0.8;
|
|
176
|
+
--ui-font-family: 'Roboto', sans-serif;
|
|
177
|
+
--ui-primary-color: #2c3e50;
|
|
178
|
+
--ui-accent-color: #3498db;
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## 통합 예제
|
|
183
|
+
|
|
184
|
+
### React 통합
|
|
185
|
+
|
|
186
|
+
```jsx
|
|
187
|
+
import React, { useRef, useEffect } from 'react'
|
|
188
|
+
import '@operato/weather/ox-weather.js'
|
|
189
|
+
|
|
190
|
+
function WeatherMap() {
|
|
191
|
+
const weatherRef = useRef(null)
|
|
192
|
+
|
|
193
|
+
useEffect(() => {
|
|
194
|
+
if (weatherRef.current) {
|
|
195
|
+
// 설정 및 이벤트 리스너 추가
|
|
196
|
+
weatherRef.current.addEventListener('weather-data-update', handleUpdate)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return () => {
|
|
200
|
+
if (weatherRef.current) {
|
|
201
|
+
weatherRef.current.removeEventListener('weather-data-update', handleUpdate)
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}, [])
|
|
205
|
+
|
|
206
|
+
const handleUpdate = e => {
|
|
207
|
+
console.log('날씨 데이터:', e.detail)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return (
|
|
211
|
+
<ox-weather
|
|
212
|
+
ref={weatherRef}
|
|
213
|
+
latitude="37.5665"
|
|
214
|
+
longitude="126.9780"
|
|
215
|
+
zoom="7"
|
|
216
|
+
api-key="YOUR_API_KEY"
|
|
217
|
+
active-layers='["wind", "temperature"]'
|
|
218
|
+
></ox-weather>
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export default WeatherMap
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Vue 통합
|
|
226
|
+
|
|
227
|
+
```vue
|
|
228
|
+
<template>
|
|
229
|
+
<ox-weather
|
|
230
|
+
ref="weatherMap"
|
|
231
|
+
:latitude="37.5665"
|
|
232
|
+
:longitude="126.978"
|
|
233
|
+
:zoom="7"
|
|
234
|
+
:api-key="apiKey"
|
|
235
|
+
:active-layers="['wind', 'precipitation']"
|
|
236
|
+
@weather-data-update="onWeatherUpdate"
|
|
237
|
+
></ox-weather>
|
|
238
|
+
</template>
|
|
239
|
+
|
|
240
|
+
<script>
|
|
241
|
+
import '@operato/weather/ox-weather.js'
|
|
242
|
+
|
|
243
|
+
export default {
|
|
244
|
+
name: 'WeatherMapComponent',
|
|
245
|
+
data() {
|
|
246
|
+
return {
|
|
247
|
+
apiKey: 'YOUR_API_KEY'
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
methods: {
|
|
251
|
+
onWeatherUpdate(e) {
|
|
252
|
+
console.log('날씨 데이터 업데이트:', e.detail)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
</script>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## 라이센스
|
|
260
|
+
|
|
261
|
+
MIT
|
|
262
|
+
|
|
263
|
+
## Linting with ESLint, Prettier, and Types
|
|
264
|
+
|
|
265
|
+
To scan the project for linting errors, run
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
npm run lint
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
You can lint with ESLint and Prettier individually as well
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
npm run lint:eslint
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
npm run lint:prettier
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
To automatically fix many linting errors, run
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
npm run format
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
You can format using ESLint and Prettier individually as well
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
npm run format:eslint
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
npm run format:prettier
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
## Testing with Web Test Runner
|
|
298
|
+
|
|
299
|
+
To run the suite of Web Test Runner tests, run
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
npm run test
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
To run the tests in watch mode (for <abbr title="test driven development">TDD</abbr>, for example), run
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
npm run test:watch
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## Demoing with Storybook
|
|
312
|
+
|
|
313
|
+
To run a local instance of Storybook for your component, run
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
npm run storybook
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
To build a production version of Storybook, run
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
npm run storybook:build
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
## Tooling configs
|
|
326
|
+
|
|
327
|
+
For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
|
|
328
|
+
|
|
329
|
+
If you customize the configuration a lot, you can consider moving them to individual files.
|
|
330
|
+
|
|
331
|
+
## Local Demo with `web-dev-server`
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
npm start
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
To run a local development server that serves the basic demo located in `demo/index.html`
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ox-weather.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA","sourcesContent":["export * from './ox-weather.js'\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import BaseLayer from 'ol/layer/Base.js';
|
|
2
|
+
import { Map } from 'ol';
|
|
3
|
+
import { WeatherData, WeatherLayerType } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* 날씨 레이어의 기본 클래스
|
|
6
|
+
* 모든 레이어 타입은 이 클래스를 상속합니다.
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class BaseWeatherLayer {
|
|
9
|
+
protected map?: Map;
|
|
10
|
+
protected layer?: BaseLayer;
|
|
11
|
+
protected weatherData: WeatherData[];
|
|
12
|
+
/**
|
|
13
|
+
* 레이어의 타입을 반환합니다.
|
|
14
|
+
*/
|
|
15
|
+
abstract getType(): WeatherLayerType;
|
|
16
|
+
/**
|
|
17
|
+
* 레이어를 생성합니다. 이 메서드는 각 서브클래스에서 구현해야 합니다.
|
|
18
|
+
*/
|
|
19
|
+
abstract createLayer(): BaseLayer;
|
|
20
|
+
/**
|
|
21
|
+
* 맵에 레이어를 추가합니다.
|
|
22
|
+
*/
|
|
23
|
+
addToMap(map: Map): BaseLayer;
|
|
24
|
+
/**
|
|
25
|
+
* 맵에서 레이어를 제거합니다.
|
|
26
|
+
*/
|
|
27
|
+
removeFromMap(): void;
|
|
28
|
+
/**
|
|
29
|
+
* 레이어에 날씨 데이터를 설정합니다.
|
|
30
|
+
*/
|
|
31
|
+
setWeatherData(data: WeatherData[]): void;
|
|
32
|
+
/**
|
|
33
|
+
* 레이어를 업데이트합니다. 데이터가 변경된 경우 호출됩니다.
|
|
34
|
+
*/
|
|
35
|
+
protected updateLayer(): void;
|
|
36
|
+
/**
|
|
37
|
+
* 레이어 인스턴스를 반환합니다.
|
|
38
|
+
*/
|
|
39
|
+
getLayer(): BaseLayer | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* 레이어의 가시성을 설정합니다.
|
|
42
|
+
*/
|
|
43
|
+
setVisible(visible: boolean): void;
|
|
44
|
+
/**
|
|
45
|
+
* 레이어의 가시성 상태를 반환합니다.
|
|
46
|
+
*/
|
|
47
|
+
isVisible(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* 애니메이션을 시작합니다. 애니메이션이 필요한 레이어에서 오버라이드합니다.
|
|
50
|
+
*/
|
|
51
|
+
startAnimation(): void;
|
|
52
|
+
/**
|
|
53
|
+
* 애니메이션을 중지합니다. 애니메이션이 필요한 레이어에서 오버라이드합니다.
|
|
54
|
+
*/
|
|
55
|
+
stopAnimation(): void;
|
|
56
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 날씨 레이어의 기본 클래스
|
|
3
|
+
* 모든 레이어 타입은 이 클래스를 상속합니다.
|
|
4
|
+
*/
|
|
5
|
+
export class BaseWeatherLayer {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.weatherData = [];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 맵에 레이어를 추가합니다.
|
|
11
|
+
*/
|
|
12
|
+
addToMap(map) {
|
|
13
|
+
this.map = map;
|
|
14
|
+
if (!this.layer) {
|
|
15
|
+
this.layer = this.createLayer();
|
|
16
|
+
}
|
|
17
|
+
this.map.addLayer(this.layer);
|
|
18
|
+
return this.layer;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 맵에서 레이어를 제거합니다.
|
|
22
|
+
*/
|
|
23
|
+
removeFromMap() {
|
|
24
|
+
if (this.map && this.layer) {
|
|
25
|
+
this.map.removeLayer(this.layer);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 레이어에 날씨 데이터를 설정합니다.
|
|
30
|
+
*/
|
|
31
|
+
setWeatherData(data) {
|
|
32
|
+
this.weatherData = data;
|
|
33
|
+
this.updateLayer();
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 레이어를 업데이트합니다. 데이터가 변경된 경우 호출됩니다.
|
|
37
|
+
*/
|
|
38
|
+
updateLayer() {
|
|
39
|
+
if (this.layer) {
|
|
40
|
+
this.removeFromMap();
|
|
41
|
+
this.layer = this.createLayer();
|
|
42
|
+
if (this.map) {
|
|
43
|
+
this.map.addLayer(this.layer);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 레이어 인스턴스를 반환합니다.
|
|
49
|
+
*/
|
|
50
|
+
getLayer() {
|
|
51
|
+
return this.layer;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 레이어의 가시성을 설정합니다.
|
|
55
|
+
*/
|
|
56
|
+
setVisible(visible) {
|
|
57
|
+
if (this.layer) {
|
|
58
|
+
this.layer.setVisible(visible);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 레이어의 가시성 상태를 반환합니다.
|
|
63
|
+
*/
|
|
64
|
+
isVisible() {
|
|
65
|
+
if (this.layer) {
|
|
66
|
+
return this.layer.getVisible();
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 애니메이션을 시작합니다. 애니메이션이 필요한 레이어에서 오버라이드합니다.
|
|
72
|
+
*/
|
|
73
|
+
startAnimation() {
|
|
74
|
+
// 기본 구현은 비어있음
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* 애니메이션을 중지합니다. 애니메이션이 필요한 레이어에서 오버라이드합니다.
|
|
78
|
+
*/
|
|
79
|
+
stopAnimation() {
|
|
80
|
+
// 기본 구현은 비어있음
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=base-weather-layer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-weather-layer.js","sourceRoot":"","sources":["../../../src/layers/base-weather-layer.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,OAAgB,gBAAgB;IAAtC;QAGY,gBAAW,GAAkB,EAAE,CAAA;IA8F3C,CAAC;IAlFC;;OAEG;IACH,QAAQ,CAAC,GAAQ;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;QACjC,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAED;;OAEG;IACH,aAAa;QACX,IAAI,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC3B,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAClC,CAAC;IACH,CAAC;IAED;;OAEG;IACH,cAAc,CAAC,IAAmB;QAChC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA;QACvB,IAAI,CAAC,WAAW,EAAE,CAAA;IACpB,CAAC;IAED;;OAEG;IACO,WAAW;QACnB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,aAAa,EAAE,CAAA;YACpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;YAC/B,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;gBACb,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,OAAgB;QACzB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;QAChC,CAAC;IACH,CAAC;IAED;;OAEG;IACH,SAAS;QACP,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAA;QAChC,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,cAAc;IAChB,CAAC;IAED;;OAEG;IACH,aAAa;QACX,cAAc;IAChB,CAAC;CACF","sourcesContent":["import BaseLayer from 'ol/layer/Base.js'\nimport { Map } from 'ol'\nimport { WeatherData, WeatherLayerType } from '../types.js'\n\n/**\n * 날씨 레이어의 기본 클래스\n * 모든 레이어 타입은 이 클래스를 상속합니다.\n */\nexport abstract class BaseWeatherLayer {\n protected map?: Map\n protected layer?: BaseLayer\n protected weatherData: WeatherData[] = []\n\n /**\n * 레이어의 타입을 반환합니다.\n */\n abstract getType(): WeatherLayerType\n\n /**\n * 레이어를 생성합니다. 이 메서드는 각 서브클래스에서 구현해야 합니다.\n */\n abstract createLayer(): BaseLayer\n\n /**\n * 맵에 레이어를 추가합니다.\n */\n addToMap(map: Map) {\n this.map = map\n if (!this.layer) {\n this.layer = this.createLayer()\n }\n\n this.map.addLayer(this.layer)\n return this.layer\n }\n\n /**\n * 맵에서 레이어를 제거합니다.\n */\n removeFromMap() {\n if (this.map && this.layer) {\n this.map.removeLayer(this.layer)\n }\n }\n\n /**\n * 레이어에 날씨 데이터를 설정합니다.\n */\n setWeatherData(data: WeatherData[]) {\n this.weatherData = data\n this.updateLayer()\n }\n\n /**\n * 레이어를 업데이트합니다. 데이터가 변경된 경우 호출됩니다.\n */\n protected updateLayer() {\n if (this.layer) {\n this.removeFromMap()\n this.layer = this.createLayer()\n if (this.map) {\n this.map.addLayer(this.layer)\n }\n }\n }\n\n /**\n * 레이어 인스턴스를 반환합니다.\n */\n getLayer(): BaseLayer | undefined {\n return this.layer\n }\n\n /**\n * 레이어의 가시성을 설정합니다.\n */\n setVisible(visible: boolean) {\n if (this.layer) {\n this.layer.setVisible(visible)\n }\n }\n\n /**\n * 레이어의 가시성 상태를 반환합니다.\n */\n isVisible(): boolean {\n if (this.layer) {\n return this.layer.getVisible()\n }\n return false\n }\n\n /**\n * 애니메이션을 시작합니다. 애니메이션이 필요한 레이어에서 오버라이드합니다.\n */\n startAnimation() {\n // 기본 구현은 비어있음\n }\n\n /**\n * 애니메이션을 중지합니다. 애니메이션이 필요한 레이어에서 오버라이드합니다.\n */\n stopAnimation() {\n // 기본 구현은 비어있음\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import BaseLayer from 'ol/layer/Base';
|
|
2
|
+
import { BaseWeatherLayer } from './base-weather-layer.js';
|
|
3
|
+
import { WeatherData, WeatherLayerType } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* 구름 레이어 구현
|
|
6
|
+
*/
|
|
7
|
+
export declare class CloudLayer extends BaseWeatherLayer {
|
|
8
|
+
getType(): WeatherLayerType;
|
|
9
|
+
/**
|
|
10
|
+
* 벡터 레이어를 생성하여 구름을 표현합니다.
|
|
11
|
+
*/
|
|
12
|
+
createLayer(): BaseLayer;
|
|
13
|
+
/**
|
|
14
|
+
* 레이어에 날씨 데이터를 설정합니다.
|
|
15
|
+
*/
|
|
16
|
+
setWeatherData(data: WeatherData[]): void;
|
|
17
|
+
}
|