MCPcopy Create free account
hub / github.com/OSGeo/gdal / run

Method run

swig/java/apps/GDALTestIO.java:46–144  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44 }
45
46 public void run()
47 {
48 Dataset dataset = null;
49 Driver driver = null;
50 Band band = null;
51
52 int xsize = 4000;
53 int ysize = 400;
54
55 synchronized(notifier)
56 {
57 nReady ++;
58 notifier.notify();
59 }
60
61 synchronized(waiter)
62 {
63 while( bWait )
64 {
65 try
66 {
67 waiter.wait();
68 }
69 catch(InterruptedException ie)
70 {
71 }
72 }
73 }
74
75 driver = gdal.GetDriverByName("GTiff");
76
77 ByteBuffer byteBuffer = ByteBuffer.allocateDirect(4 * xsize);
78 byteBuffer.order(ByteOrder.nativeOrder());
79 FloatBuffer floatBuffer = byteBuffer.asFloatBuffer();
80 int[] intArray = new int[xsize];
81 float[] floatArray = new float[xsize];
82
83 dataset = driver.Create(filename, xsize, ysize, 1, gdalconst.GDT_Float32);
84 band = dataset.GetRasterBand(1);
85
86 for(int iter = 0; iter < nbIters; iter++)
87 {
88 if (method == METHOD_DBB)
89 {
90 for( int i = 0; i < ysize; i++) {
91 for( int j = 0; j < xsize; j++) {
92 floatBuffer.put(j, (float) (i + j));
93 }
94 band.WriteRaster_Direct(0, i, xsize, 1, gdalconst.GDT_Float32, byteBuffer);
95 }
96 }
97 else
98 {
99 for( int i = 0; i < ysize; i++) {
100 for( int j = 0; j < xsize; j++) {
101 floatArray[j] = (float) (i + j);
102 }
103 band.WriteRaster(0, i, xsize, 1, floatArray);

Callers

nothing calls this directly

Calls 11

putMethod · 0.80
WriteRaster_DirectMethod · 0.80
deleteMethod · 0.80
ReadRaster_DirectMethod · 0.80
GetDriverByNameMethod · 0.45
CreateMethod · 0.45
GetRasterBandMethod · 0.45
WriteRasterMethod · 0.45
OpenMethod · 0.45
ReadRasterMethod · 0.45
UnlinkMethod · 0.45

Tested by

no test coverage detected