Revision 4183 org.gvsig.raster/trunk/org.gvsig.raster/org.gvsig.raster.fmap/src/main/java/org/gvsig/raster/fmap/layers/DefaultFLyrRaster.java
DefaultFLyrRaster.java | ||
---|---|---|
918 | 918 |
* |
919 | 919 |
* @return True si ha sido correcto el borrado del Listener. |
920 | 920 |
*/ |
921 |
public boolean removeLayerListener(LayerListener o) {
|
|
922 |
if (this.isRemoveRasterFlag()) {
|
|
923 |
try {
|
|
924 |
enableClosed();
|
|
925 |
} catch (NotAvailableStateException e1) {
|
|
926 |
// No se ha podido cambiar el estado de la capa a cerrado
|
|
927 |
}
|
|
928 |
}
|
|
921 |
public boolean removeLayerListener(LayerListener o) {
|
|
922 |
if (this.isRemoveRasterFlag()) {
|
|
923 |
try {
|
|
924 |
enableClosed();
|
|
925 |
} catch (NotAvailableStateException e1) {
|
|
926 |
// No se ha podido cambiar el estado de la capa a cerrado
|
|
927 |
}
|
|
928 |
}
|
|
929 | 929 |
|
930 |
// Salva a RMF
|
|
931 |
if (getDataStore() != null)
|
|
932 |
// Guardamos la GeoReferenciacion de cada dataset
|
|
933 |
try {
|
|
934 |
getDataStore().saveGeoreferencingToRmf();
|
|
935 |
} catch (Exception e) {
|
|
936 |
logger.info("error_salvando_rmf", e);
|
|
937 |
}
|
|
930 |
// Salva a RMF
|
|
931 |
if (getDataStore() != null)
|
|
932 |
// Guardamos la GeoReferenciacion de cada dataset
|
|
933 |
try {
|
|
934 |
getDataStore().saveGeoreferencingToRmf();
|
|
935 |
} catch (Exception e) {
|
|
936 |
logger.info("error_salvando_rmf", e);
|
|
937 |
}
|
|
938 | 938 |
|
939 |
if (this.isRemoveRasterFlag()) {
|
|
940 |
if (getDataStore() != null) {
|
|
941 |
URI[] uris = getUris().clone();
|
|
939 |
if (this.isRemoveRasterFlag()) {
|
|
940 |
if (getDataStore() != null) {
|
|
941 |
URI[] uris = getUris().clone();
|
|
942 | 942 |
|
943 |
try {
|
|
944 |
getDataStore().close();
|
|
945 |
} catch (CloseException e) {
|
|
946 |
}
|
|
943 |
try {
|
|
944 |
getDataStore().close();
|
|
945 |
} catch (CloseException e) {
|
|
946 |
}
|
|
947 | 947 |
|
948 |
dataStore = null;
|
|
949 |
if(render != null)
|
|
950 |
render.dispose();
|
|
951 |
render = null;
|
|
952 |
// System.gc();
|
|
953 |
this.setRemoveRasterFlag(true);
|
|
948 |
dataStore = null;
|
|
949 |
if (render != null)
|
|
950 |
render.dispose();
|
|
951 |
render = null;
|
|
952 |
// System.gc();
|
|
953 |
this.setRemoveRasterFlag(true);
|
|
954 | 954 |
|
955 |
for (int i = 0; i < uris.length; i++) { |
|
955 |
for (int i = 0; i < uris.length; i++) { |
|
956 |
if ("FILE".equalsIgnoreCase(uris[i].getScheme())) { |
|
956 | 957 |
File file = new File(uris[i]); |
957 |
File dirTemp = fileUtil.getTemporalFile();
|
|
958 |
if(!file.exists())
|
|
959 |
continue;
|
|
960 |
if (dirTemp.compareTo(file.getParentFile()) == 0) {
|
|
961 |
file.delete();
|
|
958 |
File dirTemp = fileUtil.getTemporalFile();
|
|
959 |
if (!file.exists())
|
|
960 |
continue;
|
|
961 |
if (dirTemp.compareTo(file.getParentFile()) == 0) {
|
|
962 |
file.delete();
|
|
962 | 963 |
|
963 |
// Borramos todos los ficheros que puedan tener relacion con el fichero actual |
|
964 |
String basefile = file.getName(); |
|
965 |
File basepath = file.getParentFile(); |
|
966 |
int last = basefile.lastIndexOf("."); |
|
967 |
if (last != -1) |
|
968 |
basefile = basefile.substring(0, last + 1); |
|
969 |
File[] list = basepath.listFiles(); |
|
970 |
for (int j = 0; j < list.length; j++) |
|
971 |
if (list[j].getName().startsWith(basefile)) |
|
972 |
list[j].delete(); |
|
973 |
} |
|
974 |
} |
|
975 |
} |
|
976 |
} |
|
977 |
updateDrawVersion(); |
|
978 |
return super.layerListeners.remove(o); |
|
979 |
} |
|
964 |
// Borramos todos los ficheros que puedan tener |
|
965 |
// relacion con el fichero actual |
|
966 |
String basefile = file.getName(); |
|
967 |
File basepath = file.getParentFile(); |
|
968 |
int last = basefile.lastIndexOf("."); |
|
969 |
if (last != -1) |
|
970 |
basefile = basefile.substring(0, last + 1); |
|
971 |
File[] list = basepath.listFiles(); |
|
972 |
for (int j = 0; j < list.length; j++) |
|
973 |
if (list[j].getName().startsWith(basefile)) |
|
974 |
list[j].delete(); |
|
975 |
} |
|
976 |
} |
|
977 |
} |
|
978 |
} |
|
979 |
} |
|
980 |
updateDrawVersion(); |
|
981 |
return super.layerListeners.remove(o); |
|
982 |
} |
|
980 | 983 |
|
981 | 984 |
public boolean isRemoveRasterFlag() { |
982 | 985 |
return removeRasterFlag; |
Also available in: Unified diff