Revision 517 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/FLyrRasterIRasterLayer.java
FLyrRasterIRasterLayer.java | ||
---|---|---|
63 | 63 |
private int xTranslate = 0; |
64 | 64 |
private int yTranslate = 0; |
65 | 65 |
private AnalysisExtent layerExtent = null; |
66 |
private String lyrName = null; |
|
67 | 66 |
private String fName = null; |
68 | 67 |
|
69 | 68 |
public FLyrRasterIRasterLayer() { |
... | ... | |
73 | 72 |
public FLyrRasterIRasterLayer(String fName) { |
74 | 73 |
this.fName = fName; |
75 | 74 |
} |
76 |
|
|
77 |
public String getFileName() { |
|
78 |
return fName; |
|
79 |
} |
|
80 | 75 |
|
81 | 76 |
public void create(final FLyrRaster lyr) { |
82 | 77 |
this.lyr = lyr; |
... | ... | |
110 | 105 |
} |
111 | 106 |
|
112 | 107 |
public double getCellValueInLayerCoords(final int x, final int y, |
113 |
final int iBand) {
|
|
108 |
final int iBand) {
|
|
114 | 109 |
int newx = x - xTranslate; |
115 | 110 |
int newy = y - yTranslate; |
116 | 111 |
if(m_Buffer == null) |
117 | 112 |
open(); |
118 |
if (m_Buffer.isInside(newx, newy)) { |
|
119 |
switch (getDataStore().getDataType()[0]) { |
|
120 |
case Buffer.TYPE_BYTE: |
|
121 |
return (m_Buffer.getElemByte(newy, newx, iBand) & 0xff); |
|
122 |
case Buffer.TYPE_SHORT: |
|
123 |
return m_Buffer.getElemShort(newy, newx, iBand); |
|
124 |
case Buffer.TYPE_INT: |
|
125 |
return m_Buffer.getElemInt(newy, newx, iBand); |
|
126 |
case Buffer.TYPE_FLOAT: |
|
127 |
return m_Buffer.getElemFloat(newy, newx, iBand); |
|
128 |
case Buffer.TYPE_DOUBLE: |
|
129 |
default: |
|
130 |
return m_Buffer.getElemDouble(newy, newx, iBand); |
|
131 |
} |
|
132 |
} else { |
|
133 |
return getNoDataValue(); |
|
134 |
} |
|
135 |
|
|
113 |
if (m_Buffer.isInside(newx, newy)) { |
|
114 |
switch (getDataStore().getDataType()[0]) { |
|
115 |
case Buffer.TYPE_BYTE: |
|
116 |
return (m_Buffer.getElemByte(newy, newx, iBand) & 0xff); |
|
117 |
case Buffer.TYPE_SHORT: |
|
118 |
return m_Buffer.getElemShort(newy, newx, iBand); |
|
119 |
case Buffer.TYPE_INT: |
|
120 |
return m_Buffer.getElemInt(newy, newx, iBand); |
|
121 |
case Buffer.TYPE_FLOAT: |
|
122 |
return m_Buffer.getElemFloat(newy, newx, iBand); |
|
123 |
case Buffer.TYPE_DOUBLE: |
|
124 |
default: |
|
125 |
return m_Buffer.getElemDouble(newy, newx, iBand); |
|
126 |
} |
|
127 |
} else { |
|
128 |
return getNoDataValue(); |
|
129 |
} |
|
136 | 130 |
} |
137 | 131 |
|
138 | 132 |
public int getBandsCount() { |
... | ... | |
140 | 134 |
} |
141 | 135 |
|
142 | 136 |
public String getName() { |
143 |
String uri = getDataStore().getName(); |
|
144 |
if(uri.contains(File.separator)) { |
|
145 |
int index = uri.lastIndexOf(File.separator); |
|
146 |
return uri.substring(index + 1); |
|
147 |
} |
|
148 |
return uri; |
|
137 |
if(lyr != null) { |
|
138 |
return lyr.getName(); |
|
139 |
} |
|
140 |
if(getDataStore() != null) { |
|
141 |
String uri = getDataStore().getName(); |
|
142 |
if(uri.contains(File.separator)) { |
|
143 |
int index = uri.lastIndexOf(File.separator); |
|
144 |
return uri.substring(index + 1); |
|
145 |
} |
|
146 |
return uri; |
|
147 |
} |
|
148 |
return null; |
|
149 | 149 |
} |
150 | 150 |
|
151 | 151 |
public void postProcess() { |
... | ... | |
233 | 233 |
} |
234 | 234 |
|
235 | 235 |
public void setName(final String name) { |
236 |
this.lyrName = name;
|
|
236 |
lyr.setName(name);
|
|
237 | 237 |
} |
238 | 238 |
|
239 | 239 |
public void free() { |
... | ... | |
287 | 287 |
public IOutputChannel getOutputChannel() { |
288 | 288 |
return new IOutputChannel() { |
289 | 289 |
public String getAsCommandLineParameter() { |
290 |
return lyrName;
|
|
290 |
return lyr.getName();
|
|
291 | 291 |
} |
292 | 292 |
}; |
293 | 293 |
} |
Also available in: Unified diff