Revision 42567 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/src/main/java/org/gvsig/fmap/dal/store/shp/SHPStoreProvider.java
SHPStoreProvider.java | ||
---|---|---|
28 | 28 |
|
29 | 29 |
import org.apache.commons.io.FileUtils; |
30 | 30 |
import org.apache.commons.io.FilenameUtils; |
31 |
import org.cresques.cts.ICRSFactory; |
|
31 | 32 |
import org.cresques.cts.IProjection; |
32 | 33 |
import org.slf4j.Logger; |
33 | 34 |
import org.slf4j.LoggerFactory; |
... | ... | |
62 | 63 |
import org.gvsig.fmap.dal.store.dbf.DBFStoreParameters; |
63 | 64 |
import org.gvsig.fmap.dal.store.dbf.DBFStoreProvider; |
64 | 65 |
import org.gvsig.fmap.dal.store.shp.utils.ISHPFile; |
66 |
import org.gvsig.fmap.dal.store.shp.utils.SHP; |
|
65 | 67 |
import org.gvsig.fmap.dal.store.shp.utils.SHPFile2; |
66 | 68 |
import org.gvsig.fmap.geom.Geometry; |
67 | 69 |
import org.gvsig.fmap.geom.GeometryLocator; |
... | ... | |
506 | 508 |
close(); |
507 | 509 |
|
508 | 510 |
|
509 |
//FIXME: Descomentarizar este c?digo cuando se consiga exportar la proyecci?n al formato de WKT_ESRI. |
|
510 |
// File tmpPrjFile = SHP.getPrjFile(tmpParams.getSHPFile()); |
|
511 |
// try { |
|
512 |
// FileUtils.writeStringToFile(tmpPrjFile, tmpParams.getCRS().export(ICRSFactory.FORMAT_WKT_ESRI)); |
|
513 |
// } catch(Exception e) { |
|
514 |
// logger.info("Can't write prj file '"+tmpPrjFile.getAbsolutePath()+"'."); |
|
515 |
// } |
|
511 |
File tmpPrjFile = SHP.getPrjFile(tmpParams.getSHPFile()); |
|
512 |
try { |
|
513 |
FileUtils.writeStringToFile(tmpPrjFile, tmpParams.getCRS().export(ICRSFactory.FORMAT_WKT_ESRI)); |
|
514 |
} catch(Exception e) { |
|
515 |
logger.info("Can't write prj file '"+tmpPrjFile.getAbsolutePath()+"'."); |
|
516 |
} |
|
516 | 517 |
|
517 | 518 |
if (!shpParams.getDBFFile().delete()) { |
518 | 519 |
logger.debug("Can't delete dbf file '"+shpParams.getDBFFile()+"'."); |
... | ... | |
526 | 527 |
logger.debug("Can't delete dbf file '"+shpParams.getSHXFile()+"'."); |
527 | 528 |
throw new IOException("Can't delete shx '"+FilenameUtils.getBaseName(shpParams.getSHXFileName())+"' file to replace with the new shx.\nThe new shx is in temporary file '"+str_base+"'"); |
528 | 529 |
} |
529 |
//FIXME: Descomentarizar este c?digo cuando se consiga exportar la proyecci?n al formato de WKT_ESRI. |
|
530 |
// if (SHP.getPrjFile(shpParams.getSHPFile()).exists()) { |
|
531 |
// if (!SHP.getPrjFile(shpParams.getSHPFile()).delete()) { |
|
532 |
// logger.debug("Can't delete prj file '" + SHP.getPrjFile(shpParams.getSHPFile()) + "'."); |
|
533 |
// throw new IOException("Can't delete shx '" |
|
534 |
// + FilenameUtils.getBaseName(SHP.getPrjFile(shpParams.getSHPFile()).getPath()) |
|
535 |
// + "' file to replace with the new shx.\nThe new shx is in temporary file '" |
|
536 |
// + str_base + "'"); |
|
537 |
// } |
|
538 |
// } |
|
530 |
|
|
531 |
File prjFile = SHP.getPrjFile(shpParams.getSHPFile()); |
|
532 |
if (prjFile.exists()) { |
|
533 |
if (!prjFile.delete()) { |
|
534 |
logger.debug("Can't delete prj file '" + prjFile + "'."); |
|
535 |
throw new IOException("Can't delete shx '" |
|
536 |
+ FilenameUtils.getBaseName(prjFile.getPath()) |
|
537 |
+ "' file to replace with the new shx.\nThe new shx is in temporary file '" |
|
538 |
+ str_base + "'"); |
|
539 |
} |
|
540 |
} |
|
539 | 541 |
FileUtils.moveFile( |
540 | 542 |
tmpParams.getDBFFile(), |
541 | 543 |
shpParams.getDBFFile()); |
... | ... | |
545 | 547 |
FileUtils.moveFile( |
546 | 548 |
tmpParams.getSHXFile(), |
547 | 549 |
shpParams.getSHXFile()); |
548 |
//FIXME: Descomentarizar este c?digo cuando se consiga exportar la proyecci?n al formato de WKT_ESRI. |
|
549 |
// FileUtils.moveFile( |
|
550 |
// tmpPrjFile, |
|
551 |
// SHP.getPrjFile(shpParams.getSHPFile())); |
|
552 | 550 |
|
551 |
FileUtils.moveFile( |
|
552 |
tmpPrjFile, |
|
553 |
SHP.getPrjFile(shpParams.getSHPFile())); |
|
554 |
|
|
553 | 555 |
resourcesNotifyChanges(); |
554 | 556 |
initFeatureType(); |
555 | 557 |
return null; |
Also available in: Unified diff