Revision 137
1.10/tags/gvSIG_3D_Animation_1_10_build_16/libraries/libjni-mrsid/.cproject | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
|
2 |
<?fileVersion 4.0.0?> |
|
3 |
|
|
4 |
<cproject> |
|
5 |
<storageModule moduleId="org.eclipse.cdt.core.settings"> |
|
6 |
<cconfiguration id="converted.config.931178486"> |
|
7 |
<storageModule moduleId="org.eclipse.cdt.core.pathentry"> |
|
8 |
<pathentry kind="src" path=""/> |
|
9 |
<pathentry kind="out" path=""/> |
|
10 |
<pathentry kind="con" path="org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"/> |
|
11 |
</storageModule> |
|
12 |
<storageModule moduleId="cdt_indexer"> |
|
13 |
<indexEnabled indexValue="true"/> |
|
14 |
<indexerProblemsEnabled indexProblemsValue="0"/> |
|
15 |
</storageModule> |
|
16 |
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"> |
|
17 |
<buildTargets> |
|
18 |
<target name="all" path="" targetID="org.eclipse.cdt.make.MakeTargetBuilder"> |
|
19 |
<buildCommand>make</buildCommand> |
|
20 |
<buildTarget>all</buildTarget> |
|
21 |
<stopOnError>false</stopOnError> |
|
22 |
<useDefaultCommand>true</useDefaultCommand> |
|
23 |
</target> |
|
24 |
<target name="clean" path="" targetID="org.eclipse.cdt.make.MakeTargetBuilder"> |
|
25 |
<buildCommand>make</buildCommand> |
|
26 |
<buildTarget>clean</buildTarget> |
|
27 |
<stopOnError>false</stopOnError> |
|
28 |
<useDefaultCommand>true</useDefaultCommand> |
|
29 |
</target> |
|
30 |
</buildTargets> |
|
31 |
</storageModule> |
|
32 |
<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="converted.config.931178486" moduleId="org.eclipse.cdt.core.settings" name="convertedConfig"> |
|
33 |
<externalSettings/> |
|
34 |
<extensions> |
|
35 |
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/> |
|
36 |
</extensions> |
|
37 |
</storageModule> |
|
38 |
</cconfiguration> |
|
39 |
</storageModule> |
|
40 |
</cproject> |
1.10/tags/gvSIG_3D_Animation_1_10_build_16/libraries/libjni-mrsid/src/test/java/es/gva/cir/jmrsid/TestReadMrSid.java | ||
---|---|---|
1 |
package es.gva.cir.jmrsid; |
|
2 |
|
|
3 |
import java.io.IOException; |
|
4 |
|
|
5 |
import junit.framework.TestCase; |
|
6 |
import es.gva.cit.jmrsid.LTIMetadataDatabase; |
|
7 |
import es.gva.cit.jmrsid.LTIMetadataRecord; |
|
8 |
import es.gva.cit.jmrsid.MrSIDException; |
|
9 |
import es.gva.cit.jmrsid.MrSIDImageReader; |
|
10 |
|
|
11 |
public class TestReadMrSid extends TestCase{ |
|
12 |
|
|
13 |
private MrSIDImageReader sid = null; |
|
14 |
|
|
15 |
private String fileName = "Urban_10cm.sid"; |
|
16 |
private String baseDir = "./test-images/"; |
|
17 |
private String file1 = baseDir + fileName; |
|
18 |
|
|
19 |
private int numBands = 0; |
|
20 |
private int width = 0; |
|
21 |
private int height = 0; |
|
22 |
private String projection = null; |
|
23 |
private LTIMetadataDatabase metadata = null; |
|
24 |
private LTIMetadataRecord record = null; |
|
25 |
|
|
26 |
public void start(){ |
|
27 |
setUp(); |
|
28 |
testStack(); |
|
29 |
} |
|
30 |
|
|
31 |
|
|
32 |
public void setUp(){ |
|
33 |
try { |
|
34 |
sid = new MrSIDImageReader(file1); |
|
35 |
sid.initialize(); |
|
36 |
|
|
37 |
} catch (MrSIDException e) { |
|
38 |
e.printStackTrace(); |
|
39 |
} catch (IOException e) { |
|
40 |
e.printStackTrace(); |
|
41 |
} |
|
42 |
|
|
43 |
|
|
44 |
} |
|
45 |
|
|
46 |
public void testStack(){ |
|
47 |
try { |
|
48 |
numBands = sid.getNumBands(); |
|
49 |
width = sid.getWidth(); |
|
50 |
height = sid.getHeight(); |
|
51 |
metadata = sid.getMetadata(); |
|
52 |
System.out.println("**** TEST DE ACCESO A IMÁGENES MRSID ****"); |
|
53 |
System.out.println(" IMAGEN: " + fileName); |
|
54 |
System.out.println("Número de bandas: " + numBands); |
|
55 |
System.out.println("Anchura: " + width); |
|
56 |
System.out.println("Altura: " + height); |
|
57 |
|
|
58 |
// for (int i = 0 ; i<metadata.getIndexCount() ; i++){ |
|
59 |
// record = metadata.getDataByIndex(i); |
|
60 |
// System.out.println(record.getTagName() + ": " + record.getScalarData()); |
|
61 |
// } |
|
62 |
sid.close(); |
|
63 |
} catch (MrSIDException e) { |
|
64 |
e.printStackTrace(); |
|
65 |
} |
|
66 |
|
|
67 |
} |
|
68 |
|
|
69 |
} |
1.10/tags/gvSIG_3D_Animation_1_10_build_16/libraries/libjni-mrsid/src/main/native/jmrsid/mrsidimagereader.cpp | ||
---|---|---|
1 |
/********************************************************************** |
|
2 |
* $Id: mrsidimagereader.cpp 8460 2006-10-31 16:26:34Z nacho $ |
|
3 |
* |
|
4 |
* Name: mrsid_interfaz.c |
|
5 |
* Project: JMRSID. Interfaz java to MrSID (Lizardtech). |
|
6 |
* Purpose: dataset's Basic Funcions. |
|
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 |
* [01] 01-Oct-2005 nbt MrSIDImageReaderArrayNat function to support name parameter in char array |
|
51 |
*/ |
|
52 |
|
|
53 |
|
|
54 |
#include <jni.h> |
|
55 |
#include <stdlib.h> |
|
56 |
#include "es_gva_cit_jmrsid_MrSIDImageReader.h" |
|
57 |
#include "es_gva_cit_jmrsid_JNIBase.h" |
|
58 |
|
|
59 |
#include "lt_types.h" |
|
60 |
#include "lt_base.h" |
|
61 |
#include "lt_fileSpec.h" |
|
62 |
#include "lti_geoCoord.h" |
|
63 |
#include "lti_pixel.h" |
|
64 |
#include "lti_navigator.h" |
|
65 |
#include "lti_sceneBuffer.h" |
|
66 |
#include "lti_metadataDatabase.h" |
|
67 |
#include "lti_metadataRecord.h" |
|
68 |
#include "lti_utils.h" |
|
69 |
#include "MrSIDImageReader.h" |
|
70 |
#include "J2KImageReader.h" |
|
71 |
#include "lti_imageReader.h" |
|
72 |
#include "lti_sceneBuffer.h" |
|
73 |
#include "lti_scene.h" |
|
74 |
//#include "cpl_conv.h" |
|
75 |
#include "TIFFImageWriter.h" |
|
76 |
|
|
77 |
LT_USE_NAMESPACE(LizardTech); |
|
78 |
|
|
79 |
/******************************************************************************/ |
|
80 |
// Constructor MrSIDImageReader |
|
81 |
/******************************************************************************/ |
|
82 |
|
|
83 |
|
|
84 |
JNIEXPORT jlong JNICALL Java_es_gva_cit_jmrsid_MrSIDImageReader_MrSIDImageReaderNat |
|
85 |
(JNIEnv *env, jobject obj, jstring pszF){ |
|
86 |
|
|
87 |
const char *pszFilename; |
|
88 |
MrSIDImageReader *poImageReader; |
|
89 |
jlong jresult = 0 ; |
|
90 |
FILE *fich; |
|
91 |
|
|
92 |
|
|
93 |
pszFilename = env->GetStringUTFChars(pszF, 0); |
|
94 |
|
|
95 |
fich=fopen( pszFilename, "r" ); |
|
96 |
if( fich ) |
|
97 |
fclose(fich); |
|
98 |
else |
|
99 |
{ |
|
100 |
fclose(fich); |
|
101 |
return -1; |
|
102 |
} |
|
103 |
|
|
104 |
const LTFileSpec fileSpec(pszFilename); |
|
105 |
poImageReader = MrSIDImageReader::create(); |
|
106 |
poImageReader->initialize( fileSpec ); |
|
107 |
*(MrSIDImageReader **)&jresult = poImageReader; |
|
108 |
env->ReleaseStringUTFChars(pszF, pszFilename); |
|
109 |
|
|
110 |
|
|
111 |
if(poImageReader==NULL)return -1; |
|
112 |
else return jresult; |
|
113 |
|
|
114 |
} |
|
115 |
|
|
116 |
/******************************************************************************/ |
|
117 |
// Constructor MrSIDImageArrayReader |
|
118 |
/******************************************************************************/ |
|
119 |
|
|
120 |
|
|
121 |
JNIEXPORT jlong JNICALL Java_es_gva_cit_jmrsid_MrSIDImageReader_MrSIDImageReaderArrayNat |
|
122 |
(JNIEnv *env, jobject obj, jbyteArray pszF){ |
|
123 |
|
|
124 |
jbyte *pszFilename; |
|
125 |
MrSIDImageReader *poImageReader; |
|
126 |
jlong jresult = 0 ; |
|
127 |
FILE *fich; |
|
128 |
int longitud = 0; |
|
129 |
|
|
130 |
longitud = env->GetArrayLength(pszF); |
|
131 |
pszFilename = env->GetByteArrayElements(pszF, 0); |
|
132 |
jbyte *aux = (jbyte *)malloc(sizeof(jbyte) * (longitud + 1)); |
|
133 |
memcpy(aux, pszFilename, longitud); |
|
134 |
env->ReleaseByteArrayElements(pszF, pszFilename, 0); |
|
135 |
pszFilename = aux; |
|
136 |
pszFilename[longitud] = '\0'; |
|
137 |
|
|
138 |
fich=fopen( (char *)pszFilename, "r" ); |
|
139 |
if( fich ) |
|
140 |
fclose(fich); |
|
141 |
else |
|
142 |
return -1; |
|
143 |
|
|
144 |
const LTFileSpec fileSpec((char*)pszFilename); |
|
145 |
poImageReader = MrSIDImageReader::create(); |
|
146 |
poImageReader->initialize( fileSpec ); |
|
147 |
|
|
148 |
*(MrSIDImageReader **)&jresult = poImageReader; |
|
149 |
|
|
150 |
free(pszFilename); |
|
151 |
|
|
152 |
if(poImageReader==NULL) |
|
153 |
return -1; |
|
154 |
else |
|
155 |
return jresult; |
|
156 |
|
|
157 |
} |
|
158 |
|
|
159 |
/******************************************************************************/ |
|
160 |
// getNumLevels |
|
161 |
/******************************************************************************/ |
|
162 |
|
|
163 |
JNIEXPORT jint JNICALL Java_es_gva_cit_jmrsid_JNIBase_getNumLevelsNat |
|
164 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
165 |
|
|
166 |
MrSIDImageReader *img = (MrSIDImageReader *) 0 ; |
|
167 |
int res = -1; |
|
168 |
|
|
169 |
img = *(MrSIDImageReader **)&cPtr; |
|
170 |
|
|
171 |
if(img!=NULL) |
|
172 |
res = img->getNumLevels(); |
|
173 |
|
|
174 |
return res; |
|
175 |
|
|
176 |
} |
|
177 |
|
|
178 |
/******************************************************************************/ |
|
179 |
// ~MrSIDImageReader |
|
180 |
/******************************************************************************/ |
|
181 |
|
|
182 |
JNIEXPORT void JNICALL Java_es_gva_cit_jmrsid_MrSIDImageReader_FreeMrSIDImageReaderNat |
|
183 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
184 |
|
|
185 |
MrSIDImageReader *reader = (MrSIDImageReader *) 0 ; |
|
186 |
|
|
187 |
reader = *(MrSIDImageReader **)&cPtr; |
|
188 |
if(reader!=NULL){ |
|
189 |
reader->release(); |
|
190 |
} |
|
191 |
|
|
192 |
} |
|
193 |
|
|
194 |
|
|
195 |
|
|
196 |
|
|
197 |
|
1.10/tags/gvSIG_3D_Animation_1_10_build_16/libraries/libjni-mrsid/src/main/native/jmrsid/ltiscene.cpp | ||
---|---|---|
1 |
/********************************************************************** |
|
2 |
* $Id: ltiscene.cpp 3539 2006-01-09 12:23:20Z nacho $ |
|
3 |
* |
|
4 |
* Name: ltiscene.c |
|
5 |
* Project: JMRSID. Interfaz java to MrSID (Lizardtech). |
|
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 |
|
|
52 |
#include <jni.h> |
|
53 |
#include "es_gva_cit_jmrsid_LTIScene.h" |
|
54 |
#include "es_gva_cit_jmrsid_JNIBase.h" |
|
55 |
|
|
56 |
#include "lt_types.h" |
|
57 |
#include "lt_base.h" |
|
58 |
#include "lt_fileSpec.h" |
|
59 |
#include "lti_geoCoord.h" |
|
60 |
#include "lti_pixel.h" |
|
61 |
#include "lti_navigator.h" |
|
62 |
#include "lti_sceneBuffer.h" |
|
63 |
#include "lti_metadataDatabase.h" |
|
64 |
#include "lti_metadataRecord.h" |
|
65 |
#include "lti_utils.h" |
|
66 |
#include "MrSIDImageReader.h" |
|
67 |
#include "J2KImageReader.h" |
|
68 |
#include "lti_imageReader.h" |
|
69 |
#include "lti_sceneBuffer.h" |
|
70 |
#include "lti_scene.h" |
|
71 |
//#include "cpl_conv.h" |
|
72 |
#include "TIFFImageWriter.h" |
|
73 |
|
|
74 |
LT_USE_NAMESPACE(LizardTech); |
|
75 |
|
|
76 |
/******************************************************************************/ |
|
77 |
// Constructor LTIScene |
|
78 |
/******************************************************************************/ |
|
79 |
|
|
80 |
|
|
81 |
JNIEXPORT jlong JNICALL Java_es_gva_cit_jmrsid_LTIScene_LTISceneNat |
|
82 |
(JNIEnv *env, jobject obj, jdouble xinic, jdouble yinic, jdouble tamx, jdouble tamy, jdouble magn){ |
|
83 |
|
|
84 |
LTIScene *scene; |
|
85 |
jlong jresult = 0 ; |
|
86 |
|
|
87 |
scene=new LTIScene(xinic,yinic,tamx,tamy,magn); |
|
88 |
|
|
89 |
*(LTIScene **)&jresult = scene; |
|
90 |
|
|
91 |
return jresult; |
|
92 |
|
|
93 |
} |
|
94 |
|
|
95 |
/******************************************************************************/ |
|
96 |
// ~LTIScene |
|
97 |
/******************************************************************************/ |
|
98 |
|
|
99 |
JNIEXPORT void JNICALL Java_es_gva_cit_jmrsid_LTIScene_FreeLTISceneNat |
|
100 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
101 |
|
|
102 |
LTIScene *scene = (LTIScene *) 0 ; |
|
103 |
|
|
104 |
scene = *(LTIScene **)&cPtr; |
|
105 |
if(scene!=NULL){ |
|
106 |
delete scene; |
|
107 |
} |
|
108 |
|
|
109 |
} |
|
110 |
|
1.10/tags/gvSIG_3D_Animation_1_10_build_16/libraries/libjni-mrsid/src/main/native/jmrsid/ltimetadatarecord.cpp | ||
---|---|---|
1 |
/********************************************************************** |
|
2 |
* $Id: ltimetadatarecord.cpp 3539 2006-01-09 12:23:20Z nacho $ |
|
3 |
* |
|
4 |
* Name: ltimetadatarecord.c |
|
5 |
* Project: JMRSID. Interfaz java to MrSID (Lizardtech). |
|
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 |
|
|
52 |
#include <jni.h> |
|
53 |
#include <string.h> |
|
54 |
#include "es_gva_cit_jmrsid_LTIMetadataRecord.h" |
|
55 |
#include "es_gva_cit_jmrsid_JNIBase.h" |
|
56 |
|
|
57 |
#include "lt_types.h" |
|
58 |
#include "lt_base.h" |
|
59 |
#include "lt_fileSpec.h" |
|
60 |
#include "lti_geoCoord.h" |
|
61 |
#include "lti_pixel.h" |
|
62 |
#include "lti_navigator.h" |
|
63 |
#include "lti_sceneBuffer.h" |
|
64 |
#include "lti_metadataDatabase.h" |
|
65 |
#include "lti_metadataRecord.h" |
|
66 |
#include "lti_utils.h" |
|
67 |
#include "MrSIDImageReader.h" |
|
68 |
#include "J2KImageReader.h" |
|
69 |
#include "lti_imageReader.h" |
|
70 |
#include "lti_sceneBuffer.h" |
|
71 |
#include "lti_scene.h" |
|
72 |
//#include "cpl_conv.h" |
|
73 |
#include "TIFFImageWriter.h" |
|
74 |
|
|
75 |
LT_USE_NAMESPACE(LizardTech); |
|
76 |
|
|
77 |
/******************************************************************************/ |
|
78 |
// getTagName |
|
79 |
/******************************************************************************/ |
|
80 |
|
|
81 |
JNIEXPORT jstring JNICALL Java_es_gva_cit_jmrsid_LTIMetadataRecord_getTagNameNat |
|
82 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
83 |
|
|
84 |
LTIMetadataRecord *record = (LTIMetadataRecord *) 0 ; |
|
85 |
jstring res=NULL; |
|
86 |
const char *tagname; |
|
87 |
|
|
88 |
record = *(LTIMetadataRecord **)&cPtr; |
|
89 |
|
|
90 |
if(record!=NULL){ |
|
91 |
tagname=record->getTagName(); |
|
92 |
res = env->NewStringUTF(tagname); |
|
93 |
} |
|
94 |
|
|
95 |
return res; |
|
96 |
|
|
97 |
} |
|
98 |
|
|
99 |
/******************************************************************************/ |
|
100 |
// isScalar |
|
101 |
/******************************************************************************/ |
|
102 |
|
|
103 |
JNIEXPORT jint JNICALL Java_es_gva_cit_jmrsid_LTIMetadataRecord_isScalarNat |
|
104 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
105 |
|
|
106 |
LTIMetadataRecord *record = (LTIMetadataRecord *) 0 ; |
|
107 |
|
|
108 |
record = *(LTIMetadataRecord **)&cPtr; |
|
109 |
|
|
110 |
if(record!=NULL){ |
|
111 |
if (record->isScalar())return 1; |
|
112 |
else return 0; |
|
113 |
}else return -1; |
|
114 |
} |
|
115 |
|
|
116 |
|
|
117 |
/******************************************************************************/ |
|
118 |
// isVector |
|
119 |
/******************************************************************************/ |
|
120 |
|
|
121 |
JNIEXPORT jint JNICALL Java_es_gva_cit_jmrsid_LTIMetadataRecord_isVectorNat |
|
122 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
123 |
|
|
124 |
LTIMetadataRecord *record = (LTIMetadataRecord *) 0 ; |
|
125 |
|
|
126 |
record = *(LTIMetadataRecord **)&cPtr; |
|
127 |
|
|
128 |
if(record!=NULL){ |
|
129 |
if (record->isVector())return 1; |
|
130 |
else return 0; |
|
131 |
}else return -1; |
|
132 |
} |
|
133 |
|
|
134 |
/******************************************************************************/ |
|
135 |
// isArray |
|
136 |
/******************************************************************************/ |
|
137 |
|
|
138 |
JNIEXPORT jint JNICALL Java_es_gva_cit_jmrsid_LTIMetadataRecord_isArrayNat |
|
139 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
140 |
|
|
141 |
LTIMetadataRecord *record = (LTIMetadataRecord *) 0 ; |
|
142 |
|
|
143 |
record = *(LTIMetadataRecord **)&cPtr; |
|
144 |
|
|
145 |
if(record!=NULL){ |
|
146 |
if (record->isArray())return 1; |
|
147 |
else return 0; |
|
148 |
}else return -1; |
|
149 |
} |
|
150 |
|
|
151 |
/******************************************************************************/ |
|
152 |
// getDataType |
|
153 |
/******************************************************************************/ |
|
154 |
|
|
155 |
JNIEXPORT jint JNICALL Java_es_gva_cit_jmrsid_LTIMetadataRecord_getDataTypeNat |
|
156 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
157 |
|
|
158 |
LTIMetadataRecord *record = (LTIMetadataRecord *) 0 ; |
|
159 |
|
|
160 |
record = *(LTIMetadataRecord **)&cPtr; |
|
161 |
|
|
162 |
if(record!=NULL){ |
|
163 |
switch (record->getDataType()) |
|
164 |
{ |
|
165 |
case LTI_METADATA_DATATYPE_UINT8: |
|
166 |
case LTI_METADATA_DATATYPE_SINT8: |
|
167 |
case LTI_METADATA_DATATYPE_UINT16: |
|
168 |
case LTI_METADATA_DATATYPE_SINT16: |
|
169 |
case LTI_METADATA_DATATYPE_UINT32: |
|
170 |
case LTI_METADATA_DATATYPE_SINT32: |
|
171 |
case LTI_METADATA_DATATYPE_UINT64: |
|
172 |
case LTI_METADATA_DATATYPE_SINT64:return 0;break; |
|
173 |
case LTI_METADATA_DATATYPE_FLOAT32: |
|
174 |
case LTI_METADATA_DATATYPE_FLOAT64:return 1;break; |
|
175 |
case LTI_METADATA_DATATYPE_ASCII:return 2;break; |
|
176 |
} |
|
177 |
} |
|
178 |
|
|
179 |
return -1; |
|
180 |
} |
|
181 |
|
|
182 |
/******************************************************************************/ |
|
183 |
// getScalarData |
|
184 |
/******************************************************************************/ |
|
185 |
|
|
186 |
JNIEXPORT jstring JNICALL Java_es_gva_cit_jmrsid_LTIMetadataRecord_getScalarDataNat |
|
187 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
188 |
|
|
189 |
LTIMetadataRecord *record = (LTIMetadataRecord *) 0 ; |
|
190 |
record = *(LTIMetadataRecord **)&cPtr; |
|
191 |
|
|
192 |
if(record!=NULL){ |
|
193 |
char dato[8192]; |
|
194 |
const void* data = record->getScalarData(); |
|
195 |
switch (record->getDataType()) |
|
196 |
{ |
|
197 |
case LTI_METADATA_DATATYPE_UINT8: |
|
198 |
sprintf(dato, "%d", (lt_uint32)((lt_uint8*)data)[0]); |
|
199 |
break; |
|
200 |
case LTI_METADATA_DATATYPE_SINT8: |
|
201 |
sprintf(dato, "%d", (lt_int32)((lt_int8*)data)[0]); |
|
202 |
break; |
|
203 |
case LTI_METADATA_DATATYPE_UINT16: |
|
204 |
sprintf(dato, "%d", (lt_uint32)((lt_uint16*)data)[0]); |
|
205 |
break; |
|
206 |
case LTI_METADATA_DATATYPE_SINT16: |
|
207 |
sprintf(dato, "%d", (lt_int32)((lt_int16*)data)[0]); |
|
208 |
break; |
|
209 |
case LTI_METADATA_DATATYPE_UINT32: |
|
210 |
sprintf(dato, "%d", ((lt_uint32*)data)[0]); |
|
211 |
break; |
|
212 |
case LTI_METADATA_DATATYPE_SINT32: |
|
213 |
sprintf(dato, "%d", ((lt_int32*)data)[0]); |
|
214 |
break; |
|
215 |
case LTI_METADATA_DATATYPE_UINT64: |
|
216 |
sprintf(dato, "%I64u", ((lt_uint64*)data)[0]); |
|
217 |
break; |
|
218 |
case LTI_METADATA_DATATYPE_SINT64: |
|
219 |
sprintf(dato, "%I64d", ((lt_int64*)data)[0]); |
|
220 |
break; |
|
221 |
case LTI_METADATA_DATATYPE_FLOAT32: |
|
222 |
sprintf(dato, "%f", ((float*)data)[0]); |
|
223 |
break; |
|
224 |
case LTI_METADATA_DATATYPE_FLOAT64: |
|
225 |
sprintf(dato, "%f", ((double*)data)[0]); |
|
226 |
break; |
|
227 |
case LTI_METADATA_DATATYPE_ASCII: |
|
228 |
{ |
|
229 |
|
|
230 |
const char* p = ((const char**)data)[0]; |
|
231 |
if(strlen(p)>8192) |
|
232 |
strncpy(dato,p,8192); |
|
233 |
else |
|
234 |
sprintf(dato,"%s", p); |
|
235 |
} |
|
236 |
break; |
|
237 |
} |
|
238 |
|
|
239 |
return env->NewStringUTF(dato); |
|
240 |
|
|
241 |
|
|
242 |
}else return NULL; |
|
243 |
} |
|
244 |
|
|
245 |
|
|
246 |
|
|
247 |
|
|
248 |
/******************************************************************************/ |
|
249 |
// getVectorData |
|
250 |
/******************************************************************************/ |
|
251 |
|
|
252 |
JNIEXPORT jobject JNICALL Java_es_gva_cit_jmrsid_LTIMetadataRecord_getVectorDataNat |
|
253 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
254 |
|
|
255 |
LTIMetadataRecord *record = (LTIMetadataRecord *) 0 ; |
|
256 |
char dato[255]; |
|
257 |
jclass clase; |
|
258 |
jmethodID metodo; |
|
259 |
jobject obj_stringarray; |
|
260 |
jfieldID id_campo; |
|
261 |
jobjectArray arr_string; |
|
262 |
|
|
263 |
record = *(LTIMetadataRecord **)&cPtr; |
|
264 |
|
|
265 |
if(record!=NULL){ |
|
266 |
lt_uint32 len=0; |
|
267 |
const void* data = record->getVectorData(len); |
|
268 |
|
|
269 |
clase = env->FindClass ("es/gva/cit/jmrsid/StringArray"); |
|
270 |
metodo = env->GetMethodID(clase, "reserva", "(I)V"); |
|
271 |
obj_stringarray = env->NewObject (clase,metodo,len); |
|
272 |
id_campo = env->GetFieldID(clase, "array", "[Ljava/lang/String;"); |
|
273 |
arr_string =(jobjectArray)env->GetObjectField(obj_stringarray, id_campo); |
|
274 |
|
|
275 |
for (lt_uint32 i=0; i<len; i++) |
|
276 |
{ |
|
277 |
switch (record->getDataType()) |
|
278 |
{ |
|
279 |
case LTI_METADATA_DATATYPE_UINT8: |
|
280 |
sprintf(dato, "%d", (lt_uint32)((lt_uint8*)data)[i]); |
|
281 |
break; |
|
282 |
case LTI_METADATA_DATATYPE_SINT8: |
|
283 |
sprintf(dato, "%d", (lt_int32)((lt_int8*)data)[i]); |
|
284 |
break; |
|
285 |
case LTI_METADATA_DATATYPE_UINT16: |
|
286 |
sprintf(dato, "%d", (lt_uint32)((lt_uint16*)data)[i]); |
|
287 |
break; |
|
288 |
case LTI_METADATA_DATATYPE_SINT16: |
|
289 |
sprintf(dato, "%d", (lt_int32)((lt_int16*)data)[i]); |
|
290 |
break; |
|
291 |
case LTI_METADATA_DATATYPE_UINT32: |
|
292 |
sprintf(dato, "%d", ((lt_uint32*)data)[i]); |
|
293 |
break; |
|
294 |
case LTI_METADATA_DATATYPE_SINT32: |
|
295 |
sprintf(dato, "%d", ((lt_int32*)data)[i]); |
|
296 |
break; |
|
297 |
case LTI_METADATA_DATATYPE_UINT64: |
|
298 |
sprintf(dato, "%I64u", ((lt_uint64*)data)[i]); |
|
299 |
break; |
|
300 |
case LTI_METADATA_DATATYPE_SINT64: |
|
301 |
sprintf(dato, "%I64d", ((lt_int64*)data)[i]); |
|
302 |
break; |
|
303 |
case LTI_METADATA_DATATYPE_FLOAT32: |
|
304 |
sprintf(dato, "%f", ((float*)data)[i]); |
|
305 |
break; |
|
306 |
case LTI_METADATA_DATATYPE_FLOAT64: |
|
307 |
sprintf(dato, "%f", ((double*)data)[i]); |
|
308 |
break; |
|
309 |
case LTI_METADATA_DATATYPE_ASCII: |
|
310 |
{ |
|
311 |
const char* p = ((const char**)data)[i]; |
|
312 |
sprintf(dato,"%s", p); |
|
313 |
} |
|
314 |
break; |
|
315 |
} |
|
316 |
|
|
317 |
env->SetObjectArrayElement(arr_string,i,env->NewStringUTF(dato)); |
|
318 |
|
|
319 |
} |
|
320 |
|
|
321 |
} |
|
322 |
|
|
323 |
return obj_stringarray; |
|
324 |
|
|
325 |
} |
|
326 |
|
|
327 |
/******************************************************************************/ |
|
328 |
// getArrayData |
|
329 |
/******************************************************************************/ |
|
330 |
|
|
331 |
JNIEXPORT jobject JNICALL Java_es_gva_cit_jmrsid_LTIMetadataRecord_getArrayDataNat |
|
332 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
333 |
|
|
334 |
LTIMetadataRecord *record = (LTIMetadataRecord *) 0 ; |
|
335 |
char dato[255]; |
|
336 |
jclass clase; |
|
337 |
jmethodID metodo; |
|
338 |
jobject obj_stringarray; |
|
339 |
jfieldID id_campo; |
|
340 |
jobjectArray arr_string; |
|
341 |
|
|
342 |
record = *(LTIMetadataRecord **)&cPtr; |
|
343 |
|
|
344 |
if(record!=NULL){ |
|
345 |
|
|
346 |
lt_uint32 numDims=0; |
|
347 |
const lt_uint32* dims=NULL; |
|
348 |
const void* data = record->getArrayData(numDims, dims); |
|
349 |
lt_uint32 i=0; |
|
350 |
lt_uint32 d=0; |
|
351 |
|
|
352 |
|
|
353 |
clase = env->FindClass ("es/gva/cit/jmrsid/StringArray"); |
|
354 |
metodo = env->GetMethodID(clase, "reserva", "(I)V"); |
|
355 |
obj_stringarray = env->NewObject (clase,metodo,numDims*(*dims)); |
|
356 |
id_campo = env->GetFieldID(clase, "array", "[Ljava/lang/String;"); |
|
357 |
arr_string =(jobjectArray)env->GetObjectField(obj_stringarray, id_campo); |
|
358 |
|
|
359 |
for (d=0; d<numDims; d++) |
|
360 |
{ |
|
361 |
|
|
362 |
lt_uint32 nd=0; |
|
363 |
for (nd=0; nd<dims[d]; nd++) |
|
364 |
{ |
|
365 |
switch (record->getDataType()) |
|
366 |
{ |
|
367 |
case LTI_METADATA_DATATYPE_UINT8: |
|
368 |
sprintf(dato, "%d", (lt_uint32)((lt_uint8*)data)[i]); |
|
369 |
break; |
|
370 |
case LTI_METADATA_DATATYPE_SINT8: |
|
371 |
sprintf(dato, "%d", (lt_int32)((lt_int8*)data)[i]); |
|
372 |
break; |
|
373 |
case LTI_METADATA_DATATYPE_UINT16: |
|
374 |
sprintf(dato, "%d", (lt_uint32)((lt_uint16*)data)[i]); |
|
375 |
break; |
|
376 |
case LTI_METADATA_DATATYPE_SINT16: |
|
377 |
sprintf(dato, "%d", (lt_int32)((lt_int16*)data)[i]); |
|
378 |
break; |
|
379 |
case LTI_METADATA_DATATYPE_UINT32: |
|
380 |
sprintf(dato, "%d", ((lt_uint32*)data)[i]); |
|
381 |
break; |
|
382 |
case LTI_METADATA_DATATYPE_SINT32: |
|
383 |
sprintf(dato, "%d", ((lt_int32*)data)[i]); |
|
384 |
break; |
|
385 |
case LTI_METADATA_DATATYPE_UINT64: |
|
386 |
sprintf(dato, "%I64u", ((lt_uint64*)data)[i]); |
|
387 |
break; |
|
388 |
case LTI_METADATA_DATATYPE_SINT64: |
|
389 |
sprintf(dato, "%I64d", ((lt_int64*)data)[i]); |
|
390 |
break; |
|
391 |
case LTI_METADATA_DATATYPE_FLOAT32: |
|
392 |
sprintf(dato, "%f", ((float*)data)[i]); |
|
393 |
break; |
|
394 |
case LTI_METADATA_DATATYPE_FLOAT64: |
|
395 |
sprintf(dato, "%f", ((double*)data)[i]); |
|
396 |
break; |
|
397 |
case LTI_METADATA_DATATYPE_ASCII: |
|
398 |
{ |
|
399 |
const char* p = ((const char**)data)[i]; |
|
400 |
sprintf(dato,"%s", p); |
|
401 |
} |
|
402 |
break; |
|
403 |
} |
|
404 |
|
|
405 |
env->SetObjectArrayElement(arr_string,i,env->NewStringUTF(dato)); |
|
406 |
|
|
407 |
++i; |
|
408 |
} |
|
409 |
} |
|
410 |
|
|
411 |
} |
|
412 |
|
|
413 |
return obj_stringarray; |
|
414 |
} |
|
415 |
|
|
416 |
/******************************************************************************/ |
|
417 |
// getNumDims |
|
418 |
/******************************************************************************/ |
|
419 |
|
|
420 |
JNIEXPORT jint JNICALL Java_es_gva_cit_jmrsid_LTIMetadataRecord_getNumDimsNat |
|
421 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
422 |
|
|
423 |
jint dims=-1; |
|
424 |
LTIMetadataRecord *record = (LTIMetadataRecord *) 0 ; |
|
425 |
record = *(LTIMetadataRecord **)&cPtr; |
|
426 |
if(record!=NULL){ |
|
427 |
dims = (jint)record->getNumDims(); |
|
428 |
} |
|
429 |
return dims; |
|
430 |
} |
|
431 |
|
|
432 |
/******************************************************************************/ |
|
433 |
// getDims |
|
434 |
/******************************************************************************/ |
|
435 |
|
|
436 |
JNIEXPORT jintArray JNICALL Java_es_gva_cit_jmrsid_LTIMetadataRecord_getDimsNat |
|
437 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
438 |
|
|
439 |
jintArray longitudes=NULL; |
|
440 |
LTIMetadataRecord *record = (LTIMetadataRecord *) 0 ; |
|
441 |
record = *(LTIMetadataRecord **)&cPtr; |
|
442 |
if(record!=NULL){ |
|
443 |
const lt_uint32* dims = record->getDims(); |
|
444 |
const lt_uint32 numdims = record->getNumDims(); |
|
445 |
longitudes = env->NewIntArray((int)numdims); |
|
446 |
env->SetIntArrayRegion( longitudes, 0, (int)numdims,(jint *)dims); |
|
447 |
|
|
448 |
} |
|
449 |
return longitudes; |
|
450 |
} |
|
451 |
|
|
452 |
|
|
453 |
/******************************************************************************/ |
|
454 |
// ~LTIMetadataRecord |
|
455 |
/******************************************************************************/ |
|
456 |
|
|
457 |
JNIEXPORT void JNICALL Java_es_gva_cit_jmrsid_LTIMetadataRecord_FreeLTIMetadataRecordNat |
|
458 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
459 |
|
|
460 |
LTIMetadataRecord *record = (LTIMetadataRecord *) 0 ; |
|
461 |
|
|
462 |
record = *(LTIMetadataRecord **)&cPtr; |
|
463 |
if(record!=NULL){ |
|
464 |
delete record; |
|
465 |
} |
|
466 |
|
|
467 |
} |
1.10/tags/gvSIG_3D_Animation_1_10_build_16/libraries/libjni-mrsid/src/main/native/jmrsid/ltiutils.cpp | ||
---|---|---|
1 |
/********************************************************************** |
|
2 |
* $Id: ltiutils.cpp 3539 2006-01-09 12:23:20Z nacho $ |
|
3 |
* |
|
4 |
* Name: ltiutils.c |
|
5 |
* Project: JMRSID. Interfaz java to MrSID (Lizardtech). |
|
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 |
|
|
52 |
#include <jni.h> |
|
53 |
#include <malloc.h> |
|
54 |
#include "es_gva_cit_jmrsid_LTIUtils.h" |
|
55 |
#include "es_gva_cit_jmrsid_JNIBase.h" |
|
56 |
|
|
57 |
#include "lt_types.h" |
|
58 |
#include "lt_base.h" |
|
59 |
#include "lt_fileSpec.h" |
|
60 |
#include "lti_geoCoord.h" |
|
61 |
#include "lti_pixel.h" |
|
62 |
#include "lti_navigator.h" |
|
63 |
#include "lti_sceneBuffer.h" |
|
64 |
#include "lti_metadataDatabase.h" |
|
65 |
#include "lti_metadataRecord.h" |
|
66 |
#include "lti_utils.h" |
|
67 |
#include "MrSIDImageReader.h" |
|
68 |
#include "J2KImageReader.h" |
|
69 |
#include "lti_imageReader.h" |
|
70 |
#include "lti_sceneBuffer.h" |
|
71 |
#include "lti_scene.h" |
|
72 |
//#include "cpl_conv.h" |
|
73 |
#include "TIFFImageWriter.h" |
|
74 |
|
|
75 |
LT_USE_NAMESPACE(LizardTech); |
|
76 |
|
|
77 |
/******************************************************************************/ |
|
78 |
// levelToMag |
|
79 |
/******************************************************************************/ |
|
80 |
|
|
81 |
JNIEXPORT jdouble JNICALL Java_es_gva_cit_jmrsid_LTIUtils_levelToMagNat |
|
82 |
(JNIEnv *env, jclass clase, jint level){ |
|
83 |
|
|
84 |
double mag = LTIUtils::levelToMag(level); |
|
85 |
|
|
86 |
return (jdouble)mag; |
|
87 |
} |
1.10/tags/gvSIG_3D_Animation_1_10_build_16/libraries/libjni-mrsid/src/main/native/jmrsid/ltipixel.cpp | ||
---|---|---|
1 |
/********************************************************************** |
|
2 |
* $Id: ltipixel.cpp 3539 2006-01-09 12:23:20Z nacho $ |
|
3 |
* |
|
4 |
* Name: ltipixel.c |
|
5 |
* Project: JMRSID. Interfaz java to MrSID (Lizardtech). |
|
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 |
|
|
52 |
#include <jni.h> |
|
53 |
#include "es_gva_cit_jmrsid_LTIPixel.h" |
|
54 |
#include "es_gva_cit_jmrsid_JNIBase.h" |
|
55 |
|
|
56 |
#include "lt_types.h" |
|
57 |
#include "lt_base.h" |
|
58 |
#include "lt_fileSpec.h" |
|
59 |
#include "lti_geoCoord.h" |
|
60 |
#include "lti_pixel.h" |
|
61 |
#include "lti_navigator.h" |
|
62 |
#include "lti_sceneBuffer.h" |
|
63 |
#include "lti_metadataDatabase.h" |
|
64 |
#include "lti_metadataRecord.h" |
|
65 |
#include "lti_utils.h" |
|
66 |
#include "MrSIDImageReader.h" |
|
67 |
#include "J2KImageReader.h" |
|
68 |
#include "lti_imageReader.h" |
|
69 |
#include "lti_sceneBuffer.h" |
|
70 |
#include "lti_scene.h" |
|
71 |
//#include "cpl_conv.h" |
|
72 |
#include "TIFFImageWriter.h" |
|
73 |
|
|
74 |
LT_USE_NAMESPACE(LizardTech); |
|
75 |
|
|
76 |
/******************************************************************************/ |
|
77 |
// Constructor LTIPixel |
|
78 |
/******************************************************************************/ |
|
79 |
|
|
80 |
|
|
81 |
JNIEXPORT jlong JNICALL Java_es_gva_cit_jmrsid_LTIPixel_LTIPixelNat |
|
82 |
(JNIEnv *env, jobject obj, jint eColorSpace, jint nBands, jint eSampleType){ |
|
83 |
|
|
84 |
LTIPixel *poPixel; |
|
85 |
jlong jresult = 0 ; |
|
86 |
|
|
87 |
poPixel = new LTIPixel((LTIColorSpace)eColorSpace, (lt_uint16)nBands, (LTIDataType)eSampleType ); |
|
88 |
|
|
89 |
*(LTIPixel **)&jresult = poPixel; |
|
90 |
|
|
91 |
return jresult; |
|
92 |
} |
|
93 |
|
|
94 |
/******************************************************************************/ |
|
95 |
// ~LTIPixel |
|
96 |
/******************************************************************************/ |
|
97 |
|
|
98 |
JNIEXPORT void JNICALL Java_es_gva_cit_jmrsid_LTIPixel_FreeLTIPixelNat |
|
99 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
100 |
|
|
101 |
LTIPixel *pixel = (LTIPixel *) 0 ; |
|
102 |
|
|
103 |
pixel = *(LTIPixel **)&cPtr; |
|
104 |
if(pixel!=NULL){ |
|
105 |
delete pixel; |
|
106 |
} |
|
107 |
|
|
108 |
} |
1.10/tags/gvSIG_3D_Animation_1_10_build_16/libraries/libjni-mrsid/src/main/native/jmrsid/ltiimage.cpp | ||
---|---|---|
1 |
/********************************************************************** |
|
2 |
* $Id: ltiimage.cpp 8460 2006-10-31 16:26:34Z nacho $ |
|
3 |
* |
|
4 |
* Name: ltiimage.c |
|
5 |
* Project: JMRSID. Interfaz java to MrSID (Lizardtech). |
|
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 |
|
|
52 |
#include <jni.h> |
|
53 |
#include <malloc.h> |
|
54 |
#include "es_gva_cit_jmrsid_LTIImage.h" |
|
55 |
#include "es_gva_cit_jmrsid_JNIBase.h" |
|
56 |
|
|
57 |
#include "lt_types.h" |
|
58 |
#include "lt_base.h" |
|
59 |
#include "lt_fileSpec.h" |
|
60 |
#include "lti_geoCoord.h" |
|
61 |
#include "lti_pixel.h" |
|
62 |
#include "lti_navigator.h" |
|
63 |
#include "lti_sceneBuffer.h" |
|
64 |
#include "lti_metadataDatabase.h" |
|
65 |
#include "lti_metadataRecord.h" |
|
66 |
#include "lti_utils.h" |
|
67 |
#include "MrSIDImageReader.h" |
|
68 |
#include "J2KImageReader.h" |
|
69 |
#include "lti_imageReader.h" |
|
70 |
#include "lti_sceneBuffer.h" |
|
71 |
#include "lti_scene.h" |
|
72 |
//#include "cpl_conv.h" |
|
73 |
#include "TIFFImageWriter.h" |
|
74 |
|
|
75 |
LT_USE_NAMESPACE(LizardTech); |
|
76 |
|
|
77 |
/******************************************************************************/ |
|
78 |
// initialize |
|
79 |
/******************************************************************************/ |
|
80 |
|
|
81 |
|
|
82 |
JNIEXPORT jint JNICALL Java_es_gva_cit_jmrsid_JNIBase_initializeNat |
|
83 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
84 |
|
|
85 |
LTIImage *img = (LTIImage *) 0 ; |
|
86 |
int res = -1; |
|
87 |
|
|
88 |
img = *(LTIImage **)&cPtr; |
|
89 |
// rgaitan: API has changed between previous version |
|
90 |
// and this version.. so this method currently is |
|
91 |
// really a no-op, but I don't want to change all |
|
92 |
// raster libraries :). |
|
93 |
if(img!=NULL) |
|
94 |
res = 0; |
|
95 |
|
|
96 |
|
|
97 |
return res; |
|
98 |
|
|
99 |
} |
|
100 |
|
|
101 |
/******************************************************************************/ |
|
102 |
// getMetadata |
|
103 |
/******************************************************************************/ |
|
104 |
|
|
105 |
JNIEXPORT jlong JNICALL Java_es_gva_cit_jmrsid_LTIImage_getMetadataNat |
|
106 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
107 |
|
|
108 |
jlong jresult = 0 ; |
|
109 |
LTIImageReader *img = (LTIImageReader *) 0 ; |
|
110 |
LTIMetadataDatabase *metadata=NULL; |
|
111 |
|
|
112 |
img = *(LTIImageReader **)&cPtr; |
|
113 |
if(img!=NULL){ |
|
114 |
metadata = new LTIMetadataDatabase( img->getMetadata() ); |
|
115 |
*(LTIMetadataDatabase **)&jresult = metadata; |
|
116 |
} |
|
117 |
|
|
118 |
return jresult; |
|
119 |
|
|
120 |
} |
|
121 |
|
|
122 |
/******************************************************************************/ |
|
123 |
// getWidth |
|
124 |
/******************************************************************************/ |
|
125 |
|
|
126 |
|
|
127 |
JNIEXPORT jint JNICALL Java_es_gva_cit_jmrsid_JNIBase_getWidthNat |
|
128 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
129 |
|
|
130 |
LTIImage *img = (LTIImage *) 0 ; |
|
131 |
int res = -1; |
|
132 |
|
|
133 |
img = *(LTIImage **)&cPtr; |
|
134 |
|
|
135 |
if(img!=NULL) |
|
136 |
res = img->getWidth(); |
|
137 |
|
|
138 |
return res; |
|
139 |
|
|
140 |
} |
|
141 |
|
|
142 |
|
|
143 |
/******************************************************************************/ |
|
144 |
// getHeight |
|
145 |
/******************************************************************************/ |
|
146 |
|
|
147 |
|
|
148 |
JNIEXPORT jint JNICALL Java_es_gva_cit_jmrsid_JNIBase_getHeightNat |
|
149 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
150 |
|
|
151 |
LTIImage *img = (LTIImage *) 0 ; |
|
152 |
int res = -1; |
|
153 |
|
|
154 |
img = *(LTIImage **)&cPtr; |
|
155 |
|
|
156 |
if(img!=NULL) |
|
157 |
res = img->getHeight(); |
|
158 |
|
|
159 |
return res; |
|
160 |
|
|
161 |
} |
|
162 |
|
|
163 |
|
|
164 |
/******************************************************************************/ |
|
165 |
// getDimsAtMagWidth |
|
166 |
/******************************************************************************/ |
|
167 |
|
|
168 |
|
|
169 |
JNIEXPORT jint JNICALL Java_es_gva_cit_jmrsid_LTIImage_getDimsAtMagWidthNat |
|
170 |
(JNIEnv *env, jobject obj, jlong cPtr, jdouble mag){ |
|
171 |
|
|
172 |
LTIImage *img = (LTIImage *) 0 ; |
|
173 |
int res = -1; |
|
174 |
int height; |
|
175 |
double mg=mag; |
|
176 |
|
|
177 |
img = *(LTIImage **)&cPtr; |
|
178 |
|
|
179 |
if(img!=NULL) |
|
180 |
img->getDimsAtMag((double)mg,(lt_uint32 &)res,(lt_uint32 &)height); |
|
181 |
|
|
182 |
return res; |
|
183 |
|
|
184 |
} |
|
185 |
|
|
186 |
/******************************************************************************/ |
|
187 |
// getDimsAtMagHeight |
|
188 |
/******************************************************************************/ |
|
189 |
|
|
190 |
|
|
191 |
JNIEXPORT jint JNICALL Java_es_gva_cit_jmrsid_LTIImage_getDimsAtMagHeightNat |
|
192 |
(JNIEnv *env, jobject obj, jlong cPtr, jdouble mag){ |
|
193 |
|
|
194 |
LTIImage *img = (LTIImage *) 0 ; |
|
195 |
int res = -1; |
|
196 |
int width; |
|
197 |
double mg=mag; |
|
198 |
|
|
199 |
img = *(LTIImage **)&cPtr; |
|
200 |
|
|
201 |
if(img!=NULL) |
|
202 |
img->getDimsAtMag((double)mg,(lt_uint32 &)width,(lt_uint32 &)res); |
|
203 |
|
|
204 |
return res; |
|
205 |
|
|
206 |
} |
|
207 |
|
|
208 |
/******************************************************************************/ |
|
209 |
// getStripHeight |
|
210 |
/******************************************************************************/ |
|
211 |
|
|
212 |
|
|
213 |
JNIEXPORT jint JNICALL Java_es_gva_cit_jmrsid_JNIBase_getStripHeightNat |
|
214 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
215 |
|
|
216 |
LTIImageReader *img = (LTIImageReader *) 0 ; |
|
217 |
int res = -1; |
|
218 |
|
|
219 |
img = *(LTIImageReader **)&cPtr; |
|
220 |
|
|
221 |
if(img!=NULL) |
|
222 |
res = img->getStripHeight(); |
|
223 |
|
|
224 |
return res; |
|
225 |
|
|
226 |
} |
|
227 |
|
|
228 |
/******************************************************************************/ |
|
229 |
// getNumBands |
|
230 |
/******************************************************************************/ |
|
231 |
|
|
232 |
|
|
233 |
JNIEXPORT jint JNICALL Java_es_gva_cit_jmrsid_JNIBase_getNumBandsNat |
|
234 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
235 |
|
|
236 |
LTIImage *img = (LTIImage *) 0 ; |
|
237 |
int res = -1; |
|
238 |
|
|
239 |
img = *(LTIImage **)&cPtr; |
|
240 |
|
|
241 |
if(img!=NULL) |
|
242 |
res = img->getNumBands(); |
|
243 |
|
|
244 |
return res; |
|
245 |
|
|
246 |
} |
|
247 |
|
|
248 |
/******************************************************************************/ |
|
249 |
// getColorSpace |
|
250 |
/******************************************************************************/ |
|
251 |
|
|
252 |
|
|
253 |
JNIEXPORT jint JNICALL Java_es_gva_cit_jmrsid_JNIBase_getColorSpaceNat |
|
254 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
255 |
|
|
256 |
LTIImage *img = (LTIImage *) 0 ; |
|
257 |
int res = -1; |
|
258 |
|
|
259 |
img = *(LTIImage **)&cPtr; |
|
260 |
|
|
261 |
if(img!=NULL) |
|
262 |
res = img->getColorSpace(); |
|
263 |
|
|
264 |
return res; |
|
265 |
|
|
266 |
} |
|
267 |
|
|
268 |
/******************************************************************************/ |
|
269 |
// getDataType |
|
270 |
/******************************************************************************/ |
|
271 |
|
|
272 |
|
|
273 |
JNIEXPORT jint JNICALL Java_es_gva_cit_jmrsid_JNIBase_getDataTypeNat |
|
274 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
275 |
|
|
276 |
LTIImage *img = (LTIImage *) 0 ; |
|
277 |
int res = -1; |
|
278 |
|
|
279 |
img = *(LTIImage **)&cPtr; |
|
280 |
|
|
281 |
if(img!=NULL) |
|
282 |
res = img->getDataType(); |
|
283 |
|
|
284 |
return res; |
|
285 |
|
|
286 |
} |
|
287 |
|
|
288 |
/******************************************************************************/ |
|
289 |
// getMinMagnification |
|
290 |
/******************************************************************************/ |
|
291 |
|
|
292 |
|
|
293 |
JNIEXPORT jdouble JNICALL Java_es_gva_cit_jmrsid_LTIImage_getMinMagnificationNat |
|
294 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
295 |
|
|
296 |
LTIImage *img = (LTIImage *) 0 ; |
|
297 |
double res = -1; |
|
298 |
|
|
299 |
img = *(LTIImage **)&cPtr; |
|
300 |
|
|
301 |
if(img!=NULL) |
|
302 |
res = img->getMinMagnification(); |
|
303 |
|
|
304 |
return (jdouble)res; |
|
305 |
|
|
306 |
} |
|
307 |
|
|
308 |
/******************************************************************************/ |
|
309 |
// getMaxMagnification |
|
310 |
/******************************************************************************/ |
|
311 |
|
|
312 |
|
|
313 |
JNIEXPORT jdouble JNICALL Java_es_gva_cit_jmrsid_LTIImage_getMaxMagnificationNat |
|
314 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
315 |
|
|
316 |
LTIImage *img = (LTIImage *) 0 ; |
|
317 |
double res = -1; |
|
318 |
|
|
319 |
img = *(LTIImage **)&cPtr; |
|
320 |
|
|
321 |
if(img!=NULL) |
|
322 |
res = img->getMaxMagnification(); |
|
323 |
|
|
324 |
return (jdouble)res; |
|
325 |
|
|
326 |
} |
|
327 |
|
|
328 |
/******************************************************************************/ |
|
329 |
// getPixelProps |
|
330 |
/******************************************************************************/ |
|
331 |
|
|
332 |
|
|
333 |
/*JNIEXPORT jdouble JNICALL Java_es_gva_cit_jmrsid_LTIImage_getPixelPropsNat |
|
334 |
(JNIEnv *env, jobject obj, jlong cPtr){ |
|
335 |
|
|
336 |
jlong jresult = 0 ;*/ |
|
337 |
/*LTIImage *img = (LTIImage *) 0 ; |
|
338 |
|
|
339 |
|
|
340 |
img = *(LTIImage **)&cPtr; |
|
341 |
if(img!=NULL){ |
|
342 |
const LTIPixel& pixelprops = img->getPixelProps(); |
|
343 |
*(LTIPixel **)&jresult = pixelprops; |
|
344 |
|
|
345 |
|
|
346 |
return (jlong)pixelprops; |
|
347 |
}*/ |
|
348 |
/*return jresult; |
|
349 |
|
|
350 |
} */ |
|
351 |
|
|
352 |
/******************************************************************************/ |
|
353 |
// getGeoCoord |
|
354 |
/******************************************************************************/ |
|
355 |
|
|
356 |
JNIEXPORT jint JNICALL Java_es_gva_cit_jmrsid_LTIImage_getGeoCoordNat |
|
357 |
(JNIEnv *env, jobject obj, jlong cPtr, jobject geocoord){ |
|
358 |
|
|
359 |
LTIImage *img = (LTIImage *) 0 ; |
|
360 |
jclass clase; |
|
361 |
jfieldID id_campo; |
|
362 |
|
|
363 |
img = *(LTIImage **)&cPtr; |
|
364 |
if(img!=NULL){ |
|
365 |
const LTIGeoCoord& geo = img->getGeoCoord(); |
|
366 |
|
|
367 |
clase = env->GetObjectClass(geocoord); |
|
368 |
id_campo = env->GetFieldID(clase, "xUL", "D"); |
|
369 |
env->SetDoubleField(geocoord, id_campo, geo.getX()); |
|
370 |
|
|
371 |
id_campo = env->GetFieldID(clase, "yUL", "D"); |
|
372 |
env->SetDoubleField(geocoord, id_campo, geo.getY()); |
|
373 |
|
|
374 |
id_campo = env->GetFieldID(clase, "xRes", "D"); |
|
375 |
env->SetDoubleField(geocoord, id_campo, geo.getXRes()); |
|
376 |
|
|
377 |
id_campo = env->GetFieldID(clase, "yRes", "D"); |
|
378 |
env->SetDoubleField(geocoord, id_campo, geo.getYRes()); |
|
379 |
|
|
380 |
id_campo = env->GetFieldID(clase, "xRot", "D"); |
Also available in: Unified diff