Revision 21888 branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/FLyrVect.java

View differences:

FLyrVect.java
41 41
package org.gvsig.fmap.mapcontext.layers.vectorial;
42 42

  
43 43
import java.awt.Graphics2D;
44
import java.awt.Point;
44 45
import java.awt.geom.AffineTransform;
45 46
import java.awt.geom.Point2D;
46 47
import java.awt.geom.Rectangle2D;
......
80 81
import org.gvsig.fmap.mapcontext.layers.FLyrDefault;
81 82
import org.gvsig.fmap.mapcontext.layers.FLyrVectLinkProperties;
82 83
import org.gvsig.fmap.mapcontext.layers.LayerEvent;
83
import org.gvsig.fmap.mapcontext.layers.SelectionSupport;
84 84
import org.gvsig.fmap.mapcontext.layers.SpatialCache;
85 85
import org.gvsig.fmap.mapcontext.layers.XMLException;
86
import org.gvsig.fmap.mapcontext.layers.operations.AlphanumericData;
87 86
import org.gvsig.fmap.mapcontext.layers.operations.ClassifiableVectorial;
88 87
import org.gvsig.fmap.mapcontext.layers.operations.ILabelable;
88
import org.gvsig.fmap.mapcontext.layers.operations.InfoByPoint;
89 89
import org.gvsig.fmap.mapcontext.layers.operations.SingleLayer;
90 90
import org.gvsig.fmap.mapcontext.layers.operations.VectorialData;
91
import org.gvsig.fmap.mapcontext.layers.operations.XMLItem;
91 92
import org.gvsig.fmap.mapcontext.rendering.legend.IClassifiedVectorLegend;
92 93
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend;
93 94
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
......
110 111
 */
111 112

  
112 113
// TODO Cuando no sea para pruebas debe no ser public
113
public class FLyrVect extends FLyrDefault implements ILabelable,
114
        ClassifiableVectorial, SingleLayer, VectorialData, //RandomVectorialData,
115
        AlphanumericData //, InfoByPoint
116
        {
114
public class FLyrVect extends FLyrDefault implements ILabelable, VectorialData, InfoByPoint, ClassifiableVectorial, SingleLayer{
117 115
    private static Logger logger = Logger.getLogger(FLyrVect.class.getName());
118 116

  
119 117
    /** Leyenda de la capa vectorial */
......
122 120
//    private ReadableVectorial source;
123 121
//    private SelectableDataSource sds;
124 122
    private FeatureStore featureStore=null;
125
    private SelectionSupport selectionSupport = new SelectionSupport();
123
//    private SelectionSupport selectionSupport = new SelectionSupport();
126 124
    private SpatialCache spatialCache = new SpatialCache();
127 125
    private boolean spatialCacheEnabled = false;
128 126

  
......
294 292
			Point2D pt2 = new Point2D.Double(rAux.getMaximum(0), rAux.getMaximum(1));
295 293
			pt1 = ct.convert(pt1, null);
296 294
			pt2 = ct.convert(pt2, null);
297
			rAux = new DefaultEnvelope(2,new double[]{pt1.getX(),pt2.getX()},new double[]{pt1.getY(),pt2.getY()});//new Rectangle2D.Double();
295
			rAux = new DefaultEnvelope(2,new double[]{pt1.getX(),pt1.getY()},new double[]{pt2.getX(),pt2.getY()});//new Rectangle2D.Double();
298 296
		}
299 297
		//Esto es para cuando se crea una capa nueva con el fullExtent de ancho y alto 0.
300 298
		if (rAux.getMaximum(0)-rAux.getMinimum(0)==0 && rAux.getMaximum(1)-rAux.getMinimum(1)==0) {
......
316 314
     */
317 315
    public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
318 316
    		Cancellable cancel, double scale) throws ReadException {
317
    	DrawOperationContext doc=new DrawOperationContext();
318
    	doc.setViewPort(viewPort);
319 319
    	boolean bDrawShapes = true;
320 320
    	if (legend instanceof SingleSymbolLegend) {
321 321
    		bDrawShapes = legend.getDefaultSymbol().isShapeVisible();
......
350 350

  
351 351
    			FeatureCollection featureCollection=null;
352 352
    			featureCollection = (FeatureCollection)featureStore.getDataCollection(
353
    					fieldList.toArray(new String[fieldList.size()]),
353
    					new String[]{featureStore.getDefaultFeatureType().getDefaultGeometry()},
354 354
    					null,//filter
355 355
    					null);//order
356 356
    			Iterator it = featureCollection.iterator();
......
481 481
									imageLevels[symbolLevel].setRGB(x, y, mySym.getOnePointRgb());
482 482
								} else {
483 483
									if (!bDrawCartographicSupport) {
484
										DrawOperationContext doc=new DrawOperationContext();
485 484
										doc.setGraphics(graphics[symbolLevel]);
486
										doc.setViewPort(viewPort);
487 485
										doc.setSymbol(mySym);
488 486
										doc.setCancellable(cancel);
489 487
										geom.invokeOperation(DrawInts.CODE,doc);
490 488
									} else {
491
										DrawOperationContext doc=new DrawOperationContext();
492 489
										doc.setGraphics(graphics[symbolLevel]);
493
										doc.setViewPort(viewPort);
494 490
										doc.setSymbol(mySym);
495 491
										doc.setCancellable(cancel);
496 492
										doc.setDPI(dpi);
......
501 497
						} else {
502 498
							// else, just draw the symbol in its level
503 499
							if (!bDrawCartographicSupport) {
504
								DrawOperationContext doc=new DrawOperationContext();
505 500
								doc.setGraphics(graphics[zSort.getSymbolLevel(sym)]);
506
								doc.setViewPort(viewPort);
507 501
								doc.setSymbol(sym);
508 502
								doc.setCancellable(cancel);
509 503
								geom.invokeOperation(DrawInts.CODE,doc);
510 504
							} else {
511
								DrawOperationContext doc=new DrawOperationContext();
512 505
								doc.setGraphics(graphics[zSort.getSymbolLevel(sym)]);
513
								doc.setViewPort(viewPort);
514 506
								doc.setSymbol((ISymbol)csSym);
515 507
								doc.setCancellable(cancel);
516 508
								doc.setDPI(dpi);
......
543 535
						} else {
544 536

  
545 537
							if (!bDrawCartographicSupport) {
546
								DrawOperationContext doc=new DrawOperationContext();
547 538
								doc.setGraphics(g);
548
								doc.setViewPort(viewPort);
549 539
								doc.setSymbol(sym);
550 540
								doc.setCancellable(cancel);
551 541
								geom.invokeOperation(DrawInts.CODE,doc);
552 542
							} else {
553
								DrawOperationContext doc=new DrawOperationContext();
554 543
								doc.setGraphics(g);
555
								doc.setViewPort(viewPort);
556 544
								doc.setSymbol((ISymbol)csSym);
557 545
								doc.setCancellable(cancel);
558 546
								doc.setDPI(dpi);
......
1798 1786
		return (FeatureStore)getDataStore();
1799 1787
	}
1800 1788

  
1801
	public FeatureCollection queryByPoint(Point2D mapPoint, double tol) {
1802
		// TODO Auto-generated method stub
1803
		return null;
1789
	public FeatureCollection queryByPoint(Point2D mapPoint, double tol) throws ReadException {
1790
		double halfTol=tol*0.5;
1791
		Envelope envelope=new DefaultEnvelope(mapPoint.getX()-halfTol,mapPoint.getY()-halfTol,mapPoint.getX()+halfTol,mapPoint.getY()+halfTol);
1792
		return queryByEnvelope(envelope);
1804 1793
	}
1805 1794

  
1806
	public FeatureCollection queryByShape(Geometry geom) {
1807
		// TODO Auto-generated method stub
1808
		return null;
1795
	public FeatureCollection queryByGeometry(Geometry geom) throws ReadException {
1796
		//TODO falta pasar bien el filtro con la geom
1797
		return (FeatureCollection)getFeatureStore().getDataCollection(getFeatureStore().getDefaultFeatureType(),geom.toString(),null);
1809 1798
	}
1810 1799

  
1811
	public FeatureCollection queryByEnvelope(Envelope rect) {
1800
	public FeatureCollection queryByEnvelope(Envelope rect) throws ReadException {
1801
		//TODO falta pasar bien el filtro con el Envelope
1802
		return (FeatureCollection)getFeatureStore().getDataCollection(getFeatureStore().getDefaultFeatureType(),rect.toString(),null);
1803
	}
1804

  
1805
	public XMLItem[] getInfo(Point p, double tolerance, Cancellable cancel) throws ReadException, LoadLayerException {
1812 1806
		// TODO Auto-generated method stub
1813 1807
		return null;
1814 1808
	}
1815

  
1816 1809
 }

Also available in: Unified diff