Revision 33030 branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/impl/DefaultMapContextManager.java

View differences:

DefaultMapContextManager.java
68 68
 * @author <a href="mailto:cordinyana@gvsig.org">C?sar Ordi?ana</a>
69 69
 */
70 70
public class DefaultMapContextManager implements MapContextManager {
71
	private static final Logger logger = LoggerFactory.getLogger(MapContextManager.class);
71
	private static final Logger LOG = LoggerFactory.getLogger(MapContextManager.class);
72 72
	
73 73
	private Class drawerClazz = DefaultMapContextDrawer.class;
74 74

  
......
220 220
			layer.initialize(projection);	
221 221
			layer.setLegend((IVectorLegend)createLegend(IVectorialUniqueValueLegend.LEGEND_NAME));
222 222
		} catch (Exception e) {
223
			logger.error("Error initializing the graphics layer", e);
223
			LOG.error("Error initializing the graphics layer", e);
224 224
		}
225 225
		return layer;
226 226
	}
......
264 264

  
265 265
	public IVectorLegend createDefaultVectorLegend(int shapeType)
266 266
			throws MapContextRuntimeException {
267
		Random rand = new Random();
268

  
269
		int numreg = rand.nextInt(255 / 2);
270
		double div = (1 - rand.nextDouble() * 0.66) * 0.9;
271
		Color randomColor = new Color(((int) (255 * div + (numreg * rand
272
				.nextDouble()))) % 255, ((int) (255 * div + (numreg * rand
273
				.nextDouble()))) % 255, ((int) (255 * div + (numreg * rand
274
				.nextDouble()))) % 255);
275
		IVectorLegend legend = (IVectorLegend) createLegend(getDefaultVectorLegend());
276

  
277
		ISymbol defaultSymbol =
278
				getSymbolManager().createSymbol(shapeType, randomColor);
279
		legend.setDefaultSymbol(defaultSymbol);
280
		return legend;
267
		try {
268
			Random rand = new Random();
269
	
270
			int numreg = rand.nextInt(255 / 2);
271
			double div = (1 - rand.nextDouble() * 0.66) * 0.9;
272
			Color randomColor = new Color(((int) (255 * div + (numreg * rand
273
					.nextDouble()))) % 255, ((int) (255 * div + (numreg * rand
274
					.nextDouble()))) % 255, ((int) (255 * div + (numreg * rand
275
					.nextDouble()))) % 255);
276
			IVectorLegend legend = (IVectorLegend) createLegend(getDefaultVectorLegend());
277
			if( legend == null ) {
278
				return null;
279
			}
280
			ISymbol defaultSymbol =
281
					getSymbolManager().createSymbol(shapeType, randomColor);
282
			legend.setDefaultSymbol(defaultSymbol);
283
			return legend;
284
		} catch(Exception e) {
285
			throw new MapContextRuntimeException(e);
286
		}
281 287
	}
282 288

  
283 289
	public void registerLegendReader(String format, Class readerClass)

Also available in: Unified diff