Revision 10860

View differences:

trunk/extensions/extDwg/src/com/iver/cit/gvsig/drivers/dwg/DwgMemoryDriver.java
46 46
 *
47 47
 * $Id$
48 48
 * $Log$
49
 * Revision 1.9  2007-03-20 20:21:19  azabala
49
 * Revision 1.10  2007-03-22 19:56:12  azabala
50
 * changes in exceptinos api
51
 *
52
 * Revision 1.9  2007/03/20 20:21:19  azabala
50 53
 * added roi filtering, reordering of code
51 54
 *
52 55
 * Revision 1.7  2007/02/27 17:18:03  azabala
......
83 86
import java.util.ArrayList;
84 87
import java.util.List;
85 88

  
86
import com.hardcode.gdbms.engine.data.DataSourceFactory;
87 89
import com.hardcode.gdbms.driver.exceptions.InitializeDriverException;
88 90
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
89 91
import com.hardcode.gdbms.driver.exceptions.UnsupportedVersionDriverException;
90
import com.hardcode.gdbms.engine.data.driver.DriverException;
92
import com.hardcode.gdbms.engine.data.DataSourceFactory;
91 93
import com.hardcode.gdbms.engine.data.driver.ObjectDriver;
92 94
import com.hardcode.gdbms.engine.data.edition.DataWare;
93 95
import com.hardcode.gdbms.engine.values.IntValue;
......
104 106
import com.iver.cit.gvsig.fmap.rendering.Legend;
105 107
import com.iver.cit.gvsig.fmap.rendering.LegendFactory;
106 108
import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend;
109
import com.iver.cit.gvsig.fmap.rendering.styling.AttrInTableLabeling;
110
import com.iver.cit.gvsig.fmap.rendering.styling.ILabelingStrategy;
107 111
import com.iver.cit.jdwglib.dwg.DwgFile;
108 112
import com.iver.cit.jdwglib.dwg.DwgObject;
109 113
import com.iver.cit.jdwglib.dwg.DwgVersionNotSupportedException;
......
130 134
	private boolean isInitialized = false;
131 135
	float heightText = 10;	
132 136
	
137
	//new WithDefaultLegend API
138
	private AttrInTableLabeling labeling;
139

  
133 140
	
141
	
142
	
143
	
134 144
	private boolean debug = false;
135 145
	/**
136 146
	 * entities of the dwg file (once applied many transformation,
......
160 170
	 * 
161 171
	 * @see com.iver.cit.gvsig.fmap.drivers.MemoryDriver#open(java.io.File)
162 172
	 */
163
	public void open(File f) throws IOException {
173
	public void open(File f) {
164 174
		m_Fich = f;
165 175
	}
166 176

  
......
263 273
		arrayFields.add("HeightText");
264 274
		arrayFields.add("RotationText");
265 275
		getTableModel().setColumnIdentifiers(arrayFields.toArray());
276
		
277
		labeling = new AttrInTableLabeling();
278
		((AttrInTableLabeling) labeling).setTextFieldId(arrayFields.indexOf("Text"));
279
		((AttrInTableLabeling) labeling).setRotationFieldId(arrayFields.indexOf("RotationText"));
280
		((AttrInTableLabeling) labeling).setHeightFieldId(arrayFields.indexOf("HeightText"));
266 281

  
282
		
267 283
		boolean is3dFile = dwg.isDwg3DFile();
268 284
		try {
269 285
			for (int i = 0; i < dwgObjects.size(); i++) {
......
291 307
					String layerName = dwg.getLayerName(entity);
292 308
					auxRow[ID_FIELD_LAYER] = ValueFactory
293 309
							.createValue(layerName);
294
					int color = entity.getColor();
295 310
					int colorByLayer = dwg.getColorByLayer(entity);
296

  
297
					if (color == 256)
298
						color = colorByLayer;
299 311
					
312
					int color = entity.getColor();
313
					if(color < 0)
314
						color = Math.abs(color);
315
					if(color > 255)
316
						color = colorByLayer;					
300 317
					auxRow[ID_FIELD_COLOR] = ValueFactory.createValue(color);
301 318

  
302 319
					auxRow[ID_FIELD_HEIGHTTEXT] = ValueFactory.createValue(0.0);
......
351 368
	 * Sets a symbol for each dwg entity's derived feature based in
352 369
	 * the DWG symbology info.
353 370
	 * */
354
	private void setSymbols() throws IOException{
371
	private void setSymbols() throws InitializeDriverException{
355 372
		FSymbol myDefaultSymbol = new FSymbol(getShapeType());
356 373
		myDefaultSymbol.setShapeVisible(false);
357 374
		myDefaultSymbol.setFontSizeInPixels(false);
......
508 525
	 * 
509 526
	 * @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#getPrimaryKeys()
510 527
	 */
511
	public int[] getPrimaryKeys() throws DriverException {
528
	public int[] getPrimaryKeys() {
512 529
		// TODO Auto-generated method stub
513 530
		return null;
514 531
	}
......
518 535
	 * 
519 536
	 * @see com.hardcode.gdbms.engine.data.driver.ObjectDriver#write(com.hardcode.gdbms.engine.data.edition.DataWare)
520 537
	 */
521
	public void write(DataWare arg0) throws DriverException {
538
	public void write(DataWare arg0)  {
522 539
		// TODO Auto-generated method stub
523 540

  
524 541
	}
......
528 545

  
529 546
	}
530 547

  
531
	public void close() throws IOException {
548
	public void close()  {
532 549
		// TODO Auto-generated method stub
533 550

  
534 551
	}
......
550 567
	public void setDebug(boolean debug) {
551 568
		this.debug = debug;
552 569
	}
570
	
571
	public ILabelingStrategy getDefaultLabelingStrategy() {
572
		return labeling;
573
	}
553 574
}

Also available in: Unified diff