Skip to content

Commit d703c97

Browse files
authored
[CI] Configure EditorConfig for Java files (#2740)
1 parent 3ac6397 commit d703c97

7 files changed

Lines changed: 85 additions & 81 deletions

File tree

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ charset = utf-8
2828
insert_final_newline = true
2929
trim_trailing_whitespace = true
3030

31+
[*.java]
32+
indent_size = 2
33+
indent_style = space
34+
3135
[*.xml]
3236
indent_style = space
3337

spark/common/src/main/java/org/apache/sedona/viz/core/VisualizationOperator.java

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -686,9 +686,9 @@ public ImageSerializableWrapper call(
686686
List<Tuple2<Pixel,Integer>> colorMatrix = this.distributedRasterColorMatrix.collect();
687687
for(Tuple2<Pixel,Integer> pixelColor:colorMatrix)
688688
{
689-
int pixelX = pixelColor._1().getX();
690-
int pixelY = pixelColor._1().getY();
691-
renderedImage.setRGB(pixelX, (this.resolutionY-1)-pixelY, pixelColor._2);
689+
int pixelX = pixelColor._1().getX();
690+
int pixelY = pixelColor._1().getY();
691+
renderedImage.setRGB(pixelX, (this.resolutionY-1)-pixelY, pixelColor._2);
692692
}
693693
this.rasterImage = renderedImage;
694694
*/
@@ -886,19 +886,19 @@ public Boolean call(Tuple2<Pixel, Double> pixelCount) throws Exception {
886886
/*
887887
spatialRDDwithPixelId = spatialRDDwithPixelId.reduceByKey(new Function2<Double,Double,Double>()
888888
{
889-
@Override
890-
public Double call(Double count1, Double count2) throws Exception {
891-
if(colorizeOption==ColorizeOption.SPATIALAGGREGATION)
892-
{
893-
return count1+count2;
894-
}
895-
else
896-
{
897-
//TODO, colorizeOption for uniform color and z-axis color follow the same aggregate strategy
898-
// which takes the large value. We need to find a better strategy to distinguish them.
899-
return count1>count2?count1:count2;
900-
}
901-
}
889+
@Override
890+
public Double call(Double count1, Double count2) throws Exception {
891+
if(colorizeOption==ColorizeOption.SPATIALAGGREGATION)
892+
{
893+
return count1+count2;
894+
}
895+
else
896+
{
897+
//TODO, colorizeOption for uniform color and z-axis color follow the same aggregate strategy
898+
// which takes the large value. We need to find a better strategy to distinguish them.
899+
return count1>count2?count1:count2;
900+
}
901+
}
902902
});
903903
*/
904904
this.distributedRasterCountMatrix = spatialRDDwithPixelId;
@@ -956,16 +956,16 @@ public Boolean call(Tuple2<Pixel, Double> pixelCount) throws Exception {
956956
/*
957957
spatialRDDwithPixelId = spatialRDDwithPixelId.reduceByKey(new Function2<Double,Double,Double>()
958958
{
959-
@Override
960-
public Double call(Double count1, Double count2) throws Exception {
961-
if(colorizeOption==ColorizeOption.SPATIALAGGREGATION)
962-
{
963-
return count1+count2;
964-
}
965-
else {
966-
return count1>count2?count1:count2;
967-
}
968-
}
959+
@Override
960+
public Double call(Double count1, Double count2) throws Exception {
961+
if(colorizeOption==ColorizeOption.SPATIALAGGREGATION)
962+
{
963+
return count1+count2;
964+
}
965+
else {
966+
return count1>count2?count1:count2;
967+
}
968+
}
969969
});
970970
*/
971971

spark/common/src/main/java/org/apache/sedona/viz/core/VisualizationPartitioner.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -199,29 +199,29 @@ public List<Tuple2<Pixel, Double>> assignPartitionIDs(
199199
200200
if(pixelCoordinateInPartition._1()<=0+photoFilterRadius || pixelCoordinateInPartition._1()>=partitionIntervalX-photoFilterRadius||pixelCoordinateInPartition._2()<=0+photoFilterRadius || pixelCoordinateInPartition._2()>=partitionIntervalY-photoFilterRadius)
201201
{
202-
// Second, calculate the partitions that the pixel duplicates should go to
203-
for (int x = -photoFilterRadius; x <= photoFilterRadius; x++) {
204-
for (int y = -photoFilterRadius; y <= photoFilterRadius; y++) {
205-
int neighborPixelX = pixelCoordinateInPartition._1()+x;
206-
int neighborPixelY = pixelCoordinateInPartition._2()+y;
207-
try {
208-
partitionId = RasterizationUtils.CalculatePartitionId(this.resolutionX,this.resolutionY,this.partitionX, this.partitionY, neighborPixelX, neighborPixelY);
209-
// This partition id is out of the image boundary
210-
if(partitionId<0) continue;
211-
if(!existingPartitionIds.contains(partitionId))
212-
{
213-
Pixel newPixelDuplicate = pixelDoubleTuple2._1();
214-
newPixelDuplicate.setCurrentPartitionId(partitionId);
215-
newPixelDuplicate.setDuplicate(true);
216-
existingPartitionIds.add(partitionId);
217-
duplicatePixelList.add(new Tuple2<Pixel, Double>(newPixelDuplicate, pixelDoubleTuple2._2()));
218-
}
219-
} catch (Exception e) {
220-
e.printStackTrace();
221-
}
222-
223-
}
224-
}
202+
// Second, calculate the partitions that the pixel duplicates should go to
203+
for (int x = -photoFilterRadius; x <= photoFilterRadius; x++) {
204+
for (int y = -photoFilterRadius; y <= photoFilterRadius; y++) {
205+
int neighborPixelX = pixelCoordinateInPartition._1()+x;
206+
int neighborPixelY = pixelCoordinateInPartition._2()+y;
207+
try {
208+
partitionId = RasterizationUtils.CalculatePartitionId(this.resolutionX,this.resolutionY,this.partitionX, this.partitionY, neighborPixelX, neighborPixelY);
209+
// This partition id is out of the image boundary
210+
if(partitionId<0) continue;
211+
if(!existingPartitionIds.contains(partitionId))
212+
{
213+
Pixel newPixelDuplicate = pixelDoubleTuple2._1();
214+
newPixelDuplicate.setCurrentPartitionId(partitionId);
215+
newPixelDuplicate.setDuplicate(true);
216+
existingPartitionIds.add(partitionId);
217+
duplicatePixelList.add(new Tuple2<Pixel, Double>(newPixelDuplicate, pixelDoubleTuple2._2()));
218+
}
219+
} catch (Exception e) {
220+
e.printStackTrace();
221+
}
222+
223+
}
224+
}
225225
226226
}*/
227227

spark/common/src/main/java/org/apache/sedona/viz/extension/visualizationEffect/ChoroplethMap.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -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

spark/common/src/main/java/org/apache/sedona/viz/utils/RasterizationUtils.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ public static Tuple2<Integer, Integer> FindOnePixelCoordinate(
7070
datasetBoundary = datasetBoundaryOriginal;
7171
}
7272
/*
73-
if(spatialCoordinate.x < datasetBoundary.getMinX() || spatialCoordinate.x > datasetBoundary.getMaxX())
73+
if(spatialCoordinate.x < datasetBoundary.getMinX() || spatialCoordinate.x > datasetBoundary.getMaxX())
7474
{
75-
throw new Exception("[RasterizationUtils][FindOnePixelCoordinate] This spatial coordinate is out of the given boundary. Should be ignored.");
75+
throw new Exception("[RasterizationUtils][FindOnePixelCoordinate] This spatial coordinate is out of the given boundary. Should be ignored.");
7676
}
7777
if(spatialCoordinate.y < datasetBoundaryOriginal.getMinY() || spatialCoordinate.y > datasetBoundaryOriginal.getMaxY())
7878
{
79-
throw new Exception("[RasterizationUtils][FindOnePixelCoordinate] This spatial coordinate is out of the given boundary. Should be ignored.");
79+
throw new Exception("[RasterizationUtils][FindOnePixelCoordinate] This spatial coordinate is out of the given boundary. Should be ignored.");
8080
}*/
8181

8282
Double pixelXDouble =
@@ -221,7 +221,7 @@ public static int Encode2DTo1DId(
221221
/*
222222
if((twoDimensionIdX+twoDimensionIdY*resolutionX)<0 ||(twoDimensionIdX+twoDimensionIdY*resolutionX)>(resolutionX*resolutionY-1))
223223
{
224-
throw new Exception("[RasterizationUtils][Encode2DTo1DId] This given 2 dimension coordinate is "+twoDimensionIdX+" "+twoDimensionIdY+". This coordinate is out of the given boundary and will be dropped.");
224+
throw new Exception("[RasterizationUtils][Encode2DTo1DId] This given 2 dimension coordinate is "+twoDimensionIdX+" "+twoDimensionIdY+". This coordinate is out of the given boundary and will be dropped.");
225225
}
226226
*/
227227
return twoDimensionIdX + twoDimensionIdY * resolutionX;

spark/common/src/test/java/org/apache/sedona/core/spatialRDD/LineStringRDDTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ public void testBuildQuadtreeIndex() throws Exception {
126126
@Test
127127
public void testPolygonUnion()
128128
{
129-
LineStringRDD lineStringRDD = new LineStringRDD(sc, InputLocation, offset, splitter, numPartitions);
130-
assert lineStringRDD.PolygonUnion() instanceof Polygon;
129+
LineStringRDD lineStringRDD = new LineStringRDD(sc, InputLocation, offset, splitter, numPartitions);
130+
assert lineStringRDD.PolygonUnion() instanceof Polygon;
131131
}
132132
*/
133133

spark/common/src/test/java/org/apache/sedona/core/spatialRDD/PolygonRDDTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ public void testMBR() throws Exception {
211211
@Test
212212
public void testPolygonUnion()
213213
{
214-
PolygonRDD polygonRDD = new PolygonRDD(sc, InputLocation, offset, splitter, numPartitions);
215-
assert polygonRDD.PolygonUnion() instanceof Polygon;
214+
PolygonRDD polygonRDD = new PolygonRDD(sc, InputLocation, offset, splitter, numPartitions);
215+
assert polygonRDD.PolygonUnion() instanceof Polygon;
216216
}
217217
*/
218218

0 commit comments

Comments
 (0)