1+ // Third party imports
12import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
3+
4+ // Local constants
25const mesh_polygons_schemas = viewer_schemas . opengeodeweb_viewer . mesh . polygons
36
47export function useMeshPolygonsStyle ( ) {
@@ -19,7 +22,9 @@ export function useMeshPolygonsStyle() {
1922 response_function : ( ) => {
2023 polygons_style . visibility = visibility
2124 console . log (
22- `${ setMeshPolygonsVisibility . name } ${ id } ${ meshPolygonsVisibility ( id ) } ` ,
25+ setMeshPolygonsVisibility . name ,
26+ { id } ,
27+ meshPolygonsVisibility ( id ) ,
2328 )
2429 } ,
2530 } ,
@@ -37,7 +42,9 @@ export function useMeshPolygonsStyle() {
3742 response_function : ( ) => {
3843 coloring_style . color = color
3944 console . log (
40- `${ setMeshPolygonsColor . name } ${ id } ${ JSON . stringify ( meshPolygonsColor ( id ) ) } ` ,
45+ setMeshPolygonsColor . name ,
46+ { id } ,
47+ JSON . stringify ( meshPolygonsColor ( id ) ) ,
4148 )
4249 } ,
4350 } ,
@@ -58,7 +65,9 @@ export function useMeshPolygonsStyle() {
5865 response_function : ( ) => {
5966 coloring_style . textures = textures
6067 console . log (
61- `${ setMeshPolygonsTextures . name } ${ id } ${ meshPolygonsTextures ( id ) } ` ,
68+ setMeshPolygonsTextures . name ,
69+ { id } ,
70+ meshPolygonsTextures ( id ) ,
6271 )
6372 } ,
6473 } ,
@@ -80,7 +89,9 @@ export function useMeshPolygonsStyle() {
8089 response_function : ( ) => {
8190 coloring_style . vertex = vertex_attribute
8291 console . log (
83- `${ setMeshPolygonsVertexAttribute . name } ${ id } ${ meshPolygonsVertexAttribute ( id ) } ` ,
92+ setMeshPolygonsVertexAttribute . name ,
93+ { id } ,
94+ meshPolygonsVertexAttribute ( id ) ,
8495 )
8596 } ,
8697 } ,
@@ -101,7 +112,9 @@ export function useMeshPolygonsStyle() {
101112 response_function : ( ) => {
102113 coloring_style . polygon = polygon_attribute
103114 console . log (
104- `${ setMeshPolygonsPolygonAttribute . name } ${ id } ${ meshPolygonsPolygonAttribute ( id ) } ` ,
115+ setMeshPolygonsPolygonAttribute . name ,
116+ { id } ,
117+ meshPolygonsPolygonAttribute ( id ) ,
105118 )
106119 } ,
107120 } ,
@@ -115,7 +128,9 @@ export function useMeshPolygonsStyle() {
115128 const coloring = meshPolygonsStyle ( id ) . coloring
116129 coloring . active = type
117130 console . log (
118- `${ setMeshPolygonsActiveColoring . name } ${ id } ${ meshPolygonsActiveColoring ( id ) } ` ,
131+ setMeshPolygonsActiveColoring . name ,
132+ { id } ,
133+ meshPolygonsActiveColoring ( id ) ,
119134 )
120135 if ( type === "color" ) {
121136 return setMeshPolygonsColor ( id , coloring . color )
@@ -125,10 +140,13 @@ export function useMeshPolygonsStyle() {
125140 return setMeshPolygonsVertexAttribute ( id , coloring . vertex )
126141 } else if ( type === "polygon" && coloring . polygon !== null ) {
127142 return setMeshPolygonsPolygonAttribute ( id , coloring . polygon )
128- } else throw new Error ( "Unknown polygons coloring type: " + type )
143+ } else {
144+ throw new Error ( "Unknown mesh polygons coloring type: " + type )
145+ }
129146 }
130147
131- function applyMeshPolygonsStyle ( id , style ) {
148+ function applyMeshPolygonsStyle ( id ) {
149+ const style = meshPolygonsStyle ( id )
132150 return Promise . all ( [
133151 setMeshPolygonsVisibility ( id , style . visibility ) ,
134152 setMeshPolygonsActiveColoring ( id , style . coloring . active ) ,
0 commit comments