当前位置: 首页>>代码示例>>Python>>正文


Python mapscript.pointObj函数代码示例

本文整理汇总了Python中testing.mapscript.pointObj函数的典型用法代码示例。如果您正苦于以下问题:Python pointObj函数的具体用法?Python pointObj怎么用?Python pointObj使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pointObj函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

 def setUp(self):
     """The test fixture is a line with two points"""
     self.points = (mapscript.pointObj(0.0, 1.0),
                    mapscript.pointObj(2.0, 3.0))
     self.line = mapscript.lineObj()
     self.addPointToLine(self.line, self.points[0])
     self.addPointToLine(self.line, self.points[1])
开发者ID:codeforeurope,项目名称:gim,代码行数:7,代码来源:linetest.py

示例2: testSetPoints

 def testSetPoints(self):
     """add lines of points to an existing symbol"""
     symbol = self.map.symbolset.getSymbol(1)
     assert symbol.name == 'circle'
     line = mapscript.lineObj()
     self.addPointToLine(line, mapscript.pointObj(2.0, 2.0))
     self.addPointToLine(line, mapscript.pointObj(3.0, 3.0))
     assert symbol.setPoints(line) == 2
     assert symbol.numpoints == 2
     line = symbol.getPoints()
     assert line.numpoints == 2, line.numpoints
     pt = self.getPointFromLine(line, 1)
     self.assertPointsEqual(pt, mapscript.pointObj(3.0, 3.0))
开发者ID:AdRiley,项目名称:mapserver,代码行数:13,代码来源:symboltest.py

示例3: testDrawPoints

 def testDrawPoints(self):
     """DrawProgrammedStylesTestCase.testDrawPoints: point drawing with styles works as advertised"""
     points = [mapscript.pointObj(-0.2, 51.6), mapscript.pointObj(0.0, 51.2), mapscript.pointObj(0.2, 51.6)]
     colors = [mapscript.colorObj(255, 0, 0), mapscript.colorObj(0, 255, 0), mapscript.colorObj(0, 0, 255)]
     img = self.map.prepareImage()
     layer = self.map.getLayerByName("POINT")
     # layer.draw(self.map, img)
     class0 = layer.getClass(0)
     for i in range(len(points)):
         style0 = class0.getStyle(0)
         style0.color = colors[i]
         # style0.color.pen = -4
         assert style0.color.toHex() == colors[i].toHex()
         points[i].draw(self.map, layer, img, 0, "foo")
     img.save("test_draw_points.png")
开发者ID:RodrigoVazquez,项目名称:mapserver,代码行数:15,代码来源:styletest.py

示例4: setUp

 def setUp(self):
     """The test fixture is a shape of one point"""
     self.points = (mapscript.pointObj(0.0, 1.0),)
     self.lines = (mapscript.lineObj(),)
     self.addPointToLine(self.lines[0], self.points[0])
     self.shape = mapscript.shapeObj(mapscript.MS_SHAPE_POINT)
     self.addLineToShape(self.shape, self.lines[0])
开发者ID:codeforeurope,项目名称:gim,代码行数:7,代码来源:shapetest.py

示例5: testSetXYM

 def testSetXYM(self):
     """point can have its x and y reset (with m value)"""
     p = mapscript.pointObj()
     p.setXY(1.0, 1.0, 1.0)
     self.assertAlmostEqual(p.x, 1.0)
     self.assertAlmostEqual(p.y, 1.0)
     if hasattr(p, 'm'):
         self.assertAlmostEqual(p.m, 1.0)
开发者ID:AdRiley,项目名称:mapserver,代码行数:8,代码来源:pointtest.py

示例6: testPoint__str__

 def testPoint__str__(self):
     """return properly formatted string"""
     p = mapscript.pointObj(1.0, 1.0)
     if hasattr(p, 'z'):
         p_str = "{ 'x': %.16g, 'y': %.16g, 'z': %.16g }" % (p.x, p.y, p.z)
     else:
         p_str = "{ 'x': %.16g, 'y': %.16g }" % (p.x, p.y)
     assert str(p) == p_str, str(p)
开发者ID:AdRiley,项目名称:mapserver,代码行数:8,代码来源:pointtest.py

示例7: testZoomInPoint

 def testZoomInPoint(self):
     """ZoomPointTestCase.testZoomInPoint: zooming in by a power of 2 returns the proper extent"""
     w, h = (self.mapobj1.width, self.mapobj1.height)
     p = mapscript.pointObj(50.0, 50.0)
     extent = self.mapobj1.extent
     self.mapobj1.zoomPoint(2, p, w, h, extent, None)
     new_extent = self.mapobj1.extent
     self.assertRectsEqual(new_extent, mapscript.rectObj(-25,-25,25,25))
开发者ID:BentleySystems,项目名称:mapserver,代码行数:8,代码来源:zoomtest.py

示例8: testGetPoints

 def testGetPoints(self):
     """get symbol points as line and test coords"""
     symbol = self.map.symbolset.getSymbol(1)
     assert symbol.name == 'circle'
     line = symbol.getPoints()
     assert line.numpoints == 1, line.numpoints
     pt = self.getPointFromLine(line, 0)
     self.assertPointsEqual(pt, mapscript.pointObj(1.0, 1.0))
开发者ID:AdRiley,项目名称:mapserver,代码行数:8,代码来源:symboltest.py

示例9: testRecenter

 def testRecenter(self):
     """ZoomPointTestCase.testRecenter: recentering the map with a point returns the same extent"""
     w, h = (self.mapobj1.width, self.mapobj1.height)
     p = mapscript.pointObj(50.0, 50.0)
     extent = self.mapobj1.extent
     self.mapobj1.zoomPoint(1, p, w, h, extent, None)
     new_extent = self.mapobj1.extent
     self.assertRectsEqual(new_extent, mapscript.rectObj(-50,-50,50,50))
开发者ID:BentleySystems,项目名称:mapserver,代码行数:8,代码来源:zoomtest.py

示例10: testZoomOutPoint

 def testZoomOutPoint(self):
     """ZoomPointTestCase.testZoomOutPoint: zooming out by a power of 2 returns the proper extent"""
     w, h = (self.mapobj1.width, self.mapobj1.height)
     p = mapscript.pointObj()
     p.x, p.y = (50, 50)
     extent = self.mapobj1.extent
     self.mapobj1.zoomPoint(-2, p, w, h, extent, None)
     new_extent = self.mapobj1.extent
     self.assertRectsEqual(new_extent, mapscript.rectObj(-100,-100,100,100))
开发者ID:BentleySystems,项目名称:mapserver,代码行数:9,代码来源:zoomtest.py

示例11: testZoomBadSize

 def testZoomBadSize(self):
     """ZoomPointTestCase.testZoomBadSize: zooming to a bad size raises proper error"""
     p = mapscript.pointObj()
     p.x, p.y = (50, 50)
     extent = self.mapobj1.extent
     w = 0
     h = -1
     self.assertRaises(mapscript.MapServerError, 
         self.mapobj1.zoomPoint, -2, p, w, h, extent, None);
开发者ID:BentleySystems,项目名称:mapserver,代码行数:9,代码来源:zoomtest.py

示例12: testSetXYZ

 def testSetXYZ(self):
     """point can have its x, y, z reset (with m value)"""
     p = mapscript.pointObj()
     p.setXYZ(1.0, 2.0, 3.0, 4.0)
     self.assertAlmostEqual(p.x, 1.0)
     self.assertAlmostEqual(p.y, 2.0)
     if hasattr(p, 'z') and hasattr(p, 'm'):
         self.assertAlmostEqual(p.z, 3.0)
         self.assertAlmostEqual(p.m, 4.0)
开发者ID:AdRiley,项目名称:mapserver,代码行数:9,代码来源:pointtest.py

示例13: xtestRecenter

 def xtestRecenter(self):
     """ZoomScaleTestCase.testRecenter: recentering map returns proper extent"""
     w, h = (self.mapobj1.width, self.mapobj1.height)
     p = mapscript.pointObj()
     p.x, p.y = (50, 50)
     scale = 2834.6472
     extent = self.mapobj1.extent
     self.mapobj1.zoomScale(scale, p, w, h, extent, None)
     new_extent = self.mapobj1.extent
     self.assertRectsEqual(new_extent, mapscript.rectObj(-50,-50,50,50))
开发者ID:BentleySystems,项目名称:mapserver,代码行数:10,代码来源:zoomtest.py

示例14: testPointToString

    def testPointToString(self):
        """return properly formatted string in toString()"""
        p = mapscript.pointObj(1.0, 1.0, 0.002, 15.0)
        if hasattr(p, 'z') and hasattr(p, 'm'):
            p_str = "{ 'x': %.16g, 'y': %.16g, 'z': %.16g, 'm': %.16g }" \
                  % (p.x, p.y, p.z, p.m)
        else:
            p_str = "{ 'x': %.16g, 'y': %.16g }" % (p.x, p.y)

        assert p.toString() == p_str, p.toString()
开发者ID:AdRiley,项目名称:mapserver,代码行数:10,代码来源:pointtest.py

示例15: testZoomBadExtent

 def testZoomBadExtent(self):
     """ZoomPointTestCase.testZoomBadExtent: zooming to a bad extent raises proper error"""
     p = mapscript.pointObj()
     p.x, p.y = (50, 50)
     extent = self.mapobj1.extent
     extent.maxx = extent.maxx - 1000000
     w = 100
     h = 100
     self.assertRaises(mapscript.MapServerError, 
         self.mapobj1.zoomPoint, -2, p, w, h, extent, None);
开发者ID:BentleySystems,项目名称:mapserver,代码行数:10,代码来源:zoomtest.py


注:本文中的testing.mapscript.pointObj函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。