예제 #1
0
 def testLoadStaticRaster(self):
     aRaster = StaticRaster()
     loader = GeneralState.rasterLoader()
     loader.fillGDALRaster(aRaster, '../../resources/test.tiff')
     self.assertEqual(120, aRaster.getSize()._width)
     self.assertEqual(120, aRaster.getSize()._height)
     self.assertEqual(139, aRaster.getValue(Point2DInt(39, 39)))
예제 #2
0
#!/usr/bin/env python

import os, sys

pandoraPath = os.getenv('PANDORAPATH', '/usr/local/pandora')
sys.path.append(pandoraPath + '/bin')
sys.path.append(pandoraPath + '/lib')

from pyPandora import Point2DInt, StaticRaster, DynamicRaster, SizeInt

testStaticRaster = StaticRaster()
print('Static Raster - size: ', testStaticRaster.getSize())
size = SizeInt(5, 5)
testStaticRaster.resize(size)
print('Static Raster - size changed: ', testStaticRaster.getSize())

testDynamicRaster = DynamicRaster()
testDynamicRaster.resize(size)
testDynamicRaster.setInitValues(0, 1000, 0)

print('Dynamic Raster - size: ', testDynamicRaster.getSize())
for i in range(0, size._width):
    for j in range(0, size._height):
        index = Point2DInt(i, j)
        testDynamicRaster.setValue(index, i * size._width + j)

for i in range(0, size._width):
    line = ''
    for j in range(0, size._height):
        index = Point2DInt(i, j)
        line = line + '[' + str(i) + '][' + str(j) + ']=' + str(