Revision 22465

View differences:

trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/ZSort.java
83 83
	                 1;
84 84
			matrix[i] = new int[rowLength];
85 85
		}
86
		legend.addLegendListener(this);
86 87
	}
87 88

  
88 89
	public void legendChanged(LegendChangedEvent e) {
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/SingleSymbolLegend.java
91 91
		}
92 92
	}
93 93

  
94

  
95 94
	public void setDefaultSymbol(ISymbol s) {
96 95
		if (s == null) throw new NullPointerException("Default symbol cannot be null");
97 96
		setShapeType(s.getSymbolType());
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/VectorialUniqueValueLegend.java
283 283

  
284 284
    public ISymbol getDefaultSymbol() {
285 285

  
286
    	NullUniqueValue nuv=new NullUniqueValue();
287
    	if (symbols.containsKey(nuv))
288
    		return symbols.get(nuv);
286
//  	NullUniqueValue nuv=new NullUniqueValue();
287
//  	if (symbols.containsKey(nuv))
288
//  	return symbols.get(nuv);
289 289

  
290 290
    	if(defaultSymbol==null) {
291 291
    		defaultSymbol = SymbologyFactory.createDefaultSymbolByShapeType(shapeType);
292 292
    		fireDefaultSymbolChangedEvent(new SymbolLegendEvent(null, defaultSymbol));
293 293
    	}
294
        return defaultSymbol;
294
    	return defaultSymbol;
295 295
    }
296 296

  
297

  
298 297
    public XMLEntity getXMLEntity() {
299 298
        XMLEntity xml = new XMLEntity();
300 299
        xml.putProperty("className", this.getClass().getName());
......
476 475
    }
477 476

  
478 477
    public void setDefaultSymbol(ISymbol s) {
479
    	if (s == null) throw new NullPointerException("Default symbol cannot be null");
480
    	ISymbol old = defaultSymbol;
481
        defaultSymbol = s;
482
		fireDefaultSymbolChangedEvent(new SymbolLegendEvent(old, defaultSymbol));
483
		
478
    	ISymbol mySymbol = defaultSymbol;
479
    	
480
    	if (s == null) 
481
    		throw new NullPointerException("Default symbol cannot be null");
482
    	
483
    	ISymbol old = mySymbol;
484
    	defaultSymbol = s;
485
    	fireDefaultSymbolChangedEvent(new SymbolLegendEvent(old, s));
486
    }
484 487

  
485
    }
486 488
    /**
487 489
     * Returns the value using the its value in a string.
488 490
	 * 
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/styling/labeling/LabelClass.java
138 138
 * @author jaume dominguez faus - jaume.dominguez@iver.es
139 139
 */
140 140
public class LabelClass implements IPersistence, CartographicSupport {
141
	private String name;
141
	private String name; 
142 142
	private ITextSymbol textSymbol;
143 143
	private String labelExpression;
144 144
	private boolean isVisible = true;
......
201 201
	
202 202
	private Dimension getSize() {
203 203
		if (labelStyle == null) {
204
			if (texts!=null && texts.length >0)
205
				getTextSymbol().setText(texts[0]);
204
			if (texts!=null && texts.length >0) {
205
				String t = "";
206
				for (int i = 0; i < texts.length; i++) {
207
					t += texts[i];
208
				}
209
				getTextSymbol().setText(t);
210
			}
211
				
206 212
			Rectangle bounds = getTextSymbol().getBounds();
207 213
			bounds.setLocation(
208 214
					(int) Math.round(bounds.getX()), 
209 215
					(int) Math.round(bounds.getY()+bounds.getHeight()));
210 216
			return new Dimension(bounds.width, bounds.height);
211
		} else {
217
		} else { 
212 218
			labelStyle.setTextFields(texts); 
213 219
			return labelStyle.getSize();
214 220
		}
......
277 283
		
278 284
	}
279 285
	
286
	
280 287
	/**
281 288
	 * <p>
282 289
	 * LabelLocationMetrics, contains the anchor point, rotation, and some
......
310 317
		double xAnchor = anchor.getX();
311 318
		double yAnchor = anchor.getY();
312 319
		double theta = llm.getRotation();
320
 
313 321

  
314

  
315 322
		graphics.translate(xAnchor, yAnchor);
316 323
		graphics.rotate(theta);
317 324
		try {
......
324 331
		graphics.translate(-xAnchor, -yAnchor);
325 332
	}
326 333
	
334
	
327 335
	private void relativeToAbsolute(double[] xy, Rectangle r, Dimension labelSz, double ratioLabel, double ratioViewPort) {
328 336
		int x;
329 337
		int y;
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/rendering/AbstractIntervalLegend.java
564 564
	
565 565
	public void replace(ISymbol oldSymbol, ISymbol newSymbol) {
566 566
		if (symbols.containsValue(oldSymbol)) {
567
			Iterator it = symbols.keySet().iterator();
567
			Iterator<Object> it = symbols.keySet().iterator();
568 568
			while (it.hasNext()) {
569 569
				Object key = it.next();
570 570
				if (symbols.get(key).equals(oldSymbol)) {
571 571
					symbols.remove(key);
572 572
					symbols.put(key, newSymbol);
573
					fireClassifiedSymbolChangeEvent(
574
							new SymbolLegendEvent(oldSymbol, newSymbol));
573 575
				}
574 576
			}
575 577
		}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrVect.java
57 57
import org.cresques.cts.ICoordTrans;
58 58

  
59 59
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
60
import com.hardcode.gdbms.engine.data.DataSourceFactory;
60 61
import com.hardcode.gdbms.engine.data.NoSuchTableException;
61 62
import com.hardcode.gdbms.engine.data.driver.DriverException;
62 63
import com.hardcode.gdbms.engine.instruction.FieldNotFoundException;
......
406 407
    				ReadableVectorial rv=getSource();
407 408
    				int selectionIndex=-1;
408 409
    				if (rv instanceof ISpatialDB){
409
    					selectionIndex=((ISpatialDB)rv).getRowIndexByFID(feat);
410
    					selectionIndex = ((ISpatialDB)rv).getRowIndexByFID(feat);
410 411
    				}else{
411
    					selectionIndex=Integer.parseInt(feat.getID());
412
    					selectionIndex = Integer.parseInt(feat.getID());
412 413
    				}
413 414
    				if (selectionIndex!=-1) {
414 415
    					if (selectionSupport.isSelected(selectionIndex)) {
......
1190 1191
    		try {
1191 1192
    			getRecordset().getSelectionSupport().setXMLEntity(xml.getChild(1));
1192 1193
    			// JMVIVO: Esto sirve para algo????
1194
    			/*
1195
    			 *  Jaume: si, para restaurar el selectable datasource cuando se
1196
    			 *  clona la capa, cuando se carga de un proyecto. Si no esta ya
1197
    			 *  no se puede ni hacer consultas sql, ni hacer selecciones,
1198
    			 *  ni usar la mayor parte de las herramientas.
1199
    			 *  
1200
    			 *  Lo vuelvo a poner.
1201
    			 */
1202

  
1193 1203
    			String recordsetName = xml.getStringProperty("recordset-name");
1194 1204

  
1205
    			SelectableDataSource sds = new SelectableDataSource(LayerFactory
1206
    					.getDataSourceFactory().createRandomDataSource(
1207
    							recordsetName, DataSourceFactory.AUTOMATIC_OPENING));
1208

  
1195 1209
    			LayerFactory.getDataSourceFactory().changeDataSourceName(
1196 1210
    					getSource().getRecordset().getName(), recordsetName);
1197 1211
    		} catch (NoSuchTableException e1) {
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/gvl/FMapGVLDriver.java
5 5
import java.io.FileReader;
6 6
import java.io.FileWriter;
7 7
import java.io.IOException;
8
import java.util.ArrayList;
8 9
import java.util.Hashtable;
9 10

  
10 11
import org.exolab.castor.xml.MarshalException;
......
140 141

  
141 142
	}
142 143

  
143
	public void write(FLayers layers,FLayer layer,ILegend legend, File file) throws LegendDriverException  {
144
	public void write(FLayers layers, FLayer layer, ILegend legend, File file, String version) throws LegendDriverException  {
144 145
		FileWriter writer;
145 146
		int errors = 0;
146 147
		try {
......
159 160
		
160 161
	}
161 162

  
163
	public ArrayList<String> getSupportedVersions() {
164
		ArrayList<String> versions = new ArrayList<String>();
165
		versions.add("gvSIG 1.0.0");
166
		versions.add("gvSIG 1.1.0");
167
		versions.add("gvSIG 2.0.0");
168
		
169
		return versions;
170
	}
162 171

  
163

  
164 172
}
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/legend/IFMapLegendDriver.java
4 4
package com.iver.cit.gvsig.fmap.drivers.legend;
5 5

  
6 6
import java.io.File;
7
import java.util.ArrayList;
7 8
import java.util.Hashtable;
8 9

  
9 10
import com.iver.cit.gvsig.fmap.layers.FLayer;
......
19 20

  
20 21
	String getFileExtension();
21 22
	
22
	void write(FLayers layers,FLayer layer, ILegend legend, File file) throws LegendDriverException;
23
	ArrayList<String> getSupportedVersions();
23 24
	
24
	Hashtable<FLayer, ILegend> read(FLayers layers,FLayer layer,File file) throws LegendDriverException;
25
	void write(FLayers layers, FLayer layer, ILegend legend, File file, String version) throws LegendDriverException;
26
	
27
	Hashtable<FLayer, ILegend> read(FLayers layers, FLayer layer, File file) throws LegendDriverException;
25 28
}

Also available in: Unified diff