Revision 6164
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrDefault.java | ||
---|---|---|
50 | 50 |
import org.apache.log4j.Logger; |
51 | 51 |
import org.cresques.cts.ICoordTrans; |
52 | 52 |
import org.cresques.cts.IProjection; |
53 |
import org.cresques.cts.ProjectionPool; |
|
54 |
import org.cresques.cts.gt2.CoordSys; |
|
55 |
import org.cresques.cts.gt2.CoordTrans; |
|
56 | 53 |
|
57 | 54 |
import com.iver.cit.gvsig.fmap.DriverException; |
58 | 55 |
import com.iver.cit.gvsig.fmap.FMap; |
56 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
|
59 | 57 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
60 | 58 |
import com.iver.cit.gvsig.fmap.edition.EditionException; |
61 | 59 |
import com.iver.cit.gvsig.fmap.operations.strategies.Strategy; |
... | ... | |
201 | 199 |
// Si no lo es, es una capa que est? reproyectada al vuelo |
202 | 200 |
if ((proj != null) && (getFMap() != null)) |
203 | 201 |
if (proj != getFMap().getProjection()) { |
204 |
ICoordTrans ct = new CoordTrans((CoordSys) proj, |
|
205 |
(CoordSys) getFMap().getProjection()); |
|
202 |
ICoordTrans ct = proj.getCT(getFMap().getProjection()); |
|
206 | 203 |
setCoordTrans(ct); |
207 | 204 |
logger.debug("Cambio proyecci?n: FMap con " |
208 | 205 |
+ getFMap().getProjection().getAbrev() + " y capa " |
... | ... | |
305 | 302 |
maxScale = xml.getDoubleProperty("maxScale"); |
306 | 303 |
visible = xml.getBooleanProperty("visible"); |
307 | 304 |
if (xml.contains("proj")) { |
308 |
setProjection(ProjectionPool.get(xml.getStringProperty("proj")));
|
|
305 |
setProjection(CRSFactory.getCRS(xml.getStringProperty("proj")));
|
|
309 | 306 |
} |
310 | 307 |
if (xml.contains("transparency")) |
311 | 308 |
transparency = xml.getIntProperty("transparency"); |
... | ... | |
330 | 327 |
maxScale = xml.getDoubleProperty("maxScale"); |
331 | 328 |
visible = xml.getBooleanProperty("visible"); |
332 | 329 |
if (xml.contains("proj")) { |
333 |
setProjection(ProjectionPool.get(xml.getStringProperty("proj")));
|
|
330 |
setProjection(CRSFactory.getCRS(xml.getStringProperty("proj")));
|
|
334 | 331 |
} |
335 | 332 |
if (xml.contains("transparency")) |
336 | 333 |
transparency = xml.getIntProperty("transparency"); |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLayers.java | ||
---|---|---|
46 | 46 |
import java.awt.image.BufferedImage; |
47 | 47 |
import java.awt.image.WritableRaster; |
48 | 48 |
import java.io.File; |
49 |
import java.io.WriteAbortedException; |
|
50 | 49 |
import java.util.ArrayList; |
51 | 50 |
import java.util.Collections; |
52 | 51 |
import java.util.ConcurrentModificationException; |
... | ... | |
59 | 58 |
import org.apache.log4j.Logger; |
60 | 59 |
import org.cresques.cts.ICoordTrans; |
61 | 60 |
import org.cresques.cts.IProjection; |
62 |
import org.cresques.cts.ProjectionPool; |
|
63 |
import org.cresques.cts.gt2.CoordSys; |
|
64 |
import org.cresques.cts.gt2.CoordTrans; |
|
65 | 61 |
|
66 | 62 |
import com.hardcode.driverManager.Driver; |
67 | 63 |
import com.hardcode.driverManager.DriverLoadException; |
... | ... | |
69 | 65 |
import com.iver.cit.gvsig.fmap.FMap; |
70 | 66 |
import com.iver.cit.gvsig.fmap.MapControl; |
71 | 67 |
import com.iver.cit.gvsig.fmap.ViewPort; |
68 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
|
72 | 69 |
import com.iver.cit.gvsig.fmap.drivers.DefaultDBDriver; |
73 | 70 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
74 | 71 |
import com.iver.cit.gvsig.fmap.drivers.VectorialDatabaseDriver; |
... | ... | |
683 | 680 |
if (proj != null) |
684 | 681 |
if (proj != fmap.getProjection()) |
685 | 682 |
{ |
686 |
ICoordTrans ct = new CoordTrans((CoordSys) proj, |
|
687 |
(CoordSys) fmap.getProjection()); |
|
683 |
ICoordTrans ct = proj.getCT(fmap.getProjection()); |
|
688 | 684 |
layer.setCoordTrans(ct); |
689 | 685 |
System.err.println("coordTrans = " + |
690 | 686 |
proj.getAbrev() + " " + |
... | ... | |
783 | 779 |
//String recordsetName = xml.getChild(i).getStringProperty("recordset-name"); |
784 | 780 |
IProjection proj = null; |
785 | 781 |
if (xml.getChild(i).contains("proj")) { |
786 |
proj = ProjectionPool.get(xml.getChild(i).getStringProperty("proj"));
|
|
782 |
proj = CRSFactory.getCRS(xml.getChild(i).getStringProperty("proj"));
|
|
787 | 783 |
} |
788 | 784 |
else |
789 | 785 |
{ |
... | ... | |
937 | 933 |
if ((proj != null)) |
938 | 934 |
if (proj != getFMap().getProjection()) |
939 | 935 |
{ |
940 |
ICoordTrans ct = new CoordTrans((CoordSys) proj, |
|
941 |
(CoordSys) getFMap().getProjection()); |
|
936 |
ICoordTrans ct = proj.getCT(getFMap().getProjection()); |
|
942 | 937 |
// TODO: REVISAR CON LUIS |
943 | 938 |
// Se lo fijamos a todas, luego cada una que se reproyecte |
944 | 939 |
// si puede, o que no haga nada |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrAnnotation.java | ||
---|---|---|
12 | 12 |
|
13 | 13 |
import org.cresques.cts.ICoordTrans; |
14 | 14 |
import org.cresques.cts.IProjection; |
15 |
import org.cresques.cts.ProjectionPool; |
|
16 | 15 |
|
17 | 16 |
import com.hardcode.driverManager.Driver; |
18 | 17 |
import com.hardcode.driverManager.DriverLoadException; |
... | ... | |
30 | 29 |
import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
31 | 30 |
import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
32 | 31 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
32 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
|
33 | 33 |
import com.iver.cit.gvsig.fmap.drivers.BoundedShapes; |
34 | 34 |
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes; |
35 | 35 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
... | ... | |
251 | 251 |
IProjection proj = null; |
252 | 252 |
|
253 | 253 |
if (xml.contains("proj")) { |
254 |
proj = ProjectionPool.get(xml.getStringProperty("proj"));
|
|
254 |
proj = CRSFactory.getCRS(xml.getStringProperty("proj"));
|
|
255 | 255 |
} |
256 | 256 |
|
257 | 257 |
VectorialFileAdapter adapter = new VectorialFileAdapter(new File(xml |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/ViewPort.java | ||
---|---|---|
43 | 43 |
import java.awt.Color; |
44 | 44 |
import java.awt.Dimension; |
45 | 45 |
import java.awt.Point; |
46 |
import java.awt.Rectangle; |
|
47 | 46 |
import java.awt.geom.AffineTransform; |
48 | 47 |
import java.awt.geom.NoninvertibleTransformException; |
49 | 48 |
import java.awt.geom.Point2D; |
... | ... | |
52 | 51 |
|
53 | 52 |
import org.cresques.cts.GeoCalc; |
54 | 53 |
import org.cresques.cts.IProjection; |
55 |
import org.cresques.cts.ProjectionPool; |
|
56 | 54 |
import org.cresques.cts.gt2.CSUTM; |
57 | 55 |
|
56 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
|
58 | 57 |
import com.iver.utiles.StringUtilities; |
59 | 58 |
import com.iver.utiles.XMLEntity; |
60 | 59 |
|
... | ... | |
778 | 777 |
xml.getDoubleProperty("offsetY"))); |
779 | 778 |
|
780 | 779 |
if (xml.contains("proj")) { |
781 |
vp.proj = ProjectionPool.get(xml.getStringProperty("proj"));
|
|
780 |
vp.proj = CRSFactory.getCRS(xml.getStringProperty("proj"));
|
|
782 | 781 |
} |
783 | 782 |
|
784 | 783 |
//vp.setScale(xml.getDoubleProperty("scale")); |
... | ... | |
839 | 838 |
xml.getDoubleProperty("offsetY"))); |
840 | 839 |
|
841 | 840 |
if (xml.contains("proj")) { |
842 |
vp.proj = ProjectionPool.get(xml.getStringProperty("proj"));
|
|
841 |
vp.proj = CRSFactory.getCRS(xml.getStringProperty("proj"));
|
|
843 | 842 |
} |
844 | 843 |
|
845 | 844 |
//vp.setScale(xml.getDoubleProperty("scale")); |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/dxf/DXFMemoryDriver.java | ||
---|---|---|
58 | 58 |
import java.util.Properties; |
59 | 59 |
|
60 | 60 |
import org.cresques.cts.IProjection; |
61 |
import org.cresques.cts.ProjectionPool; |
|
62 | 61 |
import org.cresques.geo.Point3D; |
63 | 62 |
import org.cresques.io.DxfFile; |
64 | 63 |
import org.cresques.px.IObjList; |
... | ... | |
89 | 88 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
90 | 89 |
import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
91 | 90 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
91 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
|
92 | 92 |
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes; |
93 | 93 |
import com.iver.cit.gvsig.fmap.drivers.ILayerDefinition; |
94 | 94 |
import com.iver.cit.gvsig.fmap.drivers.ITableDefinition; |
... | ... | |
102 | 102 |
import com.iver.cit.gvsig.fmap.edition.IWriter; |
103 | 103 |
import com.iver.cit.gvsig.fmap.edition.writers.dxf.DxfFieldsMapping; |
104 | 104 |
import com.iver.cit.gvsig.fmap.edition.writers.dxf.DxfWriter; |
105 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
106 | 105 |
import com.iver.cit.gvsig.fmap.rendering.Legend; |
107 | 106 |
import com.iver.cit.gvsig.fmap.rendering.LegendFactory; |
108 | 107 |
import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend; |
... | ... | |
173 | 172 |
|
174 | 173 |
attr.setLoadedInMemory(true); |
175 | 174 |
|
176 |
IProjection proj = ProjectionPool.get("EPSG:23030");
|
|
175 |
IProjection proj = CRSFactory.getCRS("EPSG:23030");
|
|
177 | 176 |
featureMaker = new DxfFeatureMaker(proj); |
178 | 177 |
headerManager = new DxfHeaderManager(); |
179 | 178 |
dxfFeatureFile = new DxfFile(proj, m_Fich.getAbsolutePath(), |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/demo/MapImage.java | ||
---|---|---|
48 | 48 |
|
49 | 49 |
import javax.swing.JFrame; |
50 | 50 |
|
51 |
import org.cresques.cts.ProjectionPool; |
|
52 |
|
|
53 | 51 |
import com.hardcode.driverManager.DriverLoadException; |
54 | 52 |
import com.iver.cit.gvsig.fmap.DriverException; |
55 | 53 |
import com.iver.cit.gvsig.fmap.MapControl; |
54 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
|
56 | 55 |
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver; |
57 | 56 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
58 | 57 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
... | ... | |
108 | 107 |
FLayer l = LayerFactory.createLayer("Vias", |
109 | 108 |
(VectorialFileDriver) LayerFactory.getDM().getDriver("gvSIG shp driver"), |
110 | 109 |
new File("C:/Documents and Settings/fernando/Mis documentos/vias.shp"), |
111 |
ProjectionPool.get("EPSG:23030"));
|
|
110 |
CRSFactory.getCRS("EPSG:23030"));
|
|
112 | 111 |
newMapControl.getMapContext().getLayers().addLayer(l); |
113 | 112 |
newMapControl.addMapTool("zoom", new RectangleBehavior(new ZoomInListenerImpl(newMapControl))); |
114 | 113 |
newMapControl.setTool("zoom"); |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/demo/ImageFrame.java | ||
---|---|---|
48 | 48 |
import javax.swing.JFrame; |
49 | 49 |
import javax.swing.JLabel; |
50 | 50 |
|
51 |
import org.cresques.cts.ProjectionPool; |
|
52 |
|
|
53 | 51 |
import com.hardcode.driverManager.DriverLoadException; |
54 | 52 |
import com.iver.cit.gvsig.fmap.DriverException; |
55 | 53 |
import com.iver.cit.gvsig.fmap.FMap; |
56 | 54 |
import com.iver.cit.gvsig.fmap.ViewPort; |
55 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
|
57 | 56 |
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver; |
58 | 57 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
59 | 58 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
... | ... | |
92 | 91 |
l = LayerFactory.createLayer("Provin", |
93 | 92 |
(VectorialFileDriver) LayerFactory.getDM().getDriver("gvSIG shp driver"), |
94 | 93 |
new File("C:/Documents and Settings/fjp/Mis documentos/provin.shp"), |
95 |
ProjectionPool.get("EPSG:23030"));
|
|
94 |
CRSFactory.getCRS("EPSG:23030"));
|
|
96 | 95 |
|
97 |
ViewPort vp = new ViewPort(ProjectionPool.get("EPSG:23030"));
|
|
96 |
ViewPort vp = new ViewPort(CRSFactory.getCRS("EPSG:23030"));
|
|
98 | 97 |
vp.setImageSize(new Dimension(getWidth(), getHeight())); |
99 | 98 |
|
100 | 99 |
FMap mapa = new FMap(vp); |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/crs/CRSFactory.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.fmap.crs; |
|
2 |
|
|
3 |
import org.cresques.cts.IProjection; |
|
4 |
import org.cresques.cts.ProjectionPool; |
|
5 |
|
|
6 |
/** |
|
7 |
* Fabrica de CRS. |
|
8 |
* Centraliza las peticiones de creaci?n de objetos CRS de todo fmap. |
|
9 |
* @author luisw |
|
10 |
* |
|
11 |
*/ |
|
12 |
public class CRSFactory { |
|
13 |
public static IProjection getCRS(String code) { |
|
14 |
return ProjectionPool.get(code); |
|
15 |
} |
|
16 |
} |
|
0 | 17 |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/writers/shp/testWriter.java | ||
---|---|---|
5 | 5 |
import javax.swing.JFileChooser; |
6 | 6 |
|
7 | 7 |
import org.cresques.cts.IProjection; |
8 |
import org.cresques.cts.ProjectionPool; |
|
9 | 8 |
|
10 |
import com.hardcode.driverManager.DriverLoadException; |
|
11 | 9 |
import com.hardcode.driverManager.DriverManager; |
12 | 10 |
import com.iver.cit.gvsig.fmap.DriverException; |
13 | 11 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
14 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
|
|
12 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory;
|
|
15 | 13 |
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver; |
16 | 14 |
import com.iver.cit.gvsig.fmap.edition.DefaultRowEdited; |
17 |
import com.iver.cit.gvsig.fmap.edition.EditionException; |
|
18 | 15 |
import com.iver.cit.gvsig.fmap.edition.IRowEdited; |
19 | 16 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
20 | 17 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
21 | 18 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
22 | 19 |
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial; |
23 |
import com.iver.cit.gvsig.fmap.layers.VectorialAdapter; |
|
24 | 20 |
import com.iver.cit.gvsig.fmap.layers.VectorialFileAdapter; |
25 | 21 |
|
26 | 22 |
public class testWriter { |
... | ... | |
59 | 55 |
FLyrVect layer= (FLyrVect) test.createLayer("prueba", |
60 | 56 |
(VectorialFileDriver)driverManager.getDriver("gvSIG shp driver"), |
61 | 57 |
original, |
62 |
ProjectionPool.get("EPSG:23030"));
|
|
58 |
CRSFactory.getCRS("EPSG:23030"));
|
|
63 | 59 |
|
64 | 60 |
|
65 | 61 |
if (jfc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/writers/shp/Prueba.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 | 4 |
import java.io.IOException; |
5 |
import java.util.BitSet; |
|
6 | 5 |
|
7 | 6 |
import org.cresques.cts.IProjection; |
8 |
import org.cresques.cts.ProjectionPool; |
|
9 | 7 |
|
10 |
import com.hardcode.driverManager.Driver; |
|
11 | 8 |
import com.hardcode.driverManager.DriverLoadException; |
12 | 9 |
import com.hardcode.driverManager.DriverManager; |
13 | 10 |
import com.hardcode.gdbms.engine.instruction.FieldNotFoundException; |
... | ... | |
16 | 13 |
import com.iver.cit.gvsig.fmap.DriverException; |
17 | 14 |
import com.iver.cit.gvsig.fmap.core.DefaultFeature; |
18 | 15 |
import com.iver.cit.gvsig.fmap.core.ShapeFactory; |
16 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
|
19 | 17 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
20 | 18 |
import com.iver.cit.gvsig.fmap.drivers.VectorialDriver; |
21 | 19 |
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver; |
... | ... | |
23 | 21 |
import com.iver.cit.gvsig.fmap.edition.EditionEvent; |
24 | 22 |
import com.iver.cit.gvsig.fmap.edition.EditionException; |
25 | 23 |
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter; |
26 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
|
27 | 24 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
28 | 25 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
29 | 26 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
... | ... | |
120 | 117 |
Prueba prueba=new Prueba(); |
121 | 118 |
FLayer layer=null; |
122 | 119 |
try { |
123 |
layer=prueba.createLayer("prueba", (VectorialFileDriver)LayerFactory.getDM().getDriver("gvSIG shp driver"),new File("c:/Layers/puntosPrueba.shp"),ProjectionPool.get("EPSG:23030"));
|
|
120 |
layer=prueba.createLayer("prueba", (VectorialFileDriver)LayerFactory.getDM().getDriver("gvSIG shp driver"),new File("c:/Layers/puntosPrueba.shp"),CRSFactory.getCRS("EPSG:23030"));
|
|
124 | 121 |
} catch (DriverException e) { |
125 | 122 |
e.printStackTrace(); |
126 | 123 |
} catch (DriverLoadException e) { |
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/MapControl.java | ||
---|---|---|
62 | 62 |
import javax.swing.Timer; |
63 | 63 |
|
64 | 64 |
import org.cresques.cts.IProjection; |
65 |
import org.cresques.cts.ProjectionPool; |
|
66 | 65 |
|
66 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
|
67 | 67 |
import com.iver.cit.gvsig.fmap.edition.commands.CommandListener; |
68 | 68 |
import com.iver.cit.gvsig.fmap.layers.LayerEvent; |
69 | 69 |
import com.iver.cit.gvsig.fmap.tools.BehaviorException; |
... | ... | |
130 | 130 |
// TODO: Cuando creamos un mapControl, deber?amos asignar |
131 | 131 |
// la projecci?n por defecto con la que vayamos a trabajar. |
132 | 132 |
// 23030 es el c?digo EPSG del UTM30 elipsoide ED50 |
133 |
vp = new ViewPort(ProjectionPool.get("EPSG:23030"));
|
|
133 |
vp = new ViewPort(CRSFactory.getCRS("EPSG:23030"));
|
|
134 | 134 |
setMapContext(new FMap(vp)); |
135 | 135 |
|
136 | 136 |
//eventos |
Also available in: Unified diff