Revision 37204 branches/dal_time_support/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/rendering/symbols/impl/DefaultSymbolManager.java
DefaultSymbolManager.java | ||
---|---|---|
35 | 35 |
import java.util.Collections; |
36 | 36 |
import java.util.HashMap; |
37 | 37 |
import java.util.Map; |
38 |
import java.util.Random; |
|
38 | 39 |
|
39 | 40 |
import org.gvsig.fmap.mapcontext.MapContextRuntimeException; |
40 | 41 |
import org.gvsig.fmap.mapcontext.impl.InvalidRegisteredClassException; |
... | ... | |
49 | 50 |
import org.gvsig.tools.persistence.PersistenceManager; |
50 | 51 |
import org.gvsig.tools.persistence.PersistentState; |
51 | 52 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
52 |
import org.gvsig.tools.persistence.exception.PersistenceValidateExceptions; |
|
53 | 53 |
|
54 | 54 |
/** |
55 | 55 |
* Default {@link SymbolManager} implementation. |
... | ... | |
286 | 286 |
symbolClass, symbolName, e); |
287 | 287 |
} |
288 | 288 |
|
289 |
Color symbolColor; |
|
290 |
if (getSymbolPreferences().isDefaultSymbolFillColorAleatory()) { |
|
291 |
Random rand = new Random(); |
|
292 |
int numreg = rand.nextInt(255 / 2); |
|
293 |
double div = (1 - rand.nextDouble() * 0.66) * 0.9; |
|
294 |
symbolColor = |
|
295 |
new Color( |
|
296 |
((int) (255 * div + (numreg * rand.nextDouble()))) % 255, |
|
297 |
((int) (255 * div + (numreg * rand.nextDouble()))) % 255, |
|
298 |
((int) (255 * div + (numreg * rand.nextDouble()))) % 255); |
|
299 |
} |
|
300 |
else { |
|
301 |
symbolColor = getSymbolPreferences().getDefaultSymbolFillColor(); |
|
302 |
} |
|
303 |
symbol.setColor(symbolColor); |
|
289 | 304 |
// Perform this initialization into the Symbol implementation |
290 | 305 |
// if (symbol instanceof CartographicSupport) { |
291 | 306 |
// CartographicSupport cs = (CartographicSupport) symbol; |
Also available in: Unified diff