Revision 1020

View differences:

org.gvsig.raster.ermapper/trunk/org.gvsig.raster.ermapper/org.gvsig.raster.ermapper.jni/src/main/native/CMakeLists.txt
1
add_subdirectory(jecw)
2

  
3

  
0 4

  
org.gvsig.raster.ermapper/trunk/org.gvsig.raster.ermapper/org.gvsig.raster.ermapper.jni/src/main/java/com/ermapper/util/JNCSScreenPoint.java
1
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
2
// Jad home page: http://www.kpdus.com/jad.html
3
// Decompiler options: packimports(3) 
4
// Source File Name:   JNCSScreenPoint.java
5

  
6
package com.ermapper.util;
7

  
8

  
9
public class JNCSScreenPoint
10
{
11

  
12
    public JNCSScreenPoint()
13
    {
14
        x = 0;
15
        y = 0;
16
    }
17

  
18
    public JNCSScreenPoint(int i, int j)
19
    {
20
        x = i;
21
        y = j;
22
    }
23

  
24
    public int x;
25
    public int y;
26
}
0 27

  
org.gvsig.raster.ermapper/trunk/org.gvsig.raster.ermapper/org.gvsig.raster.ermapper.jni/src/main/java/com/ermapper/util/JNCSDatasetPoint.java
1
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
2
// Jad home page: http://www.kpdus.com/jad.html
3
// Decompiler options: packimports(3) 
4
// Source File Name:   JNCSDatasetPoint.java
5

  
6
package com.ermapper.util;
7

  
8

  
9
public class JNCSDatasetPoint
10
{
11

  
12
    public JNCSDatasetPoint()
13
    {
14
        x = 0;
15
        y = 0;
16
    }
17

  
18
    public JNCSDatasetPoint(int i, int j)
19
    {
20
        x = i;
21
        y = j;
22
    }
23

  
24
    public int x;
25
    public int y;
26
}
0 27

  
org.gvsig.raster.ermapper/trunk/org.gvsig.raster.ermapper/org.gvsig.raster.ermapper.jni/src/main/java/com/ermapper/util/JNCSWorldPoint.java
1
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
2
// Jad home page: http://www.kpdus.com/jad.html
3
// Decompiler options: packimports(3) 
4
// Source File Name:   JNCSWorldPoint.java
5

  
6
package com.ermapper.util;
7

  
8

  
9
public class JNCSWorldPoint
10
{
11

  
12
    public JNCSWorldPoint()
13
    {
14
        x = 0.0D;
15
        y = 0.0D;
16
        z = 0.0D;
17
    }
18

  
19
    public JNCSWorldPoint(double d, double d1)
20
    {
21
        x = d;
22
        y = d1;
23
    }
24

  
25
    public JNCSWorldPoint(double d, double d1, double d2)
26
    {
27
        x = d;
28
        y = d1;
29
        z = d2;
30
    }
31

  
32
    public double x;
33
    public double y;
34
    public double z;
35
}
0 36

  
org.gvsig.raster.ermapper/trunk/org.gvsig.raster.ermapper/org.gvsig.raster.ermapper.jni/src/main/java/com/ermapper/ecw/JNCSFileOpenFailedException.java
1
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
2
// Jad home page: http://www.kpdus.com/jad.html
3
// Decompiler options: packimports(3) 
4
// Source File Name:   JNCSFileOpenFailedException.java
5

  
6
package com.ermapper.ecw;
7

  
8

  
9
// Referenced classes of package com.ermapper.ecw:
10
//            JNCSException
11

  
12
public class JNCSFileOpenFailedException extends JNCSException
13
{
14

  
15
    public JNCSFileOpenFailedException()
16
    {
17
    }
18

  
19
    public JNCSFileOpenFailedException(String s)
20
    {
21
        super(s);
22
    }
23
}
0 24

  
org.gvsig.raster.ermapper/trunk/org.gvsig.raster.ermapper/org.gvsig.raster.ermapper.jni/src/main/java/com/ermapper/ecw/JNCSRenderer.java
1
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
2
// Jad home page: http://www.kpdus.com/jad.html
3
// Decompiler options: packimports(3) 
4
// Source File Name:   JNCSRenderer.java
5

  
6
package com.ermapper.ecw;
7

  
8
import com.ermapper.util.JNCSDatasetPoint;
9
import com.ermapper.util.JNCSWorldPoint;
10
import java.awt.*;
11
import java.awt.image.*;
12
import java.io.PrintStream;
13
import java.util.StringTokenizer;
14

  
15
// Referenced classes of package com.ermapper.ecw:
16
//            JNCSFile, JNCSException, JNCSFileOpenFailedException, JNCSFileNotOpenException, 
17
//            JNCSInvalidSetViewException, JNCSProgressiveUpdate
18

  
19
public class JNCSRenderer extends JNCSFile
20
{
21

  
22
    public JNCSRenderer()
23
        throws JNCSException
24
    {
25
        pRGBArray = null;
26
        outputDeviceCoords = new double[4];
27
        ecwImage = null;
28
        prevImageSizeX = -1;
29
        prevImageSizeY = -1;
30
        bHaveValidSetView = false;
31
        transparencyValue = 1.0F;
32
        alphaComposite = null;
33
        memImSource = null;
34
    }
35

  
36
    public JNCSRenderer(String s, boolean flag)
37
        throws JNCSFileOpenFailedException, JNCSException
38
    {
39
        pRGBArray = null;
40
        outputDeviceCoords = new double[4];
41
        ecwImage = null;
42
        prevImageSizeX = -1;
43
        prevImageSizeY = -1;
44
        bHaveValidSetView = false;
45
        transparencyValue = 1.0F;
46
        alphaComposite = null;
47
        memImSource = null;
48
        open(s, flag);
49
    }
50

  
51
    public void setTransparency(float f)
52
    {
53
        transparencyValue = f;
54
        if(bHave1_2VM)
55
            alphaComposite = AlphaComposite.getInstance(3, transparencyValue);
56
    }
57

  
58
    public int setView(int i, int ai[], int j, int k, int l, int i1, int j1, 
59
            int k1)
60
        throws JNCSFileNotOpenException, JNCSInvalidSetViewException
61
    {
62
        int l1 = j;
63
        int i2 = k;
64
        int j2 = l;
65
        int k2 = i1;
66
        if(j < 0)
67
            l1 = 0;
68
        if(k < 0)
69
            i2 = 0;
70
        if(l > super.width - 1)
71
            j2 = super.width - 1;
72
        if(i1 > super.height - 1)
73
            k2 = super.height - 1;
74
        int l2 = (int)Math.round(((double)(l1 - j) / (double)(l - j)) * (double)j1);
75
        int i3 = (int)Math.round(((double)(i2 - k) / (double)(i1 - k)) * (double)k1);
76
        int j3 = (int)Math.round(((double)(j2 - j) / (double)(l - j)) * (double)j1);
77
        int k3 = (int)Math.round(((double)(k2 - k) / (double)(i1 - k)) * (double)k1);
78
        super.setView(i, ai, l1, i2, j2, k2, j3 - l2, k3 - i3);
79
        bHaveValidSetView = true;
80
        if(!super.progressive)
81
        {
82
            dRendererSetViewDatasetTLX = l1;
83
            dRendererSetViewDatasetTLY = l1;
84
            dRendererSetViewDatasetBRX = j2;
85
            dRendererSetViewDatasetBRY = k2;
86
            dRendererSetViewWidth = j3 - l2;
87
            dRendererSetViewHeight = k3 - i3;
88
        }
89
        return 0;
90
    }
91

  
92
    public int setView(int i, int ai[], double d, double d1, double d2, double d3, int j, int k)
93
        throws JNCSFileNotOpenException, JNCSInvalidSetViewException
94
    {
95
        JNCSDatasetPoint jncsdatasetpoint = convertWorldToDataset(d, d1);
96
        JNCSDatasetPoint jncsdatasetpoint1 = convertWorldToDataset(d2, d3);
97
        double d4 = d;
98
        double d5 = d1;
99
        double d6 = d2;
100
        double d7 = d3;
101
        jncsdatasetpoint.x = (int)Math.floor((d4 - super.originX) / super.cellIncrementX);
102
        jncsdatasetpoint.y = (int)Math.floor((d5 - super.originY) / super.cellIncrementY);
103
        jncsdatasetpoint1.x = (int)Math.ceil((d6 - super.originX) / super.cellIncrementX);
104
        jncsdatasetpoint1.y = (int)Math.ceil((d7 - super.originY) / super.cellIncrementY);
105
        JNCSWorldPoint jncsworldpoint = convertDatasetToWorld(jncsdatasetpoint.x, jncsdatasetpoint.y);
106
        JNCSWorldPoint jncsworldpoint1 = convertDatasetToWorld(jncsdatasetpoint1.x, jncsdatasetpoint1.y);
107
        d4 = jncsworldpoint.x;
108
        d5 = jncsworldpoint.y;
109
        d6 = jncsworldpoint1.x;
110
        d7 = jncsworldpoint1.y;
111
        if(jncsdatasetpoint.x < 0)
112
            d4 = super.originX;
113
        if(jncsdatasetpoint.y < 0)
114
            d5 = super.originY;
115
        if(jncsdatasetpoint1.x > super.width - 1)
116
            d6 = super.originX + (double)(super.width - 1) * super.cellIncrementX;
117
        if(jncsdatasetpoint1.y > super.height - 1)
118
            d7 = super.originY + (double)(super.height - 1) * super.cellIncrementY;
119
        if(jncsdatasetpoint.x < 0 && jncsdatasetpoint1.x < 0 || jncsdatasetpoint.x > super.width - 1 && jncsdatasetpoint1.x > super.width - 1)
120
        {
121
            bHaveValidSetView = false;
122
            return 1;
123
        }
124
        if(jncsdatasetpoint.y < 0 && jncsdatasetpoint1.y < 0 || jncsdatasetpoint.y > super.height - 1 && jncsdatasetpoint1.y > super.height - 1)
125
        {
126
            bHaveValidSetView = false;
127
            return 1;
128
        }
129
        int l = (int)Math.round(((d4 - d) / (d2 - d)) * (double)j);
130
        int i1 = (int)Math.round(((d5 - d1) / (d3 - d1)) * (double)k);
131
        int j1 = (int)Math.round(((d6 - d) / (d2 - d)) * (double)j);
132
        int k1 = (int)Math.round(((d7 - d1) / (d3 - d1)) * (double)k);
133
        if(j1 - l > jncsdatasetpoint1.x - jncsdatasetpoint.x)
134
        {
135
            j1 = jncsdatasetpoint1.x;
136
            l = jncsdatasetpoint.x;
137
        }
138
        if(k1 - i1 > jncsdatasetpoint1.y - jncsdatasetpoint.y)
139
        {
140
            k1 = jncsdatasetpoint1.y;
141
            i1 = jncsdatasetpoint.y;
142
        }
143
        if(j1 - l < 1 || k1 - i1 < 1)
144
        {
145
            bHaveValidSetView = false;
146
            return 1;
147
        }
148
        super.setView(i, ai, d4, d5, d6, d7, j1 - l, k1 - i1);
149
        bHaveValidSetView = true;
150
        if(!super.progressive)
151
        {
152
            dRendererSetViewWorldTLX = d4;
153
            dRendererSetViewWorldTLY = d5;
154
            dRendererSetViewWorldBRX = d6;
155
            dRendererSetViewWorldBRY = d7;
156
            dRendererSetViewWidth = j1 - l;
157
            dRendererSetViewHeight = k1 - i1;
158
        }
159
        return 0;
160
    }
161

  
162
    public void refreshUpdate(int i, int j, double d, double d1, double d2, double d3)
163
    {
164
        ecwReadImage(i, j, d, d1, d2, d3);
165
        if(super.progImageClient != null)
166
            super.progImageClient.refreshUpdate(i, j, d, d1, d2, d3);
167
    }
168

  
169
    public void refreshUpdate(int i, int j, int k, int l, double d, int i1)
170
    {
171
        ecwReadImage(i, j, k, l, d, i1);
172
        if(super.progImageClient != null)
173
            super.progImageClient.refreshUpdate(i, j, k, l, d, i1);
174
    }
175

  
176
    private boolean ecwReadImage(int i, int j, double d, double d1, double d2, double d3)
177
    {
178
        Image image = null;
179
        boolean flag = false;
180
        if(prevImageSizeX != i || prevImageSizeY != j)
181
        {
182
            pRGBArray = new int[i * j];
183
            prevImageSizeX = i;
184
            prevImageSizeY = j;
185
            flag = true;
186
        }
187
        try
188
        {
189
            readImageRGBA(pRGBArray, i, j);
190
            if(flag)
191
            {
192
                memImSource = null;
193
                memImSource = new MemoryImageSource(i, j, ecwColorModel, pRGBArray, 0, i);
194
            } else
195
            {
196
                memImSource.newPixels(pRGBArray, ecwColorModel, 0, i);
197
            }
198
        }
199
        catch(JNCSException jncsexception)
200
        {
201
            System.out.print(String.valueOf(String.valueOf((new StringBuffer("readImageRGBA failed :")).append(jncsexception.toString()).append("\n"))));
202
            bHaveValidSetView = false;
203
            boolean flag1 = false;
204
            return flag1;
205
        }
206
        image = Toolkit.getDefaultToolkit().createImage(memImSource);
207
        if(ecwImage == null)
208
        {
209
            ecwImage = image;
210
            dRendererWorldTLX = d;
211
            dRendererWorldTLY = d1;
212
            dRendererWorldBRX = d2;
213
            dRendererWorldBRY = d3;
214
        } else
215
        {
216
            synchronized(ecwImage)
217
            {
218
                ecwImage = image;
219
                dRendererWorldTLX = d;
220
                dRendererWorldTLY = d1;
221
                dRendererWorldBRX = d2;
222
                dRendererWorldBRY = d3;
223
            }
224
        }
225
        bHaveValidSetView = false;
226
        return true;
227
    }
228

  
229
    public void drawImage(Graphics g, int i, int j, int k, int l, double d, 
230
            double d1, double d2, double d3, ImageObserver imageobserver)
231
    {
232
        if(!super.progressive && bHaveValidSetView)
233
            ecwReadImage(dRendererSetViewWidth, dRendererSetViewHeight, dRendererSetViewWorldTLX, dRendererSetViewWorldTLY, dRendererSetViewWorldBRX, dRendererSetViewWorldBRY);
234
        if(super.progressive && ecwImage == null)
235
            return;
236
        synchronized(ecwImage)
237
        {
238
            if(bHave1_2VM)
239
                if((double)transparencyValue == 1.0D);
240
            calculateDeviceCoords(i, j, i + k, j + l, d, d1, d2, d3, outputDeviceCoords);
241
            int i1 = (int)Math.round(outputDeviceCoords[2] - outputDeviceCoords[0]);
242
            int j1 = (int)Math.round(outputDeviceCoords[3] - outputDeviceCoords[1]);
243
            int k1 = ecwImage.getWidth(imageobserver);
244
            int l1 = ecwImage.getHeight(imageobserver);
245
            if(i1 != k1 || j1 != l1)
246
            {
247
                if(i1 > k1 && j1 > l1)
248
                {
249
                    double d4 = outputDeviceCoords[0] >= (double)i ? outputDeviceCoords[0] : i;
250
                    double d5 = outputDeviceCoords[1] >= (double)j ? outputDeviceCoords[1] : j;
251
                    double d6 = outputDeviceCoords[2] <= (double)(i + k) ? outputDeviceCoords[2] : i + k;
252
                    double d7 = outputDeviceCoords[3] <= (double)(j + l) ? outputDeviceCoords[3] : j + l;
253
                    double ad[] = calculateImageCoords(outputDeviceCoords[0], outputDeviceCoords[1], outputDeviceCoords[2], outputDeviceCoords[3], k1, l1, d4, d5, d6, d7);
254
                    ad[0] = Math.floor(ad[0]);
255
                    ad[1] = Math.floor(ad[1]);
256
                    ad[2] = Math.ceil(ad[2]);
257
                    ad[3] = Math.ceil(ad[3]);
258
                    double d8 = dRendererWorldTLX + ((dRendererWorldBRX - dRendererWorldTLX) / (double)k1) * ad[0];
259
                    double d9 = dRendererWorldTLY + ((dRendererWorldBRY - dRendererWorldTLY) / (double)l1) * ad[1];
260
                    double d10 = dRendererWorldTLX + ((dRendererWorldBRX - dRendererWorldTLX) / (double)k1) * ad[2];
261
                    double d11 = dRendererWorldTLY + ((dRendererWorldBRY - dRendererWorldTLY) / (double)l1) * ad[3];
262
                    double d12 = ((outputDeviceCoords[2] - outputDeviceCoords[0]) * (d8 - dRendererWorldTLX)) / (dRendererWorldBRX - dRendererWorldTLX) + outputDeviceCoords[0];
263
                    double d13 = ((outputDeviceCoords[3] - outputDeviceCoords[1]) * (d9 - dRendererWorldTLY)) / (dRendererWorldBRY - dRendererWorldTLY) + outputDeviceCoords[1];
264
                    double d14 = ((outputDeviceCoords[2] - outputDeviceCoords[0]) * (d10 - dRendererWorldTLX)) / (dRendererWorldBRX - dRendererWorldTLX) + outputDeviceCoords[0];
265
                    double d15 = ((outputDeviceCoords[3] - outputDeviceCoords[1]) * (d11 - dRendererWorldTLY)) / (dRendererWorldBRY - dRendererWorldTLY) + outputDeviceCoords[1];
266
                    g.drawImage(ecwImage, (int)Math.round(d12), (int)Math.round(d13), (int)Math.round(d14), (int)Math.round(d15), (int)Math.floor(ad[0]), (int)Math.floor(ad[1]), (int)Math.ceil(ad[2]), (int)Math.ceil(ad[3]), imageobserver);
267
                } else
268
                {
269
                    g.drawImage(ecwImage, (int)Math.round(outputDeviceCoords[0]), (int)Math.round(outputDeviceCoords[1]), (int)Math.round(outputDeviceCoords[2]), (int)Math.round(outputDeviceCoords[3]), 0, 0, k1, l1, imageobserver);
270
                }
271
            } else
272
            {
273
                g.drawImage(ecwImage, (int)Math.round(outputDeviceCoords[0]), (int)Math.round(outputDeviceCoords[1]), imageobserver);
274
            }
275
            if(bHave1_2VM)
276
                if((double)transparencyValue == 1.0D);
277
        }
278
    }
279

  
280
    private static final double[] calculateImageCoords(double d, double d1, double d2, double d3, 
281
            double d4, double d5, double d6, double d7, double d8, double d9)
282
    {
283
        double ad[] = new double[4];
284
        double d10 = ((d8 - d6) * d4) / (d2 - d);
285
        double d11 = ((d9 - d7) * d5) / (d3 - d1);
286
        ad[0] = ((d6 - d) * d10) / (d8 - d6);
287
        ad[1] = ((d7 - d1) * d11) / (d9 - d7);
288
        ad[2] = ad[0] + d10;
289
        ad[3] = ad[1] + d11;
290
        return ad;
291
    }
292

  
293
    private final void calculateDeviceCoords(int i, int j, int k, int l, double d, double d1, double d2, double d3, double ad[])
294
    {
295
        ad[0] = ((dRendererWorldTLX - d) / (d2 - d)) * (double)(k - i);
296
        ad[1] = ((dRendererWorldTLY - d1) / (d3 - d1)) * (double)(l - j);
297
        ad[2] = ((dRendererWorldBRX - d) / (d2 - d)) * (double)(k - i);
298
        ad[3] = ((dRendererWorldBRY - d1) / (d3 - d1)) * (double)(l - j);
299
    }
300

  
301
    private final void convertImageToWorld(int i, int j, double d, double d1, double ad[])
302
    {
303
        ad[0] = dRendererWorldTLX + ((dRendererWorldBRX - dRendererWorldTLX) / (double)i) * d;
304
        ad[1] = dRendererWorldTLY + ((dRendererWorldBRY - dRendererWorldTLY) / (double)j) * d1;
305
    }
306

  
307
    private double dRendererSetViewWorldTLX;
308
    private double dRendererSetViewWorldTLY;
309
    private double dRendererSetViewWorldBRX;
310
    private double dRendererSetViewWorldBRY;
311
    private int dRendererSetViewDatasetTLX;
312
    private int dRendererSetViewDatasetTLY;
313
    private int dRendererSetViewDatasetBRX;
314
    private int dRendererSetViewDatasetBRY;
315
    private int dRendererSetViewWidth;
316
    private int dRendererSetViewHeight;
317
    private int pRGBArray[];
318
    private double outputDeviceCoords[];
319
    private double dRendererWorldTLX;
320
    private double dRendererWorldTLY;
321
    private double dRendererWorldBRX;
322
    private double dRendererWorldBRY;
323
    private Image ecwImage;
324
    private int prevImageSizeX;
325
    private int prevImageSizeY;
326
    private boolean bHaveValidSetView;
327
    private float transparencyValue;
328
    private AlphaComposite alphaComposite;
329
    private static boolean bHave1_2VM = false;
330
    private MemoryImageSource memImSource;
331
    private static DirectColorModel ecwColorModel = null;
332
    private static final boolean bOptimizeImageStretch = true;
333

  
334
    static 
335
    {
336
        String s = System.getProperty("java.version");
337
        StringTokenizer stringtokenizer = new StringTokenizer(s, ".");
338
        int i = Integer.parseInt(stringtokenizer.nextToken());
339
        int j = Integer.parseInt(stringtokenizer.nextToken());
340
        if(i >= 1 && j >= 2)
341
            bHave1_2VM = true;
342
        ecwColorModel = new DirectColorModel(32, 0xff0000, 65280, 255);
343
    }
344
}
0 345

  
org.gvsig.raster.ermapper/trunk/org.gvsig.raster.ermapper/org.gvsig.raster.ermapper.jni/src/main/java/com/ermapper/ecw/JNCSError.java
1
package com.ermapper.ecw;
2

  
3
/**
4
 * Representaci?n de errores como cadenas de texto  
5
 */
6
public class JNCSError{
7

  
8
	public static String getError(int e){
9
		
10
		switch(e){
11
			case 0: return new String("No error");												/* NCS_SUCCESS											*/
12
			/* NCS Raster Errors */
13
			case 1: return new String("Queue node creation failed");							/* NCS_QUEUE_NODE_CREATE_FAILED							*/
14
			case 2: return new String("Could not open file");						/* NCS_FILE_OPEN_FAILED									*/
15
			case 3: return new String("The Image Web Server's licensed file limit has been reached ");							/* NCS_FILE_LIMIT_REACHED (license name eg office) */
16
			case 4: return new String("The requested file is larger than is permitted by the license on this Image Web Server ");/* NCS_FILE_SIZE_LIMIT_REACHED (license name eg office)	*/
17
			case 5: return new String("Not enough memory for new file");															/* NCS_FILE_NO_MEMORY				*/
18
			case 6: return new String("The Image Web Server's licensed client limit has been reached ");							/* NCS_CLIENT_LIMIT_REACHED	(license name eg enterprise) */
19
			case 7: return new String("Detected duplicate open from net layer");				/* NCS_DUPLICATE_OPEN									*/
20
			case 8: return new String("Packet request type not yet implemented");			/* NCS_PACKET_REQUEST_NYI (packet type num)				*/
21
			case 9: return new String("Packet type is illegal");							/* NCS_PACKET_TYPE_ILLEGAL (packet type num)			*/
22
			case 10: return new String("Client closed while requests outstanding");				/* NCS_DESTROY_CLIENT_DANGLING_REQUESTS					*/
23
	
24
			/* NCS Network Errors */
25
			case 11: return new String("Client UID unknown");									/* NCS_UNKNOWN_CLIENT_UID								*/
26
			case 12: return new String("Could not create new client ");						/* NCS_COULDNT_CREATE_CLIENT (reason)					*/
27
			case 13: return new String("Could not resolve address of Image Web Server ");		/* NCS_NET_COULDNT_RESOLVE_HOST	(ip or hostname)		*/
28
			case 14: return new String("Could not connect to host ");							/* NCS_NET_COULDNT_CONNECT (reason)						*/
29
			case 15: return new String("Receive timeout");										/* NCS_NET_RECV_TIMEOUT									*/
30
			case 16: return new String("Error sending header ");								/* NCS_NET_HEADER_SEND_FAILURE (reason)					*/
31
			case 17: return new String("Error receiving header ");							/* NCS_NET_HEADER_RECV_FAILURE (reason)					*/
32
			case 18: return new String("Error sending packet");									/* NCS_NET_PACKET_SEND_FAILURE							*/
33
			case 19: return new String("Error receiving packet");								/* NCS_NET_PACKET_RECV_FAILURE							*/
34
			case 20: return new String("401 Unauthorised");										/* NCS_NET_401_UNAUTHORISED								*/
35
			case 21: return new String("403 Forbidden");										/* NCS_NET_403_FORBIDDEN								*/
36
			case 22: return new String("Is the host an Image Web Server?");						/* NCS_NET_404_NOT_FOUND								*/
37
			case 23: return new String("Your HTTP proxy requires authentication,\nthis is presently unsupported by the Image Web Server control");	/*	NCS_NET_407_PROXYAUTH */
38
			case 24: return new String("Unexpected HTTP response ");								/* NCS_NET_UNEXPECTED_RESPONSE (resonse # or string)*/
39
			case 25: return new String("Bad HTTP response ");									/* NCS_NET_BAD_RESPONSE	(resonse # or string)			*/
40
			case 26: return new String("Already connected");									/* NCS_NET_ALREADY_CONNECTED							*/
41
			case 27: return new String("The connection is invalid");							/* NCS_INVALID_CONNECTION								*/
42
			case 28: return new String("Windows sockets failure ");							/* NCS_WINSOCK_FAILURE (reason (GetLastError()) or wininet version)	*/
43
	
44
			/* NCS Symbol Errors */
45
			case 29: return new String("Symbology error");										/* NCS_SYMBOL_ERROR										*/
46
			case 30: return new String("Could not open database");								/* NCS_OPEN_DB_ERROR									*/
47
			case 31: return new String("Could not execute the requested query on database");	/* NCS_DB_QUERY_FAILED									*/
48
			case 32: return new String("SQL statement could not be executed");					/* NCS_DB_SQL_ERROR										*/
49
			case 33: return new String("Open symbol layer failed");								/* NCS_GET_LAYER_FAILED									*/
50
			case 34: return new String("The database is not open");								/* NCS_DB_NOT_OPEN										*/
51
			case 35: return new String("This type of quad tree is not supported");				/* NCS_QT_TYPE_UNSUPPORTED								*/
52
	
53
			/* Preference errors */
54
			case 36: return new String("Invalid local user key name specified ");				/* NCS_PREF_INVALID_USER_KEY (key name)					*/
55
			case 37: return new String("Invalid local machine key name specified ");			/* NCS_PREF_INVALID_MACHINE_KEY	(local machine key)		*/
56
			case 38: return new String("Failed to open registry key ");						/* NCS_REGKEY_OPENEX_FAILED	(key name)					*/
57
			case 39: return new String("Registry query failed ");								/* NCS_REGQUERY_VALUE_FAILED (reason)					*/
58
			case 40: return new String("Type mismatch in registry variable");					/* NCS_INVALID_REG_TYPE									*/
59
	
60
			/* Misc errors */
61
			case 41: return new String("Invalid arguments passed to function ");				/* NCS_INVALID_ARGUMENTS (function name)				*/
62
			case 42: return new String("ECW error ");											/* NCS_ECW_ERROR (reason)								*/
63
			case 43: return new String("Server error ");										/* NCS_SERVER_ERROR (reason)							*/
64
			case 44: return new String("Unknown error ");										/* NCS_UNKNOWN_ERROR (reason)							*/
65
			case 45: return new String("Extent conversion failed");								/* NCS_EXTENT_ERROR										*/
66
			case 46: return new String("Could not allocate enough memory ");					/* NCS_COULDNT_ALLOC_MEMORY	(what trying to malloc)	[12]*/
67
			case 47: return new String("An invalid parameter was used ");						/* NCS_INVALID_PARAMETER (reason)						*/
68
			
69
			/* Compress errors */
70
			case 48: return new String("Could not perform Read/Write on file ");				/* NCS_FILEIO_ERROR	(filename)							*/
71
			case 49: return new String("Could not open compression task ");					/* NCS_COULDNT_OPEN_COMPRESSION	(reason)				*/
72
			case 50: return new String("Could not perform compression ");						/* NCS_COULDNT_PERFORM_COMPRESSION	(reason)			*/
73
			case 51: return new String("Trying to generate too many output lines");				/* NCS_GENERATED_TOO_MANY_OUTPUT_LINES					*/
74
			case 52: return new String("User cancelled compression");							/* NCS_USER_CANCELLED_COMPRESSION						*/
75
			case 53: return new String("Could not read line from input image file");			/* NCS_COULDNT_READ_INPUT_LINE							*/
76
			case 54: return new String("Input image size exceeded for this version");			/* NCS_INPUT_SIZE_EXCEEDED								*/
77
	
78
			/* Decompression Errors */
79
			case 55: return new String("Specified image region is outside image area");			/* NCS_REGION_OUTSIDE_FILE								*/
80
			case 56: return new String("Supersampling not supported");							/* NCS_NO_SUPERSAMPLE									*/
81
			case 57: return new String("Specified image region has a zero width or height");	/* NCS_ZERO_SIZE										*/
82
			case 58: return new String("More bands specified than exist in this file ");/* NCS_TOO_MANY_BANDS	(bands passed); bands in file)	*/
83
			case 59: return new String("An invalid band number has been specified ");			/* NCS_INVALID_BAND_NR (bandnr)							*/
84
			
85
			/* New Compression Error */
86
			case 60: return new String("Input image size is too small to compress");			/* NCS_INPUT_SIZE_TOO_SMALL								*/
87
			/* NEW Network error */
88
			case 61: return new String("The ECWP client version is incompatible with this server "); /* NCS_INCOMPATIBLE_PROTOCOL_VERSION (clientver, server ver) */
89
			case 62: return new String("Windows Internet Client error ");						/* NCS_WININET_FAILURE	(reason)						*/
90
			case 63: return new String("Could not load wininet.dll ");						/* NCS_COULDNT_LOAD_WININET	(reason)					*/
91
	
92
			/* NCSFile && NCSRenderer class errors */
93
			case 64: return new String("Invalid SetView parameters or SetView not called.");	/* NCS_FILE_INVALID_SETVIEW								*/
94
			case 65: return new String("There is no open ECW file.");							/* NCS_FILE_NOT_OPEN									*/
95
	
96
			/* NEW JNI Java Errors */
97
			case 66: return new String("Class does not implement ECWProgressiveDisplay interface.");/* NCS_JNI_REFRESH_NOT_IMPLEMENTED */
98
	
99
			/* NEW Coordinate Errors */
100
			case 67: return new String("Incompatible coordinate systems");						/* NCS_INCOMPATIBLE_COORDINATE_SYSTEMS					*/
101
			case 68: return new String("Incompatible coordinate datum types");					/* NCS_INCOMPATIBLE_COORDINATE_DATUM					*/
102
			case 69: return new String("Incompatible coordinate projection types");				/* NCS_INCOMPATIBLE_COORDINATE_PROJECTION				*/
103
			case 70: return new String("Incompatible coordinate units types");					/* NCS_INCOMPATIBLE_COORDINATE_UNITS					*/
104
			case 71: return new String("Non-linear coordinate systems not supported");			/* NCS_COORDINATE_CANNOT_BE_TRANSFORMED					*/
105
			case 72: return new String("GDT Error  ");										/* NCS_GDT_ERROR (reason)								*/
106
			case 73: return new String("Zero length packet : ");								/* NCS_NET_PACKET_RECV_ZERO_LENGTH (reason)             */ /**[01]**/
107
			case 74: return new String("Must use Japanese version of the ECW SDK");				/* NCS_UNSUPPORTEDLANGUAGE								*/ /**[02]**/
108
			case 75: return new String("Lost of connection to server  ");					/* NCS_CONNECTION_LOST									*/ /**[03]**/
109
			case 76: return new String("NCSGdt coordinate conversion failed  ");				/* NCS_COORD_CONVERT_ERROR */
110
			case 77: return new String("Failed to open metabase  ");							/* NCS_METABASE_OPEN_FAILED*/				/**[04]**/
111
			case 78: return new String("Failed to get value from metabase  ");				/* NCS_METABASE_GET_FAILED*/				/**[04]**/
112
			case 79: return new String("Timeout sending header  ");							/* NCS_NET_HEADER_SEND_TIMEOUT*/			/**[05]**/
113
			case 80: return new String("Java JNI error  ");									/* NCS_JNI_ERROR */						/**[06]**/
114
			case 81: return new String("No data source passed");								/* NCS_DB_INVALID_NAME									*/
115
			case 82: return new String("Could not resolve address of Image Web Server Symbol Server Extension");		/* NCS_SYMBOL_COULDNT_RESOLVE_HOST		*/
116
			case 83: return new String("Invalid NCSError value!");							/* NCS_INVALID_ERROR_ENUM */			/**[08]**/
117
			/* NCSFileIO errors [10] */
118
			case 84: return new String("End Of File reached  ");									/* NCS_FILE_EOF					[10]	*/
119
			case 85: return new String("File not found ");										/* NCS_FILE_NOT_FOUND			[10]	*/
120
			case 86: return new String("File is invalid or corrupt  ");							/* NCS_FILE_INVALID				[10]	*/
121
			case 87: return new String("Attempted to read, write or seek past file limits  ");	/* NCS_FILE_SEEK_ERROR			[10]	*/
122
			case 88: return new String("Permissions not available to access file  ");			/* NCS_FILE_NO_PERMISSIONS		[10]	*/
123
			case 89: return new String("File open error ");										/* NCS_FILE_OPEN_ERROR			[10]	*/
124
			case 90: return new String("File close error  ");									/* NCS_FILE_CLOSE_ERROR			[10]	*/
125
			case 91: return new String("File IO error  ");										/* NCS_FILE_IO_ERROR			[10]	*/
126
			
127
			case 92: return new String("Illegal World Coordinates  ");							/* NCS_SET_EXTENTS_ERROR		[13]	*/
128
	
129
			case 93: return new String("Image projection doesn't match controlling layer  ");	/* NCS_FILE_PROJECTION_MISMATCH		[14]	*/
130
	
131
			/** 1.65 gdt errors [15]**/
132
			case 94: return new String("Unknown map projection ");							/*NCS_GDT_UNKNOWN_PROJECTION,*/
133
			case 95: return new String("Unknown datum ");									/*NCS_GDT_UNKNOWN_DATUM,*/
134
			case 96: return new String("User specified Geographic Projection Database data server failed while loading .  Please check your network connection and if the problem persists contact the website administrator.");			/*NCS_GDT_USER_SERVER_FAILED*/
135
			case 97: return new String("Remote Geographic Projection Database file downloading has been disable and no Geographic Projection Database data is locally available");	/*NCS_GDT_REMOTE_PATH_DISABLED*/
136
			case 98: return new String("Invalid transform mode ");							/*NCS_GDT_BAD_TRANSFORM_MODE,			[17]**/
137
	
138
			case 99: return new String("coordinate to be transformed is out of bounds ");	/*NCS_GDT_TRANSFORM_OUT_OF_BOUNDS*/
139
	
140
			case 100: return new String("Layer already exists with this name  ");				/*NCS_LAYER_DUPLICATE_LAYER_NAME*/	/**[17]**/
141
			case 101: return new String("Layer does not contain this parameter  ");			/*NCS_LAYER_INVALID_PARAMETER*/		/**[18]**/
142
	
143
			case 102: return new String("Failed to create pipe ");							/*NCS_PIPE_CREATE_FAILED*/ /**[19]**/
144
			/* Directory creation errors */
145
			case 103: return new String("Directory already exists  ");						/*[20] NCS_FILE_MKDIR_EXISTS, Directory already exists */
146
			case 104: return new String("The path was not found  ");							/*[20] NCS_FILE_MKDIR_PATH_NOT_FOUND, The path for the location of the new dir does not exist */
147
	
148
			case 105: return new String("The read was cancelled");
149
			case 106: return new String("Error reading georeferencing data from JPEG 2000 file "); /*[21] NCS_JP2_GEODATA_READ_ERROR*/
150
			case 107: return new String("Error writing georeferencing data to JPEG 2000 file"); /*[21] NCS_JP2_GEODATA_READ_ERROR*/
151
			case 108: return new String("JPEG 2000 file is not or should not be georeferenced"); /*[21] NCS_JP2_GEODATA_NOT_GEOREFERENCED*/
152
	
153
			// Insert new errors before here!
154
			case 109: return new String("Max NCSError enum value!");							/* NCS_MAX_ERROR_NUMBER */				/**[08]**/
155
			
156
		}
157
		return new String("");
158
	}
159
	
160
}
0 161

  
org.gvsig.raster.ermapper/trunk/org.gvsig.raster.ermapper/org.gvsig.raster.ermapper.jni/src/main/java/com/ermapper/ecw/JNCSNativeLibraryException.java
1
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
2
// Jad home page: http://www.kpdus.com/jad.html
3
// Decompiler options: packimports(3) 
4
// Source File Name:   JNCSNativeLibraryException.java
5

  
6
package com.ermapper.ecw;
7

  
8

  
9
// Referenced classes of package com.ermapper.ecw:
10
//            JNCSException
11

  
12
public class JNCSNativeLibraryException extends JNCSException
13
{
14

  
15
    public JNCSNativeLibraryException()
16
    {
17
    }
18

  
19
    public JNCSNativeLibraryException(String s)
20
    {
21
        super(s);
22
    }
23
}
0 24

  
org.gvsig.raster.ermapper/trunk/org.gvsig.raster.ermapper/org.gvsig.raster.ermapper.jni/src/main/java/com/ermapper/ecw/JNCSProgressiveUpdate.java
1
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
2
// Jad home page: http://www.kpdus.com/jad.html
3
// Decompiler options: packimports(3) 
4
// Source File Name:   JNCSProgressiveUpdate.java
5

  
6
package com.ermapper.ecw;
7

  
8

  
9
public interface JNCSProgressiveUpdate
10
{
11

  
12
    public abstract void refreshUpdate(int i, int j, double d, double d1, double d2, double d3);
13

  
14
    public abstract void refreshUpdate(int i, int j, int k, int l, int i1, int j1);
15
}
0 16

  
org.gvsig.raster.ermapper/trunk/org.gvsig.raster.ermapper/org.gvsig.raster.ermapper.jni/src/main/java/com/ermapper/ecw/JNCSInvalidSetViewException.java
1
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
2
// Jad home page: http://www.kpdus.com/jad.html
3
// Decompiler options: packimports(3) 
4
// Source File Name:   JNCSInvalidSetViewException.java
5

  
6
package com.ermapper.ecw;
7

  
8

  
9
// Referenced classes of package com.ermapper.ecw:
10
//            JNCSException
11

  
12
public class JNCSInvalidSetViewException extends JNCSException
13
{
14

  
15
    public JNCSInvalidSetViewException()
16
    {
17
    }
18

  
19
    public JNCSInvalidSetViewException(String s)
20
    {
21
        super(s);
22
    }
23
}
0 24

  
org.gvsig.raster.ermapper/trunk/org.gvsig.raster.ermapper/org.gvsig.raster.ermapper.jni/src/main/java/com/ermapper/ecw/JNCSException.java
1
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
2
// Jad home page: http://www.kpdus.com/jad.html
3
// Decompiler options: packimports(3) 
4
// Source File Name:   JNCSException.java
5

  
6
package com.ermapper.ecw;
7

  
8

  
9
public class JNCSException extends Exception
10
{
11

  
12
    public JNCSException()
13
    {
14
    }
15

  
16
    public JNCSException(String s)
17
    {
18
        super(s);
19
    }
20
}
0 21

  
org.gvsig.raster.ermapper/trunk/org.gvsig.raster.ermapper/org.gvsig.raster.ermapper.jni/src/main/java/com/ermapper/ecw/JNCSFile.java
1
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
2
// Jad home page: http://www.kpdus.com/jad.html
3
// Decompiler options: packimports(3) 
4
// Source File Name:   JNCSFile.java
5
// [01] 01-Oct-2005 nbt New call to JNI function ECWOpenArray to convert name string to char array.
6

  
7
package com.ermapper.ecw;
8

  
9
import com.ermapper.util.JNCSDatasetPoint;
10
import com.ermapper.util.JNCSWorldPoint;
11
import java.io.FileInputStream;
12
import java.io.PrintStream;
13
import java.lang.reflect.Field;
14
import java.lang.reflect.Method;
15
import java.util.Properties;
16

  
17
// Referenced classes of package com.ermapper.ecw:
18
//            JNCSNativeLibraryException, JNCSFileOpenFailedException, JNCSInvalidSetViewException, JNCSException, 
19
//            JNCSFileNotOpenException, JNCSProgressiveUpdate
20

  
21
/**
22
 * Clase que representa a un fichero Ecw
23
 */
24

  
25
public class JNCSFile
26
    implements JNCSProgressiveUpdate
27
{
28

  
29
    private native int ECWOpen(String s, boolean flag);
30
    
31
    private native int ECWOpenArray(String s, boolean flag, byte[] b);
32

  
33
    private native void ECWClose(boolean flag);
34

  
35
    private native int ECWSetView(int i, int ai[], int j, int k, int l, int i1, double d, double d1, double d2, double d3, 
36
            int j1, int k1);
37

  
38
    private native int ECWReadLineRGBA(int ai[]);
39

  
40
    private native int ECWReadImageRGBA(int ai[], int i, int j);
41

  
42
    private native short ECWGetPercentComplete();
43

  
44
    private static native String ECWGetErrorString(int i);
45

  
46
    private static native int NCSJNIInit();
47

  
48
    private static native String ECWGetLibVersion();
49

  
50
    /**
51
     * Carga la libreria libecw.so que contiene el wrapper y llama a la
52
     * funci�n de inicializaci�n
53
     * @throws JNCSNativeLibraryException
54
     */
55
    
56
    static void initClass()
57
        throws JNCSNativeLibraryException
58
    {
59
    	 boolean flag = false;
60
         boolean flag1 = false;
61

  
62

  
63
         try
64
         {
65
             System.loadLibrary("jecw2.0.0");
66
             bUseNativeMethods = true;
67
             bUnsatisfiedLink = false;
68
             int i = NCSJNIInit();
69
             if(i != 0)
70
             {
71
                 System.err.println("JNCSFile classes found on PATH failed to initialize correctly. Attempting to locate other libecw.so....");
72
             }
73
         }
74
         catch(Exception e)
75
         {
76
         	e.printStackTrace();
77
         }
78
    }
79

  
80
    /**
81
     * Constructor
82
     * @throws JNCSException
83
     */
84
    
85
    public JNCSFile()
86
        throws JNCSException
87
    {
88
        bSetViewIsWorld = false;
89
        progImageClient = null;
90
        initClass();
91
        cellSizeUnits = 0;
92
        bIsOpen = false;
93
    }
94

  
95
    /**
96
     * Constructor con open del fichero.
97
     * @throws JNCSException
98
     */
99
    
100
    public JNCSFile(String s, boolean flag)
101
        throws JNCSException
102
    {
103
        bSetViewIsWorld = false;
104
        progImageClient = null;
105
        initClass();
106
        open(s, flag);
107
    }
108

  
109
    /**
110
     * Llama al close del ecw para liberar la memoria de C.
111
     * @throws Throwable
112
     */
113
    
114
    protected void finalize()
115
        throws Throwable
116
    {
117
        if(bIsOpen)
118
            ECWClose(false);
119
        super.finalize();
120
    }
121

  
122
    /**
123
     * Abre el fichero de imagen.
124
     * @throws JNCSFileOpenFailedException
125
     */
126
    
127
    public int open(String s, boolean flag)
128
        throws JNCSFileOpenFailedException
129
    {
130
        if(s == null)
131
            throw new IllegalArgumentException();
132
        
133
        //int i = ECWOpen(s, flag);
134
        int i = ECWOpenArray(s, flag, s.getBytes());
135
        
136
        if(i != 0)
137
        {
138
            bIsOpen = false;
139
            String s1 = JNCSError.getError(i);
140
            throw new JNCSFileOpenFailedException(s1);
141
        } else
142
        {
143
            bIsOpen = true;
144
            progressive = flag;
145
            return 0;
146
        }
147
    }
148

  
149
    /**
150
     * Cierra el fichero de imagen.
151
     * @param flag	par�metro para la funci�n NCScbmCloseFileViewEx
152
     */
153
    
154
    public void close(boolean flag)
155
    {
156
        ECWClose(flag);
157
        if(!flag);
158
    }
159
    
160
    public void addProgressiveUpdateListener(JNCSProgressiveUpdate jncsprogressiveupdate)
161
    {
162
        progImageClient = jncsprogressiveupdate;
163
    }
164

  
165
    public void refreshUpdate(int i, int j, double d, double d1, double d2, double d3)
166
    {
167
        if(progImageClient != null)
168
            progImageClient.refreshUpdate(i, j, d, d1, d2, d3);
169
    }
170

  
171
    public void refreshUpdate(int i, int j, int k, int l, int i1, int j1)
172
    {
173
        if(progImageClient != null)
174
            progImageClient.refreshUpdate(i, j, k, l, i1, j1);
175
    }
176

  
177
    /**
178
     * Crea una vista en un fichero ecw abierto dando las coordenadas de la vista
179
     * @param nBands N�mero de bandas en bandList
180
     * @param bandList Array de �ndices de bandas
181
     * @param width ancho de la vista en pixels
182
     * @param height alto de la vista en pixels
183
     * @param tlx coordenada X arriba-izquierda de la vista
184
     * @param tly coordenada Y arriba-izquierda de la vista
185
     * @param brx coordenada X abajo-derecha de la vista
186
     * @param bry coordenada Y abajo-derecha de la vista
187
     * @throws JNCSFileNotOpenException, JNCSInvalidSetViewException
188
     */
189
    
190
    public int setView(int i, int ai[], int j, int k, int l, int i1, int j1,
191
            int k1)
192
        throws JNCSFileNotOpenException, JNCSInvalidSetViewException
193
    {
194
    	if(!bIsOpen)
195
    		throw new JNCSFileNotOpenException("File not open");
196
    	
197
    	if (ai == null)
198
    		throw new JNCSInvalidSetViewException("Wrong parameter value");
199
    	
200
    	
201
        int l1 = ECWSetView(i, ai, j, k, l, i1, 0.0D, 0.0D, 0.0D, 0.0D, j1, k1);
202
        if(l1 != 0)
203
        {
204
            //String s = ECWGetErrorString(l1);
205
            String s = JNCSError.getError(l1);
206
            throw new JNCSInvalidSetViewException(s);
207
        } else
208
        {
209
            bSetViewIsWorld = false;
210
            return 0;
211
        }
212
    }
213

  
214
    /**
215
     * Asigna la vista pasando por par�metros los pixeles de inicio y fin y coordenadas de georreferenciaci�n solicitadas-
216
     * El cliente de esta funci�n tendr� que convertir las coordenadas reales en pixeles.
217
     */
218
    public int setView(int nBands, int posBands[], int iniX, int iniY, int endX, int endY, double tlX, double tlY, double brX, double brY, 
219
            int bufW, int bufH)throws JNCSFileNotOpenException, JNCSInvalidSetViewException{
220
    	
221
    	if(!bIsOpen)
222
    		throw new JNCSFileNotOpenException("File not open");
223
    	
224
    	if (posBands == null)
225
    		throw new JNCSInvalidSetViewException("Wrong parameter value");
226
    	
227
    	int l = ECWSetView(nBands, posBands, iniX, iniY, endX, endY, tlX, tlY, brX, brY, bufW, bufH);
228
        if(l != 0){
229
            String s = JNCSError.getError(l);
230
            throw new JNCSInvalidSetViewException(s);
231
        }else{
232
            bSetViewIsWorld = true;
233
            return 0;
234
        }
235

  
236
    }
237
    
238
    /**
239
     * Crea una vista en un fichero ecw abierto.
240
     *  
241
     * @param nBands N�mero de bandas en bandList
242
     * @param bandList Array de �ndices de bandas
243
     * @param width ancho de la vista en pixels
244
     * @param height alto de la vista en pixels
245
     * @param dWorldTLX coordenada X arriba-izquierda)
246
     * @param dWorldTLY coordenada Y arriba-izquierda
247
     * @param dWorldBRX coordenada X abajo-derecha)
248
     * @param dWorldBRY coordenada Y abajo-derecha
249
     * @throws JNCSFileNotOpenException, JNCSInvalidSetViewException
250
     */
251
    
252
    public int setView(int i, int ai[], double d, double d1, double d2, double d3, int j, int k)
253
        throws JNCSFileNotOpenException, JNCSInvalidSetViewException
254
    {
255
    	if(!bIsOpen)
256
    		throw new JNCSFileNotOpenException("File not open");
257
    	
258
    	if (ai == null)
259
    		throw new JNCSInvalidSetViewException("Wrong parameter value");
260
        JNCSDatasetPoint jncsdatasetpoint = convertWorldToDataset(d, d1);
261
        JNCSDatasetPoint jncsdatasetpoint1 = convertWorldToDataset(d2, d3);
262
        int l = ECWSetView(i, ai, jncsdatasetpoint.x, jncsdatasetpoint.y, jncsdatasetpoint1.x - 1, jncsdatasetpoint1.y - 1, d, d1, d2, d3, j, k);
263
        if(l != 0)
264
        {
265
            //String s = ECWGetErrorString(l);
266
            String s = JNCSError.getError(l);
267
            throw new JNCSInvalidSetViewException(s);
268
        } else
269
        {
270
            bSetViewIsWorld = true;
271
            return 0;
272
        }
273
    }
274

  
275
    /**
276
     * Lee una l�nea del fichero Ecw
277
     * @param buffer	Buffer donde se almacenan los datos de la l�nea
278
     * @throws JNCSException
279
     */
280
    
281
    public int readLineRGBA(int ai[])
282
        throws JNCSException
283
    {
284
    	if(!bIsOpen)
285
    		throw new JNCSFileNotOpenException("File not open");
286
        int i = ECWReadLineRGBA(ai);
287
        if(i != 0)
288
        {
289
            String s = JNCSError.getError(i);
290
            throw new JNCSException(s);
291
        } else
292
        {
293
            return 0;
294
        }
295
    }
296

  
297
    public int readLineBGRA(int ai[])
298
        throws JNCSException
299
    {
300
        throw new JNCSException("Not Yet Implemented!");
301
    }
302

  
303
    public int readLineBIL(int ai[])
304
        throws JNCSException
305
    {
306
        throw new JNCSException("Not Yet Implemented!");
307
    }
308

  
309
    public int readLineBIL(double ad[])
310
        throws JNCSException
311
    {
312
        throw new JNCSException("Not Yet Implemented!");
313
    }
314

  
315
    public int readImageRGBA(int ai[], int i, int j)
316
        throws JNCSException
317
    {
318
    	if(!bIsOpen)
319
    		throw new JNCSFileNotOpenException("File not open");
320
        int k = ECWReadImageRGBA(ai, i, j);
321
        if(k != 0)
322
        {
323
            String s = JNCSError.getError(k);
324
            throw new JNCSException(s);
325
        } else
326
        {
327
            return 0;
328
        }
329
    }
330

  
331
    /**
332
     * Obtiene una cadena que corresponde a un error a trav�s del entero que lo representa
333
     * @return String	Cadena de error
334
     * @param error	Entero que representa el error
335
     */
336
    
337
    public String getLastErrorText(int i)
338
    {
339
        return JNCSError.getError(i);
340
    }
341

  
342
    /**
343
     * Convierte una coordenada del mundo real a coordenadas de la vista
344
     * @return JNCSDatasetPoint	Clase que representa a un punto en la imagen
345
     * @param x	Coordenada X del mundo real
346
     * @param y Coordenada Y del mundo real
347
     * @throws JNCSFileNotOpenException
348
     */
349
    
350
    public JNCSDatasetPoint convertWorldToDataset(double d, double d1)
351
        throws JNCSFileNotOpenException
352
    {
353
        int i;
354
        int j;
355
        if(bIsOpen)
356
        {
357
            i = (int)Math.round((d - originX) / cellIncrementX);
358
            j = (int)Math.round((d1 - originY) / cellIncrementY);
359
        } else
360
        {
361
            throw new JNCSFileNotOpenException();
362
        }
363
        return new JNCSDatasetPoint(i, j);
364
    }
365

  
366
    /**
367
     * Convierte una coordenada de la vista a coordenadas del mundo real
368
     * @return JNCSWorldPoint	Clase que representa una coordenada del mundo real
369
     * @param x	Coordenada X de la imagen
370
     * @param y Coordenada Y de la imagen
371
     * @throws JNCSFileNotOpenException
372
     */
373
    
374
    public JNCSWorldPoint convertDatasetToWorld(int i, int j)
375
        throws JNCSFileNotOpenException
376
    {
377
        double d;
378
        double d1;
379
        if(bIsOpen)
380
        {
381
            d = originX + (double)i * cellIncrementX;
382
            d1 = originY + (double)j * cellIncrementY;
383
        } else
384
        {
385
            throw new JNCSFileNotOpenException();
386
        }
387
        return new JNCSWorldPoint(d, d1);
388
    }
389

  
390
    public short getPercentComplete()
391
    {
392
        return ECWGetPercentComplete();
393
    }
394

  
395
    /**
396
     * Obtiene una cadena con la versi�n de la libreria
397
     * @return versi�n
398
     */
399
    
400
    public static String getLibVersion()
401
    {
402
        return ECWGetLibVersion();
403
    }
404

  
405
    private static void debug(String s)
406
    {
407
        if(debug)
408
            System.out.println(s);
409
    }
410

  
411
    private static boolean bUseNativeMethods = false;
412
    private static boolean bSecurityError = false;
413
    private static boolean bUnsatisfiedLink = false;
414
    static boolean bHaveClassInit = false;
415
    static boolean debug = false;
416
    public static final int ECW_CELL_UNITS_INVALID = 0;
417
    public static final int ECW_CELL_UNITS_METERS = 1;
418
    public static final int ECW_CELL_UNITS_DEGREES = 2;
419
    public static final int ECW_CELL_UNITS_FEET = 3;
420
    public int numBands;
421
    public int width;
422
    public int height;
423
    public double originX;
424
    public double originY;
425
    public double cellIncrementX;
426
    public double cellIncrementY;
427
    public int cellSizeUnits;
428
    public double compressionRate;
429
    public boolean progressive;
430
    public String fileName;
431
    public String datum;
432
    public String projection;
433
    public boolean bIsOpen;
434
    private long nativeDataPointer;
435
    private static final boolean doGarbageCollectionOnClose = false;
436
    private static final int ECW_OK = 0;
437
    private int nFileSetViewDatasetTLX;
438
    private int nFileSetViewDatasetTLY;
439
    private int nFileSetViewDatasetBRX;
440
    private int nFileSetViewDatasetBRY;
441
    private int nFileSetViewWidth;
442
    private int nFileSetViewHeight;
443
    private double dFileSetViewWorldTLX;
444
    private double dFileSetViewWorldTLY;
445
    private double dFileSetViewWorldBRX;
446
    private double dFileSetViewWorldBRY;
447
    private boolean bSetViewIsWorld;
448
    protected JNCSProgressiveUpdate progImageClient;
449

  
450
}
0 451

  
org.gvsig.raster.ermapper/trunk/org.gvsig.raster.ermapper/org.gvsig.raster.ermapper.jni/src/main/java/com/ermapper/ecw/JNCSFileNotOpenException.java
1
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
2
// Jad home page: http://www.kpdus.com/jad.html
3
// Decompiler options: packimports(3) 
4
// Source File Name:   JNCSFileNotOpenException.java
5

  
6
package com.ermapper.ecw;
7

  
8

  
9
// Referenced classes of package com.ermapper.ecw:
10
//            JNCSException
11

  
12
public class JNCSFileNotOpenException extends JNCSException
13
{
14

  
15
    public JNCSFileNotOpenException()
16
    {
17
    }
18

  
19
    public JNCSFileNotOpenException(String s)
20
    {
21
        super(s);
22
    }
23
}
0 24

  
org.gvsig.raster.ermapper/trunk/org.gvsig.raster.ermapper/org.gvsig.raster.ermapper.jni/src/main/java/com/ermapper/ecw/JNCSReadLineException.java
1
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
2
// Jad home page: http://www.kpdus.com/jad.html
3
// Decompiler options: packimports(3) 
4
// Source File Name:   JNCSReadLineException.java
5

  
6
package com.ermapper.ecw;
7

  
8

  
9
// Referenced classes of package com.ermapper.ecw:
10
//            JNCSException
11

  
12
public class JNCSReadLineException extends JNCSException
13
{
14

  
15
    public JNCSReadLineException()
16
    {
17
    }
18
}
0 19

  
org.gvsig.raster.ermapper/trunk/org.gvsig.raster.ermapper/org.gvsig.raster.ermapper.jni/src/main/java/es/gva/cit/jecwcompress/JniObject.java
1
/**********************************************************************
2
 * $Id: JniObject.java 3538 2006-01-09 11:56:54Z nacho $
3
 *
4
 * Name:     JniObject.java
5
 * Project:  
6
 * Purpose:  
7
 * Author:   Nacho Brodin, brodin_ign@gva.es
8
 *
9
 **********************************************************************/
10
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
11
*
12
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
13
*
14
* This program is free software; you can redistribute it and/or
15
* modify it under the terms of the GNU General Public License
16
* as published by the Free Software Foundation; either version 2
17
* of the License, or (at your option) any later version.
18
*
19
* This program is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
* GNU General Public License for more details.
23
*
24
* You should have received a copy of the GNU General Public License
25
* along with this program; if not, write to the Free Software
26
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
27
*
28
* For more information, contact:
29
*
30
*  Generalitat Valenciana
31
*   Conselleria d'Infraestructures i Transport
32
*   Av. Blasco Ib??ez, 50
33
*   46010 VALENCIA
34
*   SPAIN
35
*
36
*      +34 963862235
37
*   gvsig@gva.es
38
*      www.gvsig.gva.es
39
*
40
*    or
41
*
42
*   IVER T.I. S.A
43
*   Salamanca 50
44
*   46005 Valencia
45
*   Spain
46
*
47
*   +34 963163400
48
*   dac@iver.es
49
*/
50

  
51
package es.gva.cit.jecwcompress;
52

  
53

  
54
/**
55
 * Clase de la que debe heredar el servidor de datos creado por el cliente
56
 * 
57
 * @author Nacho Brodin <brodin_ign@gva.es>.<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es
58
 * @version 0.0
59
 * @link http://www.gvsig.gva.es
60
 */
61
public class JniObject{
62
	
63
	protected long cPtr;
64
	protected int nNextLine;
65
	
66
	/**
67
	 * Obtiene la direcci?n de memoria
68
	 */
69
	public long getPtro(){
70
		return cPtr;
71
	}
72
		
73
}
0 74

  
org.gvsig.raster.ermapper/trunk/org.gvsig.raster.ermapper/org.gvsig.raster.ermapper.jni/src/main/java/es/gva/cit/jecwcompress/ReadCallBack.java
1
/**********************************************************************
2
 * $Id: ReadCallBack.java 3538 2006-01-09 11:56:54Z nacho $
3
 *
4
 * Name:     ReadCallBack.java
5
 * Project:  
6
 * Purpose:  
7
 * Author:   Nacho Brodin, brodin_ign@gva.es
8
 *
9
 **********************************************************************/
10
/*Copyright (C) 2004  Nacho Brodin <brodin_ign@gva.es>
11

  
12
 This program is free software; you can redistribute it and/or
13
 modify it under the terms of the GNU General Public License
14
 as published by the Free Software Foundation; either version 2
15
 of the License, or (at your option) any later version.
16

  
17
 This program is d/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
18
*
19
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
20
*
21
* This program is free software; you can redistribute it and/or
22
* modify it under the terms of the GNU General Public License
23
* as published by the Free Software Foundation; either version 2
24
* of the License, or (at your option) any later version.
25
*
26
* This program is distributed in the hope that it will be useful,
27
* but WITHOUT ANY WARRANTY; without even the implied warranty of
28
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29
* GNU General Public License for more details.
30
*
31
* You should have received a copy of the GNU General Public License
32
* along with this program; if not, write to the Free Software
33
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
34
*
35
* For more information, contact:
36
*
37
*  Generalitat Valenciana
38
*   Conselleria d'Infraestructures i Transport
39
*   Av. Blasco Ib??ez, 50
40
*   46010 VALENCIA
41
*   SPAIN
42
*
43
*      +34 963862235
44
*   gvsig@gva.es
45
*      www.gvsig.gva.es
46
*
47
*    or
48
*
49
*   IVER T.I. S.A
50
*   Salamanca 50
51
*   46005 Valencia
52
*   Spain
53
*
54
*   +34 963163400
55
*   dac@iver.es
56
*/
57

  
58
package es.gva.cit.jecwcompress;
59

  
60
/**
61
 * Interfaz que debe implementar el cliente de compresi?n para que se pueda hacer llamadas
62
 * a las funciones java  que cargan los buffers, desde el espacio C.
63
 * 
64
 * @author Nacho Brodin <brodin_ign@gva.es>.<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es
65
 * @version 0.0
66
 * @link http://www.gvsig.gva.es
67
 */
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff