@geode/opengeodeweb-front 10.43.2 → 10.44.0-rc.10
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/server/utils/cleanup.js +7 -2
- package/.build/server/utils/microservices.js +9 -81
- package/.build/server/utils/microservices_process.js +85 -0
- package/.build/server/utils/scripts.js +34 -23
- package/.build/server/utils/typed_handler.js +5 -1
- package/.build/server/utils/ws_client.js +7 -2
- package/.build/shared/utils/fetch_raw.js +2 -2
- package/.build/shared/utils/parse_boolean.js +2 -1
- package/app/assets/geode_objects.ts +1 -0
- package/app/components/BasemapAttribution.vue +28 -0
- package/app/components/ClippingPlanes.vue +22 -78
- package/app/components/CrsSelector.vue +53 -46
- package/app/components/DragAndDrop.vue +16 -79
- package/app/components/FeedBack/Snackers.vue +27 -0
- package/app/components/FileSelector.vue +9 -6
- package/app/components/HybridViewerTooltip.vue +8 -2
- package/app/components/MissingFilesSelector.vue +40 -23
- package/app/components/ObjectSelector.vue +34 -20
- package/app/components/ProjectCrs.vue +37 -0
- package/app/components/Screenshot.vue +17 -59
- package/app/components/ThresholdCard.vue +205 -0
- package/app/components/ThresholdFilter.vue +81 -216
- package/app/components/ViewToolbar.vue +15 -231
- package/app/components/Viewer/Basemap/CropOptions.vue +50 -0
- package/app/components/Viewer/Basemap/OpacityOptions.vue +52 -0
- package/app/components/Viewer/ContextMenu/CircularItems.vue +1 -2
- package/app/components/Viewer/ContextMenu/ContextMenu.vue +11 -6
- package/app/components/Viewer/ContextMenu/ContextMenuItem.vue +10 -7
- package/app/components/Viewer/ContextMenu/InfoCard.vue +30 -0
- package/app/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue +209 -0
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +3 -191
- package/app/components/Viewer/Generic/Mesh/CellsColoring.vue +221 -0
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +3 -210
- package/app/components/Viewer/Generic/Mesh/EdgesColoring.vue +211 -0
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +3 -192
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +13 -0
- package/app/components/Viewer/Generic/Mesh/PolygonsColoring.vue +227 -0
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +3 -215
- package/app/components/Viewer/Generic/Mesh/PolyhedraColoring.vue +221 -0
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +3 -203
- package/app/components/Viewer/Generic/Model/BlocksOptions.vue +14 -12
- package/app/components/Viewer/Generic/Model/ComponentPointsOptions.vue +2 -18
- package/app/components/Viewer/Generic/Model/CornerComponentOptions.vue +145 -0
- package/app/components/Viewer/Generic/Model/CornersOptions.vue +15 -294
- package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +173 -0
- package/app/components/Viewer/Generic/Model/LineComponentOptions.vue +218 -0
- package/app/components/Viewer/Generic/Model/LinesOptions.vue +15 -427
- package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +229 -0
- package/app/components/Viewer/Generic/Model/ModelCardTabs.vue +35 -0
- package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +34 -25
- package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +34 -25
- package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +17 -5
- package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +16 -12
- package/app/components/Viewer/ObjectTree/Base/ComponentRelations.vue +4 -1
- package/app/components/Viewer/ObjectTree/Base/ItemLabel.vue +71 -1
- package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +55 -10
- package/app/components/Viewer/Options/AttributeRangeSelector.vue +11 -4
- package/app/components/Viewer/Options/AttributeSelector.vue +40 -136
- package/app/components/Viewer/Options/ColorPicker.vue +4 -1
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +48 -74
- package/app/components/Viewer/Options/ColormapQuickPicker.vue +13 -7
- package/app/components/Viewer/Options/NoDataColorInfo.vue +56 -0
- package/app/components/Viewer/Options/Sliders/Opacity.vue +22 -0
- package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +13 -0
- package/app/components/Viewer/Scene/BackgroundOptions.vue +37 -0
- package/app/components/Viewer/Scene/OrientationWidgetOptions.vue +48 -0
- package/app/components/Viewer/Scene/TextOptions.vue +63 -0
- package/app/components/Viewer/Solid/SpecificPolyhedraColoring.vue +217 -0
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +4 -199
- package/app/components/Viewer/Surface/PolygonsColoring.vue +224 -0
- package/app/components/Viewer/Surface/PolygonsOptions.vue +3 -213
- package/app/components/Viewer/Ui.vue +9 -0
- package/app/components/csv-preview/CsvPreviewer.vue +4 -1
- package/app/composables/attribute_coloring_style.ts +8 -2
- package/app/composables/attribute_selector.ts +126 -0
- package/app/composables/batch_style_model.ts +34 -0
- package/app/composables/clipping_slices.ts +166 -0
- package/app/composables/global_attribute_style.ts +4 -3
- package/app/composables/hover_highlight.ts +19 -18
- package/app/composables/live_data_item.ts +39 -0
- package/app/composables/model_tabs.ts +86 -0
- package/app/composables/overlapping_picker_menu.ts +43 -0
- package/app/composables/project_manager.ts +5 -81
- package/app/composables/project_manager_helpers/reset.ts +34 -0
- package/app/composables/project_manager_helpers/restore.ts +67 -0
- package/app/composables/project_manager_helpers/types.ts +24 -0
- package/app/composables/project_manager_helpers/viewer_session.ts +25 -0
- package/app/composables/stepper_tree.ts +10 -2
- package/app/composables/tree_filter.ts +11 -2
- package/app/composables/tree_keyboard_nav.ts +4 -2
- package/app/composables/use_overlapping_picker.ts +30 -42
- package/app/composables/view_toolbar_options.ts +126 -0
- package/app/composables/view_toolbar_tool_options.ts +115 -0
- package/app/composables/view_toolbar_tools.ts +108 -0
- package/app/composables/viewer_context_menu.ts +19 -1
- package/app/composables/virtual_tree.ts +20 -131
- package/app/composables/virtual_tree_flatten.ts +109 -0
- package/app/composables/virtual_tree_types.ts +81 -0
- package/app/stores/app.ts +8 -55
- package/app/stores/app_helpers/extension.ts +90 -51
- package/app/stores/app_helpers/registry.ts +69 -0
- package/app/stores/basemap.ts +52 -0
- package/app/stores/basemap_detail.ts +51 -0
- package/app/stores/basemap_helpers/builds.ts +158 -0
- package/app/stores/basemap_helpers/detail_layers.ts +72 -0
- package/app/stores/basemap_helpers/detail_map.ts +62 -0
- package/app/stores/basemap_helpers/detail_refresh.ts +134 -0
- package/app/stores/basemap_helpers/detail_view.ts +94 -0
- package/app/stores/basemap_helpers/extent.ts +40 -0
- package/app/stores/basemap_helpers/georeferenced.ts +50 -0
- package/app/stores/basemap_helpers/layers.ts +66 -0
- package/app/stores/basemap_helpers/settings.ts +87 -0
- package/app/stores/basemap_helpers/viewer.ts +114 -0
- package/app/stores/crs.ts +136 -0
- package/app/stores/data.ts +24 -1
- package/app/stores/data_style.ts +8 -0
- package/app/stores/feedback.ts +12 -2
- package/app/stores/hybrid_viewer.ts +1 -1
- package/app/stores/infra.ts +26 -21
- package/app/stores/menu.ts +8 -124
- package/app/stores/menu_helpers/basemap.ts +10 -0
- package/app/stores/menu_helpers/menus_data.ts +27 -0
- package/app/stores/menu_helpers/mesh/edged_curve.ts +12 -0
- package/app/stores/menu_helpers/mesh/grid.ts +24 -0
- package/app/stores/menu_helpers/mesh/point_set.ts +11 -0
- package/app/stores/menu_helpers/mesh/solid.ts +29 -0
- package/app/stores/menu_helpers/mesh/surface.ts +22 -0
- package/app/stores/menu_helpers/model.ts +25 -0
- package/app/stores/menu_helpers/scene.ts +10 -0
- package/app/stores/menu_helpers/types.ts +5 -0
- package/app/stores/treeview.ts +17 -10
- package/app/stores/viewer.ts +17 -79
- package/app/stores/viewer_helpers/actions.ts +68 -0
- package/app/stores/viewer_helpers/request.ts +61 -0
- package/app/utils/basemap_tree.ts +76 -0
- package/app/utils/clipping_planes.ts +4 -131
- package/app/utils/clipping_planes_scene.ts +131 -0
- package/app/utils/color_picker.ts +18 -15
- package/app/utils/coloring_styles.ts +101 -0
- package/app/utils/crs.ts +38 -0
- package/app/utils/default_styles/constants.ts +10 -0
- package/app/utils/default_styles/index.ts +17 -1
- package/app/utils/default_styles/mesh_components.ts +168 -0
- package/app/utils/default_styles/meshes.ts +13 -153
- package/app/utils/default_styles/model_components.ts +170 -0
- package/app/utils/default_styles/models.ts +16 -153
- package/app/utils/drag_and_drop.ts +80 -0
- package/app/utils/extension.ts +1 -1
- package/app/utils/import_workflow.ts +26 -11
- package/app/utils/model_component_coloring.ts +46 -0
- package/app/utils/threshold.ts +33 -0
- package/app/utils/threshold_sources.ts +51 -0
- package/app/utils/treeview.ts +12 -1
- package/app/utils/upload_path.ts +15 -9
- package/app/utils/visible_map_area.ts +129 -0
- package/internal/database/base_database.ts +2 -0
- package/internal/database/database.ts +47 -29
- package/internal/database/tables/scene_style.ts +6 -0
- package/internal/stores/data_style/mesh/base_style.ts +74 -0
- package/internal/stores/data_style/mesh/cells/cell.ts +27 -150
- package/internal/stores/data_style/mesh/cells/cell_attribute.ts +74 -0
- package/internal/stores/data_style/mesh/cells/cell_config.ts +152 -0
- package/internal/stores/data_style/mesh/cells/color.ts +3 -1
- package/internal/stores/data_style/mesh/cells/index.ts +17 -1
- package/internal/stores/data_style/mesh/cells/opacity.ts +54 -0
- package/internal/stores/data_style/mesh/cells/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/cells/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/cells/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/edges/color.ts +3 -1
- package/internal/stores/data_style/mesh/edges/edge.ts +27 -150
- package/internal/stores/data_style/mesh/edges/edge_attribute.ts +74 -0
- package/internal/stores/data_style/mesh/edges/edge_config.ts +152 -0
- package/internal/stores/data_style/mesh/edges/index.ts +17 -1
- package/internal/stores/data_style/mesh/edges/opacity.ts +54 -0
- package/internal/stores/data_style/mesh/edges/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/edges/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/edges/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/index.ts +2 -57
- package/internal/stores/data_style/mesh/points/color.ts +3 -1
- package/internal/stores/data_style/mesh/points/index.ts +17 -1
- package/internal/stores/data_style/mesh/points/opacity.ts +54 -0
- package/internal/stores/data_style/mesh/points/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/points/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/points/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/polygons/color.ts +3 -1
- package/internal/stores/data_style/mesh/polygons/index.ts +17 -1
- package/internal/stores/data_style/mesh/polygons/opacity.ts +54 -0
- package/internal/stores/data_style/mesh/polygons/polygon.ts +27 -152
- package/internal/stores/data_style/mesh/polygons/polygon_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polygons/polygon_config.ts +148 -0
- package/internal/stores/data_style/mesh/polygons/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/polygons/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polygons/vertex_config.ts +152 -0
- package/internal/stores/data_style/mesh/polyhedra/color.ts +3 -1
- package/internal/stores/data_style/mesh/polyhedra/index.ts +17 -1
- package/internal/stores/data_style/mesh/polyhedra/opacity.ts +54 -0
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +27 -160
- package/internal/stores/data_style/mesh/polyhedra/polyhedron_attribute.ts +82 -0
- package/internal/stores/data_style/mesh/polyhedra/polyhedron_config.ts +157 -0
- package/internal/stores/data_style/mesh/polyhedra/vertex.ts +26 -157
- package/internal/stores/data_style/mesh/polyhedra/vertex_attribute.ts +80 -0
- package/internal/stores/data_style/mesh/polyhedra/vertex_config.ts +152 -0
- package/internal/stores/data_style/model/blocks/apply_coloring.ts +173 -0
- package/internal/stores/data_style/model/blocks/color.ts +58 -57
- package/internal/stores/data_style/model/blocks/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/blocks/index.ts +12 -140
- package/internal/stores/data_style/model/blocks/polyhedron.ts +102 -54
- package/internal/stores/data_style/model/blocks/vertex.ts +102 -54
- package/internal/stores/data_style/model/color.ts +25 -26
- package/internal/stores/data_style/model/common.ts +10 -119
- package/internal/stores/data_style/model/common_mutations.ts +184 -0
- package/internal/stores/data_style/model/corners/index.ts +85 -78
- package/internal/stores/data_style/model/corners/vertex.ts +97 -49
- package/internal/stores/data_style/model/lines/apply_coloring.ts +154 -0
- package/internal/stores/data_style/model/lines/color.ts +53 -40
- package/internal/stores/data_style/model/lines/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/lines/edge.ts +102 -54
- package/internal/stores/data_style/model/lines/index.ts +10 -134
- package/internal/stores/data_style/model/lines/vertex.ts +102 -54
- package/internal/stores/data_style/model/surfaces/apply_coloring.ts +186 -0
- package/internal/stores/data_style/model/surfaces/color.ts +68 -56
- package/internal/stores/data_style/model/surfaces/coloring_groups.ts +18 -0
- package/internal/stores/data_style/model/surfaces/index.ts +16 -160
- package/internal/stores/data_style/model/surfaces/polygon.ts +94 -46
- package/internal/stores/data_style/model/surfaces/vertex.ts +94 -46
- package/internal/stores/data_style/model/visibility.ts +3 -156
- package/internal/stores/data_style/model/visibility_dispatch.ts +110 -0
- package/internal/stores/data_style/scene.ts +118 -0
- package/internal/stores/data_style/state.ts +5 -181
- package/internal/stores/data_style/state_shared.ts +199 -0
- package/internal/stores/data_style/types.ts +24 -1
- package/internal/stores/hybrid_viewer/brightness.ts +8 -2
- package/internal/stores/hybrid_viewer/camera.ts +7 -161
- package/internal/stores/hybrid_viewer/camera_animation.ts +4 -3
- package/internal/stores/hybrid_viewer/camera_helpers.ts +120 -0
- package/internal/stores/hybrid_viewer/camera_orientation.ts +60 -0
- package/internal/stores/hybrid_viewer/filters.ts +54 -11
- package/internal/stores/hybrid_viewer/highlight.ts +80 -63
- package/internal/stores/hybrid_viewer/ruler.ts +4 -3
- package/internal/stores/hybrid_viewer/scene.ts +34 -26
- package/internal/stores/hybrid_viewer/vtk_types.ts +2 -1
- package/internal/utils/ws_client.ts +8 -1
- package/package.json +5 -5
- package/server/api/local/extensions/run.post.ts +6 -4
- package/server/api/local/extensions/upload.put.ts +47 -20
- package/server/utils/cleanup.ts +12 -2
- package/server/utils/microservices.ts +10 -102
- package/server/utils/microservices_process.ts +127 -0
- package/server/utils/scripts.ts +35 -30
- package/server/utils/typed_handler.ts +8 -1
- package/server/utils/ws_client.ts +15 -2
- package/shared/utils/fetch_raw.ts +2 -2
- package/shared/utils/parse_boolean.ts +4 -1
- package/app/components/Viewer/Options/OptionsSection.vue +0 -76
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
JsonRpcSchema,
|
|
3
|
+
ParamsOf,
|
|
4
|
+
RequestHandlers,
|
|
5
|
+
ResponseOf,
|
|
6
|
+
} from "@ogw_shared/utils/types.js";
|
|
7
|
+
import type { RpcClient } from "@ogw_shared/utils/call_raw.js";
|
|
8
|
+
import { viewer_call } from "@ogw_internal/utils/viewer_call";
|
|
9
|
+
|
|
10
|
+
interface ViewerRequestMicroservice {
|
|
11
|
+
$id: string;
|
|
12
|
+
client: RpcClient;
|
|
13
|
+
base_url: string;
|
|
14
|
+
start_request: () => void;
|
|
15
|
+
stop_request: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface ViewerRequestArgs<Schema extends JsonRpcSchema> {
|
|
19
|
+
schema: Schema;
|
|
20
|
+
params?: ParamsOf<Schema>;
|
|
21
|
+
timeout?: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type ViewerRequest = <Schema extends JsonRpcSchema>(
|
|
25
|
+
args: ViewerRequestArgs<Schema>,
|
|
26
|
+
callbacks?: RequestHandlers<ResponseOf<Schema>>,
|
|
27
|
+
) => Promise<ResponseOf<Schema>>;
|
|
28
|
+
|
|
29
|
+
const MS_PER_SECOND = 1000;
|
|
30
|
+
const SECONDS_PER_REQUEST = 10;
|
|
31
|
+
const request_timeout = MS_PER_SECOND * SECONDS_PER_REQUEST;
|
|
32
|
+
|
|
33
|
+
async function callViewer<Schema extends JsonRpcSchema>(
|
|
34
|
+
microservice: ViewerRequestMicroservice,
|
|
35
|
+
{ schema, params, timeout = request_timeout }: ViewerRequestArgs<Schema>,
|
|
36
|
+
callbacks: RequestHandlers<ResponseOf<Schema>> = {},
|
|
37
|
+
): Promise<ResponseOf<Schema>> {
|
|
38
|
+
const result = await viewer_call(
|
|
39
|
+
microservice,
|
|
40
|
+
{
|
|
41
|
+
schema,
|
|
42
|
+
params: params ?? {},
|
|
43
|
+
timeout,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
...callbacks,
|
|
47
|
+
response_function: async (response: unknown) => {
|
|
48
|
+
if (callbacks.response_function) {
|
|
49
|
+
// The viewer validates its responses against the schema `response` it was generated from.
|
|
50
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion
|
|
51
|
+
await callbacks.response_function(response as ResponseOf<Schema>);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion
|
|
57
|
+
return result as ResponseOf<Schema>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { callViewer };
|
|
61
|
+
export type { ViewerRequest, ViewerRequestArgs };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
type MapStyle = "satellite" | "plan" | "routes";
|
|
2
|
+
|
|
3
|
+
interface BasemapTreeGroup {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
children: { id: string; title: string }[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Tree order and stacking order: from the bottom up, the routes stay readable on top
|
|
10
|
+
const MAP_STYLES: readonly MapStyle[] = ["satellite", "plan", "routes"];
|
|
11
|
+
const MAP_TITLES: Record<MapStyle, string> = {
|
|
12
|
+
satellite: "Satellite",
|
|
13
|
+
plan: "Plan",
|
|
14
|
+
routes: "Routes",
|
|
15
|
+
};
|
|
16
|
+
const BASEMAP_GROUP_ID = "basemap";
|
|
17
|
+
const MAP_ID_PREFIX = `${BASEMAP_GROUP_ID}:`;
|
|
18
|
+
|
|
19
|
+
function mapId(style: MapStyle): string {
|
|
20
|
+
return `${MAP_ID_PREFIX}${style}`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function mapStyleOf(id: string): MapStyle | undefined {
|
|
24
|
+
return MAP_STYLES.find((style) => mapId(style) === id);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function sortedMaps(maps: readonly string[]): MapStyle[] {
|
|
28
|
+
return MAP_STYLES.filter((style) => maps.includes(style));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Tree ids of the basemap: never project data
|
|
32
|
+
function isBasemapId(id: string): boolean {
|
|
33
|
+
return id === BASEMAP_GROUP_ID || id.startsWith(MAP_ID_PREFIX);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function basemapGroup(): BasemapTreeGroup {
|
|
37
|
+
return {
|
|
38
|
+
id: BASEMAP_GROUP_ID,
|
|
39
|
+
title: "Basemap",
|
|
40
|
+
children: MAP_STYLES.map((style) => ({ id: mapId(style), title: MAP_TITLES[style] })),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Each map eye shows or hides its map. The classic tree adds the group and every map on a
|
|
45
|
+
// Group click: that click hides the visible maps, or shows the last visible maps again
|
|
46
|
+
function nextBasemapMaps(
|
|
47
|
+
current: readonly MapStyle[],
|
|
48
|
+
last: readonly MapStyle[],
|
|
49
|
+
added: readonly string[],
|
|
50
|
+
removed: readonly string[],
|
|
51
|
+
): MapStyle[] {
|
|
52
|
+
const addedMaps = added.flatMap((id) => mapStyleOf(id) ?? []);
|
|
53
|
+
if (added.includes(BASEMAP_GROUP_ID) || addedMaps.length > 1) {
|
|
54
|
+
if (current.length === 0) {
|
|
55
|
+
return [...last];
|
|
56
|
+
}
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
const removedMaps = removed.flatMap((id) => mapStyleOf(id) ?? []);
|
|
60
|
+
if (removed.includes(BASEMAP_GROUP_ID) && removedMaps.length === 0) {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
return sortedMaps([...current, ...addedMaps].filter((style) => !removedMaps.includes(style)));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type { MapStyle };
|
|
67
|
+
export {
|
|
68
|
+
BASEMAP_GROUP_ID,
|
|
69
|
+
MAP_STYLES,
|
|
70
|
+
basemapGroup,
|
|
71
|
+
isBasemapId,
|
|
72
|
+
mapId,
|
|
73
|
+
mapStyleOf,
|
|
74
|
+
nextBasemapMaps,
|
|
75
|
+
sortedMaps,
|
|
76
|
+
};
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type { Bounds } from "@kitware/vtk.js/types";
|
|
2
|
-
import type vtkActor from "@kitware/vtk.js/Rendering/Core/Actor";
|
|
3
|
-
import type { vtkCamera } from "@kitware/vtk.js/Rendering/Core/Camera";
|
|
4
|
-
|
|
5
1
|
const AXIS_SCALE = 0.45;
|
|
6
2
|
const SIZE_RATIO = 0.1;
|
|
7
3
|
const DEBOUNCE_DELAY = 200;
|
|
@@ -79,130 +75,6 @@ function getPlaneStyle(rgb: readonly number[]): PlaneStyle {
|
|
|
79
75
|
};
|
|
80
76
|
}
|
|
81
77
|
|
|
82
|
-
function computeSceneBounds(actors: readonly vtkActor[]): Bounds {
|
|
83
|
-
let bounds: Bounds = [Infinity, -Infinity, Infinity, -Infinity, Infinity, -Infinity];
|
|
84
|
-
for (const actor of actors) {
|
|
85
|
-
const boundsOfActor = actor.getBounds();
|
|
86
|
-
bounds = [
|
|
87
|
-
Math.min(bounds[0], boundsOfActor[0]),
|
|
88
|
-
Math.max(bounds[1], boundsOfActor[1]),
|
|
89
|
-
Math.min(bounds[2], boundsOfActor[2]),
|
|
90
|
-
Math.max(bounds[3], boundsOfActor[3]),
|
|
91
|
-
Math.min(bounds[4], boundsOfActor[4]),
|
|
92
|
-
Math.max(bounds[5], boundsOfActor[5]),
|
|
93
|
-
];
|
|
94
|
-
}
|
|
95
|
-
return bounds;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
interface SceneBoundsInfo {
|
|
99
|
-
readonly center: readonly number[];
|
|
100
|
-
readonly cubicBounds: readonly number[];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function computeSceneBoundsInfo(actors: readonly vtkActor[]): SceneBoundsInfo {
|
|
104
|
-
if (actors.length === 0) {
|
|
105
|
-
return { center: [0, 0, 0], cubicBounds: [-1, 1, -1, 1, -1, 1] };
|
|
106
|
-
}
|
|
107
|
-
const [xmin, xmax, ymin, ymax, zmin, zmax] = computeSceneBounds(actors);
|
|
108
|
-
const center = [
|
|
109
|
-
Number(((xmin + xmax) / 2).toFixed(4)),
|
|
110
|
-
Number(((ymin + ymax) / 2).toFixed(4)),
|
|
111
|
-
Number(((zmin + zmax) / 2).toFixed(4)),
|
|
112
|
-
];
|
|
113
|
-
|
|
114
|
-
const maxActorExtent = Math.max(
|
|
115
|
-
...actors.map((actor: vtkActor) => {
|
|
116
|
-
const bounds = actor.getBounds();
|
|
117
|
-
return Math.max(bounds[1] - bounds[0], bounds[3] - bounds[2], bounds[5] - bounds[4]);
|
|
118
|
-
}),
|
|
119
|
-
);
|
|
120
|
-
const halfExtent = maxActorExtent / 2;
|
|
121
|
-
const [centerX = 0, centerY = 0, centerZ = 0] = center;
|
|
122
|
-
const cubicBounds = [
|
|
123
|
-
centerX - halfExtent,
|
|
124
|
-
centerX + halfExtent,
|
|
125
|
-
centerY - halfExtent,
|
|
126
|
-
centerY + halfExtent,
|
|
127
|
-
centerZ - halfExtent,
|
|
128
|
-
centerZ + halfExtent,
|
|
129
|
-
];
|
|
130
|
-
return { center, cubicBounds };
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
interface ActorEntry {
|
|
134
|
-
readonly actor: vtkActor;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
interface MainCameraOptions {
|
|
138
|
-
readonly focal_point?: readonly number[];
|
|
139
|
-
readonly position?: readonly number[];
|
|
140
|
-
readonly view_up?: readonly number[];
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function resolveActiveActors(
|
|
144
|
-
targetAllVisible: boolean,
|
|
145
|
-
allItems: readonly { readonly id: string }[],
|
|
146
|
-
selectedDatasetIds: readonly string[],
|
|
147
|
-
hybridDb: Record<string, ActorEntry | undefined>,
|
|
148
|
-
): vtkActor[] {
|
|
149
|
-
const targetIds = targetAllVisible
|
|
150
|
-
? allItems.map((item: { id: string }) => item.id)
|
|
151
|
-
: selectedDatasetIds;
|
|
152
|
-
const targeted = targetIds
|
|
153
|
-
.map((id) => hybridDb[id]?.actor)
|
|
154
|
-
.filter((actor: vtkActor | undefined): actor is vtkActor => actor !== undefined);
|
|
155
|
-
if (targeted.length > 0) {
|
|
156
|
-
return targeted;
|
|
157
|
-
}
|
|
158
|
-
return Object.values(hybridDb)
|
|
159
|
-
.filter((entry: ActorEntry | undefined): entry is ActorEntry => entry !== undefined)
|
|
160
|
-
.map((entry: ActorEntry) => entry.actor);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function computeNormalizedViewDirection(
|
|
164
|
-
focalPoint: readonly number[],
|
|
165
|
-
position: readonly number[],
|
|
166
|
-
): readonly number[] | undefined {
|
|
167
|
-
const dir = [
|
|
168
|
-
(position[0] ?? 0) - (focalPoint[0] ?? 0),
|
|
169
|
-
(position[1] ?? 0) - (focalPoint[1] ?? 0),
|
|
170
|
-
(position[2] ?? 0) - (focalPoint[2] ?? 0),
|
|
171
|
-
];
|
|
172
|
-
const dirLen = Math.hypot(...dir);
|
|
173
|
-
if (dirLen === 0) {
|
|
174
|
-
return undefined;
|
|
175
|
-
}
|
|
176
|
-
return dir.map((component) => component / dirLen);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// Aligns the local clipping-plane preview camera onto the same viewing direction as the
|
|
180
|
-
// Main viewer camera, re-centered on the clipped scene's bounds.
|
|
181
|
-
function alignCameraToMainCamera(
|
|
182
|
-
camera: vtkCamera,
|
|
183
|
-
mainCam: MainCameraOptions,
|
|
184
|
-
center: readonly number[],
|
|
185
|
-
): void {
|
|
186
|
-
if (!mainCam.focal_point || !mainCam.position) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
const normDir = computeNormalizedViewDirection(mainCam.focal_point, mainCam.position);
|
|
190
|
-
if (!normDir) {
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
const distance = camera.getDistance();
|
|
194
|
-
camera.setFocalPoint(center[0] ?? 0, center[1] ?? 0, center[2] ?? 0);
|
|
195
|
-
camera.setPosition(
|
|
196
|
-
(center[0] ?? 0) + (normDir[0] ?? 0) * distance,
|
|
197
|
-
(center[1] ?? 0) + (normDir[1] ?? 0) * distance,
|
|
198
|
-
(center[2] ?? 0) + (normDir[2] ?? 0) * distance,
|
|
199
|
-
);
|
|
200
|
-
if (mainCam.view_up) {
|
|
201
|
-
const [viewUpX = 0, viewUpY = 0, viewUpZ = 0] = mainCam.view_up;
|
|
202
|
-
camera.setViewUp(viewUpX, viewUpY, viewUpZ);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
78
|
export {
|
|
207
79
|
AXIS_SCALE,
|
|
208
80
|
SIZE_RATIO,
|
|
@@ -213,10 +85,11 @@ export {
|
|
|
213
85
|
getPlaneCssColor,
|
|
214
86
|
hasPlaneChanged,
|
|
215
87
|
getPlaneStyle,
|
|
88
|
+
};
|
|
89
|
+
export {
|
|
216
90
|
computeSceneBounds,
|
|
217
91
|
computeSceneBoundsInfo,
|
|
218
92
|
resolveActiveActors,
|
|
219
93
|
alignCameraToMainCamera,
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
export type { SceneBoundsInfo, MainCameraOptions };
|
|
94
|
+
} from "./clipping_planes_scene";
|
|
95
|
+
export type { SceneBoundsInfo, MainCameraOptions } from "./clipping_planes_scene";
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { Bounds } from "@kitware/vtk.js/types";
|
|
2
|
+
import type vtkActor from "@kitware/vtk.js/Rendering/Core/Actor";
|
|
3
|
+
import type { vtkCamera } from "@kitware/vtk.js/Rendering/Core/Camera";
|
|
4
|
+
|
|
5
|
+
function computeSceneBounds(actors: readonly vtkActor[]): Bounds {
|
|
6
|
+
let bounds: Bounds = [Infinity, -Infinity, Infinity, -Infinity, Infinity, -Infinity];
|
|
7
|
+
for (const actor of actors) {
|
|
8
|
+
const boundsOfActor = actor.getBounds();
|
|
9
|
+
bounds = [
|
|
10
|
+
Math.min(bounds[0], boundsOfActor[0]),
|
|
11
|
+
Math.max(bounds[1], boundsOfActor[1]),
|
|
12
|
+
Math.min(bounds[2], boundsOfActor[2]),
|
|
13
|
+
Math.max(bounds[3], boundsOfActor[3]),
|
|
14
|
+
Math.min(bounds[4], boundsOfActor[4]),
|
|
15
|
+
Math.max(bounds[5], boundsOfActor[5]),
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
return bounds;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface SceneBoundsInfo {
|
|
22
|
+
readonly center: readonly number[];
|
|
23
|
+
readonly cubicBounds: readonly number[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function computeSceneBoundsInfo(actors: readonly vtkActor[]): SceneBoundsInfo {
|
|
27
|
+
if (actors.length === 0) {
|
|
28
|
+
return { center: [0, 0, 0], cubicBounds: [-1, 1, -1, 1, -1, 1] };
|
|
29
|
+
}
|
|
30
|
+
const [xmin, xmax, ymin, ymax, zmin, zmax] = computeSceneBounds(actors);
|
|
31
|
+
const center = [
|
|
32
|
+
Number(((xmin + xmax) / 2).toFixed(4)),
|
|
33
|
+
Number(((ymin + ymax) / 2).toFixed(4)),
|
|
34
|
+
Number(((zmin + zmax) / 2).toFixed(4)),
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
const maxActorExtent = Math.max(
|
|
38
|
+
...actors.map((actor: vtkActor) => {
|
|
39
|
+
const bounds = actor.getBounds();
|
|
40
|
+
return Math.max(bounds[1] - bounds[0], bounds[3] - bounds[2], bounds[5] - bounds[4]);
|
|
41
|
+
}),
|
|
42
|
+
);
|
|
43
|
+
const halfExtent = maxActorExtent / 2;
|
|
44
|
+
const [centerX = 0, centerY = 0, centerZ = 0] = center;
|
|
45
|
+
const cubicBounds = [
|
|
46
|
+
centerX - halfExtent,
|
|
47
|
+
centerX + halfExtent,
|
|
48
|
+
centerY - halfExtent,
|
|
49
|
+
centerY + halfExtent,
|
|
50
|
+
centerZ - halfExtent,
|
|
51
|
+
centerZ + halfExtent,
|
|
52
|
+
];
|
|
53
|
+
return { center, cubicBounds };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface ActorEntry {
|
|
57
|
+
readonly actor: vtkActor;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface MainCameraOptions {
|
|
61
|
+
readonly focal_point?: readonly number[];
|
|
62
|
+
readonly position?: readonly number[];
|
|
63
|
+
readonly view_up?: readonly number[];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function resolveActiveActors(
|
|
67
|
+
targetAllVisible: boolean,
|
|
68
|
+
allItems: readonly { readonly id: string }[],
|
|
69
|
+
selectedDatasetIds: readonly string[],
|
|
70
|
+
hybridDb: Record<string, ActorEntry | undefined>,
|
|
71
|
+
): vtkActor[] {
|
|
72
|
+
let targetIds: readonly string[] = selectedDatasetIds;
|
|
73
|
+
if (targetAllVisible) {
|
|
74
|
+
targetIds = allItems.map((item: { id: string }) => item.id);
|
|
75
|
+
}
|
|
76
|
+
const targeted = targetIds
|
|
77
|
+
.map((id) => hybridDb[id]?.actor)
|
|
78
|
+
.filter((actor: vtkActor | undefined): actor is vtkActor => actor !== undefined);
|
|
79
|
+
if (targeted.length > 0) {
|
|
80
|
+
return targeted;
|
|
81
|
+
}
|
|
82
|
+
return Object.values(hybridDb)
|
|
83
|
+
.filter((entry: ActorEntry | undefined): entry is ActorEntry => entry !== undefined)
|
|
84
|
+
.map((entry: ActorEntry) => entry.actor);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function computeNormalizedViewDirection(
|
|
88
|
+
focalPoint: readonly number[],
|
|
89
|
+
position: readonly number[],
|
|
90
|
+
): readonly number[] | undefined {
|
|
91
|
+
const dir = [
|
|
92
|
+
(position[0] ?? 0) - (focalPoint[0] ?? 0),
|
|
93
|
+
(position[1] ?? 0) - (focalPoint[1] ?? 0),
|
|
94
|
+
(position[2] ?? 0) - (focalPoint[2] ?? 0),
|
|
95
|
+
];
|
|
96
|
+
const dirLen = Math.hypot(...dir);
|
|
97
|
+
if (dirLen === 0) {
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
return dir.map((component) => component / dirLen);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Aligns the local clipping-plane preview camera onto the same viewing direction as the
|
|
104
|
+
// Main viewer camera, re-centered on the clipped scene's bounds.
|
|
105
|
+
function alignCameraToMainCamera(
|
|
106
|
+
camera: vtkCamera,
|
|
107
|
+
mainCam: MainCameraOptions,
|
|
108
|
+
center: readonly number[],
|
|
109
|
+
): void {
|
|
110
|
+
if (!mainCam.focal_point || !mainCam.position) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const normDir = computeNormalizedViewDirection(mainCam.focal_point, mainCam.position);
|
|
114
|
+
if (!normDir) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const distance = camera.getDistance();
|
|
118
|
+
camera.setFocalPoint(center[0] ?? 0, center[1] ?? 0, center[2] ?? 0);
|
|
119
|
+
camera.setPosition(
|
|
120
|
+
(center[0] ?? 0) + (normDir[0] ?? 0) * distance,
|
|
121
|
+
(center[1] ?? 0) + (normDir[1] ?? 0) * distance,
|
|
122
|
+
(center[2] ?? 0) + (normDir[2] ?? 0) * distance,
|
|
123
|
+
);
|
|
124
|
+
if (mainCam.view_up) {
|
|
125
|
+
const [viewUpX = 0, viewUpY = 0, viewUpZ = 0] = mainCam.view_up;
|
|
126
|
+
camera.setViewUp(viewUpX, viewUpY, viewUpZ);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export { alignCameraToMainCamera, computeSceneBounds, computeSceneBoundsInfo, resolveActiveActors };
|
|
131
|
+
export type { MainCameraOptions, SceneBoundsInfo };
|
|
@@ -10,6 +10,20 @@ function parseComponent(val: string, max = RGB_MAX): number {
|
|
|
10
10
|
return Number(val);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
function clampChannel(value: number): number {
|
|
14
|
+
return Math.min(RGB_MAX, Math.max(0, Math.round(value)));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function parseAlpha(alphaText: string | undefined): number {
|
|
18
|
+
if (alphaText === undefined) {
|
|
19
|
+
return 1;
|
|
20
|
+
}
|
|
21
|
+
const rawAlpha = parseComponent(alphaText, 1);
|
|
22
|
+
const calculatedAlpha = rawAlpha > 1 ? rawAlpha / RGB_MAX : rawAlpha;
|
|
23
|
+
const roundedAlpha = Number(calculatedAlpha.toFixed(2));
|
|
24
|
+
return Math.min(1, Math.max(0, roundedAlpha));
|
|
25
|
+
}
|
|
26
|
+
|
|
13
27
|
function parseColorString(colorText: string): RGBAColor | undefined {
|
|
14
28
|
if (colorText === "") {
|
|
15
29
|
return undefined;
|
|
@@ -21,21 +35,10 @@ function parseColorString(colorText: string): RGBAColor | undefined {
|
|
|
21
35
|
}
|
|
22
36
|
|
|
23
37
|
const [redText = "", greenText = "", blueText = "", alphaText] = numbersMatch;
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
const red = Math.min(RGB_MAX, Math.max(0, Math.round(rawRed)));
|
|
29
|
-
const green = Math.min(RGB_MAX, Math.max(0, Math.round(rawGreen)));
|
|
30
|
-
const blue = Math.min(RGB_MAX, Math.max(0, Math.round(rawBlue)));
|
|
31
|
-
|
|
32
|
-
let alpha = 1;
|
|
33
|
-
if (alphaText !== undefined) {
|
|
34
|
-
const rawAlpha = parseComponent(alphaText, 1);
|
|
35
|
-
const calculatedAlpha = rawAlpha > 1 ? rawAlpha / RGB_MAX : rawAlpha;
|
|
36
|
-
const roundedAlpha = Number(calculatedAlpha.toFixed(2));
|
|
37
|
-
alpha = Math.min(1, Math.max(0, roundedAlpha));
|
|
38
|
-
}
|
|
38
|
+
const red = clampChannel(parseComponent(redText));
|
|
39
|
+
const green = clampChannel(parseComponent(greenText));
|
|
40
|
+
const blue = clampChannel(parseComponent(blueText));
|
|
41
|
+
const alpha = parseAlpha(alphaText);
|
|
39
42
|
|
|
40
43
|
if (Number.isNaN(red) || Number.isNaN(green) || Number.isNaN(blue) || Number.isNaN(alpha)) {
|
|
41
44
|
return undefined;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { AttributeSchemas } from "@ogw_front/utils/attribute_range";
|
|
2
|
+
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
|
|
3
|
+
|
|
4
|
+
interface Schemas {
|
|
5
|
+
vertex?: AttributeSchemas;
|
|
6
|
+
edge?: AttributeSchemas;
|
|
7
|
+
cell?: AttributeSchemas;
|
|
8
|
+
polygon?: AttributeSchemas;
|
|
9
|
+
polyhedron?: AttributeSchemas;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface ColoringStyle {
|
|
13
|
+
name: string;
|
|
14
|
+
value: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface ColoringAvailability {
|
|
18
|
+
color: boolean;
|
|
19
|
+
textures: boolean;
|
|
20
|
+
vertex: boolean;
|
|
21
|
+
edge: boolean;
|
|
22
|
+
cell: boolean;
|
|
23
|
+
polygon: boolean;
|
|
24
|
+
polyhedron: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const COLORING_STYLES = {
|
|
28
|
+
color: { name: "Constant", value: "constant" },
|
|
29
|
+
random: { name: "Random", value: "random" },
|
|
30
|
+
textures: { name: "Textures", value: "textures" },
|
|
31
|
+
vertex: { name: "Vertex attribute", value: "vertex" },
|
|
32
|
+
edge: { name: "Edge attribute", value: "edge" },
|
|
33
|
+
cell: { name: "Cell attribute", value: "cell" },
|
|
34
|
+
polygon: { name: "Polygon attribute", value: "polygon" },
|
|
35
|
+
polyhedron: {
|
|
36
|
+
name: "Polyhedron attribute",
|
|
37
|
+
value: "polyhedron",
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const ATTRIBUTE_STYLE_KEYS = [
|
|
42
|
+
"textures",
|
|
43
|
+
"vertex",
|
|
44
|
+
"edge",
|
|
45
|
+
"cell",
|
|
46
|
+
"polygon",
|
|
47
|
+
"polyhedron",
|
|
48
|
+
] as const;
|
|
49
|
+
|
|
50
|
+
function buildColoringStyles(
|
|
51
|
+
available: ColoringAvailability,
|
|
52
|
+
allowRandom: boolean,
|
|
53
|
+
): { labels: string[]; values: string[] } {
|
|
54
|
+
const array: ColoringStyle[] = [];
|
|
55
|
+
if (available.color) {
|
|
56
|
+
array.push(COLORING_STYLES.color);
|
|
57
|
+
if (allowRandom) {
|
|
58
|
+
array.push(COLORING_STYLES.random);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
for (const key of ATTRIBUTE_STYLE_KEYS) {
|
|
62
|
+
if (available[key]) {
|
|
63
|
+
array.push(COLORING_STYLES[key]);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const labels = array.map((coloring) => coloring.name);
|
|
68
|
+
const values = array.map((coloring) => coloring.value);
|
|
69
|
+
|
|
70
|
+
return { labels, values };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// The attribute schemas of the props, each defaulting to the ones of the mesh elements
|
|
74
|
+
function resolveAttributeSchemas(schemas: Schemas): Required<Schemas> {
|
|
75
|
+
const backSchemas = back_schemas.opengeodeweb_back;
|
|
76
|
+
return {
|
|
77
|
+
vertex: schemas.vertex ?? {
|
|
78
|
+
names: backSchemas.vertex_attribute_names,
|
|
79
|
+
range: backSchemas.vertex_attribute_range,
|
|
80
|
+
},
|
|
81
|
+
edge: schemas.edge ?? {
|
|
82
|
+
names: backSchemas.edge_attribute_names,
|
|
83
|
+
range: backSchemas.edge_attribute_range,
|
|
84
|
+
},
|
|
85
|
+
cell: schemas.cell ?? {
|
|
86
|
+
names: backSchemas.cell_attribute_names,
|
|
87
|
+
range: backSchemas.cell_attribute_range,
|
|
88
|
+
},
|
|
89
|
+
polygon: schemas.polygon ?? {
|
|
90
|
+
names: backSchemas.polygon_attribute_names,
|
|
91
|
+
range: backSchemas.polygon_attribute_range,
|
|
92
|
+
},
|
|
93
|
+
polyhedron: schemas.polyhedron ?? {
|
|
94
|
+
names: backSchemas.polyhedron_attribute_names,
|
|
95
|
+
range: backSchemas.polyhedron_attribute_range,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export { COLORING_STYLES, buildColoringStyles, resolveAttributeSchemas };
|
|
101
|
+
export type { Schemas };
|
package/app/utils/crs.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { CrsItem, NewDataItem } from "@ogw_front/stores/data";
|
|
2
|
+
import type { CRSList } from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
|
|
3
|
+
|
|
4
|
+
function formatCrs(crs: CRSList | undefined): string {
|
|
5
|
+
return crs ? `${crs.authority}:${crs.code} — ${crs.name}` : "None";
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// Code alone, for narrow places: the full name goes in a tooltip
|
|
9
|
+
function formatCrsCode(crs: CRSList | undefined): string {
|
|
10
|
+
return crs ? `${crs.authority}:${crs.code}` : "None";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// The name is only a label: two CRS are the same when their authority code is
|
|
14
|
+
function sameCrs(left: CRSList | undefined, right: CRSList | undefined): boolean {
|
|
15
|
+
return (
|
|
16
|
+
left !== undefined &&
|
|
17
|
+
right !== undefined &&
|
|
18
|
+
left.authority === right.authority &&
|
|
19
|
+
left.code === right.code
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Same CRS, or both still in local coordinates
|
|
24
|
+
function sameCrsState(left: CRSList | undefined, right: CRSList | undefined): boolean {
|
|
25
|
+
return (left === undefined && right === undefined) || sameCrs(left, right);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// The CRS of the oldest georeferenced data: the project CRS of a project saved before it was stored
|
|
29
|
+
function oldestCrs(
|
|
30
|
+
items: readonly Pick<CrsItem, "crs" | "created_at">[] | readonly NewDataItem[],
|
|
31
|
+
): CRSList | undefined {
|
|
32
|
+
return items
|
|
33
|
+
.filter((item) => item.crs !== undefined)
|
|
34
|
+
.toSorted((left, right) => (left.created_at ?? "").localeCompare(right.created_at ?? ""))[0]
|
|
35
|
+
?.crs;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { formatCrs, formatCrsCode, oldestCrs, sameCrs, sameCrsState };
|
|
@@ -53,6 +53,12 @@ const DEFAULT_MODEL_COMPONENT_TYPE_COLORS: Record<string, RGBAColor> = {
|
|
|
53
53
|
|
|
54
54
|
const DEFAULT_NO_DATA_COLOR: RGBAColor = { red: 128, green: 128, blue: 128, alpha: 1 };
|
|
55
55
|
|
|
56
|
+
// Scene
|
|
57
|
+
const SCENE_DEFAULT_BACKGROUND_COLOR: RGBAColor = { red: 180, green: 180, blue: 180, alpha: 1 };
|
|
58
|
+
const SCENE_DEFAULT_TEXT_COLOR: RGBAColor = { red: 0, green: 0, blue: 0, alpha: 1 };
|
|
59
|
+
const SCENE_DEFAULT_FONT_FAMILY = "arial";
|
|
60
|
+
const SCENE_DEFAULT_ORIENTATION_WIDGET = "axes";
|
|
61
|
+
|
|
56
62
|
export type { RGBAColor, AttributeConfig };
|
|
57
63
|
export {
|
|
58
64
|
POINTS_DEFAULT_VISIBILITY,
|
|
@@ -85,4 +91,8 @@ export {
|
|
|
85
91
|
MESH_DEFAULT_ACTIVE_COLORING,
|
|
86
92
|
MODEL_DEFAULT_ACTIVE_COLORING,
|
|
87
93
|
DEFAULT_NO_DATA_COLOR,
|
|
94
|
+
SCENE_DEFAULT_BACKGROUND_COLOR,
|
|
95
|
+
SCENE_DEFAULT_TEXT_COLOR,
|
|
96
|
+
SCENE_DEFAULT_FONT_FAMILY,
|
|
97
|
+
SCENE_DEFAULT_ORIENTATION_WIDGET,
|
|
88
98
|
};
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SCENE_DEFAULT_BACKGROUND_COLOR,
|
|
3
|
+
SCENE_DEFAULT_FONT_FAMILY,
|
|
4
|
+
SCENE_DEFAULT_ORIENTATION_WIDGET,
|
|
5
|
+
SCENE_DEFAULT_TEXT_COLOR,
|
|
6
|
+
} from "./constants";
|
|
1
7
|
import {
|
|
2
8
|
brepDefaultStyle,
|
|
3
9
|
crossSectionDefaultStyle,
|
|
@@ -14,6 +20,7 @@ import {
|
|
|
14
20
|
solidDefaultStyle,
|
|
15
21
|
surfaceDefaultStyle,
|
|
16
22
|
} from "./meshes";
|
|
23
|
+
import type { SceneStyle } from "@ogw_internal/stores/data_style/types";
|
|
17
24
|
|
|
18
25
|
function default_styles(): Record<string, unknown> {
|
|
19
26
|
return {
|
|
@@ -50,6 +57,15 @@ function getDefaultStyle(type: string): unknown {
|
|
|
50
57
|
return styles[type];
|
|
51
58
|
}
|
|
52
59
|
|
|
60
|
+
function getDefaultSceneStyle(): SceneStyle {
|
|
61
|
+
return {
|
|
62
|
+
id: "scene",
|
|
63
|
+
background_color: { ...SCENE_DEFAULT_BACKGROUND_COLOR },
|
|
64
|
+
text: { color: { ...SCENE_DEFAULT_TEXT_COLOR }, font_family: SCENE_DEFAULT_FONT_FAMILY },
|
|
65
|
+
orientation_widget: SCENE_DEFAULT_ORIENTATION_WIDGET,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
53
69
|
export { DEFAULT_MODEL_COMPONENT_TYPE_STYLES } from "./models";
|
|
54
70
|
export {
|
|
55
71
|
MESH_COMPONENT_TYPES,
|
|
@@ -58,4 +74,4 @@ export {
|
|
|
58
74
|
MODEL_DEFAULT_ACTIVE_COLORING,
|
|
59
75
|
DEFAULT_NO_DATA_COLOR,
|
|
60
76
|
} from "./constants";
|
|
61
|
-
export { getDefaultStyle };
|
|
77
|
+
export { getDefaultSceneStyle, getDefaultStyle };
|