本文整理汇总了Python中test_qgspallabeling_base.TestQgsPalLabeling类的典型用法代码示例。如果您正苦于以下问题:Python TestQgsPalLabeling类的具体用法?Python TestQgsPalLabeling怎么用?Python TestQgsPalLabeling使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestQgsPalLabeling类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
"""Run before each test."""
self.configTest('pal_server', 'sp')
TestQgsPalLabeling.setDefaultEngineSettings()
self.lyr = self.defaultSettings()
self.params = self.defaultWmsParams('point')
self._TestImage = ''
示例2: tearDownClass
def tearDownClass(cls):
"""Run after all tests"""
TestQgsPalLabeling.tearDownClass()
cls.removeMapLayer(cls.layer)
cls.layer = None
# avoid crash on finish, probably related to https://bugreports.qt.io/browse/QTBUG-35760
QThreadPool.globalInstance().waitForDone()
示例3: setUpClass
def setUpClass(cls):
TestQgsPalLabeling.setUpClass()
cls.setUpServerProjectAndDir(TESTPROJPATH, TESTPROJDIR)
cls.layer = TestQgsPalLabeling.loadFeatureLayer('background')
cls.layer = TestQgsPalLabeling.loadFeatureLayer('point')
cls.checkmismatch = 1000
cls.checkgroup = ''
示例4: test_polygon_placement_with_hole_and_point
def test_polygon_placement_with_hole_and_point(self):
# Testing that hole from a feature is not treated as an obstacle for other feature's labels
self.layer = TestQgsPalLabeling.loadFeatureLayer('point')
polyLayer = TestQgsPalLabeling.loadFeatureLayer('polygon_with_hole')
self._TestMapSettings = self.cloneMapSettings(self._MapSettings)
self.checkTest()
self.removeMapLayer(self.layer)
self.removeMapLayer(polyLayer)
self.layer = None
示例5: test_point_placement_narrow_polygon_obstacle
def test_point_placement_narrow_polygon_obstacle(self):
# Default point label placement with narrow polygon obstacle
self.layer = TestQgsPalLabeling.loadFeatureLayer('point')
polyLayer = TestQgsPalLabeling.loadFeatureLayer('narrow_polygon')
self._TestMapSettings = self.cloneMapSettings(self._MapSettings)
self.checkTest()
self.removeMapLayer(self.layer)
self.removeMapLayer(polyLayer)
self.layer = None
示例6: test_multipolygon_obstacle
def test_multipolygon_obstacle(self):
# Test that all parts of multipolygon are used as an obstacle
self.layer = TestQgsPalLabeling.loadFeatureLayer('point')
polyLayer = TestQgsPalLabeling.loadFeatureLayer('multi_polygon')
self._TestMapSettings = self.cloneMapSettings(self._MapSettings)
self.checkTest()
self.removeMapLayer(self.layer)
self.removeMapLayer(polyLayer)
self.layer = None
示例7: tearDownClass
def tearDownClass(cls):
"""Run after all tests"""
TestQgsPalLabeling.tearDownClass()
# layers removed, save empty project file
cls._TestProj.write()
if "PAL_SERVER_TEMP" in os.environ:
MAPSERV.stop_processes()
MAPSERV.open_temp_dir()
else:
MAPSERV.shutdown()
示例8: test_point_ordered_placement4
def test_point_ordered_placement4(self):
# Test ordered placements for point (3 obstacle)
self.layer = TestQgsPalLabeling.loadFeatureLayer('point_ordered_placement')
obstacleLayer = TestQgsPalLabeling.loadFeatureLayer('point_ordered_obstacle3')
self._TestMapSettings = self.cloneMapSettings(self._MapSettings)
self.lyr.placement = QgsPalLayerSettings.OrderedPositionsAroundPoint
self.lyr.dist = 2
self.checkTest()
self.removeMapLayer(obstacleLayer)
self.removeMapLayer(self.layer)
self.layer = None
示例9: test_point_dd_ordered_placement1
def test_point_dd_ordered_placement1(self):
# Test ordered placements for point with data defined order and obstacle
self.layer = TestQgsPalLabeling.loadFeatureLayer("point_ordered_placement")
obstacleLayer = TestQgsPalLabeling.loadFeatureLayer("point_ordered_obstacle_top")
self._TestMapSettings = self.cloneMapSettings(self._MapSettings)
self.lyr.placement = QgsPalLayerSettings.OrderedPositionsAroundPoint
self.lyr.dist = 2
self.lyr.setDataDefinedProperty(QgsPalLayerSettings.PredefinedPositionOrder, True, True, "'T,B'", None)
self.checkTest()
self.removeMapLayer(obstacleLayer)
self.removeMapLayer(self.layer)
self.lyr.removeDataDefinedProperty(QgsPalLayerSettings.PredefinedPositionOrder)
self.layer = None
示例10: test_point_dd_ordered_placement1
def test_point_dd_ordered_placement1(self):
# Test ordered placements for point with data defined order and obstacle
self.layer = TestQgsPalLabeling.loadFeatureLayer('point_ordered_placement')
obstacleLayer = TestQgsPalLabeling.loadFeatureLayer('point_ordered_obstacle_top')
self._TestMapSettings = self.cloneMapSettings(self._MapSettings)
self.lyr.placement = QgsPalLayerSettings.OrderedPositionsAroundPoint
self.lyr.dist = 2
self.lyr.dataDefinedProperties().setProperty(QgsPalLayerSettings.PredefinedPositionOrder, QgsProperty.fromExpression("'T,B'"))
self.checkTest()
self.removeMapLayer(obstacleLayer)
self.removeMapLayer(self.layer)
self.lyr.dataDefinedProperties().setProperty(QgsPalLayerSettings.PredefinedPositionOrder, QgsProperty())
self.layer = None
示例11: setUpClass
def setUpClass(cls):
TestQgsPalLabeling.setUpClass()
cls._TestProj = QgsProject.instance()
cls._TestProj.setFileName(str(TESTPROJPATH).strip())
if not cls._TestProjSetup:
try:
shutil.copy(cls._PalFeaturesDb, TESTPROJDIR)
for qml in glob.glob(cls._PalDataDir + os.sep + '*.qml'):
shutil.copy(qml, TESTPROJDIR)
except IOError, e:
raise IOError(str(e) +
'\nCould not set up test server directory')
cls._TestProjSetup = True
示例12: test_point_placement_around_obstacle
def test_point_placement_around_obstacle(self):
# Default point label placement with obstacle
self.layer = TestQgsPalLabeling.loadFeatureLayer("point2")
self._TestMapSettings = self.cloneMapSettings(self._MapSettings)
self.checkTest()
self.removeMapLayer(self.layer)
self.layer = None
示例13: test_point_placement_around_obstacle_large_symbol
def test_point_placement_around_obstacle_large_symbol(self):
# Default point label placement with obstacle and large symbols
self.layer = TestQgsPalLabeling.loadFeatureLayer('point3')
self._TestMapSettings = self.cloneMapSettings(self._MapSettings)
self.checkTest()
self.removeMapLayer(self.layer)
self.layer = None
示例14: test_point_placement_around
def test_point_placement_around(self):
# Default point label placement
self.layer = TestQgsPalLabeling.loadFeatureLayer('point')
self._TestMapSettings = self.cloneMapSettings(self._MapSettings)
self.checkTest()
self.removeMapLayer(self.layer)
self.layer = None
示例15: test_label_line_over_small_angles
def test_label_line_over_small_angles(self):
# Test that labeling a line using parallel labels will place labels near center of straightish line
self.layer = TestQgsPalLabeling.loadFeatureLayer('line_placement_3')
self._TestMapSettings = self.cloneMapSettings(self._MapSettings)
self.lyr.placement = QgsPalLayerSettings.Line
self.checkTest()
self.removeMapLayer(self.layer)
self.layer = None