Skip to content

Commit

Permalink
Test for fillarea concave. (#319)
Browse files Browse the repository at this point in the history
* Support concave polygons for fillarea.

* Test for fillarea concave.

* Don't make doctest to avoid timeout.
  • Loading branch information
danlipsa authored and doutriaux1 committed Feb 26, 2018
1 parent 0a8ad62 commit 0aea5fb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,5 @@ script:
- rm -rf build
- python setup.py install --old-and-unmanageable
- python run_tests.py -n2 -g --no-vtk-ui
#- cd docs
#- make doctest
#- cd ..
after_success:
- if [ "$TRAVIS_BRANCH" == "master" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then conda install -n root conda-build anaconda-client && bash ci-support/conda_upload.sh ; fi
19 changes: 19 additions & 0 deletions tests/test_vcs_fillarea_concave.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import basevcstest


class TestVCSFillareaConcave(basevcstest.VCSBaseTest):
def test(self):
o = self.x.createfillarea()
xs = [-70.0, -66.0, -62.0, -58.0, -54.0, -50.0,
-46.0, -46.0, -50.0, -54.0, -58.0, -62.0,
-66.0, -70.0]
ys = [97.40004179212772, 99.24051369561087, 99.64501380920407,
99.50791666242807, 99.25809764862053, 98.72724999321828,
97.86243057250978, 66.1760279867384, 78.08891693751016,
84.6064443588257, 75.83586128552756, 54.88270839055378,
33.08841943740845, 32.207757042513954]
o.x = xs
o.y = ys
o.worldcoordinate = [-70,-35,30,100]
self.x.plot(o)
self.checkImage("test_vcs_fillarea_concave.png")
6 changes: 5 additions & 1 deletion vcs/vcs2vtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -1437,9 +1437,13 @@ def prepFillarea(context, renWin, farea, cmap=None):
# Transform points
geo, pts = project(pts, farea.projection, farea.worldcoordinate)
polygonPolyData.SetPoints(pts)
# for concave polygons
tris = vtk.vtkTriangleFilter()
tris.SetInputData(polygonPolyData)

# Setup rendering
m = vtk.vtkPolyDataMapper()
m.SetInputData(polygonPolyData)
m.SetInputConnection(tris.GetOutputPort())
a = vtk.vtkActor()
a.SetMapper(m)
ren, xscale, yscale = context.fitToViewport(a,
Expand Down

0 comments on commit 0aea5fb

Please sign in to comment.