Statistics
| Revision:

gvsig-geoprocess / org.gvsig.geoprocess / trunk / org.gvsig.geoprocess / org.gvsig.geoprocess.lib / org.gvsig.geoprocess.lib.sextante / src / main / java / org / gvsig / geoprocess / lib / sextante / dataObjects / gvRasterLayerWrite.java @ 220

History | View | Annotate | Download (3.68 KB)

1
package org.gvsig.geoprocess.lib.sextante.dataObjects;
2

    
3
import java.awt.geom.Rectangle2D;
4

    
5
import es.unex.sextante.core.AnalysisExtent;
6
import es.unex.sextante.dataObjects.AbstractRasterLayer;
7
import es.unex.sextante.gui.core.SextanteGUI;
8
import es.unex.sextante.outputs.IOutputChannel;
9

    
10
import org.cresques.cts.IProjection;
11

    
12
/**
13
 * 
14
 * @author volaya, nacho brodin (nachobrodin@gmail.com)
15
 * 
16
 */
17
public class gvRasterLayerWrite
18
         extends
19
            AbstractRasterLayer {
20

    
21
   private String         m_sFilename;
22
   private IProjection    m_Projection;
23
   protected RasterDriver m_RasterDriver;
24

    
25

    
26
   public void create(final String sName,
27
                      final String sFilename,
28
                      final AnalysisExtent ae,
29
                      final int iDataType,
30
                      final int iNumBands,
31
                      final Object crs) {
32

    
33
      final RasterDriver rmd = new RasterDriver(ae, iDataType, iNumBands);
34
      rmd.setName(sName);
35
        rmd.setNoDataValue(SextanteGUI.getOutputFactory()
36
            .getDefaultNoDataValue());
37

    
38
      m_RasterDriver = rmd;
39
      m_sFilename = sFilename;
40
      m_Projection = (IProjection) crs;
41

    
42
   }
43

    
44

    
45
   public void create(final String sName,
46
                      final String sFilename,
47
                      final AnalysisExtent ge,
48
                      final int iDataType,
49
                      final Object crs) {
50

    
51
      create(sName, sFilename, ge, iDataType, 1, crs);
52

    
53
   }
54

    
55

    
56
   public int getDataType() {
57

    
58
      return m_RasterDriver.getRasterBuf().getDataType();
59

    
60
   }
61

    
62

    
63
   public void setCellValue(final int x,
64
                            final int y,
65
                            final int iBand,
66
                            final double dValue) {
67

    
68
      m_RasterDriver.setCellValue(x, y, iBand, dValue);
69

    
70
   }
71

    
72

    
73
   public void setNoDataValue(final double dNoDataValue) {
74

    
75
      m_RasterDriver.setNoDataValue(dNoDataValue);
76

    
77
   }
78

    
79

    
80
   @Override
81
   public void setNoData(final int x,
82
                         final int y) {
83

    
84
      m_RasterDriver.setNoData(x, y);
85

    
86
   }
87

    
88

    
89
   public double getNoDataValue() {
90

    
91
      return m_RasterDriver.getNoDataValue();
92

    
93
   }
94

    
95

    
96
   public double getCellValueInLayerCoords(final int x,
97
                                           final int y,
98
                                           final int band) {
99

    
100
      return m_RasterDriver.getCellValue(x, y, band);
101

    
102
   }
103

    
104

    
105
   public int getBandsCount() {
106

    
107
      return m_RasterDriver.getRasterBuf().getBandCount();
108

    
109
   }
110

    
111

    
112
   public String getName() {
113

    
114
      return m_RasterDriver.getName();
115

    
116
   }
117

    
118

    
119
   public void postProcess() {
120

    
121
      m_RasterDriver.export(m_sFilename, m_Projection);
122

    
123
   }
124

    
125

    
126
   public void open() {
127

    
128
   }
129

    
130

    
131
   public void close() {
132

    
133
      m_RasterDriver.free();
134

    
135
   }
136

    
137

    
138
   public Rectangle2D getFullExtent() {
139

    
140
      return m_RasterDriver.getGridExtent().getAsRectangle2D();
141

    
142
   }
143

    
144

    
145
   public AnalysisExtent getLayerGridExtent() {
146

    
147
      return m_RasterDriver.getGridExtent();
148

    
149
   }
150

    
151

    
152
   public double getLayerCellSize() {
153

    
154

    
155
      return m_RasterDriver.getGridExtent().getCellSize();
156

    
157

    
158
   }
159

    
160

    
161
   public String getFilename() {
162

    
163

    
164
      return m_sFilename;
165

    
166
   }
167

    
168

    
169
   public Object getCRS() {
170

    
171
      return m_Projection;
172

    
173
   }
174

    
175

    
176
   public void setName(final String name) {
177

    
178
      m_RasterDriver.setName(name);
179

    
180
   }
181

    
182

    
183
   public Object getBaseDataObject() {
184

    
185
      return m_RasterDriver;
186

    
187
   }
188

    
189

    
190
    public void free() {
191
        // TODO Auto-generated method stub
192

    
193
    }
194

    
195
    public IOutputChannel getOutputChannel() {
196
        // TODO Auto-generated method stub
197
        return null;
198
    }
199

    
200
}