@itowns/geographic 2.45.1-next.0 → 2.45.1-next.1

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.
@@ -0,0 +1,246 @@
1
+ import * as THREE from 'three';
2
+ import Coordinates from './Coordinates';
3
+ import type { ProjectionLike } from './Crs';
4
+ export interface ExtentLike {
5
+ readonly west: number;
6
+ readonly east: number;
7
+ readonly south: number;
8
+ readonly north: number;
9
+ }
10
+ /**
11
+ * A class representing a geographical extent.
12
+ *
13
+ * An extent is a geographical bounding rectangle defined by 4 limits: west,
14
+ * east, south and north.
15
+ *
16
+ * **Warning**: Using a geocentric projection is not suitable for representing a
17
+ * geographical extent. Please use a geographic projection.
18
+ */
19
+ declare class Extent {
20
+ /**
21
+ * Read-only flag to check if a given object is of type `Extent`.
22
+ */
23
+ readonly isExtent: true;
24
+ /**
25
+ * A default or user-defined CRS (see {@link ProjectionLike}).
26
+ */
27
+ crs: ProjectionLike;
28
+ /**
29
+ * West longitude bound of this extent.
30
+ */
31
+ west: number;
32
+ /**
33
+ * East longitude bound of this extent.
34
+ */
35
+ east: number;
36
+ /**
37
+ * South latitude bound of this extent.
38
+ */
39
+ south: number;
40
+ /**
41
+ * North latitude bound of this extent.
42
+ */
43
+ north: number;
44
+ /**
45
+ * @param crs - A default or user-defined CRS (see {@link ProjectionLike}).
46
+ * @param west - the `west` value of this extent. Default is 0.
47
+ * @param east - the `east` value of this extent. Default is 0.
48
+ * @param south - the `south` value of this extent. Default is 0.
49
+ * @param north - the `north` value of this extent. Default is 0.
50
+ */
51
+ constructor(crs: ProjectionLike, west?: number, east?: number, south?: number, north?: number);
52
+ /**
53
+ * Returns a new extent with the same bounds and crs as this one.
54
+ */
55
+ clone(): Extent;
56
+ /**
57
+ * Projects this extent to the specified projection.
58
+ *
59
+ * @param crs - target's projection.
60
+ * @param target - The target to store the projected extent. If this not
61
+ * provided a new extent will be created.
62
+ */
63
+ as(crs: string, target?: Extent): Extent;
64
+ /**
65
+ * Returns the center of the extent.
66
+ *
67
+ * @param target - The target to store the center coordinate. If this not
68
+ * provided a new coordinate will be created.
69
+ */
70
+ center(target?: Coordinates): Coordinates;
71
+ /**
72
+ * Returns the planar dimensions as two-vector planar distances west/east
73
+ * and south/north.
74
+ * The planar distance is a straight-line Euclidean distance calculated in a
75
+ * 2D Cartesian coordinate system.
76
+ *
77
+ * @param target - optional target
78
+ */
79
+ planarDimensions(target?: THREE.Vector2): THREE.Vector2;
80
+ /**
81
+ * Returns the geodetic dimensions as two-vector planar distances west/east
82
+ * and south/north.
83
+ * Geodetic distance is calculated in an ellispoid space as the distance
84
+ * across the curved surface of the ellipsoid.
85
+ *
86
+ * @param target - optional target
87
+ */
88
+ geodeticDimensions(target?: THREE.Vector2): THREE.Vector2;
89
+ /**
90
+ * Returns the spatial euclidean dimensions as a two-vector spatial
91
+ * euclidean distances between west/east corner and south/north corner.
92
+ * Spatial euclidean distance chord is calculated in an ellispoid space.
93
+ *
94
+ * @param target - optional target
95
+ */
96
+ spatialEuclideanDimensions(target?: THREE.Vector2): THREE.Vector2;
97
+ /**
98
+ * Checks whether a coordinates is inside the extent.
99
+ *
100
+ * @param coord - the given coordinates.
101
+ * @param epsilon - error margin when comparing to the coordinates.
102
+ * Default is 0.
103
+ */
104
+ isPointInside(coord: Coordinates, epsilon?: number): boolean;
105
+ /**
106
+ * Checks whether another extent is inside the extent.
107
+ *
108
+ * @param extent - the extent to check
109
+ * @param epsilon - error margin when comparing the extent bounds.
110
+ */
111
+ isInside(extent: Extent, epsilon?: number): boolean;
112
+ /**
113
+ * Return the translation and scale to transform this extent to the input
114
+ * extent.
115
+ *
116
+ * @param extent - input extent
117
+ * @param target - copy the result to target.
118
+ * @returns A {@link THREE.Vector4} where the `x` property encodes the
119
+ * translation on west-east, the `y` property the translation on
120
+ * south-north, the `z` property the scale on west-east, the `w` property
121
+ * the scale on south-north.
122
+ */
123
+ offsetToParent(extent: Extent, target?: THREE.Vector4): THREE.Vector4;
124
+ /**
125
+ * Checks wheter this bounding box intersects with the given extent
126
+ * parameter.
127
+ * @param extent - the provided extent
128
+ */
129
+ intersectsExtent(extent: Extent): boolean;
130
+ static intersectsExtent(extentA: Extent, extentB: Extent): boolean;
131
+ /**
132
+ * Returns the intersection of this extent with another one.
133
+ * @param extent - extent to intersect
134
+ */
135
+ intersect(extent: Extent): Extent;
136
+ /**
137
+ * Set west, east, south and north values.
138
+ *
139
+ * @param v0 - the `west` value of this extent. Default is 0.
140
+ * @param v1 - the `east` value of this extent. Default is 0.
141
+ * @param v2 - the `south` value of this extent. Default is 0.
142
+ * @param v3 - the `north` value of this extent. Default is 0.
143
+ */
144
+ set(v0: number, v1: number, v2: number, v3: number): this;
145
+ /**
146
+ * Sets this extent `west` property to `array[offset + 0]`, `east` property
147
+ * to `array[offset + 1]`, `south` property to `array[offset + 2]` and
148
+ * `north` property to `array[offset + 3]`.
149
+ * @param array - the source array
150
+ * @param offset - offset into the array. Default is 0.
151
+ */
152
+ setFromArray(array: ArrayLike<number>, offset?: number): this;
153
+ /**
154
+ * Sets this extent `west`, `east`, `south` and `north` properties from an
155
+ * `extent` bounds.
156
+ * @param extent - the source extent
157
+ */
158
+ setFromExtent(extent: ExtentLike): this;
159
+ /**
160
+ * Copies the passed extent to this extent.
161
+ * @param extent - extent to copy.
162
+ */
163
+ copy(extent: Extent): this;
164
+ /**
165
+ * Union this extent with the input extent.
166
+ * @param extent - the extent to union.
167
+ */
168
+ union(extent: Extent): void;
169
+ /**
170
+ * expandByCoordinates perfoms the minimal extension
171
+ * for the coordinates to belong to this Extent object
172
+ * @param coordinates - The coordinates to belong
173
+ */
174
+ expandByCoordinates(coordinates: Coordinates): void;
175
+ /**
176
+ * expandByValuesCoordinates perfoms the minimal extension
177
+ * for the coordinates values to belong to this Extent object
178
+ * @param we - The coordinate on west-east
179
+ * @param sn - The coordinate on south-north
180
+ *
181
+ */
182
+ expandByValuesCoordinates(we: number, sn: number): void;
183
+ /**
184
+ * Instance Extent with THREE.Box3.
185
+ *
186
+ * If crs is a geocentric projection, the `box3.min` and `box3.max`
187
+ * should be the geocentric coordinates of `min` and `max` of a `box3`
188
+ * in local tangent plane.
189
+ *
190
+ * @param crs - Projection of extent to instancied.
191
+ * @param box - Bounding-box
192
+ */
193
+ static fromBox3(crs: ProjectionLike, box: THREE.Box3): Extent;
194
+ /**
195
+ * Return values of extent in string, separated by the separator input.
196
+ * @param sep - string separator
197
+ */
198
+ toString(sep?: string): string;
199
+ /**
200
+ * Subdivide equally an extent from its center to return four extents:
201
+ * north-west, north-east, south-west and south-east.
202
+ *
203
+ * @returns An array containing the four sections of the extent. The order
204
+ * of the sections is [NW, NE, SW, SE].
205
+ */
206
+ subdivision(): Extent[];
207
+ /**
208
+ * subdivise extent by scheme.x on west-east and scheme.y on south-north.
209
+ *
210
+ * @param scheme - The scheme to subdivise.
211
+ * @returns subdivised extents.
212
+ */
213
+ subdivisionByScheme(scheme?: THREE.Vector2): Extent[];
214
+ /**
215
+ * Multiplies all extent `coordinates` (with an implicit 1 in the 4th
216
+ * dimension) and `matrix`.
217
+ *
218
+ * @param matrix - The matrix
219
+ * @returns return this extent instance.
220
+ */
221
+ applyMatrix4(matrix: THREE.Matrix4): this;
222
+ /**
223
+ * clamp south and north values
224
+ *
225
+ * @param south - The min south
226
+ * @param north - The max north
227
+ * @returns this extent
228
+ */
229
+ clampSouthNorth(south?: number, north?: number): this;
230
+ /**
231
+ * clamp west and east values
232
+ *
233
+ * @param west - The min west
234
+ * @param east - The max east
235
+ * @returns this extent
236
+ */
237
+ clampWestEast(west?: number, east?: number): this;
238
+ /**
239
+ * clamp this extent by passed extent
240
+ *
241
+ * @param extent - The maximum extent.
242
+ * @returns this extent.
243
+ */
244
+ clampByExtent(extent: ExtentLike): this;
245
+ }
246
+ export default Extent;