Skip to content

Commit 8fddeab

Browse files
authored
Merge pull request #153 from Geode-solutions/fix/GridScaleDataHidden
fix(GridScale): Grid scale fit to the data visible
2 parents 2ae5652 + cfe9d5a commit 8fddeab

2 files changed

Lines changed: 19 additions & 12 deletions

File tree

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,3 @@ wslink==1.12.4
6161
yarl>=1
6262
# via aiohttp
6363

64-
opengeodeweb-microservice==1.*,>=1.1.3

src/opengeodeweb_viewer/vtk_protocol.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,18 +183,26 @@ def update_grid_scale_and_clipping_range(self) -> None:
183183
grid_scale = self.get_grid_scale()
184184
if grid_scale is not None:
185185
renderer = self.get_renderer()
186-
bounds = vtkBoundingBox()
187-
props = renderer.GetViewProps()
188-
props.InitTraversal()
189-
prop = props.GetNextProp()
190-
while prop:
191-
if prop.GetUseBounds() and prop != grid_scale:
192-
bounds.AddBounds(prop.GetBounds())
186+
if not grid_scale.GetVisibility():
187+
bounds = vtkBoundingBox()
188+
props = renderer.GetViewProps()
189+
props.InitTraversal()
193190
prop = props.GetNextProp()
194-
if bounds.IsValid():
195-
final_bounds = [0.0] * 6
196-
bounds.GetBounds(final_bounds)
197-
grid_scale.SetBounds(final_bounds)
191+
while prop:
192+
if (
193+
prop.GetVisibility()
194+
and prop.GetUseBounds()
195+
and prop != grid_scale
196+
):
197+
bounds.AddBounds(prop.GetBounds())
198+
prop = props.GetNextProp()
199+
if bounds.IsValid():
200+
final_bounds = [0.0] * 6
201+
bounds.GetBounds(final_bounds)
202+
grid_scale.SetBounds(final_bounds)
203+
204+
final_bounds = list(grid_scale.GetBounds())
205+
if final_bounds[0] <= final_bounds[1]:
198206

199207
def get_dist(axis: int) -> float:
200208
p1 = [final_bounds[0], final_bounds[2], final_bounds[4]]

0 commit comments

Comments
 (0)