@@ -159,31 +159,31 @@ public ChoroplethMap(
159159 @Override
160160 protected JavaPairRDD<Integer, Color> GenerateColorMatrix()
161161 {
162- //This Color Matrix version controls some too high pixel weights by dividing the max weight to 1/4.
163- logger.debug("[VisualizationOperator][GenerateColorMatrix][Start]");
164- final long maxWeight = this.distributedCountMatrix.max(new PixelCountComparator())._2;
165- final long minWeight = 0;
166- System.out.println("Max weight "+maxWeight);
167- JavaPairRDD<Integer, Long> normalizedPixelWeights = this.distributedCountMatrix.mapToPair(new PairFunction<Tuple2<Integer,Long>, Integer, Long>(){
168- @Override
169- public Tuple2<Integer, Long> call(Tuple2<Integer, Long> pixelWeight) throws Exception {
170- if(pixelWeight._2>maxWeight/20)
171- {
172- return new Tuple2<Integer, Long>(pixelWeight._1,new Long(255));
173- }
174- return new Tuple2<Integer, Long>(pixelWeight._1,(pixelWeight._2-minWeight)*255/(maxWeight/20-minWeight));
175- }});
176- this.distributedColorMatrix = normalizedPixelWeights.mapToPair(new PairFunction<Tuple2<Integer,Long>,Integer,Color>()
177- {
162+ //This Color Matrix version controls some too high pixel weights by dividing the max weight to 1/4.
163+ logger.debug("[VisualizationOperator][GenerateColorMatrix][Start]");
164+ final long maxWeight = this.distributedCountMatrix.max(new PixelCountComparator())._2;
165+ final long minWeight = 0;
166+ System.out.println("Max weight "+maxWeight);
167+ JavaPairRDD<Integer, Long> normalizedPixelWeights = this.distributedCountMatrix.mapToPair(new PairFunction<Tuple2<Integer,Long>, Integer, Long>(){
168+ @Override
169+ public Tuple2<Integer, Long> call(Tuple2<Integer, Long> pixelWeight) throws Exception {
170+ if(pixelWeight._2>maxWeight/20)
171+ {
172+ return new Tuple2<Integer, Long>(pixelWeight._1,new Long(255));
173+ }
174+ return new Tuple2<Integer, Long>(pixelWeight._1,(pixelWeight._2-minWeight)*255/(maxWeight/20-minWeight));
175+ }});
176+ this.distributedColorMatrix = normalizedPixelWeights.mapToPair(new PairFunction<Tuple2<Integer,Long>,Integer,Color>()
177+ {
178178
179- @Override
180- public Tuple2<Integer, Color> call(Tuple2<Integer, Long> pixelCount) throws Exception {
181- Color pixelColor = EncodeColor(pixelCount._2.intValue());
182- return new Tuple2<Integer,Color>(pixelCount._1,pixelColor);
183- }
184- });
185- logger.debug("[VisualizationOperator][GenerateColorMatrix][Stop]");
186- return this.distributedColorMatrix;
179+ @Override
180+ public Tuple2<Integer, Color> call(Tuple2<Integer, Long> pixelCount) throws Exception {
181+ Color pixelColor = EncodeColor(pixelCount._2.intValue());
182+ return new Tuple2<Integer,Color>(pixelCount._1,pixelColor);
183+ }
184+ });
185+ logger.debug("[VisualizationOperator][GenerateColorMatrix][Stop]");
186+ return this.distributedColorMatrix;
187187 }
188188 */
189189
0 commit comments