Revision 141

View differences:

org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3
	<modelVersion>4.0.0</modelVersion>
4
	<groupId>org.gvsig</groupId>
5
	<artifactId>org.gvsig.toolbox.core</artifactId>
6
	<packaging>jar</packaging>
7
	<name>${artifactId}</name>
8
	
9
	<parent>
10
		<groupId>org.gvsig</groupId>
11
		<artifactId>org.gvsig.toolbox</artifactId>
12
		<version>1.0.16</version>
13
	</parent>
14
	
15
	<dependencies>
16
	    <dependency>
17
            <groupId>org.gvsig</groupId>
18
            <artifactId>org.gvsig.i18n</artifactId>
19
            <scope>compile</scope>
20
        </dependency>
21
		<dependency>
22
			<groupId>org.gvsig</groupId>
23
			<artifactId>org.gvsig.toolbox.math</artifactId>
24
		</dependency>
25
		<dependency>
26
			<groupId>jfree</groupId>
27
			<artifactId>jfreechart</artifactId>
28
		</dependency>
29
		<dependency>
30
			<groupId>com.vividsolutions</groupId>
31
			<artifactId>jts</artifactId>
32
		</dependency>
33
		<dependency>
34
			<groupId>net.sf.kxml</groupId>
35
			<artifactId>kxml2</artifactId>
36
		</dependency>
37
	</dependencies>
38

  
39
</project>
0 40

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/build.xml
1
<project name="SEXTANTE_LIB" default="create-jar" basedir=".">
2
    <description>
3
        SEXTANTE_LIB
4
    </description>
5
	<property name="version.number" value="0.7"/>
6

  
7
  <target name="create-jar">
8

  
9
	   <tstamp>
10
	     <format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss" />
11
	   </tstamp>
12

  
13
    <manifest file="MANIFEST.MF">
14
        <attribute name="Implementation-Version"
15
            value="${version.number}"/>
16
        <attribute name="Built-Date" value="${TODAY}"/>
17
   </manifest>
18

  
19
  	<delete dir="../dist"/>
20
  	<mkdir dir="../dist/"/>
21
    <jar jarfile="../dist/sextante.jar" manifest="MANIFEST.MF">
22
  		<fileset dir="bin">
23
            <include name="**"/>
24
 		</fileset>
25
 	</jar>
26

  
27
    <jar jarfile="../dist/sextante.jar" update ="true">
28
        <fileset dir=".">
29
            <include name="i18n/**"/>
30
        </fileset>
31
    </jar>
32

  
33
    <copy todir="../dist">
34
    	<fileset dir="lib" includes="**"/>
35
    </copy>
36

  
37
  	<ant antfile="../libMath/build.xml" inheritall="no" />
38
  	<ant antfile="../sextante_gui/build.xml" inheritall="no" />
39
        <ant antfile="../algorithms/build.xml" inheritall="no" />
40

  
41
  </target>
42

  
43
</project>
0 44

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/MANIFEST.MF
1
Manifest-Version: 1.0
2
Ant-Version: Apache Ant 1.7.1
3
Created-By: 16.0-b13 (Sun Microsystems Inc.)
4
Implementation-Version: 0.7
5
Built-Date: 2012-10-04 11:28:17
6

  
0 7

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/jaitools/package.html
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
<html>
3
  <head>
4
    <title>jaitools</title>
5
  </head>
6
  <body>
7
    The JAITools and CollectionFactory helper classes
8
  </body>
9
</html>
0 10

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/jaitools/tilecache/package.html
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
<html>
3
  <head>
4
    <title>jaitools.tilecache</title>
5
  </head>
6
  <body>
7
  An implementation of TileCache which can use disk caching to supplement
8
  memory, allowing large volumes of image data to be handled
9
  </body>
10
</html>
0 11

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/jaitools/tiledimage/package.html
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
<html>
3
  <head>
4
    <title>jaitools.tiledimage</title>
5
    <meta http-equiv="Content-Type" content="text/html; charset=MacRoman">
6
  </head>
7
  <body>
8
  A writable tiled image class similar to JAI's TiledImage but backed
9
  by disk as well as memory storage to handle very large images within
10
  limited memory.
11
  </body>
12
</html>
0 13

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/docEngines/html/HTMLDoc.java
1
package es.unex.sextante.docEngines.html;
2

  
3
/**
4
 * A class to create simple HTML-formatted texts. Use this to create HTML results from SEXTANTE algorithms
5
 * 
6
 * @author volaya
7
 * 
8
 */
9
public class HTMLDoc {
10

  
11
   private final String OPENING_HTML_CODE_1 = "<html>\n" + "<head>" + "<title>";
12

  
13
   private final String OPENING_HTML_CODE_2 = "</title>\n" + "</head>\n" + "<body bgcolor=\"#FFFFFF\" text=\"#000000\">\n";
14

  
15
   private final String CLOSING_HTML_CODE   = "</body>\n" + "</html>";
16

  
17
   private StringBuffer m_sHTMLCode;
18

  
19

  
20
   /**
21
    * Opens the HTML page with the given title
22
    * 
23
    * @param sTitle
24
    *                the title of the page
25
    */
26
   public void open(final String sTitle) {
27

  
28
      m_sHTMLCode = new StringBuffer("");
29

  
30
      m_sHTMLCode.append(OPENING_HTML_CODE_1);
31
      m_sHTMLCode.append(sTitle);
32
      m_sHTMLCode.append(OPENING_HTML_CODE_2);
33

  
34
   }
35

  
36

  
37
   /**
38
    * Closes the HTML page
39
    */
40
   public void close() {
41

  
42
      m_sHTMLCode.append(CLOSING_HTML_CODE);
43

  
44
   }
45

  
46

  
47
   /**
48
    * Returns the page as a HTML-formatted string
49
    * 
50
    * @return the page as a HTML-formatted string
51
    */
52
   public String getHTMLCode() {
53

  
54
      return m_sHTMLCode.toString();
55

  
56
   }
57

  
58

  
59
   /**
60
    * adds the given text. HTML tags can be included
61
    * 
62
    * @param sText
63
    *                the text to add
64
    */
65
   public void addText(final String sText) {
66

  
67
      m_sHTMLCode.append(sText);
68

  
69
   }
70

  
71

  
72
   /**
73
    * Adds the given text in bold font
74
    * 
75
    * @param sText
76
    *                the text to add
77
    */
78
   public void addBoldText(final String sText) {
79

  
80
      m_sHTMLCode.append("<b>");
81
      m_sHTMLCode.append(sText);
82
      m_sHTMLCode.append("</b>");
83

  
84
   }
85

  
86

  
87
   /**
88
    * Adds a new paragraph
89
    * 
90
    * @param sText
91
    *                the text of the paragraph
92
    */
93
   public void addParagraph(final String sText) {
94

  
95
      m_sHTMLCode.append("<p align=\"left\">");
96
      m_sHTMLCode.append(sText);
97
      m_sHTMLCode.append("</p>\n");
98

  
99
   }
100

  
101

  
102
   /**
103
    * Adds a line break
104
    */
105
   public void addLineBreak() {
106

  
107
      m_sHTMLCode.append("</br>");
108

  
109
   }
110

  
111

  
112
   /**
113
    * Adds a header
114
    * 
115
    * @param sText
116
    *                the text of the header
117
    * @param iOrder
118
    *                the order (importance) of the header (1,2,3...)
119
    */
120
   public void addHeader(final String sText,
121
                         final int iOrder) {
122

  
123
      m_sHTMLCode.append("<h");
124
      m_sHTMLCode.append(iOrder);
125
      m_sHTMLCode.append(" align=\"left\">");
126
      m_sHTMLCode.append(sText);
127
      m_sHTMLCode.append("</h");
128
      m_sHTMLCode.append(iOrder);
129
      m_sHTMLCode.append(">\n");
130

  
131
   }
132

  
133

  
134
   /**
135
    * Adds a hyperlink
136
    * 
137
    * @param sText
138
    *                the text of the link
139
    * @param sURL
140
    *                the URL to link to
141
    */
142
   public void addHyperlink(final String sText,
143
                            final String sURL) {
144

  
145
      m_sHTMLCode.append("<a href=\"");
146
      m_sHTMLCode.append(sURL);
147
      m_sHTMLCode.append("\">\n");
148
      m_sHTMLCode.append(sText);
149
      m_sHTMLCode.append("\n</a>");
150

  
151
   }
152

  
153

  
154
   /**
155
    * Adds a horizontal separator
156
    */
157
   public void addHorizontalSeparator() {
158

  
159
      m_sHTMLCode.append("<p><hr width=\"80%\"></p>");
160

  
161
   }
162

  
163

  
164
   /**
165
    * Adds an image
166
    * 
167
    * @param sFilename
168
    *                the filename of the image
169
    */
170
   public void addImage(final String sFilename) {
171

  
172
      m_sHTMLCode.append("<img src=\"");
173
      m_sHTMLCode.append(sFilename);
174
      m_sHTMLCode.append("\">\n");
175

  
176
   }
177

  
178

  
179
   public void addThumbnail(final String sFilename,
180
                            final int iWidth,
181
                            final boolean bIsPercent) {
182

  
183
      m_sHTMLCode.append("<a href=\"");
184
      m_sHTMLCode.append(sFilename);
185
      m_sHTMLCode.append("\">\n");
186
      m_sHTMLCode.append("<img src=\"");
187
      m_sHTMLCode.append(sFilename);
188
      m_sHTMLCode.append("\" width=");
189
      m_sHTMLCode.append(iWidth);
190
      if (bIsPercent) {
191
         m_sHTMLCode.append("%");
192
      }
193
      m_sHTMLCode.append("></a><br><br>\n");
194

  
195
   }
196

  
197

  
198
   /**
199
    * Starts an unordered list
200
    */
201
   public void startUnorderedList() {
202

  
203
      m_sHTMLCode.append("<ul>\n");
204

  
205
   }
206

  
207

  
208
   /**
209
    * Starts an ordered list
210
    */
211
   public void startOrderedList() {
212

  
213
      m_sHTMLCode.append("<ol>\n");
214

  
215
   }
216

  
217

  
218
   /**
219
    * Closes an unordered list
220
    */
221
   public void closeUnorderedList() {
222

  
223
      m_sHTMLCode.append("</ul>\n");
224

  
225
   }
226

  
227

  
228
   /**
229
    * Closes an ordered list
230
    */
231
   public void closeOrderedList() {
232

  
233
      m_sHTMLCode.append("</ol>\n");
234

  
235
   }
236

  
237

  
238
   /**
239
    * Adds an element to the last opened list (ordered or unordered)
240
    * 
241
    * @param sText
242
    *                the text of the element
243
    */
244
   public void addListElement(final String sText) {
245

  
246
      m_sHTMLCode.append("<li>");
247
      m_sHTMLCode.append(sText);
248
      m_sHTMLCode.append("</li>\n");
249

  
250
   }
251

  
252

  
253
   /**
254
    * Creates an ordered list from a set of elements
255
    * 
256
    * @param sText
257
    *                an array of string, each of them representing one element of the list
258
    */
259
   public void addOrderedList(final String[] sText) {
260

  
261
      startOrderedList();
262
      for (int i = 0; i < sText.length; i++) {
263
         addListElement(sText[i]);
264
      }
265
      closeOrderedList();
266

  
267
   }
268

  
269

  
270
   /**
271
    * Creates an unordered list from a set of elements
272
    * 
273
    * @param sText
274
    *                an array of string, each of them representing one element of the list
275
    */
276
   public void addUnorderedList(final String[] sText) {
277

  
278
      startUnorderedList();
279
      for (int i = 0; i < sText.length; i++) {
280
         addListElement(sText[i]);
281
      }
282
      closeUnorderedList();
283

  
284
   }
285

  
286

  
287
   /**
288
    * Adds a table
289
    * 
290
    * @param Table
291
    *                The table as a 2D array of strings
292
    * @param sDescription
293
    *                The description of the table
294
    * @param bColorFirstRow
295
    *                true if should give a different color to the first row
296
    * @param bColorFirstCol
297
    *                true if should give a different color to the first columns
298
    */
299
   public void addTable(final String[][] Table,
300
                        final String sDescription,
301
                        final boolean bColorFirstRow,
302
                        final boolean bColorFirstCol) {
303

  
304
      int i, j;
305
      int iRows, iCols;
306
      int iWidth;
307

  
308
      iRows = Table.length;
309
      if (iRows > 0) {
310
         iCols = Table[0].length;
311
      }
312
      else {
313
         return;
314
      }
315

  
316
      iWidth = (100 / iCols);
317

  
318
      m_sHTMLCode.append("<table width=\"99%\" style=\"background-color:transparent;\" "
319
                         + "border=0 cellspacing=0 cellpadding=2 >\n");
320

  
321
      for (i = 0; i < iRows; i++) {
322
         if ((i == 0) && bColorFirstRow) {
323
            m_sHTMLCode.append("<tr bgcolor=\"#CCCCCC\">\n");
324
         }
325
         else {
326
            m_sHTMLCode.append("<tr>\n");
327
         }
328
         for (j = 0; j < iCols; j++) {
329
            m_sHTMLCode.append("<td width=\"");
330
            m_sHTMLCode.append(iWidth);
331
            m_sHTMLCode.append("%\"");
332
            if ((j == 0) & bColorFirstCol) {
333
               m_sHTMLCode.append("bgcolor=\"#CCCCCC\"");
334
            }
335
            m_sHTMLCode.append("align=\"center\">");
336
            try {
337
               m_sHTMLCode.append(Table[i][j]);
338
            }
339
            catch (final Exception e) {}
340
            m_sHTMLCode.append("</td>");
341
         }
342
         m_sHTMLCode.append("\n</tr>\n");
343
      }
344

  
345
      m_sHTMLCode.append("\n</table>\n");
346
      m_sHTMLCode.append("<p align=\"center\"><i>");
347
      m_sHTMLCode.append(sDescription);
348
      m_sHTMLCode.append("</i></p>\n");
349

  
350
   }
351

  
352

  
353
   /**
354
    * Adds an image an a caption describing it
355
    * 
356
    * @param sImageFile
357
    *                the image file
358
    * @param sDescription
359
    *                the caption
360
    */
361
   public void addImageAndDescription(final String sImageFile,
362
                                      final String sDescription) {
363

  
364
      m_sHTMLCode.append("<p><center>\n");
365
      m_sHTMLCode.append("<img src=\"");
366
      m_sHTMLCode.append(sImageFile);
367
      m_sHTMLCode.append("\"><br>\n");
368
      m_sHTMLCode.append(sDescription);
369
      m_sHTMLCode.append("\n</center></p>\n");
370

  
371
   }
372

  
373

  
374
   /**
375
    * Adds text in courier font
376
    * 
377
    * @param sText
378
    *                the text to add
379
    */
380
   public void addCourierText(final String sText) {
381

  
382
      m_sHTMLCode.append("<font face=\"courier\">");
383
      m_sHTMLCode.append(sText);
384
      m_sHTMLCode.append("</font>");
385

  
386
   }
387

  
388

  
389
}
0 390

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/io3d/Default3DRasterLayer.java
1
package es.unex.sextante.io3d;
2

  
3
import java.awt.geom.Rectangle2D;
4
import java.io.File;
5

  
6
import es.unex.sextante.core.AnalysisExtent;
7
import es.unex.sextante.dataObjects.I3DRasterLayer;
8
import es.unex.sextante.outputs.FileOutputChannel;
9
import es.unex.sextante.outputs.IOutputChannel;
10
import es.unex.sextante.rasterWrappers.Grid3DCell;
11

  
12
public class Default3DRasterLayer
13
         implements
14
            I3DRasterLayer {
15

  
16
   private AnalysisExtent m_Extent;
17
   private double         m_dData[][][];
18
   private double         m_dNoDataValue = -99999d;
19
   private String         m_sFilename;
20
   private String         m_sName;
21
   private Object         m_CRS;
22

  
23

  
24
   public void create(final String sName,
25
                      final String sFilename,
26
                      final AnalysisExtent ae,
27
                      final Object crs) {
28

  
29
      m_CRS = crs;
30
      m_sName = sName;
31
      m_sFilename = sFilename;
32
      m_Extent = ae;
33
      m_dData = new double[ae.getNX()][ae.getNY()][ae.getNZ()];
34

  
35

  
36
   }
37

  
38

  
39
   public byte getCellValueAsByte(final int x,
40
                                  final int y,
41
                                  final int z) {
42

  
43
      return (byte) getCellValueAsDouble(x, y, z);
44

  
45
   }
46

  
47

  
48
   public double getCellValueAsDouble(final int x,
49
                                      final int y,
50
                                      final int z) {
51

  
52
      try {
53
         return m_dData[x][y][z];
54
      }
55
      catch (final Exception e) {
56
         return m_dNoDataValue;
57
      }
58

  
59
   }
60

  
61

  
62
   public float getCellValueAsFloat(final int x,
63
                                    final int y,
64
                                    final int z) {
65

  
66
      return (float) getCellValueAsDouble(x, y, z);
67

  
68
   }
69

  
70

  
71
   public int getCellValueAsInt(final int x,
72
                                final int y,
73
                                final int z) {
74

  
75
      return (int) getCellValueAsDouble(x, y, z);
76

  
77
   }
78

  
79

  
80
   public short getCellValueAsShort(final int x,
81
                                    final int y,
82
                                    final int z) {
83

  
84
      return (short) getCellValueAsDouble(x, y, z);
85

  
86
   }
87

  
88

  
89
   public int getDataType() {
90

  
91
      return RASTER_DATA_TYPE_DOUBLE;
92

  
93
   }
94

  
95

  
96
   public double getCellSize() {
97

  
98
      return m_Extent.getCellSize();
99

  
100
   }
101

  
102

  
103
   public double getCellSizeZ() {
104

  
105
      return m_Extent.getCellSizeZ();
106

  
107
   }
108

  
109

  
110
   public AnalysisExtent getLayerExtent() {
111

  
112
      return m_Extent;
113

  
114
   }
115

  
116

  
117
   public int getNX() {
118

  
119
      return m_dData.length;
120

  
121
   }
122

  
123

  
124
   public int getNY() {
125

  
126
      return m_dData[0].length;
127
   }
128

  
129

  
130
   public int getNZ() {
131

  
132
      return m_dData[0][0].length;
133

  
134
   }
135

  
136

  
137
   public double getNoDataValue() {
138

  
139
      return m_dNoDataValue;
140

  
141
   }
142

  
143

  
144
   public double getValueAt(final double x,
145
                            final double y,
146
                            final double z) {
147

  
148
      final Grid3DCell cell = m_Extent.getGridCoordsFromWorldCoords(x, y, z);
149
      return getCellValueAsDouble(cell.getX(), cell.getY(), cell.getZ());
150

  
151
   }
152

  
153

  
154
   public boolean isInWindow(final int x,
155
                             final int y,
156
                             final int z) {
157

  
158
      return (x >= 0) && (y >= 0) && (z >= 0) && (x < getNX()) && (y < getNY()) && (z < getNZ());
159

  
160
   }
161

  
162

  
163
   public boolean isNoDataValue(final double dNoDataValue) {
164

  
165
      return dNoDataValue == m_dNoDataValue;
166
   }
167

  
168

  
169
   public void setCellValue(final int x,
170
                            final int y,
171
                            final int z,
172
                            final double dValue) {
173

  
174
      try {
175
         m_dData[x][y][z] = dValue;
176
      }
177
      catch (final Exception e) {}
178

  
179
   }
180

  
181

  
182
   public void setNoData(final int x,
183
                         final int y,
184
                         final int z) {
185

  
186
      try {
187
         m_dData[x][y][z] = m_dNoDataValue;
188
      }
189
      catch (final Exception e) {}
190

  
191
   }
192

  
193

  
194
   public void setNoDataValue(final double dNoDataValue) {
195

  
196
      m_dNoDataValue = dNoDataValue;
197

  
198
   }
199

  
200

  
201
   public Object getCRS() {
202

  
203
      return m_CRS;
204

  
205
   }
206

  
207

  
208
   public Rectangle2D getFullExtent() {
209

  
210
      return m_Extent.getAsRectangle2D();
211

  
212
   }
213

  
214

  
215
   public void close() {}
216

  
217

  
218
   public Object getBaseDataObject() {
219

  
220
      return m_dData;
221

  
222
   }
223

  
224

  
225
   public IOutputChannel getOutputChannel() {
226

  
227
      return new FileOutputChannel(m_sFilename);
228

  
229
   }
230

  
231

  
232
   public String getName() {
233

  
234
      return m_sName;
235

  
236
   }
237

  
238

  
239
   public void open() {}
240

  
241

  
242
   public void postProcess() throws Exception {
243

  
244
      ASCII3DFileTools.writeFile(this, new File(m_sFilename));
245

  
246
   }
247

  
248

  
249
   public void setName(final String sName) {
250

  
251
      m_sName = sName;
252

  
253
   }
254

  
255

  
256
   public void free() {
257

  
258
      m_dData = null;
259

  
260
   }
261

  
262
}
0 263

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/io3d/ASCII3DFileTools.java
1
package es.unex.sextante.io3d;
2

  
3
import java.io.BufferedReader;
4
import java.io.BufferedWriter;
5
import java.io.File;
6
import java.io.FileReader;
7
import java.io.FileWriter;
8
import java.io.IOException;
9

  
10
import es.unex.sextante.core.AnalysisExtent;
11
import es.unex.sextante.dataObjects.I3DRasterLayer;
12

  
13

  
14
public class ASCII3DFileTools {
15

  
16
   public static I3DRasterLayer readFile(final File file) throws IOException, NumberFormatException {
17

  
18
      String s = new String();
19
      int iX, iY, iZ;
20
      double dCellsize, dCellsizeZ;
21
      double dX, dY, dZ;
22
      final BufferedReader fin = new BufferedReader(new FileReader(file));
23

  
24
      s = fin.readLine();
25
      String[] sTokens = s.split(" ");
26
      iX = Integer.parseInt(sTokens[0]);
27
      iY = Integer.parseInt(sTokens[1]);
28
      iZ = Integer.parseInt(sTokens[2]);
29
      s = fin.readLine();
30
      sTokens = s.split(" ");
31
      dX = Double.parseDouble(sTokens[0]);
32
      dY = Double.parseDouble(sTokens[1]);
33
      dZ = Double.parseDouble(sTokens[2]);
34
      s = fin.readLine();
35
      sTokens = s.split(" ");
36
      dCellsize = Double.parseDouble(sTokens[0]);
37
      dCellsizeZ = Double.parseDouble(sTokens[1]);
38

  
39
      final AnalysisExtent ae = new AnalysisExtent();
40
      ae.setCellSize(dCellsize);
41
      ae.setCellSizeZ(dCellsizeZ);
42
      ae.setXRange(dX, dX + iX * dCellsize, true);
43
      ae.setYRange(dY, dY + iY * dCellsize, true);
44
      ae.setZRange(dZ, dZ + iZ * dCellsizeZ, true);
45

  
46
      final Default3DRasterLayer layer = new Default3DRasterLayer();
47
      layer.create("", file.getAbsolutePath(), ae, null);
48

  
49
      for (int z = 0; z < iZ; z++) {
50
         for (int y = 0; y < iY; y++) {
51
            s = fin.readLine();
52
            sTokens = s.split(" ");
53
            for (int x = 0; x < iX; x++) {
54
               layer.setCellValue(x, y, z, Double.parseDouble(sTokens[x]));
55
            }
56
         }
57
      }
58
      fin.close();
59

  
60
      return layer;
61

  
62
   }
63

  
64

  
65
   public static boolean writeFile(final I3DRasterLayer layer,
66
                                   final File file) {
67

  
68
      int x;
69
      try {
70
         final FileWriter writer = new FileWriter(file);
71
         final BufferedWriter out = new BufferedWriter(writer);
72
         final AnalysisExtent extent = layer.getLayerExtent();
73
         out.write(Integer.toString(extent.getNX()) + " " + Integer.toString(extent.getNY()) + " "
74
                   + Integer.toString(extent.getNZ()) + "\n");
75
         out.write(Double.toString(extent.getXMin()) + " " + Double.toString(extent.getYMin()) + " "
76
                   + Double.toString(extent.getZMin()) + "\n");
77
         out.write(Double.toString(layer.getCellSize()) + " " + Double.toString(layer.getCellSizeZ()) + "\n");
78
         for (int z = 0; z < layer.getNZ(); z++) {
79
            for (int y = 0; y < layer.getNY(); y++) {
80
               for (x = 0; x < layer.getNX() - 1; x++) {
81
                  out.write(Double.toString(layer.getCellValueAsDouble(x, y, z)) + " ");
82
               }
83
               out.write(Double.toString(layer.getCellValueAsDouble(x, y, z)) + "\n");
84
            }
85
         }
86
         out.close();
87
         writer.close();
88
      }
89
      catch (final Exception e) {
90
         e.printStackTrace();
91
         return false;
92
      }
93

  
94
      return true;
95

  
96
   }
97

  
98
}
0 99

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/exceptions/WrongAnalysisExtentException.java
1
package es.unex.sextante.exceptions;
2

  
3
public class WrongAnalysisExtentException
4
         extends
5
            GeoAlgorithmExecutionException {
6

  
7
   public WrongAnalysisExtentException(final String s) {
8

  
9
      super(s);
10

  
11
   }
12

  
13

  
14
   public WrongAnalysisExtentException() {
15

  
16
      super("Wrong raster extension exception");
17

  
18
   }
19

  
20
}
0 21

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/exceptions/IteratorException.java
1
package es.unex.sextante.exceptions;
2

  
3
public class IteratorException
4
         extends
5
            GeoAlgorithmExecutionException {
6

  
7
   public IteratorException() {
8

  
9
      super("Iterator exception");
10

  
11
   }
12

  
13

  
14
   public IteratorException(final String s) {
15

  
16
      super(s);
17

  
18
   }
19

  
20
}
0 21

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/exceptions/WrongOutputIDException.java
1
package es.unex.sextante.exceptions;
2

  
3
public class WrongOutputIDException
4
         extends
5
            GeoAlgorithmExecutionException {
6

  
7
   public WrongOutputIDException() {
8

  
9
      super("Wrong uoutput ID exception");
10

  
11
   }
12

  
13
}
0 14

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/exceptions/WrongParameterValueException.java
1
package es.unex.sextante.exceptions;
2

  
3
public class WrongParameterValueException
4
         extends
5
            GeoAlgorithmExecutionException {
6

  
7
   public WrongParameterValueException() {
8

  
9
      super("Wrong parameter value exception");
10

  
11
   }
12

  
13
}
0 14

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/exceptions/RepeatedParameterNameException.java
1
package es.unex.sextante.exceptions;
2

  
3
public class RepeatedParameterNameException
4
         extends
5
            Exception {
6

  
7
   public RepeatedParameterNameException() {}
8

  
9
}
0 10

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/exceptions/WrongSerializedStringParameterValueException.java
1
package es.unex.sextante.exceptions;
2

  
3
public class WrongSerializedStringParameterValueException
4
         extends
5
            Exception {
6

  
7
}
0 8

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/exceptions/WrongParameterTypeException.java
1
package es.unex.sextante.exceptions;
2

  
3
public class WrongParameterTypeException
4
         extends
5
            GeoAlgorithmExecutionException {
6

  
7
   public WrongParameterTypeException() {
8

  
9
      super("Wrong parameter type execption");
10

  
11
   }
12

  
13
}
0 14

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/exceptions/OptionalParentParameterException.java
1
package es.unex.sextante.exceptions;
2

  
3
public class OptionalParentParameterException
4
         extends
5
            Exception {
6

  
7
   public OptionalParentParameterException() {}
8

  
9
}
0 10

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/exceptions/WrongOutputChannelDataException.java
1
package es.unex.sextante.exceptions;
2

  
3
public class WrongOutputChannelDataException
4
         extends
5
            Exception {
6

  
7
}
0 8

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/exceptions/UnsupportedOutputChannelException.java
1
package es.unex.sextante.exceptions;
2

  
3
public class UnsupportedOutputChannelException
4
         extends
5
            GeoAlgorithmExecutionException {
6

  
7
   public UnsupportedOutputChannelException() {
8

  
9
      super("Unsupported output channel");
10

  
11
   }
12

  
13
}
0 14

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/exceptions/GeoAlgorithmExecutionException.java
1
package es.unex.sextante.exceptions;
2

  
3
public class GeoAlgorithmExecutionException
4
         extends
5
            Exception {
6

  
7
   public GeoAlgorithmExecutionException(final String s) {
8

  
9
      super(s);
10

  
11
   }
12

  
13
}
0 14

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/exceptions/NullParameterValueException.java
1
package es.unex.sextante.exceptions;
2

  
3
public class NullParameterValueException
4
         extends
5
            GeoAlgorithmExecutionException {
6

  
7
   public NullParameterValueException() {
8

  
9
      super("Null parameter value exception");
10

  
11
   }
12
}
0 13

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/exceptions/WrongParameterIDException.java
1
package es.unex.sextante.exceptions;
2

  
3
public class WrongParameterIDException
4
         extends
5
            GeoAlgorithmExecutionException {
6

  
7
   public WrongParameterIDException() {
8

  
9
      super("Wrong parameter ID exception");
10

  
11
   }
12

  
13
}
0 14

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/exceptions/WrongInputException.java
1
package es.unex.sextante.exceptions;
2

  
3
import es.unex.sextante.core.Sextante;
4

  
5
public class WrongInputException
6
         extends
7
            Exception {
8

  
9
   public WrongInputException() {
10

  
11
      super(Sextante.getText("Wrong_or_missing_parameters_definition"));
12

  
13
   }
14

  
15

  
16
   public WrongInputException(final String s) {
17

  
18
      super(s);
19

  
20
   }
21

  
22
}
0 23

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/exceptions/UndefinedParentParameterNameException.java
1
package es.unex.sextante.exceptions;
2

  
3
public class UndefinedParentParameterNameException
4
         extends
5
            Exception {
6

  
7
   public UndefinedParentParameterNameException() {}
8

  
9
}
0 10

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/exceptions/NullParameterAdditionalInfoException.java
1
package es.unex.sextante.exceptions;
2

  
3
public class NullParameterAdditionalInfoException
4
         extends
5
            GeoAlgorithmExecutionException {
6

  
7
   public NullParameterAdditionalInfoException() {
8

  
9
      super("Null parameter additional info exception");
10

  
11
   }
12
}
0 13

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/dataObjects/IFeature.java
1
package es.unex.sextante.dataObjects;
2

  
3
import com.vividsolutions.jts.geom.Geometry;
4

  
5
/**
6
 * A generic interface for features, to be used by SEXTANTE algorithms
7
 *
8
 * @author Victor Olaya volaya@unex.es
9
 *
10
 */
11
public interface IFeature {
12

  
13
   /**
14
    * Returns the geometry of the feature
15
    *
16
    * @return the geometry of the feature
17
    */
18
   public Geometry getGeometry();
19

  
20

  
21
   /**
22
    * Returns the set of attributes of the feature
23
    *
24
    * @return the attributes of the feature
25
    */
26
   public IRecord getRecord();
27

  
28
}
0 29

  
org.gvsig.toolbox/tags/org.gvsig.toolbox-1.0.16/org.gvsig.toolbox.core/src/main/java/es/unex/sextante/dataObjects/IRasterLayer.java
1
package es.unex.sextante.dataObjects;
2

  
3
import java.awt.image.DataBuffer;
4

  
5
import es.unex.sextante.core.AnalysisExtent;
6

  
7
/**
8
 * This is the base interface that all raster object have to implement to be able to be used by SEXTANTE algorithms.
9
 * 
10
 * Instead of implementing this class directly, it is recommended to extend {@link AbstractRasterLayer}, since it solves some of
11
 * the most complex methods, such as grid window definition and resampling methods
12
 * 
13
 * @author Victor Olaya. volaya@unex.es
14
 * 
15
 */
16
public interface IRasterLayer
17
         extends
18
            ILayer {
19

  
20
   public static final int RASTER_DATA_TYPE_FLOAT         = DataBuffer.TYPE_FLOAT;
21
   public static final int RASTER_DATA_TYPE_DOUBLE        = DataBuffer.TYPE_DOUBLE;
22
   public static final int RASTER_DATA_TYPE_INT           = DataBuffer.TYPE_INT;
23
   public static final int RASTER_DATA_TYPE_SHORT         = DataBuffer.TYPE_SHORT;
24
   public static final int RASTER_DATA_TYPE_BYTE          = DataBuffer.TYPE_BYTE;
25

  
26
   public static final int INTERPOLATION_NearestNeighbour = 0;
27
   public static final int INTERPOLATION_Bilinear         = 1;
28
   public static final int INTERPOLATION_InverseDistance  = 2;
29
   public static final int INTERPOLATION_BicubicSpline    = 3;
30
   public static final int INTERPOLATION_BSpline          = 4;
31

  
32

  
33
   /**
34
    * Returns the data type of the layer
35
    * 
36
    * @return the data type of the layer
37
    */
38
   public int getDataType();
39

  
40

  
41
   /**
42
    * Returns the extent of the query window of this layer. Each layer can have a query window, which makes it easier to
43
    * seamlessly combine several layers.
44
    * 
45
    * @return the window grid extent
46
    */
47
   public AnalysisExtent getWindowGridExtent();
48

  
49

  
50
   /**
51
    * Returns the extent of the whole layer
52
    * 
53
    * @return the extent of the whole layer
54
    */
55
   public AnalysisExtent getLayerGridExtent();
56

  
57

  
58
   /**
59
    * Return the cellsize of the query window. X and Y cellsizes are assumed to be equal
60
    * 
61
    * @return the cellsize of the query window
62
    */
63
   public double getWindowCellSize();
64

  
65

  
66
   /**
67
    * Return the original cellsize of the layer. X and Y cellsizes are assumed to be equal
68
    * 
69
    * @return the original cellsize of the layer
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff