Include IFC file name
TODO: move UI routines to Stimulus
This commit is contained in:
parent
34d1506483
commit
96bb0388a8
@ -16,7 +16,12 @@ export default class extends Controller {
|
|||||||
|
|
||||||
if (event.currentTarget === this.buildingFormTarget) {
|
if (event.currentTarget === this.buildingFormTarget) {
|
||||||
const options = this.prepare(
|
const options = this.prepare(
|
||||||
JSON.stringify({name: this.buildingTarget.value}),
|
JSON.stringify(
|
||||||
|
{
|
||||||
|
name: this.buildingTarget.value,
|
||||||
|
ifc: localStorage.getItem('loaded-ifc'),
|
||||||
|
}
|
||||||
|
),
|
||||||
'POST'
|
'POST'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
import BIM from './bim.js';
|
import BIM from './bim.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @todo Move to Stimulus?
|
||||||
* @namespace UI
|
* @namespace UI
|
||||||
*/
|
*/
|
||||||
const UI = {};
|
const UI = {};
|
||||||
@ -20,12 +21,15 @@ UI.setScene = function (container) {
|
|||||||
*/
|
*/
|
||||||
UI.ifcLoader = function (container, btnId = 'load-ifc') {
|
UI.ifcLoader = function (container, btnId = 'load-ifc') {
|
||||||
const loadBtn = document.querySelector(`#${btnId}`);
|
const loadBtn = document.querySelector(`#${btnId}`);
|
||||||
|
const nameInput = document.querySelector('[data-form-target="building"]');
|
||||||
let model = null;
|
let model = null;
|
||||||
loadBtn.onchange = async function () {
|
loadBtn.onchange = async function () {
|
||||||
const files = this.files;
|
const files = this.files;
|
||||||
model = await BIM.loadIfc(new Uint8Array(await files[0].arrayBuffer()), files[0].name);
|
model = await BIM.loadIfc(new Uint8Array(await files[0].arrayBuffer()), files[0].name);
|
||||||
// Set a raycaster to select objects
|
// Set a raycaster to select objects
|
||||||
BIM.setupHighligther(model);
|
BIM.setupHighligther(model);
|
||||||
|
localStorage.setItem('loaded-ifc', files[0].name);
|
||||||
|
nameInput.value = files[0].name.replace('.ifc', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
|
@ -54,6 +54,7 @@ final class ProjectController extends AbstractController
|
|||||||
$project = new Project();
|
$project = new Project();
|
||||||
$project->setUser($user);
|
$project->setUser($user);
|
||||||
$project->setBuilding($building);
|
$project->setBuilding($building);
|
||||||
|
$project->setIfc($data->get('ifc'));
|
||||||
$project->setCreatedAt($datetime);
|
$project->setCreatedAt($datetime);
|
||||||
$project->setLastModified($datetime);
|
$project->setLastModified($datetime);
|
||||||
$em->persist($project);
|
$em->persist($project);
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<form class="form" data-form-target="buildingForm" data-action="submit->form#submit" method="post">
|
<form class="form" data-form-target="buildingForm" data-action="submit->form#submit" method="post">
|
||||||
|
<label class="label">Nome edificio</label>
|
||||||
<div class="field has-addons">
|
<div class="field has-addons">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<input class="input" type="text"
|
<input class="input" type="text"
|
||||||
|
Loading…
Reference in New Issue
Block a user