Revision 42464

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/cts/gt2/CoordSys.java
36 36
import org.geotools.cs.CoordinateSystemFactory;
37 37
import org.geotools.cs.GeographicCoordinateSystem;
38 38
import org.geotools.cs.ProjectedCoordinateSystem;
39
import org.gvsig.fmap.crs.CRSFactory;
40 39
import org.opengis.referencing.FactoryException;
41 40

  
41
import org.gvsig.fmap.crs.CRSFactory;
42 42

  
43

  
43 44
/**
44 45
 * Sistema de Coordenadas (Proyecci?n).
45 46
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
......
219 220
	public String getFullCode() {
220 221
		return getAbrev();
221 222
	}
222
	
223

  
223 224
	public Object clone() throws CloneNotSupportedException {
224 225
	       return CRSFactory.getCRS( this.getFullCode() );
225 226
	    }
226 227

  
228
    /* (non-Javadoc)
229
     * @see org.cresques.cts.IProjection#export(java.lang.String)
230
     */
231
    @Override
232
    public String export(String format) {
233
        // TODO Auto-generated method stub
234
        return null;
235
    }
236

  
227 237
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/cts/ProjectionPool.java
222 222
        cs = new CSLambertCC(CSDatum.ntfParis, 0, 46.79999999999995, 0.99987742, 600000, 2200000);
223 223
        cs.setAbrev("EPSG:27572");
224 224
        data.put(cs.getAbrev(), cs);
225
        
225

  
226 226
        cs = new CSLambertCC(CSDatum.ntfParis, 0, 52, 0.99987742, 600000, 2200000);
227 227
        cs.setAbrev("EPSG:27582");
228 228
        data.put(cs.getAbrev(), cs);
......
248 248
        data.put(cs.getAbrev(), cs);
249 249
        cs.setAbrev("EPSG:9804");
250 250
        data.put(cs.getAbrev(), cs);
251
        
251

  
252 252
        // Lo que faltaba: ?planetas!
253 253
        cs = (new CSUTM(CSDatum.moon, 30)).toGeo();
254 254
        cs.setAbrev("IAU2000:30100"); // Moon
......
257 257
        cs = (new CSUTM(CSDatum.mars, 30)).toGeo();
258 258
        cs.setAbrev("IAU2000:49900"); // Mars
259 259
        data.put(cs.getAbrev(), cs);
260
        
260

  
261 261
        /*
262 262
         * CRSs argentinos.
263 263
         * coordenadas geograficas
264
			PosGAr 4172 
264
			PosGAr 4172
265 265
			PosGAr98 4190
266
			
266

  
267 267
			coordenadas proyectadas
268
			POSGAR 94/Argentina 1 22191 
268
			POSGAR 94/Argentina 1 22191
269 269
			POSGAR 94/Argentina 2 22192
270 270
			POSGAR 94/Argentina 3 22193
271 271
			POSGAR 94/Argentina 4 22194
272 272
			POSGAR 94/Argentina 5 22195
273 273
			POSGAR 94/Argentina 6 22196
274 274
			POSGAR 94/Argentina 7 22197
275
			
275

  
276 276
			POSGAR 98/Argentina 1 22181
277 277
			POSGAR 98/Argentina 2 22182
278 278
			POSGAR 98/Argentina 3 22183
......
280 280
			POSGAR 98/Argentina 5 22185
281 281
			POSGAR 98/Argentina 6 22186
282 282
			POSGAR 98/Argentina 7 22187
283
			
283

  
284 284
			4221 GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
285
			
285

  
286 286
			22191	EPSG	22191	PROJCS["Argentina_Zone_1",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",1500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-72],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]	+proj=tmerc +lat_0=-90 +lon_0=-72 +k=1.000000 +x_0=1500000 +y_0=0 +ellps=intl +units=m
287 287
			22192	EPSG	22192	PROJCS["Argentina_Zone_2",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",2500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-69],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]	+proj=tmerc +lat_0=-90 +lon_0=-69 +k=1.000000 +x_0=2500000 +y_0=0 +ellps=intl +units=m
288 288
			22193	EPSG	22193	PROJCS["Argentina_Zone_3",GEOGCS["GCS_Campo_Inchauspe",DATUM["D_Campo_Inchauspe",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",3500000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-66],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",-90],UNIT["Meter",1]]	+proj=tmerc +lat_0=-90 +lon_0=-66 +k=1.000000 +x_0=3500000 +y_0=0 +ellps=intl +units=m
......
295 295
        cs = new CoordSys(CSDatum.posgar);
296 296
        cs.setAbrev("EPSG:4172"); // Posgar
297 297
        data.put(cs.getAbrev(), cs);
298
        
298

  
299 299
        cs = new CoordSys(
300 300
			"GEOGCS[\"GCS_Campo_Inchauspe\"," +
301 301
				"DATUM[\"D_Campo_Inchauspe\"," +
......
305 305
				"UNIT[\"Degree\",0.017453292519943295]]");
306 306
        cs.setAbrev("EPSG:4221"); // Campo Inchauspe
307 307
        data.put(cs.getAbrev(), cs);
308
        
308

  
309 309
       for (int i=1; i<=7; i++) {
310 310
	        cs = new CoordSys(
311 311
	        	"PROJCS[\"Argentina_Zone_"+i+"\"," +
......
325 325
	        cs.setAbrev("EPSG:2219"+i); // Posgar
326 326
	        data.put(cs.getAbrev(), cs);
327 327
        }
328
       
328

  
329 329
       /*
330 330
        * pendiente de a?adir:
331
        * 
331
        *
332 332
        * EPSG 3003: Montemario / Italy Zone 1 - Pendiente de a?adir
333 333
      	* EPSG 4149: CH1903 - Pendiente de a?adir
334 334
      	* Ecuador:
......
381 381
	public boolean doesRigurousTransformations() {
382 382
		return false;
383 383
	}
384

  
385
    /* (non-Javadoc)
386
     * @see org.cresques.cts.ICRSFactory#get(java.lang.String, java.lang.String)
387
     */
388
    @Override
389
    public IProjection get(String format, String value) {
390
        // TODO Auto-generated method stub
391
        return null;
392
    }
384 393
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/geo/Mercator.java
27 27
import org.cresques.cts.IDatum;
28 28
import org.cresques.cts.IProjection;
29 29
import org.cresques.geo.ViewPortData;
30

  
31 30
import org.cresques.px.Extent;
32 31

  
33 32
import java.awt.FontMetrics;
......
35 34
import java.awt.geom.AffineTransform;
36 35
import java.awt.geom.Point2D;
37 36
import java.awt.geom.Rectangle2D;
38

  
39 37
import java.util.TreeMap;
40 38

  
41 39

  
......
390 388
	public String getFullCode() {
391 389
		return getAbrev();
392 390
	}
391

  
392
    /* (non-Javadoc)
393
     * @see org.cresques.cts.IProjection#export(java.lang.String)
394
     */
395
    @Override
396
    public String export(String arg0) {
397
        // TODO Auto-generated method stub
398
        return null;
399
    }
393 400
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.projection/org.gvsig.projection.cresques/org.gvsig.projection.cresques.impl/src/main/java/org/cresques/impl/geo/Projection.java
26 26
import org.cresques.cts.IDatum;
27 27
import org.cresques.cts.IProjection;
28 28
import org.cresques.geo.ViewPortData;
29

  
29 30
import org.gvsig.fmap.crs.CRSFactory;
30 31

  
31 32
import java.awt.Color;
......
162 163
    }
163 164

  
164 165
    abstract public void drawGrid(Graphics2D g, ViewPortData vp);
165
    
166

  
166 167
    public boolean isProjected() {
167 168
    	return false;
168 169
    }
169
    
170

  
170 171
    public Object clone() throws CloneNotSupportedException {
171 172
        return CRSFactory.getCRS( this.getFullCode() );
172 173
     }
173 174

  
175
    /* (non-Javadoc)
176
     * @see org.cresques.cts.IProjection#export(java.lang.String)
177
     */
178
    @Override
179
    public String export(String format) {
180
        // TODO Auto-generated method stub
181
        return null;
182
    }
174 183
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/primitive/Envelope.java
138 138
     *
139 139
     * Is equivalent to:
140 140
     *  <code>add(geometry.getEnvelope())</code>
141
     * 
141
     *
142 142
     * @param envelope The envelope to add.
143 143
     */
144 144
    void add(Geometry geometry);
145
    
145

  
146 146
    /**
147 147
     * It returns the equivalent of an envelope like a geometry.
148 148
     *
......
171 171
    boolean intersects(Envelope envelope);
172 172

  
173 173
    /**
174
     * Returns <code>true</code> if the geometry intersects with the current
175
     * envelope.
176
     *
177
     * @param geometry The geometry to compare.
178
     * @return If the current envelope intersects with the geometry
179
     */
180
    boolean intersects(Geometry geometry);
181

  
182
    /**
174 183
     * Converts the envelope to other coordinate reference system
175 184
     *
176 185
     * @param trans The CRS conversor
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/polygon/Polygon2DM.java
34 34
import com.vividsolutions.jts.operation.buffer.BufferParameters;
35 35
import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder;
36 36

  
37
import org.cresques.cts.ICoordTrans;
38

  
37 39
import org.gvsig.fmap.geom.Geometry;
38 40
import org.gvsig.fmap.geom.GeometryException;
39 41
import org.gvsig.fmap.geom.aggregate.MultiLine;
......
253 255
      public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException {
254 256
          return JTSUtils.createGeometry(getJTS().buffer(distance));
255 257
      }
258

  
259
      /* (non-Javadoc)
260
       * @see org.gvsig.fmap.geom.jts.primitive.curve.line.AbstractLine#reProject(org.cresques.cts.ICoordTrans)
261
       */
262
      @Override
263
      public void reProject(ICoordTrans ct) {
264
          super.reProject(ct);
265
          for (Iterator<Ring> iterator = interiorRings.iterator(); iterator.hasNext();) {
266
              GeometryJTS ring = (GeometryJTS) iterator.next();
267
              ring.reProject(ct);
268
          }
269
          if (coordinates.size()>=2 && !isClosed()) {
270
              closePrimitive();
271
          }
272
      }
256 273
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/polygon/Polygon3DM.java
34 34
import com.vividsolutions.jts.operation.buffer.BufferParameters;
35 35
import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder;
36 36

  
37
import org.cresques.cts.ICoordTrans;
38

  
37 39
import org.gvsig.fmap.geom.Geometry;
38 40
import org.gvsig.fmap.geom.GeometryException;
39 41
import org.gvsig.fmap.geom.aggregate.MultiLine;
......
259 261
      public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException {
260 262
          return JTSUtils.createGeometry(getJTS().buffer(distance));
261 263
      }
264

  
265

  
266
      /* (non-Javadoc)
267
       * @see org.gvsig.fmap.geom.jts.primitive.curve.line.AbstractLine#reProject(org.cresques.cts.ICoordTrans)
268
       */
269
      @Override
270
      public void reProject(ICoordTrans ct) {
271
          super.reProject(ct);
272
          for (Iterator<Ring> iterator = interiorRings.iterator(); iterator.hasNext();) {
273
              GeometryJTS ring = (GeometryJTS) iterator.next();
274
              ring.reProject(ct);
275
          }
276
          if (coordinates.size()>=2 && !isClosed()) {
277
              closePrimitive();
278
          }
279
      }
262 280
}
263 281

  
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/polygon/Polygon2D.java
34 34
import com.vividsolutions.jts.operation.buffer.BufferParameters;
35 35
import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder;
36 36

  
37
import org.cresques.cts.ICoordTrans;
38

  
37 39
import org.gvsig.fmap.geom.Geometry;
38 40
import org.gvsig.fmap.geom.GeometryException;
39 41
import org.gvsig.fmap.geom.aggregate.MultiLine;
......
270 272
    public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException {
271 273
        return JTSUtils.createGeometry(getJTS().buffer(distance));
272 274
    }
275

  
276
    /* (non-Javadoc)
277
     * @see org.gvsig.fmap.geom.jts.primitive.curve.line.AbstractLine#reProject(org.cresques.cts.ICoordTrans)
278
     */
279
    @Override
280
    public void reProject(ICoordTrans ct) {
281
        super.reProject(ct);
282
        for (Iterator<Ring> iterator = interiorRings.iterator(); iterator.hasNext();) {
283
            GeometryJTS ring = (GeometryJTS) iterator.next();
284
            ring.reProject(ct);
285
        }
286
        if (coordinates.size()>=2 && !isClosed()) {
287
            closePrimitive();
288
        }
289
    }
273 290
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/polygon/Polygon3D.java
34 34
import com.vividsolutions.jts.operation.buffer.BufferParameters;
35 35
import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder;
36 36

  
37
import org.cresques.cts.ICoordTrans;
38

  
37 39
import org.gvsig.fmap.geom.Geometry;
38 40
import org.gvsig.fmap.geom.GeometryException;
39 41
import org.gvsig.fmap.geom.aggregate.MultiLine;
......
250 252
      public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException {
251 253
          return JTSUtils.createGeometry(getJTS().buffer(distance));
252 254
      }
255

  
256
      /* (non-Javadoc)
257
       * @see org.gvsig.fmap.geom.jts.primitive.curve.line.AbstractLine#reProject(org.cresques.cts.ICoordTrans)
258
       */
259
      @Override
260
      public void reProject(ICoordTrans ct) {
261
          super.reProject(ct);
262
          for (Iterator<Ring> iterator = interiorRings.iterator(); iterator.hasNext();) {
263
              GeometryJTS ring = (GeometryJTS) iterator.next();
264
              ring.reProject(ct);
265
          }
266
          if (coordinates.size()>=2 && !isClosed()) {
267
              closePrimitive();
268
          }
269
      }
253 270
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/filledspline/FilledSpline2DM.java
24 24

  
25 25
import com.vividsolutions.jts.geom.Coordinate;
26 26

  
27
import org.cresques.cts.ICoordTrans;
28

  
27 29
import org.gvsig.fmap.geom.Geometry;
28 30
import org.gvsig.fmap.geom.jts.primitive.curve.spline.BaseSpline2DM;
29 31
import org.gvsig.fmap.geom.jts.util.JTSUtils;
......
154 156
    public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException {
155 157
        return JTSUtils.createGeometry(getJTS().buffer(distance));
156 158
    }
159

  
160
    /* (non-Javadoc)
161
     * @see org.gvsig.fmap.geom.jts.primitive.curve.spline.AbstractSpline#reProject(org.cresques.cts.ICoordTrans)
162
     */
163
    @Override
164
    public void reProject(ICoordTrans ct) {
165
        super.reProject(ct);
166
        if (coordinates.size()>=2 && !isClosed()) {
167
            closePrimitive();
168
        }
169
    }
157 170
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/filledspline/FilledSpline3DM.java
24 24

  
25 25
import com.vividsolutions.jts.geom.Coordinate;
26 26

  
27
import org.cresques.cts.ICoordTrans;
28

  
27 29
import org.gvsig.fmap.geom.Geometry;
28 30
import org.gvsig.fmap.geom.jts.primitive.curve.spline.BaseSpline3DM;
29 31
import org.gvsig.fmap.geom.jts.util.JTSUtils;
......
154 156
    public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException {
155 157
        return JTSUtils.createGeometry(getJTS().buffer(distance));
156 158
    }
159

  
160
    /* (non-Javadoc)
161
     * @see org.gvsig.fmap.geom.jts.primitive.curve.spline.AbstractSpline#reProject(org.cresques.cts.ICoordTrans)
162
     */
163
    @Override
164
    public void reProject(ICoordTrans ct) {
165
        super.reProject(ct);
166
        if (coordinates.size()>=2 && !isClosed()) {
167
            closePrimitive();
168
        }
169
    }
157 170
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/filledspline/FilledSpline2D.java
22 22
 */
23 23
package org.gvsig.fmap.geom.jts.primitive.surface.filledspline;
24 24

  
25
import java.util.Iterator;
26

  
25 27
import com.vividsolutions.jts.geom.Coordinate;
26 28

  
29
import org.cresques.cts.ICoordTrans;
30

  
27 31
import org.gvsig.fmap.geom.Geometry;
32
import org.gvsig.fmap.geom.jts.GeometryJTS;
28 33
import org.gvsig.fmap.geom.jts.primitive.curve.spline.BaseSpline2D;
29 34
import org.gvsig.fmap.geom.jts.util.JTSUtils;
30 35
import org.gvsig.fmap.geom.operation.GeometryOperationException;
......
153 158
    public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException {
154 159
        return JTSUtils.createGeometry(getJTS().buffer(distance));
155 160
    }
161

  
162
    /* (non-Javadoc)
163
     * @see org.gvsig.fmap.geom.jts.primitive.curve.spline.AbstractSpline#reProject(org.cresques.cts.ICoordTrans)
164
     */
165
    @Override
166
    public void reProject(ICoordTrans ct) {
167
        super.reProject(ct);
168
        if (coordinates.size()>=2 && !isClosed()) {
169
            closePrimitive();
170
        }
171
    }
156 172
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/filledspline/FilledSpline3D.java
24 24

  
25 25
import com.vividsolutions.jts.geom.Coordinate;
26 26

  
27
import org.cresques.cts.ICoordTrans;
28

  
27 29
import org.gvsig.fmap.geom.Geometry;
28 30
import org.gvsig.fmap.geom.jts.primitive.curve.spline.BaseSpline3D;
29 31
import org.gvsig.fmap.geom.jts.util.JTSUtils;
......
154 156
    public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException {
155 157
        return JTSUtils.createGeometry(getJTS().buffer(distance));
156 158
    }
159

  
160
    /* (non-Javadoc)
161
     * @see org.gvsig.fmap.geom.jts.primitive.curve.spline.AbstractSpline#reProject(org.cresques.cts.ICoordTrans)
162
     */
163
    @Override
164
    public void reProject(ICoordTrans ct) {
165
        super.reProject(ct);
166
        if (coordinates.size()>=2 && !isClosed()) {
167
            closePrimitive();
168
        }
169
    }
157 170
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/ellipticarc/AbstractEllipticArc.java
27 27
import java.awt.geom.Arc2D;
28 28
import java.awt.geom.PathIterator;
29 29

  
30
import org.cresques.cts.CoordTransRuntimeException;
30 31
import org.cresques.cts.ICoordTrans;
31 32

  
32 33
import org.gvsig.fmap.geom.Geometry;
......
55 56
 */
56 57
public abstract class AbstractEllipticArc extends AbstractSurface {
57 58

  
59
    /**
60
     *
61
     */
62
    private static final long serialVersionUID = 6163269454714321454L;
58 63
    protected Point axis1Start;
59 64
    protected Point axis1End;
60 65
    protected double semiAxis2Length;
......
260 265
        // Ser?a incorrecto para las de deformaci?n en cizallamiento
261 266

  
262 267
        Point2D aux = new Point2D(JTSUtils.getPointAtYAxisInEllipse(axis1Start, axis1End, semiAxis2Length));
268
        try {
263 269
        axis1Start.reProject(ct);
264 270
        axis1End.reProject(ct);
265 271
        aux.reProject(ct);
272
        } catch (CoordTransRuntimeException e) {
273
            //Si ha fallado la reproyecci?n de alguno de los puntos, ponemos todas las coordenadas a 0
274
            axis1Start.setX(0);
275
            axis1Start.setY(0);
276
            axis1End.setX(0);
277
            axis1End.setY(0);
278
            semiAxis2Length = 0;
279
        }
266 280
        try {
267 281
            Point2D transformedMiddlePoint = new Point2D(JTSUtils.getMidPoint(axis1Start, axis1End));
268 282
            semiAxis2Length = transformedMiddlePoint.distance(aux);
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/ellipse/AbstractEllipse.java
26 26
import java.awt.geom.AffineTransform;
27 27
import java.awt.geom.PathIterator;
28 28

  
29
import org.cresques.cts.CoordTransRuntimeException;
29 30
import org.cresques.cts.ICoordTrans;
30 31

  
31 32
import org.gvsig.fmap.geom.Geometry;
......
257 258
     * @see org.gvsig.fmap.geom.Geometry#reProject(org.cresques.cts.ICoordTrans)
258 259
     */
259 260
    public void reProject(ICoordTrans ct) {
260
        //FIXME: Esto solo ser?a correcto para transformaciones de traslaci?n, rotaci?n y escala
261
        // FIXME: Esto solo ser?a correcto para transformaciones de traslaci?n,
262
        // rotaci?n y escala
261 263
        // Ser?a incorrecto para las de deformaci?n en cizallamiento
262 264

  
263 265
        Point2D aux = new Point2D(JTSUtils.getPointAtYAxisInEllipse(init, end, ydist));
264
        init.reProject(ct);
265
        end.reProject(ct);
266
        aux.reProject(ct);
267 266
        try {
267
            init.reProject(ct);
268
            end.reProject(ct);
269
            aux.reProject(ct);
270
        } catch (CoordTransRuntimeException e) {
271
            //Si no se ha podido reproyectar alguno de los puntos, les asignamos 0 a todas las coordenadas
272
            init.setX(0);
273
            init.setY(0);
274
            end.setX(0);
275
            end.setY(0);
276
            ydist = 0;
277
        }
278
        try {
268 279
            Point2D transformedMiddlePoint = new Point2D(JTSUtils.getMidPoint(init, end));
269 280
            ydist = transformedMiddlePoint.distance(aux);
270 281
        } catch (BaseException e) {
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/circle/AbstractCircle.java
26 26
import java.awt.geom.AffineTransform;
27 27
import java.awt.geom.PathIterator;
28 28

  
29
import org.cresques.cts.CoordTransRuntimeException;
29 30
import org.cresques.cts.ICoordTrans;
30 31

  
32
import org.gvsig.fmap.geom.GeometryLocator;
33
import org.gvsig.fmap.geom.exception.CreateGeometryException;
31 34
import org.gvsig.fmap.geom.jts.gputils.DefaultGeneralPathX;
32 35
import org.gvsig.fmap.geom.jts.primitive.point.Point2D;
33 36
import org.gvsig.fmap.geom.jts.primitive.point.PointJTS;
......
41 44
import org.gvsig.fmap.geom.primitive.Polygon;
42 45
import org.gvsig.fmap.geom.primitive.Ring;
43 46
import org.gvsig.tools.exception.BaseException;
47
import org.gvsig.tools.locator.LocatorException;
44 48

  
45 49

  
46 50
/**
......
374 378
        // Ser?a incorrecto para las de deformaci?n en cizallamiento
375 379

  
376 380
        Point2D aux = new Point2D(center.getX(), center.getY()-radius);
377
        center.reProject(ct);
378
        aux.reProject(ct);
379 381
        try {
382
            center.reProject(ct);
383
            aux.reProject(ct);
384
        } catch (CoordTransRuntimeException e){
385
            center.setX(0);
386
            center.setY(0);
387
            radius = 0;
388
            return;
389
        }
390
        try {
380 391
            radius = center.distance(aux);
381 392
        } catch (BaseException e) {
382 393
            throw new UnsupportedOperationException("Error calculating the radius of the transformed circle.", e);
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/point/AbstractPoint.java
211 211
             * is out of the valid range and some computing
212 212
             * problem happens)
213 213
             */
214
            throw new ReprojectionRuntimeException(ct.getPOrig(), ct.getPDest(), p, exc);
214
            this.setX(0);
215
            this.setY(0);
215 216
        }
216 217
    }
217 218

  
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/ring/Ring2DM.java
29 29
import com.vividsolutions.jts.operation.buffer.BufferParameters;
30 30
import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder;
31 31

  
32
import org.cresques.cts.ICoordTrans;
33

  
32 34
import org.gvsig.fmap.geom.Geometry;
33 35
import org.gvsig.fmap.geom.GeometryException;
34 36
import org.gvsig.fmap.geom.aggregate.MultiLine;
......
117 119

  
118 120
          return new Ring2DM(coords);
119 121
      }
122

  
123

  
124
      /* (non-Javadoc)
125
       * @see org.gvsig.fmap.geom.jts.primitive.curve.line.AbstractLine#reProject(org.cresques.cts.ICoordTrans)
126
       */
127
      @Override
128
      public void reProject(ICoordTrans ct) {
129
          super.reProject(ct);
130
          if (coordinates.size()>=2 && !isClosed()) {
131
              closePrimitive();
132
          }
133
      }
120 134
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/ring/Ring3DM.java
29 29
import com.vividsolutions.jts.operation.buffer.BufferParameters;
30 30
import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder;
31 31

  
32
import org.cresques.cts.ICoordTrans;
33

  
32 34
import org.gvsig.fmap.geom.Geometry;
33 35
import org.gvsig.fmap.geom.GeometryException;
34 36
import org.gvsig.fmap.geom.aggregate.MultiLine;
......
122 124

  
123 125
          return new Ring3DM(coords);
124 126
      }
127

  
128

  
129
      /* (non-Javadoc)
130
       * @see org.gvsig.fmap.geom.jts.primitive.curve.line.AbstractLine#reProject(org.cresques.cts.ICoordTrans)
131
       */
132
      @Override
133
      public void reProject(ICoordTrans ct) {
134
          super.reProject(ct);
135
          if (coordinates.size()>=2 && !isClosed()) {
136
              closePrimitive();
137
          }
138
      }
125 139
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/ring/Ring2D.java
31 31
import com.vividsolutions.jts.operation.buffer.BufferParameters;
32 32
import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder;
33 33

  
34
import org.cresques.cts.ICoordTrans;
35

  
34 36
import org.gvsig.fmap.geom.Geometry;
35 37
import org.gvsig.fmap.geom.GeometryException;
36 38
import org.gvsig.fmap.geom.aggregate.MultiLine;
......
122 124

  
123 125
          return new Ring2D(coords);
124 126
      }
127

  
128

  
129
      /* (non-Javadoc)
130
       * @see org.gvsig.fmap.geom.jts.primitive.curve.line.AbstractLine#reProject(org.cresques.cts.ICoordTrans)
131
       */
132
      @Override
133
      public void reProject(ICoordTrans ct) {
134
          super.reProject(ct);
135
          if (coordinates.size()>=2 && !isClosed()) {
136
              closePrimitive();
137
          }
138
      }
125 139
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/ring/Ring3D.java
29 29
import com.vividsolutions.jts.operation.buffer.BufferParameters;
30 30
import com.vividsolutions.jts.operation.buffer.OffsetCurveBuilder;
31 31

  
32
import org.cresques.cts.ICoordTrans;
33

  
32 34
import org.gvsig.fmap.geom.Geometry;
33 35
import org.gvsig.fmap.geom.GeometryException;
34 36
import org.gvsig.fmap.geom.aggregate.MultiLine;
......
118 120

  
119 121
          return new Ring3D(coords);
120 122
      }
123

  
124

  
125
      /* (non-Javadoc)
126
       * @see org.gvsig.fmap.geom.jts.primitive.curve.line.AbstractLine#reProject(org.cresques.cts.ICoordTrans)
127
       */
128
      @Override
129
      public void reProject(ICoordTrans ct) {
130
          super.reProject(ct);
131
          if (coordinates.size()>=2 && !isClosed()) {
132
              closePrimitive();
133
          }
134
      }
121 135
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/DefaultEnvelope.java
24 24

  
25 25
package org.gvsig.fmap.geom.jts.primitive;
26 26

  
27
import java.text.MessageFormat;
27
import java.util.ArrayList;
28 28

  
29
import com.vividsolutions.jts.geom.Coordinate;
30

  
29 31
import org.slf4j.Logger;
30 32
import org.slf4j.LoggerFactory;
31 33

  
......
35 37
import org.gvsig.fmap.geom.GeometryLocator;
36 38
import org.gvsig.fmap.geom.GeometryManager;
37 39
import org.gvsig.fmap.geom.exception.CreateGeometryException;
40
import org.gvsig.fmap.geom.jts.GeometryJTS;
41
import org.gvsig.fmap.geom.jts.util.ArrayListCoordinateSequence;
42
import org.gvsig.fmap.geom.jts.util.JTSUtils;
38 43
import org.gvsig.fmap.geom.primitive.Envelope;
39 44
import org.gvsig.fmap.geom.primitive.EnvelopeNotInitializedException;
40 45
import org.gvsig.fmap.geom.primitive.Point;
......
70 75

  
71 76
    protected boolean isEmpty;
72 77

  
78
    private com.vividsolutions.jts.geom.Polygon jtsGeom = null;
79

  
73 80
    protected static GeometryManager manager = GeometryLocator.getGeometryManager();
74 81

  
75 82
    public DefaultEnvelope(){
......
278 285
        if (max != null){
279 286
            isEmpty = false;
280 287
        }
288
        jtsGeom = null;
281 289
    }
282 290

  
283 291
    /* (non-Javadoc)
......
288 296
        if (min != null){
289 297
            isEmpty = false;
290 298
        }
299
        jtsGeom = null;
291 300
    }
292 301

  
293 302
    public static void registerPersistent() {
......
338 347
        isEmpty = true;
339 348
    }
340 349

  
350
    /* (non-Javadoc)
351
     * @see org.gvsig.fmap.geom.primitive.Envelope#intersects(org.gvsig.fmap.geom.Geometry)
352
     */
353
    @Override
354
    public boolean intersects(Geometry geometry) {
355
        if(geometry instanceof GeometryJTS){
356
            return getJTS().intersects(((GeometryJTS)geometry).getJTS());
357
        }
358
        return false;
359
    }
360

  
361

  
362
    private com.vividsolutions.jts.geom.Geometry getJTS() {
363
        if (jtsGeom == null) {
364
            ArrayListCoordinateSequence coordinates = new ArrayListCoordinateSequence(new ArrayList<Coordinate>());
365
            coordinates.add(new com.vividsolutions.jts.geom.Coordinate(min.getX(), min.getY()));
366
            coordinates.add(new com.vividsolutions.jts.geom.Coordinate(getMaximum(0), getMinimum(1)));
367
            coordinates.add(new com.vividsolutions.jts.geom.Coordinate(max.getX(), max.getY()));
368
            coordinates.add(new com.vividsolutions.jts.geom.Coordinate(getMinimum(0), getMaximum(1)));
369
            coordinates.add(new com.vividsolutions.jts.geom.Coordinate(min.getX(), min.getY()));
370
            jtsGeom = JTSUtils.createJTSPolygon(coordinates);
371
        }
372
        return jtsGeom;
373
    }
341 374
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/Envelope2D.java
24 24

  
25 25
package org.gvsig.fmap.geom.jts.primitive;
26 26

  
27
import org.cresques.cts.CoordTransRuntimeException;
27 28
import org.cresques.cts.ICoordTrans;
28 29
import org.slf4j.Logger;
29 30
import org.slf4j.LoggerFactory;
......
127 128

  
128 129
	    double xmin = getMinimum(0);
129 130
	    double ymin = getMinimum(1);
130
	    double step_w = 0.25 * (getMaximum(0) - xmin);
131
	    double step_h = 0.25 * (getMaximum(1) - ymin);
131
	    double step_w = 0.0625 * (getMaximum(0) - xmin);
132
	    double step_h = 0.125 * (getMaximum(1) - ymin);
132 133

  
133 134
	    java.awt.geom.Point2D sample = null;
134 135
	    java.awt.geom.Point2D sample_trans = null;
135 136
	    // Init with worst values
136 137
        java.awt.geom.Point2D res_min = new java.awt.geom.Point2D.Double(
137
            Double.MAX_VALUE, Double.MAX_VALUE);
138
            Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
138 139
        java.awt.geom.Point2D res_max = new java.awt.geom.Point2D.Double(
139
            -Double.MAX_VALUE, -Double.MAX_VALUE);
140
            Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
140 141

  
141 142
        int added = 0;
142
	    for (int i=0; i<5; i++) {
143
	        for (int j=0; j<5; j++) {
143
	    for (int i=0; i<=16; i++) {
144
	        for (int j=0; j<=8; j++) {
144 145
	                sample = new java.awt.geom.Point2D.Double(
145 146
	                    xmin + i * step_w,
146 147
	                    ymin + j * step_h);
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/curve/spline/AbstractSpline.java
336 336
        if (ct == null) {
337 337
            return;
338 338
        }
339
        ArrayListCoordinateSequence tmpCoordinates = new ArrayListCoordinateSequence();
340
        tmpCoordinates.ensureCapacity(coordinates.size());
339 341
        for (Iterator<Coordinate> iterator = coordinates.iterator(); iterator.hasNext();) {
340 342
            Coordinate coordinate = (Coordinate) iterator.next();
341 343

  
......
344 346
                p = ct.convert(p, p);
345 347
                coordinate.x = p.getX();
346 348
                coordinate.y = p.getY();
349
                tmpCoordinates.add(coordinate);
347 350
            } catch (Exception exc) {
348 351
                /*
349 352
                 * This can happen when the reprojection lib is unable
......
351 354
                 * is out of the valid range and some computing
352 355
                 * problem happens)
353 356
                 */
354
                throw new ReprojectionRuntimeException(ct.getPOrig(), ct.getPDest(), p, exc);
355 357
            }
356 358
        }
359
        coordinates=tmpCoordinates;
357 360
    }
358 361

  
359 362
    /*
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/curve/arc/AbstractArc.java
26 26
import java.awt.geom.AffineTransform;
27 27
import java.awt.geom.PathIterator;
28 28

  
29
import org.cresques.cts.CoordTransRuntimeException;
29 30
import org.cresques.cts.ICoordTrans;
30 31

  
31 32
import org.gvsig.fmap.geom.Geometry;
......
210 211
        //FIXME: Esto solo ser?a correcto para transformaciones de traslaci?n, rotaci?n y escala
211 212
        // Ser?a incorrecto para las de deformaci?n en cizallamiento
212 213

  
214
        try {
213 215
        init.reProject(ct);
214 216
        middle.reProject(ct);
215 217
        end.reProject(ct);
218
        } catch (CoordTransRuntimeException e){
219
            //Si ha fallado la reproyecci?n de alguno de los puntos, ponemos todas las coordenadas a 0
220
            init.setX(0);
221
            init.setY(0);
222
            middle.setX(0);
223
            middle.setY(0);
224
            end.setX(0);
225
            end.setY(0);
226
        }
216 227
    }
217 228

  
218 229
    /* (non-Javadoc)
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/curve/line/AbstractLine.java
24 24

  
25 25
import java.awt.Shape;
26 26
import java.awt.geom.AffineTransform;
27
import java.awt.geom.GeneralPath;
27 28
import java.awt.geom.PathIterator;
28 29
import java.util.Collections;
29 30
import java.util.Iterator;
30 31

  
31 32
import com.vividsolutions.jts.geom.Coordinate;
32
import java.awt.geom.GeneralPath;
33 33

  
34 34
import org.apache.commons.lang3.StringUtils;
35 35
import org.cresques.cts.ICoordTrans;
......
49 49
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
50 50
import org.gvsig.fmap.geom.primitive.GeneralPathX;
51 51
import org.gvsig.fmap.geom.primitive.IGeneralPathX;
52
import org.gvsig.fmap.geom.primitive.OrientablePrimitive;
53 52
import org.gvsig.fmap.geom.primitive.Point;
54 53

  
55 54
/**
......
97 96
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
98 97
        }
99 98

  
100
    }    
99
    }
101 100
    /**
102 101
    *
103 102
    */
......
114 113
    }
115 114

  
116 115
    abstract public Point getVertex(int index);
117
    
116

  
118 117
    public Iterator<Point> iterator() {
119 118
        return new VertexIterator();
120 119
    }
......
327 326
        if (ct == null) {
328 327
            return;
329 328
        }
329
        ArrayListCoordinateSequence tmpCoordinates = new ArrayListCoordinateSequence();
330
        tmpCoordinates.ensureCapacity(coordinates.size());
330 331
        for (Iterator<Coordinate> iterator = coordinates.iterator(); iterator.hasNext();) {
331 332
            Coordinate coordinate = (Coordinate) iterator.next();
332 333

  
......
335 336
                p = ct.convert(p, p);
336 337
                coordinate.x = p.getX();
337 338
                coordinate.y = p.getY();
339
                tmpCoordinates.add(coordinate);
338 340
            } catch (Exception exc) {
339 341
                /*
340 342
                 * This can happen when the reprojection lib is unable
......
342 344
                 * is out of the valid range and some computing
343 345
                 * problem happens)
344 346
                 */
345
                throw new ReprojectionRuntimeException(ct.getPOrig(), ct.getPDest(), p, exc);
346 347
            }
347 348
        }
349
        coordinates=tmpCoordinates;
348 350
    }
349 351

  
350 352
    /*
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/utils/SHP.java
216 216
		}
217 217
		String[] ends = new String[] { "prj", "PRJ", "Prj", "pRj", "PRj",
218 218
				"prJ", "PrJ", "pRJ" };
219
		File shxFile = findEnd(str, files, ends);
220
		return shxFile;
219
		File prjFile = findEnd(str, files, ends);
220
		return prjFile;
221 221
	}
222 222

  
223 223
    private static File findEnd(String str,File[] files, String[] ends) {
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
64 64
import org.gvsig.fmap.dal.store.shp.utils.ISHPFile;
65 65
import org.gvsig.fmap.dal.store.shp.utils.SHPFile2;
66 66
import org.gvsig.fmap.geom.Geometry;
67
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
68 67
import org.gvsig.fmap.geom.GeometryLocator;
69 68
import org.gvsig.fmap.geom.GeometryManager;
70 69
import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
......
111 110
    public Object getDynValue(String name) throws DynFieldNotFoundException {
112 111
        if (DataStore.METADATA_CRS.equalsIgnoreCase(name)) {
113 112

  
114
            /*
115
             * String srs =  this.shpFile.getSRSParameters();
116
             if (srs != null){
117
             // This can be non null but not sure how to handle
118
             }
119
             */
120 113
            return this.getShpParameters().getCRS();
121 114

  
122 115
        } else if (DataStore.METADATA_ENVELOPE.equalsIgnoreCase(name)) {
......
507 500
                        close();
508 501
                        resourceCloseRequest();
509 502

  
503
                        //FIXME: Descomentarizar este c?digo cuando se consiga exportar la proyecci?n al formato de WKT_ESRI.
504
//                        File tmpPrjFile = SHP.getPrjFile(tmpParams.getSHPFile());
505
//                        try {
506
//                        FileUtils.writeStringToFile(tmpPrjFile, tmpParams.getCRS().export(ICRSFactory.FORMAT_WKT_ESRI));
507
//                        } catch(Exception e) {
508
//                            logger.info("Can't write prj file '"+tmpPrjFile.getAbsolutePath()+"'.");
509
//                        }
510

  
510 511
                        if (!shpParams.getDBFFile().delete()) {
511 512
                            logger.debug("Can't delete dbf file '"+shpParams.getDBFFile()+"'.");
512 513
                            throw new IOException("Can't delete dbf '"+FilenameUtils.getBaseName(shpParams.getDBFFileName())+"' file to replace with the new dbf.\nThe new dbf is in temporary file '"+str_base+"'");
......
519 520
                            logger.debug("Can't delete dbf file '"+shpParams.getSHXFile()+"'.");
520 521
                            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+"'");
521 522
                        }
523
                        //FIXME: Descomentarizar este c?digo cuando se consiga exportar la proyecci?n al formato de WKT_ESRI.
524
//                        if (SHP.getPrjFile(shpParams.getSHPFile()).exists()) {
525
//                            if (!SHP.getPrjFile(shpParams.getSHPFile()).delete()) {
526
//                                logger.debug("Can't delete prj file '" + SHP.getPrjFile(shpParams.getSHPFile()) + "'.");
527
//                                throw new IOException("Can't delete shx '"
528
//                                    + FilenameUtils.getBaseName(SHP.getPrjFile(shpParams.getSHPFile()).getPath())
529
//                                    + "' file to replace with the new shx.\nThe new shx is in temporary file '"
530
//                                    + str_base + "'");
531
//                            }
532
//                        }
522 533
                        FileUtils.moveFile(
523 534
                                tmpParams.getDBFFile(),
524 535
                                shpParams.getDBFFile());
......
528 539
                        FileUtils.moveFile(
529 540
                                tmpParams.getSHXFile(),
530 541
                                shpParams.getSHXFile());
542
                        //FIXME: Descomentarizar este c?digo cuando se consiga exportar la proyecci?n al formato de WKT_ESRI.
543
//                        FileUtils.moveFile(
544
//                            tmpPrjFile,
545
//                            SHP.getPrjFile(shpParams.getSHPFile()));
531 546

  
532 547
                        resourcesNotifyChanges();
533 548
                        initFeatureType();
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/SHPStoreParameters.java
25 25
package org.gvsig.fmap.dal.store.shp;
26 26

  
27 27
import java.io.File;
28
import java.io.IOException;
29

  
30
import org.apache.commons.io.FileUtils;
28 31
import org.apache.commons.lang3.BooleanUtils;
32
import org.cresques.cts.ICRSFactory;
33
import org.cresques.cts.IProjection;
29 34

  
30
import org.cresques.cts.IProjection;
35
import org.gvsig.fmap.crs.CRSFactory;
31 36
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
32 37
import org.gvsig.fmap.dal.store.dbf.DBFStoreParameters;
33 38
import org.gvsig.fmap.dal.store.shp.utils.SHP;
......
51 56
		fixParameters();
52 57
		super.validate();
53 58
	}
54
	
59

  
55 60
	public void fixParameters() {
56 61
		File file = this.getSHPFile();
57 62
		if( file!=null ) {
......
63 68
			}
64 69
		}
65 70
	}
66
	
71

  
67 72
	public SHPStoreParameters(String parametersDefinitionName) {
68 73
		super(parametersDefinitionName, SHPStoreProvider.NAME);
69 74
	}
......
82 87
	public void setFile(String fileName) {
83 88
		this.setSHPFile(fileName);
84 89
	}
85
	
86
	
90

  
91

  
87 92
	public String getSHPFileName() {
88 93
		if( this.getSHPFile()==null ) {
89 94
			return null;
......
103 108
		if (this.getSHXFile() == null) {
104 109
			this.setSHXFile(SHP.getShxFile(file));
105 110
		}
111
        if (getCRS() == null){
112
            String wktEsri = loadPrj(file);
113
            if (wktEsri != null) {
114
                IProjection proj = CRSFactory.getCRSFactory().get(ICRSFactory.FORMAT_WKT_ESRI, wktEsri);
115
                setCRS(proj);
116
            }
117
        }
118

  
106 119
	}
107 120

  
108 121
	public void setSHPFile(String fileName) {
......
114 127
		if (this.getSHXFile() == null) {
115 128
			this.setSHXFile(SHP.getShxFile(file));
116 129
		}
130
        if (getCRS() == null){
131
            String wktEsri = loadPrj(file);
132
            if (wktEsri != null) {
133
                IProjection proj = CRSFactory.getCRSFactory().get(ICRSFactory.FORMAT_WKT_ESRI, wktEsri);
134
                setCRS(proj);
135
            }
136
        }
117 137
	}
118 138

  
139
	private String loadPrj(File shpFile){
140
        File prjFile = SHP.getPrjFile(shpFile);
141
        if (prjFile.exists()) {
142
            try {
143
                return FileUtils.readFileToString(prjFile);
144
            } catch (IOException e) {
145
                return null;
146
            }
147
        }
148
        return null;
149
	}
150

  
119 151
	public String getSHXFileName() {
120 152
		if( this.getSHXFile()==null ) {
121 153
			return null;
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/pom.xml
46 46
      <type>test-jar</type>
47 47
      <scope>test</scope>
48 48
    </dependency>
49
    
49

  
50 50
    <!--
51 51
    <dependency>
52 52
      <groupId>org.gvsig</groupId>
......
65 65
      <scope>test</scope>
66 66
    </dependency>
67 67

  
68
    <dependency>
69
      <groupId>org.gvsig</groupId>
70
      <artifactId>org.gvsig.projection.api</artifactId>
71
    </dependency>
72

  
68 73
  </dependencies>
69 74

  
70 75
  <build>
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/vectorial/IntersectsEnvelopeEvaluator.java
24 24
package org.gvsig.fmap.mapcontext.layers.vectorial;
25 25

  
26 26
import org.cresques.cts.IProjection;
27

  
27 28
import org.gvsig.fmap.dal.exception.DataEvaluatorRuntimeException;
28 29
import org.gvsig.fmap.dal.feature.Feature;
29 30
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
......
44 45
	private Envelope envelopeTrans;
45 46
	private boolean isDefault;
46 47
	private String srs;
48
	String defaultGeometryAttributeName;
47 49

  
48 50
	public IntersectsEnvelopeEvaluator(Envelope envelope,
49 51
			IProjection envelopeProjection, FeatureType featureType,
......
51 53
		FeatureAttributeDescriptor fad = (FeatureAttributeDescriptor) featureType
52 54
				.get(geomName);
53 55

  
54
		this.isDefault = featureType.getDefaultGeometryAttributeName().equals(
56
		defaultGeometryAttributeName = featureType.getDefaultGeometryAttributeName();
57
        this.isDefault = defaultGeometryAttributeName.equals(
55 58
				geomName);
56 59
		this.envelope = envelope;
57 60
		// this.srs = envelopeProjection.getAbrev();
......
74 77

  
75 78
	}
76 79

  
77
	public Object evaluate(EvaluatorData data) throws EvaluatorException {
78
		Envelope featureEnvelope;
79
		if (isDefault) {
80
			featureEnvelope = ((Feature) data.getContextValue("feature"))
81
					.getDefaultEnvelope();
82
		} else {
83
                    Geometry geom = (Geometry) data.getDataValue(geomName);
84
                    if( geom == null ) {
85
                        return Boolean.FALSE;
86
                    }
87
                    featureEnvelope = geom.getEnvelope();
88
		}
89
		return new Boolean(envelopeTrans.intersects(featureEnvelope));
80
    public Object evaluate(EvaluatorData data) throws EvaluatorException {
81
        Envelope featureEnvelope;
82
        Geometry geom = null;
83
        if (isDefault) {
84
            geom = (Geometry) data.getDataValue(defaultGeometryAttributeName);
85
            featureEnvelope = ((Feature) data.getContextValue("feature")).getDefaultEnvelope();
86
        } else {
87
            geom = (Geometry) data.getDataValue(geomName);
88
            if (geom == null) {
89
                return Boolean.FALSE;
90
            }
91
            featureEnvelope = geom.getEnvelope();
92
        }
93
        if (envelopeTrans.intersects(featureEnvelope)) {
94
            return new Boolean(envelopeTrans.intersects(geom));
95
        }
96
        return Boolean.FALSE;
97
    }
90 98

  
91
	}
92

  
93 99
	public String getName() {
94 100
		return "intersects envelope";
95 101
	}
trunk/org.gvsig.desktop/pom.xml
1426 1426
                </plugin>
1427 1427

  
1428 1428
                <plugin>
1429
                    <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
1430
                    <groupId>org.eclipse.m2e</groupId>
1431
                    <artifactId>lifecycle-mapping</artifactId>
1432
                    <version>1.0.0</version>
1433
                    <configuration>
1434
                        <lifecycleMappingMetadata>
1435
                            <pluginExecutions>
1436
                                <pluginExecution>
1437
                                    <pluginExecutionFilter>
1438
                                        <groupId>org.gvsig</groupId>
1439
                                        <artifactId> org.gvsig.installer.maven </artifactId>
1440
                                        <versionRange> [2.0.10-SNAPSHOT,) </versionRange>
1441
                                        <goals>
1442
                                            <goal>write-info</goal>
1443
                                        </goals>
1444
                                    </pluginExecutionFilter>
1445
                                    <action>
1446
                                        <ignore />
1447
                                    </action>
1448
                                </pluginExecution>
1449
                                <pluginExecution>
1450
                                    <pluginExecutionFilter>
1451
                                        <groupId> org.codehaus.mojo </groupId>
1452
                                        <artifactId> properties-maven-plugin </artifactId>
1453
                                        <versionRange> [1.0-alpha-2,) </versionRange>
1454
                                        <goals>
1455
                                            <goal>
1456
                                                read-project-properties
1457
                                            </goal>
1458
                                        </goals>
1459
                                    </pluginExecutionFilter>
1460
                                    <action>
1461
                                        <ignore />
1462
                                    </action>
1463
                                </pluginExecution>
1464
                                <pluginExecution>
1465
                                    <pluginExecutionFilter>
1466
                                        <groupId>org.codehaus.gmaven</groupId>
1467
                                        <artifactId>gmaven-plugin</artifactId>
1468
                                        <versionRange>[1.4,)</versionRange>
1469
                                        <goals>
1470
                                            <goal>execute</goal>
1471
                                        </goals>
1472
                                    </pluginExecutionFilter>
1473
                                    <action>
1474
                                        <ignore />
1475
                                    </action>
1476
                                </pluginExecution>
1477
                                <pluginExecution>
1478
                                    <pluginExecutionFilter>
1479
                                        <groupId>org.apache.maven.plugins</groupId>
1480
                                        <artifactId>
1481
                                            maven-dependency-plugin
1482
                                        </artifactId>
1483
                                        <versionRange>[2.1,)</versionRange>
1484
                                        <goals>
1485
                                            <goal>unpack</goal>
1486
                                        </goals>
1487
                                    </pluginExecutionFilter>
1488
                                    <action>
1489
                                        <ignore />
1490
                                    </action>
1491
                                </pluginExecution>
1492
                            </pluginExecutions>
1493
                        </lifecycleMappingMetadata>
1494
                    </configuration>
1495
                </plugin>
1496

  
1497
                <plugin>
1498 1429
                    <groupId>org.apache.maven.plugins</groupId>
1499 1430
                    <artifactId>maven-compiler-plugin</artifactId>
1500 1431
                    <version>2.3.2</version>
......
2583 2514
        <!-- External project versions -->
2584 2515
        <gvsig.tools.version>3.0.65</gvsig.tools.version>
2585 2516
        <gvsig.proj.version>1.0.1</gvsig.proj.version>
2586
        <gvsig.projection.api.version>2.0.17</gvsig.projection.api.version>
2517
        <gvsig.projection.api.version>2.0.20</gvsig.projection.api.version>
2587 2518

  
2588 2519
        <gvsig.product.folder.path>${basedir}/target/product</gvsig.product.folder.path>
2589 2520

  
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/legend/impl/AbstractVectorialLegend.java
87 87

  
88 88
/**
89 89
 * Base implementation for Vectorial data Legends.
90
 * 
90
 *
91 91
 * Provides a draw method implementation which loads the {@link Feature}s and
92 92
 * uses the {@link ISymbol} objects to draw the {@link Geometry} objects.
93
 * 
93
 *
94 94
 * @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team
95 95
 */
96 96
public abstract class AbstractVectorialLegend extends AbstractLegend implements
97 97
IVectorLegend {
98
	
98

  
99 99
	private static final Logger LOG = LoggerFactory
100 100
			.getLogger(AbstractVectorialLegend.class);
101 101

  
......
123 123
        this.zSort = zSort;
124 124
        addLegendListener(zSort);
125 125
    }
126
    
126

  
127 127
    @SuppressWarnings("unchecked")
128 128
    public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
129 129
        Cancellable cancel, double scale, Map queryParameters,
......
133 133
        draw(image, g, viewPort, cancel, scale, queryParameters, coordTrans,
134 134
            featureStore, null, dpi);
135 135
    }
136
    
136

  
137 137
    @SuppressWarnings("unchecked")
138 138
    public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
139 139
        Cancellable cancel, double scale, Map queryParameters,
......
152 152
        print(g, viewPort, cancel, scale, queryParameters, coordTrans,
153 153
            featureStore, null, properties);
154 154
    }
155
    
155

  
156 156
    @SuppressWarnings("unchecked")
157 157
    public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
158 158
        double scale, Map queryParameters, ICoordTrans coordTrans,
......
178 178

  
179 179
            int mapLevelCount = (useZSort) ? zSort.getLevelCount() : 1;
180 180
            for (int mapPass = 0; mapPass < mapLevelCount; mapPass++) {
181
                
181

  
182 182
                Envelope vp_env_in_store_crs = null;
183 183
                IProjection store_crs = null;
184 184
                if (coordTrans != null) {
......
191 191
                    vp_env_in_store_crs = viewPort.getAdjustedEnvelope();
192 192
                    store_crs = viewPort.getProjection();
193 193
                }
194
                
194

  
195 195
                FeatureQuery feat_query = fquery;
196 196
                Envelope store_env = featureStore.getEnvelope();
197 197
                boolean use_intersection_cond = false;
......
205 205
                        use_intersection_cond = true;
206 206
                    }
207 207
                }
208
                
208

  
209 209
                if (use_intersection_cond) {
210
                    FeatureType ft = featureStore.getDefaultFeatureType(); 
210
                    FeatureType ft = featureStore.getDefaultFeatureType();
211 211
                    IntersectsEnvelopeEvaluator iee =
212 212
                        new IntersectsEnvelopeEvaluator(
213 213
                            vp_env_in_store_crs,
......
220 220
                    }
221 221
                    feat_query.addFilter(iee);
222 222
                }
223
                
223

  
224 224
                // 'feat_query' can still be NULL here, so we only filter
225 225
                // the featureStore if it's not null
226 226
                if (feat_query == null) {
......
235 235
                    Geometry geom = feat.getDefaultGeometry();
236 236
                    if (geom==null) {
237 237
                    	continue;
238
                    }                    
238
                    }
239 239
                    // Reprojection if needed
240 240
                    if (coordTrans != null) {
241 241
                        geom = geom.cloneGeometry();
......
363 363
		}
364 364

  
365 365
		IProjection dataProjection;
366
		Envelope reprojectedDataEnvelop;
367

  
366
		Envelope dataEnvelope;
367
		Envelope reprojectedDataEnvelope;
368
		// Gets the view envelope
369
		Envelope viewPortEnvelope = viewPort.getAdjustedEnvelope();
370
        Envelope reprojectedViewPortEnvelope;
368 371
		try {
372
		    dataEnvelope = featureStore.getEnvelope();
369 373
			if (coordTrans == null) {
370 374
				dataProjection = featureStore.getDefaultFeatureType()
371 375
						.getDefaultSRS();
......
376 380
					dataProjection = viewPort.getProjection();
377 381
				}
378 382

  
379
				reprojectedDataEnvelop = featureStore.getEnvelope();
383
				reprojectedDataEnvelope = dataEnvelope;
384
                reprojectedViewPortEnvelope = viewPortEnvelope;
380 385
			} else {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff