本文整理汇总了Python中qgis.core.QgsProject.removeEntry方法的典型用法代码示例。如果您正苦于以下问题:Python QgsProject.removeEntry方法的具体用法?Python QgsProject.removeEntry怎么用?Python QgsProject.removeEntry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qgis.core.QgsProject
的用法示例。
在下文中一共展示了QgsProject.removeEntry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_wmts_config
# 需要导入模块: from qgis.core import QgsProject [as 别名]
# 或者: from qgis.core.QgsProject import removeEntry [as 别名]
def test_wmts_config(self):
projectPath = self.projectGroupsPath
assert os.path.exists(projectPath), "Project file not found: " + projectPath
project = QgsProject()
project.read(projectPath)
self.wmts_request_compare_project(project, 'GetCapabilities', reference_base_name='wmts_getcapabilities_config')
self.assertTrue(project.removeEntry('WMTSGrids', 'Config'))
self.assertTrue(project.removeEntry('WMTSGrids', 'CRS'))
self.wmts_request_compare_project(project, 'GetCapabilities', reference_base_name='wmts_getcapabilities_config')
self.assertTrue(project.writeEntry('WMTSGrids', 'Config', ('EPSG:3857,20037508.342789248,-20037508.342789248,559082264.0287179,20',)))
self.assertTrue(project.writeEntry('WMTSGrids', 'CRS', ('EPSG:3857',)))
self.wmts_request_compare_project(project, 'GetCapabilities', reference_base_name='wmts_getcapabilities_config_3857')
示例2: testDirtying
# 需要导入模块: from qgis.core import QgsProject [as 别名]
# 或者: from qgis.core.QgsProject import removeEntry [as 别名]
def testDirtying(self):
project = QgsProject()
# writing a new entry should dirty the project
project.setDirty(False)
self.assertTrue(project.writeEntry('myscope', 'myentry', True))
self.assertTrue(project.isDirty())
# over-writing a pre-existing entry with the same value should _not_ dirty the project
project.setDirty(False)
self.assertTrue(project.writeEntry('myscope', 'myentry', True))
self.assertFalse(project.isDirty())
# over-writing a pre-existing entry with a different value should dirty the project
project.setDirty(False)
self.assertTrue(project.writeEntry('myscope', 'myentry', False))
self.assertTrue(project.isDirty())
# removing an existing entry should dirty the project
project.setDirty(False)
self.assertTrue(project.removeEntry('myscope', 'myentry'))
self.assertTrue(project.isDirty())
# removing a non-existing entry should _not_ dirty the project
project.setDirty(False)
self.assertTrue(project.removeEntry('myscope', 'myentry'))
self.assertFalse(project.isDirty())
# setting a project CRS with a new value should dirty the project
project.setCrs(QgsCoordinateReferenceSystem('EPSG:4326'))
project.setDirty(False)
project.setCrs(QgsCoordinateReferenceSystem('EPSG:3148'))
self.assertTrue(project.isDirty())
# setting a project CRS with the same project CRS should not dirty the project
project.setDirty(False)
project.setCrs(QgsCoordinateReferenceSystem('EPSG:3148'))
self.assertFalse(project.isDirty())