jmapcloud-ng-core-types 0.0.4
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/.prettierrc +10 -0
- package/.vscode/settings.json +24 -0
- package/README.md +12 -0
- package/_config.yml +1 -0
- package/all-enums.ts +286 -0
- package/index.ts +1003 -0
- package/package.json +42 -0
- package/public/core.d.ts +12255 -0
- package/public/jmap/ajax.d.ts +31 -0
- package/public/jmap/date.d.ts +17 -0
- package/public/jmap/extension.d.ts +216 -0
- package/public/jmap/features.d.ts +32 -0
- package/public/jmap/form.d.ts +590 -0
- package/public/jmap/geocoding.d.ts +33 -0
- package/public/jmap/geometry.d.ts +44 -0
- package/public/jmap/language.d.ts +38 -0
- package/public/jmap/layer.d.ts +591 -0
- package/public/jmap/main.d.ts +30 -0
- package/public/jmap/map-context.d.ts +197 -0
- package/public/jmap/map.d.ts +622 -0
- package/public/jmap/mouseover.d.ts +62 -0
- package/public/jmap/photos.d.ts +43 -0
- package/public/jmap/project.d.ts +45 -0
- package/public/jmap/query.d.ts +41 -0
- package/public/jmap/selection.d.ts +25 -0
- package/public/jmap/server.d.ts +79 -0
- package/public/jmap/startup-options.d.ts +500 -0
- package/public/jmap/ui.d.ts +13 -0
- package/public/jmap/user.d.ts +96 -0
- package/tsconfig.json +25 -0
- package/tslint.json +86 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
declare interface JProjectLoadThumbnailsParams {
|
|
2
|
+
width: number
|
|
3
|
+
height: number
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
declare interface JProjectEventParams {
|
|
7
|
+
project: JProject
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare interface JProjectAllEventParams {
|
|
11
|
+
projects: JProject[]
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare interface JProjectServerExtension {
|
|
15
|
+
id: string
|
|
16
|
+
urn: string // Unique identifier. Same as id for JMS
|
|
17
|
+
name: string
|
|
18
|
+
jsUrl: string
|
|
19
|
+
data: any | null
|
|
20
|
+
version: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare interface JProject {
|
|
24
|
+
id: JId //TODO: refactoring will be done in JWNG-351
|
|
25
|
+
name: string
|
|
26
|
+
description: string
|
|
27
|
+
projection: JProjection
|
|
28
|
+
initialRotation: number
|
|
29
|
+
colorSelection: string
|
|
30
|
+
colorBackground: string
|
|
31
|
+
initialExtent: JBounds | null
|
|
32
|
+
minimumVisibleMapboxZoom: number
|
|
33
|
+
maximumVisibleMapboxZoom: number
|
|
34
|
+
mapUnit: JMAP_DISTANCE_UNITS
|
|
35
|
+
apiKey: {
|
|
36
|
+
google: string | null
|
|
37
|
+
bing: string | null
|
|
38
|
+
mapBox: string | null
|
|
39
|
+
}
|
|
40
|
+
queryGroups: JQueryGroup[]
|
|
41
|
+
defaultDistanceUnit: JMAP_DISTANCE_UNITS
|
|
42
|
+
base64ImageThumbnail: string
|
|
43
|
+
extensions: JProjectServerExtension[]
|
|
44
|
+
usageStatisticsActive: boolean
|
|
45
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
declare interface JQueryGroup {
|
|
2
|
+
id: JId
|
|
3
|
+
name: string
|
|
4
|
+
queries: JQuery[]
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare interface JQuery {
|
|
8
|
+
id: string // unique id, set by NG
|
|
9
|
+
jmapId: JId // non unique id, set by server, used to fetch query form (associate to layer id)
|
|
10
|
+
groupId: JId
|
|
11
|
+
name: string
|
|
12
|
+
layerId: JId
|
|
13
|
+
maxScale: number
|
|
14
|
+
maxResults: number,
|
|
15
|
+
isInitialized: boolean
|
|
16
|
+
isLoading: boolean
|
|
17
|
+
hasLoadingError: boolean
|
|
18
|
+
formMetaData: JFormMetaData
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare interface JQueryBeforeEventParams {
|
|
22
|
+
id: string
|
|
23
|
+
groupId: string
|
|
24
|
+
name: string
|
|
25
|
+
layerId: JId
|
|
26
|
+
maxScale: number
|
|
27
|
+
maxResults: number
|
|
28
|
+
enteredData: any
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare interface JQuerySuccessEventParams extends JQueryBeforeEventParams {
|
|
32
|
+
returnedFeatures: GeoJSON.Feature[]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare interface JQueryErrorEventParams extends JQueryBeforeEventParams {
|
|
36
|
+
error: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare interface JQueryQueryFormHasLoadedEventParams {
|
|
40
|
+
query: JQuery
|
|
41
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare type JElementSelection = {
|
|
2
|
+
[key in JId]: JId[]
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
declare interface JSelectionSetLayersSelectionParams {
|
|
6
|
+
layerId: JId
|
|
7
|
+
features: GeoJSON.Feature[]
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare interface JMapSelectionParams {
|
|
11
|
+
/**
|
|
12
|
+
* true by default.
|
|
13
|
+
* If new selection select a feature that is already selected,
|
|
14
|
+
* if parameter is true it will deselect the feature,
|
|
15
|
+
* else will let the feature selected.
|
|
16
|
+
*/
|
|
17
|
+
toggleSelection?: boolean
|
|
18
|
+
/**
|
|
19
|
+
* false by default.
|
|
20
|
+
* If new selection doesn't select a feature that is already selected,
|
|
21
|
+
* if true will let the feature selected,
|
|
22
|
+
* else will deselect it.
|
|
23
|
+
*/
|
|
24
|
+
keepCurrentSelection?: boolean
|
|
25
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// ALL_SERVER_TYPES in all-enum.ts
|
|
2
|
+
declare const enum JSERVER_TYPES {
|
|
3
|
+
LEGACY = "legacy",
|
|
4
|
+
SAAS = "saas"
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// ALL_SERVER_SAAS_STATUS in all-enum.ts
|
|
8
|
+
declare const enum JSERVER_SAAS_STATUS {
|
|
9
|
+
STARTING = "STARTING",
|
|
10
|
+
UP = "UP",
|
|
11
|
+
DOWN = "DOWN"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// ALL_SERVER_SAAS_STATUS in all-enum.ts
|
|
15
|
+
declare const enum JSERVER_IDENTITY_PROVIDER_TYPES {
|
|
16
|
+
SSO = "sso",
|
|
17
|
+
AUTH0_SPA = "auth0-spa"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare interface JServerIdentityProviderById {
|
|
21
|
+
[id: string]: JServerAnyIdentityProvider
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare interface JServerSaasServiceById {
|
|
25
|
+
[id: string]: JServerSaasService
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare interface JServerInfo {
|
|
29
|
+
identityProviderById: JServerIdentityProviderById
|
|
30
|
+
standardLoginAvailable: boolean
|
|
31
|
+
version: JServerVersion
|
|
32
|
+
type: JSERVER_TYPES
|
|
33
|
+
saasServiceById?: JServerSaasServiceById
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare interface JServerSaasService {
|
|
37
|
+
id: string
|
|
38
|
+
name: string
|
|
39
|
+
version: string
|
|
40
|
+
status: JSERVER_SAAS_STATUS
|
|
41
|
+
restBaseUrl: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare type JServerAnyIdentityProvider = JServerIdentityProviderAuth0Password | JServerIdentityProviderSso
|
|
45
|
+
|
|
46
|
+
declare interface JServerIdentityProviderBase {
|
|
47
|
+
id: string
|
|
48
|
+
name: string
|
|
49
|
+
type: JSERVER_IDENTITY_PROVIDER_TYPES
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
declare interface JServerIdentityProviderAuth0Password extends JServerIdentityProviderBase {
|
|
53
|
+
type: JSERVER_IDENTITY_PROVIDER_TYPES.AUTH0_SPA
|
|
54
|
+
domain: string
|
|
55
|
+
clientId: string
|
|
56
|
+
realm: string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
declare interface JServerIdentityProviderSso extends JServerIdentityProviderBase {
|
|
60
|
+
type: JSERVER_IDENTITY_PROVIDER_TYPES.SSO
|
|
61
|
+
imageData: string
|
|
62
|
+
loginUrl: string
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
declare interface JServerVersion {
|
|
66
|
+
title: string
|
|
67
|
+
mainVersion: number
|
|
68
|
+
buildNumber: number
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
declare interface JMinimumServerVersion {
|
|
72
|
+
legacy: JServerVersion
|
|
73
|
+
saas: JServerVersion
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
declare interface JServerInfoReadyEventParams {
|
|
77
|
+
serverInfo: JServerInfo
|
|
78
|
+
isMinimumVersionRespected: boolean
|
|
79
|
+
}
|
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
declare interface Window {
|
|
2
|
+
JMAP_OPTIONS?: JCoreOptions
|
|
3
|
+
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?: any
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* This section is about the JMAP Library startup options.
|
|
8
|
+
*
|
|
9
|
+
* JMap library executable is available through a CDN url.
|
|
10
|
+
*
|
|
11
|
+
* The URL is like "https://cdn.jsdelivr.net/npm/jmap-core-js@0.5.0/public/",
|
|
12
|
+
* but it depends on the version you want to use.
|
|
13
|
+
*
|
|
14
|
+
* First you need to import our JS file in your http file, in order to load the JMap Cloud NG Core library.
|
|
15
|
+
* It's recommended to put the CDN import at the end of the body tag, like that :
|
|
16
|
+
* ```html
|
|
17
|
+
* ...
|
|
18
|
+
* <html>
|
|
19
|
+
* ...
|
|
20
|
+
* <body>
|
|
21
|
+
* ...
|
|
22
|
+
* <!-- !!! Insert the import at the end of the body tag !!! -->
|
|
23
|
+
* <script defer type="text/javascript" src="https://cdn.jsdelivr.net/npm/jmap-core-js@x.x.x/public/"></script>
|
|
24
|
+
* </body>
|
|
25
|
+
* </html>
|
|
26
|
+
* ```
|
|
27
|
+
* To make the JMap Cloud NG Core library working you need to provide some required information like :
|
|
28
|
+
*
|
|
29
|
+
* - Your JMap Server Rest API URL
|
|
30
|
+
* - The project id to open
|
|
31
|
+
* - A valid JMap user session token, **or** set the JMap Cloud NG Core library to log as "anonymous"
|
|
32
|
+
*
|
|
33
|
+
* It can be passed by setting a global JS variable named "JMAP_OPTIONS" :
|
|
34
|
+
*
|
|
35
|
+
* ```html
|
|
36
|
+
* <html>
|
|
37
|
+
* <body>
|
|
38
|
+
* <script type="text/javascript">
|
|
39
|
+
* window.JMAP_OPTIONS = {
|
|
40
|
+
* // a valid project id
|
|
41
|
+
* projectId: 10,
|
|
42
|
+
* // a valid JMap server Rest url
|
|
43
|
+
* restBaseUrl: "http://my-jmap-server/services/rest/v2.0",
|
|
44
|
+
* session: {
|
|
45
|
+
* // a valid session token
|
|
46
|
+
* token: 2345677654
|
|
47
|
+
* }
|
|
48
|
+
* ... // other optional JMAP params
|
|
49
|
+
* }
|
|
50
|
+
* </script>
|
|
51
|
+
* ... your web page
|
|
52
|
+
* <script defer type="text/javascript" src="https://cdn.jsdelivr.net/npm/jmap-core-js@x.x.x/public/"></script>
|
|
53
|
+
* </body>
|
|
54
|
+
* </html>
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* Below a full example of how to start the JMap library in a web page,
|
|
58
|
+
* where parameters ***ngToken*** and ***ngProjectId*** are get from the url :
|
|
59
|
+
* ```html
|
|
60
|
+
* <!DOCTYPE html>
|
|
61
|
+
* <html>
|
|
62
|
+
* <head>
|
|
63
|
+
* <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
|
64
|
+
* <meta charset="UTF-8">
|
|
65
|
+
* </head>
|
|
66
|
+
* <body class="jmap_wrapper">
|
|
67
|
+
* <script type="text/javascript">
|
|
68
|
+
* const url = new URL(window.location.href)
|
|
69
|
+
* const token = url.searchParams.get("ngToken")
|
|
70
|
+
* let projectId = Number(url.searchParams.get("ngProjectId"))
|
|
71
|
+
* if (isNaN(projectId)) {
|
|
72
|
+
* projectId = 0
|
|
73
|
+
* }
|
|
74
|
+
* window.JMAP_OPTIONS = {
|
|
75
|
+
* projectId: Number(projectId),
|
|
76
|
+
* restBaseUrl: "http://your-jmap-server-url/services/rest/v2.0",
|
|
77
|
+
* token: token
|
|
78
|
+
* }
|
|
79
|
+
* </script>
|
|
80
|
+
* <script defer type="text/javascript" src="https://cdn.jsdelivr.net/npm/jmap-core-js@x.x.x/public/index.js">
|
|
81
|
+
* </script>
|
|
82
|
+
* </body>
|
|
83
|
+
* </html>
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* For example, you can pass this parameters like that :
|
|
87
|
+
* - **http:// my-company/my-custom-page-using-jmap?ngToken=95423672742&ngProjectId=10**.
|
|
88
|
+
*
|
|
89
|
+
* When JMap Cloud NG Core library starts, if the **JMap token "*95423672742*"** is valid, it will automatically load
|
|
90
|
+
* the **JMap project id=*10***, then load the map in the **div id="*jmap-map*"**.
|
|
91
|
+
*/
|
|
92
|
+
declare interface JCoreOptions {
|
|
93
|
+
/**
|
|
94
|
+
* The JMap project id.
|
|
95
|
+
*
|
|
96
|
+
* If both a project id and a project name are provided, project id will be used.
|
|
97
|
+
*
|
|
98
|
+
* If no project name or id are set, the library will do noting, you will have a blank page.
|
|
99
|
+
*
|
|
100
|
+
* So if you want the library to load the project automatically, you need to set the project id.
|
|
101
|
+
*
|
|
102
|
+
* ```html
|
|
103
|
+
* <html>
|
|
104
|
+
* ...
|
|
105
|
+
* <body>
|
|
106
|
+
* <script type="text/javascript">
|
|
107
|
+
* window.JMAP_OPTIONS = {
|
|
108
|
+
* ...
|
|
109
|
+
* // a valid project id
|
|
110
|
+
* projectId: 12
|
|
111
|
+
* }
|
|
112
|
+
* </script>
|
|
113
|
+
* ...
|
|
114
|
+
* </body>
|
|
115
|
+
* </html>
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
projectId?: JId
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* A JMap project name.
|
|
122
|
+
*
|
|
123
|
+
* If you can prefer using the project id over the name.
|
|
124
|
+
*
|
|
125
|
+
* If both a project id and a project name are provided, project id will be used.
|
|
126
|
+
*
|
|
127
|
+
* If no project name or id are set, the library will do noting, you will have a blank page.
|
|
128
|
+
*
|
|
129
|
+
* So if you want the library to load the project automatically, you need to set the project name (or id).
|
|
130
|
+
*
|
|
131
|
+
* ```html
|
|
132
|
+
* <html>
|
|
133
|
+
* ...
|
|
134
|
+
* <body>
|
|
135
|
+
* <script type="text/javascript">
|
|
136
|
+
* window.JMAP_OPTIONS = {
|
|
137
|
+
* ...
|
|
138
|
+
* // a valid project name
|
|
139
|
+
* projectName: "The world"
|
|
140
|
+
* }
|
|
141
|
+
* </script>
|
|
142
|
+
* ...
|
|
143
|
+
* </body>
|
|
144
|
+
* </html>
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
projectName?: string
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* If provided this function will be processed when the list of projects is received from the server :
|
|
151
|
+
*
|
|
152
|
+
* the event receives a JProjectAllEventParams object
|
|
153
|
+
*
|
|
154
|
+
* ```html
|
|
155
|
+
* <html>
|
|
156
|
+
* ...
|
|
157
|
+
* <body>
|
|
158
|
+
* <script type="text/javascript">
|
|
159
|
+
* window.JMAP_OPTIONS = {
|
|
160
|
+
* ...
|
|
161
|
+
* onProjectsChange: (params) => {
|
|
162
|
+
* params.projects.forEach(project => console.log("project name: " + project.name))
|
|
163
|
+
* },
|
|
164
|
+
* ...
|
|
165
|
+
* }
|
|
166
|
+
* </script>
|
|
167
|
+
* ...
|
|
168
|
+
* </body>
|
|
169
|
+
* </html>
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
onProjectsChange?(params: JProjectAllEventParams): void
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* By default project thumbnails are not loaded, because they are not useful if JMap Cloud NG Core lib is used alone.
|
|
176
|
+
*
|
|
177
|
+
* To load asynchronously project thumbnails, set startup option "loadProjectThumbnails" to true.
|
|
178
|
+
*
|
|
179
|
+
* JMap Cloud NG Core lib will load all project thumbnails (or preview) in project objects (property "base64ImageThumbnail").
|
|
180
|
+
*
|
|
181
|
+
* The thumbnail is stored as a base64 string image, that you can use to set an img src attribute directly.
|
|
182
|
+
*
|
|
183
|
+
* For a project object, if thumbnail is not loaded, default value of its property "base64ImageThumbnail" is "" (empty string).
|
|
184
|
+
*
|
|
185
|
+
* ```html
|
|
186
|
+
* <html>
|
|
187
|
+
* ...
|
|
188
|
+
* <body>
|
|
189
|
+
* <script type="text/javascript">
|
|
190
|
+
* window.JMAP_OPTIONS = {
|
|
191
|
+
* ...
|
|
192
|
+
* loadProjectThumbnails: true
|
|
193
|
+
* }
|
|
194
|
+
* </script>
|
|
195
|
+
* ...
|
|
196
|
+
* </body>
|
|
197
|
+
* </html>
|
|
198
|
+
* ```
|
|
199
|
+
*
|
|
200
|
+
* Then you will be able to get a project and use its thumbnail :
|
|
201
|
+
* ```javascript
|
|
202
|
+
* JMap.Project.getBase64ImageThumbnail() // return loaded project image, "" if no image loaded
|
|
203
|
+
* JMap.Project.getById(3).base64ImageThumbnail // return project id=3 image, "" if no image loaded
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
loadProjectThumbnails?: boolean
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* The JMap Server Rest API url.
|
|
210
|
+
*
|
|
211
|
+
* Default value is : http://localhost:8080/services/rest/v2.0 (for test only).
|
|
212
|
+
*
|
|
213
|
+
* If your are not testing you must provide the url of your JMap REST API :
|
|
214
|
+
* ```html
|
|
215
|
+
* <html>
|
|
216
|
+
* ...
|
|
217
|
+
* <body>
|
|
218
|
+
* <script type="text/javascript">
|
|
219
|
+
* window.JMAP_OPTIONS = {
|
|
220
|
+
* ...
|
|
221
|
+
* // a valid JMap REST Api url
|
|
222
|
+
* restBaseUrl: "http://my-custom-jmap-server-url/services/rest/v2.0"
|
|
223
|
+
* }
|
|
224
|
+
* </script>
|
|
225
|
+
* ...
|
|
226
|
+
* </body>
|
|
227
|
+
* </html>
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
restBaseUrl?: string
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* If the project you access can be accessed anonymously,
|
|
234
|
+
* you are not forced to pass a session token but you have
|
|
235
|
+
* to explicitly tell the JMap Cloud NG library to log as an anonymous
|
|
236
|
+
* user by setting the "***anonymous***" parameter like that :
|
|
237
|
+
*
|
|
238
|
+
* ```html
|
|
239
|
+
* <html>
|
|
240
|
+
* ...
|
|
241
|
+
* <body>
|
|
242
|
+
* <script type="text/javascript">
|
|
243
|
+
* window.JMAP_OPTIONS = {
|
|
244
|
+
* // a valid project id
|
|
245
|
+
* projectId: 10,
|
|
246
|
+
* // a valid JMap Server Rest url
|
|
247
|
+
* restBaseUrl: "http://my-jmap-server/services/rest/v2.0",
|
|
248
|
+
* // The anonymous parameter
|
|
249
|
+
* anonymous: true
|
|
250
|
+
* ... // other optional JMAP params
|
|
251
|
+
* }
|
|
252
|
+
* </script>
|
|
253
|
+
*
|
|
254
|
+
* ... your web page
|
|
255
|
+
*
|
|
256
|
+
* <script defer type="text/javascript" src="https://cdn.jsdelivr.net/npm/jmap-core-js@x.x.x/public/"></script>
|
|
257
|
+
* </body>
|
|
258
|
+
* </html>
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
anonymous?: boolean
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* The JMap user's session token.
|
|
265
|
+
*
|
|
266
|
+
* If you don't use the library with an anonymous user (see the [[***JCoreOptions.anonymous***]] parameter in this section), you must provide a JMap Server session token or a JMap Cloud refresh token to the JMap library.
|
|
267
|
+
*
|
|
268
|
+
* To get a session or refresh token, you can use the JMap Rest API on your JMap Server. See [[JMap.User.setToken]] for detailed examples on how to fetch a token through JMap's REST API.
|
|
269
|
+
*
|
|
270
|
+
* So to start the library using the fetched token you can configure your startup options like this :
|
|
271
|
+
* ```html
|
|
272
|
+
* <html>
|
|
273
|
+
* ...
|
|
274
|
+
* <body>
|
|
275
|
+
* <script type="text/javascript">
|
|
276
|
+
* window.JMAP_OPTIONS = {
|
|
277
|
+
* token: "23558109"
|
|
278
|
+
* }
|
|
279
|
+
* </script>
|
|
280
|
+
* ...
|
|
281
|
+
* <script defer type="text/javascript" src="https://cdn.jsdelivr.net/npm/jmap-core-js@x.x.x/public/"></script>
|
|
282
|
+
* </body>
|
|
283
|
+
* </html>
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* If you don't want to make an AJAX call to the REST API, you can use the JMap library to login (JMap will make the AJAX call to the rest API). You have to wait for the lib to be loaded and the server to be ready to accept requests.
|
|
287
|
+
*
|
|
288
|
+
* To know if the lib has been loaded you can check if the JMAp namespace exists or not. See below for an example:
|
|
289
|
+
*
|
|
290
|
+
* ```html
|
|
291
|
+
* <!DOCTYPE html>
|
|
292
|
+
* <html>
|
|
293
|
+
* ...
|
|
294
|
+
* <body class="jmap_wrapper">
|
|
295
|
+
* <script type="text/javascript">
|
|
296
|
+
* console.log("JMap", window.JMap)
|
|
297
|
+
* window.JMAP_OPTIONS = {
|
|
298
|
+
* projectId: 35,
|
|
299
|
+
* restBaseUrl: "https://jmap7dev.jmaponline.net/services/rest/v2.0",
|
|
300
|
+
* map: {
|
|
301
|
+
* zoom: 9.757829447748511,
|
|
302
|
+
* center: {
|
|
303
|
+
* x: -73.66415865898597,
|
|
304
|
+
* y: 45.53583011032552
|
|
305
|
+
* }
|
|
306
|
+
* }
|
|
307
|
+
* }
|
|
308
|
+
* </script>
|
|
309
|
+
* ...
|
|
310
|
+
* <script defer type="text/javascript" src="https://cdn.jsdelivr.net/npm/jmap-core-js@x.x.x/public/index.js"></script>
|
|
311
|
+
* <script>
|
|
312
|
+
* (function jmapLogin() {
|
|
313
|
+
* if (window.hasOwnProperty("JMap") && JMap.Server.isReady()) {
|
|
314
|
+
* JMap.User.login("jdo@company.com", "xxx")
|
|
315
|
+
* } else {
|
|
316
|
+
* console.log("Waiting for the JMap lib to be loaded ...")
|
|
317
|
+
* setTimeout(() => jmapLogin(), 150) // check every 150 milliseconds
|
|
318
|
+
* }
|
|
319
|
+
* })()
|
|
320
|
+
* </script>
|
|
321
|
+
* </body>
|
|
322
|
+
* </html>
|
|
323
|
+
* ```
|
|
324
|
+
*
|
|
325
|
+
*/
|
|
326
|
+
token?: string
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* The JMap Cloud organization id associated with the refresh token.
|
|
330
|
+
*
|
|
331
|
+
* For JMap CLoud only. Only taken into account if a refresh token has been passed via the [[JCoreOptions.token]] startup option (or the equivalent hash parameter version)
|
|
332
|
+
* ***or*** if the "anonymous" option has been passed, together with a project id.
|
|
333
|
+
*
|
|
334
|
+
* You can pass this organization id to open a session on JMap Cloud via the startup options.
|
|
335
|
+
*
|
|
336
|
+
* A typical usage for a session opening:
|
|
337
|
+
* ```html
|
|
338
|
+
* <html>
|
|
339
|
+
* ...
|
|
340
|
+
* <body>
|
|
341
|
+
* <script type="text/javascript">
|
|
342
|
+
* window.JMAP_OPTIONS = {
|
|
343
|
+
* token: "v1.MRq [.....] Rehef72YWws", // a refresh token
|
|
344
|
+
* organizationId: "my-organization-id"
|
|
345
|
+
* }
|
|
346
|
+
* </script>
|
|
347
|
+
* ...
|
|
348
|
+
* <script defer type="text/javascript" src="https://cdn.jsdelivr.net/npm/jmap-core-js@x.x.x/public/"></script>
|
|
349
|
+
* </body>
|
|
350
|
+
* </html>
|
|
351
|
+
* ```
|
|
352
|
+
*
|
|
353
|
+
* A typical usage for a JMap Cloud public project:
|
|
354
|
+
* ```html
|
|
355
|
+
* <html>
|
|
356
|
+
* ...
|
|
357
|
+
* <body>
|
|
358
|
+
* <script type="text/javascript">
|
|
359
|
+
* window.JMAP_OPTIONS = {
|
|
360
|
+
* anonymous: true,
|
|
361
|
+
* projectId: "my-project-id",
|
|
362
|
+
* organizationId: "my-organization-id"
|
|
363
|
+
* }
|
|
364
|
+
* </script>
|
|
365
|
+
* ...
|
|
366
|
+
* <script defer type="text/javascript" src="https://cdn.jsdelivr.net/npm/jmap-core-js@x.x.x/public/"></script>
|
|
367
|
+
* </body>
|
|
368
|
+
* </html>
|
|
369
|
+
* ``` */
|
|
370
|
+
organizationId?: string
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* By default the geolocation service is enabled.
|
|
374
|
+
*
|
|
375
|
+
* But you can disable the geolocation service by setting the "***geolocationEnabled***" parameter to false :
|
|
376
|
+
*
|
|
377
|
+
* ```html
|
|
378
|
+
* <html>
|
|
379
|
+
* ...
|
|
380
|
+
* <body>
|
|
381
|
+
* <script type="text/javascript">
|
|
382
|
+
* window.JMAP_OPTIONS = {
|
|
383
|
+
* ...
|
|
384
|
+
* geolocationEnabled: false
|
|
385
|
+
* }
|
|
386
|
+
* </script>
|
|
387
|
+
* ...
|
|
388
|
+
* </body>
|
|
389
|
+
* </html>
|
|
390
|
+
* ```
|
|
391
|
+
*/
|
|
392
|
+
geolocationEnabled?: boolean
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* All map related options.
|
|
396
|
+
*
|
|
397
|
+
* Click on [[JCoreMapOptions]] to get details.
|
|
398
|
+
*/
|
|
399
|
+
map?: JCoreMapOptions
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Optional extensions.
|
|
403
|
+
*
|
|
404
|
+
* Click [[JCoreExtension]] to get details about how defining an extension.
|
|
405
|
+
*/
|
|
406
|
+
extensions?: JCoreExtension[]
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* If true, changing project after one has been loaded will be disabled.
|
|
410
|
+
*/
|
|
411
|
+
disableProjectChange?: boolean
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* If set to any of the locales supported by JMap, will define the default locale, bypassing browser or user-defined locale.
|
|
415
|
+
*
|
|
416
|
+
* Supported locales can be retrieved by calling [[JMap.User.getLocales()]]
|
|
417
|
+
*/
|
|
418
|
+
locale?: string
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Call when the JMap library is loaded
|
|
422
|
+
*/
|
|
423
|
+
onReady?: () => void
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* As a developer, you can override a project's extension jsUrl during development.
|
|
427
|
+
*
|
|
428
|
+
* Ex: the extension having id="custom-extension" is set on the project. Its unique identifier is:
|
|
429
|
+
* * for JMap Server: `serverExtensionId` = "my.extention.classPath"
|
|
430
|
+
* * for JMap Cloud: `jmapCloudExtensionUrn` = "949079ff-d021-45dd-93c0-611bfcebfc2b"
|
|
431
|
+
*
|
|
432
|
+
* Its jsUrl is "https://cdn.jsdelivr.net/npm/custom-extension@1.0.10/public/index.js"
|
|
433
|
+
*
|
|
434
|
+
* During development, you need to be able to load your local code instead of the code located at the extension's jsUrl location.
|
|
435
|
+
*
|
|
436
|
+
* Your local development code could for instance be available at: "https://localhost:8083/build/index.js".
|
|
437
|
+
*
|
|
438
|
+
* In order to change the extension jsUrl dynamically, you can set your `JMAP_OPTIONS.extensionsUrlOverride` property like this:
|
|
439
|
+
*
|
|
440
|
+
* For JMAp Server:
|
|
441
|
+
* [{
|
|
442
|
+
* extensionUniqueIdentifier: "my.extention.classPath",
|
|
443
|
+
* jsUrl: "https://localhost:8083/build/index.js"
|
|
444
|
+
* }]
|
|
445
|
+
*
|
|
446
|
+
* For JMap Cloud:
|
|
447
|
+
* [{
|
|
448
|
+
* extensionUniqueIdentifier: "949079ff-d021-45dd-93c0-611bfcebfc2b",
|
|
449
|
+
* jsUrl: "https://localhost:8083/build/index.js"
|
|
450
|
+
* }]
|
|
451
|
+
*
|
|
452
|
+
*
|
|
453
|
+
*/
|
|
454
|
+
extensionsUrlOverride?: JExtensionServerOverride[]
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* By default NG Core provide a main layout in order to display:
|
|
458
|
+
* - a loader incating NG Core is loading
|
|
459
|
+
* - a login panel
|
|
460
|
+
* - a project selection panel
|
|
461
|
+
*
|
|
462
|
+
* But you can avoid this UI by setting this option to true.
|
|
463
|
+
*
|
|
464
|
+
* For example NG don't need NG Core minimal UI and use this option.
|
|
465
|
+
*/
|
|
466
|
+
hideMainLayout?: boolean
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* If true, no basemap will be available/displayed.
|
|
470
|
+
* In JMap Cloud NG, no basemap panel will be displayed in the left panel
|
|
471
|
+
*/
|
|
472
|
+
disableBasemaps?: boolean
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* A basemap id.
|
|
476
|
+
*
|
|
477
|
+
* If provided, will use the corresponding basemap as the default basemap.
|
|
478
|
+
*
|
|
479
|
+
* If the id is unknown, will do nothing. To get all basemaps ids in the project, use [[JMap.Map.Basemap.getAllIds()]]
|
|
480
|
+
*
|
|
481
|
+
* Using the id "none" will use no basemap at startup.
|
|
482
|
+
*
|
|
483
|
+
* ```html
|
|
484
|
+
* <html>
|
|
485
|
+
* ...
|
|
486
|
+
* <body>
|
|
487
|
+
* <script type="text/javascript">
|
|
488
|
+
* window.JMAP_OPTIONS = {
|
|
489
|
+
* ...
|
|
490
|
+
* // disable the default basemap
|
|
491
|
+
* defaultBasemapId: "none"
|
|
492
|
+
* }
|
|
493
|
+
* </script>
|
|
494
|
+
* ...
|
|
495
|
+
* </body>
|
|
496
|
+
* </html>
|
|
497
|
+
* ```
|
|
498
|
+
*/
|
|
499
|
+
defaultBasemapId?: string
|
|
500
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare interface JIFramePopup {
|
|
2
|
+
src: string
|
|
3
|
+
title: string
|
|
4
|
+
initialPosition: JLocation
|
|
5
|
+
initialWidth: string
|
|
6
|
+
initialHeight: string
|
|
7
|
+
resizable: boolean
|
|
8
|
+
hideBorder: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare interface JIFramePopupParams extends Partial<JIFramePopup> {
|
|
12
|
+
src: string
|
|
13
|
+
}
|