Revision 13074 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/LayerFactory.java
LayerFactory.java | ||
---|---|---|
69 | 69 |
import com.iver.cit.gvsig.fmap.DriverNotLoadedExceptionType; |
70 | 70 |
import com.iver.cit.gvsig.fmap.LegendDriverExceptionType; |
71 | 71 |
import com.iver.cit.gvsig.fmap.ProgressListener; |
72 |
import com.iver.cit.gvsig.fmap.ViewPort; |
|
73 | 72 |
import com.iver.cit.gvsig.fmap.drivers.ConnectionFactory; |
74 | 73 |
import com.iver.cit.gvsig.fmap.drivers.DBException; |
75 | 74 |
import com.iver.cit.gvsig.fmap.drivers.DBLayerDefinition; |
76 | 75 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
77 | 76 |
import com.iver.cit.gvsig.fmap.drivers.IVectorialDatabaseDriver; |
78 | 77 |
import com.iver.cit.gvsig.fmap.drivers.IVectorialJDBCDriver; |
79 |
import com.iver.cit.gvsig.fmap.drivers.RasterDriver; |
|
80 | 78 |
import com.iver.cit.gvsig.fmap.drivers.VectorialDriver; |
81 | 79 |
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver; |
82 | 80 |
import com.iver.cit.gvsig.fmap.drivers.WithDefaultLegend; |
... | ... | |
133 | 131 |
|
134 | 132 |
if (d instanceof VectorialFileDriver) { |
135 | 133 |
return createLayer(layerName, (VectorialFileDriver) d, f, proj); |
136 |
} else if (d instanceof RasterDriver) { |
|
137 |
return createLayer(layerName, (RasterDriver) d, f, proj); |
|
138 | 134 |
} |
139 | 135 |
} catch (DriverLoadException e) { |
140 | 136 |
//hay un poco de lio sobre que excepciones se dejan subir |
... | ... | |
352 | 348 |
return layer; |
353 | 349 |
} |
354 | 350 |
|
355 |
/** |
|
356 |
* Crea una capa Raster a partir del nombre driver, fichero y proyecci?n. |
|
357 |
* |
|
358 |
* @param layerName |
|
359 |
* Nombre de la capa. |
|
360 |
* @param d |
|
361 |
* RasterDriver. |
|
362 |
* @param f |
|
363 |
* Fichero. |
|
364 |
* @param proj |
|
365 |
* Proyecci?n. |
|
366 |
* |
|
367 |
* @return Nueva capa de tipo raster. |
|
368 |
* @throws LoadLayerException |
|
369 |
* |
|
370 |
* @throws DriverIOException |
|
371 |
*/ |
|
372 |
public static FLyrRaster createLayer(String layerName, RasterDriver d, |
|
373 |
File f, IProjection proj) throws LoadLayerException { |
|
374 |
RasterAdapter adapter = new RasterFileAdapter(f); |
|
375 |
adapter.setDriver(d); |
|
376 |
FLyrRaster capa = new FLyrRaster(); |
|
377 |
capa.setName(layerName); |
|
378 |
|
|
379 |
// TODO Meter esto dentro de la comprobaci?n de si hay memoria |
|
380 |
if (false) { |
|
381 |
} else { |
|
382 |
capa.setSource(adapter); |
|
383 |
capa.setProjection(proj); |
|
384 |
capa.load(); |
|
385 |
} |
|
386 |
|
|
387 |
return capa; |
|
388 |
} |
|
389 |
|
|
390 |
/** |
|
391 |
* Crea una capa Raster a partir del nombre driver, fichero y proyecci?n y |
|
392 |
* coordenadas de georeferenciaci?n. Esta funci?n es para georeferenciar |
|
393 |
* capas raster. Para imagenes que no tienen georeferenciaci?n hay que |
|
394 |
* asignarle una temporal, normalmente a partir de la vista activa. |
|
395 |
* |
|
396 |
* @param layerName |
|
397 |
* Nombre de la capa. |
|
398 |
* @param d |
|
399 |
* RasterDriver. |
|
400 |
* @param f |
|
401 |
* Fichero. |
|
402 |
* @param proj |
|
403 |
* Proyecci?n. |
|
404 |
* @param extent |
|
405 |
* Extent de la vista activa |
|
406 |
* |
|
407 |
* @return Nueva capa de tipo raster. |
|
408 |
* @throws LoadLayerException |
|
409 |
* |
|
410 |
* @throws DriverIOException |
|
411 |
*/ |
|
412 |
public static FLyrRaster createLayer(String layerName, RasterDriver d, |
|
413 |
File f, IProjection proj, ViewPort vp) throws LoadLayerException { |
|
414 |
RasterAdapter adapter = new RasterFileAdapter(f); |
|
415 |
adapter.setDriver(d); |
|
416 |
|
|
417 |
FLyrRaster capa = new FLyrRaster(); |
|
418 |
capa.setName(layerName); |
|
419 |
|
|
420 |
// TODO Meter esto dentro de la comprobaci?n de si hay memoria |
|
421 |
if (false) { |
|
422 |
} else { |
|
423 |
capa.setSource(adapter); |
|
424 |
capa.setProjection(proj); |
|
425 |
// capa.setTempExtent(vp); |
|
426 |
capa.load(); |
|
427 |
} |
|
428 |
|
|
429 |
return capa; |
|
430 |
} |
|
431 |
|
|
432 | 351 |
public static FLayer createArcSDELayer(String layerName, |
433 | 352 |
IVectorialDatabaseDriver driver, IProjection proj) { |
434 | 353 |
// throw new UnsupportedOperationException(); |
... | ... | |
668 | 587 |
} |
669 | 588 |
|
670 | 589 |
/** |
671 |
* Crea una FLyrComplexRaster que ataca al driver que se pasa como |
|
672 |
* par?metro. |
|
673 |
* |
|
674 |
* @param driver |
|
675 |
* @param f |
|
676 |
* @param proj |
|
677 |
* |
|
678 |
* @throws IllegalArgumentException |
|
679 |
* Si se pasa un driver que no implementa |
|
680 |
* GeorreferencedRasterDriver o NotGeorreferencedRasterDriver |
|
681 |
*/ |
|
682 |
public static void createLayer(RasterDriver driver, File f, IProjection proj) |
|
683 |
throws IllegalArgumentException { |
|
684 |
} |
|
685 |
|
|
686 |
/** |
|
687 | 590 |
* Devuelve el DriverManager. |
688 | 591 |
* |
689 | 592 |
* @return DriverManager. |
Also available in: Unified diff