Commit ff8fa1d8 authored by a001188's avatar a001188
Browse files

Initial commit

parent 2b68da01
......@@ -37,8 +37,8 @@ public class Coordinate{
this.c=c;
}
public void fitToFrame(Dimension dimension, GridCorners gridCorners, String type){
if(type.equals(Coordinates.LONLAT)){
public void fitToFrame(Dimension dimension, MatrixCorners gridCorners, String type){
if(type.equals(Matrix.LONLAT)){
double lon1= Math.min(gridCorners.R0C0.lon, gridCorners.R0Cn.lon);
double lat1= Math.min(gridCorners.R0C0.lat, gridCorners.R0Cn.lat);
double lon2= Math.max(gridCorners.RmC0.lon, gridCorners.RmCn.lon);
......@@ -46,12 +46,15 @@ public class Coordinate{
double lonWidth = lon2-lon1;
double latHight = lat2-lat1;
this.x = (int)Math.round(((lat-gridCorners.R0C0.lat)/latHight * HEIGHT + OFFSET_X) * dimension.width);
this.y = (int)Math.round(((lon-gridCorners.R0C0.lon)/lonWidth * WIDTH + OFFSET_Y) * dimension.width);
this.x = (int)Math.round(((lat-gridCorners.R0C0.lat)/lonWidth * HEIGHT + OFFSET_X) * dimension.width);
this.y = (int)Math.round(((lon-gridCorners.R0C0.lon)/latHight * WIDTH + OFFSET_Y) * dimension.height);
// this.y= (int)Math.round(((lat-lat1)*30 + 100) );
// this.x = (int)Math.round(((lon-lon1)*30 + 100));
}
else{
double gridWidth = gridCorners.R0Cn.c - gridCorners.R0C0.c;
double gridHeight = gridCorners.RmC0.r - gridCorners.R0C0.r;
double gridWidth = gridCorners.R0Cn.c - gridCorners.R0C0.c+1;
double gridHeight = gridCorners.RmC0.r - gridCorners.R0C0.r+1;
this.x = (int)Math.round((c/gridWidth * HEIGHT + OFFSET_X) * dimension.width);
this.y = (int)Math.round((r/gridHeight * WIDTH + OFFSET_Y) * dimension.height);
}
......@@ -87,6 +90,12 @@ public class Coordinate{
sb.append(y);
sb.append("] => ");
sb.append(value);
sb.append(" Direction: ");
if(direction!=null)
sb.append(direction);
else
sb.append("null");
return sb.toString();
}
......
......@@ -16,10 +16,10 @@ import javax.swing.JFrame;
*/
public class GUI extends JFrame{
private final Polygons polygons = new Polygons();
private final Coordinates coords;
private final String type = Coordinates.RC;
private final Matrix coords;
private final String type = Matrix.RC;
public GUI(Coordinates coords){
public GUI(Matrix coords){
this.coords = coords;
}
......@@ -38,16 +38,17 @@ public class GUI extends JFrame{
g.clearRect(0,0, this.getSize().width, this.getSize().height);
coords.fitToFrame(getSize(), type);
drawGrid(g, coords);
drawCorners(g, coords.getGridCorners());
for(int p = 0; p < polygons.size(); p++)
drawIso(g, polygons.get(p));
}
private void drawGrid(Graphics g, Coordinates coords){
private void drawGrid(Graphics g, Matrix coords){
coords.fitToFrame(getSize(), type);
g.setColor(Color.LIGHT_GRAY);
int s = 14;
int s = 1;
int x11;
int x21;
int x12;
......@@ -106,11 +107,7 @@ public class GUI extends JFrame{
g.drawLine(x1, y1, x2, y2);
}
g.setColor(Color.BLUE); //Corner
drawDot(g, coords.getCoordinate(0, 0));
drawDot(g, coords.getCoordinate(coords.getRows()-1, 0));
drawDot(g, coords.getCoordinate(0, coords.getCols()-1));
drawDot(g, coords.getCoordinate(coords.getRows()-1, coords.getCols()-1));
}
......@@ -129,9 +126,13 @@ public class GUI extends JFrame{
}
}
private void drawDot(Graphics g, Coordinate coord){
private void drawCorners(Graphics g, MatrixCorners gridCorners){
int dotDiameter = 4;
g.drawOval(coord.x - dotDiameter/2, coord.y - dotDiameter/2, dotDiameter, dotDiameter);
g.setColor(Color.BLUE); //Corner
g.drawOval(gridCorners.R0C0.x - dotDiameter/2, gridCorners.R0C0.y - dotDiameter/2, dotDiameter, dotDiameter);
g.drawOval(gridCorners.R0Cn.x - dotDiameter/2, gridCorners.R0Cn.y - dotDiameter/2, dotDiameter, dotDiameter);
g.drawOval(gridCorners.RmC0.x - dotDiameter/2, gridCorners.RmC0.y - dotDiameter/2, dotDiameter, dotDiameter);
g.drawOval(gridCorners.RmCn.x - dotDiameter/2, gridCorners.RmCn.y - dotDiameter/2, dotDiameter, dotDiameter);
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package isospline;
import java.util.ArrayList;
/**
*
* @author a001188
*/
public class IsoLinearSplineElementList extends ArrayList{
}
......@@ -13,42 +13,49 @@ import java.awt.Color;
* @author a001188
*/
public class IsoSpline {
private final Coordinates coords;
private final Matrix coords;
private final ArrayList<Double> isoLevels = new ArrayList();
private final GUI gui;
private final double min;
private final double max;
private final double avg;
public IsoSpline(GUI gui, Coordinates coords){
public IsoSpline(GUI gui, Matrix coords){
this.coords=coords;
this.gui=gui;
this.avg = coords.average();
this.min = coords.getMin();
this.max = coords.getMax();
for(int i=0;i<Main.ISO_LEVELS;i++)
isoLevels.add(i * (max-min)/(Main.ISO_LEVELS-1) + min);
for(int i=1;i<Main.ISO_LEVELS+1;i++)
isoLevels.add(i * (max-min)/(Main.ISO_LEVELS+1) + min);
System.out.println("Matrix min: " + min + ", Matrix max: " + max + " Matrix avg: " + avg);
System.out.println("isoLevels (" + isoLevels.size() + "): " + isoLevels);
}
public void createIso(Coordinates coords, String name, Color color){
Polygon polygon = null;
Polygons polygons = null;
public void createIso(Matrix coords, String name, Color color){
Polygon coordinatPairs = null;
Polygons coordinatePairsList = new Polygons();
for(int n=0; n<isoLevels.size(); n++){
polygon = new Polygon(isoLevels.get(n), name, color, coords.get(0));
coordinatPairs = new Polygon(isoLevels.get(n), name, color, coords.get(0));
LinearSplineElements lse = new LinearSplineElements(coords, isoLevels.get(n), null);
for(int i = 0; i<lse.size(); i++){
Coordinate coord1 = lse.get(i).coord1;
Coordinate coord2 = lse.get(i).coord2;
String direction1 = lse.get(i).coord1.direction;
String direction2 = lse.get(i).coord2.direction;
polygon.add(new CoordinatePair(coord1,coord2, direction1, direction2));
coordinatPairs.add(new CoordinatePair(coord1,coord2, direction1, direction2));
}
if(polygon.size()>0)
polygons = polygon.getSeparatePolygons(name, color);
if(coordinatPairs.size()>0)
coordinatePairsList.add(coordinatPairs);
}
for(int i =0; i<polygons.size(); i++)
gui.addPolygon(polygons.get(i));
Polygons polygons = new Polygons();
if(coordinatPairs!=null)
for(int i = 0; i<coordinatePairsList.size();i++)
polygons = coordinatPairs.getSeparatePolygons(name, color);
for(int j=0; j<polygons.size();j++)
gui.addPolygon(polygons.get(j));
gui.repaint();
}
......@@ -57,9 +64,9 @@ public class IsoSpline {
public void filtering(){
int filterWidth = 2;
int filtrations = 10;
Coordinates tmp;
Matrix tmp;
for(int i = 0; i<filtrations; i++){
tmp = (Coordinates)coords.clone();
tmp = (Matrix)coords.clone();
for(int r = filterWidth; r<coords.getRows()-filterWidth-1; r++)
for(int c = filterWidth; c<coords.getCols()-filterWidth-1; c++){
coords.setValue(r, c, tmp.getFilteredValue(r, c, filterWidth));
......
......@@ -15,18 +15,36 @@ import org.json.*;
*
* @author a001188
*/
/*
http://opendata-download-metfcst.smhi.se/api/category/pmp2g/version/2/geotype/multipoint/validtime/20170923T180000Z/parameter/msl/leveltype/hmsl/level/0/data.json?with-geo=false&downsample=1
*/
public class JSONMatrix{
private final static HashMap<Long, Integer> statistics = new HashMap();
private static int rows=613;
private static int cols=753;
public static JSONObject parseJSONFile(String filename) throws JSONException, IOException {
String content = new String(Files.readAllBytes(Paths.get(filename)));
return new JSONObject(content);
}
public static Coordinates read() throws IOException, JSONException {
Coordinates coords = new Coordinates(612,752);
String gridfilename = "D:\\git\\GribVisualizer\\src\\isospline\\data\\multipoint.json";
String datafilename = "D:\\git\\GribVisualizer\\src\\isospline\\data\\data_temp.json";
public static Matrix read() throws IOException, JSONException {
boolean test = true;
String gridfilename;
String datafilename;
if(test){
rows=4;
cols=4;
gridfilename = "D:\\git\\GribVisualizer\\src\\isospline\\data\\testmultipoint.json";
datafilename = "D:\\git\\GribVisualizer\\src\\isospline\\data\\test_data.json";
}
else{
rows=613;
cols=753;
gridfilename = "D:\\git\\GribVisualizer\\src\\isospline\\data\\multipoint.json";
datafilename = "D:\\git\\GribVisualizer\\src\\isospline\\data\\data_temp.json";
}
Matrix coords = new Matrix(rows,cols);
JSONObject gridObject = parseJSONFile(gridfilename);
JSONArray coordinatesArray = gridObject.getJSONArray("coordinates");
......@@ -53,17 +71,17 @@ public class JSONMatrix{
updateStatistics(lon,lat,value);
coord = new Coordinate(null, lon, lat, r, c, filteredValue(lon, lat, value));
coords.add(coord);
if(c<752){
if(c<cols-1){
c++;
}
else{
System.out.println(coord + " size " + coords.size());
//System.out.println(coord + " size " + coords.size());
c=0;
r++;
}
prevLon=lon;
}
System.out.println(coord + " size " + coords.size());
//System.out.println(coord + " size " + coords.size());
System.out.println(coords.toString());
Iterator<Long> keys = statistics.keySet().iterator();
Long key;
......
......@@ -12,10 +12,14 @@ package isospline;
public class LinearSplineElement {
public final Coordinate coord1;
public final Coordinate coord2;
public LinearSplineElement(Coordinate intersept1, Coordinate intersept2){
this.coord1=intersept1;
this.coord2=intersept2;
public final String dírection1;
public final String dírection2;
public LinearSplineElement(Coordinate coord1, Coordinate coors2, String direction1, String direction2){
this.coord1=coord1;
this.coord2=coors2;
this.dírection1=direction1;
this.dírection2=direction2;
}
public int compareTo(LinearSplineElement lse) {
......@@ -25,6 +29,21 @@ public class LinearSplineElement {
return -1;
}
public boolean hasEqual(Coordinate coord){
if(coord.equals(coord1) || coord.equals(coord2))
return true;
return false;
}
public Coordinate getOpposite(Coordinate coord){
if(coord.equals(coord1))
return coord2;
else
return coord1;
}
public double getZ1(){
return coord1.value;
}
......
......@@ -14,11 +14,11 @@ import java.util.ArrayList;
* @author peter
*/
public class LinearSplineElements extends ArrayList<LinearSplineElement>{
Coordinates intersepts;
Matrix intersepts;
public LinearSplineElements(Coordinates coords, double isoLevel, Float front){
public LinearSplineElements(Matrix coords, double isoLevel, Float front){
for(int r = 0; r < coords.getRows() - 1; r++)
for(int c = 0; c < coords.getCols() - 1; c++){
if(front==null){
......@@ -42,34 +42,10 @@ public class LinearSplineElements extends ArrayList<LinearSplineElement>{
}
return sb.toString();
}
/*
private void createDerivateIntersepts(Coordinates coords, int r, int c, double front){
intersepts = new Coordinates();
// North
if(Math.abs(coords.getValue(r, c) - coords.getValue(r, c + 1)) > front) //verticals
add(new LinearSplineElement(new Intersept(r, c, r, c, coords.getValue(r, c)), new Intersept(r, c, r,c+1, coords.getValue(r, c+1))));
// West
if(Math.abs(coords.getValue(r, c) - coords.getValue(r + 1, c)) > front)
add(new LinearSplineElement(new Intersept(r, c, r, c, coords.getValue(r, c)), new Intersept(r, c, r+1,c, coords.getValue(r+1, c))));
// SouthEast
if(Math.abs(coords.getValue(r, c) - coords.getValue(r + 1, c + 1)) > front * (float)Math.pow(2, 0.5))
add(new LinearSplineElement(new Intersept(r, c, r, c, coords.getValue(r, c)), new Intersept(r, c, r+1,c+1, coords.getValue(r+1, c+1))));
// SouthWest
if(Math.abs(coords.getValue(r, c + 1) - coords.getValue(r + 1, c)) > front * (float)Math.pow(2, 0.5))
add(new LinearSplineElement(new Intersept(r, c, r, c + 1, coords.getValue(r + 1, c)), new Intersept(r, c, r + 1, c, coords.getValue(r + 1, c))));
// East
if(Math.abs(coords.getValue(r, c + 1) - coords.getValue(r + 1, c + 1)) > front * (float)Math.pow(2, 0.5))
add(new LinearSplineElement(new Intersept(r, c, r, c + 1, coords.getValue(r + 1, c)), new Intersept(r, c, r + 1, c + 1, coords.getValue(r + 1, c + 1))));
// South
if(Math.abs(coords.getValue(r + 1, c) - coords.getValue(r + 1, c + 1)) > front * (float)Math.pow(2, 0.5))
add(new LinearSplineElement(new Intersept(r, c, r + 1, c, coords.getValue(r + 1, c)), new Intersept(r, c, r + 1, c + 1, coords.getValue(r + 1, c + 1))));
}
*/
private void createIntersepts(Coordinates coords, int r, int c, double isoLevel){
private void createIntersepts(Matrix coords, int r, int c, double isoLevel){
Directions directions = new Directions(new Dimension(r,c));
intersepts = new Coordinates(coords.getRows(), coords.getCols());
intersepts = new Matrix(coords.getRows(), coords.getCols());
for(int i=0; i<directions.size(); i++){
Direction direction = directions.get(i);
Coordinate coord1 = coords.getCoordinate(direction.c1, direction.r1);
......@@ -98,10 +74,36 @@ public class LinearSplineElements extends ArrayList<LinearSplineElement>{
//intersepts.add(coord1);
//intersepts.add(coord2);
}
}
private Coordinate createtIntersept(String direction, Coordinate coord1, Coordinate coord2, double isoLevel){
double v1 = coord1.value;
double v2 = coord2.value;
double range = (isoLevel - v1)/(v2 - v1);
double lat = range * (coord2.lat-coord1.lat) + coord1.lat;
double lon = range * (coord2.lon-coord1.lon) + coord1.lon;
int r = coord1.r;
int c = coord1.c;
return new Coordinate(direction, lon, lat, r, c, isoLevel);
}
private void createSplineElement(Matrix matrix) {
if(matrix.size()==2)
add(new LinearSplineElement(matrix.get(0), matrix.get(1), direction1, direction2));
if(matrix.size()>21)
for(int i = 0;i < matrix.size() - 1; i++)
for(int j = i +1 ; j < matrix.size(); j++){
double xi = matrix.get(i).x;
double yi = matrix.get(i).y;
double xj = matrix.get(j).x;
double yj = matrix.get(j).y;
if(Math.abs(xi-xj) < 1 && Math.abs(yi-yj) < 1)
add(new LinearSplineElement(matrix.get(i), matrix.get(j), direction1, direction2));
}
}
/*
private void addIntersept(Coordinates coords, Direction direction, double isoLevel){
private void addIntersept(Matrix coords, Direction direction, double isoLevel){
double v1 = coords.getValue(direction.c1, direction.r1);
double v2 = coords.getValue(direction.c2, direction.r2);
double intersept = getIntersept(v1, v2, isoLevel);
......@@ -149,32 +151,29 @@ public class LinearSplineElements extends ArrayList<LinearSplineElement>{
}
*/
private Coordinate createtIntersept(String direction, Coordinate coord1, Coordinate coord2, double isoLevel){
double v1 = coord1.value;
double v2 = coord2.value;
double range = (isoLevel - v1)/(v2 - v1);
double lat = range * (coord2.lat-coord1.lat) + coord1.lat;
double lon = range * (coord2.lon-coord1.lon) + coord1.lon;
int r = coord1.r;
int c = coord1.c;
return new Coordinate(direction, lon, lat, r, c, isoLevel);
/*
private void createDerivateIntersepts(Matrix coords, int r, int c, double front){
intersepts = new Matrix();
// North
if(Math.abs(coords.getValue(r, c) - coords.getValue(r, c + 1)) > front) //verticals
add(new LinearSplineElement(new Intersept(r, c, r, c, coords.getValue(r, c)), new Intersept(r, c, r,c+1, coords.getValue(r, c+1))));
// West
if(Math.abs(coords.getValue(r, c) - coords.getValue(r + 1, c)) > front)
add(new LinearSplineElement(new Intersept(r, c, r, c, coords.getValue(r, c)), new Intersept(r, c, r+1,c, coords.getValue(r+1, c))));
// SouthEast
if(Math.abs(coords.getValue(r, c) - coords.getValue(r + 1, c + 1)) > front * (float)Math.pow(2, 0.5))
add(new LinearSplineElement(new Intersept(r, c, r, c, coords.getValue(r, c)), new Intersept(r, c, r+1,c+1, coords.getValue(r+1, c+1))));
// SouthWest
if(Math.abs(coords.getValue(r, c + 1) - coords.getValue(r + 1, c)) > front * (float)Math.pow(2, 0.5))
add(new LinearSplineElement(new Intersept(r, c, r, c + 1, coords.getValue(r + 1, c)), new Intersept(r, c, r + 1, c, coords.getValue(r + 1, c))));
// East
if(Math.abs(coords.getValue(r, c + 1) - coords.getValue(r + 1, c + 1)) > front * (float)Math.pow(2, 0.5))
add(new LinearSplineElement(new Intersept(r, c, r, c + 1, coords.getValue(r + 1, c)), new Intersept(r, c, r + 1, c + 1, coords.getValue(r + 1, c + 1))));
// South
if(Math.abs(coords.getValue(r + 1, c) - coords.getValue(r + 1, c + 1)) > front * (float)Math.pow(2, 0.5))
add(new LinearSplineElement(new Intersept(r, c, r + 1, c, coords.getValue(r + 1, c)), new Intersept(r, c, r + 1, c + 1, coords.getValue(r + 1, c + 1))));
}
private void createSplineElement(Coordinates intersepts) {
if(intersepts.size()==2)
add(new LinearSplineElement(intersepts.get(0), intersepts.get(1)));
if(intersepts.size()>21)
for(int i = 0;i < intersepts.size() - 1; i++)
for(int j = i +1 ; j < intersepts.size(); j++){
double xi = intersepts.get(i).x;
double yi = intersepts.get(i).y;
double xj = intersepts.get(j).x;
double yj = intersepts.get(j).y;
if(Math.abs(xi-xj) < 1 && Math.abs(yi-yj) < 1)
add(new LinearSplineElement(intersepts.get(i), intersepts.get(j)));
}
}
*/
}
......@@ -15,19 +15,19 @@ import org.json.JSONException;
* @author a001188
*/
public class Main {
public static final int ISO_LEVELS = 17;
public static final int ISO_LEVELS = 2;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try {
Coordinates coords = JSONMatrix.read();
Matrix coords = JSONMatrix.read();
System.out.println("Coords size: " + coords.size());
GUI gui = new GUI(coords);
IsoSpline ip = new IsoSpline(gui, coords);
//ip.createIso(coords, "Original", Color.GRAY);
ip.filtering();
gui.setSize(1900,1000);
gui.setSize(1000,1000);
gui.setVisible(true);
}
catch (IOException ex) {
......@@ -37,7 +37,4 @@ public class Main {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
/*
http://opendata-download-metfcst.smhi.se/api/category/pmp2g/version/2/geotype/multipoint/validtime/20170923T180000Z/parameter/msl/leveltype/hmsl/level/0/data.json?with-geo=false&downsample=1
*/
}
......@@ -12,7 +12,7 @@ import java.util.ArrayList;
*
* @author a001188
*/
public class Coordinates extends ArrayList<Coordinate>{
public class Matrix extends ArrayList<Coordinate>{
public static final String LONLAT = "lonlat";
public static final String RC = "RC";
private final int rows;
......@@ -20,20 +20,20 @@ public class Coordinates extends ArrayList<Coordinate>{
private Coordinate maxCoordinate;
private Coordinate minCoordinate;
public Coordinates(int rows, int cols){
public Matrix(int rows, int cols){
this.rows=rows;
this.cols=cols;
}
public void fitToFrame(Dimension dimension, String type){
this.forEach((coord) -> {
coord.fitToFrame(dimension, getGridCorners(), RC);
coord.fitToFrame(dimension, getGridCorners(), LONLAT);
});
}
public GridCorners getGridCorners(){
return new GridCorners(getCoordinate(0,0), getCoordinate(0,getCols()), getCoordinate(getRows(),0), getCoordinate(getRows(),getCols()));
public MatrixCorners getGridCorners(){
return new MatrixCorners(getCoordinate(0,0), getCoordinate(0,getCols()-1), getCoordinate(getRows()-1,0), getCoordinate(getRows()-1,getCols()-1));
}
......@@ -72,14 +72,7 @@ public class Coordinates extends ArrayList<Coordinate>{
public boolean add(Coordinate coord){
boolean ok;
ok = super.add(coord);
// if(size()>1){
// if(get(size()-1).lon < get(size()-2).lon){
// if(rows == 2)
// cols = size()-1;
//
// rows++;
// }
// }
return ok;
}
......@@ -196,7 +189,7 @@ public class Coordinates extends ArrayList<Coordinate>{
private int getIndexFromCoord(int row, int col){
int index;
index = row * (getCols()+1) + col ;
index = row * getCols() + col ;
return index;
}
......@@ -208,17 +201,17 @@ public class Coordinates extends ArrayList<Coordinate>{
sb.append(" index: ");
sb.append(getIndexFromCoord(0,0));
sb.append("\r\n");
sb.append(getCoordinate(0,getCols()));
sb.append(getCoordinate(0,getCols()-1));
sb.append(" index: ");
sb.append(getIndexFromCoord(0,getCols()));
sb.append(getIndexFromCoord(0,getCols()-1));
sb.append("\r\n");
sb.append(getCoordinate(getRows(),0));
sb.append(getCoordinate(getRows()-1,0));
sb.append(" index: ");
sb.append(getIndexFromCoord(getRows(),0));
sb.append(getIndexFromCoord(getRows()-1,0));
sb.append("\r\n");
sb.append(getCoordinate(getRows(),getCols()));
sb.append(getCoordinate(getRows()-1,getCols()-1));
sb.append(" index: ");
sb.append(getIndexFromCoord(getRows(),getCols()));
sb.append(getIndexFromCoord(getRows()-1,getCols()-1));
sb.append("\r\n");
sb.append("Number of grindpoints: ");
sb.append(size());
......
package isospline;
import isospline.Coordinate;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
......@@ -13,13 +10,13 @@ import isospline.Coordinate;
*
* @author a001188
*/
public class GridCorners {
public class MatrixCorners {
public final Coordinate R0C0;
public final Coordinate R0Cn;
public final Coordinate RmC0;
public final Coordinate RmCn;
public GridCorners(Coordinate R0C0, Coordinate R0Cn, Coordinate RmC0, Coordinate RmCn){
public MatrixCorners(Coordinate R0C0, Coordinate R0Cn, Coordinate RmC0, Coordinate RmCn){
this.R0C0=R0C0;
this.R0Cn=R0Cn;
this.RmC0=RmC0;
......
......@@ -8,6 +8,7 @@ package isospline;
import java.awt.Color;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.Collection;
/**
*
......@@ -27,58 +28,61 @@ public class Polygon extends ArrayList<CoordinatePair>{
this.name = name;
this.color = color;