Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lgl
SmartVillages2
Commits
9558fd27
Commit
9558fd27
authored
Sep 23, 2025
by
Luna Riegel
Browse files
Add loading from catalog for placement files
parent
5a38e4d7
Changes
2
Show whitespace changes
Inline
Side-by-side
src/index.js
View file @
9558fd27
import
{
ToolboxType
,
WindowSlot
,
NotificationType
}
from
'
@vcmap/ui
'
;
import
{
ToolboxType
,
WindowSlot
,
NotificationType
}
from
'
@vcmap/ui
'
;
import
{
Cesium3DTileStyle
,
Math
as
CMath
,
Ellipsoid
,
Cartesian3
,
ConstantProperty
,
Transforms
,
HeadingPitchRoll
,
Cesium3DTileset
,
Matrix4
}
from
'
@vcmap-cesium/engine
'
;
import
{
Cesium3DTileStyle
,
Math
as
CMath
,
Ellipsoid
,
Cartesian3
,
ConstantProperty
,
Transforms
,
HeadingPitchRoll
,
Cesium3DTileset
,
Matrix4
,
EntityCollection
}
from
'
@vcmap-cesium/engine
'
;
import
{
AbstractInteraction
,
EventType
}
from
'
@vcmap/core
'
;
import
{
AbstractInteraction
,
EventType
}
from
'
@vcmap/core
'
;
import
{
name
,
version
,
mapVersion
}
from
'
../package.json
'
;
import
{
name
,
version
,
mapVersion
}
from
'
../package.json
'
;
import
BIMOptions
,
{
bimOptionsId
}
from
'
./upload.vue
'
;
import
BIMOptions
,
{
bimOptionsId
}
from
'
./upload.vue
'
;
...
@@ -104,7 +115,7 @@ function saveObjects() {
...
@@ -104,7 +115,7 @@ function saveObjects() {
position
:
[
wgs84X
,
wgs84Y
,
height
],
position
:
[
wgs84X
,
wgs84Y
,
height
],
heading
:
heading
,
heading
:
heading
,
scale
:
m
.
model
.
model
.
scale
.
getValue
(),
scale
:
m
.
model
.
model
.
scale
.
getValue
(),
fromCatalog
:
m
.
fromCatalog
,
fromCatalog
:
m
.
model
.
fromCatalog
.
valueOf
()
,
});
});
}
}
outputObject
.
placedObjects
=
outputArray
;
outputObject
.
placedObjects
=
outputArray
;
...
@@ -355,19 +366,22 @@ export default function smartVillagesPlugin(config, baseUrl) {
...
@@ -355,19 +366,22 @@ export default function smartVillagesPlugin(config, baseUrl) {
}
}
}
}
if
(
objectUrl
===
undefined
)
{
if
(
objectUrl
===
undefined
)
{
console
.
log
(
"
From Catalog:
"
+
loadingObject
.
fromCatalog
);
if
(
loadingObject
.
fromCatalog
===
true
){
if
(
loadingObject
.
fromCatalog
===
true
){
// TODO: Fetch from catalog
// TODO: Fetch from catalog
objectUrl
=
loadingObject
.
uri
;
// Load the model into memory
// Load the model into memory
loadCatalogModel
(
objectUrl
).
catch
(
e
=>
{
const
model
=
await
loadCatalogModel
(
loadingObject
.
name
).
catch
(
e
=>
{
console
.
error
(
e
);
console
.
error
(
e
);
app
.
notifier
.
add
({
app
.
notifier
.
add
({
type
:
NotificationType
.
ERROR
,
type
:
NotificationType
.
ERROR
,
message
:
"
Katalogobject:
"
+
loadingObject
.
name
+
"
konnte nicht geladenen werden. Konfiguration konnte nicht vollständig geladen werden.
"
,
message
:
"
Katalogobject:
"
+
loadingObject
.
name
+
"
konnte nicht geladenen werden. Konfiguration konnte nicht vollständig geladen werden.
"
,
});
});
return
undefined
;
});
});
if
(
model
===
undefined
)
{
return
;
return
;
}
else
{
objectUrl
=
model
.
url
;
}
}
else
{
}
else
{
app
.
notifier
.
add
({
app
.
notifier
.
add
({
type
:
NotificationType
.
ERROR
,
type
:
NotificationType
.
ERROR
,
...
@@ -386,8 +400,8 @@ export default function smartVillagesPlugin(config, baseUrl) {
...
@@ -386,8 +400,8 @@ export default function smartVillagesPlugin(config, baseUrl) {
uri
:
objectUrl
,
uri
:
objectUrl
,
scale
:
loadingObject
.
scale
,
scale
:
loadingObject
.
scale
,
show
:
true
,
show
:
true
,
},
fromCatalog
:
loadingObject
.
fromCatalog
,
fromCatalog
:
loadingObject
.
fromCatalog
,
},
});
});
const
roll
=
new
HeadingPitchRoll
();
const
roll
=
new
HeadingPitchRoll
();
hpRollMap
.
set
(
model
,
roll
);
hpRollMap
.
set
(
model
,
roll
);
...
...
src/objectList.vue
View file @
9558fd27
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
<vcs-button
<vcs-button
v-for=
"entry in entries"
v-for=
"entry in entries"
:key=
"entry.title"
:key=
"entry.title"
@
click=
"
fetch
Catalog
ue
Model(entry.model)"
@
click=
"
place
CatalogModel(entry.model)"
class=
"p-0 mx-1 my-0 border gc-2"
class=
"p-0 mx-1 my-0 border gc-2"
style=
"width: auto; height: auto; margin-left: 1rem; margin-bottom: 1px;"
style=
"width: auto; height: auto; margin-left: 1rem; margin-bottom: 1px;"
variant=
"filled"
variant=
"filled"
...
@@ -129,17 +129,17 @@ let setupModelFunction = undefined;
...
@@ -129,17 +129,17 @@ let setupModelFunction = undefined;
let
app
=
undefined
;
let
app
=
undefined
;
let
projectStateObject
=
undefined
;
let
projectStateObject
=
undefined
;
async
function
loadCatalog
ue
sFromConfig
(
config
)
{
async
function
loadCatalogsFromConfig
(
config
)
{
const
configJson
=
JSON
.
parse
(
JSON
.
stringify
(
config
));
const
configJson
=
JSON
.
parse
(
JSON
.
stringify
(
config
));
const
catalogues
=
Object
.
values
(
configJson
.
objectCatalogues
);
const
catalogues
=
Object
.
values
(
configJson
.
objectCatalogues
);
for
(
const
cat
of
catalogues
)
{
for
(
const
cat
of
catalogues
)
{
const
catJson
=
await
retrieveCatalog
ue
Json
(
cat
.
url
);
const
catJson
=
await
retrieveCatalogJson
(
cat
.
url
);
if
(
!
catJson
)
continue
;
if
(
!
catJson
)
continue
;
const
category
=
cat
.
category
.
toString
();
const
category
=
cat
.
category
.
toString
();
const
linkPrefix
=
cat
.
url
.
replace
(
/
\/[^/]
*catalog
\.
json$/
,
'
/
'
);
const
linkPrefix
=
cat
.
url
.
replace
(
/
\/[^/]
*catalog
\.
json$/
,
'
/
'
);
const
entries
=
getCatalog
ue
Entries
(
catJson
,
linkPrefix
);
const
entries
=
getCatalogEntries
(
catJson
,
linkPrefix
);
if
(
!
objLib
.
value
[
category
])
{
if
(
!
objLib
.
value
[
category
])
{
objLib
.
value
[
category
]
=
entries
;
objLib
.
value
[
category
]
=
entries
;
...
@@ -151,7 +151,7 @@ async function loadCataloguesFromConfig(config) {
...
@@ -151,7 +151,7 @@ async function loadCataloguesFromConfig(config) {
}
}
async
function
retrieveCatalog
ue
Json
(
link
)
{
async
function
retrieveCatalogJson
(
link
)
{
const
controller
=
new
AbortController
();
const
controller
=
new
AbortController
();
const
timeout
=
setTimeout
(()
=>
controller
.
abort
(),
5000
);
const
timeout
=
setTimeout
(()
=>
controller
.
abort
(),
5000
);
...
@@ -173,7 +173,7 @@ async function retrieveCatalogueJson(link) {
...
@@ -173,7 +173,7 @@ async function retrieveCatalogueJson(link) {
}
}
}
}
function
getCatalog
ue
Entries
(
json
,
linkPrefix
)
{
function
getCatalogEntries
(
json
,
linkPrefix
)
{
const
part
=
{};
const
part
=
{};
...
@@ -209,7 +209,7 @@ function getCatalogueEntries(json, linkPrefix) {
...
@@ -209,7 +209,7 @@ function getCatalogueEntries(json, linkPrefix) {
return
part
;
return
part
;
}
}
async
function
retriev
eCatalogModel
(
modelLink
){
async
function
plac
eCatalogModel
(
modelLink
){
loadCatalogModel
(
modelLink
).
then
(
model
=>
{
loadCatalogModel
(
modelLink
).
then
(
model
=>
{
const
catModel
=
model
;
const
catModel
=
model
;
const
x
=
window
.
innerWidth
/
2
;
const
x
=
window
.
innerWidth
/
2
;
...
@@ -230,9 +230,9 @@ async function retrieveCatalogModel(modelLink){
...
@@ -230,9 +230,9 @@ async function retrieveCatalogModel(modelLink){
export
async
function
loadCatalogModel
(
modelLink
){
export
async
function
loadCatalogModel
(
modelLink
){
return
new
Promise
(
(
resolve
,
reject
)
=>
{
return
new
Promise
(
(
resolve
,
reject
)
=>
{
if
(
preloadedModels
.
value
[
modelLink
]
!=
null
){
if
(
preloadedModels
.
value
[
modelLink
]
!=
null
){
// Model is already in memory
resolve
(
preloadedModels
.
value
[
modelLink
]);
resolve
(
preloadedModels
.
value
[
modelLink
]);
}
else
{
}
else
{
//Todo: parse model from catalog
const
loader
=
new
GLTFLoader
();
const
loader
=
new
GLTFLoader
();
loader
.
load
(
loader
.
load
(
modelLink
,
modelLink
,
...
@@ -433,8 +433,7 @@ function uploadModel() {
...
@@ -433,8 +433,7 @@ function uploadModel() {
const
dialog
=
ref
(
false
);
const
dialog
=
ref
(
false
);
setupModelFunction
=
setupModel
;
setupModelFunction
=
setupModel
;
projectStateObject
=
pluginState
;
projectStateObject
=
pluginState
;
// loadCataloguesFromConfig(config).then(response => {console.log(objLib);});
onMounted
(()
=>
loadCatalogsFromConfig
(
config
).
then
(
response
=>
{
console
.
log
(
objLib
)}));
onMounted
(()
=>
loadCataloguesFromConfig
(
config
).
then
(
response
=>
{
console
.
log
(
objLib
)}));
return
{
return
{
draggable
,
draggable
,
selectable
,
selectable
,
...
@@ -528,8 +527,8 @@ function uploadModel() {
...
@@ -528,8 +527,8 @@ function uploadModel() {
loadModel
()
{
loadModel
()
{
uploadModel
();
uploadModel
();
},
},
fetch
Catalog
ue
Model
(
modelLink
)
{
place
CatalogModel
(
modelLink
)
{
retriev
eCatalogModel
(
modelLink
);
plac
eCatalogModel
(
modelLink
);
},
},
loadConfiguration
()
{
loadConfiguration
()
{
loadObjects
(
app
);
loadObjects
(
app
);
...
...
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