Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3ecb7ac
fix(modelColor): Fix model color Inheritance
MaxNumerique Jun 10, 2026
793b261
Apply prepare changes
MaxNumerique Jun 10, 2026
db6a8fa
Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWe…
MaxNumerique Jun 10, 2026
8003858
Merge branch 'fix/model-color' of https://github.com/Geode-solutions/…
MaxNumerique Jun 10, 2026
b5fe1c9
model default color and color_mode
MaxNumerique Jun 10, 2026
d05129b
Apply prepare changes
MaxNumerique Jun 10, 2026
0778362
getters in store
MaxNumerique Jun 10, 2026
625f1ae
Apply prepare changes
MaxNumerique Jun 10, 2026
d0fe5b6
default style
MaxNumerique Jun 10, 2026
bdb1a43
Merge branch 'fix/model-color' of https://github.com/Geode-solutions/…
MaxNumerique Jun 10, 2026
016ccbf
refacto coloring and harmonize everywhere
MaxNumerique Jun 11, 2026
860e9e2
activecolor instead of colorMode
MaxNumerique Jun 11, 2026
ee4047c
rm fallbacks
MaxNumerique Jun 11, 2026
b153b23
Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWe…
MaxNumerique Jun 11, 2026
ffb35b9
activeColoring over color_mode
MaxNumerique Jun 11, 2026
bfe6a85
Apply prepare changes
MaxNumerique Jun 11, 2026
d88506b
no more guards for every attribute. constant over color for meshes
MaxNumerique Jun 11, 2026
984d4df
Apply prepare changes
MaxNumerique Jun 11, 2026
ee03cbc
constant over color
MaxNumerique Jun 11, 2026
a4aaa22
Merge branch 'fix/model-color' of https://github.com/Geode-solutions/…
MaxNumerique Jun 11, 2026
08822fd
MODEL_DEFAULT_ACTIVE_COLORING
MaxNumerique Jun 11, 2026
b32e840
coloringType
MaxNumerique Jun 11, 2026
89c164e
internal stores models
MaxNumerique Jun 11, 2026
2d76f91
modelComponentsColor.value
MaxNumerique Jun 11, 2026
d39dfbf
default
MaxNumerique Jun 11, 2026
9195c2f
default constants for components for active coloring
MaxNumerique Jun 11, 2026
f075aca
refacto
MaxNumerique Jun 12, 2026
ae47b97
refacto
MaxNumerique Jun 12, 2026
a755190
Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWe…
MaxNumerique Jun 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions app/components/Viewer/Generic/Model/BlocksOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,24 @@ const blocksColor = computed({
const blockColor = computed({
get: () => dataStyleStore.modelBlockColor(modelId, blockId),
set: async (color) => {
if (blockId) {
await dataStyleStore.setModelBlocksColor(modelId, [blockId], color);
hybridViewerStore.remoteRender();
}
await dataStyleStore.setModelBlocksColor(modelId, [blockId], color);
hybridViewerStore.remoteRender();
},
});

const blocksColorMode = computed({
get: () => dataStyleStore.getModelComponentTypeColorMode(modelId, "Block"),
set: async (colorMode) => {
await dataStyleStore.setModelComponentTypeColorMode(modelId, "Block", colorMode);
const blocksActiveColoring = computed({
get: () => dataStyleStore.getModelComponentTypeActiveColoring(modelId, "Block"),
set: async (coloringType) => {
await dataStyleStore.setModelComponentTypeActiveColoring(modelId, "Block", coloringType);
hybridViewerStore.remoteRender();
},
});

const blockColorMode = computed({
get: () => dataStyleStore.modelBlockColorMode(modelId, blockId),
set: async (colorMode) => {
if (blockId) {
await dataStyleStore.setModelComponentColorMode(modelId, blockId, colorMode);
hybridViewerStore.remoteRender();
}
const blockActiveColoring = computed({
get: () => dataStyleStore.modelBlockActiveColoring(modelId, blockId),
set: async (coloringType) => {
await dataStyleStore.setModelBlocksActiveColoring(modelId, [blockId], coloringType);
hybridViewerStore.remoteRender();
},
});

Expand Down Expand Up @@ -211,7 +207,7 @@ const polyhedronSchema = back_schemas.opengeodeweb_back.model_component_polyhedr
<ViewerOptionsColoringTypeSelector
:id="modelId"
:componentId="targetBlockIds[0]"
v-model:coloring_style_key="blocksColorMode"
v-model:coloring_style_key="blocksActiveColoring"
v-model:color="blocksColor"
v-model:vertex_attribute_name="blocksVertexAttributeName"
v-model:vertex_attribute_range="blocksVertexAttributeRange"
Expand All @@ -230,7 +226,7 @@ const polyhedronSchema = back_schemas.opengeodeweb_back.model_component_polyhedr
<ViewerOptionsColoringTypeSelector
:id="modelId"
:componentId="blockId"
v-model:coloring_style_key="blockColorMode"
v-model:coloring_style_key="blockActiveColoring"
v-model:color="blockColor"
v-model:vertex_attribute_name="vertexAttributeName"
v-model:vertex_attribute_range="vertexAttributeRange"
Expand Down
30 changes: 13 additions & 17 deletions app/components/Viewer/Generic/Model/CornersOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,24 @@ const cornersColor = computed({
const cornerColor = computed({
get: () => dataStyleStore.modelCornerColor(modelId, cornerId),
set: async (color) => {
if (cornerId) {
await dataStyleStore.setModelCornersColor(modelId, [cornerId], color);
hybridViewerStore.remoteRender();
}
await dataStyleStore.setModelCornersColor(modelId, [cornerId], color);
hybridViewerStore.remoteRender();
},
});

const cornersColorMode = computed({
get: () => dataStyleStore.getModelComponentTypeColorMode(modelId, "Corner"),
set: async (colorMode) => {
await dataStyleStore.setModelComponentTypeColorMode(modelId, "Corner", colorMode);
const cornersActiveColoring = computed({
get: () => dataStyleStore.getModelComponentTypeActiveColoring(modelId, "Corner"),
set: async (coloringType) => {
await dataStyleStore.setModelComponentTypeActiveColoring(modelId, "Corner", coloringType);
hybridViewerStore.remoteRender();
},
});

const cornerColorMode = computed({
get: () => dataStyleStore.modelCornerColorMode(modelId, cornerId),
set: async (colorMode) => {
if (cornerId) {
await dataStyleStore.setModelComponentColorMode(modelId, cornerId, colorMode);
hybridViewerStore.remoteRender();
}
const cornerActiveColoring = computed({
get: () => dataStyleStore.modelCornerActiveColoring(modelId, cornerId),
set: async (coloringType) => {
await dataStyleStore.setModelCornersActiveColoring(modelId, [cornerId], coloringType);
hybridViewerStore.remoteRender();
},
});

Expand Down Expand Up @@ -148,7 +144,7 @@ const vertexSchema = back_schemas.opengeodeweb_back.model_component_vertex_attri
<ViewerOptionsColoringTypeSelector
:id="modelId"
:componentId="targetCornerIds[0]"
v-model:coloring_style_key="cornersColorMode"
v-model:coloring_style_key="cornersActiveColoring"
v-model:color="cornersColor"
v-model:vertex_attribute_name="cornersVertexAttributeName"
v-model:vertex_attribute_range="cornersVertexAttributeRange"
Expand All @@ -164,7 +160,7 @@ const vertexSchema = back_schemas.opengeodeweb_back.model_component_vertex_attri
<ViewerOptionsColoringTypeSelector
:id="modelId"
:componentId="cornerId"
v-model:coloring_style_key="cornerColorMode"
v-model:coloring_style_key="cornerActiveColoring"
v-model:color="cornerColor"
v-model:vertex_attribute_name="vertexAttributeName"
v-model:vertex_attribute_range="vertexAttributeRange"
Expand Down
30 changes: 13 additions & 17 deletions app/components/Viewer/Generic/Model/LinesOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,24 @@ const linesColor = computed({
const lineColor = computed({
get: () => dataStyleStore.modelLineColor(modelId, lineId),
set: async (color) => {
if (lineId) {
await dataStyleStore.setModelLinesColor(modelId, [lineId], color);
hybridViewerStore.remoteRender();
}
await dataStyleStore.setModelLinesColor(modelId, [lineId], color);
hybridViewerStore.remoteRender();
},
});

const linesColorMode = computed({
get: () => dataStyleStore.getModelComponentTypeColorMode(modelId, "Line"),
set: async (colorMode) => {
await dataStyleStore.setModelComponentTypeColorMode(modelId, "Line", colorMode);
const linesActiveColoring = computed({
get: () => dataStyleStore.getModelComponentTypeActiveColoring(modelId, "Line"),
set: async (coloringType) => {
await dataStyleStore.setModelComponentTypeActiveColoring(modelId, "Line", coloringType);
hybridViewerStore.remoteRender();
},
});

const lineColorMode = computed({
get: () => dataStyleStore.modelLineColorMode(modelId, lineId),
set: async (colorMode) => {
if (lineId) {
await dataStyleStore.setModelComponentColorMode(modelId, lineId, colorMode);
hybridViewerStore.remoteRender();
}
const lineActiveColoring = computed({
get: () => dataStyleStore.modelLineActiveColoring(modelId, lineId),
set: async (coloringType) => {
await dataStyleStore.setModelLinesActiveColoring(modelId, [lineId], coloringType);
hybridViewerStore.remoteRender();
},
});

Expand Down Expand Up @@ -207,7 +203,7 @@ const edgeSchema = back_schemas.opengeodeweb_back.model_component_edge_attribute
<ViewerOptionsColoringTypeSelector
:id="modelId"
:componentId="targetLineIds[0]"
v-model:coloring_style_key="linesColorMode"
v-model:coloring_style_key="linesActiveColoring"
v-model:color="linesColor"
v-model:vertex_attribute_name="linesVertexAttributeName"
v-model:vertex_attribute_range="linesVertexAttributeRange"
Expand All @@ -226,7 +222,7 @@ const edgeSchema = back_schemas.opengeodeweb_back.model_component_edge_attribute
<ViewerOptionsColoringTypeSelector
:id="modelId"
:componentId="lineId"
v-model:coloring_style_key="lineColorMode"
v-model:coloring_style_key="lineActiveColoring"
v-model:color="lineColor"
v-model:vertex_attribute_name="vertexAttributeName"
v-model:vertex_attribute_range="vertexAttributeRange"
Expand Down
72 changes: 29 additions & 43 deletions app/components/Viewer/Generic/Model/ModelStyleCard.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup>
import OptionsSection from "@ogw_front/components/Viewer/Options/OptionsSection.vue";
import ViewerOptionsColorPicker from "@ogw_front/components/Viewer/Options/ColorPicker.vue";
import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
import VisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
import { useDataStore } from "@ogw_front/stores/data";
import { useDataStyleStore } from "@ogw_front/stores/data_style";
Expand Down Expand Up @@ -86,43 +86,36 @@ const modelVisibility = computed({
},
});

const colorModes = [
{ title: "Constant", value: "constant" },
{ title: "Random", value: "random" },
];

const modelComponentsColorMode = ref("constant");

const modelComponentsColor = computed({
get: () => {
if (selection.value.length > 0) {
return dataStyleStore.getModelComponentColor(modelId.value, selection.value[0]);
}
return { red: 255, green: 255, blue: 255 };
},
set: async (color) => {
if (selection.value.length > 0) {
await dataStyleStore.setModelComponentsColor(
modelId.value,
selection.value,
color,
modelComponentsColorMode.value,
);
hybridViewerStore.remoteRender();
}
const modelComponentsActiveColoring = computed({
get: () => dataStyleStore.getModelActiveColoring(modelId.value),
set: async (coloringType) => {
await dataStyleStore.mutateStyle(modelId.value, {
coloring: { active: coloringType },
});
await dataStyleStore.setModelComponentsColor(
modelId.value,
selection.value,
modelComponentsColor.value,
coloringType,
);
hybridViewerStore.remoteRender();
},
});

watch(modelComponentsColorMode, async (colorMode) => {
if (colorMode === "random" && selection.value.length > 0) {
const modelComponentsColor = computed({
get: () => dataStyleStore.getModelColor(modelId.value),
set: async (color) => {
await dataStyleStore.mutateStyle(modelId.value, {
coloring: { constant: color },
});
await dataStyleStore.setModelComponentsColor(
modelId.value,
selection.value,
undefined,
colorMode,
color,
modelComponentsActiveColoring.value,
);
hybridViewerStore.remoteRender();
}
},
});
</script>

Expand All @@ -133,20 +126,13 @@ watch(modelComponentsColorMode, async (colorMode) => {
</OptionsSection>

<OptionsSection v-if="!componentType && !componentId" title="Components Options" class="mt-4">
<v-label class="text-caption mb-1 mt-2">Color Mode</v-label>
<v-select
v-model="modelComponentsColorMode"
:items="colorModes"
density="compact"
hide-details
class="mb-3"
variant="outlined"
<ViewerOptionsColoringTypeSelector
:id="modelId"
v-model:coloring_style_key="modelComponentsActiveColoring"
v-model:color="modelComponentsColor"
:capabilities="{ color: { available: true } }"
:allowRandom="true"
/>

<template v-if="modelComponentsColorMode === 'constant'">
<v-label class="text-caption mb-1">Color</v-label>
<ViewerOptionsColorPicker v-model="modelComponentsColor" />
</template>
</OptionsSection>

<BlocksOptions
Expand Down
30 changes: 13 additions & 17 deletions app/components/Viewer/Generic/Model/SurfacesOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,24 @@ const surfacesColor = computed({
const surfaceColor = computed({
get: () => dataStyleStore.modelSurfaceColor(modelId, surfaceId),
set: async (color) => {
if (surfaceId) {
await dataStyleStore.setModelSurfacesColor(modelId, [surfaceId], color);
hybridViewerStore.remoteRender();
}
await dataStyleStore.setModelSurfacesColor(modelId, [surfaceId], color);
hybridViewerStore.remoteRender();
},
});

const surfacesColorMode = computed({
get: () => dataStyleStore.getModelComponentTypeColorMode(modelId, "Surface"),
set: async (colorMode) => {
await dataStyleStore.setModelComponentTypeColorMode(modelId, "Surface", colorMode);
const surfacesActiveColoring = computed({
get: () => dataStyleStore.getModelComponentTypeActiveColoring(modelId, "Surface"),
set: async (coloringType) => {
await dataStyleStore.setModelComponentTypeActiveColoring(modelId, "Surface", coloringType);
hybridViewerStore.remoteRender();
},
});

const surfaceColorMode = computed({
get: () => dataStyleStore.modelSurfaceColorMode(modelId, surfaceId),
set: async (colorMode) => {
if (surfaceId) {
await dataStyleStore.setModelComponentColorMode(modelId, surfaceId, colorMode);
hybridViewerStore.remoteRender();
}
const surfaceActiveColoring = computed({
get: () => dataStyleStore.modelSurfaceActiveColoring(modelId, surfaceId),
set: async (coloringType) => {
await dataStyleStore.setModelSurfacesActiveColoring(modelId, [surfaceId], coloringType);
hybridViewerStore.remoteRender();
},
});

Expand Down Expand Up @@ -215,7 +211,7 @@ const polygonSchema = back_schemas.opengeodeweb_back.model_component_polygon_att
<ViewerOptionsColoringTypeSelector
:id="modelId"
:componentId="targetSurfaceIds[0]"
v-model:coloring_style_key="surfacesColorMode"
v-model:coloring_style_key="surfacesActiveColoring"
v-model:color="surfacesColor"
v-model:vertex_attribute_name="surfacesVertexAttributeName"
v-model:vertex_attribute_range="surfacesVertexAttributeRange"
Expand All @@ -234,7 +230,7 @@ const polygonSchema = back_schemas.opengeodeweb_back.model_component_polygon_att
<ViewerOptionsColoringTypeSelector
:id="modelId"
:componentId="surfaceId"
v-model:coloring_style_key="surfaceColorMode"
v-model:coloring_style_key="surfaceActiveColoring"
v-model:color="surfaceColor"
v-model:vertex_attribute_name="vertexAttributeName"
v-model:vertex_attribute_range="vertexAttributeRange"
Expand Down
7 changes: 6 additions & 1 deletion app/components/Viewer/Options/AttributeSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import { useBackStore } from "@ogw_front/stores/back";

const backStore = useBackStore();

const name = defineModel("name", { type: String });
const name = defineModel("name", {
type: String,
default: undefined,
set: (value) => value ?? name.value,
});

const range = defineModel("range", { type: Array });
const colorMap = defineModel("colorMap", { type: String });

Expand Down
Loading
Loading