Revision 23298

View differences:

branches/v2_0_0_prep/libraries/libFMap_data_dwg/src/org/gvsig/fmap/data/feature/file/dwg/DWGResource.java
116 116
		initializeFeatureType();
117 117
		if (legendLabelingManagerFactory != null){
118 118
			legendlabelingManager = legendLabelingManagerFactory.newManager();
119
			legendlabelingManager.startLoading(null);
119 120
		}else{
120 121
			legendlabelingManager = null;
121 122
		}
......
170 171

  
171 172
					IDwg2FMap dwgEnt = (IDwg2FMap)entity;
172 173
					Geometry geometry = dwgEnt.toFMapGeometry(is3dFile);
173
					if (geometry == null)
174
					if (geometry == null) {
174 175
						continue;
176
					}
175 177
					//we check for Region of Interest of the CAD file
176
					if(!this.fullEnvelope.contains(geometry.getEnvelope()))
178
					if(!this.fullEnvelope.contains(geometry.getEnvelope())) {
177 179
						continue;
180
					}
178 181
					DWGFeature feature = new DWGFeature(this.featureType, false);
179 182

  
180 183
					feature.loading();
......
189 192

  
190 193
					int colorByLayer = dwg.getColorByLayer(entity);
191 194
					int color = entity.getColor();
192
					if(color < 0)
195
					if(color < 0) {
193 196
						color = Math.abs(color);
194
					if(color > 255)
197
					}
198
					if(color > 255) {
195 199
						color = colorByLayer;
200
					}
196 201

  
197 202

  
198 203
					feature.set(ID_FIELD_COLOR, color);
......
225 230

  
226 231
					this.addFeature(feature);
227 232
					if (this.legendlabelingManager != null){
228
						this.legendlabelingManager.add(feature);
233
						this.legendlabelingManager.add(feature, null);
229 234
					}
230 235

  
231 236
				}//if instanceof
......
238 243

  
239 244

  
240 245

  
241

  
242

  
243
//		String[] types = new String[featureType.size()];
244
//		Iterator iter = featureType.iterator();
245
//		int i=0;
246
//		while (iter.hasNext()){
247
//			types[i] = ((FeatureAttributeDescriptor)iter.next()).getDataType();
248
//			i++;
249
//		}
250

  
246
		if (legendlabelingManager != null) {
247
			legendlabelingManager.endLoading();
248
		}
251 249
	}
252 250

  
253 251
	/* (non-Javadoc)
branches/v2_0_0_prep/libraries/libFMap_data_dwg/src/org/gvsig/fmap/data/feature/file/dwg/operation/DWGLegendLabelingManager.java
2 2

  
3 3
import java.awt.Color;
4 4
import java.util.ArrayList;
5
import java.util.Map;
5 6

  
6 7
import org.gvsig.fmap.data.DataException;
7 8
import org.gvsig.fmap.data.feature.Feature;
......
40 41
		labeling.setUnit(1); //MapContext.NAMES[1] (meters)
41 42
	}
42 43

  
43
	public void add(Feature feature) throws DataException {
44
	public void add(Feature feature, Map params) throws DataException {
44 45
		// Legend
45 46
		Integer curColor = (Integer) feature.get(DWGResource.ID_FIELD_COLOR);
46 47
		if (!colors.contains(curColor)){
......
65 66
		return this.labeling;
66 67
	}
67 68

  
69
	public void endLoading() {
70
		this.colors.clear();
71
		this.colors = null;
72
	}
68 73

  
74
	public void startLoading(Map params) {
75
		// DO NOTHING
76
	}
77

  
69 78
}

Also available in: Unified diff