This is an automated email from the ASF dual-hosted git repository.
johnbam pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git
The following commit(s) were added to refs/heads/master by this push:
new d703c97cad [CI] Configure EditorConfig for Java files (#2740)
d703c97cad is described below
commit d703c97cad18e86646464af3afbf2ae781733837
Author: John Bampton <[email protected]>
AuthorDate: Thu Mar 12 22:12:22 2026 +1000
[CI] Configure EditorConfig for Java files (#2740)
---
.editorconfig | 4 ++
.../sedona/viz/core/VisualizationOperator.java | 52 +++++++++++-----------
.../sedona/viz/core/VisualizationPartitioner.java | 46 +++++++++----------
.../visualizationEffect/ChoroplethMap.java | 48 ++++++++++----------
.../sedona/viz/utils/RasterizationUtils.java | 8 ++--
.../sedona/core/spatialRDD/LineStringRDDTest.java | 4 +-
.../sedona/core/spatialRDD/PolygonRDDTest.java | 4 +-
7 files changed, 85 insertions(+), 81 deletions(-)
diff --git a/.editorconfig b/.editorconfig
index 14a8252742..4f21cb13f2 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -28,6 +28,10 @@ charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
+[*.java]
+indent_size = 2
+indent_style = space
+
[*.xml]
indent_style = space
diff --git
a/spark/common/src/main/java/org/apache/sedona/viz/core/VisualizationOperator.java
b/spark/common/src/main/java/org/apache/sedona/viz/core/VisualizationOperator.java
index 0b617231c7..2d8bdedb71 100644
---
a/spark/common/src/main/java/org/apache/sedona/viz/core/VisualizationOperator.java
+++
b/spark/common/src/main/java/org/apache/sedona/viz/core/VisualizationOperator.java
@@ -686,9 +686,9 @@ public abstract class VisualizationOperator implements
Serializable {
List<Tuple2<Pixel,Integer>> colorMatrix =
this.distributedRasterColorMatrix.collect();
for(Tuple2<Pixel,Integer> pixelColor:colorMatrix)
{
- int pixelX = pixelColor._1().getX();
- int pixelY = pixelColor._1().getY();
- renderedImage.setRGB(pixelX, (this.resolutionY-1)-pixelY,
pixelColor._2);
+ int pixelX = pixelColor._1().getX();
+ int pixelY = pixelColor._1().getY();
+ renderedImage.setRGB(pixelX, (this.resolutionY-1)-pixelY,
pixelColor._2);
}
this.rasterImage = renderedImage;
*/
@@ -886,19 +886,19 @@ public abstract class VisualizationOperator implements
Serializable {
/*
spatialRDDwithPixelId = spatialRDDwithPixelId.reduceByKey(new
Function2<Double,Double,Double>()
{
- @Override
- public Double call(Double count1, Double count2) throws Exception {
- if(colorizeOption==ColorizeOption.SPATIALAGGREGATION)
- {
- return count1+count2;
- }
- else
- {
- //TODO, colorizeOption for uniform color and z-axis
color follow the same aggregate strategy
- // which takes the large value. We need to find a
better strategy to distinguish them.
- return count1>count2?count1:count2;
- }
- }
+ @Override
+ public Double call(Double count1, Double count2) throws Exception {
+ if(colorizeOption==ColorizeOption.SPATIALAGGREGATION)
+ {
+ return count1+count2;
+ }
+ else
+ {
+ //TODO, colorizeOption for uniform color and z-axis color follow the
same aggregate strategy
+ // which takes the large value. We need to find a better strategy to
distinguish them.
+ return count1>count2?count1:count2;
+ }
+ }
});
*/
this.distributedRasterCountMatrix = spatialRDDwithPixelId;
@@ -956,16 +956,16 @@ public abstract class VisualizationOperator implements
Serializable {
/*
spatialRDDwithPixelId = spatialRDDwithPixelId.reduceByKey(new
Function2<Double,Double,Double>()
{
- @Override
- public Double call(Double count1, Double count2) throws Exception {
- if(colorizeOption==ColorizeOption.SPATIALAGGREGATION)
- {
- return count1+count2;
- }
- else {
- return count1>count2?count1:count2;
- }
- }
+ @Override
+ public Double call(Double count1, Double count2) throws Exception {
+ if(colorizeOption==ColorizeOption.SPATIALAGGREGATION)
+ {
+ return count1+count2;
+ }
+ else {
+ return count1>count2?count1:count2;
+ }
+ }
});
*/
diff --git
a/spark/common/src/main/java/org/apache/sedona/viz/core/VisualizationPartitioner.java
b/spark/common/src/main/java/org/apache/sedona/viz/core/VisualizationPartitioner.java
index 4000d65ae4..ef46a6f173 100644
---
a/spark/common/src/main/java/org/apache/sedona/viz/core/VisualizationPartitioner.java
+++
b/spark/common/src/main/java/org/apache/sedona/viz/core/VisualizationPartitioner.java
@@ -199,29 +199,29 @@ public class VisualizationPartitioner extends Partitioner
implements Serializabl
if(pixelCoordinateInPartition._1()<=0+photoFilterRadius ||
pixelCoordinateInPartition._1()>=partitionIntervalX-photoFilterRadius||pixelCoordinateInPartition._2()<=0+photoFilterRadius
|| pixelCoordinateInPartition._2()>=partitionIntervalY-photoFilterRadius)
{
- // Second, calculate the partitions that the pixel duplicates should go
to
- for (int x = -photoFilterRadius; x <= photoFilterRadius; x++) {
- for (int y = -photoFilterRadius; y <= photoFilterRadius; y++) {
- int neighborPixelX = pixelCoordinateInPartition._1()+x;
- int neighborPixelY = pixelCoordinateInPartition._2()+y;
- try {
- partitionId =
RasterizationUtils.CalculatePartitionId(this.resolutionX,this.resolutionY,this.partitionX,
this.partitionY, neighborPixelX, neighborPixelY);
- // This partition id is out of the image
boundary
- if(partitionId<0) continue;
- if(!existingPartitionIds.contains(partitionId))
- {
- Pixel newPixelDuplicate =
pixelDoubleTuple2._1();
-
newPixelDuplicate.setCurrentPartitionId(partitionId);
- newPixelDuplicate.setDuplicate(true);
- existingPartitionIds.add(partitionId);
- duplicatePixelList.add(new
Tuple2<Pixel, Double>(newPixelDuplicate, pixelDoubleTuple2._2()));
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
- }
+ // Second, calculate the partitions that the pixel duplicates should go
to
+ for (int x = -photoFilterRadius; x <= photoFilterRadius; x++) {
+ for (int y = -photoFilterRadius; y <= photoFilterRadius; y++) {
+ int neighborPixelX = pixelCoordinateInPartition._1()+x;
+ int neighborPixelY = pixelCoordinateInPartition._2()+y;
+ try {
+ partitionId =
RasterizationUtils.CalculatePartitionId(this.resolutionX,this.resolutionY,this.partitionX,
this.partitionY, neighborPixelX, neighborPixelY);
+ // This partition id is out of the image boundary
+ if(partitionId<0) continue;
+ if(!existingPartitionIds.contains(partitionId))
+ {
+ Pixel newPixelDuplicate = pixelDoubleTuple2._1();
+ newPixelDuplicate.setCurrentPartitionId(partitionId);
+ newPixelDuplicate.setDuplicate(true);
+ existingPartitionIds.add(partitionId);
+ duplicatePixelList.add(new Tuple2<Pixel,
Double>(newPixelDuplicate, pixelDoubleTuple2._2()));
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+ }
}*/
diff --git
a/spark/common/src/main/java/org/apache/sedona/viz/extension/visualizationEffect/ChoroplethMap.java
b/spark/common/src/main/java/org/apache/sedona/viz/extension/visualizationEffect/ChoroplethMap.java
index de51b34cda..dd6dd93d6c 100644
---
a/spark/common/src/main/java/org/apache/sedona/viz/extension/visualizationEffect/ChoroplethMap.java
+++
b/spark/common/src/main/java/org/apache/sedona/viz/extension/visualizationEffect/ChoroplethMap.java
@@ -159,31 +159,31 @@ public class ChoroplethMap extends VisualizationOperator {
@Override
protected JavaPairRDD<Integer, Color> GenerateColorMatrix()
{
- //This Color Matrix version controls some too high pixel weights by
dividing the max weight to 1/4.
- logger.debug("[VisualizationOperator][GenerateColorMatrix][Start]");
- final long maxWeight = this.distributedCountMatrix.max(new
PixelCountComparator())._2;
- final long minWeight = 0;
- System.out.println("Max weight "+maxWeight);
- JavaPairRDD<Integer, Long> normalizedPixelWeights =
this.distributedCountMatrix.mapToPair(new PairFunction<Tuple2<Integer,Long>,
Integer, Long>(){
- @Override
- public Tuple2<Integer, Long> call(Tuple2<Integer, Long>
pixelWeight) throws Exception {
- if(pixelWeight._2>maxWeight/20)
- {
- return new Tuple2<Integer,
Long>(pixelWeight._1,new Long(255));
- }
- return new Tuple2<Integer,
Long>(pixelWeight._1,(pixelWeight._2-minWeight)*255/(maxWeight/20-minWeight));
- }});
- this.distributedColorMatrix = normalizedPixelWeights.mapToPair(new
PairFunction<Tuple2<Integer,Long>,Integer,Color>()
- {
+ //This Color Matrix version controls some too high pixel weights by
dividing the max weight to 1/4.
+ logger.debug("[VisualizationOperator][GenerateColorMatrix][Start]");
+ final long maxWeight = this.distributedCountMatrix.max(new
PixelCountComparator())._2;
+ final long minWeight = 0;
+ System.out.println("Max weight "+maxWeight);
+ JavaPairRDD<Integer, Long> normalizedPixelWeights =
this.distributedCountMatrix.mapToPair(new PairFunction<Tuple2<Integer,Long>,
Integer, Long>(){
+ @Override
+ public Tuple2<Integer, Long> call(Tuple2<Integer, Long> pixelWeight)
throws Exception {
+ if(pixelWeight._2>maxWeight/20)
+ {
+ return new Tuple2<Integer, Long>(pixelWeight._1,new Long(255));
+ }
+ return new Tuple2<Integer,
Long>(pixelWeight._1,(pixelWeight._2-minWeight)*255/(maxWeight/20-minWeight));
+ }});
+ this.distributedColorMatrix = normalizedPixelWeights.mapToPair(new
PairFunction<Tuple2<Integer,Long>,Integer,Color>()
+ {
- @Override
- public Tuple2<Integer, Color> call(Tuple2<Integer, Long>
pixelCount) throws Exception {
- Color pixelColor =
EncodeColor(pixelCount._2.intValue());
- return new
Tuple2<Integer,Color>(pixelCount._1,pixelColor);
- }
- });
- logger.debug("[VisualizationOperator][GenerateColorMatrix][Stop]");
- return this.distributedColorMatrix;
+ @Override
+ public Tuple2<Integer, Color> call(Tuple2<Integer, Long> pixelCount)
throws Exception {
+ Color pixelColor = EncodeColor(pixelCount._2.intValue());
+ return new Tuple2<Integer,Color>(pixelCount._1,pixelColor);
+ }
+ });
+ logger.debug("[VisualizationOperator][GenerateColorMatrix][Stop]");
+ return this.distributedColorMatrix;
}
*/
diff --git
a/spark/common/src/main/java/org/apache/sedona/viz/utils/RasterizationUtils.java
b/spark/common/src/main/java/org/apache/sedona/viz/utils/RasterizationUtils.java
index b181d44596..b576756fbb 100644
---
a/spark/common/src/main/java/org/apache/sedona/viz/utils/RasterizationUtils.java
+++
b/spark/common/src/main/java/org/apache/sedona/viz/utils/RasterizationUtils.java
@@ -70,13 +70,13 @@ public class RasterizationUtils implements Serializable {
datasetBoundary = datasetBoundaryOriginal;
}
/*
- if(spatialCoordinate.x < datasetBoundary.getMinX() || spatialCoordinate.x
> datasetBoundary.getMaxX())
+ if(spatialCoordinate.x < datasetBoundary.getMinX() || spatialCoordinate.x
> datasetBoundary.getMaxX())
{
- throw new Exception("[RasterizationUtils][FindOnePixelCoordinate] This
spatial coordinate is out of the given boundary. Should be ignored.");
+ throw new Exception("[RasterizationUtils][FindOnePixelCoordinate] This
spatial coordinate is out of the given boundary. Should be ignored.");
}
if(spatialCoordinate.y < datasetBoundaryOriginal.getMinY() ||
spatialCoordinate.y > datasetBoundaryOriginal.getMaxY())
{
- throw new Exception("[RasterizationUtils][FindOnePixelCoordinate] This
spatial coordinate is out of the given boundary. Should be ignored.");
+ throw new Exception("[RasterizationUtils][FindOnePixelCoordinate] This
spatial coordinate is out of the given boundary. Should be ignored.");
}*/
Double pixelXDouble =
@@ -221,7 +221,7 @@ public class RasterizationUtils implements Serializable {
/*
if((twoDimensionIdX+twoDimensionIdY*resolutionX)<0
||(twoDimensionIdX+twoDimensionIdY*resolutionX)>(resolutionX*resolutionY-1))
{
- 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.");
+ 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.");
}
*/
return twoDimensionIdX + twoDimensionIdY * resolutionX;
diff --git
a/spark/common/src/test/java/org/apache/sedona/core/spatialRDD/LineStringRDDTest.java
b/spark/common/src/test/java/org/apache/sedona/core/spatialRDD/LineStringRDDTest.java
index f5a70e09e5..7e4d3a7000 100644
---
a/spark/common/src/test/java/org/apache/sedona/core/spatialRDD/LineStringRDDTest.java
+++
b/spark/common/src/test/java/org/apache/sedona/core/spatialRDD/LineStringRDDTest.java
@@ -126,8 +126,8 @@ public class LineStringRDDTest extends SpatialRDDTestBase {
@Test
public void testPolygonUnion()
{
- LineStringRDD lineStringRDD = new LineStringRDD(sc, InputLocation,
offset, splitter, numPartitions);
- assert lineStringRDD.PolygonUnion() instanceof Polygon;
+ LineStringRDD lineStringRDD = new LineStringRDD(sc, InputLocation, offset,
splitter, numPartitions);
+ assert lineStringRDD.PolygonUnion() instanceof Polygon;
}
*/
diff --git
a/spark/common/src/test/java/org/apache/sedona/core/spatialRDD/PolygonRDDTest.java
b/spark/common/src/test/java/org/apache/sedona/core/spatialRDD/PolygonRDDTest.java
index 097cf7a706..0df86f5861 100644
---
a/spark/common/src/test/java/org/apache/sedona/core/spatialRDD/PolygonRDDTest.java
+++
b/spark/common/src/test/java/org/apache/sedona/core/spatialRDD/PolygonRDDTest.java
@@ -211,8 +211,8 @@ public class PolygonRDDTest extends SpatialRDDTestBase {
@Test
public void testPolygonUnion()
{
- PolygonRDD polygonRDD = new PolygonRDD(sc, InputLocation, offset,
splitter, numPartitions);
- assert polygonRDD.PolygonUnion() instanceof Polygon;
+ PolygonRDD polygonRDD = new PolygonRDD(sc, InputLocation, offset,
splitter, numPartitions);
+ assert polygonRDD.PolygonUnion() instanceof Polygon;
}
*/