Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,3 @@ wslink==2.6.0
yarl==1.*
# via aiohttp

opengeodeweb-microservice==1.*,>=1.3.3
24 changes: 23 additions & 1 deletion src/opengeodeweb_viewer/object/object_methods.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import logging
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Any

# Third party imports
from vtkmodules.vtkCommonCore import reference
from vtkmodules.vtkCommonDataModel import (
vtkDataSet,
vtkMultiBlockDataSet,
Expand All @@ -11,6 +12,7 @@
vtkActor,
vtkCompositePolyDataMapper,
vtkDataSetMapper,
vtkMapper,
)

# Local application imports
Expand All @@ -22,6 +24,9 @@

logger = logging.getLogger(__name__)

# Share of the gap between the polygons and lines offset factors given to the edges actors
EDGES_DEPTH_FACTOR_SHARE = 0.5


class VtkObjectView(VtkView):
def __init__(self) -> None:
Expand Down Expand Up @@ -262,13 +267,30 @@ def update_style_scalar_bars_visibility(self, pipeline: VtkPipeline) -> None:
)
)

@staticmethod
def match_edges_depth_to_polygons(mapper: vtkMapper) -> None:
# Edges drawn by their own wireframe actor are lines, and the global offsets push lines
# back less than polygons: the edges of a surface just behind another one showed through
# it. Halfway to the polygons' factor removes most of it; the full factor would hide wide
# edges behind their own surface on sharp folds.
polygon_factor: Any = reference(0.0)
polygon_units: Any = reference(0.0)
mapper.GetResolveCoincidentTopologyPolygonOffsetParameters(polygon_factor, polygon_units)
line_factor: Any = reference(0.0)
line_units: Any = reference(0.0)
mapper.GetResolveCoincidentTopologyLineOffsetParameters(line_factor, line_units)
mapper.SetRelativeCoincidentTopologyLineOffsetParameters(
EDGES_DEPTH_FACTOR_SHARE * (float(polygon_factor) - float(line_factor)), 0.0
)

def ensure_edges_actor(self, pipeline: VtkPipeline) -> vtkActor:
# Edges get their own actor so their scalars stay independent from the polygons
if pipeline.edges_actor is not None:
return pipeline.edges_actor
mapper = vtkDataSetMapper()
mapper.SetInputConnection(pipeline.filter.GetOutputPort())
mapper.ScalarVisibilityOff()
self.match_edges_depth_to_polygons(mapper)
actor = vtkActor()
actor.SetMapper(mapper)
actor.PickableOff()
Expand Down
1 change: 1 addition & 0 deletions src/opengeodeweb_viewer/rpc/model/model_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ def sync_edges_width_actors(self, pipeline: VtkPipeline) -> None:
mapper.SetInputDataObject(pipeline.mapper.GetInputDataObject(0, 0))
mapper.ScalarVisibilityOn()
mapper.SetColorModeToMapScalars()
self.match_edges_depth_to_polygons(mapper)
actor = vtkActor()
actor.SetMapper(mapper)
actor.PickableOff()
Expand Down
Binary file modified tests/data/images/model/edges/blocks_edges_color.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/data/images/model/edges/surface_edges_width.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/data/images/model/edges/surfaces_edges_attribute.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/data/images/model/edges/surfaces_edges_behind_surface.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/data/images/model/edges/surfaces_edges_color.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/data/images/model/edges/surfaces_edges_explode.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/data/images/model/edges/width_after_component_width.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading