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
7fb28ca0
Commit
7fb28ca0
authored
Sep 23, 2025
by
Luna Riegel
Browse files
Code Cleaning
parent
eb5683df
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/index.js
View file @
7fb28ca0
import
{
ToolboxType
,
WindowSlot
,
NotificationType
}
from
'
@vcmap/ui
'
;
import
{
NotificationType
,
ToolboxType
,
WindowSlot
}
from
'
@vcmap/ui
'
;
import
*
as
Cesium
from
'
@vcmap-cesium/engine
'
;
import
{
import
{
Cesium3DTileStyle
,
Math
as
CMath
,
Ellipsoid
,
Cartesian3
,
Cartesian3
,
Cesium3DTileset
,
Cesium3DTileStyle
,
ConstantProperty
,
ConstantProperty
,
Transforms
,
Ellipsoid
,
HeadingPitchRoll
,
HeadingPitchRoll
,
Cesium3DTileset
,
Math
as
CMath
,
Matrix4
,
Transforms
EntityCollection
}
from
'
@vcmap-cesium/engine
'
;
}
from
'
@vcmap-cesium/engine
'
;
import
{
AbstractInteraction
,
EventType
}
from
'
@vcmap/core
'
;
import
{
AbstractInteraction
,
EventType
}
from
'
@vcmap/core
'
;
import
{
name
,
version
,
mapVersion
}
from
'
../package.json
'
;
import
{
mapVersion
,
name
,
version
}
from
'
../package.json
'
;
import
BIMOptions
,
{
bimOptionsId
}
from
'
./upload.vue
'
;
import
BIMOptions
,
{
bimOptionsId
}
from
'
./upload.vue
'
;
import
objectList
,
{
objectListId
}
from
'
./objectList.vue
'
;
import
objectList
,
{
loadCatalogModel
,
objectListId
}
from
'
./objectList.vue
'
;
import
scaleControl
,
{
scaleControlId
}
from
'
./scaleControl.vue
'
;
import
scaleControl
,
{
scaleControlId
}
from
'
./scaleControl.vue
'
;
import
*
as
Cesium
from
"
@vcmap-cesium/engine
"
;
import
{
loadCatalogModel
}
from
"
./objectList.vue
"
;
let
model
;
let
model
;
let
conditions
=
[[
true
,
true
]];
let
conditions
=
[[
true
,
true
]];
...
@@ -195,7 +193,6 @@ class MoveInteraction extends AbstractInteraction {
...
@@ -195,7 +193,6 @@ class MoveInteraction extends AbstractInteraction {
let
xDif
=
pickResult
.
x
-
initialPickResult
.
x
;
let
xDif
=
pickResult
.
x
-
initialPickResult
.
x
;
let
yDif
=
pickResult
.
y
-
initialPickResult
.
y
;
let
yDif
=
pickResult
.
y
-
initialPickResult
.
y
;
let
zDif
=
pickResult
.
z
-
initialPickResult
.
z
;
let
zDif
=
pickResult
.
z
-
initialPickResult
.
z
;
// pickResult.z = pickResult.z + heightDif;
let
pos
=
initialPosition
.
clone
();
let
pos
=
initialPosition
.
clone
();
pos
.
x
=
pos
.
x
+
xDif
;
pos
.
x
=
pos
.
x
+
xDif
;
pos
.
y
=
pos
.
y
+
yDif
;
pos
.
y
=
pos
.
y
+
yDif
;
...
@@ -304,8 +301,7 @@ class RotateAction extends AbstractInteraction {
...
@@ -304,8 +301,7 @@ class RotateAction extends AbstractInteraction {
if
(
hpRoll
.
heading
<
0.0
)
{
if
(
hpRoll
.
heading
<
0.0
)
{
hpRoll
.
heading
+=
CMath
.
TWO_PI
;
hpRoll
.
heading
+=
CMath
.
TWO_PI
;
}
}
const
orientation
=
new
ConstantProperty
(
Transforms
.
headingPitchRollQuaternion
(
modelPos
,
hpRoll
));
model
.
orientation
=
new
ConstantProperty
(
Transforms
.
headingPitchRollQuaternion
(
modelPos
,
hpRoll
));
model
.
orientation
=
orientation
;
}
}
return
event
;
return
event
;
}
}
...
@@ -358,7 +354,7 @@ export default function smartVillagesPlugin(config, baseUrl) {
...
@@ -358,7 +354,7 @@ export default function smartVillagesPlugin(config, baseUrl) {
const
objects
=
JSON
.
parse
(
content
);
const
objects
=
JSON
.
parse
(
content
);
const
vcMap
=
app
.
maps
.
activeMap
;
const
vcMap
=
app
.
maps
.
activeMap
;
for
(
const
loadingObject
of
objects
.
placedObjects
)
{
for
(
const
loadingObject
of
objects
.
placedObjects
)
{
let
objectUrl
=
undefined
;
let
objectUrl
;
for
(
const
loadedObject
of
pluginState
.
objects
)
{
for
(
const
loadedObject
of
pluginState
.
objects
)
{
if
(
loadedObject
.
name
===
loadingObject
.
name
)
{
if
(
loadedObject
.
name
===
loadingObject
.
name
)
{
objectUrl
=
loadedObject
.
url
;
objectUrl
=
loadedObject
.
url
;
...
@@ -367,7 +363,6 @@ export default function smartVillagesPlugin(config, baseUrl) {
...
@@ -367,7 +363,6 @@ export default function smartVillagesPlugin(config, baseUrl) {
}
}
if
(
objectUrl
===
undefined
)
{
if
(
objectUrl
===
undefined
)
{
if
(
loadingObject
.
fromCatalog
===
true
){
if
(
loadingObject
.
fromCatalog
===
true
){
// TODO: Fetch from catalog
// Load the model into memory
// Load the model into memory
const
model
=
await
loadCatalogModel
(
loadingObject
.
name
).
catch
(
e
=>
{
const
model
=
await
loadCatalogModel
(
loadingObject
.
name
).
catch
(
e
=>
{
console
.
error
(
e
);
console
.
error
(
e
);
...
@@ -406,8 +401,7 @@ export default function smartVillagesPlugin(config, baseUrl) {
...
@@ -406,8 +401,7 @@ export default function smartVillagesPlugin(config, baseUrl) {
const
roll
=
new
HeadingPitchRoll
();
const
roll
=
new
HeadingPitchRoll
();
hpRollMap
.
set
(
model
,
roll
);
hpRollMap
.
set
(
model
,
roll
);
roll
.
heading
=
loadingObject
.
heading
;
roll
.
heading
=
loadingObject
.
heading
;
const
orientation
=
new
ConstantProperty
(
Transforms
.
headingPitchRollQuaternion
(
model
.
position
.
getValue
(),
roll
));
model
.
orientation
=
new
ConstantProperty
(
Transforms
.
headingPitchRollQuaternion
(
model
.
position
.
getValue
(),
roll
));
model
.
orientation
=
orientation
;
placedModels
.
push
({
placedModels
.
push
({
model
:
model
,
model
:
model
,
...
@@ -561,10 +555,6 @@ export default function smartVillagesPlugin(config, baseUrl) {
...
@@ -561,10 +555,6 @@ export default function smartVillagesPlugin(config, baseUrl) {
}
}
const
map
=
vcsApp
.
maps
.
getByType
(
"
CesiumVisualisationType
"
);
const
map
=
vcsApp
.
maps
.
getByType
(
"
CesiumVisualisationType
"
);
// tileset.allTilesLoaded.addEventListener(function() {
// console.log('All tiles are loaded');
// });
const
bimGroup
=
{
const
bimGroup
=
{
id
:
'
bim-functions
'
,
id
:
'
bim-functions
'
,
...
...
src/objectList.vue
View file @
7fb28ca0
...
@@ -125,9 +125,9 @@ const preloadedModels = ref({});
...
@@ -125,9 +125,9 @@ const preloadedModels = ref({});
const
defaultItems
=
[];
const
defaultItems
=
[];
const
items
=
ref
(
defaultItems
);
const
items
=
ref
(
defaultItems
);
let
setupModelFunction
=
undefined
;
let
setupModelFunction
;
let
app
=
undefined
;
let
app
;
let
projectStateObject
=
undefined
;
let
projectStateObject
;
async
function
loadCatalogsFromConfig
(
config
)
{
async
function
loadCatalogsFromConfig
(
config
)
{
const
configJson
=
JSON
.
parse
(
JSON
.
stringify
(
config
));
const
configJson
=
JSON
.
parse
(
JSON
.
stringify
(
config
));
...
@@ -158,14 +158,15 @@ async function retrieveCatalogJson(link) {
...
@@ -158,14 +158,15 @@ async function retrieveCatalogJson(link) {
try
{
try
{
const
response
=
await
fetch
(
link
,
{
signal
:
controller
.
signal
});
const
response
=
await
fetch
(
link
,
{
signal
:
controller
.
signal
});
if
(
!
response
.
ok
)
{
if
(
!
response
.
ok
)
{
throw
new
Error
(
`HTTP error
${
response
.
status
}
for
${
link
}
`
);
console
.
error
(
`Received HTTP error
${
response
.
status
}
for
${
link
}
`
);
return
null
;
}
}
return
await
response
.
json
();
return
await
response
.
json
();
}
catch
(
error
)
{
}
catch
(
error
)
{
if
(
error
.
name
===
'
AbortError
'
)
{
if
(
error
.
name
===
'
AbortError
'
)
{
console
.
warn
(
`Fetch aborted (
timeout
) for
:
${
link
}
`
);
console
.
error
(
`Catalog.json request
time
d
out:
${
link
}
`
);
}
else
{
}
else
{
console
.
error
(
`
Fetch failed for
${
link
}
:
`
,
error
);
console
.
error
(
`
Encountered error during catalog.json request:
${
link
}
`
,
error
);
}
}
return
null
;
return
null
;
}
finally
{
}
finally
{
...
@@ -305,8 +306,6 @@ function uploadModel() {
...
@@ -305,8 +306,6 @@ function uploadModel() {
});
});
let
url
=
URL
.
createObjectURL
(
blob
);
let
url
=
URL
.
createObjectURL
(
blob
);
const
loader
=
new
GLTFLoader
();
const
loader
=
new
GLTFLoader
();
loader
.
load
(
url
,
function
(
gltf
)
{
loader
.
load
(
url
,
function
(
gltf
)
{
let
bounds
=
new
THREE
.
Box3
().
setFromObject
(
gltf
.
scene
);
let
bounds
=
new
THREE
.
Box3
().
setFromObject
(
gltf
.
scene
);
...
@@ -348,10 +347,11 @@ function uploadModel() {
...
@@ -348,10 +347,11 @@ function uploadModel() {
},
},
// called when there is an error in the generation
// called when there is an error in the generation
function
(
error
)
{
function
(
error
)
{
app
.
notifier
.
add
({
app
.
notifier
.
add
({
type
:
NotificationType
.
ERROR
,
type
:
NotificationType
.
ERROR
,
message
:
"
Ein Fehler ist beim Laden der glTF Datei aufgetreten. Bitte vergewissern Sie sich, dass es sich um eine gültige glTF2.0 Datei handelt.
"
,
message
:
"
Ein Fehler ist beim Laden der glTF Datei aufgetreten. Bitte vergewissern Sie sich, dass es sich um eine gültige glTF2.0 Datei handelt.
"
+
"
Fehlermeldung:
"
+
error
.
message
,
timeout
:
20000
,
timeout
:
20000
,
});
});
},
options
);
},
options
);
...
@@ -364,8 +364,6 @@ function uploadModel() {
...
@@ -364,8 +364,6 @@ function uploadModel() {
});
});
});
});
}
}
reader
.
readAsArrayBuffer
(
file
);
reader
.
readAsArrayBuffer
(
file
);
}
}
});
});
...
@@ -433,7 +431,7 @@ function uploadModel() {
...
@@ -433,7 +431,7 @@ function uploadModel() {
const
dialog
=
ref
(
false
);
const
dialog
=
ref
(
false
);
setupModelFunction
=
setupModel
;
setupModelFunction
=
setupModel
;
projectStateObject
=
pluginState
;
projectStateObject
=
pluginState
;
onMounted
(()
=>
loadCatalogsFromConfig
(
config
).
then
(
response
=>
{
console
.
log
(
"
Object library loaded
"
)}));
onMounted
(()
=>
loadCatalogsFromConfig
(
config
).
then
(
()
=>
{
console
.
log
(
"
Object library loaded
"
)}));
return
{
return
{
draggable
,
draggable
,
selectable
,
selectable
,
...
...
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