@@ -57,30 +57,35 @@ define([
57
57
} ,
58
58
59
59
_setDefaultSymbols : function ( ) {
60
- function getRandomColor ( transparency ) {
61
- var min = 50 ,
62
- max = 200 ;
63
- function getRandomInt ( ) {
60
+ function getRandomColor ( mainColor , transparency ) {
61
+ function getRandomInt ( min , max ) {
64
62
return Math . floor ( Math . random ( ) * ( max - min + 1 ) ) + min ;
65
63
}
66
- return new Color ( [ getRandomInt ( ) , getRandomInt ( ) , getRandomInt ( ) , transparency ] ) ;
64
+ switch ( mainColor ) {
65
+ case "red" :
66
+ return new Color ( [ getRandomInt ( 150 , 255 ) , getRandomInt ( 0 , 255 ) , getRandomInt ( 0 , 255 ) , transparency ] ) ;
67
+ case "green" :
68
+ return new Color ( [ getRandomInt ( 0 , 155 ) , getRandomInt ( 150 , 255 ) , getRandomInt ( 0 , 155 ) , transparency ] ) ;
69
+ case "blue" :
70
+ return new Color ( [ getRandomInt ( 0 , 255 ) , getRandomInt ( 0 , 255 ) , getRandomInt ( 150 , 255 ) , transparency ] ) ;
71
+ }
67
72
}
68
- // Random colors - TODO: These color suck!
69
- this . _simplePointSym = new SimpleMarkerSymbol ( SimpleMarkerSymbol . STYLE_CIRCLE , 14 ,
70
- new SimpleLineSymbol ( SimpleLineSymbol . STYLE_SOLID , getRandomColor ( 0.75 ) , 0.5 ) ,
71
- getRandomColor ( 0.85 ) ) ;
72
- this . _simpleLineSym = new SimpleLineSymbol ( SimpleLineSymbol . STYLE_SOLID , new Color ( [ 50 , 50 , 50 , 0.75 ] ) , 2 ) ;
73
+ // Random colors
74
+ this . _simplePointSym = new SimpleMarkerSymbol ( SimpleMarkerSymbol . STYLE_CIRCLE , 8 ,
75
+ new SimpleLineSymbol ( SimpleLineSymbol . STYLE_SOLID , getRandomColor ( "blue" , 0.5 ) , 1 ) ,
76
+ getRandomColor ( "blue" , 0.75 ) ) ;
77
+ this . _simpleLineSym = new SimpleLineSymbol ( SimpleLineSymbol . STYLE_SOLID , getRandomColor ( "red" , 0.9 ) , 1 ) ;
73
78
this . _simplePolygonSym = new SimpleFillSymbol ( "solid" ,
74
- new SimpleLineSymbol ( "solid" , new Color ( [ 50 , 50 , 50 , 0.25 ] ) , 1 ) ,
75
- getRandomColor ( 0.25 ) ) ;
79
+ new SimpleLineSymbol ( "solid" , new Color ( [ 50 , 50 , 50 , 0.15 ] ) , 1 ) ,
80
+ getRandomColor ( "green" , 0.15 ) ) ;
76
81
// Option to hardcod colors here
77
82
// this._simplePointSym = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10,
78
- // new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([50, 50 , 150]), 0.5 ),
79
- // new Color([0, 50, 150 , 0.25 ]));
80
- // this._simpleLineSym = new SimpleLineSymbol("solid", new Color([255, 50, 50, 1 ]), 2);
83
+ // new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([150, 150 , 150]), 0.75 ),
84
+ // new Color([50, 130, 255 , 0.75 ]));
85
+ // this._simpleLineSym = new SimpleLineSymbol("solid", new Color([255, 50, 50, 0.65 ]), 2);
81
86
// this._simplePolygonSym = new SimpleFillSymbol("solid",
82
- // new SimpleLineSymbol("solid", new Color([0, 0, 0, 0.25 ]), 1),
83
- // new Color([50, 150, 50 , 0.5 ]));
87
+ // new SimpleLineSymbol("solid", new Color([0, 0, 0, 0.15 ]), 1),
88
+ // new Color([150, 255, 150 , 0.10 ]));
84
89
} ,
85
90
86
91
_setCorsSevers : function ( ) {
@@ -243,7 +248,7 @@ define([
243
248
_addGraphicToLayer : function ( graphic ) {
244
249
// Add or project and then add graphic
245
250
if ( this . _inSpatialReference . wkid === 4326 || this . _inSpatialReference . wkid === 102100 ) {
246
- // API automatically translates between these for us, but map might not be in 102100 !
251
+ // ArcGIS API automatically translates between these!
247
252
// if (graphic.geometry.spatialReference.wkid === 4326) {
248
253
// graphic.setGeometry(webMercatorUtils.geographicToWebMercator(graphic.geometry));
249
254
// }
@@ -275,8 +280,6 @@ define([
275
280
this . _drawCountTotal = arcgisJson . length ;
276
281
}
277
282
// Add graphics to the layer with symbols, project if needed
278
- // NOTE: We could probably send a single batch request to the Geometry Server
279
- // but we'd have to re-attach all geometries to graphics. Maybe version 0.2...
280
283
for ( i = 0 ; i < this . _drawCountTotal ; i ++ ) {
281
284
feature = arcgisJson [ i ] ;
282
285
// Create graphic - magically sets the geometry type!
0 commit comments