Revision 2924 trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/fmap/tools/Behavior/GeoRedimBehavior.java
GeoRedimBehavior.java | ||
---|---|---|
120 | 120 |
private Rectangle2D rectInit = null; |
121 | 121 |
|
122 | 122 |
private FLyrRaster lyrRaster = null; |
123 |
private String pathToFile = null; |
|
124 |
|
|
123 |
|
|
125 | 124 |
private GeoreferencingDialog parent = null; |
126 | 125 |
|
127 | 126 |
/** |
... | ... | |
219 | 218 |
vp.toMapPoint((int)tmpUl.getX(), (int)tmpUl.getY()).getY(), |
220 | 219 |
vp.toMapPoint((int)tmpLr.getX(), (int)tmpLr.getY()).getX(), |
221 | 220 |
vp.toMapPoint((int)tmpLr.getX(), (int)tmpLr.getY()).getY()); |
222 |
|
|
223 |
if(this.pathToFile != null && this.lyrRaster != null){ |
|
224 |
File fich = new File(this.pathToFile); |
|
225 |
RasterAdapter adapter = new RasterFileAdapter(fich); |
|
226 |
try{ |
|
227 |
adapter.setDriver(LayerFactory.getDM().getDriver("gvSIG Image Driver")); |
|
228 |
}catch(DriverLoadException exc){ |
|
229 |
NotificationManager.addError("No se pudo acceder a los drivers", exc); |
|
230 |
} |
|
231 |
FLyrRaster capa = new FLyrRaster(); |
|
232 |
if (capa != null) { |
|
233 |
capa.setName(lyrRaster.getName()); |
|
234 |
capa.setSource(adapter); |
|
235 |
capa.setProjection(lyrRaster.getProjection()); |
|
236 |
capa.setTempExtent(ext); |
|
237 |
capa.setExtentFlag(GeoRasterFile.ASSIGNED_EXTENT); |
|
238 |
try { |
|
239 |
capa.load(); |
|
240 |
} catch (DriverIOException exc) { |
|
241 |
|
|
242 |
} |
|
243 |
capa.setVisible(true); |
|
244 |
} |
|
245 |
|
|
246 |
getMapControl().getMapContext().getLayers().removeLayer(lyrRaster.getName()); |
|
247 |
lyrRaster = null; |
|
248 |
getMapControl().getMapContext().getLayers().addLayer(capa); |
|
249 |
this.setLyrRaster(capa); |
|
250 |
this.parent.getGeoMoveBehavior().setLyrRaster(capa); |
|
251 |
getMapControl().repaint(); |
|
221 |
if(this.lyrRaster != null){ |
|
222 |
((FLyrRaster)getMapControl().getMapContext().getLayers().getLayer(lyrRaster.getName())).setExtent(ext); |
|
223 |
getMapControl().getMapContext().invalidate(); |
|
252 | 224 |
tmpUl = null; |
253 | 225 |
tmpLr = null; |
254 | 226 |
} |
255 | 227 |
} |
256 |
|
|
257 |
|
|
258 | 228 |
} |
259 | 229 |
|
260 | 230 |
/** |
... | ... | |
439 | 409 |
this.lyrRaster = lyrRaster; |
440 | 410 |
} |
441 | 411 |
|
442 |
/** |
|
443 |
* @return Returns the pathToFile. |
|
444 |
*/ |
|
445 |
public String getPathToFile() { |
|
446 |
return pathToFile; |
|
447 |
} |
|
448 |
|
|
449 |
/** |
|
450 |
* @param pathToFile The pathToFile to set. |
|
451 |
*/ |
|
452 |
public void setPathToFile(String pathToFile) { |
|
453 |
this.pathToFile = pathToFile; |
|
454 |
} |
|
455 | 412 |
} |
Also available in: Unified diff