Skip to content

Commit 97a9426

Browse files
committed
cleanup
1 parent e787fb5 commit 97a9426

2 files changed

Lines changed: 7 additions & 29 deletions

File tree

src/opengeodeweb_viewer/rpc/viewer/viewer_protocols.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -274,17 +274,10 @@ def pickedIds(self, rpc_params: RpcParams) -> dict[str, list[str] | int | None]:
274274
]
275275
if not array_ids:
276276
return {"array_ids": [], "viewer_id": None}
277-
# Map flat_index to None if it is -1 (no composite block picked)
278277
viewer_id = flat_index if flat_index != -1 else None
279278
if viewer_id is not None:
280279
pipeline = self.get_vtk_pipeline(array_ids[0])
281-
# Verify composite block visibility (discard pick if block is hidden)
282-
dataset, geode_id, is_visible = self.get_composite_block_info(
283-
pipeline, picker
284-
)
285-
if not is_visible:
286-
return {"array_ids": [], "viewer_id": None}
287-
280+
dataset, geode_id = self.get_composite_block_info(pipeline, picker)
288281
return {
289282
"array_ids": array_ids,
290283
"viewer_id": viewer_id,
@@ -342,26 +335,19 @@ def setHighlight(
342335
rpc_params, self.viewer_schemas_dict["highlight"], self.viewer_prefix
343336
)
344337
params = schemas.Highlight.from_dict(rpc_params)
345-
346338
# Clear previous highlights
347339
self.clear_highlights(params.ids)
348340
picker = vtkCellPicker(tolerance=0.005)
349-
350341
# Perform pick operation to identify clicked pipeline and primitive ID
351342
data_id, id_to_select = self.pick_cell_or_point(
352343
params.ids, params.x, params.y, params.field_type.value, picker
353344
)
354345
if not data_id or id_to_select == -1:
355346
self.render(-1)
356347
return {}
357-
358-
# Retrieve picked composite block information and check block visibility
348+
# Retrieve picked composite block information
359349
pipeline = self.get_vtk_pipeline(data_id)
360-
dataset, geode_id, is_visible = self.get_composite_block_info(pipeline, picker)
361-
if not is_visible:
362-
self.render(-1)
363-
return {}
364-
350+
dataset, geode_id = self.get_composite_block_info(pipeline, picker)
365351
# Update highlight visibility and extract attributes from the picked element
366352
self.update_highlight(pipeline, id_to_select, params.field_type.value, dataset)
367353
self.render(-1)

src/opengeodeweb_viewer/vtk_protocol.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ def pick_cell_or_point(
218218
picker.Pick(x, y, 0, self.get_renderer())
219219
finally:
220220
self.swap_pick_mappers(data_ids, use_pick_mapper=False)
221-
222221
actor = picker.GetActor()
223222
# Find which pipeline owns the picked actor
224223
data_id = next(
@@ -256,27 +255,20 @@ def pick_actors_under_coordinate(
256255

257256
def get_composite_block_info(
258257
self, pipeline: VtkPipeline, picker: vtkCellPicker
259-
) -> tuple[vtkDataObject | None, str | None, bool]:
258+
) -> tuple[vtkDataObject | None, str | None]:
260259
# Extract the specific block dataset and metadata from a picked composite flat index
261260
if not isinstance(pipeline.mapper, vtkCompositePolyDataMapper):
262-
return None, None, True
261+
return None, None
263262
flat_index = picker.GetFlatBlockIndex()
264263
if not (0 <= flat_index < len(pipeline.blockDataSets)):
265-
return None, None, True
266-
264+
return None, None
267265
dataset = pipeline.blockDataSets[flat_index]
268-
if dataset:
269-
# Extra safety check on the display visibility attribute
270-
attr = pipeline.mapper.GetCompositeDataDisplayAttributes()
271-
if attr and not attr.GetBlockVisibility(dataset):
272-
return None, None, False
273-
274266
geode_id = (
275267
pipeline.blockGeodeIds[flat_index]
276268
if flat_index < len(pipeline.blockGeodeIds)
277269
else None
278270
)
279-
return dataset, geode_id, True
271+
return dataset, geode_id
280272

281273
def get_array_values(self, array: Any, id_to_select: int) -> list[float] | float:
282274
components = array.GetNumberOfComponents()

0 commit comments

Comments
 (0)