Route_test.py
Go to the documentation of this file.
1 #==============================================================================
2 # Copyright (C) 2021-2024 Wageningen University - All Rights Reserved
3 # Author: Gonzalo Mier
4 # BSD-3 License
5 #==============================================================================
6 
7 import pytest
8 import fields2cover as f2c
9 
10 def near(a, b):
11  assert pytest.approx(a) == pytest.approx(b)
12 
14  assert (f2c.Route().asLineString().isEmpty());
15  route = f2c.Route();
16  route.addConnection(f2c.MultiPoint(
17  f2c.VectorPoint([f2c.Point(0, 0)])));
18  swaths1 = f2c.Swaths();
19  swaths1.push_back(f2c.Swath(f2c.LineString(f2c.VectorPoint(
20  [f2c.Point(0, 0), f2c.Point(1, 0)])), 4));
21  route.addSwaths(swaths1);
22  route.addConnection(f2c.MultiPoint(f2c.VectorPoint(
23  [f2c.Point(1, 0), f2c.Point(1, 1)])));
24  swaths2 = f2c.Swaths();
25  swaths2.push_back(f2c.Swath(f2c.LineString(f2c.VectorPoint(
26  [f2c.Point(1, 1), f2c.Point(0, 1)])), 4));
27  route.addSwaths(swaths2);
28  route.addConnection(f2c.MultiPoint());
29  assert not (route.asLineString().isEmpty());
30  near(route.asLineString().length(), 3);
31 
32 
Route_test.test_fields2cover_types_route_init
def test_fields2cover_types_route_init()
Definition: Route_test.py:13
Route_test.near
def near(a, b)
Definition: Route_test.py:10


fields2cover
Author(s):
autogenerated on Fri Apr 25 2025 02:18:31