Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
OGC
i3s-server
Commits
9a2f0ed2
Commit
9a2f0ed2
authored
Apr 17, 2021
by
Athanasios
Browse files
Complete service
parent
7681b81e
Changes
11
Hide whitespace changes
Inline
Side-by-side
config.js
View file @
9a2f0ed2
...
...
@@ -4,8 +4,9 @@ module.exports = {
FOLDER_INDEX
:
{
SCENELAYER
:
"
3dSceneLayer.json.gz
"
,
NODE
:
"
3dNodeIndexDocument.json.gz
"
,
SHARED
:
"
sharedResource.json.gz
"
,
FEATURES
:
"
0.json.gz
"
,
GEOMETRIES
:
"
0.bin.gz
"
,
SHARED
:
"
sharedResource.jso
n.gz
"
ATTRIBUTES
:
"
0.bi
n.gz
"
}
};
\ No newline at end of file
routes/nodes.js
View file @
9a2f0ed2
...
...
@@ -3,19 +3,43 @@ const getHandler = require('../src/handler');
let
router
=
express
.
Router
();
router
.
route
(
"
/
"
).
get
((
req
,
res
)
=>
{
router
.
route
(
"
/
:nodeid/?
"
).
get
((
req
,
res
)
=>
{
res
.
sendStatus
(
404
);
res
.
end
();
let
param
=
req
.
params
.
nodeid
;
let
handler
=
getHandler
(
param
);
handler
(
req
,
res
);
});
router
.
route
(
"
/:nodeid/:resource
"
).
get
((
req
,
res
)
=>
{
let
param
=
req
.
params
.
resource
;
let
handler
=
getHandler
(
param
);
handler
(
req
,
res
);
});
router
.
route
(
"
[/]?*/:leaf
"
).
get
((
req
,
res
)
=>
{
router
.
route
(
"
/:nodeid/:resource/0
"
).
get
((
req
,
res
)
=>
{
let
leaf
=
req
.
params
.
leaf
;
let
handler
=
getHandler
(
leaf
);
let
param
=
req
.
params
.
resource
;
let
handler
=
getHandler
(
param
);
handler
(
req
,
res
);
});
router
.
route
(
"
/:nodeid/:resource/:resourceid/0
"
).
get
((
req
,
res
)
=>
{
let
param
=
req
.
params
.
resource
;
let
handler
=
getHandler
(
param
);
handler
(
req
,
res
);
});
router
.
route
(
"
*
"
).
get
((
req
,
res
)
=>
{
res
.
sendStatus
(
404
);
res
.
end
();
});
module
.
exports
=
router
;
\ No newline at end of file
routes/scenelayers.js
View file @
9a2f0ed2
...
...
@@ -22,7 +22,7 @@ router.route("/").get((req, res) => {
});
router
.
route
(
"
/:layer
"
).
get
((
req
,
res
)
=>
{
router
.
route
(
"
/:layer
/layers/0
"
).
get
((
req
,
res
)
=>
{
let
handler
=
getHandler
(
"
layer
"
);
handler
(
req
,
res
);
...
...
src/attributes.js
0 → 100644
View file @
9a2f0ed2
const
config
=
require
(
'
../config
'
);
const
fs
=
require
(
'
fs
'
);
const
handle
=
(
req
,
res
)
=>
{
let
baseUrl
=
req
.
baseUrl
.
replace
(
/^
\/?
|
\/?
$/g
,
""
);
let
resourse
=
`
${
config
.
BASE_DIR
}
/
${
baseUrl
}
/
${
req
.
params
.
nodeid
}
/
${
req
.
params
.
resource
}
/
${
req
.
params
.
resourceid
}
/
${
config
.
FOLDER_INDEX
.
ATTRIBUTES
}
`
;
if
(
!
fs
.
existsSync
(
resourse
))
throw
new
Error
(
"
not found
"
);
res
.
set
({
'
Content-Disposition
'
:
'
attachment; filename=0.bin
'
,
'
Content-Type
'
:
'
application/octet-stream
'
,
'
Content-Encoding
'
:
'
gzip
'
});
res
.
sendFile
(
resourse
);
};
module
.
exports
=
handle
;
\ No newline at end of file
src/default.js
View file @
9a2f0ed2
...
...
@@ -3,13 +3,9 @@ const fs = require('fs');
const
handle
=
(
req
,
res
)
=>
{
let
resourse
=
`
${
config
.
BASE_DIR
}${
req
.
originalUrl
}
/
${
config
.
FOLDER_INDEX
.
NODE
}
`
;
if
(
!
fs
.
existsSync
(
resourse
))
{
res
.
sendStatus
(
404
);
res
.
end
();
return
;
}
let
originalUrl
=
req
.
originalUrl
.
replace
(
/^
\/?
|
\/?
$/g
,
""
);
let
resourse
=
`
${
config
.
BASE_DIR
}
/
${
originalUrl
}
/
${
config
.
FOLDER_INDEX
.
NODE
}
`
;
if
(
!
fs
.
existsSync
(
resourse
))
throw
new
Error
(
"
not found
"
);
res
.
set
({
'
Content-Type
'
:
'
application/json
'
,
...
...
src/features.js
View file @
9a2f0ed2
...
...
@@ -3,13 +3,9 @@ const fs = require('fs');
const
handle
=
(
req
,
res
)
=>
{
let
resourse
=
`
${
config
.
BASE_DIR
}${
req
.
originalUrl
}
/
${
config
.
FOLDER_INDEX
.
FEATURES
}
`
;
if
(
!
fs
.
existsSync
(
resourse
))
{
res
.
sendStatus
(
404
);
res
.
end
();
return
;
}
let
baseUrl
=
req
.
baseUrl
.
replace
(
/^
\/?
|
\/?
$/g
,
""
);
let
resourse
=
`
${
config
.
BASE_DIR
}
/
${
baseUrl
}
/
${
req
.
params
.
nodeid
}
/
${
req
.
params
.
resource
}
/
${
config
.
FOLDER_INDEX
.
FEATURES
}
`
;
if
(
!
fs
.
existsSync
(
resourse
))
throw
new
Error
(
"
not found
"
);
res
.
set
({
'
Content-Type
'
:
'
application/json
'
,
...
...
src/geometries.js
View file @
9a2f0ed2
...
...
@@ -3,13 +3,9 @@ const fs = require('fs');
const
handle
=
(
req
,
res
)
=>
{
let
resourse
=
`
${
config
.
BASE_DIR
}${
req
.
originalUrl
}
/
${
config
.
FOLDER_INDEX
.
GEOMETRIES
}
`
;
if
(
!
fs
.
existsSync
(
resourse
))
{
res
.
sendStatus
(
404
);
res
.
end
();
return
;
}
let
baseUrl
=
req
.
baseUrl
.
replace
(
/^
\/?
|
\/?
$/g
,
""
);
let
resourse
=
`
${
config
.
BASE_DIR
}
/
${
baseUrl
}
/
${
req
.
params
.
nodeid
}
/
${
req
.
params
.
resource
}
/
${
config
.
FOLDER_INDEX
.
GEOMETRIES
}
`
;
if
(
!
fs
.
existsSync
(
resourse
))
throw
new
Error
(
"
not found
"
);
res
.
set
({
'
Content-Disposition
'
:
'
attachment; filename=0.bin
'
,
...
...
src/handler.js
View file @
9a2f0ed2
const
_default_
=
require
(
'
./default
'
);
const
shared
=
require
(
'
./shared
'
);
const
features
=
require
(
'
./features
'
);
const
geometries
=
require
(
'
./geometries
'
);
const
shared
=
require
(
'
./
shared
'
);
const
attributes
=
require
(
'
./
attributes
'
);
const
layer
=
require
(
'
./layer
'
);
const
layers
=
require
(
'
./layers
'
);
const
handlers
=
{
_default_
:
_default_
,
shared
:
shared
,
features
:
features
,
geometries
:
geometries
,
shared
:
shared
,
attributes
:
attributes
,
layer
:
layer
,
layers
:
layers
}
...
...
src/layer.js
View file @
9a2f0ed2
...
...
@@ -3,13 +3,8 @@ const fs = require('fs');
const
handle
=
(
req
,
res
)
=>
{
let
resourse
=
`
${
config
.
BASE_DIR
}
/scenelayers/
${
req
.
params
.
layer
}
/
${
config
.
FOLDER_INDEX
.
SCENELAYER
}
`
;
if
(
!
fs
.
existsSync
(
resourse
))
{
res
.
sendStatus
(
404
);
res
.
end
();
return
;
}
let
resourse
=
`
${
config
.
BASE_DIR
}
/scenelayers/
${
req
.
params
.
layer
}
/layers/0/
${
config
.
FOLDER_INDEX
.
SCENELAYER
}
`
;
if
(
!
fs
.
existsSync
(
resourse
))
throw
new
Error
(
"
not found
"
);
res
.
set
({
'
Content-Type
'
:
'
application/json
'
,
...
...
src/shared.js
View file @
9a2f0ed2
...
...
@@ -3,13 +3,9 @@ const fs = require('fs');
const
handle
=
(
req
,
res
)
=>
{
let
resourse
=
`
${
config
.
BASE_DIR
}${
req
.
originalUrl
}
/
${
config
.
FOLDER_INDEX
.
SHARED
}
`
;
if
(
!
fs
.
existsSync
(
resourse
))
{
res
.
sendStatus
(
404
);
res
.
end
();
return
;
}
let
baseUrl
=
req
.
baseUrl
.
replace
(
/^
\/?
|
\/?
$/g
,
""
);
let
resourse
=
`
${
config
.
BASE_DIR
}
/
${
baseUrl
}
/
${
req
.
params
.
nodeid
}
/
${
req
.
params
.
resource
}
/
${
config
.
FOLDER_INDEX
.
SHARED
}
`
;
if
(
!
fs
.
existsSync
(
resourse
))
throw
new
Error
(
"
not found
"
);
res
.
set
({
'
Content-Type
'
:
'
application/json
'
,
...
...
views/sceneLayers.pug
View file @
9a2f0ed2
...
...
@@ -7,4 +7,4 @@ style.
ul
each layer in layers
li
a(href=`${layer}`)= layer
\ No newline at end of file
a(href=`${layer}/layers/0`)= layer
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment