onClick("edit-photosphereBuilding"),
+ color: "var(--color-primary)"
+ });
+ }
+
menuItems.push({
key: 2,
text: props.model.archived ? "t.unarchive" : "t.archive",
diff --git a/src/components/specific/models/models-table/model-name-cell/ModelNameCell.vue b/src/components/specific/models/models-table/model-name-cell/ModelNameCell.vue
index be9dd3ebc..fc57a4e4d 100644
--- a/src/components/specific/models/models-table/model-name-cell/ModelNameCell.vue
+++ b/src/components/specific/models/models-table/model-name-cell/ModelNameCell.vue
@@ -39,7 +39,9 @@
-
+
diff --git a/src/config/models.js b/src/config/models.js
index bf27870ff..a91a6149c 100644
--- a/src/config/models.js
+++ b/src/config/models.js
@@ -16,6 +16,8 @@ const MODEL_TYPE = Object.freeze({
META_BUILDING: "METABUILDING",
OBJ: "OBJ",
PDF: "PDF",
+ PHOTOSPHERE: "PHOTOSPHERE",
+ PHOTOSPHERE_BUILDING: "PHOTOSPHERE_BUILDING",
PNG: "PNG",
POINT_CLOUD: "POINT_CLOUD",
});
@@ -116,6 +118,16 @@ const MODEL_CONFIG = Object.freeze({
window: WINDOWS.PLAN,
icon: "filePdfPolychrome",
},
+ [MODEL_TYPE.PHOTOSPHERE]: {
+ ext: [MODEL_EXTENSIONS.JPEG, MODEL_EXTENSIONS.JPG],
+ window: WINDOWS.PHOTOSPHERE,
+ icon: "filePhotospherePolychrome",
+ },
+ [MODEL_TYPE.PHOTOSPHERE_BUILDING]: {
+ ext: [],
+ window: WINDOWS.PHOTOSPHERE,
+ icon: "fileImagePolychrome",
+ },
[MODEL_TYPE.PNG]: {
ext: [MODEL_EXTENSIONS.PNG],
window: WINDOWS.PLAN,
diff --git a/src/config/viewer.js b/src/config/viewer.js
index ebd4941d6..dadf9c020 100644
--- a/src/config/viewer.js
+++ b/src/config/viewer.js
@@ -14,6 +14,7 @@ const WINDOWS = Object.freeze({
DXF: "dxf",
IFC2D: "2d",
IFC3D: "3d",
+ PHOTOSPHERE: "photosphere",
PLAN: "plan",
POINT_CLOUD: "pointCloud"
});
diff --git a/src/i18n/lang/en.json b/src/i18n/lang/en.json
index 6e8a5ab28..0e13058e3 100644
--- a/src/i18n/lang/en.json
+++ b/src/i18n/lang/en.json
@@ -57,6 +57,7 @@
"addVersionButtonText": "Add version",
"manageAccessButtonText": "Manage access",
"createModelButtonText": "Define as model",
+ "createPhotosphereButtonText": "Define as photosphere",
"removeModelButtonText": "Remove from models",
"versioningButtonText": "Add a version",
"visaButtonText": "Validation request",
@@ -180,6 +181,7 @@
"archive": "Archives",
"dwg": "DWG",
"metaBuildings": "Meta Buildings",
+ "photosphereBuildings": "Photosphere Buildings",
"upload": "Upload"
}
},
diff --git a/src/i18n/lang/fr.json b/src/i18n/lang/fr.json
index 3dc2f9621..930b0417d 100644
--- a/src/i18n/lang/fr.json
+++ b/src/i18n/lang/fr.json
@@ -117,6 +117,7 @@
"addTagsButtonText": "Ajouter des tags",
"addVersionButtonText": "Ajouter une version",
"createModelButtonText": "Définir comme modèle",
+ "createPhotosphereButtonText": "Définir comme photosphère",
"manageAccessButtonText": "Gérer les accès",
"openViewerButtonText": "Ouvrir",
"previewModelButtonText": "Prévisualiser",
@@ -135,6 +136,7 @@
"FilesManager": {
"title": "Documents du projet",
"createModelNotification": "Modèle créé avec succès",
+ "createPhotosphereNotification": "Photosphère créée avec succès",
"structureImport": "Importer une structure GED",
"gedDownload": "Télécharger la GED",
"folderImport": "Importer un dossier",
@@ -273,6 +275,7 @@
"archive": "Archives",
"dwg": "DWG",
"metaBuildings": "Meta Buildings",
+ "photosphereBuildings": "Photosphere Buildings",
"upload": "Upload"
}
},
diff --git a/src/services/ModelService.js b/src/services/ModelService.js
index dd3bb0453..ba13d90d4 100644
--- a/src/services/ModelService.js
+++ b/src/services/ModelService.js
@@ -1,7 +1,7 @@
import queue from "async/queue";
import apiClient from "./api-client.js";
+import { MODEL_TYPE } from "../config/models.js";
import { ERRORS, RuntimeError, ErrorService } from "./ErrorService.js";
-import { isPlan } from "../utils/models.js";
class ModelService {
callQueue = queue(async task => {
@@ -46,6 +46,20 @@ class ModelService {
}
}
+ async createPhotosphere(project, file) {
+ try {
+ return await apiClient.modelApi.createPhotosphere(
+ project.cloud.id,
+ project.id,
+ {
+ document_id: file.id
+ }
+ );
+ } catch (error) {
+ throw new RuntimeError(ERRORS.MODEL_CREATE_ERROR, error);
+ }
+ }
+
async updateModels(project, models) {
try {
return await Promise.all(
@@ -67,7 +81,8 @@ class ModelService {
try {
return await Promise.all(
models.map(model => {
- if (isPlan(model) && !hard) {
+ const { JPEG, PDF, PHOTOSPHERE, PNG } = MODEL_TYPE;
+ if ([JPEG, PDF, PHOTOSPHERE, PNG].includes(model.type) && !hard) {
return apiClient.modelApi.deleteModelWithoutDoc(
project.cloud.id,
model.id,
diff --git a/src/state/models.js b/src/state/models.js
index 0d1be0f75..1eacfdbf2 100644
--- a/src/state/models.js
+++ b/src/state/models.js
@@ -31,6 +31,8 @@ const createModel = async (project, file) => {
return newModel;
};
+const createPhotosphere = (project, file) => ModelService.createPhotosphere(project, file);
+
const updateModels = async (project, models) => {
const newModels = await ModelService.updateModels(project, models);
await loadProjectModels(project);
@@ -171,6 +173,7 @@ export function useModels() {
loadProjectModels,
fetchModelByID,
createModel,
+ createPhotosphere,
updateModels,
updateModelName,
mergeModels,
diff --git a/src/utils/models.js b/src/utils/models.js
index 106a588cf..7970ac8a0 100644
--- a/src/utils/models.js
+++ b/src/utils/models.js
@@ -54,11 +54,6 @@ function isModel(document) {
return !!document.model_id;
}
-function isPlan(model) {
- const { JPEG, PDF, PNG } = MODEL_TYPE;
- return [JPEG, PDF, PNG].includes(model.type);
-}
-
function isIFC(document) {
return isModel(document) && document.model_type === MODEL_TYPE.IFC;
}
@@ -78,6 +73,13 @@ function isConvertible(document) {
);
}
+function isConvertibleToPhotosphere(document) {
+ const { JPEG, JPG } = MODEL_EXTENSIONS;
+ return [JPEG, JPG].includes(
+ fileExtension(document.file_name).toLowerCase()
+ );
+}
+
function openInViewer(router, project, model, window) {
const models = [].concat(model);
router.push({
@@ -95,10 +97,10 @@ function openInViewer(router, project, model, window) {
export {
isConvertible,
+ isConvertibleToPhotosphere,
isIFC,
isModel,
isPDF,
- isPlan,
isViewable,
openInViewer,
segregateBySource,