Beispiel #1
0
    def testTopologyTwoVertices(self):
        topology = TerrainTopology()
        topology.addGeometries([vertices_1, vertices_2])

        self.assertEqual(len(topology.vertices), 5)
        self.assertEqual(len(topology.faces), 2)

        # Make sure no extra vertice is inserted
        self.assertEqual(topology.vertices[1][0], vertices_2[0][0])
        self.assertEqual(topology.vertices[1][1], vertices_2[0][1])
        self.assertEqual(topology.vertices[1][2], vertices_2[0][2])

        self.assertEqual(topology.faces[1][0], 1)
        self.assertEqual(topology.faces[1][1], 3)
        self.assertEqual(topology.faces[1][2], 4)

        self.assertEqual(len(topology.indexData), 6)
        self.assertEqual(len(topology.uVertex), 5)
        self.assertEqual(len(topology.vVertex), 5)
        self.assertEqual(len(topology.hVertex), 5)

        self.assertEqual(topology.minLon, 1.2)
        self.assertEqual(topology.minLat, 1.1)
        self.assertEqual(topology.minHeight, 1.1)
        self.assertEqual(topology.maxLon, 3.2)
        self.assertEqual(topology.maxLat, 3.1)
        self.assertEqual(topology.maxHeight, 4.5)
    def testTopologyTwoVertices(self):
        topology = TerrainTopology()
        topology.addGeometries([vertices_1, vertices_2])

        self.assertEqual(len(topology.vertices), 5)
        self.assertEqual(len(topology.faces), 2)

        # Make sure no extra vertice is inserted
        self.assertEqual(topology.vertices[1][0], vertices_2[0][0])
        self.assertEqual(topology.vertices[1][1], vertices_2[0][1])
        self.assertEqual(topology.vertices[1][2], vertices_2[0][2])

        self.assertEqual(topology.faces[1][0], 1)
        self.assertEqual(topology.faces[1][1], 3)
        self.assertEqual(topology.faces[1][2], 4)

        self.assertEqual(len(topology.indexData), 6)
        self.assertEqual(len(topology.uVertex), 5)
        self.assertEqual(len(topology.vVertex), 5)
        self.assertEqual(len(topology.hVertex), 5)

        self.assertEqual(topology.minLon, 1.2)
        self.assertEqual(topology.minLat, 1.1)
        self.assertEqual(topology.minHeight, 1.1)
        self.assertEqual(topology.maxLon, 3.2)
        self.assertEqual(topology.maxLat, 3.1)
        self.assertEqual(topology.maxHeight, 4.5)
Beispiel #3
0
    def testTopologyOneVertex(self):
        topology = TerrainTopology()
        topology.addGeometries([vertices_1])

        topologyWKT = TerrainTopology()
        topologyWKT.addGeometries([wkt_1])

        topologyWKB = TerrainTopology()
        topologyWKB.addGeometries([wkb_1])

        self.assertIsInstance(topology.__repr__(), str)
        self.assertIsInstance(topology.__repr__(), str)
        self.assertIsInstance(topology.__repr__(), str)

        self.assertEqual(len(topology.vertices), 3)
        self.assertEqual(len(topology.faces), 1)

        self.assertEqual(topology.vertices[0][0], vertices_1[0][0])
        self.assertEqual(topology.vertices[0][1], vertices_1[0][1])
        self.assertEqual(topology.vertices[0][2], vertices_1[0][2])

        self.assertEqual(topology.vertices[1][0], vertices_1[1][0])
        self.assertEqual(topology.vertices[1][1], vertices_1[1][1])
        self.assertEqual(topology.vertices[1][2], vertices_1[1][2])

        # Test if from vertices and from wkt give the same result
        self.assertEqual(topology.vertices[0][0], topologyWKT.vertices[0][0])
        self.assertEqual(topology.vertices[0][1], topologyWKT.vertices[0][1])
        self.assertEqual(topology.vertices[0][2], topologyWKT.vertices[0][2])

        self.assertEqual(topology.vertices[1][0], topologyWKT.vertices[1][0])
        self.assertEqual(topology.vertices[1][1], topologyWKT.vertices[1][1])
        self.assertEqual(topology.vertices[1][2], topologyWKT.vertices[1][2])

        # Test if from wkt and from wkb give the same result
        self.assertEqual(topologyWKT.vertices[0][0],
                         topologyWKB.vertices[0][0])
        self.assertEqual(topologyWKT.vertices[0][1],
                         topologyWKB.vertices[0][1])
        self.assertEqual(topologyWKT.vertices[0][2],
                         topologyWKB.vertices[0][2])

        self.assertEqual(topologyWKT.vertices[1][0],
                         topologyWKB.vertices[1][0])
        self.assertEqual(topologyWKT.vertices[1][1],
                         topologyWKB.vertices[1][1])
        self.assertEqual(topologyWKT.vertices[1][2],
                         topologyWKB.vertices[1][2])
    def testTopologyOneVertex(self):
        topology = TerrainTopology()
        topology.addGeometries([vertices_1])

        topologyWKT = TerrainTopology()
        topologyWKT.addGeometries([wkt_1])

        topologyWKB = TerrainTopology()
        topologyWKB.addGeometries([wkb_1])

        self.assertIsInstance(topology.__repr__(), str)
        self.assertIsInstance(topology.__repr__(), str)
        self.assertIsInstance(topology.__repr__(), str)

        self.assertEqual(len(topology.vertices), 3)
        self.assertEqual(len(topology.faces), 1)

        self.assertEqual(topology.vertices[0][0], vertices_1[0][0])
        self.assertEqual(topology.vertices[0][1], vertices_1[0][1])
        self.assertEqual(topology.vertices[0][2], vertices_1[0][2])

        self.assertEqual(topology.vertices[1][0], vertices_1[1][0])
        self.assertEqual(topology.vertices[1][1], vertices_1[1][1])
        self.assertEqual(topology.vertices[1][2], vertices_1[1][2])

        # Test if from vertices and from wkt give the same result
        self.assertEqual(topology.vertices[0][0], topologyWKT.vertices[0][0])
        self.assertEqual(topology.vertices[0][1], topologyWKT.vertices[0][1])
        self.assertEqual(topology.vertices[0][2], topologyWKT.vertices[0][2])

        self.assertEqual(topology.vertices[1][0], topologyWKT.vertices[1][0])
        self.assertEqual(topology.vertices[1][1], topologyWKT.vertices[1][1])
        self.assertEqual(topology.vertices[1][2], topologyWKT.vertices[1][2])

        # Test if from wkt and from wkb give the same result
        self.assertEqual(topologyWKT.vertices[0][0], topologyWKB.vertices[0][0])
        self.assertEqual(topologyWKT.vertices[0][1], topologyWKB.vertices[0][1])
        self.assertEqual(topologyWKT.vertices[0][2], topologyWKB.vertices[0][2])

        self.assertEqual(topologyWKT.vertices[1][0], topologyWKB.vertices[1][0])
        self.assertEqual(topologyWKT.vertices[1][1], topologyWKB.vertices[1][1])
        self.assertEqual(topologyWKT.vertices[1][2], topologyWKB.vertices[1][2])