@geode/opengeodeweb-front 10.40.1-rc.1 → 10.41.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.build/shared/utils/file.js +1 -1
- package/.build/shared/utils/response_handlers/load.js +19 -1
- package/app/components/MissingFilesSelector.vue +84 -11
- package/app/components/ObjectSelector.vue +147 -13
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +0 -1
- package/app/components/Viewer/Generic/Model/ComponentPointsOptions.vue +245 -0
- package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +141 -0
- package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +7 -67
- package/app/components/Viewer/Generic/Model/PointsOptions.vue +2 -40
- package/app/components/csv-preview/CsvSettings.vue +1 -1
- package/app/composables/model_menu_context.ts +101 -0
- package/app/utils/import_workflow.ts +13 -2
- package/internal/stores/data_style/model/blocks/index.ts +4 -0
- package/internal/stores/data_style/model/blocks/points.ts +51 -0
- package/internal/stores/data_style/model/index.ts +6 -0
- package/internal/stores/data_style/model/lines/index.ts +4 -0
- package/internal/stores/data_style/model/lines/points.ts +51 -0
- package/internal/stores/data_style/model/points/component.ts +423 -0
- package/internal/stores/data_style/model/points/size.ts +13 -1
- package/internal/stores/data_style/model/points/visibility.ts +13 -3
- package/internal/stores/data_style/model/surfaces/index.ts +4 -0
- package/internal/stores/data_style/model/surfaces/points.ts +51 -0
- package/internal/utils/upload_file.ts +1 -1
- package/package.json +1 -1
- package/shared/utils/file.ts +1 -1
- package/shared/utils/response_handlers/load.ts +37 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
type ModelMenuItemProps,
|
|
4
|
+
useModelMenuContext,
|
|
5
|
+
} from "@ogw_front/composables/model_menu_context";
|
|
6
|
+
import OptionsSection from "@ogw_front/components/Viewer/Options/OptionsSection.vue";
|
|
7
|
+
import ViewerGenericModelComponentPointsOptions from "@ogw_front/components/Viewer/Generic/Model/ComponentPointsOptions.vue";
|
|
8
|
+
import VisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
|
|
9
|
+
import { useBatchStyle } from "@ogw_front/composables/batch_style";
|
|
10
|
+
import { useDataStore } from "@ogw_front/stores/data";
|
|
11
|
+
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
12
|
+
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
13
|
+
|
|
14
|
+
// Corners have no points options: their points are the corners themselves
|
|
15
|
+
const POINTS_TYPE_TITLES = {
|
|
16
|
+
Surface: "Surfaces Points Options",
|
|
17
|
+
Line: "Lines Points Options",
|
|
18
|
+
Block: "Blocks Points Options",
|
|
19
|
+
} as const;
|
|
20
|
+
type PointsComponentType = keyof typeof POINTS_TYPE_TITLES;
|
|
21
|
+
const POINTS_COMPONENT_TYPES: PointsComponentType[] = ["Surface", "Line", "Block"];
|
|
22
|
+
|
|
23
|
+
function isPointsComponentType(type: string | undefined): type is PointsComponentType {
|
|
24
|
+
return type !== undefined && type in POINTS_TYPE_TITLES;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface Props {
|
|
28
|
+
itemProps: ModelMenuItemProps;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { itemProps } = defineProps<Props>();
|
|
32
|
+
|
|
33
|
+
const dataStore = useDataStore();
|
|
34
|
+
const dataStyleStore = useDataStyleStore();
|
|
35
|
+
const hybridViewerStore = useHybridViewerStore();
|
|
36
|
+
const { applyBatchStyle } = useBatchStyle();
|
|
37
|
+
|
|
38
|
+
const { modelId, componentId, componentType, collections, targetComponentIds } =
|
|
39
|
+
useModelMenuContext(() => itemProps);
|
|
40
|
+
|
|
41
|
+
const modelPointsVisibility = computed<boolean>({
|
|
42
|
+
get: () => dataStyleStore.modelPointsVisibility(modelId.value),
|
|
43
|
+
set: async (newValue) => {
|
|
44
|
+
await applyBatchStyle(modelId.value, (targetId: string) =>
|
|
45
|
+
dataStyleStore.setModelPointsVisibility(targetId, newValue),
|
|
46
|
+
);
|
|
47
|
+
hybridViewerStore.remoteRender();
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const pointsComponentType = computed<PointsComponentType | undefined>(() =>
|
|
52
|
+
isPointsComponentType(componentType.value) ? componentType.value : undefined,
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const allComponentsTargets = ref<{ componentType: PointsComponentType; componentIds: string[] }[]>(
|
|
56
|
+
[],
|
|
57
|
+
);
|
|
58
|
+
watch(
|
|
59
|
+
modelId,
|
|
60
|
+
async (currentModelId) => {
|
|
61
|
+
const targets = await Promise.all(
|
|
62
|
+
POINTS_COMPONENT_TYPES.map(async (type) => ({
|
|
63
|
+
componentType: type,
|
|
64
|
+
componentIds: await dataStore.getMeshComponentGeodeIds(currentModelId, type),
|
|
65
|
+
})),
|
|
66
|
+
);
|
|
67
|
+
if (modelId.value === currentModelId) {
|
|
68
|
+
allComponentsTargets.value = targets.filter((target) => target.componentIds.length > 0);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{ immediate: true },
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const typeTargets = computed(() =>
|
|
75
|
+
pointsComponentType.value === undefined
|
|
76
|
+
? []
|
|
77
|
+
: [{ componentType: pointsComponentType.value, componentIds: targetComponentIds.value }],
|
|
78
|
+
);
|
|
79
|
+
const typeReferenceId = computed<string | undefined>(() =>
|
|
80
|
+
collections.value ? targetComponentIds.value[0] : undefined,
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const componentTargets = computed(() =>
|
|
84
|
+
pointsComponentType.value === undefined || componentId.value === undefined
|
|
85
|
+
? []
|
|
86
|
+
: [{ componentType: pointsComponentType.value, componentIds: [componentId.value] }],
|
|
87
|
+
);
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<template>
|
|
91
|
+
<v-sheet class="model-points-card" color="transparent">
|
|
92
|
+
<OptionsSection title="Model Points Options">
|
|
93
|
+
<VisibilitySwitch data-testid="modelPointsVisibilitySwitch" v-model="modelPointsVisibility" />
|
|
94
|
+
</OptionsSection>
|
|
95
|
+
|
|
96
|
+
<OptionsSection
|
|
97
|
+
v-if="!componentType && !componentId && allComponentsTargets.length > 0"
|
|
98
|
+
title="Components Points Options"
|
|
99
|
+
data-testid="modelPointsComponentsOptions"
|
|
100
|
+
class="mt-4"
|
|
101
|
+
>
|
|
102
|
+
<ViewerGenericModelComponentPointsOptions
|
|
103
|
+
:modelId="modelId"
|
|
104
|
+
:targets="allComponentsTargets"
|
|
105
|
+
/>
|
|
106
|
+
</OptionsSection>
|
|
107
|
+
|
|
108
|
+
<OptionsSection
|
|
109
|
+
v-if="pointsComponentType"
|
|
110
|
+
:title="POINTS_TYPE_TITLES[pointsComponentType]"
|
|
111
|
+
data-testid="modelPointsComponentTypeOptions"
|
|
112
|
+
class="mt-4"
|
|
113
|
+
>
|
|
114
|
+
<ViewerGenericModelComponentPointsOptions
|
|
115
|
+
:modelId="modelId"
|
|
116
|
+
:targets="typeTargets"
|
|
117
|
+
:referenceComponentId="typeReferenceId"
|
|
118
|
+
/>
|
|
119
|
+
</OptionsSection>
|
|
120
|
+
|
|
121
|
+
<OptionsSection
|
|
122
|
+
v-if="pointsComponentType && componentId"
|
|
123
|
+
title="Component Points Options"
|
|
124
|
+
data-testid="modelPointsComponentOptions"
|
|
125
|
+
class="mt-4"
|
|
126
|
+
>
|
|
127
|
+
<ViewerGenericModelComponentPointsOptions
|
|
128
|
+
:modelId="modelId"
|
|
129
|
+
:targets="componentTargets"
|
|
130
|
+
:referenceComponentId="componentId"
|
|
131
|
+
/>
|
|
132
|
+
</OptionsSection>
|
|
133
|
+
</v-sheet>
|
|
134
|
+
</template>
|
|
135
|
+
|
|
136
|
+
<style scoped>
|
|
137
|
+
.model-points-card {
|
|
138
|
+
padding-top: 12px;
|
|
139
|
+
overflow-x: hidden;
|
|
140
|
+
}
|
|
141
|
+
</style>
|
|
@@ -1,95 +1,35 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
type ModelMenuItemProps,
|
|
4
|
+
useModelMenuContext,
|
|
5
|
+
} from "@ogw_front/composables/model_menu_context";
|
|
2
6
|
import BlocksOptions from "./BlocksOptions.vue";
|
|
3
|
-
import type { CollectionComponent } from "@ogw_front/stores/data_helpers/collections";
|
|
4
7
|
import CornersOptions from "./CornersOptions.vue";
|
|
5
8
|
import LinesOptions from "./LinesOptions.vue";
|
|
6
|
-
import { MESH_COMPONENT_TYPES } from "@ogw_front/utils/default_styles";
|
|
7
9
|
import OptionsSection from "@ogw_front/components/Viewer/Options/OptionsSection.vue";
|
|
8
10
|
import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
9
11
|
import SurfacesOptions from "./SurfacesOptions.vue";
|
|
10
12
|
import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
|
|
11
13
|
import VisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
|
|
12
14
|
import { useBatchStyle } from "@ogw_front/composables/batch_style";
|
|
13
|
-
import { useDataStore } from "@ogw_front/stores/data";
|
|
14
15
|
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
15
16
|
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
16
17
|
|
|
17
18
|
const dataStyleStore = useDataStyleStore();
|
|
18
19
|
const hybridViewerStore = useHybridViewerStore();
|
|
19
|
-
const dataStore = useDataStore();
|
|
20
20
|
const { applyBatchStyle } = useBatchStyle();
|
|
21
21
|
|
|
22
22
|
interface Props {
|
|
23
|
-
itemProps:
|
|
23
|
+
itemProps: ModelMenuItemProps;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
const { itemProps } = defineProps<Props>();
|
|
27
27
|
|
|
28
|
-
const modelId
|
|
29
|
-
|
|
28
|
+
const { modelId, componentId, componentType, collections, targetComponentIds } =
|
|
29
|
+
useModelMenuContext(() => itemProps);
|
|
30
30
|
function visibleComponents(targetId: string): string[] {
|
|
31
31
|
return dataStyleStore.visibleMeshComponents(targetId).value || [];
|
|
32
32
|
}
|
|
33
|
-
const componentType = ref<string | undefined>(undefined);
|
|
34
|
-
const collections = ref<CollectionComponent[] | undefined>(undefined);
|
|
35
|
-
|
|
36
|
-
watch(
|
|
37
|
-
() => [
|
|
38
|
-
modelId.value,
|
|
39
|
-
componentId.value,
|
|
40
|
-
itemProps.meta_data.viewer_type,
|
|
41
|
-
itemProps.meta_data.modelComponentType,
|
|
42
|
-
],
|
|
43
|
-
async () => {
|
|
44
|
-
componentType.value = undefined;
|
|
45
|
-
collections.value = undefined;
|
|
46
|
-
if (itemProps.meta_data.viewer_type === "model_component_type") {
|
|
47
|
-
const { modelComponentType, targetComponentIds: ids } = itemProps.meta_data;
|
|
48
|
-
if (MESH_COMPONENT_TYPES.includes(modelComponentType)) {
|
|
49
|
-
componentType.value = modelComponentType;
|
|
50
|
-
} else {
|
|
51
|
-
const collectionsByType = await dataStore.fetchAllCollectionComponents(modelId.value);
|
|
52
|
-
collections.value = collectionsByType[modelComponentType].filter((collection) =>
|
|
53
|
-
collection.children.every((child) => ids.includes(child.id)),
|
|
54
|
-
);
|
|
55
|
-
componentType.value = collections.value[0].children[0].category;
|
|
56
|
-
}
|
|
57
|
-
} else if (componentId.value && modelId.value) {
|
|
58
|
-
const currentModelId = modelId.value;
|
|
59
|
-
const currentCompId = componentId.value;
|
|
60
|
-
const type = await dataStore.meshComponentType(currentModelId, currentCompId);
|
|
61
|
-
if (
|
|
62
|
-
modelId.value === currentModelId &&
|
|
63
|
-
componentId.value === currentCompId &&
|
|
64
|
-
itemProps.meta_data.viewer_type !== "model_component_type"
|
|
65
|
-
) {
|
|
66
|
-
componentType.value = type;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
{ immediate: true },
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
const targetComponentIds = ref<string[]>([]);
|
|
74
|
-
watch(
|
|
75
|
-
() => [modelId.value, componentType.value, itemProps.meta_data.targetComponentIds],
|
|
76
|
-
async () => {
|
|
77
|
-
targetComponentIds.value = [];
|
|
78
|
-
if (itemProps.meta_data.targetComponentIds) {
|
|
79
|
-
targetComponentIds.value = itemProps.meta_data.targetComponentIds;
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
if (componentType.value && modelId.value) {
|
|
83
|
-
const currentModelId = modelId.value;
|
|
84
|
-
const currentType = componentType.value;
|
|
85
|
-
const ids = await dataStore.getMeshComponentGeodeIds(currentModelId, currentType);
|
|
86
|
-
if (modelId.value === currentModelId && componentType.value === currentType) {
|
|
87
|
-
targetComponentIds.value = ids;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
{ immediate: true },
|
|
92
|
-
);
|
|
93
33
|
|
|
94
34
|
const modelVisibility = computed<boolean | undefined>({
|
|
95
35
|
get: () => dataStyleStore.modelVisibility(modelId.value),
|
|
@@ -2,45 +2,14 @@
|
|
|
2
2
|
import ViewerContextMenuItem, {
|
|
3
3
|
type ItemProps,
|
|
4
4
|
} from "@ogw_front/components/Viewer/ContextMenu/ContextMenuItem.vue";
|
|
5
|
+
import ModelPointsCard from "./ModelPointsCard.vue";
|
|
5
6
|
import SurfacePoints from "@ogw_front/assets/viewer_svgs/surface_points.svg";
|
|
6
|
-
import ViewerOptionsSizeSlider from "@ogw_front/components/Viewer/Options/Sliders/Size.vue";
|
|
7
|
-
import ViewerOptionsVisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
|
|
8
|
-
import { useBatchStyle } from "@ogw_front/composables/batch_style";
|
|
9
|
-
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
10
|
-
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
11
|
-
|
|
12
|
-
const dataStyleStore = useDataStyleStore();
|
|
13
|
-
const hybridViewerStore = useHybridViewerStore();
|
|
14
|
-
const { applyBatchStyle } = useBatchStyle();
|
|
15
7
|
|
|
16
8
|
interface Props {
|
|
17
9
|
itemProps: ItemProps & { index: number };
|
|
18
10
|
}
|
|
19
11
|
|
|
20
12
|
const { itemProps } = defineProps<Props>();
|
|
21
|
-
|
|
22
|
-
const id = computed<string>(
|
|
23
|
-
() => (itemProps.meta_data.modelId as string | undefined) || itemProps.id,
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
const visibility = computed<boolean>({
|
|
27
|
-
get: () => dataStyleStore.modelPointsVisibility(id.value),
|
|
28
|
-
set: async (newValue) => {
|
|
29
|
-
await applyBatchStyle(id.value, (targetId: string) =>
|
|
30
|
-
dataStyleStore.setModelPointsVisibility(targetId, newValue),
|
|
31
|
-
);
|
|
32
|
-
hybridViewerStore.remoteRender();
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
const size = computed<number>({
|
|
36
|
-
get: () => dataStyleStore.modelPointsSize(id.value),
|
|
37
|
-
set: async (newValue) => {
|
|
38
|
-
await applyBatchStyle(id.value, (targetId: string) =>
|
|
39
|
-
dataStyleStore.setModelPointsSize(targetId, newValue),
|
|
40
|
-
);
|
|
41
|
-
hybridViewerStore.remoteRender();
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
13
|
</script>
|
|
45
14
|
|
|
46
15
|
<template>
|
|
@@ -52,14 +21,7 @@ const size = computed<number>({
|
|
|
52
21
|
:btnImage="SurfacePoints"
|
|
53
22
|
>
|
|
54
23
|
<template #options>
|
|
55
|
-
<
|
|
56
|
-
data-testid="modelPointsVisibilitySwitch"
|
|
57
|
-
v-model="visibility"
|
|
58
|
-
/>
|
|
59
|
-
<template v-if="visibility">
|
|
60
|
-
<v-divider class="my-2" />
|
|
61
|
-
<ViewerOptionsSizeSlider data-testid="modelPointsSizeSlider" v-model="size" />
|
|
62
|
-
</template>
|
|
24
|
+
<ModelPointsCard :itemProps="itemProps" />
|
|
63
25
|
</template>
|
|
64
26
|
</ViewerContextMenuItem>
|
|
65
27
|
</template>
|
|
@@ -26,7 +26,7 @@ const emit = defineEmits<Emits>();
|
|
|
26
26
|
const separators = [
|
|
27
27
|
{ title: "Comma (,)", value: "," },
|
|
28
28
|
{ title: "Semicolon (;)", value: ";" },
|
|
29
|
-
{ title:
|
|
29
|
+
{ title: String.raw`Tab (\t)`, value: "\t" },
|
|
30
30
|
{ title: "Space ( )", value: " " },
|
|
31
31
|
{ title: "Pipe (|)", value: "|" },
|
|
32
32
|
{ title: "Custom", value: "custom" },
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { type ComputedRef, type Ref, computed, ref, watch } from "vue";
|
|
2
|
+
import type { CollectionComponent } from "@ogw_front/stores/data_helpers/collections";
|
|
3
|
+
import { MESH_COMPONENT_TYPES } from "@ogw_front/utils/default_styles";
|
|
4
|
+
import { useDataStore } from "@ogw_front/stores/data";
|
|
5
|
+
|
|
6
|
+
interface ModelMenuMetaData {
|
|
7
|
+
modelId?: string;
|
|
8
|
+
pickedComponentId?: string;
|
|
9
|
+
viewer_type?: string;
|
|
10
|
+
modelComponentType?: string;
|
|
11
|
+
targetComponentIds?: string[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface ModelMenuItemProps {
|
|
15
|
+
id: string;
|
|
16
|
+
meta_data: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ModelMenuContext {
|
|
20
|
+
modelId: ComputedRef<string>;
|
|
21
|
+
componentId: ComputedRef<string | undefined>;
|
|
22
|
+
componentType: Ref<string | undefined>;
|
|
23
|
+
collections: Ref<CollectionComponent[] | undefined>;
|
|
24
|
+
targetComponentIds: Ref<string[]>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Resolves what a model context menu targets: the whole model, a component type, a collection or one component
|
|
28
|
+
// oxlint-disable-next-line max-lines-per-function
|
|
29
|
+
function useModelMenuContext(getItemProps: () => ModelMenuItemProps): ModelMenuContext {
|
|
30
|
+
const dataStore = useDataStore();
|
|
31
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- meta_data is filled by the viewer context menu with these keys.
|
|
32
|
+
const metaData = computed(() => getItemProps().meta_data as ModelMenuMetaData);
|
|
33
|
+
|
|
34
|
+
const modelId = computed<string>(() => metaData.value.modelId ?? getItemProps().id);
|
|
35
|
+
const componentId = computed<string | undefined>(() => metaData.value.pickedComponentId);
|
|
36
|
+
const componentType = ref<string | undefined>(undefined);
|
|
37
|
+
const collections = ref<CollectionComponent[] | undefined>(undefined);
|
|
38
|
+
|
|
39
|
+
watch(
|
|
40
|
+
() => [
|
|
41
|
+
modelId.value,
|
|
42
|
+
componentId.value,
|
|
43
|
+
metaData.value.viewer_type,
|
|
44
|
+
metaData.value.modelComponentType,
|
|
45
|
+
],
|
|
46
|
+
async () => {
|
|
47
|
+
componentType.value = undefined;
|
|
48
|
+
collections.value = undefined;
|
|
49
|
+
if (metaData.value.viewer_type === "model_component_type") {
|
|
50
|
+
const { modelComponentType = "", targetComponentIds: ids = [] } = metaData.value;
|
|
51
|
+
if (MESH_COMPONENT_TYPES.includes(modelComponentType)) {
|
|
52
|
+
componentType.value = modelComponentType;
|
|
53
|
+
} else {
|
|
54
|
+
const collectionsByType = await dataStore.fetchAllCollectionComponents(modelId.value);
|
|
55
|
+
collections.value = (collectionsByType[modelComponentType] ?? []).filter((collection) =>
|
|
56
|
+
collection.children.every((child) => ids.includes(child.id)),
|
|
57
|
+
);
|
|
58
|
+
componentType.value = collections.value[0]?.children[0]?.category;
|
|
59
|
+
}
|
|
60
|
+
} else if (componentId.value !== undefined && modelId.value !== "") {
|
|
61
|
+
const currentModelId = modelId.value;
|
|
62
|
+
const currentCompId = componentId.value;
|
|
63
|
+
const type = await dataStore.meshComponentType(currentModelId, currentCompId);
|
|
64
|
+
if (
|
|
65
|
+
modelId.value === currentModelId &&
|
|
66
|
+
componentId.value === currentCompId &&
|
|
67
|
+
metaData.value.viewer_type !== "model_component_type"
|
|
68
|
+
) {
|
|
69
|
+
componentType.value = type;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{ immediate: true },
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const targetComponentIds = ref<string[]>([]);
|
|
77
|
+
watch(
|
|
78
|
+
() => [modelId.value, componentType.value, metaData.value.targetComponentIds],
|
|
79
|
+
async () => {
|
|
80
|
+
targetComponentIds.value = [];
|
|
81
|
+
if (metaData.value.targetComponentIds !== undefined) {
|
|
82
|
+
targetComponentIds.value = metaData.value.targetComponentIds;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (componentType.value !== undefined && modelId.value !== "") {
|
|
86
|
+
const currentModelId = modelId.value;
|
|
87
|
+
const currentType = componentType.value;
|
|
88
|
+
const ids = await dataStore.getMeshComponentGeodeIds(currentModelId, currentType);
|
|
89
|
+
if (modelId.value === currentModelId && componentType.value === currentType) {
|
|
90
|
+
targetComponentIds.value = ids;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{ immediate: true },
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
return { modelId, componentId, componentType, collections, targetComponentIds };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export { useModelMenuContext };
|
|
101
|
+
export type { ModelMenuItemProps };
|
|
@@ -96,18 +96,26 @@ async function importWorkflow(files: readonly FileToImport[]): Promise<string[]>
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
const results: string[] = [];
|
|
99
|
+
const errors: unknown[] = [];
|
|
99
100
|
async function processChunk(chunkIndex: number): Promise<void> {
|
|
100
101
|
if (chunkIndex >= chunks.length) {
|
|
101
102
|
return;
|
|
102
103
|
}
|
|
103
104
|
const chunk = chunks[chunkIndex] ?? [];
|
|
104
|
-
|
|
105
|
+
// A failing file does not prevent the other files from being imported
|
|
106
|
+
const chunk_results = await Promise.allSettled(
|
|
105
107
|
chunk.map(async ({ filename, geode_object_type }) => {
|
|
106
108
|
const id = await importFile(filename, geode_object_type);
|
|
107
109
|
return id;
|
|
108
110
|
}),
|
|
109
111
|
);
|
|
110
|
-
|
|
112
|
+
for (const result of chunk_results) {
|
|
113
|
+
if (result.status === "fulfilled") {
|
|
114
|
+
results.push(result.value);
|
|
115
|
+
} else {
|
|
116
|
+
errors.push(result.reason);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
111
119
|
await processChunk(chunkIndex + 1);
|
|
112
120
|
}
|
|
113
121
|
await processChunk(0);
|
|
@@ -116,6 +124,9 @@ async function importWorkflow(files: readonly FileToImport[]): Promise<string[]>
|
|
|
116
124
|
hybridViewerStore.resetCamera();
|
|
117
125
|
}
|
|
118
126
|
await hybridViewerStore.remoteRender();
|
|
127
|
+
if (errors.length > 0) {
|
|
128
|
+
throw new AggregateError(errors, `${errors.length} file(s) could not be imported`);
|
|
129
|
+
}
|
|
119
130
|
return results;
|
|
120
131
|
}
|
|
121
132
|
|
|
@@ -7,6 +7,7 @@ import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
|
7
7
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
8
8
|
import { useModelBlocksColor } from "./color";
|
|
9
9
|
import { useModelBlocksCommonStyle } from "./common";
|
|
10
|
+
import { useModelBlocksPointsStyle } from "./points";
|
|
10
11
|
import { useModelBlocksVisibility } from "./visibility";
|
|
11
12
|
|
|
12
13
|
interface ColorGroup {
|
|
@@ -34,6 +35,7 @@ type UseModelBlocksStyleReturn = {
|
|
|
34
35
|
} & ReturnType<typeof useModelBlocksCommonStyle> &
|
|
35
36
|
ReturnType<typeof useModelBlocksVisibility> &
|
|
36
37
|
ReturnType<typeof useModelBlocksColor> &
|
|
38
|
+
ReturnType<typeof useModelBlocksPointsStyle> &
|
|
37
39
|
ReturnType<typeof useModelBlocksVertexAttribute> &
|
|
38
40
|
ReturnType<typeof useModelBlocksPolyhedronAttribute>;
|
|
39
41
|
|
|
@@ -45,6 +47,7 @@ export function useModelBlocksStyle(): UseModelBlocksStyleReturn {
|
|
|
45
47
|
const modelColorStyle = useModelBlocksColor();
|
|
46
48
|
const modelBlocksVertexAttribute = useModelBlocksVertexAttribute();
|
|
47
49
|
const modelBlocksPolyhedronAttribute = useModelBlocksPolyhedronAttribute();
|
|
50
|
+
const modelBlocksPointsStyle = useModelBlocksPointsStyle();
|
|
48
51
|
|
|
49
52
|
async function applyModelBlocksVisibilityStyle(
|
|
50
53
|
modelId: string,
|
|
@@ -245,5 +248,6 @@ export function useModelBlocksStyle(): UseModelBlocksStyleReturn {
|
|
|
245
248
|
...modelColorStyle,
|
|
246
249
|
...modelBlocksVertexAttribute,
|
|
247
250
|
...modelBlocksPolyhedronAttribute,
|
|
251
|
+
...modelBlocksPointsStyle,
|
|
248
252
|
};
|
|
249
253
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ModelComponentPointsStyle,
|
|
3
|
+
useModelComponentPointsStyle,
|
|
4
|
+
} from "@ogw_internal/stores/data_style/model/points/component";
|
|
5
|
+
|
|
6
|
+
interface UseModelBlocksPointsStyleReturn {
|
|
7
|
+
modelBlockPointsVisibility: ModelComponentPointsStyle["visibility"];
|
|
8
|
+
modelBlockPointsSize: ModelComponentPointsStyle["size"];
|
|
9
|
+
modelBlockPointsColor: ModelComponentPointsStyle["color"];
|
|
10
|
+
modelBlockPointsActiveColoring: ModelComponentPointsStyle["activeColoring"];
|
|
11
|
+
modelBlockPointsVertexAttributeName: ModelComponentPointsStyle["vertexAttributeName"];
|
|
12
|
+
modelBlockPointsVertexAttributeItem: ModelComponentPointsStyle["vertexAttributeItem"];
|
|
13
|
+
modelBlockPointsVertexAttributeRange: ModelComponentPointsStyle["vertexAttributeRange"];
|
|
14
|
+
modelBlockPointsVertexAttributeColorMap: ModelComponentPointsStyle["vertexAttributeColorMap"];
|
|
15
|
+
modelBlockPointsVertexAttributeNoDataColor: ModelComponentPointsStyle["vertexAttributeNoDataColor"];
|
|
16
|
+
setModelBlocksPointsVisibility: ModelComponentPointsStyle["setVisibility"];
|
|
17
|
+
setModelBlocksPointsSize: ModelComponentPointsStyle["setSize"];
|
|
18
|
+
setModelBlocksPointsColor: ModelComponentPointsStyle["setColor"];
|
|
19
|
+
setModelBlocksPointsActiveColoring: ModelComponentPointsStyle["setActiveColoring"];
|
|
20
|
+
setModelBlocksPointsVertexAttributeName: ModelComponentPointsStyle["setVertexAttributeName"];
|
|
21
|
+
setModelBlocksPointsVertexAttributeItem: ModelComponentPointsStyle["setVertexAttributeItem"];
|
|
22
|
+
setModelBlocksPointsVertexAttributeRange: ModelComponentPointsStyle["setVertexAttributeRange"];
|
|
23
|
+
setModelBlocksPointsVertexAttributeColorMap: ModelComponentPointsStyle["setVertexAttributeColorMap"];
|
|
24
|
+
setModelBlocksPointsVertexAttributeNoDataColor: ModelComponentPointsStyle["setVertexAttributeNoDataColor"];
|
|
25
|
+
applyModelBlocksPointsStyle: ModelComponentPointsStyle["applyPointsStyle"];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function useModelBlocksPointsStyle(): UseModelBlocksPointsStyleReturn {
|
|
29
|
+
const points = useModelComponentPointsStyle("Block");
|
|
30
|
+
return {
|
|
31
|
+
modelBlockPointsVisibility: points.visibility,
|
|
32
|
+
modelBlockPointsSize: points.size,
|
|
33
|
+
modelBlockPointsColor: points.color,
|
|
34
|
+
modelBlockPointsActiveColoring: points.activeColoring,
|
|
35
|
+
modelBlockPointsVertexAttributeName: points.vertexAttributeName,
|
|
36
|
+
modelBlockPointsVertexAttributeItem: points.vertexAttributeItem,
|
|
37
|
+
modelBlockPointsVertexAttributeRange: points.vertexAttributeRange,
|
|
38
|
+
modelBlockPointsVertexAttributeColorMap: points.vertexAttributeColorMap,
|
|
39
|
+
modelBlockPointsVertexAttributeNoDataColor: points.vertexAttributeNoDataColor,
|
|
40
|
+
setModelBlocksPointsVisibility: points.setVisibility,
|
|
41
|
+
setModelBlocksPointsSize: points.setSize,
|
|
42
|
+
setModelBlocksPointsColor: points.setColor,
|
|
43
|
+
setModelBlocksPointsActiveColoring: points.setActiveColoring,
|
|
44
|
+
setModelBlocksPointsVertexAttributeName: points.setVertexAttributeName,
|
|
45
|
+
setModelBlocksPointsVertexAttributeItem: points.setVertexAttributeItem,
|
|
46
|
+
setModelBlocksPointsVertexAttributeRange: points.setVertexAttributeRange,
|
|
47
|
+
setModelBlocksPointsVertexAttributeColorMap: points.setVertexAttributeColorMap,
|
|
48
|
+
setModelBlocksPointsVertexAttributeNoDataColor: points.setVertexAttributeNoDataColor,
|
|
49
|
+
applyModelBlocksPointsStyle: points.applyPointsStyle,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -61,6 +61,12 @@ function useModelStyle(): UseModelStyleReturn {
|
|
|
61
61
|
modelPointsStyle.applyModelPointsStyle(modelId),
|
|
62
62
|
modelEdgesStyle.applyModelEdgesStyle(modelId),
|
|
63
63
|
]);
|
|
64
|
+
// Components points come after the model points, which override every component
|
|
65
|
+
await Promise.all([
|
|
66
|
+
modelSurfacesStyle.applyModelSurfacesPointsStyle(modelId),
|
|
67
|
+
modelLinesStyle.applyModelLinesPointsStyle(modelId),
|
|
68
|
+
modelBlocksStyle.applyModelBlocksPointsStyle(modelId),
|
|
69
|
+
]);
|
|
64
70
|
return results;
|
|
65
71
|
}
|
|
66
72
|
|
|
@@ -4,6 +4,7 @@ import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
|
|
|
4
4
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
5
5
|
import { useModelLinesColor } from "./color";
|
|
6
6
|
import { useModelLinesCommonStyle } from "./common";
|
|
7
|
+
import { useModelLinesPointsStyle } from "./points";
|
|
7
8
|
import { useModelLinesVisibility } from "./visibility";
|
|
8
9
|
|
|
9
10
|
interface ColorGroup {
|
|
@@ -29,6 +30,7 @@ async function setModelLinesDefaultStyle(_id: string): Promise<void> {
|
|
|
29
30
|
export function useModelLinesStyle(): ReturnType<typeof useModelLinesCommonStyle> &
|
|
30
31
|
ReturnType<typeof useModelLinesVisibility> &
|
|
31
32
|
ReturnType<typeof useModelLinesColor> &
|
|
33
|
+
ReturnType<typeof useModelLinesPointsStyle> &
|
|
32
34
|
ReturnType<typeof useModelLinesVertexAttribute> &
|
|
33
35
|
ReturnType<typeof useModelLinesEdgeAttribute> & {
|
|
34
36
|
applyModelLinesStyle: (modelId: string) => Promise<void>;
|
|
@@ -40,6 +42,7 @@ export function useModelLinesStyle(): ReturnType<typeof useModelLinesCommonStyle
|
|
|
40
42
|
const modelColorStyle = useModelLinesColor();
|
|
41
43
|
const modelLinesVertexAttribute = useModelLinesVertexAttribute();
|
|
42
44
|
const modelLinesEdgeAttribute = useModelLinesEdgeAttribute();
|
|
45
|
+
const modelLinesPointsStyle = useModelLinesPointsStyle();
|
|
43
46
|
|
|
44
47
|
async function applyModelLinesVisibilityStyle(
|
|
45
48
|
modelId: string,
|
|
@@ -232,5 +235,6 @@ export function useModelLinesStyle(): ReturnType<typeof useModelLinesCommonStyle
|
|
|
232
235
|
...modelColorStyle,
|
|
233
236
|
...modelLinesVertexAttribute,
|
|
234
237
|
...modelLinesEdgeAttribute,
|
|
238
|
+
...modelLinesPointsStyle,
|
|
235
239
|
};
|
|
236
240
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ModelComponentPointsStyle,
|
|
3
|
+
useModelComponentPointsStyle,
|
|
4
|
+
} from "@ogw_internal/stores/data_style/model/points/component";
|
|
5
|
+
|
|
6
|
+
interface UseModelLinesPointsStyleReturn {
|
|
7
|
+
modelLinePointsVisibility: ModelComponentPointsStyle["visibility"];
|
|
8
|
+
modelLinePointsSize: ModelComponentPointsStyle["size"];
|
|
9
|
+
modelLinePointsColor: ModelComponentPointsStyle["color"];
|
|
10
|
+
modelLinePointsActiveColoring: ModelComponentPointsStyle["activeColoring"];
|
|
11
|
+
modelLinePointsVertexAttributeName: ModelComponentPointsStyle["vertexAttributeName"];
|
|
12
|
+
modelLinePointsVertexAttributeItem: ModelComponentPointsStyle["vertexAttributeItem"];
|
|
13
|
+
modelLinePointsVertexAttributeRange: ModelComponentPointsStyle["vertexAttributeRange"];
|
|
14
|
+
modelLinePointsVertexAttributeColorMap: ModelComponentPointsStyle["vertexAttributeColorMap"];
|
|
15
|
+
modelLinePointsVertexAttributeNoDataColor: ModelComponentPointsStyle["vertexAttributeNoDataColor"];
|
|
16
|
+
setModelLinesPointsVisibility: ModelComponentPointsStyle["setVisibility"];
|
|
17
|
+
setModelLinesPointsSize: ModelComponentPointsStyle["setSize"];
|
|
18
|
+
setModelLinesPointsColor: ModelComponentPointsStyle["setColor"];
|
|
19
|
+
setModelLinesPointsActiveColoring: ModelComponentPointsStyle["setActiveColoring"];
|
|
20
|
+
setModelLinesPointsVertexAttributeName: ModelComponentPointsStyle["setVertexAttributeName"];
|
|
21
|
+
setModelLinesPointsVertexAttributeItem: ModelComponentPointsStyle["setVertexAttributeItem"];
|
|
22
|
+
setModelLinesPointsVertexAttributeRange: ModelComponentPointsStyle["setVertexAttributeRange"];
|
|
23
|
+
setModelLinesPointsVertexAttributeColorMap: ModelComponentPointsStyle["setVertexAttributeColorMap"];
|
|
24
|
+
setModelLinesPointsVertexAttributeNoDataColor: ModelComponentPointsStyle["setVertexAttributeNoDataColor"];
|
|
25
|
+
applyModelLinesPointsStyle: ModelComponentPointsStyle["applyPointsStyle"];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function useModelLinesPointsStyle(): UseModelLinesPointsStyleReturn {
|
|
29
|
+
const points = useModelComponentPointsStyle("Line");
|
|
30
|
+
return {
|
|
31
|
+
modelLinePointsVisibility: points.visibility,
|
|
32
|
+
modelLinePointsSize: points.size,
|
|
33
|
+
modelLinePointsColor: points.color,
|
|
34
|
+
modelLinePointsActiveColoring: points.activeColoring,
|
|
35
|
+
modelLinePointsVertexAttributeName: points.vertexAttributeName,
|
|
36
|
+
modelLinePointsVertexAttributeItem: points.vertexAttributeItem,
|
|
37
|
+
modelLinePointsVertexAttributeRange: points.vertexAttributeRange,
|
|
38
|
+
modelLinePointsVertexAttributeColorMap: points.vertexAttributeColorMap,
|
|
39
|
+
modelLinePointsVertexAttributeNoDataColor: points.vertexAttributeNoDataColor,
|
|
40
|
+
setModelLinesPointsVisibility: points.setVisibility,
|
|
41
|
+
setModelLinesPointsSize: points.setSize,
|
|
42
|
+
setModelLinesPointsColor: points.setColor,
|
|
43
|
+
setModelLinesPointsActiveColoring: points.setActiveColoring,
|
|
44
|
+
setModelLinesPointsVertexAttributeName: points.setVertexAttributeName,
|
|
45
|
+
setModelLinesPointsVertexAttributeItem: points.setVertexAttributeItem,
|
|
46
|
+
setModelLinesPointsVertexAttributeRange: points.setVertexAttributeRange,
|
|
47
|
+
setModelLinesPointsVertexAttributeColorMap: points.setVertexAttributeColorMap,
|
|
48
|
+
setModelLinesPointsVertexAttributeNoDataColor: points.setVertexAttributeNoDataColor,
|
|
49
|
+
applyModelLinesPointsStyle: points.applyPointsStyle,
|
|
50
|
+
};
|
|
51
|
+
}
|