本文整理汇总了Python中testing.mapscript.pointObj函数的典型用法代码示例。如果您正苦于以下问题:Python pointObj函数的具体用法?Python pointObj怎么用?Python pointObj使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pointObj函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: xtestZoomOutScale
def xtestZoomOutScale(self):
"""ZoomScaleTestCase.testZoomOutScale: zooming out to a specified scale returns proper extent"""
w, h = (self.mapobj1.width, self.mapobj1.height)
p = mapscript.pointObj()
p.x, p.y = (50, 50)
scale = 5669.2944
extent = self.mapobj1.extent
self.mapobj1.zoomScale(scale, p, w, h, extent, None)
new_extent = self.mapobj1.extent
self.assertRectsEqual(new_extent, mapscript.rectObj(-100,-100,100,100))
开发者ID:BentleySystems,项目名称:mapserver,代码行数:10,代码来源:zoomtest.py
示例17: xtestZoomInScale
def xtestZoomInScale(self):
"""ZoomScaleTestCase.testZoomInScale: zooming in to a specified scale returns proper extent"""
w, h = (self.mapobj1.width, self.mapobj1.height)
p = mapscript.pointObj()
p.x, p.y = (50, 50)
scale = 1417.3236
extent = self.mapobj1.extent
self.mapobj1.zoomScale(scale, p, w, h, extent, None)
new_extent = self.mapobj1.extent
self.assertRectsEqual(new_extent, mapscript.rectObj(-25,-25,25,25))
开发者ID:BentleySystems,项目名称:mapserver,代码行数:10,代码来源:zoomtest.py
示例18: testZoomOutPointConstrained
def testZoomOutPointConstrained(self):
"""ZoomPointTestCase.testZoomOutPointConstrained: zooming out to a constrained extent returns proper extent"""
w, h = (self.mapobj1.width, self.mapobj1.height)
max = mapscript.rectObj()
max.minx, max.miny, max.maxx, max.maxy = (-100.0,-100.0,100.0,100.0)
p = mapscript.pointObj()
p.x, p.y = (50, 50)
extent = self.mapobj1.extent
self.mapobj1.zoomPoint(-4, p, w, h, extent, max)
new_extent = self.mapobj1.extent
self.assertRectsEqual(new_extent, max)
开发者ID:BentleySystems,项目名称:mapserver,代码行数:11,代码来源:zoomtest.py
示例19: testGetPointWKT
def testGetPointWKT(self):
# Create new instance from class data
po = mapscript.pointObj(self.point_xy[0], self.point_xy[1])
lo = mapscript.lineObj()
lo.add(po)
so = mapscript.shapeObj(mapscript.MS_SHAPE_POINT)
so.add(lo)
# test output WKT
wkt = so.toWKT()
self.assert_(wkt == self.point_wkt, wkt)
开发者ID:codeforeurope,项目名称:gim,代码行数:11,代码来源:shapetest.py
示例20: testAddPointFeature
def testAddPointFeature(self):
"""adding a point to an inline feature works correctly"""
inline_layer = self.map.getLayerByName('INLINE')
assert inline_layer.connectiontype == mapscript.MS_INLINE
p = mapscript.pointObj(0.2, 51.5)
l = mapscript.lineObj()
self.addPointToLine(l, p)
shape = mapscript.shapeObj(inline_layer.type)
shape.classindex = 0
self.addLineToShape(shape, l)
inline_layer.addFeature(shape)
msimg = self.map.draw()
filename = 'testAddPointFeature.png'
msimg.save(filename)
开发者ID:codeforeurope,项目名称:gim,代码行数:14,代码来源:shapetest.py
注:本文中的testing.mapscript.pointObj函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论