Revision: 5261
http://sourceforge.net/p/jump-pilot/code/5261
Author: michaudm
Date: 2016-12-16 07:43:01 +0000 (Fri, 16 Dec 2016)
Log Message:
-----------
Fix reference to ErrorHandlerV2 and prepare integration of prj writer
(postponed to after 1.10 release, waiting for cts 1.5.0)
Modified Paths:
--------------
core/trunk/src/com/vividsolutions/jump/io/ShapefileWriter.java
core/trunk/src/org/openjump/core/ccordsys/utils/SRSInfo.java
core/trunk/src/org/openjump/core/ui/io/file/DataSourceFileLayerSaver.java
core/trunk/src/org/openjump/core/ui/plugin/file/open/OpenFileWizard.java
Modified: core/trunk/src/com/vividsolutions/jump/io/ShapefileWriter.java
===================================================================
--- core/trunk/src/com/vividsolutions/jump/io/ShapefileWriter.java
2016-12-15 11:27:04 UTC (rev 5260)
+++ core/trunk/src/com/vividsolutions/jump/io/ShapefileWriter.java
2016-12-16 07:43:01 UTC (rev 5261)
@@ -223,13 +223,9 @@
**/
public class ShapefileWriter implements JUMPWriter {
- //public static final String FILE_PROPERTY_KEY = "File";
- //public static final String DEFAULT_VALUE_PROPERTY_KEY =
"DefaultValue";
private static final String SHAPE_TYPE_PROPERTY_KEY = "ShapeType";
private static boolean truncate = false;
private static long lastTimeTruncate = new Date(0).getTime();
-
- private static CGAlgorithms CG_ALGO = new CGAlgorithms();
/** Creates new ShapefileWriter */
public ShapefileWriter() {
@@ -294,6 +290,11 @@
String charsetName = dp.getProperty(DataSource.CHARSET_KEY);
if (charsetName == null) charsetName =
Charset.defaultCharset().name();
writeDbf(featureCollection, dbffname, Charset.forName(charsetName));
+ // Prepare prj file writing for post 1.10 version
+ //String registry = dp.getProperty("SrsRegistry", "EPSG");
+ //String code = dp.getProperty("SrsCode", "0");
+ //writePrj(path + fname_withoutextention + ".prj", registry, code);
+
PrintWriter pw = null;
try {
cpgfname = path + fname_withoutextention + ".cpg";
@@ -358,7 +359,7 @@
/**
* Returns: <br>
* 2 for 2d (default) <br>
- * 4 for 3d - one of the oordinates has a non-NaN z value <br>
+ * 4 for 3d - one of the coordinates has a non-NaN z value <br>
* (3 is for x,y,m but thats not supported yet) <br>
* @param g geometry to test - looks at 1st coordinate
*/
@@ -672,6 +673,25 @@
dbf.close();
}
+ // Prepare prj writing for post-1.10 version
+ private void writePrj(String fname, String registry, String code)
+ throws Exception {
+ System.out.println("writePrj");
+ System.out.println(registry);
+ System.out.println(code);
+ if (code.equals("0")) return;
+ if (!code.matches("\\d+")) return;
+ System.out.println("test org.cts.CRSFactory");
+ //if (Class.forName("org.cts.CRSFactory") != null) {
+ // org.cts.CRSFactory crsFactory = new org.cts.CRSFactory();
+ // org.cts.registry.RegistryManager registryManager =
crsFactory.getRegistryManager();
+ // if (registry.equals("EPSG")) registryManager.addRegistry(new
org.cts.registry.EPSGRegistry());
+ // if (registry.equals("ESRI")) registryManager.addRegistry(new
org.cts.registry.ESRIRegistry());
+ // org.cts.crs.CoordinateReferenceSystem crs =
crsFactory.getCRS(registry + ":" + code);
+ // System.out.println(crs.toWKT());
+ //}
+ }
+
private String removeCount(String s, int count) {
return s.substring(0, s.length()-Integer.toString(count).length());
}
Modified: core/trunk/src/org/openjump/core/ccordsys/utils/SRSInfo.java
===================================================================
--- core/trunk/src/org/openjump/core/ccordsys/utils/SRSInfo.java
2016-12-15 11:27:04 UTC (rev 5260)
+++ core/trunk/src/org/openjump/core/ccordsys/utils/SRSInfo.java
2016-12-16 07:43:01 UTC (rev 5261)
@@ -10,7 +10,7 @@
/**
* Small container for SRS information.
- * This class does not contains all information to perform coordinate
transformation,
+ * This class does not contain all information to perform coordinate
transformation,
* but enough to return metadata about SRS code or map unit
*/
public class SRSInfo {
Modified:
core/trunk/src/org/openjump/core/ui/io/file/DataSourceFileLayerSaver.java
===================================================================
--- core/trunk/src/org/openjump/core/ui/io/file/DataSourceFileLayerSaver.java
2016-12-15 11:27:04 UTC (rev 5260)
+++ core/trunk/src/org/openjump/core/ui/io/file/DataSourceFileLayerSaver.java
2016-12-16 07:43:01 UTC (rev 5261)
@@ -6,6 +6,7 @@
import java.util.List;
import java.util.Map;
+import org.openjump.core.ccordsys.utils.SRSInfo;
import org.openjump.util.UriUtil;
import com.vividsolutions.jump.feature.FeatureCollection;
@@ -50,6 +51,11 @@
options.put(DataSource.URI_KEY, uri);
options.put(DataSource.FILE_KEY, UriUtil.getFilePath(uri));
dataSource.setProperties(options);
+ SRSInfo srsInfo =
org.openjump.core.ccordsys.utils.ProjUtils.getSRSInfoFromLayerSource(layer);
+ if (srsInfo != null) {
+ dataSource.getProperties().put("SrsRegistry",
srsInfo.getRegistry().name());
+ dataSource.getProperties().put("SrsCode", srsInfo.getCode());
+ }
Connection connection = dataSource.getConnection();
try {
Modified:
core/trunk/src/org/openjump/core/ui/plugin/file/open/OpenFileWizard.java
===================================================================
--- core/trunk/src/org/openjump/core/ui/plugin/file/open/OpenFileWizard.java
2016-12-15 11:27:04 UTC (rev 5260)
+++ core/trunk/src/org/openjump/core/ui/plugin/file/open/OpenFileWizard.java
2016-12-16 07:43:01 UTC (rev 5261)
@@ -18,7 +18,6 @@
import com.vividsolutions.jump.workbench.WorkbenchContext;
import com.vividsolutions.jump.workbench.model.Layerable;
import com.vividsolutions.jump.workbench.registry.Registry;
-import com.vividsolutions.jump.workbench.ui.ErrorHandlerV2;
import com.vividsolutions.jump.workbench.ui.wizard.WizardDialog;
public class OpenFileWizard extends AbstractWizardGroup {
@@ -163,8 +162,7 @@
}
}
} catch (final Exception e) {
- ((ErrorHandlerV2) workbenchContext.getErrorHandler())
- .handleThrowable(e, dialog);
+ (workbenchContext.getErrorHandler()).handleThrowable(e);
}
}
} finally {
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Jump-pilot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel