@osm-editor-kit/street-imagery-react 0.1.0-alpha.0 → 0.1.0-alpha.10
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 +186 -4
- package/dist/MapillaryPanel-FAXVZH37.js +2 -0
- package/dist/PanoramaxPanel-TWKTSOXM.js +2 -0
- package/dist/StreetLevelImagerySelectionOverlay.d.ts +22 -3
- package/dist/StreetLevelImagerySourcesAndLayers.d.ts +24 -1
- package/dist/StreetLevelImageryViewCone.d.ts +13 -1
- package/dist/StreetLevelImageryViewer.d.ts +23 -1
- package/dist/chunk-6EMFFIL2.js +147 -0
- package/dist/chunk-SGIB7AVC.js +309 -0
- package/dist/chunk-XQXYV6SR.js +466 -0
- package/dist/filters/PhotoDateRangeFilter.d.ts +46 -0
- package/dist/hooks/useAllProviderMapFeatures.d.ts +0 -4
- package/dist/hooks/useProviderData.d.ts +8 -3
- package/dist/i18n/PhotoCount.d.ts +12 -0
- package/dist/i18n/PhotoDate.d.ts +16 -0
- package/dist/i18n/StreetImageryLocaleProvider.d.ts +21 -0
- package/dist/i18n/messages.d.ts +45 -0
- package/dist/index.d.ts +19 -4
- package/dist/index.js +1542 -141
- package/dist/mapillary/MapillaryFeatureBar.d.ts +16 -0
- package/dist/mapillary/SelectedMapFeatureLayer.d.ts +19 -0
- package/dist/mapillary/featureBarLabels.d.ts +16 -0
- package/dist/mapillary/useMapillaryFeatures.d.ts +54 -0
- package/dist/openers/LocationPickOnMap.d.ts +10 -0
- package/dist/openers/useLocationPickStore.d.ts +9 -0
- package/dist/panels/MapillaryPanel.d.ts +19 -1
- package/dist/panels/PanoramaxPanel.d.ts +14 -4
- package/dist/panels/PanoramaxWebViewerPanel.d.ts +20 -0
- package/dist/panels/mapillaryLookAt.d.ts +41 -0
- package/dist/panels/panoramaxDataProvider.d.ts +44 -0
- package/dist/panels/panoramaxItem.d.ts +96 -0
- package/dist/panels/panoramaxLimitPanning.d.ts +54 -0
- package/dist/panels/panoramaxPhotoFromMetadata.d.ts +8 -0
- package/dist/panoramax-web-viewer/index.d.ts +1 -0
- package/dist/panoramax-web-viewer.js +314 -0
- package/dist/photo-details/PhotoDetailsDialog.d.ts +21 -0
- package/dist/photo-details/index.d.ts +6 -0
- package/dist/photo-details/labels.d.ts +33 -0
- package/dist/photo-details.js +235 -0
- package/dist/streetImageryClick.d.ts +4 -0
- package/dist/viewer-panels/index.d.ts +5 -0
- package/dist/viewer-panels.js +3 -0
- package/dist/viewpoints/FloatingPhotoViewer.d.ts +73 -0
- package/dist/viewpoints/ViewpointLayer.d.ts +17 -0
- package/dist/viewpoints/useViewSuggestions.d.ts +23 -0
- package/dist/viewpoints/useViewpointSessionStore.d.ts +35 -0
- package/dist/viewpoints/viewDirectionLabels.d.ts +4 -0
- package/package.json +37 -6
- package/dist/MapillaryPanel-QX6NESX7.js +0 -2
- package/dist/PanoramaxPanel-J6ANR6LB.js +0 -2
- package/dist/chunk-BS6LPDMY.js +0 -143
- package/dist/chunk-ZH3TPW4D.js +0 -165
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type MapFeatureImages, type TargetImage } from '@osm-editor-kit/street-imagery';
|
|
2
|
+
import { type MapillaryFeatureBarLabels } from './featureBarLabels';
|
|
3
|
+
export type MapillaryFeatureBarProps = {
|
|
4
|
+
data: MapFeatureImages;
|
|
5
|
+
shownImage: TargetImage | null;
|
|
6
|
+
onShow: (image: TargetImage) => void;
|
|
7
|
+
/** Replace single texts, e.g. `name` to map values to your own sign catalogue. */
|
|
8
|
+
labels?: Partial<MapillaryFeatureBarLabels>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A Mapillary sign or object above its photo: what it is, when Mapillary saw it, and one button
|
|
12
|
+
* per capture day (newest first). The shown day is highlighted; clicking it again steps through
|
|
13
|
+
* that day's photos. Dates show month and year; the tooltip has the full date and the age.
|
|
14
|
+
* Texts and dates follow the `StreetImageryLocaleProvider`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const MapillaryFeatureBar: ({ data, shownImage, onShow, labels: labelOverrides, }: MapillaryFeatureBarProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type Bbox, type MapFeatureImages, type ProviderId, type TargetImage } from '@osm-editor-kit/street-imagery';
|
|
2
|
+
export type SelectedMapFeatureLayerProps = {
|
|
3
|
+
/** From `useSelectedMapillaryFeature`. Nothing is drawn without it. */
|
|
4
|
+
data: MapFeatureImages | null;
|
|
5
|
+
/** The shown photo of the feature: a dotted line runs from its camera to the feature. */
|
|
6
|
+
shownImage?: TargetImage | null;
|
|
7
|
+
/** The providers whose map features are drawn, to ring the dot that is on the map. */
|
|
8
|
+
providers: ProviderId[];
|
|
9
|
+
bbox: Bbox | null;
|
|
10
|
+
zoom: number;
|
|
11
|
+
/** Color of the dot and disk. Default: the map features' purple. */
|
|
12
|
+
color?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The selected sign or object on the map: its dot on a light disk, and a dotted line to it from
|
|
16
|
+
* the camera position of the shown photo (Mapillary's computed position, which the feature was
|
|
17
|
+
* located from). Draw it after `StreetLevelImagerySourcesAndLayers`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const SelectedMapFeatureLayer: ({ data, shownImage, providers, bbox, zoom, color, }: SelectedMapFeatureLayerProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type StreetImageryLocale } from '@osm-editor-kit/street-imagery';
|
|
2
|
+
/**
|
|
3
|
+
* Texts of `MapillaryFeatureBar`. Kept out of the package-wide messages, so the German sign names
|
|
4
|
+
* are only bundled by apps that show the feature bar.
|
|
5
|
+
*/
|
|
6
|
+
export type MapillaryFeatureBarLabels = {
|
|
7
|
+
/** Name of a Mapillary value like `regulatory--turn-right-ahead--g1`. */
|
|
8
|
+
name: (value: string) => string;
|
|
9
|
+
/** Line below the name; `first` and `last` are the rendered dates. */
|
|
10
|
+
seen: string;
|
|
11
|
+
noPhotos: string;
|
|
12
|
+
daysSummary: (photos: number, days: number) => string;
|
|
13
|
+
/** Third tooltip line of a day button, below date and age. */
|
|
14
|
+
dayPhotos: (photos: number, canStep: boolean) => string;
|
|
15
|
+
};
|
|
16
|
+
export declare const MAPILLARY_FEATURE_BAR_LABELS: Record<StreetImageryLocale, MapillaryFeatureBarLabels>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type LngLat, type TargetShape } from '@osm-editor-kit/street-imagery';
|
|
2
|
+
/**
|
|
3
|
+
* A Mapillary map feature (sign, traffic light, marking) with all images that show it, grouped by
|
|
4
|
+
* day, and the outlines Mapillary linked to it. Feed `days[0].best` into the viewer with
|
|
5
|
+
* `lookAt={{ lngLat: feature.lngLat, outline: image.outline }}`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useMapillaryMapFeatureImages: (featureId: string | null | undefined, { shape }?: {
|
|
8
|
+
shape?: TargetShape;
|
|
9
|
+
}) => import("@tanstack/react-query").UseQueryResult<NoInfer<import("@osm-editor-kit/street-imagery").MapFeatureImages | null>, Error>;
|
|
10
|
+
/**
|
|
11
|
+
* Map features within `radiusMeters` of a point (Graph API), nearest first, e.g. the traffic
|
|
12
|
+
* lights and markings at a junction. `objectValues` accepts wildcards (`object--traffic-light--*`).
|
|
13
|
+
*/
|
|
14
|
+
export declare const useMapillaryMapFeaturesNear: (lngLat: LngLat | null | undefined, { radiusMeters, objectValues, enabled, }?: {
|
|
15
|
+
radiusMeters?: number;
|
|
16
|
+
objectValues?: string[];
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
}) => import("@tanstack/react-query").UseQueryResult<NoInfer<{
|
|
19
|
+
id: string;
|
|
20
|
+
value: string;
|
|
21
|
+
lngLat: LngLat;
|
|
22
|
+
firstSeenAt: number | null;
|
|
23
|
+
lastSeenAt: number | null;
|
|
24
|
+
facing: number | null;
|
|
25
|
+
imageIds: string[];
|
|
26
|
+
distanceMeters: number;
|
|
27
|
+
}[]>, Error>;
|
|
28
|
+
/**
|
|
29
|
+
* Detection outlines of one image, for `outlines` of the Mapillary viewer. An image has ~500
|
|
30
|
+
* detections; pass `filter` (e.g. `matchesAnyGroup(JUNCTION_DETECTION_GROUPS)`) and name it with
|
|
31
|
+
* `filterKey` so the cache can tell filters apart.
|
|
32
|
+
*/
|
|
33
|
+
export declare const useMapillaryImageDetections: (imageId: string | null | undefined, { filter, filterKey }?: {
|
|
34
|
+
filter?: (value: string) => boolean;
|
|
35
|
+
filterKey?: string;
|
|
36
|
+
}) => import("@tanstack/react-query").UseQueryResult<NoInfer<import("@osm-editor-kit/street-imagery").MapillaryDetection[]>, Error>;
|
|
37
|
+
/**
|
|
38
|
+
* A selected Mapillary map feature (sign, object) for a host's feature + photo selection: all its
|
|
39
|
+
* photos by day, the photo that is shown (`shownPhotoId`), and the one to open first — the best of
|
|
40
|
+
* the newest day, from within `minCapturedAt` (ms) when set. Feed `data` and `shownImage` to
|
|
41
|
+
* `MapillaryFeatureBar` and `SelectedMapFeatureLayer`, and `shownImage.outline` to `lookAt`.
|
|
42
|
+
*/
|
|
43
|
+
export declare const useSelectedMapillaryFeature: ({ featureId, shownPhotoId, minCapturedAt, shape, }: {
|
|
44
|
+
featureId: string | null | undefined;
|
|
45
|
+
shownPhotoId?: string | null;
|
|
46
|
+
minCapturedAt?: number | null;
|
|
47
|
+
shape?: TargetShape;
|
|
48
|
+
}) => {
|
|
49
|
+
data: NonNullable<NoInfer<import("@osm-editor-kit/street-imagery").MapFeatureImages | null>> | null;
|
|
50
|
+
isLoading: boolean;
|
|
51
|
+
isError: boolean;
|
|
52
|
+
shownImage: import("@osm-editor-kit/street-imagery").TargetImage | null;
|
|
53
|
+
firstImage: import("@osm-editor-kit/street-imagery").TargetImage | null;
|
|
54
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type LocationOpener, type OpenTarget } from '@osm-editor-kit/street-imagery';
|
|
2
|
+
export type LocationPickOnMapProps = {
|
|
3
|
+
/** Called after the place was opened, e.g. to mark it on the map. */
|
|
4
|
+
onPick?: (target: OpenTarget, opener: LocationOpener) => void;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Render inside `<Map>`. While a location opener is armed, the next map click opens the clicked
|
|
8
|
+
* place in a new tab and disarms; Escape disarms. The map's own click handlers still run.
|
|
9
|
+
*/
|
|
10
|
+
export declare const LocationPickOnMap: ({ onPick }: LocationPickOnMapProps) => null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LocationOpenerId } from '@osm-editor-kit/street-imagery';
|
|
2
|
+
/** The opener waiting for a map click, or `null`. */
|
|
3
|
+
export declare const useArmedLocationOpenerId: () => LocationOpenerId | null;
|
|
4
|
+
export declare const useLocationPickActions: () => {
|
|
5
|
+
arm: (openerId: LocationOpenerId) => void;
|
|
6
|
+
disarm: () => void;
|
|
7
|
+
/** Arm, or disarm when this opener is armed already. */
|
|
8
|
+
toggle: (openerId: LocationOpenerId) => void;
|
|
9
|
+
};
|
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
import type { NormalizedPhoto } from '@osm-editor-kit/street-imagery';
|
|
2
2
|
import 'mapillary-js/dist/mapillary.css';
|
|
3
3
|
import type { StreetImageryPhotoSelection } from '../types';
|
|
4
|
+
import { type MapillaryLookAt, type MapillaryViewerOutline } from './mapillaryLookAt';
|
|
4
5
|
type MapillaryPanelProps = {
|
|
5
6
|
photo: NormalizedPhoto;
|
|
6
7
|
groupPhotos: NormalizedPhoto[];
|
|
7
8
|
onPhotoSelected: (selection: StreetImageryPhotoSelection) => void;
|
|
8
9
|
onEaseMapToPoint: (lng: number, lat: number) => void;
|
|
10
|
+
/** Full photo data for each image the viewer shows (incl. native prev/next navigation). */
|
|
11
|
+
onViewerPhoto?: (photo: NormalizedPhoto) => void;
|
|
12
|
+
/** 360° photos: turn the view to this map bearing when `photo` opens (e.g. a suggested view). */
|
|
13
|
+
lookAtBearing?: number | null;
|
|
14
|
+
/**
|
|
15
|
+
* Turn (and zoom) the view to a place when `photo` opens: a sign, a traffic light, a junction.
|
|
16
|
+
* Works for 360° and flat photos; wins over `lookAtBearing`.
|
|
17
|
+
*/
|
|
18
|
+
lookAt?: MapillaryLookAt | null;
|
|
19
|
+
/** Outlines to draw in the shown image, e.g. the detections you care about. */
|
|
20
|
+
outlines?: MapillaryViewerOutline[];
|
|
21
|
+
/**
|
|
22
|
+
* Hide the viewer's own attribution (creator and year). The host must then show the creator
|
|
23
|
+
* (`creatorName` of `onViewerPhoto`) and a link to the image on Mapillary itself; the images
|
|
24
|
+
* are CC BY-SA.
|
|
25
|
+
*/
|
|
26
|
+
hideAttribution?: boolean;
|
|
9
27
|
};
|
|
10
|
-
export declare const MapillaryPanel: ({ photo, onPhotoSelected, onEaseMapToPoint, }: MapillaryPanelProps) => import("react").JSX.Element;
|
|
28
|
+
export declare const MapillaryPanel: ({ photo, onPhotoSelected, onEaseMapToPoint, onViewerPhoto, lookAtBearing, lookAt, outlines, hideAttribution, }: MapillaryPanelProps) => import("react").JSX.Element;
|
|
11
29
|
export {};
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
import '@panoramax/web-viewer';
|
|
2
1
|
import type { NormalizedPhoto } from '@osm-editor-kit/street-imagery';
|
|
2
|
+
import 'mapillary-js/dist/mapillary.css';
|
|
3
3
|
import type { StreetImageryPhotoSelection } from '../types';
|
|
4
|
-
type PanoramaxPanelProps = {
|
|
4
|
+
export type PanoramaxPanelProps = {
|
|
5
5
|
photo: NormalizedPhoto;
|
|
6
6
|
groupPhotos: NormalizedPhoto[];
|
|
7
7
|
onPhotoSelected: (selection: StreetImageryPhotoSelection) => void;
|
|
8
8
|
onEaseMapToPoint: (lng: number, lat: number) => void;
|
|
9
|
+
/** The shown picture with creator, licence, local capture time and camera. */
|
|
10
|
+
onViewerPhoto?: (photo: NormalizedPhoto) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Hide the line with creator and licence. The host must then show both itself, from
|
|
13
|
+
* `onViewerPhoto`.
|
|
14
|
+
*/
|
|
15
|
+
hideAttribution?: boolean;
|
|
9
16
|
};
|
|
10
|
-
|
|
11
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Panoramax pictures in the Mapillary viewer (`mapillary-js` with a `PanoramaxDataProvider`): no
|
|
19
|
+
* second viewer engine to load, and the same handling as Mapillary photos.
|
|
20
|
+
*/
|
|
21
|
+
export declare const PanoramaxPanel: ({ photo, onPhotoSelected, onEaseMapToPoint, onViewerPhoto, hideAttribution, }: PanoramaxPanelProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import '@panoramax/web-viewer';
|
|
2
|
+
import type { NormalizedPhoto } from '@osm-editor-kit/street-imagery';
|
|
3
|
+
import type { StreetImageryPhotoSelection } from '../types';
|
|
4
|
+
export type PanoramaxWebViewerPanelProps = {
|
|
5
|
+
photo: NormalizedPhoto;
|
|
6
|
+
groupPhotos: NormalizedPhoto[];
|
|
7
|
+
onPhotoSelected: (selection: StreetImageryPhotoSelection) => void;
|
|
8
|
+
onEaseMapToPoint: (lng: number, lat: number) => void;
|
|
9
|
+
/** The shown picture with creator, licence, local capture time and camera. */
|
|
10
|
+
onViewerPhoto?: (photo: NormalizedPhoto) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Leave out the viewer's own widgets: the legend (a bottom drawer in narrow containers), the
|
|
13
|
+
* player and the zoom buttons. The host must then show creator and licence itself, from
|
|
14
|
+
* `onViewerPhoto`. Stepping through a sequence still works with the arrows in the photo.
|
|
15
|
+
*/
|
|
16
|
+
hideLegend?: boolean;
|
|
17
|
+
/** Same as `hideLegend`; the name `StreetLevelImageryViewer` passes. */
|
|
18
|
+
hideAttribution?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare const PanoramaxWebViewerPanel: ({ photo, onPhotoSelected, onEaseMapToPoint, onViewerPhoto, hideLegend: hideLegendProp, hideAttribution, }: PanoramaxWebViewerPanelProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type LngLat, type TargetShape, type ViewTarget } from '@osm-editor-kit/street-imagery';
|
|
2
|
+
import { type Image, type Viewer } from 'mapillary-js';
|
|
3
|
+
/** A place the Mapillary viewer should turn to: a sign, a traffic light, a junction … */
|
|
4
|
+
export type MapillaryLookAt = {
|
|
5
|
+
lngLat: LngLat;
|
|
6
|
+
/** Size and height of the target; decides zoom and vertical position. Default: a traffic sign. */
|
|
7
|
+
shape?: TargetShape;
|
|
8
|
+
/** The target's outline in the shown image, if known; it is more exact than the location. */
|
|
9
|
+
outline?: [number, number][];
|
|
10
|
+
/**
|
|
11
|
+
* Mapillary value of the target (`regulatory--bicycles-only--g1`). Without an `outline`, the
|
|
12
|
+
* image's own detection of this value is used: Mapillary links a map feature to few of its
|
|
13
|
+
* images, but almost every image has a detection of it. With several, the one nearest to the
|
|
14
|
+
* computed position wins (the computed position alone can be far off in 360° images).
|
|
15
|
+
*/
|
|
16
|
+
value?: string;
|
|
17
|
+
/** Label for the outline drawn around the target. */
|
|
18
|
+
label?: string;
|
|
19
|
+
};
|
|
20
|
+
export type MapillaryViewerOutline = {
|
|
21
|
+
id: string;
|
|
22
|
+
/** Image ("basic") coordinates, `[0, 0]` top left to `[1, 1]` bottom right. */
|
|
23
|
+
outline: [number, number][];
|
|
24
|
+
label?: string;
|
|
25
|
+
/** CSS color number, e.g. `0xffff00`. Default yellow. */
|
|
26
|
+
color?: number;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Where the target is in the image: from its outline, else computed from the locations
|
|
30
|
+
* (360°: the viewer's own projection; flat: a pinhole model). `undefined` when a flat image does
|
|
31
|
+
* not show the target.
|
|
32
|
+
*/
|
|
33
|
+
export declare const mapillaryViewFor: (viewer: Viewer, image: Image, { lngLat, shape, outline }: MapillaryLookAt) => Promise<ViewTarget | undefined>;
|
|
34
|
+
/**
|
|
35
|
+
* Turns the viewer to the target. Returns the outline it aimed at (given, or the image's own
|
|
36
|
+
* detection of `value`), or `null` when it aimed by location; `false` when the shown (flat) image
|
|
37
|
+
* does not show the target.
|
|
38
|
+
*/
|
|
39
|
+
export declare const turnMapillaryViewerTo: (viewer: Viewer, image: Image, lookAt: MapillaryLookAt) => Promise<MapillaryViewerOutline | null | false>;
|
|
40
|
+
/** Replaces the outlines drawn in the viewer (needs the viewer's `tag` component). */
|
|
41
|
+
export declare const setMapillaryViewerOutlines: (viewer: Viewer, outlines: readonly MapillaryViewerOutline[]) => void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { DataProviderBase, type ClusterContract, type CoreImagesContract, type ImagesContract, type ImageTilesContract, type ImageTilesRequestContract, type MeshContract, type SequenceContract, type SpatialImagesContract } from 'mapillary-js';
|
|
2
|
+
import { type PanoramaxItem } from './panoramaxItem';
|
|
3
|
+
export type PanoramaxDataProviderOptions = {
|
|
4
|
+
/** The Panoramax API, e.g. `https://api.panoramax.xyz/api`. */
|
|
5
|
+
endpoint: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Lets a mapillary-js `Viewer` show Panoramax pictures: pass it as the viewer's `dataProvider`.
|
|
9
|
+
*
|
|
10
|
+
* A picture opens with its `sd` file (2048 px wide). The viewer then asks for tiles of the part in
|
|
11
|
+
* view; they are cut here, in the browser. Only when the view needs more detail than `sd` has is
|
|
12
|
+
* the original file loaded for that, once. (Panoramax has tiles of its own for 360° pictures only,
|
|
13
|
+
* in another layout.)
|
|
14
|
+
*
|
|
15
|
+
* Panoramax has no 3D reconstruction, so the viewer places each picture by its compass direction
|
|
16
|
+
* and offers the steps along the sequence only, not the arrows to pictures nearby.
|
|
17
|
+
*
|
|
18
|
+
* A Panoramax sequence can hold thousands of pictures and the API has no short list of them, so
|
|
19
|
+
* the viewer never gets the whole sequence. Every picture gets a short one of its own: the
|
|
20
|
+
* picture before, the picture, the picture after. `Image.sequenceId` of the viewer is therefore
|
|
21
|
+
* not the Panoramax sequence; use `getItem(id).collection`.
|
|
22
|
+
*/
|
|
23
|
+
export declare class PanoramaxDataProvider extends DataProviderBase {
|
|
24
|
+
private readonly endpoint;
|
|
25
|
+
private readonly items;
|
|
26
|
+
private readonly itemRequests;
|
|
27
|
+
private readonly imageBuffers;
|
|
28
|
+
private readonly pictures;
|
|
29
|
+
constructor({ endpoint }: PanoramaxDataProviderOptions);
|
|
30
|
+
/** The Panoramax data of a picture the viewer has loaded. */
|
|
31
|
+
getItem(imageId: string): PanoramaxItem | undefined;
|
|
32
|
+
getCoreImages(cellId: string): Promise<CoreImagesContract>;
|
|
33
|
+
getImages(imageIds: string[]): Promise<ImagesContract>;
|
|
34
|
+
getSpatialImages(imageIds: string[]): Promise<SpatialImagesContract>;
|
|
35
|
+
getSequence(sequenceId: string): Promise<SequenceContract>;
|
|
36
|
+
getImageBuffer(url: string): Promise<ArrayBuffer>;
|
|
37
|
+
getImageTiles({ imageId, z, }: ImageTilesRequestContract): Promise<ImageTilesContract>;
|
|
38
|
+
private cutTile;
|
|
39
|
+
private loadPicture;
|
|
40
|
+
getMesh(): Promise<MeshContract>;
|
|
41
|
+
getCluster(url: string): Promise<ClusterContract>;
|
|
42
|
+
private loadItems;
|
|
43
|
+
private toImageEnt;
|
|
44
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { NormalizedPhoto } from '@osm-editor-kit/street-imagery';
|
|
2
|
+
/** The parts of a Panoramax picture (a STAC item of `/api/search`) the viewer reads. */
|
|
3
|
+
export type PanoramaxItem = {
|
|
4
|
+
id: string;
|
|
5
|
+
collection?: string;
|
|
6
|
+
geometry: {
|
|
7
|
+
type: 'Point';
|
|
8
|
+
coordinates: [number, number];
|
|
9
|
+
};
|
|
10
|
+
links?: {
|
|
11
|
+
rel: string;
|
|
12
|
+
href?: string;
|
|
13
|
+
/** `prev` and `next` name the neighbour in the sequence. */
|
|
14
|
+
id?: string;
|
|
15
|
+
/** `via` names the server the picture is stored on. */
|
|
16
|
+
instance_name?: string;
|
|
17
|
+
}[];
|
|
18
|
+
assets?: Partial<Record<'hd' | 'sd' | 'thumb', {
|
|
19
|
+
href: string;
|
|
20
|
+
}>>;
|
|
21
|
+
providers?: {
|
|
22
|
+
name: string;
|
|
23
|
+
roles?: string[];
|
|
24
|
+
}[];
|
|
25
|
+
properties?: {
|
|
26
|
+
datetime?: string;
|
|
27
|
+
datetimetz?: string;
|
|
28
|
+
created?: string;
|
|
29
|
+
license?: string;
|
|
30
|
+
exif?: Record<string, unknown>;
|
|
31
|
+
'view:azimuth'?: number | null;
|
|
32
|
+
'geovisio:producer'?: string;
|
|
33
|
+
'geovisio:rank_in_collection'?: number;
|
|
34
|
+
'original_file:name'?: string;
|
|
35
|
+
'original_file:size'?: number;
|
|
36
|
+
'quality:horizontal_accuracy'?: number;
|
|
37
|
+
'pers:interior_orientation'?: {
|
|
38
|
+
camera_manufacturer?: string;
|
|
39
|
+
camera_model?: string;
|
|
40
|
+
focal_length?: number;
|
|
41
|
+
/** Horizontal field of view in degrees; 360 for a 360° picture. */
|
|
42
|
+
field_of_view?: number | null;
|
|
43
|
+
/** Width and height of the picture in pixels. */
|
|
44
|
+
sensor_array_dimensions?: [number, number];
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export declare const isPanoramaxItemSpherical: (item: PanoramaxItem) => boolean;
|
|
49
|
+
/** Width and height in pixels; a guess when the picture does not state them. */
|
|
50
|
+
export declare const panoramaxItemSize: (item: PanoramaxItem) => [number, number];
|
|
51
|
+
/** Neighbour in the sequence, from the item's `prev` / `next` link. */
|
|
52
|
+
export declare const panoramaxItemNeighbour: (item: PanoramaxItem, rel: 'prev' | 'next') => string | null;
|
|
53
|
+
/** The file a picture opens with: `sd`, 2048 px wide. */
|
|
54
|
+
export declare const panoramaxItemImageUrl: (item: PanoramaxItem) => string;
|
|
55
|
+
type PictureSize = [width: number, height: number];
|
|
56
|
+
/**
|
|
57
|
+
* The size to tell mapillary-js: the real proportions, with the longer side raised to the next
|
|
58
|
+
* power of two. Its tile levels halve from that power of two, so a picture of 8704 px would get
|
|
59
|
+
* levels of 4352, 2176, 1088 px, the low ones coarser than the `sd` file. This way they are
|
|
60
|
+
* 8192, 4096, 2048 px.
|
|
61
|
+
*/
|
|
62
|
+
export declare const panoramaxViewerSize: (item: PanoramaxItem) => PictureSize;
|
|
63
|
+
/** Whether level `z` shows more detail than the `sd` file; only then the original is needed. */
|
|
64
|
+
export declare const panoramaxLevelNeedsOriginal: (size: PictureSize, z: number) => boolean;
|
|
65
|
+
/** The tiles of a picture at level `z`. */
|
|
66
|
+
export declare const panoramaxTilesOfLevel: (size: PictureSize, z: number) => {
|
|
67
|
+
x: number;
|
|
68
|
+
y: number;
|
|
69
|
+
}[];
|
|
70
|
+
/**
|
|
71
|
+
* Where to cut a tile from a file of the picture, and how large to draw it. `original` is the
|
|
72
|
+
* size of that file; the cut is scaled when it differs from the stated `size`.
|
|
73
|
+
*/
|
|
74
|
+
export declare const panoramaxTileRect: (size: PictureSize, tile: {
|
|
75
|
+
x: number;
|
|
76
|
+
y: number;
|
|
77
|
+
z: number;
|
|
78
|
+
}, original: {
|
|
79
|
+
width: number;
|
|
80
|
+
height: number;
|
|
81
|
+
}) => {
|
|
82
|
+
x: number;
|
|
83
|
+
y: number;
|
|
84
|
+
width: number;
|
|
85
|
+
height: number;
|
|
86
|
+
outWidth: number;
|
|
87
|
+
outHeight: number;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Focal length of a flat picture as mapillary-js wants it: relative to the longer side. A
|
|
91
|
+
* picture without a field of view gets a common one.
|
|
92
|
+
*/
|
|
93
|
+
export declare const panoramaxItemFocal: (item: PanoramaxItem) => number;
|
|
94
|
+
/** The picture as a photo with creator, licence, local capture time and camera. */
|
|
95
|
+
export declare const panoramaxPhotoFromItem: (item: PanoramaxItem) => NormalizedPhoto;
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** The parts of Photo Sphere Viewer (inside the Panoramax viewer) that limiting the view needs. */
|
|
2
|
+
export type PsvForPanLimit = {
|
|
3
|
+
state: {
|
|
4
|
+
hFov: number;
|
|
5
|
+
vFov: number;
|
|
6
|
+
textureData?: {
|
|
7
|
+
panoData?: {
|
|
8
|
+
baseData?: {
|
|
9
|
+
fullWidth: number;
|
|
10
|
+
fullHeight: number;
|
|
11
|
+
croppedWidth: number;
|
|
12
|
+
croppedHeight: number;
|
|
13
|
+
croppedX: number;
|
|
14
|
+
croppedY: number;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
dataHelper: {
|
|
20
|
+
fovToZoomLevel(fov: number): number;
|
|
21
|
+
};
|
|
22
|
+
getZoomLevel(): number;
|
|
23
|
+
zoom(level: number): void;
|
|
24
|
+
getPosition(): {
|
|
25
|
+
yaw: number;
|
|
26
|
+
pitch: number;
|
|
27
|
+
};
|
|
28
|
+
rotate(position: {
|
|
29
|
+
yaw: number;
|
|
30
|
+
pitch: number;
|
|
31
|
+
}): void;
|
|
32
|
+
addEventListener(type: string, listener: (event: Event) => void): void;
|
|
33
|
+
removeEventListener(type: string, listener: (event: Event) => void): void;
|
|
34
|
+
};
|
|
35
|
+
type ViewPosition = {
|
|
36
|
+
yaw: number;
|
|
37
|
+
pitch: number;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The view position moved back so the image stays in view. Flat photos are shown as a small
|
|
41
|
+
* patch of a sphere; outside the patch there is only black. 360° photos have no limit.
|
|
42
|
+
*/
|
|
43
|
+
export declare const limitToImage: (psv: PsvForPanLimit, position: ViewPosition) => ViewPosition;
|
|
44
|
+
/**
|
|
45
|
+
* The widest zoom level for a flat photo: the image with a small margin around it (in the
|
|
46
|
+
* tighter direction). `null` when there is no limit.
|
|
47
|
+
*/
|
|
48
|
+
export declare const widestZoomLevel: (psv: PsvForPanLimit) => number | null;
|
|
49
|
+
/**
|
|
50
|
+
* Keep the view inside the image while the user pans and zooms. Returns a function that removes
|
|
51
|
+
* the listeners again.
|
|
52
|
+
*/
|
|
53
|
+
export declare const limitPanningToImage: (psv: PsvForPanLimit) => (() => void);
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NormalizedPhoto } from '@osm-editor-kit/street-imagery';
|
|
2
|
+
import type { PnxPictureMetadata } from './panoramax-photo-viewer.d';
|
|
3
|
+
/**
|
|
4
|
+
* The shown picture as a photo with everything the Panoramax viewer knows about it: creator,
|
|
5
|
+
* licence, local capture time, camera. The viewer's own legend holds the same; hosts show it in
|
|
6
|
+
* their own layout instead.
|
|
7
|
+
*/
|
|
8
|
+
export declare const panoramaxPhotoFromMetadata: (metadata: PnxPictureMetadata) => NormalizedPhoto;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PanoramaxWebViewerPanel } from '../panels/PanoramaxWebViewerPanel';
|