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


Python mapscript.rectObj函数代码示例

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


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

示例1: testZoomRectangle

 def testZoomRectangle(self):
     """ZoomRectangleTestCase.testZoomRectangle: zooming to an extent returns proper map extent"""
     w, h = (self.mapobj1.width, self.mapobj1.height)
     r = mapscript.rectObj(1, 26, 26, 1, 1)
     extent = self.mapobj1.extent
     self.mapobj1.zoomRectangle(r, w, h, extent, None)
     new_extent = self.mapobj1.extent
     self.assertRectsEqual(new_extent, mapscript.rectObj(-49,24,-24,49))
开发者ID:BentleySystems,项目名称:mapserver,代码行数:8,代码来源:zoomtest.py

示例2: testReBindingExtent

 def testReBindingExtent(self):
     """test the rebinding of a map's extent"""
     test_map = mapscript.mapObj(TESTMAPFILE)
     rect1 = mapscript.rectObj(-10.0, -10.0, 10.0, 10.0)
     rect2 = mapscript.rectObj(-10.0, -10.0, 10.0, 10.0)
     test_map.extent = rect1
     assert repr(test_map.extent) != repr(rect1), (test_map.extent, rect1)
     del rect1
     self.assertRectsEqual(test_map.extent, rect2)
开发者ID:AdRiley,项目名称:mapserver,代码行数:9,代码来源:maptest.py

示例3: testZoomRectangleConstrained

 def testZoomRectangleConstrained(self):
     """ZoomRectangleTestCase.testZoomRectangleConstrained: zooming to a constrained extent returns proper extent"""
     w, h = (self.mapobj1.width, self.mapobj1.height)
     max = mapscript.rectObj(-100.0, -100.0, 100.0, 100.0)
     r = mapscript.rectObj(0, 200, 200, 0, 1)
     extent = self.mapobj1.extent
     self.mapobj1.zoomRectangle(r, w, h, extent, max)
     new_extent = self.mapobj1.extent
     self.assertRectsEqual(new_extent, max)
开发者ID:BentleySystems,项目名称:mapserver,代码行数:9,代码来源:zoomtest.py

示例4: testDrawMapWithSecondPolygon

    def testDrawMapWithSecondPolygon(self):
        """draw a blue polygon and a red polygon"""
        p = self.map.getLayerByName("POLYGON")
        ip = mapscript.layerObj(self.map)
        ip.type = mapscript.MS_LAYER_POLYGON
        ip.status = mapscript.MS_DEFAULT
        c0 = mapscript.classObj(ip)

        # turn off first polygon layer's color
        p.getClass(0).getStyle(0).color.setRGB(-1, -1, -1)

        # copy this style to inline polygon layer, then change outlinecolor
        c0.insertStyle(p.getClass(0).getStyle(0))
        st0 = c0.getStyle(0)
        st0.outlinecolor.setRGB(255, 0, 0)

        # pull out the first feature from polygon layer, shift it
        # and use this as an inline feature in new layer
        p.open()
        s0 = p.getFeature(0)
        p.close()
        r0 = s0.bounds
        r1 = mapscript.rectObj(r0.minx - 0.1, r0.miny - 0.1, r0.maxx - 0.1, r0.maxy - 0.1)
        s1 = r1.toPolygon()

        ip.addFeature(s1)
        img = self.map.draw()
        img.save("test_drawmapw2ndpolygon.png")
开发者ID:RodrigoVazquez,项目名称:mapserver,代码行数:28,代码来源:styletest.py

示例5: testZoomRectangleBadly

 def testZoomRectangleBadly(self):
     """zooming into an invalid extent raises proper error"""
     w, h = (self.mapobj1.width, self.mapobj1.height)
     r = mapscript.rectObj(0, 0, 200, 200)
     extent = self.mapobj1.extent
     self.assertRaises(mapscript.MapServerError, 
         self.mapobj1.zoomRectangle, r, w, h, extent, None)
开发者ID:BentleySystems,项目名称:mapserver,代码行数:7,代码来源:zoomtest.py

示例6: testRectObjConstructorArgs

 def testRectObjConstructorArgs(self):
     """a rect can be initialized with arguments"""
     r = mapscript.rectObj(-1.0, -2.0, 3.0, 4.0)
     self.assertAlmostEqual(r.minx, -1.0)
     self.assertAlmostEqual(r.miny, -2.0)
     self.assertAlmostEqual(r.maxx, 3.0)
     self.assertAlmostEqual(r.maxy, 4.0)
开发者ID:AdRiley,项目名称:mapserver,代码行数:7,代码来源:recttest.py

示例7: testRectObjConstructorNoArgs

 def testRectObjConstructorNoArgs(self):
     """a rect can be initialized with no args"""
     r = mapscript.rectObj()
     self.assertAlmostEqual(r.minx, -1.0)
     self.assertAlmostEqual(r.miny, -1.0)
     self.assertAlmostEqual(r.maxx, -1.0)
     self.assertAlmostEqual(r.maxy, -1.0)
开发者ID:AdRiley,项目名称:mapserver,代码行数:7,代码来源:recttest.py

示例8: setUp

    def setUp(self):
        # Inline feature layer
        self.ilayer = mapscript.layerObj()
        self.ilayer.type = mapscript.MS_LAYER_POLYGON
        self.ilayer.status = mapscript.MS_DEFAULT
        self.ilayer.connectiontype = mapscript.MS_INLINE

        cs = 'f7fcfd,e5f5f9,ccece6,99d8c9,66c2a4,41ae76,238b45,006d2c,00441b'
        colors = ['#' + h for h in cs.split(',')]
        #print colors
        
        for i in range(9):
            # Make a class for feature
            ci = self.ilayer.insertClass(mapscript.classObj())
            co = self.ilayer.getClass(ci)
            si = co.insertStyle(mapscript.styleObj())
            so = co.getStyle(si)
            so.color.setHex(colors[i])
            co.label.color.setHex('#000000')
            co.label.outlinecolor.setHex('#FFFFFF')
            co.label.type = mapscript.MS_BITMAP
            co.label.size = mapscript.MS_SMALL
            
            # The shape to add is randomly generated
            xc = 4.0*(random() - 0.5)
            yc = 4.0*(random() - 0.5)
            r = mapscript.rectObj(xc-0.25, yc-0.25, xc+0.25, yc+0.25)
            s = r.toPolygon()
            
            # Classify
            s.classindex = i
            s.text = "F%d" % (i)
            
            # Add to inline feature layer
            self.ilayer.addFeature(s)
开发者ID:DMS-Aus,项目名称:MapServer,代码行数:35,代码来源:layertest.py

示例9: testDirectExtentAccess

 def testDirectExtentAccess(self):
     """direct access to a layer's extent works properly"""
     pt_layer = self.map.getLayerByName('POINT')
     rect = pt_layer.extent
     assert str(pt_layer.extent) == str(rect), (pt_layer.extent, rect)
     e = mapscript.rectObj(-0.5, 51.0, 0.5, 52.0)
     self.assertRectsEqual(e, rect)
开发者ID:DMS-Aus,项目名称:MapServer,代码行数:7,代码来源:layertest.py

示例10: 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

示例11: 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

示例12: 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

示例13: testGetPresetExtent

 def testGetPresetExtent(self):
     """test layer.setExtent() and layer.getExtent() to return preset instead of calculating extents"""
     r = mapscript.rectObj(1.0, 1.0, 3.0, 3.0)
     self.layer.setExtent(r.minx, r.miny, r.maxx, r.maxy)
     rect = self.layer.extent
     assert r.minx == rect.minx, rect
     assert r.miny == rect.miny, rect.miny
     assert r.maxx == rect.maxx, rect.maxx
     assert r.maxy == rect.maxy, rect.maxy
开发者ID:DMS-Aus,项目名称:MapServer,代码行数:9,代码来源:layertest.py

示例14: testRect__str__

 def testRect__str__(self):
     """__str__ returns properly formatted string"""
     r = mapscript.rectObj(-1.0, -2.0, 3.0001, 4.0)
     r_str = str(r)
     assert r_str == "{ 'minx': -1 , 'miny': -2 , 'maxx': 3.0001 , 'maxy': 4 }", r_str
     r2 = eval(r_str)
     self.assertAlmostEqual(r2['minx'], r.minx)
     self.assertAlmostEqual(r2['miny'], r.miny)
     self.assertAlmostEqual(r2['maxx'], r.maxx)
     self.assertAlmostEqual(r2['maxy'], r.maxy)
开发者ID:AdRiley,项目名称:mapserver,代码行数:10,代码来源:recttest.py

示例15: 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


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