Revision 5908

View differences:

trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrAnnotation.java
9 9
import java.io.File;
10 10
import java.io.IOException;
11 11
import java.util.ArrayList;
12
import java.util.BitSet;
13 12

  
14 13
import org.cresques.cts.ICoordTrans;
15 14
import org.cresques.cts.IProjection;
......
41 40
import com.iver.cit.gvsig.fmap.operations.strategies.StrategyManager;
42 41
import com.iver.cit.gvsig.fmap.operations.strategies.VisitException;
43 42
import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend;
44
import com.iver.cit.gvsig.fmap.spatialindex.IPersistentSpatialIndex;
45 43
import com.iver.cit.gvsig.fmap.spatialindex.QuadtreeJts;
46
import com.iver.cit.gvsig.fmap.spatialindex.RTreeSptLib;
47
import com.iver.cit.gvsig.fmap.spatialindex.SpatialIndexException;
48
import com.iver.utiles.FileUtils;
49 44
import com.iver.utiles.XMLEntity;
50 45
import com.iver.utiles.swing.threads.Cancellable;
51
import com.vividsolutions.jts.geom.Coordinate;
52
import com.vividsolutions.jts.geom.Envelope;
53
import com.vividsolutions.jts.index.quadtree.Quadtree;
54 46

  
55 47
/**
56 48
 * DOCUMENT ME!
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrDefault.java
86 86

  
87 87
    private Strategy privateStrategy = null;
88 88
	private boolean isediting;
89
	
89

  
90 90
	private Hashtable properties = new Hashtable();
91
	
91

  
92 92
	public Object getProperty(Object key)
93 93
	{
94 94
		return properties.get(key);
......
96 96
	public void setProperty (Object key, Object val){
97 97
		properties.put(key, val);
98 98
	}
99
	
99

  
100 100
	/**
101 101
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setActive(boolean)
102 102
	 */
......
172 172
	 * @param proj Proyecci?n.
173 173
	 */
174 174
	public void setProjection(IProjection proj) {
175
		projection = proj;   
175
		projection = proj;
176 176
        // Comprobar que la proyecci?n es la misma que la de FMap
177
        // Si no lo es, es una capa que est? reproyectada al vuelo 
177
        // Si no lo es, es una capa que est? reproyectada al vuelo
178 178
        if ((proj != null) && (getFMap() != null))
179 179
            if (proj != getFMap().getProjection())
180 180
            {
181 181
                ICoordTrans ct = new CoordTrans((CoordSys) proj,
182 182
                        (CoordSys) getFMap().getProjection());
183 183
                setCoordTrans(ct);
184
                logger.debug("Cambio proyecci?n: FMap con " + getFMap().getProjection().getAbrev() 
184
                logger.debug("Cambio proyecci?n: FMap con " + getFMap().getProjection().getAbrev()
185 185
                        + " y capa " + getName() + " con " + proj.getAbrev());
186
            }        
186
            }
187 187
	}
188 188

  
189 189
	/**
......
234 234
		xml.putProperty("name", name);
235 235
		xml.putProperty("minScale",minScale);
236 236
		xml.putProperty("maxScale",maxScale);
237
		
237

  
238 238
		//TODO xml.addChild(parentLayer.getXMLEntity());
239 239
		xml.putProperty("visible", visible);
240 240
		if (projection != null) {
......
259 259
		active = xml.getBooleanProperty("active");
260 260
		name = xml.getStringProperty("name");
261 261
		minScale=xml.getDoubleProperty("minScale");
262
		maxScale=xml.getDoubleProperty("maxScale");		
262
		maxScale=xml.getDoubleProperty("maxScale");
263 263
		visible = xml.getBooleanProperty("visible");
264 264
		if (xml.contains("proj")) {
265 265
			setProjection(ProjectionPool.get(xml.getStringProperty("proj")));
......
282 282
		active = xml.getBooleanProperty("active");
283 283
		name = xml.getStringProperty("name");
284 284
		minScale=xml.getDoubleProperty("minScale");
285
		maxScale=xml.getDoubleProperty("maxScale");		
285
		maxScale=xml.getDoubleProperty("maxScale");
286 286
		visible = xml.getBooleanProperty("visible");
287 287
		if (xml.contains("proj")) {
288 288
			setProjection(ProjectionPool.get(xml.getStringProperty("proj")));
......
307 307
		active = xml.getBooleanProperty("active");
308 308
		name = xml.getStringProperty("name");
309 309
		minScale=xml.getDoubleProperty("minScale");
310
		maxScale=xml.getDoubleProperty("maxScale");	
310
		maxScale=xml.getDoubleProperty("maxScale");
311 311
		visible = xml.getBooleanProperty("visible");
312 312
		if (xml.contains("proj")) {
313 313
			setProjection(ProjectionPool.get(xml.getStringProperty("proj")));
......
339 339
			return false;
340 340
		return layerListeners.add(o);
341 341
	}
342

  
342
	public LayerListener[] getLayerListeners() {
343
		return (LayerListener[])layerListeners.toArray(new LayerListener[0]);
344
	}
343 345
	/**
344 346
	 * Borra de la lista de listeners el que se pasa como par?metro.
345 347
	 *
......
443 445
	public ICoordTrans getCoordTrans() {
444 446
		return ct;
445 447
	}
446
	
448

  
447 449
	/**
448 450
	 * M?todo que es llamado por Flayers para notificar a la capa que
449 451
	 * va a ser a?adida. Esta previa notificaci?n es util para las capas que
450 452
	 * necesitan hacer algo antes de ser a?adida. Por ejemplo, el raster necesita
451
	 * volver a abrir el fichero que ha podido ser cerrado con anterioridad. 
453
	 * volver a abrir el fichero que ha podido ser cerrado con anterioridad.
452 454
	 * Si no se redefine este m?todo no se har? nada ya que este es vacio.
453 455
	 */
454 456
	public void wakeUp(){}
455
	
457

  
456 458
    public double getMinScale() {
457 459
        return minScale;
458 460
    }
......
463 465
    public double getMaxScale() {
464 466
        return maxScale;
465 467
    }
466
	
468

  
467 469
    public void setMinScale(double minScale)
468 470
    {
469 471
        this.minScale = minScale;
......
472 474
    {
473 475
        this.maxScale = maxScale;
474 476
    }
475
    
477

  
476 478
    public boolean isWithinScale(double scale)
477 479
    {
478
       
480

  
479 481
        boolean bVisible = true;
480 482
        if (getMinScale() != -1)
481 483
        {
......
487 489
            if (scale > getMaxScale())
488 490
                bVisible = false;
489 491
        }
490
        
492

  
491 493
        return bVisible;
492 494
    }
493
    
495

  
494 496
    public Strategy getStrategy()
495 497
    {
496 498
        return privateStrategy;
497 499
    }
498
    public void setStrategy(Strategy s)    
500
    public void setStrategy(Strategy s)
499 501
    {
500 502
        privateStrategy = s;
501 503
    }
......
514 516
	public boolean isEditing(){
515 517
		return isediting;
516 518
	}
517
    
519

  
518 520
    public ImageIcon getTocImageIcon() {
519
    	return null;    	
521
    	return null;
520 522
    }
521
    
523

  
522 524
    public boolean isInTOC() {
523 525
    	return isInTOC;
524 526
    }
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLayer.java
220 220
	 * @return True si es correcta la inserci?n del listener.
221 221
	 */
222 222
	public boolean addLayerListener(LayerListener o);
223

  
223
	public LayerListener[] getLayerListeners();
224 224
	/**
225 225
	 * Borra de la lista el LayerListener que se pasa como par?metro.
226 226
	 *
......
229 229
	 * @return True si es correcto el borrado del listener.
230 230
	 */
231 231
	public boolean removeLayerListener(LayerListener o);
232
	
232

  
233 233
	public boolean isWithinScale(double scale);
234
	
235
	
234

  
235

  
236 236
	/**
237 237
	 * La capa no se visualiza si est? por debajo de esa escala
238 238
	 * @return la escala minima de visualizaci?n
......
244 244
	 * @return la escala m?xima de visualizaci?n
245 245
	 */
246 246
	public double getMaxScale();
247
	
247

  
248 248
	public void setMinScale(double minScale);
249 249
	public void setMaxScale(double maxScale);
250 250
	public void setEditing(boolean b) throws EditionException;
251 251
	public boolean isEditing();
252
	
252

  
253 253
	/**
254 254
	 * Icono a mostrar en el TOC junto a la capa
255 255
	 * @return el icono
trunk/extensions/extAddEventTheme/src/com/iver/gvsig/addeventtheme/gui/AddEventThemePanel.java
44 44
package com.iver.gvsig.addeventtheme.gui;
45 45

  
46 46
import java.util.ArrayList;
47
import java.util.logging.ConsoleHandler;
48 47

  
48
import javax.swing.DefaultComboBoxModel;
49
import javax.swing.JButton;
50
import javax.swing.JComboBox;
51
import javax.swing.JDialog;
52
import javax.swing.JLabel;
49 53
import javax.swing.JPanel;
50 54

  
55
import org.cresques.cts.IProjection;
56

  
51 57
import com.hardcode.driverManager.DriverLoadException;
52 58
import com.hardcode.gdbms.engine.data.DataSource;
53 59
import com.iver.andami.PluginServices;
......
63 69
import com.iver.gvsig.addeventtheme.AddEventThemListener;
64 70
import com.iver.gvsig.addeventtheme.AddEventThemeDriver;
65 71

  
66
import javax.swing.DefaultComboBoxModel;
67
import javax.swing.JDialog;
68
import javax.swing.JLabel;
69
import javax.swing.JComboBox;
70
import javax.swing.JButton;
71

  
72
import org.cresques.cts.IProjection;
73

  
74 72
/**
75 73
 * The AddEventThemePanel class creates a JPanel where the
76 74
 * user can input the name of the gvSIG Table from that the
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/BreakCADTool.java
449 449

  
450 450
	            theIterator.next();
451 451
	        } //end while loop
452
	        GeneralPathX gpx=new GeneralPathX();
453
	        gpx.append(geomAux.getInternalShape(),true);
454
	        if (gpx.isClosed()) {
455
	        	newGp2.append(newGp1.getPathIterator(null),true);
456
	        	IGeometry geom1=ShapeFactory.createPolyline2D(newGp2);
457
		        VectorialLayerEdited vle = getVLE();
458
		        VectorialEditableAdapter vea = vle.getVEA();
459
		        int num=vea.getRowCount();
460
		        DefaultFeature df1 = new DefaultFeature(geom1, dre.getAttributes(),String.valueOf(num));
461

  
462
		        vea.startComplexRow();
463
		        vea.removeRow(dre.getIndex(),getName(),EditionEvent.GRAPHIC);
464
		        int index1=vea.addRow(df1,PluginServices.getText(this,"parte1"),EditionEvent.GRAPHIC);
465
		        vea.endComplexRow();
466
		        ViewPort vp=CADExtension.getEditionManager().getMapControl().getViewPort();
467
		        BufferedImage selectionImage = new BufferedImage(vp.getImageWidth(), vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB);
468
				Graphics2D gs = selectionImage.createGraphics();
469
				clearSelection();
470
				ArrayList selectedRow = vle.getSelectedRow();
471
				selectedRow.add(new DefaultRowEdited(df1, IRowEdited.STATUS_ADDED, index1));
472
				geom1.cloneGeometry().draw(gs, vp, CADTool.drawingSymbol);
473
				vle.drawHandlers(geom1.cloneGeometry(),gs,vp);
474
				vea.setSelectionImage(selectionImage);
475
	        }else {
452 476
	        IGeometry geom1=ShapeFactory.createPolyline2D(newGp1);
453 477
	        IGeometry geom2=ShapeFactory.createPolyline2D(newGp2);
454 478
	        VectorialLayerEdited vle = getVLE();
......
474 498
			geom2.cloneGeometry().draw(gs, vp, CADTool.drawingSymbol);
475 499
			vle.drawHandlers(geom2.cloneGeometry(),gs,vp);
476 500
			vea.setSelectionImage(selectionImage);
501
	        }
477 502
	}
478 503

  
479 504
	private Point2D getNearPoint(Point2D previous) {
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/ExploitCADTool.java
194 194
    	GeneralPathX newGp1 = new GeneralPathX();
195 195
    	DefaultFeature df = (DefaultFeature) dre.getLinkedRow()
196 196
			.cloneRow();
197

  
197
//    	Point2D firstPoint=null;
198
//    	Point2D lastPoint=null;
198 199
    	PathIterator theIterator = df.getGeometry().getPathIterator(null);
199 200
		double[] theData = new double[6];
200 201
		int theType;
......
206 207
			case PathIterator.SEG_MOVETO:
207 208
				numParts++;
208 209
				newGp1 = new GeneralPathX();
210
//				firstPoint=new Point2D.Double(theData[0], theData[1]);
209 211
				newGp1.moveTo(theData[0], theData[1]);
212
//				lastPoint=new Point2D.Double(theData[0], theData[1]);
210 213
				break;
211 214

  
212 215
			case PathIterator.SEG_LINETO:
......
221 224
						IRowEdited.STATUS_ADDED, indexLine));
222 225
				newGp1 = new GeneralPathX();
223 226
				newGp1.moveTo(theData[0], theData[1]);
227
//				lastPoint=new Point2D.Double(theData[0], theData[1]);
224 228
				break;
225 229

  
226 230
			case PathIterator.SEG_QUADTO:
......
237 241
						IRowEdited.STATUS_ADDED, indexQuad));
238 242
				newGp1 = new GeneralPathX();
239 243
				newGp1.moveTo(theData[0], theData[1]);
244
//				lastPoint=new Point2D.Double(theData[0], theData[1]);
240 245
				break;
241 246
			case PathIterator.SEG_CUBICTO:
242 247
				newGp1.curveTo(theData[0], theData[1], theData[2],
......
251 256
						IRowEdited.STATUS_ADDED, indexCurve));
252 257
				newGp1 = new GeneralPathX();
253 258
				newGp1.moveTo(theData[0], theData[1]);
259
//				lastPoint=new Point2D.Double(theData[0], theData[1]);
254 260
				break;
255 261
			case PathIterator.SEG_CLOSE:
256
				System.out.println("");
262
//				if (firstPoint!=null) {
263
//					newGp1=new GeneralPathX();
264
//					newGp1.moveTo(firstPoint.getX(),firstPoint.getY());
265
//					newGp1.lineTo(lastPoint.getX(),lastPoint.getY());
266
//					IGeometry geomClose = ShapeFactory
267
//							.createPolyline2D(newGp1);
268
//					DefaultFeature dfClose = (DefaultFeature) df.cloneRow();
269
//					dfClose.setGeometry(geomClose);
270
//					int indexClose = addGeometry(geomClose, dfClose
271
//							.getAttributes());
272
//					selectedRowAux.add(new DefaultRowEdited(dfClose,
273
//							IRowEdited.STATUS_ADDED, indexClose));
274
//					newGp1 = new GeneralPathX();
275
//					newGp1.moveTo(theData[0], theData[1]);
276
//				}
257 277
				// if (isFirstPart)
258 278
				// newGp1.closePath();
259 279
				// else
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/SelectionCADTool.java
98 98
	protected ArrayList rowselectedHandlers=new ArrayList();
99 99
	protected String type=PluginServices.getText(this,"simple");
100 100
	protected ArrayList pointsPolygon=new ArrayList();
101

  
102
	protected boolean multipleSelection=false;
101 103
	/**
102 104
	 * Crea un nuevo SelectionCADTool.
103 105
	 */
......
409 411
				|| (status.equals("Selection.WithSelectedFeatures"))) {
410 412
			PluginServices.getMDIManager().setWaitCursor();
411 413
			firstPoint = new Point2D.Double(x, y);
412
			vle.selectWithPoint(x,y);
414
			vle.selectWithPoint(x,y,multipleSelection);
413 415
			PluginServices.getMDIManager().restoreCursor();
414 416
		}
415 417
		ArrayList selectedRow = vle.getSelectedRow();
......
489 491
	public String toString() {
490 492
		return "_selection";
491 493
	}
494
	public void multipleSelection(boolean b) {
495
		multipleSelection=b;
492 496

  
497
	}
498

  
493 499
}
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/ScaleCADTool.java
327 327
    			IRowEdited edRow = (IRowEdited) selectedRow.get(i);
328 328
    			DefaultFeature fea = (DefaultFeature) edRow.getLinkedRow().cloneRow();
329 329
				UtilFunctions.scaleGeom(fea.getGeometry(), scalePoint, scaleFactor, scaleFactor);
330
    			int index=	vea.modifyRow(edRow.getIndex(), fea,getName(),EditionEvent.GRAPHIC);
331
    			selectedRowAux.add(new DefaultRowEdited(fea,IRowEdited.STATUS_MODIFIED,index));
330
    			vea.modifyRow(edRow.getIndex(), fea,getName(),EditionEvent.GRAPHIC);
331
    			selectedRowAux.add(new DefaultRowEdited(fea,IRowEdited.STATUS_MODIFIED,edRow.getIndex()));
332 332
    		}
333 333
    		vea.endComplexRow();
334 334
    		clearSelection();
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/SymmetryCADTool.java
242 242

  
243 243
					if (s.equals(PluginServices.getText(this, "cut"))
244 244
							|| s.equals("s") || s.equals("S")) {
245
						int index = vea.modifyRow(row.getIndex(), fea,
245
						vea.modifyRow(row.getIndex(), fea,
246 246
								getName(), EditionEvent.GRAPHIC);
247 247

  
248 248
						selectedRowAux.add(new DefaultRowEdited(fea,
249
								IRowEdited.STATUS_MODIFIED, index));
249
								IRowEdited.STATUS_MODIFIED, row.getIndex()));
250 250
					} else {
251 251
						int index=addGeometry(geom,fea.getAttributes());
252 252
						selectedRowAux.add(new DefaultRowEdited(fea,
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/RotateCADTool.java
161 161
							+ (Math.PI / 2), firstPoint.getX(), firstPoint
162 162
							.getY());
163 163

  
164
					int index=vea.modifyRow(row.getIndex(), fea,
164
					vea.modifyRow(row.getIndex(), fea,
165 165
							getName(),EditionEvent.GRAPHIC);
166
					selectedRowAux.add(new DefaultRowEdited(fea,IRowEdited.STATUS_MODIFIED,index));
166
					selectedRowAux.add(new DefaultRowEdited(fea,IRowEdited.STATUS_MODIFIED,row.getIndex()));
167 167
				}
168 168

  
169 169
				vea.endComplexRow();
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/RectangleCADTool.java
127 127
            elShape.lineTo(lastPoint.getX(), firstPoint.getY());
128 128
            elShape.lineTo(lastPoint.getX(), lastPoint.getY());
129 129
            elShape.lineTo(firstPoint.getX(), lastPoint.getY());
130
            //elShape.lineTo(firstPoint.getX(), firstPoint.getY());
130
            elShape.lineTo(firstPoint.getX(), firstPoint.getY());
131 131
            elShape.closePath();
132 132
            addGeometry(ShapeFactory.createPolyline2D(elShape));
133 133
            firstPoint = (Point2D) lastPoint.clone();
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/MoveCADTool.java
156 156
                    UtilFunctions.moveGeom(ig, lastPoint.getX() -
157 157
                            firstPoint.getX(), lastPoint.getY() - firstPoint.getY());
158 158

  
159
                    int index=vea.modifyRow(edRow.getIndex(),feat,getName(),EditionEvent.GRAPHIC);
160
                    selectedRowAux.add(new DefaultRowEdited(feat,IRowEdited.STATUS_MODIFIED,index));
159
                    vea.modifyRow(edRow.getIndex(),feat,getName(),EditionEvent.GRAPHIC);
160
                    selectedRowAux.add(new DefaultRowEdited(feat,IRowEdited.STATUS_MODIFIED,edRow.getIndex()));
161 161
              }
162 162
                vea.endComplexRow();
163 163
                clearSelection();
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/CopyCADTool.java
146 146

  
147 147
            try {
148 148
            	for (int i = 0; i < selectedRow.size(); i++) {
149
                    DefaultFeature fea = (DefaultFeature) ((DefaultRowEdited)selectedRow.get(i))
150
                                                             .getLinkedRow()
149
            		DefaultRowEdited dre=(DefaultRowEdited)selectedRow.get(i);
150
                    DefaultFeature fea = (DefaultFeature)dre.getLinkedRow()
151 151
                                                             .cloneRow();
152 152
                    // Movemos la geometr?a
153 153
                    UtilFunctions.moveGeom(fea.getGeometry(), lastPoint.getX() -
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/ComplexSelectionCADTool.java
393 393
				|| (status.equals("Selection.WithSelectedFeatures"))) {
394 394
			PluginServices.getMDIManager().setWaitCursor();
395 395
			firstPoint = new Point2D.Double(x, y);
396
			vle.selectWithPoint(x,y);
396
			vle.selectWithPoint(x,y,multipleSelection);
397 397
			PluginServices.getMDIManager().restoreCursor();
398 398
		}
399 399
		ArrayList selectedRow = vle.getSelectedRow();
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/ThemeToAnnotationExtension.java
53 53
import com.iver.cit.gvsig.fmap.layers.FLayer;
54 54
import com.iver.cit.gvsig.fmap.layers.FLyrAnnotation;
55 55
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
56
import com.iver.cit.gvsig.fmap.layers.LayerListener;
56 57
import com.iver.cit.gvsig.fmap.layers.MappingAnnotation;
57 58
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
58 59
import com.iver.cit.gvsig.gui.Panels.annotation.ConfigureLabel;
......
157 158

  
158 159
            FLyrVect lv=(FLyrVect)map.getLayers().getActives()[0];
159 160
            FLyrAnnotation la=new FLyrAnnotation();
161
            LayerListener[] layerListeners=lv.getLayerListeners();
162
            for (int i=0;i<layerListeners.length;i++) {
163
            	la.addLayerListener(layerListeners[i]);
164
            }
165

  
160 166
            la.setSource(lv.getSource());
161 167
            la.setProjection(lv.getProjection());
162 168

  

Also available in: Unified diff