コード例 #1
0
 def testSetRGBAImage(self):
     """set image of new symbolObj"""
     assert self.x_symbol.name == 'xmarks'
     assert self.x_symbol.type == mapscript.MS_SYMBOL_PIXMAP
     format = mapscript.outputFormatObj('GD/PNG')
     img = self.x_symbol.getImage(format)
     img.save('set-%s.%s' % (self.x_symbol.name, img.format.extension))
コード例 #2
0
ファイル: symboltest.py プロジェクト: AdRiley/mapserver
 def testSetRGBAImage(self):
     """set image of new symbolObj"""
     assert self.x_symbol.name == 'xmarks'
     assert self.x_symbol.type == mapscript.MS_SYMBOL_PIXMAP
     format = mapscript.outputFormatObj('GD/PNG')
     img = self.x_symbol.getImage(format)
     img.save('set-%s.%s' % (self.x_symbol.name, img.format.extension))
コード例 #3
0
ファイル: symboltest.py プロジェクト: AdRiley/mapserver
 def testSetPCTImage(self):
     """set image of new symbolObj"""
     assert self.h_symbol.name == 'house'
     assert self.h_symbol.type == mapscript.MS_SYMBOL_PIXMAP
     format = mapscript.outputFormatObj('GD/PNG')
     format.transparent = mapscript.MS_ON
     img = self.h_symbol.getImage(format)
     img.save('set-%s.%s' % (self.h_symbol.name, img.format.extension))
コード例 #4
0
ファイル: symboltest.py プロジェクト: AdRiley/mapserver
 def testConstructorImage(self):
     """create new instance of symbolObj from an image"""
     symbol = mapscript.symbolObj('xmarks', XMARKS_IMAGE)
     assert symbol.name == 'xmarks'
     assert symbol.type == mapscript.MS_SYMBOL_PIXMAP
     format = mapscript.outputFormatObj('GD/PNG')
     img = symbol.getImage(format)
     img.save('sym-%s.%s' % (symbol.name, img.format.extension))
コード例 #5
0
 def testSetPCTImage(self):
     """set image of new symbolObj"""
     assert self.h_symbol.name == 'house'
     assert self.h_symbol.type == mapscript.MS_SYMBOL_PIXMAP
     format = mapscript.outputFormatObj('GD/PNG')
     format.transparent = mapscript.MS_ON
     img = self.h_symbol.getImage(format)
     img.save('set-%s.%s' % (self.h_symbol.name, img.format.extension))
コード例 #6
0
 def testConstructorImage(self):
     """create new instance of symbolObj from an image"""
     symbol = mapscript.symbolObj('xmarks', XMARKS_IMAGE)
     assert symbol.name == 'xmarks'
     assert symbol.type == mapscript.MS_SYMBOL_PIXMAP
     format = mapscript.outputFormatObj('GD/PNG')
     img = symbol.getImage(format)
     img.save('sym-%s.%s' % (symbol.name, img.format.extension))
コード例 #7
0
ファイル: imagetest.py プロジェクト: outrun123/mapserver
 def testConstructorWithFormat(self):
     """imageObj with an optional driver works"""
     driver = 'GD/PNG'
     format = mapscript.outputFormatObj(driver)
     imgobj = mapscript.imageObj(10, 10, format)
     assert imgobj.thisown == 1
     assert imgobj.format.driver == driver
     assert imgobj.height == 10
     assert imgobj.width == 10
コード例 #8
0
ファイル: imagetest.py プロジェクト: codeforeurope/gim
 def testConstructorWithFormat(self):
     """imageObj with an optional driver works"""
     driver = 'GD/PNG'
     format = mapscript.outputFormatObj(driver)
     imgobj = mapscript.imageObj(10, 10, format)
     assert imgobj.thisown == 1
     assert imgobj.format.driver == driver
     assert imgobj.height == 10
     assert imgobj.width == 10
コード例 #9
0
ファイル: outputformattest.py プロジェクト: codeforeurope/gim
 def testRemoveOutputFormat(self):
     """testRemoveOutputFormat may fail depending on GD options"""
     num = self.map.numoutputformats
     new_format = mapscript.outputFormatObj('GDAL/GTiff', 'gtiffx')
     self.map.appendOutputFormat(new_format)
     assert self.map.numoutputformats == num + 1
     assert new_format.refcount == 2, new_format.refcount
     assert self.map.removeOutputFormat('gtiffx') == mapscript.MS_SUCCESS
     assert new_format.refcount == 1, new_format.refcount
     assert self.map.numoutputformats == num
     self.assertRaises(mapscript.MapServerError,
                       self.map.selectOutputFormat, 'gtiffx')
     self.map.selectOutputFormat('GTiff')
     assert self.map.outputformat.mimetype == 'image/tiff'
コード例 #10
0
ファイル: outputformattest.py プロジェクト: codeforeurope/gim
 def testAppendNewOutputFormat(self):
     """test that a new output format can be created on-the-fly"""
     num = self.map.numoutputformats
     new_format = mapscript.outputFormatObj('GDAL/GTiff', 'gtiffx')
     assert new_format.refcount == 1, new_format.refcount
     self.map.appendOutputFormat(new_format)
     assert self.map.numoutputformats == num + 1
     assert new_format.refcount == 2, new_format.refcount
     self.map.selectOutputFormat('gtiffx')
     self.map.save('testAppendNewOutputFormat.map')
     self.map.getLayerByName('INLINE-PIXMAP-RGBA').status = mapscript.MS_ON
     imgobj = self.map.draw()
     filename = 'testAppendNewOutputFormat.tif'
     imgobj.save(filename)
コード例 #11
0
 def testRemoveOutputFormat(self):
     """testRemoveOutputFormat may fail depending on GD options"""
     num = self.map.numoutputformats
     new_format = mapscript.outputFormatObj('GDAL/GTiff', 'gtiffx')
     self.map.appendOutputFormat(new_format)
     assert self.map.numoutputformats == num + 1
     assert new_format.refcount == 2, new_format.refcount
     assert self.map.removeOutputFormat('gtiffx') == mapscript.MS_SUCCESS
     assert new_format.refcount == 1, new_format.refcount
     assert self.map.numoutputformats == num
     self.assertRaises(mapscript.MapServerError,
                       self.map.selectOutputFormat, 'gtiffx')
     self.map.selectOutputFormat('GTiff')
     assert self.map.outputformat.mimetype == 'image/tiff'
コード例 #12
0
 def testAppendNewOutputFormat(self):
     """test that a new output format can be created on-the-fly"""
     num = self.map.numoutputformats
     new_format = mapscript.outputFormatObj('GDAL/GTiff', 'gtiffx')
     assert new_format.refcount == 1, new_format.refcount
     self.map.appendOutputFormat(new_format)
     assert self.map.numoutputformats == num + 1
     assert new_format.refcount == 2, new_format.refcount
     self.map.selectOutputFormat('gtiffx')
     self.map.save('testAppendNewOutputFormat.map')
     self.map.getLayerByName('INLINE-PIXMAP-RGBA').status = mapscript.MS_ON
     imgobj = self.map.draw()
     filename = 'testAppendNewOutputFormat.tif'
     imgobj.save(filename)
コード例 #13
0
ファイル: outputformattest.py プロジェクト: codeforeurope/gim
 def testOutputFormatConstructor(self):
     new_format = mapscript.outputFormatObj('GDAL/GTiff', 'gtiff')
     assert new_format.refcount == 1, new_format.refcount
     assert new_format.name == 'gtiff'
     assert new_format.mimetype == 'image/tiff'
コード例 #14
0
 def testOutputFormatConstructor(self):
     new_format = mapscript.outputFormatObj('GDAL/GTiff', 'gtiff')
     assert new_format.refcount == 1, new_format.refcount
     assert new_format.name == 'gtiff'
     assert new_format.mimetype == 'image/tiff'