def testGettersSetters(self): """ test model getters/setters """ m = QgsPointCloudAttributeModel() self.assertEqual(m.attributes().count(), 0) m.setAllowEmptyAttributeName(True) self.assertTrue(m.allowEmptyAttributeName()) m.setAllowEmptyAttributeName(False) self.assertFalse(m.allowEmptyAttributeName()) attributes = create_attributes() m.setAttributes(attributes) self.assertEqual([a.name() for a in m.attributes().attributes()], ['x', 'y', 'z', 'cat', 'red'])
def testSetLayer(self): m = QgsPointCloudAttributeModel() self.assertIsNone(m.layer()) layer = QgsPointCloudLayer( unitTestDataPath() + '/point_clouds/ept/sunshine-coast/ept.json', 'test', 'ept') self.assertTrue(layer.isValid()) m.setLayer(layer) self.assertEqual(m.layer(), layer) self.assertEqual([a.name() for a in m.attributes().attributes()], [ 'X', 'Y', 'Z', 'Intensity', 'ReturnNumber', 'NumberOfReturns', 'ScanDirectionFlag', 'EdgeOfFlightLine', 'Classification', 'ScanAngleRank', 'UserData', 'PointSourceId', 'GpsTime', 'Red', 'Green', 'Blue' ])