Skip to content

Commit

Permalink
UnitTests an die Anpassungen angepasst
Browse files Browse the repository at this point in the history
  • Loading branch information
NickNick1210 committed Sep 26, 2022
1 parent 1ce9db8 commit 7de0799
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 74 deletions.
66 changes: 36 additions & 30 deletions test/algorithm/test_converter_lod0.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,19 +264,19 @@ def test_1(self):
root = etree.Element("root")
lod0Conv = LoD0Converter(Converter(), ifc1, "Test123", trans1, True)
result = lod0Conv.convert(root)
self.assertEqual(5026, len(etree.tostring(result)))
self.assertEqual(5110, len(etree.tostring(result)))

def test_2(self):
root = etree.Element("root")
lod0Conv = LoD0Converter(Converter(), ifc2, "TestABC", trans2, False)
result = lod0Conv.convert(root)
self.assertEqual(2878, len(etree.tostring(result)))
self.assertEqual(3196, len(etree.tostring(result)))

def test_3(self):
root = etree.Element("root")
lod0Conv = LoD0Converter(Converter(), ifc3, "ÄÖÜß", trans3, False)
result = lod0Conv.convert(root)
self.assertEqual(6583, len(etree.tostring(result)))
self.assertEqual(8845, len(etree.tostring(result)))


class TestConvertFootPrint(unittest.TestCase):
Expand All @@ -286,11 +286,11 @@ def test_1(self):
lod0Conv = LoD0Converter(Converter(), ifc1, "Test123", trans1, True)
result = lod0Conv.convertFootPrint(ifcBldg1, root)
corr = b'<root><ns0:lod0FootPrint xmlns:ns0="http://www.opengis.net/citygml/building/2.0"><ns1:MultiSurface' + \
b' xmlns:ns1="http://www.opengis.net/gml"><ns1:surfaceMember><ns1:Polygon><ns1:outerBoundaryIs>' + \
b'<ns1:LinearRing><ns1:coordinates>458870.063285681,5438773.62904949,110 ' + \
b'458862.40284125,5438780.05692559,110 458870.116292566,5438789.24945891,110 ' + \
b'458877.776736998,5438782.82158281,110 458870.063285681,5438773.62904949,110</ns1:coordinates>' + \
b'</ns1:LinearRing></ns1:outerBoundaryIs></ns1:Polygon></ns1:surfaceMember></ns1:MultiSurface>' + \
b' xmlns:ns1="http://www.opengis.net/gml"><ns1:surfaceMember><ns1:Polygon><ns1:exterior>' + \
b'<ns1:LinearRing><ns1:pos>458870.063285681 5438773.62904949 110</ns1:pos><ns1:pos>458862.40284125 ' + \
b'5438780.05692559 110</ns1:pos><ns1:pos>458870.116292566 5438789.24945891 110</ns1:pos><ns1:pos>' + \
b'458877.776736998 5438782.82158281 110</ns1:pos><ns1:pos>458870.063285681 5438773.62904949 110' + \
b'</ns1:pos></ns1:LinearRing></ns1:exterior></ns1:Polygon></ns1:surfaceMember></ns1:MultiSurface>' + \
b'</ns0:lod0FootPrint></root>'
self.assertEqual(corr, etree.tostring(root))
corr = "POLYGON ((458870.063285681 5438773.62904949 110,458862.40284125 5438780.05692559 110," + \
Expand All @@ -303,14 +303,17 @@ def test_2(self):
lod0Conv = LoD0Converter(Converter(), ifc2, "TestABC", trans2, False)
result = lod0Conv.convertFootPrint(ifcBldg2, root)
corr = b'<root><ns0:lod0FootPrint xmlns:ns0="http://www.opengis.net/citygml/building/2.0"><ns1:MultiSurface' + \
b' xmlns:ns1="http://www.opengis.net/gml"><ns1:surfaceMember><ns1:Polygon><ns1:outerBoundaryIs>' + \
b'<ns1:LinearRing><ns1:coordinates>479356.600506348,5444183.43024925,-3 479356.600506348,' + \
b'5444185.43024925,-3 479362.600506348,5444185.43024925,-3 479362.600506348,5444183.43024925,-3 ' + \
b'479380.600506348,5444183.43024925,-3 479380.600506348,5444171.43024925,-3 479363.100506348,' + \
b'5444171.43024925,-3 479363.100506348,5444167.43024925,-3 479356.100506348,5444167.43024925,-3 ' + \
b'479356.100506348,5444171.43024925,-3 479338.600506348,5444171.43024925,-3 479338.600506348,' + \
b'5444183.43024925,-3 479356.600506348,5444183.43024925,-3</ns1:coordinates></ns1:LinearRing>' + \
b'</ns1:outerBoundaryIs></ns1:Polygon></ns1:surfaceMember></ns1:MultiSurface></ns0:lod0FootPrint></root>'
b' xmlns:ns1="http://www.opengis.net/gml"><ns1:surfaceMember><ns1:Polygon><ns1:exterior>' + \
b'<ns1:LinearRing><ns1:pos>479356.600506348 5444183.43024925 -3</ns1:pos><ns1:pos>479356.600506348 ' + \
b'5444185.43024925 -3</ns1:pos><ns1:pos>479362.600506348 5444185.43024925 -3</ns1:pos><ns1:pos>' + \
b'479362.600506348 5444183.43024925 -3</ns1:pos><ns1:pos>479380.600506348 5444183.43024925 -3' + \
b'</ns1:pos><ns1:pos>479380.600506348 5444171.43024925 -3</ns1:pos><ns1:pos>479363.100506348 ' + \
b'5444171.43024925 -3</ns1:pos><ns1:pos>479363.100506348 5444167.43024925 -3</ns1:pos><ns1:pos>' + \
b'479356.100506348 5444167.43024925 -3</ns1:pos><ns1:pos>479356.100506348 5444171.43024925 -3' + \
b'</ns1:pos><ns1:pos>479338.600506348 5444171.43024925 -3</ns1:pos><ns1:pos>479338.600506348 ' + \
b'5444183.43024925 -3</ns1:pos><ns1:pos>479356.600506348 5444183.43024925 -3</ns1:pos>' + \
b'</ns1:LinearRing></ns1:exterior></ns1:Polygon></ns1:surfaceMember></ns1:MultiSurface>' + \
b'</ns0:lod0FootPrint></root>'
self.assertEqual(corr, etree.tostring(root))
corr = "POLYGON ((479356.600506348 5444183.43024925 -3,479356.600506348 5444185.43024925 -3," + \
"479362.600506348 5444185.43024925 -3,479362.600506348 5444183.43024925 -3,479380.600506348 " + \
Expand All @@ -324,7 +327,7 @@ def test_3(self):
root = etree.Element("root")
lod0Conv = LoD0Converter(Converter(), ifc3, "Test123", trans3, False)
result = lod0Conv.convertFootPrint(ifcBldg3, root)
self.assertEqual(3584, len(etree.tostring(root)))
self.assertEqual(5066, len(etree.tostring(root)))
self.assertEqual(85, result.GetGeometryRef(0).GetPointCount())


Expand All @@ -335,32 +338,35 @@ def test_1(self):
lod0Conv = LoD0Converter(Converter(), ifc1, "Test123", trans1, True)
lod0Conv.convertRoofEdge(ifcBldg1, root)
corr = b'<root><ns0:lod0RoofEdge xmlns:ns0="http://www.opengis.net/citygml/building/2.0"><ns1:MultiSurface ' + \
b'xmlns:ns1="http://www.opengis.net/gml"><ns1:surfaceMember><ns1:Polygon><ns1:outerBoundaryIs>' + \
b'<ns1:LinearRing><ns1:coordinates>458878.864175246,5438782.56181742,113 458870.50793632,' + \
b'5438772.60323966,113 458861.315403002,5438780.31669098,113 458869.671641928,5438790.27526874,113 ' + \
b'458878.864175246,5438782.56181742,113</ns1:coordinates></ns1:LinearRing></ns1:outerBoundaryIs>' + \
b'</ns1:Polygon></ns1:surfaceMember></ns1:MultiSurface></ns0:lod0RoofEdge></root>'
b'xmlns:ns1="http://www.opengis.net/gml"><ns1:surfaceMember><ns1:Polygon><ns1:exterior>' + \
b'<ns1:LinearRing><ns1:pos>458878.864175246 5438782.56181742 113</ns1:pos><ns1:pos>' + \
b'458870.50793632 5438772.60323966 113</ns1:pos><ns1:pos>458861.315403002 5438780.31669098 113' + \
b'</ns1:pos><ns1:pos>458869.671641928 5438790.27526874 113</ns1:pos><ns1:pos>458878.864175246 ' + \
b'5438782.56181742 113</ns1:pos></ns1:LinearRing></ns1:exterior></ns1:Polygon></ns1:surfaceMember>' + \
b'</ns1:MultiSurface></ns0:lod0RoofEdge></root>'
self.assertEqual(corr, etree.tostring(root))

def test_2(self):
root = etree.Element("root")
lod0Conv = LoD0Converter(Converter(), ifc2, "Test123", trans2, True)
lod0Conv.convertRoofEdge(ifcBldg2, root)
corr = b'<root><ns0:lod0RoofEdge xmlns:ns0="http://www.opengis.net/citygml/building/2.0"><ns1:MultiSurface ' + \
b'xmlns:ns1="http://www.opengis.net/gml"><ns1:surfaceMember><ns1:Polygon><ns1:outerBoundaryIs>' + \
b'<ns1:LinearRing><ns1:coordinates>479337.600506348,5444176.43024925,9 479337.600506348,' + \
b'5444184.43024925,9 479355.600506348,5444184.43024925,9 479355.600506348,5444186.43024925,9 ' + \
b'479363.600506348,5444186.43024925,9 479363.600506348,5444184.43024925,9 479381.600506348,' + \
b'5444184.43024925,9 479381.600506348,5444170.43024925,9 479337.600506348,5444170.43024925,9 ' + \
b'479337.600506348,5444176.43024925,9</ns1:coordinates></ns1:LinearRing></ns1:outerBoundaryIs>' + \
b'</ns1:Polygon></ns1:surfaceMember></ns1:MultiSurface></ns0:lod0RoofEdge></root>'
b'xmlns:ns1="http://www.opengis.net/gml"><ns1:surfaceMember><ns1:Polygon><ns1:exterior>' + \
b'<ns1:LinearRing><ns1:pos>479337.600506348 5444176.43024925 9</ns1:pos><ns1:pos>479337.600506348 ' + \
b'5444184.43024925 9</ns1:pos><ns1:pos>479355.600506348 5444184.43024925 9</ns1:pos><ns1:pos>' + \
b'479355.600506348 5444186.43024925 9</ns1:pos><ns1:pos>479363.600506348 5444186.43024925 9' + \
b'</ns1:pos><ns1:pos>479363.600506348 5444184.43024925 9</ns1:pos><ns1:pos>479381.600506348 ' + \
b'5444184.43024925 9</ns1:pos><ns1:pos>479381.600506348 5444170.43024925 9</ns1:pos><ns1:pos>' + \
b'479337.600506348 5444170.43024925 9</ns1:pos><ns1:pos>479337.600506348 5444176.43024925 9' + \
b'</ns1:pos></ns1:LinearRing></ns1:exterior></ns1:Polygon></ns1:surfaceMember></ns1:MultiSurface>' + \
b'</ns0:lod0RoofEdge></root>'
self.assertEqual(corr, etree.tostring(root))

def test_3(self):
root = etree.Element("root")
lod0Conv = LoD0Converter(Converter(), ifc3, "Test123", trans3, True)
lod0Conv.convertRoofEdge(ifcBldg3, root)
self.assertEqual(2091, len(etree.tostring(root)))
self.assertEqual(2871, len(etree.tostring(root)))


if __name__ == '__main__':
Expand Down
12 changes: 6 additions & 6 deletions test/algorithm/test_converter_lod1.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,19 +249,19 @@ def test_1(self):
root = etree.Element("root")
lod1Conv = LoD1Converter(Converter(), ifc1, "Test123", trans1, True)
result = lod1Conv.convert(root)
self.assertEqual(11408, len(etree.tostring(result)))
self.assertEqual(11912, len(etree.tostring(result)))

def test_2(self):
root = etree.Element("root")
lod1Conv = LoD1Converter(Converter(), ifc2, "TestABC", trans2, False)
result = lod1Conv.convert(root)
self.assertEqual(7802, len(etree.tostring(result)))
self.assertEqual(8678, len(etree.tostring(result)))

def test_3(self):
root = etree.Element("root")
lod1Conv = LoD1Converter(Converter(), ifc3, "ÄÖÜß", trans3, False)
result = lod1Conv.convert(root)
self.assertEqual(39525, len(etree.tostring(result)))
self.assertEqual(46017, len(etree.tostring(result)))


class TestConvertSolid(unittest.TestCase):
Expand All @@ -270,7 +270,7 @@ def test_1(self):
root = etree.Element("root")
lod1Conv = LoD1Converter(Converter(), ifc1, "Test123", trans1, True)
result = lod1Conv.convertSolid(ifcBldg1, root, 10)
self.assertEqual(2425, len(etree.tostring(root)))
self.assertEqual(2677, len(etree.tostring(root)))
corr = "POLYGON ((458870.063285681 5438773.62904949 110,458862.40284125 5438780.05692559 110," + \
"458870.116292566 5438789.24945891 110,458877.776736998 5438782.82158281 110,458870.063285681 " + \
"5438773.62904949 110))"
Expand All @@ -280,7 +280,7 @@ def test_2(self):
root = etree.Element("root")
lod1Conv = LoD1Converter(Converter(), ifc2, "Test123", trans2, True)
result = lod1Conv.convertSolid(ifcBldg2, root, 10)
self.assertEqual(5845, len(etree.tostring(root)))
self.assertEqual(6721, len(etree.tostring(root)))
corr = "POLYGON ((479356.600506348 5444183.43024925 -3,479356.600506348 5444185.43024925 -3," + \
"479362.600506348 5444185.43024925 -3,479362.600506348 5444183.43024925 -3,479380.600506348 " + \
"5444183.43024925 -3,479380.600506348 5444171.43024925 -3,479363.100506348 5444171.43024925 -3," + \
Expand All @@ -293,7 +293,7 @@ def test_3(self):
root = etree.Element("root")
lod1Conv = LoD1Converter(Converter(), ifc3, "Test123", trans3, True)
result = lod1Conv.convertSolid(ifcBldg3, root, 10)
self.assertEqual(37750, len(etree.tostring(root)))
self.assertEqual(44242, len(etree.tostring(root)))
self.assertEqual(85, result.GetGeometryRef(0).GetPointCount())


Expand Down
10 changes: 5 additions & 5 deletions test/algorithm/test_converter_lod2.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def test_1(self):
root = etree.Element("root")
lod2Conv = LoD2Converter(Converter(), ifc1, "Test123", trans1, True)
result = lod2Conv.convert(root)
self.assertEqual(24431, len(etree.tostring(result)))
self.assertEqual(25163, len(etree.tostring(result)))


class TestConvertBldgBound(unittest.TestCase):
Expand All @@ -301,7 +301,7 @@ def test_1(self):
root = etree.Element("root")
lod2Conv = LoD2Converter(Converter(), ifc1, "Test123", trans1, True)
result1, result2, result3 = lod2Conv.convertBldgBound(ifcBldg1, root, 10)
self.assertEqual(5555, len(etree.tostring(root)))
self.assertEqual(5941, len(etree.tostring(root)))
self.assertEqual(7, len(result1))
corr = "POLYGON ((458870.063285681 5438773.62904949 110,458862.40284125 5438780.05692559 110," + \
"458870.116292566 5438789.24945891 110,458877.776736998 5438782.82158281 110,458870.063285681 " + \
Expand Down Expand Up @@ -413,23 +413,23 @@ def test_1(self):
root = etree.Element("root")
lod2Conv = LoD2Converter(Converter(), ifc1, "Test123", trans1, False)
result1, result2 = lod2Conv.setElement(root, base.geom, "GroundSurface", base.name)
self.assertEqual(612, len(etree.tostring(root)))
self.assertEqual(654, len(etree.tostring(root)))
self.assertEqual(42, len(result1))
self.assertEqual(40, len(result2))

def test_2(self):
root = etree.Element("root")
lod2Conv = LoD2Converter(Converter(), ifc2, "Test123", trans2, False)
result1, result2 = lod2Conv.setElement(root, roof1.geom, "RoofSurface", roof1.name)
self.assertEqual(602, len(etree.tostring(root)))
self.assertEqual(644, len(etree.tostring(root)))
self.assertEqual(42, len(result1))
self.assertEqual(40, len(result2))

def test_3(self):
root = etree.Element("root")
lod2Conv = LoD2Converter(Converter(), ifc3, "Test123", trans3, False)
result1, result2 = lod2Conv.setElement(root, wall1.geom, "WallSurface", wall1.name)
self.assertEqual(645, len(etree.tostring(root)))
self.assertEqual(705, len(etree.tostring(root)))
self.assertEqual(42, len(result1))
self.assertEqual(40, len(result2))

Expand Down
6 changes: 3 additions & 3 deletions test/algorithm/test_converter_lod3.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def test_1(self):
root = etree.Element("root")
lod3Conv = LoD3Converter(Converter(), ifc1, "Test123", trans1, False)
result1, result2, result3 = lod3Conv.setElementGroup(root, base.geom, "GroundSurface", base.name, base.openings)
self.assertEqual(741, len(etree.tostring(root)))
self.assertEqual(783, len(etree.tostring(root)))
self.assertEqual(42, len(result1[0]))
self.assertEqual(40, len(result2))
self.assertEqual(0, len(result3))
Expand All @@ -500,7 +500,7 @@ def test_2(self):
root = etree.Element("root")
lod3Conv = LoD3Converter(Converter(), ifc1, "Test123", trans1, False)
result1, result2, result3 = lod3Conv.setElementGroup(root, wall1.geom, "WallSurface", wall1.name, [door2])
self.assertEqual(1360, len(etree.tostring(root)))
self.assertEqual(1444, len(etree.tostring(root)))
self.assertEqual(42, len(result1[0]))
self.assertEqual(40, len(result2))
self.assertEqual(1, len(result3))
Expand All @@ -509,7 +509,7 @@ def test_3(self):
root = etree.Element("root")
lod3Conv = LoD3Converter(Converter(), ifc1, "Test123", trans1, False)
result1, result2, result3 = lod3Conv.setElementGroup(root, wall2.geom, "WallSurface", wall2.name, [])
self.assertEqual(749, len(etree.tostring(root)))
self.assertEqual(791, len(etree.tostring(root)))
self.assertEqual(42, len(result1[0]))
self.assertEqual(40, len(result2))
self.assertEqual(0, len(result3))
Expand Down
Loading

0 comments on commit 7de0799

Please sign in to comment.