Revision 21884
branches/Mobile_Compatible_Hito_1/TestProjection/src/META-INF/services/projection.properties | ||
---|---|---|
1 |
Dummy=org.gvsig.projection.dummy.DummyFactory |
branches/Mobile_Compatible_Hito_1/TestProjection/src/org/gvsig/mobile/test/projection/TestProjection.java | ||
---|---|---|
1 |
package org.gvsig.mobile.test.projection; |
|
2 |
|
|
3 |
|
|
4 |
import java.awt.Color; |
|
5 |
|
|
6 |
import org.gvsig.fmap.geom.Geometry; |
|
7 |
import org.gvsig.fmap.geom.GeometryFactory; |
|
8 |
import org.gvsig.fmap.geom.GeometryManager; |
|
9 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
|
10 |
import org.gvsig.fmap.geom.primitive.Point; |
|
11 |
import org.gvsig.projection.cts.CRSFactory; |
|
12 |
import org.gvsig.projection.cts.ICoordTrans; |
|
13 |
import org.gvsig.projection.cts.IDatum; |
|
14 |
import org.gvsig.projection.cts.IProjection; |
|
15 |
import org.gvsig.projection.dummy.DummyFactory; |
|
16 |
import org.gvsig.projection.register.ProjectionRegister; |
|
17 |
import org.slf4j.Logger; |
|
18 |
import org.slf4j.LoggerFactory; |
|
19 |
|
|
20 |
|
|
21 |
public class TestProjection{ |
|
22 |
private static GeometryManager manager; |
|
23 |
private static GeometryFactory factory; |
|
24 |
private static Logger logger = LoggerFactory.getLogger("org.gvsig"); |
|
25 |
|
|
26 |
public static void main(String[] args){ |
|
27 |
|
|
28 |
|
|
29 |
// Specific Registration. |
|
30 |
//ProjectionRegister.setFactory(new JCRSFactory()); |
|
31 |
// Specific Dummy Registration. |
|
32 |
ProjectionRegister.setFactory(new DummyFactory()); |
|
33 |
// Return any projection factory manager registered. |
|
34 |
CRSFactory projectionFactory = ProjectionRegister.getProjectionFactory(); |
|
35 |
manager = GeometryManager.getInstance(); |
|
36 |
factory = manager.getGeometryFactory(); |
|
37 |
|
|
38 |
//Building the Points for a curve... |
|
39 |
Point point1 = (Point) factory.createPoint2D(0,1); |
|
40 |
Point point2 = (Point) factory.createPoint2D(1,2); |
|
41 |
Point point3 = (Point) factory.createPoint2D(3,9); |
|
42 |
GeneralPathX shape = new GeneralPathX(); |
|
43 |
double[] pointCoords = {0,1,1,2,3,9}; |
|
44 |
shape.setPointCoords(pointCoords); |
|
45 |
Geometry line = factory.createPolyline2D(shape); |
|
46 |
//java.awt.geom.Point2D p1 = new java.awt.geom.Point2D.Double(1,2); |
|
47 |
//java.awt.geom.Point2D p2 = new java.awt.geom.Point2D.Double(2,1); |
|
48 |
//java.awt.geom.Point2D p3 = new java.awt.geom.Point2D.Double(3,3); |
|
49 |
|
|
50 |
//Build a curve to get the operation invoked with the registered operation. |
|
51 |
//Geometry curve = (Curve) factory.createArc(p1, p2, p3); |
|
52 |
|
|
53 |
//First Projection |
|
54 |
IProjection proj = projectionFactory.getProjection("EPSG:4326"); |
|
55 |
logger.debug("GETTING NEW PROJECTION: "+ proj.getFullCode()); |
|
56 |
|
|
57 |
// Second Projection |
|
58 |
IProjection proj_dest = projectionFactory.getProjection("EPSG:4258"); |
|
59 |
logger.debug("GETTING NEW PROJECTION: "+ proj_dest.getFullCode()); |
|
60 |
|
|
61 |
// Transformation |
|
62 |
ICoordTrans coordTrans = proj.getCT(proj_dest); |
|
63 |
logger.debug(coordTrans.getPOrig().getAbrev()+ " TO " + coordTrans.getPDest().getAbrev()); |
|
64 |
IDatum datum = proj.getDatum(); |
|
65 |
Color colorGrid = proj.getGridColor(); |
|
66 |
|
|
67 |
//p2 = proj.toGeo(p2); |
|
68 |
//p1 = proj.fromGeo(p2, p1); |
|
69 |
line.reProject(coordTrans); |
|
70 |
} |
|
71 |
|
|
72 |
// public static class Factory{ |
|
73 |
// private static CRSFactory projection = init(); |
|
74 |
// |
|
75 |
// public static void Factory(){ |
|
76 |
// } |
|
77 |
// |
|
78 |
// public static CRSFactory init(){ |
|
79 |
// projection = ProjectionRegister.getProjectionFactory("Dummy"); |
|
80 |
// ProjectionRegister(null); |
|
81 |
// System.out.println("NEW PROJECTION FACTORY CREATED: "+ projection.getName()+"\n"+projection.getDescription()); |
|
82 |
// return projection; |
|
83 |
// } |
|
84 |
// public static void setPropertyFile(String file){ |
|
85 |
// ProjectionRegister.setPropertiesFile(file); |
|
86 |
// } |
|
87 |
// |
|
88 |
// public static IProjection getCRS(String proj){ |
|
89 |
// System.out.println("DOWNLOADING PROJECTION... "); |
|
90 |
// return projection.getProjection(proj); |
|
91 |
// } |
|
92 |
// } |
|
93 |
} |
branches/Mobile_Compatible_Hito_1/TestProjection/src/log4j.properties | ||
---|---|---|
1 |
# Set root logger level to DEBUG and its only appender to A1. |
|
2 |
log4j.rootLogger=DEBUG, A1 |
|
3 |
|
|
4 |
# A1 is set to be a ConsoleAppender. |
|
5 |
log4j.appender.A1=org.apache.log4j.ConsoleAppender |
|
6 |
|
|
7 |
# A1 uses PatternLayout. |
|
8 |
log4j.appender.A1.layout=org.apache.log4j.PatternLayout |
|
9 |
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c{1} %x - %m%n |
branches/Mobile_Compatible_Hito_1/TestProjection/.settings/org.eclipse.jdt.core.prefs | ||
---|---|---|
1 |
#Mon Jun 23 12:23:16 CEST 2008 |
|
2 |
eclipse.preferences.version=1 |
|
3 |
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled |
|
4 |
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 |
|
5 |
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve |
|
6 |
org.eclipse.jdt.core.compiler.compliance=1.4 |
|
7 |
org.eclipse.jdt.core.compiler.debug.lineNumber=generate |
|
8 |
org.eclipse.jdt.core.compiler.debug.localVariable=generate |
|
9 |
org.eclipse.jdt.core.compiler.debug.sourceFile=generate |
|
10 |
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning |
|
11 |
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning |
|
12 |
org.eclipse.jdt.core.compiler.source=1.3 |
branches/Mobile_Compatible_Hito_1/TestProjection/build.xml | ||
---|---|---|
1 |
<project name="TestProjection" default="build-desktop" basedir=".."> |
|
2 |
<description> |
|
3 |
Projection Test |
|
4 |
</description> |
|
5 |
<!-- set global properties for this build --> |
|
6 |
<property name="srcdir" location="TestProjection" /> |
|
7 |
<property name="jarsdir" value="${eclipseClasspath}"/> |
|
8 |
<target name="build-desktop"> |
|
9 |
<depend srcdir="${srcdir}/src" destdir="${srcdir}/bin"></depend> |
|
10 |
<javac srcdir="${srcdir}/src" destdir="${srcdir}/bin" |
|
11 |
classpath="${jarsdir}"> |
|
12 |
</javac> |
|
13 |
<mkdir dir="${srcdir}/dist"/> |
|
14 |
<jar destfile="${srcdir}/dist/TestProjection.jar" basedir="${srcdir}/bin"></jar> |
|
15 |
<mkdir dir="${srcdir}/class"/> |
|
16 |
<unjar dest="${srcdir}/class"> |
|
17 |
<fileset dir="${srcdir}/lib"> |
|
18 |
<include name="*.jar"/> |
|
19 |
</fileset> |
|
20 |
</unjar> |
|
21 |
<zip destfile="${srcdir}/dist/AllJarTest.jar" basedir="${srcdir}/class"/> |
|
22 |
<delete> |
|
23 |
<fileset dir="${srcdir}/class"/> |
|
24 |
</delete> |
|
25 |
</target> |
|
26 |
</project> |
branches/Mobile_Compatible_Hito_1/TestProjection/gvSIG/extensiones/org.gvsig.crs/iau2000.script | ||
---|---|---|
1 |
CREATE USER SA PASSWORD "" ADMIN |
|
2 |
SET WRITE_DELAY 60 |
branches/Mobile_Compatible_Hito_1/TestProjection/gvSIG/extensiones/org.gvsig.crs/usr.properties | ||
---|---|---|
1 |
#HSQL database |
|
2 |
#Thu Jun 26 13:11:38 CEST 2008 |
|
3 |
hsqldb.cache_file_scale=1 |
|
4 |
runtime.gc_interval=0 |
|
5 |
hsqldb.first_identity=0 |
|
6 |
version=1.7.3 |
|
7 |
modified=yes |
|
8 |
hsqldb.script_format=0 |
|
9 |
sql.enforce_size=false |
|
10 |
hsqldb.cache_size_scale=10 |
|
11 |
hsqldb.cache_scale=14 |
|
12 |
hsqldb.version=1.7.3 |
|
13 |
hsqldb.log_size=200 |
|
14 |
sql.enforce_strict_size=false |
|
15 |
readonly=false |
|
16 |
hsqldb.compatible_version=1.7.2 |
|
17 |
hsqldb.original_version=1.7.3 |
|
18 |
sql.compare_in_locale=false |
|
19 |
hsqldb.nio_data_file=true |
|
20 |
hsqldb.cache_version=1.7.0 |
branches/Mobile_Compatible_Hito_1/TestProjection/gvSIG/extensiones/org.gvsig.crs/esri.script | ||
---|---|---|
1 |
CREATE USER SA PASSWORD "" ADMIN |
|
2 |
SET WRITE_DELAY 60 |
branches/Mobile_Compatible_Hito_1/TestProjection/gvSIG/extensiones/org.gvsig.crs/iau2000.properties | ||
---|---|---|
1 |
#HSQL database |
|
2 |
#Thu Jun 26 13:11:38 CEST 2008 |
|
3 |
hsqldb.cache_file_scale=1 |
|
4 |
runtime.gc_interval=0 |
|
5 |
hsqldb.first_identity=0 |
|
6 |
version=1.7.3 |
|
7 |
modified=yes |
|
8 |
hsqldb.script_format=0 |
|
9 |
sql.enforce_size=false |
|
10 |
hsqldb.cache_size_scale=10 |
|
11 |
hsqldb.cache_scale=14 |
|
12 |
hsqldb.version=1.7.3 |
|
13 |
hsqldb.log_size=200 |
|
14 |
sql.enforce_strict_size=false |
|
15 |
readonly=false |
|
16 |
hsqldb.compatible_version=1.7.2 |
|
17 |
hsqldb.original_version=1.7.3 |
|
18 |
sql.compare_in_locale=false |
|
19 |
hsqldb.nio_data_file=true |
|
20 |
hsqldb.cache_version=1.7.0 |
branches/Mobile_Compatible_Hito_1/TestProjection/gvSIG/extensiones/org.gvsig.crs/usr.script | ||
---|---|---|
1 |
CREATE USER SA PASSWORD "" ADMIN |
|
2 |
SET WRITE_DELAY 60 |
branches/Mobile_Compatible_Hito_1/TestProjection/gvSIG/extensiones/org.gvsig.crs/esri.properties | ||
---|---|---|
1 |
#HSQL database |
|
2 |
#Thu Jun 26 13:11:38 CEST 2008 |
|
3 |
hsqldb.cache_file_scale=1 |
|
4 |
runtime.gc_interval=0 |
|
5 |
hsqldb.first_identity=0 |
|
6 |
version=1.7.3 |
|
7 |
modified=yes |
|
8 |
hsqldb.script_format=0 |
|
9 |
sql.enforce_size=false |
|
10 |
hsqldb.cache_size_scale=10 |
|
11 |
hsqldb.cache_scale=14 |
|
12 |
hsqldb.version=1.7.3 |
|
13 |
hsqldb.log_size=200 |
|
14 |
sql.enforce_strict_size=false |
|
15 |
readonly=false |
|
16 |
hsqldb.compatible_version=1.7.2 |
|
17 |
hsqldb.original_version=1.7.3 |
|
18 |
sql.compare_in_locale=false |
|
19 |
hsqldb.nio_data_file=true |
|
20 |
hsqldb.cache_version=1.7.0 |
branches/Mobile_Compatible_Hito_1/TestProjection/.classpath | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<classpath> |
|
3 |
<classpathentry kind="src" path="src"/> |
|
4 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/_jvm"/> |
|
5 |
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/> |
|
6 |
<classpathentry kind="lib" path="lib/slf4j-api-1.5.0.jar"/> |
|
7 |
<classpathentry kind="lib" path="lib/slf4j-log4j12-1.5.0.jar"/> |
|
8 |
<classpathentry kind="lib" path="lib/org.gvsig.exceptions.jar"/> |
|
9 |
<classpathentry kind="lib" path="lib/org.gvsig.fmap.geometries.jar"/> |
|
10 |
<classpathentry kind="lib" path="lib/org.gvsig.fmap.geometries.operations.jar"/> |
|
11 |
<classpathentry kind="lib" path="lib/org.gvsig.projection.api.jar"/> |
|
12 |
<classpathentry kind="lib" path="lib/org.gvsig.projection.dummy.jar"/> |
|
13 |
<classpathentry kind="lib" path="lib/jts-1.8.jar"/> |
|
14 |
<classpathentry kind="output" path="bin"/> |
|
15 |
</classpath> |
branches/Mobile_Compatible_Hito_1/TestProjection/.project | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>TestProjection</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
10 |
<arguments> |
|
11 |
</arguments> |
|
12 |
</buildCommand> |
|
13 |
</buildSpec> |
|
14 |
<natures> |
|
15 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
16 |
</natures> |
|
17 |
</projectDescription> |
Also available in: Unified diff