Revision 1431 trunk/libraries/libjni-ecwcompress/src-test/TifToEcw.java
TifToEcw.java | ||
---|---|---|
5 | 5 |
public static void main(String[] args){ |
6 | 6 |
|
7 | 7 |
Gdal migdal=new Gdal(); |
8 |
NCSEcwCompressClient client; |
|
8 | 9 |
|
9 | 10 |
try{ |
10 | 11 |
if(args.length>0) |
... | ... | |
20 | 21 |
int nysize=0; |
21 | 22 |
int rastercount=0; |
22 | 23 |
String rasterband; |
23 |
GeoTransform gt; |
|
24 |
GeoTransform gt=null;
|
|
24 | 25 |
|
25 | 26 |
try{ |
26 | 27 |
rastercount=migdal.getRasterCount(); |
... | ... | |
45 | 46 |
//........... |
46 | 47 |
} |
47 | 48 |
|
48 |
|
|
49 |
try{ |
|
50 |
client = new NCSEcwCompressClient(); |
|
51 |
|
|
52 |
client.setOutputFilename(args[1]); |
|
53 |
client.setInputFilename(args[0]); |
|
54 |
client.setTargetCompress(Double.parseDouble(args[2])); |
|
55 |
client.setInOutSizeX(nxsize); |
|
56 |
client.setInOutSizeY(nysize); |
|
57 |
client.setInputBands(rastercount); |
|
58 |
|
|
59 |
if(rastercount == 1) { |
|
60 |
client.setCompressFormat(CompressFormat.COMPRESS_UINT8); |
|
61 |
} |
|
62 |
else if(rastercount == 3) { |
|
63 |
client.setCompressFormat(CompressFormat.COMPRESS_RGB); |
|
64 |
} |
|
65 |
else { |
|
66 |
client.setCompressFormat(CompressFormat.COMPRESS_MULTI); |
|
67 |
} |
|
68 |
|
|
69 |
client.setCellIncrementX(gt.adfgeotransform[1]); |
|
70 |
client.setCellIncrementY(gt.adfgeotransform[5]); |
|
71 |
client.setOriginX(gt.adfgeotransform[0]); |
|
72 |
client.setOriginY(gt.adfgeotransform[3]); |
|
73 |
client.setCellSizeUnits(1); |
|
74 |
|
|
75 |
|
|
76 |
}catch(EcwException e){ |
|
77 |
e.printStackTrace(); |
|
78 |
//........... |
|
79 |
} |
|
49 | 80 |
/*for(int iBand=0;iBand<rastercount;iBand++){ |
50 | 81 |
|
51 | 82 |
int tipo=0; |
Also available in: Unified diff