mahal_map 1.6.12 → 1.6.13
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/README.md +51 -0
- package/dist/index.d.mts +49 -3
- package/dist/index.d.ts +49 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.map +1 -1
- package/dist/mahal_map.sdk.js +1 -1
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -100,7 +100,14 @@ interface IMahalMapOptions {
|
|
|
100
100
|
lang?: "tj" | "ru";
|
|
101
101
|
center?: [number, number];
|
|
102
102
|
zoom?: number;
|
|
103
|
+
pitch?: number;
|
|
104
|
+
bearing?: number;
|
|
103
105
|
autoAddVectorSource?: boolean;
|
|
106
|
+
engine?: "legacy" | "3d";
|
|
107
|
+
enable3D?: boolean;
|
|
108
|
+
base?: string;
|
|
109
|
+
preset?: string;
|
|
110
|
+
maps3d?: IMaps3DOptions;
|
|
104
111
|
}
|
|
105
112
|
```
|
|
106
113
|
|
|
@@ -112,7 +119,51 @@ interface IMahalMapOptions {
|
|
|
112
119
|
| `lang` | `"tj" \| "ru"` | Язык стандартного стиля. `tj` оставляет URL только с `token`, `ru` добавляет `lang=ru`. |
|
|
113
120
|
| `center` | `[number, number]` | Центр карты в формате `[lng, lat]`. |
|
|
114
121
|
| `zoom` | `number` | Начальный zoom. |
|
|
122
|
+
| `pitch` | `number` | Начальный наклон камеры (нужен для 3D-вида). |
|
|
123
|
+
| `bearing` | `number` | Начальный поворот камеры. |
|
|
115
124
|
| `autoAddVectorSource` | `boolean` | Использует встроенный vector style и блокирует смену стандартного стиля через `setStyle`. |
|
|
125
|
+
| `engine` | `"legacy" \| "3d"` | Переключатель движка карты. `"legacy"` (по умолчанию) — старые стили mtile.gram.tj. `"3d"` — новая платформа GramMaps (route.gram.tj) с пресетами стиля и Maps3D. |
|
|
126
|
+
| `enable3D` | `boolean` | Подключает детальные 3D-здания (Maps3D). Работает только при `engine: "3d"`. |
|
|
127
|
+
| `base` | `string` | Домен платформы GramMaps для `engine: "3d"`. По умолчанию `https://route.gram.tj`. |
|
|
128
|
+
| `preset` | `string` | Имя пресета стиля GramMaps (напр. `"standard-night"`) для `engine: "3d"`. По умолчанию `standard-day`/`standard-night` в зависимости от `theme`. |
|
|
129
|
+
| `maps3d` | `object` | Доп. опции Maps3D слоя: `traffic`, `minZoom`, `lodBias`, `memoryBudget`, `maskReplaced`, `typeReplacements`. |
|
|
130
|
+
|
|
131
|
+
### Новый 3D-движок (GramMaps / Maps3D)
|
|
132
|
+
|
|
133
|
+
Токен передается как обычно, через `keyUtils.saveKey()` — отдельно ключ для Maps3D передавать не нужно.
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
import maplibregl from "maplibre-gl";
|
|
137
|
+
import "maplibre-gl/dist/maplibre-gl.css";
|
|
138
|
+
import { Maps3D } from "@osm/maps3d-web";
|
|
139
|
+
import { MahalMap, keyUtils } from "mahal_map";
|
|
140
|
+
|
|
141
|
+
keyUtils.saveKey("YOUR_MAP_API_KEY");
|
|
142
|
+
|
|
143
|
+
const map = MahalMap.create(
|
|
144
|
+
{
|
|
145
|
+
container: "map",
|
|
146
|
+
center: [68.78, 38.56],
|
|
147
|
+
zoom: 16.6,
|
|
148
|
+
pitch: 58,
|
|
149
|
+
theme: "dark",
|
|
150
|
+
engine: "3d",
|
|
151
|
+
enable3D: true,
|
|
152
|
+
},
|
|
153
|
+
maplibregl,
|
|
154
|
+
Maps3D,
|
|
155
|
+
);
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
`Maps3D` (третий аргумент `create()`) — опционален: если не передан, SDK попробует взять его из `window.Maps3D`. `@osm/maps3d-web` — необязательный peer dependency, ставится только если используется `engine: "3d"`.
|
|
159
|
+
|
|
160
|
+
Получить слой Maps3D после создания карты:
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
const layer = map.getMaps3DLayer();
|
|
164
|
+
// или
|
|
165
|
+
MahalMap.getMaps3DLayer(map);
|
|
166
|
+
```
|
|
116
167
|
|
|
117
168
|
## MahalMap
|
|
118
169
|
|
package/dist/index.d.mts
CHANGED
|
@@ -19,6 +19,31 @@ interface IAdditionalParamType {
|
|
|
19
19
|
limit?: number;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
interface IMaps3DLayerOptions {
|
|
23
|
+
apiKey?: string | null;
|
|
24
|
+
base?: string;
|
|
25
|
+
buildings?: boolean | Record<string, unknown>;
|
|
26
|
+
traffic?: boolean | Record<string, unknown>;
|
|
27
|
+
minZoom?: number;
|
|
28
|
+
lodBias?: number;
|
|
29
|
+
memoryBudget?: number;
|
|
30
|
+
maskReplaced?: boolean;
|
|
31
|
+
typeReplacements?: boolean;
|
|
32
|
+
}
|
|
33
|
+
interface IMaps3DLayer {
|
|
34
|
+
attach(map: Map): void;
|
|
35
|
+
destroy?(): void;
|
|
36
|
+
remove?(): void;
|
|
37
|
+
}
|
|
38
|
+
interface IMaps3DTransformRequestOptions {
|
|
39
|
+
base: string;
|
|
40
|
+
apiKey?: string | null;
|
|
41
|
+
}
|
|
42
|
+
type Maps3DTransformRequest = (options: IMaps3DTransformRequestOptions) => unknown;
|
|
43
|
+
type Maps3DCtor = (new (options: IMaps3DLayerOptions) => IMaps3DLayer) & {
|
|
44
|
+
transformRequest: Maps3DTransformRequest;
|
|
45
|
+
};
|
|
46
|
+
|
|
22
47
|
interface IMahalMapOptions {
|
|
23
48
|
container?: string | HTMLElement;
|
|
24
49
|
style?: string;
|
|
@@ -26,10 +51,23 @@ interface IMahalMapOptions {
|
|
|
26
51
|
lang?: MapLanguage;
|
|
27
52
|
center?: [number, number];
|
|
28
53
|
zoom?: number;
|
|
54
|
+
pitch?: number;
|
|
55
|
+
bearing?: number;
|
|
29
56
|
autoAddVectorSource?: boolean;
|
|
57
|
+
/** "legacy" (default) — старый движок (mtile.gram.tj). "3d" — новый GramMaps движок (route.gram.tj) с поддержкой Maps3D. */
|
|
58
|
+
engine?: MapEngine;
|
|
59
|
+
/** Включает Maps3D слой (детальные 3D-здания). Работает только при engine: "3d". */
|
|
60
|
+
enable3D?: boolean;
|
|
61
|
+
/** Домен платформы GramMaps для engine: "3d". По умолчанию https://route.gram.tj */
|
|
62
|
+
base?: string;
|
|
63
|
+
/** Имя пресета стиля GramMaps (напр. "standard-night") для engine: "3d". */
|
|
64
|
+
preset?: string;
|
|
65
|
+
/** Доп. опции Maps3D слоя (buildings, traffic, minZoom, lodBias, memoryBudget, ...). */
|
|
66
|
+
maps3d?: Omit<IMaps3DLayerOptions, "apiKey" | "base" | "buildings">;
|
|
30
67
|
}
|
|
31
68
|
type Theme = "dark" | "light";
|
|
32
69
|
type MapLanguage = "tj" | "ru";
|
|
70
|
+
type MapEngine = "legacy" | "3d";
|
|
33
71
|
|
|
34
72
|
interface MahalMapDefaultMarkerProps {
|
|
35
73
|
coordinates: [number, number];
|
|
@@ -144,6 +182,12 @@ declare class MahalMap {
|
|
|
144
182
|
private options;
|
|
145
183
|
private language;
|
|
146
184
|
private instanceKey;
|
|
185
|
+
private engine;
|
|
186
|
+
private gramBase;
|
|
187
|
+
private gramPreset;
|
|
188
|
+
private presetIsExplicit;
|
|
189
|
+
private maps3dCtor?;
|
|
190
|
+
private maps3dLayer?;
|
|
147
191
|
private constructor();
|
|
148
192
|
private static getInstanceKey;
|
|
149
193
|
private static normalizeLanguage;
|
|
@@ -151,7 +195,8 @@ declare class MahalMap {
|
|
|
151
195
|
private static getDefaultStyle;
|
|
152
196
|
private static getVectorStyle;
|
|
153
197
|
private static getMapToken;
|
|
154
|
-
static
|
|
198
|
+
private static getMaps3DCtor;
|
|
199
|
+
static create(options: IMahalMapOptions, maplibreObject?: MapLibreApi, maps3dCtor?: Maps3DCtor): MahalMap;
|
|
155
200
|
static onReady(container: string, callback: (map: Map) => void): void;
|
|
156
201
|
static getInstance(container: string): MahalMap;
|
|
157
202
|
static hasInstance(container: string): boolean;
|
|
@@ -160,6 +205,7 @@ declare class MahalMap {
|
|
|
160
205
|
static getCamera(instance: MahalMap): CameraController;
|
|
161
206
|
static getMap(instance: MahalMap): Map;
|
|
162
207
|
static setStyle(instance: MahalMap, theme: Theme): void;
|
|
208
|
+
static getMaps3DLayer(instance: MahalMap): IMaps3DLayer | undefined;
|
|
163
209
|
static setLanguage(instance: MahalMap, lang: MapLanguage): void;
|
|
164
210
|
static setCenter(instance: MahalMap, center: [number, number]): void;
|
|
165
211
|
static setZoom(instance: MahalMap, zoom: number): void;
|
|
@@ -170,6 +216,7 @@ declare class MahalMap {
|
|
|
170
216
|
getMap(): Map;
|
|
171
217
|
setStyle(theme: Theme): void;
|
|
172
218
|
setLanguage(lang: MapLanguage): void;
|
|
219
|
+
getMaps3DLayer(): IMaps3DLayer | undefined;
|
|
173
220
|
setCenter(center: [number, number]): void;
|
|
174
221
|
setZoom(zoom: number): void;
|
|
175
222
|
destroy(): void;
|
|
@@ -349,7 +396,6 @@ declare class MeasureTool {
|
|
|
349
396
|
private setCursor;
|
|
350
397
|
private onStyleLoad;
|
|
351
398
|
private emitChange;
|
|
352
|
-
private tryEnsureLayers;
|
|
353
399
|
private ensureLayers;
|
|
354
400
|
private removeLayers;
|
|
355
401
|
private setSourceData;
|
|
@@ -426,4 +472,4 @@ declare namespace index {
|
|
|
426
472
|
export { index_checkCoordinates as checkCoordinates, index_debounce as debounce, index_geojsonPolyline as geojsonPolyline, index_geometryPolyline as geometryPolyline, index_trimValue as trimValue };
|
|
427
473
|
}
|
|
428
474
|
|
|
429
|
-
export { type IAdditionalParamType, type IMahalMapOptions, type IMapMarker, type IResponse, type IRoute, type ISearchByLocationParam, type ISearchParam, type ISearchResponse, MahalMap, MahalMapDefaultMarker, type MahalMapDefaultMarkerProps, type MapLanguage, type MeasureIcons, type MeasureLabels, type MeasureMode, type MeasurePoint, type MeasureShape, type MeasureState, type MeasureStyleOptions, MeasureTool, type MeasureToolOptions, Router, Search, SearchByLocation, type Theme, index$2 as keyUtils, index$1 as measureUtils, index as utils };
|
|
475
|
+
export { type IAdditionalParamType, type IMahalMapOptions, type IMapMarker, type IMaps3DLayer, type IMaps3DLayerOptions, type IResponse, type IRoute, type ISearchByLocationParam, type ISearchParam, type ISearchResponse, MahalMap, MahalMapDefaultMarker, type MahalMapDefaultMarkerProps, type MapEngine, type MapLanguage, type Maps3DCtor, type Maps3DTransformRequest, type MeasureIcons, type MeasureLabels, type MeasureMode, type MeasurePoint, type MeasureShape, type MeasureState, type MeasureStyleOptions, MeasureTool, type MeasureToolOptions, Router, Search, SearchByLocation, type Theme, index$2 as keyUtils, index$1 as measureUtils, index as utils };
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,31 @@ interface IAdditionalParamType {
|
|
|
19
19
|
limit?: number;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
interface IMaps3DLayerOptions {
|
|
23
|
+
apiKey?: string | null;
|
|
24
|
+
base?: string;
|
|
25
|
+
buildings?: boolean | Record<string, unknown>;
|
|
26
|
+
traffic?: boolean | Record<string, unknown>;
|
|
27
|
+
minZoom?: number;
|
|
28
|
+
lodBias?: number;
|
|
29
|
+
memoryBudget?: number;
|
|
30
|
+
maskReplaced?: boolean;
|
|
31
|
+
typeReplacements?: boolean;
|
|
32
|
+
}
|
|
33
|
+
interface IMaps3DLayer {
|
|
34
|
+
attach(map: Map): void;
|
|
35
|
+
destroy?(): void;
|
|
36
|
+
remove?(): void;
|
|
37
|
+
}
|
|
38
|
+
interface IMaps3DTransformRequestOptions {
|
|
39
|
+
base: string;
|
|
40
|
+
apiKey?: string | null;
|
|
41
|
+
}
|
|
42
|
+
type Maps3DTransformRequest = (options: IMaps3DTransformRequestOptions) => unknown;
|
|
43
|
+
type Maps3DCtor = (new (options: IMaps3DLayerOptions) => IMaps3DLayer) & {
|
|
44
|
+
transformRequest: Maps3DTransformRequest;
|
|
45
|
+
};
|
|
46
|
+
|
|
22
47
|
interface IMahalMapOptions {
|
|
23
48
|
container?: string | HTMLElement;
|
|
24
49
|
style?: string;
|
|
@@ -26,10 +51,23 @@ interface IMahalMapOptions {
|
|
|
26
51
|
lang?: MapLanguage;
|
|
27
52
|
center?: [number, number];
|
|
28
53
|
zoom?: number;
|
|
54
|
+
pitch?: number;
|
|
55
|
+
bearing?: number;
|
|
29
56
|
autoAddVectorSource?: boolean;
|
|
57
|
+
/** "legacy" (default) — старый движок (mtile.gram.tj). "3d" — новый GramMaps движок (route.gram.tj) с поддержкой Maps3D. */
|
|
58
|
+
engine?: MapEngine;
|
|
59
|
+
/** Включает Maps3D слой (детальные 3D-здания). Работает только при engine: "3d". */
|
|
60
|
+
enable3D?: boolean;
|
|
61
|
+
/** Домен платформы GramMaps для engine: "3d". По умолчанию https://route.gram.tj */
|
|
62
|
+
base?: string;
|
|
63
|
+
/** Имя пресета стиля GramMaps (напр. "standard-night") для engine: "3d". */
|
|
64
|
+
preset?: string;
|
|
65
|
+
/** Доп. опции Maps3D слоя (buildings, traffic, minZoom, lodBias, memoryBudget, ...). */
|
|
66
|
+
maps3d?: Omit<IMaps3DLayerOptions, "apiKey" | "base" | "buildings">;
|
|
30
67
|
}
|
|
31
68
|
type Theme = "dark" | "light";
|
|
32
69
|
type MapLanguage = "tj" | "ru";
|
|
70
|
+
type MapEngine = "legacy" | "3d";
|
|
33
71
|
|
|
34
72
|
interface MahalMapDefaultMarkerProps {
|
|
35
73
|
coordinates: [number, number];
|
|
@@ -144,6 +182,12 @@ declare class MahalMap {
|
|
|
144
182
|
private options;
|
|
145
183
|
private language;
|
|
146
184
|
private instanceKey;
|
|
185
|
+
private engine;
|
|
186
|
+
private gramBase;
|
|
187
|
+
private gramPreset;
|
|
188
|
+
private presetIsExplicit;
|
|
189
|
+
private maps3dCtor?;
|
|
190
|
+
private maps3dLayer?;
|
|
147
191
|
private constructor();
|
|
148
192
|
private static getInstanceKey;
|
|
149
193
|
private static normalizeLanguage;
|
|
@@ -151,7 +195,8 @@ declare class MahalMap {
|
|
|
151
195
|
private static getDefaultStyle;
|
|
152
196
|
private static getVectorStyle;
|
|
153
197
|
private static getMapToken;
|
|
154
|
-
static
|
|
198
|
+
private static getMaps3DCtor;
|
|
199
|
+
static create(options: IMahalMapOptions, maplibreObject?: MapLibreApi, maps3dCtor?: Maps3DCtor): MahalMap;
|
|
155
200
|
static onReady(container: string, callback: (map: Map) => void): void;
|
|
156
201
|
static getInstance(container: string): MahalMap;
|
|
157
202
|
static hasInstance(container: string): boolean;
|
|
@@ -160,6 +205,7 @@ declare class MahalMap {
|
|
|
160
205
|
static getCamera(instance: MahalMap): CameraController;
|
|
161
206
|
static getMap(instance: MahalMap): Map;
|
|
162
207
|
static setStyle(instance: MahalMap, theme: Theme): void;
|
|
208
|
+
static getMaps3DLayer(instance: MahalMap): IMaps3DLayer | undefined;
|
|
163
209
|
static setLanguage(instance: MahalMap, lang: MapLanguage): void;
|
|
164
210
|
static setCenter(instance: MahalMap, center: [number, number]): void;
|
|
165
211
|
static setZoom(instance: MahalMap, zoom: number): void;
|
|
@@ -170,6 +216,7 @@ declare class MahalMap {
|
|
|
170
216
|
getMap(): Map;
|
|
171
217
|
setStyle(theme: Theme): void;
|
|
172
218
|
setLanguage(lang: MapLanguage): void;
|
|
219
|
+
getMaps3DLayer(): IMaps3DLayer | undefined;
|
|
173
220
|
setCenter(center: [number, number]): void;
|
|
174
221
|
setZoom(zoom: number): void;
|
|
175
222
|
destroy(): void;
|
|
@@ -349,7 +396,6 @@ declare class MeasureTool {
|
|
|
349
396
|
private setCursor;
|
|
350
397
|
private onStyleLoad;
|
|
351
398
|
private emitChange;
|
|
352
|
-
private tryEnsureLayers;
|
|
353
399
|
private ensureLayers;
|
|
354
400
|
private removeLayers;
|
|
355
401
|
private setSourceData;
|
|
@@ -426,4 +472,4 @@ declare namespace index {
|
|
|
426
472
|
export { index_checkCoordinates as checkCoordinates, index_debounce as debounce, index_geojsonPolyline as geojsonPolyline, index_geometryPolyline as geometryPolyline, index_trimValue as trimValue };
|
|
427
473
|
}
|
|
428
474
|
|
|
429
|
-
export { type IAdditionalParamType, type IMahalMapOptions, type IMapMarker, type IResponse, type IRoute, type ISearchByLocationParam, type ISearchParam, type ISearchResponse, MahalMap, MahalMapDefaultMarker, type MahalMapDefaultMarkerProps, type MapLanguage, type MeasureIcons, type MeasureLabels, type MeasureMode, type MeasurePoint, type MeasureShape, type MeasureState, type MeasureStyleOptions, MeasureTool, type MeasureToolOptions, Router, Search, SearchByLocation, type Theme, index$2 as keyUtils, index$1 as measureUtils, index as utils };
|
|
475
|
+
export { type IAdditionalParamType, type IMahalMapOptions, type IMapMarker, type IMaps3DLayer, type IMaps3DLayerOptions, type IResponse, type IRoute, type ISearchByLocationParam, type ISearchParam, type ISearchResponse, MahalMap, MahalMapDefaultMarker, type MahalMapDefaultMarkerProps, type MapEngine, type MapLanguage, type Maps3DCtor, type Maps3DTransformRequest, type MeasureIcons, type MeasureLabels, type MeasureMode, type MeasurePoint, type MeasureShape, type MeasureState, type MeasureStyleOptions, MeasureTool, type MeasureToolOptions, Router, Search, SearchByLocation, type Theme, index$2 as keyUtils, index$1 as measureUtils, index as utils };
|