Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Peter Lundin
iso_spline_2
Commits
c55941c2
Commit
c55941c2
authored
Oct 01, 2017
by
a001188
Browse files
Initial commit
parent
2007b153
Changes
9
Show whitespace changes
Inline
Side-by-side
isospline/IsoSpline.java
View file @
c55941c2
...
...
@@ -14,7 +14,7 @@ import java.awt.Color;
* @author a001188
*/
public
class
IsoSpline
{
private
final
IsoSplineContainers
isc
;
private
final
IsoSplineContainers
isc
s
;
private
final
IsoApi
matrix
;
private
final
double
min
;
private
final
double
max
;
...
...
@@ -25,8 +25,8 @@ public class IsoSpline {
this
.
avg
=
matrix
.
average
();
this
.
min
=
matrix
.
min
();
this
.
max
=
matrix
.
max
();
isc
=
new
IsoSplineContainers
(
matrix
.
getRows
()-
1
,
matrix
.
getCols
()-
1
);
isc
.
createIsoSplineContainers
(
matrix
);
isc
s
=
new
IsoSplineContainers
(
matrix
.
getRows
()-
1
,
matrix
.
getCols
()-
1
);
isc
s
.
createIsoSplineContainers
(
matrix
);
}
...
...
@@ -40,22 +40,80 @@ public class IsoSpline {
}
public
Polygon
createIso
(
IsoApi
matrix
,
String
name
,
Color
color
,
double
isoLevel
){
public
Polygon
s
createIso
Polygon
(
IsoApi
matrix
,
String
name
,
Color
color
,
double
isoLevel
){
for
(
int
r
=
0
;
r
<
matrix
.
getRows
()-
1
;
r
++)
for
(
int
c
=
0
;
c
<
matrix
.
getCols
()-
1
;
c
++){
if
(
isc
.
getIsoSplineContainer
(
r
,
c
).
canCreateIsoSplineElement
(
isoLevel
))
isc
.
getIsoSplineContainer
(
r
,
c
).
createSplineElement
(
isoLevel
);
if
(
isc
s
.
getIsoSplineContainer
(
r
,
c
).
canCreateIsoSplineElement
(
isoLevel
))
isc
s
.
getIsoSplineContainer
(
r
,
c
).
createSplineElement
(
isoLevel
);
}
Polygon
polygon
=
new
Polygon
(
isoLevel
,
name
,
color
,
matrix
.
getCoordinate
(
0
,
0
));
for
(
IsoSplineContainer
c
:
isc
)
{
if
(
c
.
hasIsoSplineElement
())
polygon
.
add
(
c
.
getIsoSplineElement
(
false
));
}
return
polygon
;
// Polygon polygon = new Polygon(name, color, matrix.getCoordinate(0, 0));
// for(IsoSplineContainer c : iscs) {
// if(c.hasIsoSplineElement())
// polygon.add(c.getIsoSplineElement(false));
// }
// return polygons;
return
createPolygons
(
isoLevel
,
color
);
}
private
Polygons
createPolygons
(
double
isoLevel
,
Color
color
){
Polygons
polygons
=
new
Polygons
();
String
direction
;
Polygon
polygon
;
IsoSplineContainer
start
;
IsoSplineContainer
current
;
IsoSplineContainer
next
;
for
(
int
r
=
0
;
r
<
iscs
.
rows
;
r
++)
for
(
int
c
=
0
;
c
<
iscs
.
cols
;
c
++){
start
=
iscs
.
getIsoSplineContainer
(
r
,
c
);
if
(
start
.
hasNotUsedIsoSplineElement
()){
polygon
=
new
Polygon
(
"IsoLevel: "
+
isoLevel
,
color
,
start
.
ref
);
int
sortIndex
=
0
;
polygon
.
add
(
start
.
getIsoSplineElement
(
true
,
sortIndex
));
System
.
out
.
println
(
"new polygon "
+
isoLevel
);
direction
=
start
.
getPrimaryDirection
();
current
=
start
;
current
.
nextDirection
=
direction
;
System
.
out
.
println
(
"rc: > ("
+
current
.
ref
.
r
+
", "
+
current
.
ref
.
c
+
") direction "
+
direction
+
" (next direction "
+
current
.
nextDirection
+
")"
);
while
(
current
.
hasNotUsedNeighbourInDirection
()){
current
=
step
(
current
,
polygon
,
sortIndex
);
sortIndex
++;
}
if
(!
current
.
equals
(
start
)){
current
=
start
;
direction
=
current
.
getSecondaryDirection
();
current
.
nextDirection
=
direction
;
System
.
out
.
println
(
"rc: < ("
+
current
.
ref
.
r
+
", "
+
current
.
ref
.
c
+
") direction "
+
direction
+
" (next direction "
+
current
.
nextDirection
+
")"
);
sortIndex
=-
1
;
while
(
current
.
hasNotUsedNeighbourInDirection
()){
current
=
step
(
current
,
polygon
,
sortIndex
);
sortIndex
--;
}
}
else
polygon
.
setClosed
(
true
);
if
(
polygon
.
size
()>
0
)
polygon
.
sort
();
polygons
.
add
(
polygon
);
}
}
return
polygons
;
}
private
IsoSplineContainer
step
(
IsoSplineContainer
current
,
Polygon
polygon
,
int
sortIndex
){
String
searchdirection
=
">"
;
if
(
sortIndex
<
0
)
searchdirection
=
"<"
;
String
oppositeDirection
;
IsoSplineContainer
next
;
next
=
current
.
getNext
();
System
.
out
.
println
(
"rc: "
+
searchdirection
+
" ("
+
next
.
ref
.
r
+
", "
+
next
.
ref
.
c
+
") direction "
+
current
.
nextDirection
+
" (next direction "
+
next
.
nextDirection
+
")"
);
polygon
.
add
(
next
.
getIsoSplineElement
(
true
,
sortIndex
));
oppositeDirection
=
current
.
getOppositeDirection
(
current
.
nextDirection
);
next
.
setNextDirection
(
oppositeDirection
);
return
next
;
}
}
isospline/IsoSplineContainer.java
View file @
c55941c2
...
...
@@ -16,55 +16,96 @@ public class IsoSplineContainer {
public
static
String
EAST
=
"East"
;
public
static
String
SOUTH
=
"South"
;
public
static
String
WEST
=
"West"
;
private
final
Iso
Api
matrix
;
public
static
String
NO_DIRECTION
=
"No direction"
;
private
final
Iso
SplineContainers
iscs
;
public
final
ArrayList
<
MatrixCoordinate
>
coords
=
new
ArrayList
();
public
boolean
includedInPolygon
=
false
;
public
boolean
used
=
false
;
private
IsoSplineElement
ise
=
null
;
p
rivate
final
MatrixCoordinate
ref
;
p
ublic
final
MatrixCoordinate
ref
;
private
final
ArrayList
<
String
>
directions
=
new
ArrayList
();
public
IsoSplineContainer
(
IsoApi
matrix
,
MatrixCoordinate
coord0
,
MatrixCoordinate
coord1
,
MatrixCoordinate
coord2
,
MatrixCoordinate
coord3
){
this
.
matrix
=
matrix
;
private
final
ArrayList
<
String
>
compass
=
new
ArrayList
();
public
String
nextDirection
=
NO_DIRECTION
;
public
IsoSplineContainer
(
IsoSplineContainers
iscs
,
MatrixCoordinate
coord0
,
MatrixCoordinate
coord1
,
MatrixCoordinate
coord2
,
MatrixCoordinate
coord3
){
this
.
iscs
=
iscs
;
coords
.
add
(
coord0
);
coords
.
add
(
coord1
);
coords
.
add
(
coord2
);
coords
.
add
(
coord3
);
this
.
ref
=
coord0
;
compass
.
add
(
SOUTH
);
compass
.
add
(
EAST
);
compass
.
add
(
NORTH
);
compass
.
add
(
WEST
);
}
public
IsoSplineElements
getIsoSplineElements
(
){
return
new
IsoSplineElements
(
);
public
boolean
hasDirection
(
String
direction
){
return
compass
.
contains
(
direction
);
}
public
boolean
hasDirection
(
String
direction
){
return
directions
.
contains
(
direction
);
public
boolean
equals
(
IsoSplineContainer
isc
){
return
coords
.
equals
(
isc
.
coords
);
}
public
String
getPrimaryDirection
(){
return
directions
.
get
(
0
);
}
public
String
getSecondaryDirection
(){
return
directions
.
get
(
1
);
}
public
String
getOppositeDirection
(
String
direction
){
return
directions
.
get
(
1
-
directions
.
indexOf
(
direction
));
if
(
direction
.
equals
(
NORTH
))
return
SOUTH
;
if
(
direction
.
equals
(
SOUTH
))
return
NORTH
;
if
(
direction
.
equals
(
EAST
))
return
WEST
;
if
(
direction
.
equals
(
WEST
))
return
EAST
;
return
null
;
}
public
void
setNextDirection
(
String
direction
){
if
(
directions
.
contains
(
direction
))
nextDirection
=
directions
.
get
(
1
-
directions
.
indexOf
(
direction
));
else
nextDirection
=
NO_DIRECTION
;
}
public
boolean
hasNeighbourInDirection
(
String
direction
){
if
(
coords
.
get
(
0
).
r
==
0
&&
direction
.
equals
(
SOUTH
))
public
boolean
hasNotUsedNeighbourInDirection
(){
if
(
ref
.
r
>
0
&&
nextDirection
.
equals
(
SOUTH
))
if
(
getNext
()!=
null
)
return
getNext
().
hasNotUsedIsoSplineElement
();
else
return
false
;
if
(
coords
.
get
(
0
).
c
==
0
&&
direction
.
equals
(
WEST
))
if
(
ref
.
c
>
0
&&
nextDirection
.
equals
(
WEST
))
if
(
getNext
()!=
null
)
return
getNext
().
hasNotUsedIsoSplineElement
();
else
return
false
;
if
(
coords
.
get
(
3
).
r
==
matrix
.
getRows
()
&&
direction
.
equals
(
NORTH
))
if
(
ref
.
r
<
iscs
.
rows
&&
nextDirection
.
equals
(
NORTH
))
if
(
getNext
()!=
null
)
return
getNext
().
hasNotUsedIsoSplineElement
();
else
return
false
;
if
(
ref
.
c
<
iscs
.
cols
&&
nextDirection
.
equals
(
EAST
))
if
(
getNext
()!=
null
)
return
getNext
().
hasNotUsedIsoSplineElement
();
else
return
false
;
if
(
coords
.
get
(
3
).
c
==
matrix
.
getCols
()
&&
direction
.
equals
(
EAST
))
return
false
;
return
true
;
}
public
void
createSplineElement
(
double
isoLevel
){
ise
=
null
;
ArrayList
<
MatrixCoordinate
>
splineCoords
=
new
ArrayList
();
ise
=
null
;
includedInPolygon
=
false
;
used
=
false
;
//System.out.println(ref);
int
j
=
0
;
for
(
int
i
=
0
;
i
<
coords
.
size
();
i
++){
if
(
i
==
coords
.
size
()-
1
)
...
...
@@ -80,6 +121,7 @@ public class IsoSplineContainer {
double
lat
=
range
*
(
coord2
.
lat
-
coord1
.
lat
)
+
coord1
.
lat
;
double
lon
=
range
*
(
coord2
.
lon
-
coord1
.
lon
)
+
coord1
.
lon
;
splineCoords
.
add
(
new
MatrixCoordinate
(
lon
,
lat
,
coord1
.
r
,
coord1
.
c
,
isoLevel
));
directions
.
add
(
compass
.
get
(
i
));
}
}
if
(
splineCoords
.
size
()==
2
){
...
...
@@ -93,13 +135,30 @@ public class IsoSplineContainer {
}
public
IsoSplineContainer
getNext
(){
if
(
nextDirection
.
equals
(
SOUTH
))
return
iscs
.
getIsoSplineContainer
(
ref
.
r
-
1
,
ref
.
c
);
if
(
nextDirection
.
equals
(
EAST
))
return
iscs
.
getIsoSplineContainer
(
ref
.
r
,
ref
.
c
+
1
);
if
(
nextDirection
.
equals
(
WEST
))
return
iscs
.
getIsoSplineContainer
(
ref
.
r
,
ref
.
c
-
1
);
if
(
nextDirection
.
equals
(
NORTH
))
return
iscs
.
getIsoSplineContainer
(
ref
.
r
+
1
,
ref
.
c
);
return
null
;
}
public
IsoSplineElement
getIsoSplineElement
(
boolean
includedInPolygon
){
this
.
includedInPolygon
=
includedInPolygon
;
public
IsoSplineElement
getIsoSplineElement
(
boolean
used
,
int
sortIndex
){
ise
.
sortIndex
=
sortIndex
;
this
.
used
=
used
;
return
ise
;
}
public
boolean
hasNotUsedIsoSplineElement
(){
return
ise
!=
null
&&
!
used
;
}
public
boolean
hasIsoSplineElement
(){
return
ise
!=
null
;
}
...
...
@@ -128,7 +187,6 @@ public class IsoSplineContainer {
if
(
Math
.
abs
(
min
-
max
)
<
0.00001
)
return
false
;
return
true
;
}
...
...
isospline/IsoSplineContainers.java
View file @
c55941c2
...
...
@@ -23,18 +23,22 @@ public class IsoSplineContainers extends ArrayList<IsoSplineContainer>{
public
void
createIsoSplineContainers
(
IsoApi
matrix
){
for
(
int
r
=
0
;
r
<
matrix
.
getRows
()-
1
;
r
++){
for
(
int
c
=
0
;
c
<
matrix
.
getCols
()-
1
;
c
++)
add
(
new
IsoSplineContainer
(
matrix
,
matrix
.
getCoordinate
(
r
,
c
),
matrix
.
getCoordinate
(
r
,
c
+
1
),
matrix
.
getCoordinate
(
r
+
1
,
c
+
1
),
matrix
.
getCoordinate
(
r
+
1
,
c
)));
add
(
new
IsoSplineContainer
(
this
,
matrix
.
getCoordinate
(
r
,
c
),
matrix
.
getCoordinate
(
r
,
c
+
1
),
matrix
.
getCoordinate
(
r
+
1
,
c
+
1
),
matrix
.
getCoordinate
(
r
+
1
,
c
)));
}
}
public
IsoSplineContainer
getIsoSplineContainer
(
int
r
,
int
c
){
if
(
getIndexFromCoord
(
r
,
c
)<
0
)
return
null
;
return
get
(
getIndexFromCoord
(
r
,
c
));
}
private
int
getIndexFromCoord
(
int
row
,
int
col
){
int
index
;
if
(!(
row
<
rows
&&
col
<
cols
))
return
-
1
;
index
=
row
*
cols
+
col
;
return
index
;
}
...
...
isospline/IsoSplineElement.java
View file @
c55941c2
...
...
@@ -11,9 +11,10 @@ import java.awt.Dimension;
*
* @author peter
*/
public
class
IsoSplineElement
{
public
class
IsoSplineElement
implements
Comparable
<
IsoSplineElement
>
{
public
final
MatrixCoordinate
coord1
;
public
final
MatrixCoordinate
coord2
;
public
int
sortIndex
;
// public final String dírection1;
// public final String dírection2;
...
...
@@ -30,6 +31,7 @@ public class IsoSplineElement {
coord2
.
fitToFrame
(
dimension
,
gridCorners
,
type
);
}
public
boolean
hasEqual
(
MatrixCoordinate
coord
){
if
(
coord
.
equals
(
coord1
)
||
coord
.
equals
(
coord2
))
return
true
;
...
...
@@ -43,6 +45,11 @@ public class IsoSplineElement {
return
coord1
;
}
public
int
compareTo
(
IsoSplineElement
ise
)
{
if
(
ise
.
sortIndex
>
sortIndex
)
return
1
;
return
-
1
;
}
@Override
...
...
@@ -80,13 +87,4 @@ public class IsoSplineElement {
return
sb
.
toString
();
}
public
int
compareTo
(
IsoSplineElement
ise
)
{
// if(ise.getZprim()<getZprim())
// return 1;
// else
return
-
1
;
}
}
isospline/Main.java
View file @
c55941c2
...
...
@@ -19,8 +19,9 @@ import org.json.JSONException;
* @author a001188
*/
public
class
Main
{
public
static
final
int
ISO_LEVELS
=
17
;
public
static
final
int
ISO_LEVELS
=
3
;
public
static
final
boolean
test
=
false
;
public
static
int
minPolygonSize
=
0
;
/**
* @param args the command line arguments
*/
...
...
@@ -39,16 +40,16 @@ public class Main {
System
.
out
.
println
(
"Coords size: "
+
coords
.
size
());
IsoSpline
iso
=
new
IsoSpline
(
coords
);
ArrayList
<
Double
>
isoLevels
=
iso
.
getIsoLevels
(
ISO_LEVELS
);
GUI
gui
=
new
GUI
(
coords
,
Matrix
.
LONLAT
);
GUI
gui
=
new
GUI
(
coords
,
Matrix
.
LONLAT
,
minPolygonSize
);
gui
.
setSize
(
1000
,
1000
);
gui
.
setVisible
(
true
);
for
(
int
i
=
0
;
i
<
isoLevels
.
size
();
i
++){
IsoApi
clone
=
coords
.
clone
();
iso
=
new
IsoSpline
(
clone
);
Filter
filter
=
new
Filter
(
clone
);
filter
.
filtering
(
2
,
4
);
Polygon
polygon
=
iso
.
createIso
(
clone
,
"test"
+
i
+
"isoLevel: "
+
isoLevels
.
get
(
i
),
colors
.
get
(
i
),
isoLevels
.
get
(
i
));
gui
.
addPolygon
(
polygon
);
filter
.
filtering
(
2
0
,
100
);
Polygon
s
polygon
s
=
iso
.
createIso
Polygon
(
clone
,
"test"
+
i
+
"isoLevel: "
+
isoLevels
.
get
(
i
),
colors
.
get
(
i
),
isoLevels
.
get
(
i
));
gui
.
addPolygon
s
(
polygon
s
);
}
gui
.
repaint
();
...
...
isospline/Matrix.java
View file @
c55941c2
isospline/Polygon.java
View file @
c55941c2
...
...
@@ -8,38 +8,84 @@ package isospline;
import
java.awt.Color
;
import
java.awt.Dimension
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
/**
*
* @author a001188
*/
public
class
Polygon
extends
ArrayList
<
IsoSplineElement
>{
Polygons
poygons
=
new
Polygons
();
public
final
Double
isoLevel
;
public
class
Polygon
extends
ArrayList
<
IsoSplineElement
>
{
public
String
name
=
"Not set"
;
private
final
Color
color
;
private
boolean
closed
=
false
;
private
Color
color
;
private
final
MatrixCoordinate
reference
;
public
Polygon
(
Double
isoLevel
,
String
name
,
Color
color
,
MatrixCoordinate
reference
){
this
.
isoLevel
=
isoLevel
;
public
Polygon
(
String
name
,
Color
color
,
MatrixCoordinate
reference
){
if
(
name
!=
null
)
this
.
name
=
name
;
this
.
color
=
color
;
this
.
reference
=
reference
;
}
public
void
sort
(){
Collections
.
sort
(
this
,
new
Comparator
<
IsoSplineElement
>()
{
@Override
public
int
compare
(
IsoSplineElement
ise1
,
IsoSplineElement
ise2
){
return
ise1
.
compareTo
(
ise2
);
}
});
}
public
Color
getColor
(){
return
color
;
}
public
boolean
isClosed
(){
return
closed
;
}
public
void
setClosed
(
boolean
closed
){
this
.
closed
=
closed
;
}
public
void
getColor
(
Color
color
){
this
.
color
=
color
;
}
public
void
fitToFrame
(
Dimension
dimension
,
MatrixCorners
gridCorners
,
String
type
)
{
for
(
IsoSplineElement
ise
:
this
)
{
ise
.
fitToFrame
(
dimension
,
gridCorners
,
type
);
}
}
@Override
public
String
toString
(){
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
name
);
sb
.
append
(
" closed: "
);
sb
.
append
(
closed
);
sb
.
append
(
"\r\n"
);
sb
.
append
(
"i: "
);
sb
.
append
(
0
);
sb
.
append
(
", ["
);
sb
.
append
(
get
(
0
).
coord1
.
lon
);
sb
.
append
(
", "
);
sb
.
append
(
get
(
0
).
coord1
.
lat
);
sb
.
append
(
"]\r\n"
);
for
(
int
i
=
0
;
i
<
size
();
i
++){
sb
.
append
(
"i: "
);
sb
.
append
(
i
);
sb
.
append
(
", ["
);
sb
.
append
(
get
(
i
).
coord2
.
lon
);
sb
.
append
(
", "
);
sb
.
append
(
get
(
i
).
coord2
.
lat
);
sb
.
append
(
"]\r\n"
);
}
return
sb
.
toString
();
}
// public Polygons getSeparatePolygons(String name, Color color){
// Polygons polygons = new Polygons();
// int sortIndex;
...
...
@@ -127,18 +173,5 @@ public class Polygon extends ArrayList<IsoSplineElement>{
// return c;
// }
@Override
public
String
toString
(){
StringBuilder
sb
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
size
();
i
++){
sb
.
append
(
"i: "
);
sb
.
append
(
i
);
sb
.
append
(
", "
);
sb
.
append
(
get
(
i
).
coord1
);
sb
.
append
(
" -- + -- "
);
sb
.
append
(
get
(
i
).
coord2
);
sb
.
append
(
"\r\n"
);
}
return
sb
.
toString
();
}
}
isospline/io/JSONMatrix.java
View file @
c55941c2
...
...
@@ -22,6 +22,7 @@ http://opendata-download-metfcst.smhi.se/api/category/pmp2g/version/2/geotype/mu
*/
public
class
JSONMatrix
{
public
static
int
GRID_COEFF
=
1
;
private
final
static
HashMap
<
Long
,
Integer
>
statistics
=
new
HashMap
();
private
static
int
rows
=
0
;
private
static
int
cols
=
0
;
...
...
@@ -34,12 +35,14 @@ public class JSONMatrix{
String
gridfilename
;
String
datafilename
;
if
(
test
){
GRID_COEFF
=
1
;
rows
=
5
;
cols
=
4
;
gridfilename
=
"D:\\git\\GribVisualizer\\src\\isospline\\data\\testmultipoint.json"
;
datafilename
=
"D:\\git\\GribVisualizer\\src\\isospline\\data\\test_data.json"
;
}
else
{
GRID_COEFF
=
50
;
rows
=
753
;
//613
cols
=
613
;
//753
gridfilename
=
"D:\\git\\GribVisualizer\\src\\isospline\\data\\multipoint.json"
;
...
...
isospline/ui/GUI.java
View file @
c55941c2
...
...
@@ -11,6 +11,7 @@ import isospline.Matrix;
import
isospline.MatrixCorners
;
import
isospline.Polygon
;
import
isospline.Polygons
;
import
isospline.io.JSONMatrix
;
import
java.awt.Color
;
import
java.awt.Graphics
;
import
javax.swing.JFrame
;
...
...
@@ -23,12 +24,20 @@ public class GUI extends JFrame{
private
final
Polygons
polygons
=
new
Polygons
();
private
final
Matrix
coords
;
private
final
String
type
;
private
final
int
minPolygonSize
;
public
GUI
(
Matrix
coords
,
String
type
){
public
GUI
(
Matrix
coords
,
String
type
,
int
minPolygonSize
){
this
.
coords
=
coords
;
this
.
type
=
type
;
this
.
minPolygonSize
=
minPolygonSize
;
}
public
void
addPolygons
(
Polygons
polygons
){
for
(
int
i
=
0
;
i
<
polygons
.
size
();
i
++)
addPolygon
(
polygons
.
get
(
i
));
}
public
void
addPolygon
(
Polygon
polygon
){
polygons
.
add
(
polygon
);
}
...
...
@@ -45,8 +54,11 @@ public class GUI extends JFrame{
coords
.
fitToFrame
(
getSize
(),
type
);
drawGrid
(
g
,
coords
);
drawCorners
(
g
,
coords
.
getGridCorners
());
for
(
int
p
=
0
;
p
<
polygons
.
size
();
p
++)
drawIso
(
g
,
polygons
.
get
(
p
));
for
(
int
p
=
0
;
p
<
polygons
.
size
();
p
++){
Polygon
polygon
=
polygons
.
get
(
p
);
if
(
polygon
.
size
()
>
this
.
minPolygonSize
)
drawIso
(
g
,
polygon
);
}
}
...
...
@@ -54,7 +66,7 @@ public class GUI extends JFrame{
private
void
drawGrid
(
Graphics
g
,
Matrix
coords
){
coords
.
fitToFrame
(
getSize
(),
type
);
g
.
setColor
(
Color
.
LIGHT_GRAY
);
int
s
=
50
;
int
s
=
JSONMatrix
.
GRID_COEFF
;
int
x11
;
int
x21
;
int
x12
;
...
...
@@ -118,6 +130,7 @@ public class GUI extends JFrame{
private
void
drawIso
(
Graphics
g
,
Polygon
polygon
){
System
.
out
.
println
(
polygon
.
toString
());
polygon
.
fitToFrame
(
getSize
(),
coords
.
getGridCorners
(),
type
);
g
.
setColor
(
polygon
.
getColor
());
for
(
int
i
=
0
;
i
<
polygon
.
size
();
i
++){
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment