Improved the FunctionArea: Now a color can be set directly for a certain plot.

This commit is contained in:
Andreas Dräger 2010-04-12 04:49:28 +00:00
parent 8fe9ab2648
commit 82686fd280
4 changed files with 2858 additions and 2680 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
package eva2.gui; package eva2.gui;
/* /*
* Title: EvA2 * Title: EvA2
* Description: * Description:
@ -13,19 +14,22 @@ package eva2.gui;
* IMPORTS * IMPORTS
*==========================================================================*/ *==========================================================================*/
import java.awt.Color;
import java.awt.Graphics;
import java.awt.BasicStroke; import java.awt.BasicStroke;
import java.awt.Color;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import eva2.tools.chart2d.*; import eva2.tools.chart2d.DArea;
import eva2.tools.chart2d.DMeasures;
import eva2.tools.chart2d.DPoint;
import eva2.tools.chart2d.DPointIcon;
import eva2.tools.chart2d.DPointSet;
import eva2.tools.math.Mathematics; import eva2.tools.math.Mathematics;
/*==========================================================================*
/*==========================================================================*
* CLASS DECLARATION * CLASS DECLARATION
*==========================================================================*/ *==========================================================================*/
/** /**
* *
*/ */
public class GraphPointSet { public class GraphPointSet {
@ -35,67 +39,93 @@ public class GraphPointSet {
private ArrayList<PointSet> m_PointSetContainer = new ArrayList<PointSet>(); private ArrayList<PointSet> m_PointSetContainer = new ArrayList<PointSet>();
private float m_Stroke = (float) 1.0; private float m_Stroke = (float) 1.0;
private boolean m_isStatisticsGraph = false; private boolean m_isStatisticsGraph = false;
// private DPointSet m_PointSet_1; // private DPointSet m_PointSet_1;
// private DPointSet m_PointSet_2; // private DPointSet m_PointSet_2;
// private DPointSet m_PointSet_3; // private DPointSet m_PointSet_3;
private DPointSetMultiIcon m_ConnectedPointSet; private DPointSetMultiIcon m_ConnectedPointSet;
private DArea m_Area; private DArea m_Area;
private Color m_Color; private Color m_Color;
private DPointIcon m_Icon; private DPointIcon m_Icon;
private int m_CacheIndex = 0; private int m_CacheIndex = 0;
private int m_CacheSize = 0; private int m_CacheSize = 0;
private double [] m_cachex; private double[] m_cachex;
private double [] m_cachey; private double[] m_cachey;
/** /**
* *
*/ */
public GraphPointSet (/*int size*/int GraphLabel, DArea Area) { public GraphPointSet(/* int size */int GraphLabel, DArea Area) {
//System.out.println("Constructor GraphPointSet "+ GraphLabel); // System.out.println("Constructor GraphPointSet "+ GraphLabel);
m_cachex = new double[m_CacheSize]; m_cachex = new double[m_CacheSize];
m_cachey = new double[m_CacheSize]; m_cachey = new double[m_CacheSize];
m_Area = Area; m_Area = Area;
m_GraphLabel = GraphLabel; m_GraphLabel = GraphLabel;
m_ConnectedPointSet = new DPointSetMultiIcon(100); m_ConnectedPointSet = new DPointSetMultiIcon(100);
// m_PointSet_1 = new DPointSet(100); // m_PointSet_1 = new DPointSet(100);
// m_PointSet_2 = new DPointSet(100); // m_PointSet_2 = new DPointSet(100);
// m_PointSet_3 = new DPointSet(100); // m_PointSet_3 = new DPointSet(100);
// //
// DPointIcon icon1 = new DPointIcon(){ // DPointIcon icon1 = new DPointIcon(){
// public void paint( Graphics g ){ // public void paint( Graphics g ){
// g.drawLine(-2, 0, 2, 0); // g.drawLine(-2, 0, 2, 0);
// g.drawLine(0, 0, 0, 4); // g.drawLine(0, 0, 0, 4);
// } // }
// public DBorder getDBorder(){ return new DBorder(4, 4, 4, 4); } // public DBorder getDBorder(){ return new DBorder(4, 4, 4, 4); }
// }; // };
// DPointIcon icon2 = new DPointIcon(){ // DPointIcon icon2 = new DPointIcon(){
// public void paint( Graphics g ){ // public void paint( Graphics g ){
// g.drawLine(-2, 0, 2, 0); // g.drawLine(-2, 0, 2, 0);
// g.drawLine(0, 0, 0, -4); // g.drawLine(0, 0, 0, -4);
// } // }
// public DBorder getDBorder(){ return new DBorder(4, 4, 4, 4); } // public DBorder getDBorder(){ return new DBorder(4, 4, 4, 4); }
// }; // };
// //
m_ConnectedPointSet.setStroke(new BasicStroke( m_Stroke )); m_ConnectedPointSet.setStroke(new BasicStroke(m_Stroke));
m_ConnectedPointSet.setConnected(true); m_ConnectedPointSet.setConnected(true);
setColor(indexToColor(GraphLabel)); setColor(indexToColor(GraphLabel));
initGraph(Area); initGraph(Area);
} }
/**
*
* @param index
* @return
*/
private Color indexToColor(int index) { private Color indexToColor(int index) {
Color c = Color.black; Color c = Color.black;
int k = index%10; int k = index % 10;
switch(k) { switch (k) {
case 0: c = Color.black; break; case 0:
case 1: c = Color.red; break; c = Color.black;
case 2: c = Color.blue; break; break;
case 3: c = Color.pink; break; case 1:
case 4: c = Color.green; break; c = Color.red;
case 5: c = Color.gray; break; break;
case 6: c = Color.magenta; break; case 2:
case 7: c = Color.cyan; break; c = Color.blue;
case 8: c = Color.orange; break; break;
case 9: c = Color.darkGray; break; case 3:
c = Color.pink;
break;
case 4:
c = Color.green;
break;
case 5:
c = Color.gray;
break;
case 6:
c = Color.magenta;
break;
case 7:
c = Color.cyan;
break;
case 8:
c = Color.orange;
break;
case 9:
c = Color.darkGray;
break;
} }
return c; return c;
} }
@ -105,7 +135,7 @@ public class GraphPointSet {
*/ */
public void incColor() { public void incColor() {
colorOffset++; colorOffset++;
setColor(indexToColor(m_GraphLabel+colorOffset)); setColor(indexToColor(m_GraphLabel + colorOffset));
} }
public void setColorByIndex(int i) { public void setColorByIndex(int i) {
@ -114,34 +144,36 @@ public class GraphPointSet {
/** /**
* *
* @param size
* @param GraphLabel
*/ */
private GraphPointSet (int size,int GraphLabel) { private GraphPointSet(int size, int GraphLabel) {
m_GraphLabel = GraphLabel; m_GraphLabel = GraphLabel;
m_cachex = new double[m_CacheSize]; m_cachex = new double[m_CacheSize];
m_cachey = new double[m_CacheSize]; m_cachey = new double[m_CacheSize];
m_ConnectedPointSet = new DPointSetMultiIcon(100); m_ConnectedPointSet = new DPointSetMultiIcon(100);
// m_PointSet_1 = new DPointSet(100); // m_PointSet_1 = new DPointSet(100);
// m_PointSet_2 = new DPointSet(100); // m_PointSet_2 = new DPointSet(100);
// m_PointSet_3 = new DPointSet(100); // m_PointSet_3 = new DPointSet(100);
// //
// DPointIcon icon1 = new DPointIcon(){ // DPointIcon icon1 = new DPointIcon(){
// public void paint( Graphics g ){ // public void paint( Graphics g ){
// g.drawLine(-2, 0, 2, 0); // g.drawLine(-2, 0, 2, 0);
// g.drawLine(0, 0, 0, 4); // g.drawLine(0, 0, 0, 4);
// } // }
// public DBorder getDBorder(){ return new DBorder(4, 4, 4, 4); } // public DBorder getDBorder(){ return new DBorder(4, 4, 4, 4); }
// }; // };
// DPointIcon icon2 = new DPointIcon(){ // DPointIcon icon2 = new DPointIcon(){
// public void paint( Graphics g ){ // public void paint( Graphics g ){
// g.drawLine(-2, 0, 2, 0); // g.drawLine(-2, 0, 2, 0);
// g.drawLine(0, 0, 0, -4); // g.drawLine(0, 0, 0, -4);
// } // }
// public DBorder getDBorder(){ return new DBorder(4, 4, 4, 4); } // public DBorder getDBorder(){ return new DBorder(4, 4, 4, 4); }
// }; // };
// m_PointSet_2.setIcon(icon1); // m_PointSet_2.setIcon(icon1);
// m_PointSet_3.setIcon(icon1); // m_PointSet_3.setIcon(icon1);
// //
m_ConnectedPointSet.setStroke(new BasicStroke( m_Stroke )); m_ConnectedPointSet.setStroke(new BasicStroke(m_Stroke));
m_ConnectedPointSet.setConnected(true); m_ConnectedPointSet.setConnected(true);
m_Color = Color.black; m_Color = Color.black;
@ -151,109 +183,131 @@ public class GraphPointSet {
m_ConnectedPointSet.setColor(m_Color); m_ConnectedPointSet.setColor(m_Color);
} }
/** /**
* *
* @return
*/ */
public DPointSet printPoints() { public DPointSet printPoints() {
for (int i = 0; i < m_ConnectedPointSet.getSize();i++) { for (int i = 0; i < m_ConnectedPointSet.getSize(); i++) {
DPoint p = m_ConnectedPointSet.getDPoint(i); DPoint p = m_ConnectedPointSet.getDPoint(i);
double x = p.x; double x = p.x;
double y = p.y; double y = p.y;
//System.out.println("point "+i+ " x= "+x+"y= "+y); System.out.println("point " + i + " x = " + x + "y = " + y);
} }
return m_ConnectedPointSet.getDPointSet(); return m_ConnectedPointSet.getDPointSet();
} }
/** /**
* *
* @return
*/ */
public Color getColor() { public Color getColor() {
return m_ConnectedPointSet.getColor(); return m_ConnectedPointSet.getColor();
} }
/** /**
* *
* @param c
*/ */
public void setColor(Color c) { public void setColor(Color c) {
m_Color=c; m_Color = c;
m_ConnectedPointSet.setColor(m_Color); m_ConnectedPointSet.setColor(m_Color);
} }
/** /**
* *
* @return
*/ */
public DPointSet getConnectedPointSet() { public DPointSet getConnectedPointSet() {
return m_ConnectedPointSet.getDPointSet(); return m_ConnectedPointSet.getDPointSet();
} }
/**
*
* @return
*/
public DPointSetMultiIcon getReference2ConnectedPointSet() { public DPointSetMultiIcon getReference2ConnectedPointSet() {
return m_ConnectedPointSet; return m_ConnectedPointSet;
} }
/** /**
* *
* @param Area
*/ */
public void initGraph (DArea Area) { public void initGraph(DArea Area) {
m_Area = Area; m_Area = Area;
m_Area.addDElement(m_ConnectedPointSet); m_Area.addDElement(m_ConnectedPointSet);
((FunctionArea)m_Area).addGraphPointSet(this); ((FunctionArea) m_Area).addGraphPointSet(this);
// m_Area.addDElement(m_PointSet_1); // m_Area.addDElement(m_PointSet_1);
// m_Area.addDElement(m_PointSet_2); // m_Area.addDElement(m_PointSet_2);
// m_Area.addDElement(m_PointSet_3); // m_Area.addDElement(m_PointSet_3);
// DPointIcon icon1 = new DPointIcon(){ // DPointIcon icon1 = new DPointIcon(){
// public void paint( Graphics g ){ // public void paint( Graphics g ){
// g.drawLine(-2, 0, 2, 0); // g.drawLine(-2, 0, 2, 0);
// g.drawLine(0, 0, 0, 4); // g.drawLine(0, 0, 0, 4);
// } // }
// public DBorder getDBorder(){ return new DBorder(4, 4, 4, 4); } // public DBorder getDBorder(){ return new DBorder(4, 4, 4, 4); }
// }; // };
// DPointIcon icon2 = new DPointIcon(){ // DPointIcon icon2 = new DPointIcon(){
// public void paint( Graphics g ){ // public void paint( Graphics g ){
// g.drawLine(-2, 0, 2, 0); // g.drawLine(-2, 0, 2, 0);
// g.drawLine(0, 0, 0, -4); // g.drawLine(0, 0, 0, -4);
// } // }
// public DBorder getDBorder(){ return new DBorder(4, 4, 4, 4); } // public DBorder getDBorder(){ return new DBorder(4, 4, 4, 4); }
// }; // };
} }
/** /**
* *
* @param p
* @return
*/ */
public DPoint getNearestDPoint(DPoint p) { public DPoint getNearestDPoint(DPoint p) {
return m_ConnectedPointSet.getNearestDPoint(p); return m_ConnectedPointSet.getNearestDPoint(p);
} }
/** /**
* Causes the PointSet to interupt the connected painting at the * Causes the PointSet to interupt the connected painting at the current
* current position. * position.
*/ */
public void jump() { public void jump() {
m_ConnectedPointSet.jump(); m_ConnectedPointSet.jump();
} }
/** /**
* *
*/ */
public void removeAllPoints() { public void removeAllPoints() {
m_ConnectedPointSet.removeAllPoints(); m_ConnectedPointSet.removeAllPoints();
// m_PointSet_1.removeAllPoints(); // m_PointSet_1.removeAllPoints();
// m_PointSet_2.removeAllPoints(); // m_PointSet_2.removeAllPoints();
// m_PointSet_3.removeAllPoints(); // m_PointSet_3.removeAllPoints();
} }
/** /**
* *
* @param x
* @param y
*/ */
public void addDPoint(double x,double y) { public void addDPoint(double x, double y) {
//System.out.println(" "+x+" "+y); // System.out.println(" "+x+" "+y);
if (m_CacheIndex==m_CacheSize) { if (m_CacheIndex == m_CacheSize) {
for (int i=0;i<m_CacheSize;i++) { for (int i = 0; i < m_CacheSize; i++) {
m_ConnectedPointSet.addDPoint(m_cachex[i],m_cachey[i]); m_ConnectedPointSet.addDPoint(m_cachex[i], m_cachey[i]);
} }
m_ConnectedPointSet.addDPoint(x,y); m_ConnectedPointSet.addDPoint(x, y);
m_CacheIndex=0; m_CacheIndex = 0;
} } else {
else { m_cachex[m_CacheIndex] = x;
m_cachex[m_CacheIndex]=x; m_cachey[m_CacheIndex] = y;
m_cachey[m_CacheIndex]=y;
m_CacheIndex++; m_CacheIndex++;
} }
} }
/** /**
* *
* @param p
*/ */
public void addDPoint(DPoint p) { public void addDPoint(DPoint p) {
m_ConnectedPointSet.addDPoint(p); m_ConnectedPointSet.addDPoint(p);
@ -261,19 +315,24 @@ public class GraphPointSet {
/** /**
* *
* @param p
*/ */
public void setIcon(DPointIcon p) { public void setIcon(DPointIcon p) {
this.m_Icon = p; this.m_Icon = p;
this.m_ConnectedPointSet.setIcon(p); this.m_ConnectedPointSet.setIcon(p);
} }
/** /**
* *
* @param p
*/ */
public void setConnectedMode(boolean p) { public void setConnectedMode(boolean p) {
m_ConnectedPointSet.setConnected(p); m_ConnectedPointSet.setConnected(p);
} }
/** /**
* *
* @return
*/ */
public boolean isStatisticsGraph() { public boolean isStatisticsGraph() {
return m_isStatisticsGraph; return m_isStatisticsGraph;
@ -281,6 +340,7 @@ public class GraphPointSet {
/** /**
* *
* @return
*/ */
public int getPointCount() { public int getPointCount() {
return m_ConnectedPointSet.getSize(); return m_ConnectedPointSet.getSize();
@ -288,22 +348,25 @@ public class GraphPointSet {
/** /**
* *
* @return
*/ */
public PointSet getPointSet() { public PointSet getPointSet() {
return new PointSet (this.m_ConnectedPointSet.getDPointSet()); return new PointSet(this.m_ConnectedPointSet.getDPointSet());
} }
/** /**
* *
* @param x
*/ */
public void removePoint(DPoint x) { public void removePoint(DPoint x) {
System.out.println("removePoint "+x.x+ " "+ x.y); System.out.println("removePoint " + x.x + " " + x.y);
DPoint[] buf = new DPoint[m_ConnectedPointSet.getSize()]; DPoint[] buf = new DPoint[m_ConnectedPointSet.getSize()];
for (int i=0; i<m_ConnectedPointSet.getSize();i++) { for (int i = 0; i < m_ConnectedPointSet.getSize(); i++) {
buf[i] = m_ConnectedPointSet.getDPoint(i); buf[i] = m_ConnectedPointSet.getDPoint(i);
} }
m_ConnectedPointSet.removeAllPoints(); m_ConnectedPointSet.removeAllPoints();
for (int i=0; i<buf.length;i++) { for (int i = 0; i < buf.length; i++) {
if(buf[i].x == x.x && buf[i].y == x.y) if (buf[i].x == x.x && buf[i].y == x.y)
System.out.println("point found"); System.out.println("point found");
else else
m_ConnectedPointSet.addDPoint(buf[i]); m_ConnectedPointSet.addDPoint(buf[i]);
@ -312,20 +375,25 @@ public class GraphPointSet {
} }
/** /**
* Add a graph to another one forming a statistics graph if it isnt one already. * Add a graph to another one forming a statistics graph if it isnt one
* already.
* *
* @param set * @param set
* @param measures * @param measures
* @param useForce forces the add even if point counts mismatch, maybe losing some data points * @param useForce
* forces the add even if point counts mismatch, maybe losing
* some data points
*/ */
public void addGraph (GraphPointSet set,DMeasures measures, boolean useForce) { public void addGraph(GraphPointSet set, DMeasures measures, boolean useForce) {
if (set.m_ConnectedPointSet.getSize()!=m_ConnectedPointSet.getSize() && if (set.m_ConnectedPointSet.getSize() != m_ConnectedPointSet.getSize()
m_ConnectedPointSet.getSize()!=0 && !useForce) { && m_ConnectedPointSet.getSize() != 0 && !useForce) {
System.err.println("WARNING addGraph not possible, lost last graph"); System.err
System.err.println(" m_ConnectedPointSet.getSize() "+ m_ConnectedPointSet.getSize()); .println("WARNING addGraph not possible, lost last graph");
System.err.println(" m_ConnectedPointSet.getSize() "
+ m_ConnectedPointSet.getSize());
return; return;
} }
if (set.getPointSet().getSize()==0) { if (set.getPointSet().getSize() == 0) {
System.err.println("Refusing to add empty graph..."); System.err.println("Refusing to add empty graph...");
return; return;
} }
@ -336,137 +404,167 @@ public class GraphPointSet {
m_PointSetContainer.add(set.getPointSet()); m_PointSetContainer.add(set.getPointSet());
int[] index = new int[m_PointSetContainer.size()]; int[] index = new int[m_PointSetContainer.size()];
int[] GraphSize = new int[m_PointSetContainer.size()]; int[] GraphSize = new int[m_PointSetContainer.size()];
for (int i=0;i<m_PointSetContainer.size();i++) { for (int i = 0; i < m_PointSetContainer.size(); i++) {
GraphSize[i] = ((PointSet) m_PointSetContainer.get(i)).getSize(); GraphSize[i] = ((PointSet) m_PointSetContainer.get(i)).getSize();
if (GraphSize[i]<=0) System.err.println("Warning: invalid graph size of " + GraphSize[i] + " at " + i + "! (GraphPointSet.addGraph)"); if (GraphSize[i] <= 0)
System.err.println("Warning: invalid graph size of "
+ GraphSize[i] + " at " + i
+ "! (GraphPointSet.addGraph)");
} }
if (Mathematics.sum(GraphSize)==0) { if (Mathematics.sum(GraphSize) == 0) {
System.err.println("Error: not adding empty graphs... (GraphPointSet.addGraph)"); System.err
.println("Error: not adding empty graphs... (GraphPointSet.addGraph)");
return; return;
} }
boolean allSetsHaveMorePoints = true; boolean allSetsHaveMorePoints = true;
double nextXValue; double nextXValue;
double[] y = new double[m_PointSetContainer.size()]; double[] y = new double[m_PointSetContainer.size()];
while ( allSetsHaveMorePoints ) { // Loop over all point sets, add them up and calc. mean while (allSetsHaveMorePoints) { // Loop over all point sets, add them up
// this is a bit more complicated because it is allowed that the point sets are asynchronouos // and calc. mean
// in the sense that the x values do not have to match - y values for any x value found are averaged // this is a bit more complicated because it is allowed that the
// over all points. However curves may look strange if this happens, since they consist of // point sets are asynchronouos
// in the sense that the x values do not have to match - y values
// for any x value found are averaged
// over all points. However curves may look strange if this happens,
// since they consist of
// heterogenous points. // heterogenous points.
nextXValue = m_PointSetContainer.get(0).m_X[index[0]]; nextXValue = m_PointSetContainer.get(0).m_X[index[0]];
//System.out.println("m_PointSetContainer.size()"+m_PointSetContainer.size()); // System.out.println("m_PointSetContainer.size()"+m_PointSetContainer.size());
for (int i = 1;i<m_PointSetContainer.size();i++) { // search for smalles x value at next index for (int i = 1; i < m_PointSetContainer.size(); i++) { // search for
//System.out.println("i="+i); // smalles x
// value at
// next
// index
// System.out.println("i="+i);
if (nextXValue > m_PointSetContainer.get(i).m_X[index[i]]) { if (nextXValue > m_PointSetContainer.get(i).m_X[index[i]]) {
nextXValue = m_PointSetContainer.get(i).m_X[index[i]]; nextXValue = m_PointSetContainer.get(i).m_X[index[i]];
} }
} }
// Stelle nextXValue wird gezeichnet. jetzt alle y werte dazu finden // Stelle nextXValue wird gezeichnet. jetzt alle y werte dazu finden
int numberofpoints =0; int numberofpoints = 0;
for (int i = 0;i<m_PointSetContainer.size();i++) { // collect all points at next x-value for (int i = 0; i < m_PointSetContainer.size(); i++) { // collect
// all
// points at
// next
// x-value
if (nextXValue == m_PointSetContainer.get(i).m_X[index[i]]) { if (nextXValue == m_PointSetContainer.get(i).m_X[index[i]]) {
y[i]=m_PointSetContainer.get(i).m_Y[index[i]]; y[i] = m_PointSetContainer.get(i).m_Y[index[i]];
index[i]++; index[i]++;
numberofpoints++; numberofpoints++;
} else y[i]=0; } else
y[i] = 0;
} }
double ymean = Mathematics.sum(y)/numberofpoints; double ymean = Mathematics.sum(y) / numberofpoints;
// compute median double median = getMedian(y); // compute median double median = getMedian(y);
addDPoint(nextXValue,ymean);// System.out.println("ymean "+ymean+" y.length "+ y.length); addDPoint(nextXValue, ymean);// System.out.println("ymean "+ymean+" y.length "+
//addDPoint(minx,median);// System.out.println("ymean "+ymean+" y.length "+ y.length); // y.length);
for (int i=0;i<m_PointSetContainer.size();i++) { // Stop if one of the point sets has no more points // addDPoint(minx,median);//
if (GraphSize[i] <= index[i] ) { // System.out.println("ymean "+ymean+" y.length "+ y.length);
for (int i = 0; i < m_PointSetContainer.size(); i++) { // Stop if
// one of
// the point
// sets has
// no more
// points
if (GraphSize[i] <= index[i]) {
allSetsHaveMorePoints = false; allSetsHaveMorePoints = false;
break; break;
} }
} }
} }
} }
/** /**
* *
* @return
*/ */
private double getMedian(double[] in) { public int getGraphLabel() {
double[] x = (double[]) in.clone();
double ret = 0;
Arrays.sort(x);
int m = (int)( x.length/2.0);
return x[m];
}
/**
*
*/
public int getGraphLabel () {
return m_GraphLabel; return m_GraphLabel;
} }
// /**
// * // /**
// */ // *
// public void setUnconnectedPoint (double x, double y) { // */
// m_PointSet_1.addDPoint(x,y); // public void setUnconnectedPoint (double x, double y) {
// } // m_PointSet_1.addDPoint(x,y);
// }
/** /**
* *
*/ */
public String getInfoString () { public String getInfoString() {
return m_InfoString; return m_InfoString;
} }
/** /**
* *
* @param x
* @param stroke
*/ */
public void setInfoString (String x, float stroke ) { public void setInfoString(String x, float stroke) {
m_InfoString=x; m_InfoString = x;
m_Stroke = stroke; m_Stroke = stroke;
//setStroke(new BasicStroke( m_Stroke )); // setStroke(new BasicStroke( m_Stroke ));
} }
/** /**
* *
*/ */
class PointSet implements Serializable { class PointSet implements Serializable {
/**
* Generated serial version identifier
*/
private static final long serialVersionUID = -5863595580492128866L;
private double[] m_X; private double[] m_X;
private double[] m_Y; private double[] m_Y;
private Color m_Color; private Color m_Color;
/** /**
* *
* @param pointset
*/ */
public PointSet (DPointSet pointset) { public PointSet(DPointSet pointset) {
m_Color = pointset.getColor(); m_Color = pointset.getColor();
m_X = new double[pointset.getSize()]; m_X = new double[pointset.getSize()];
m_Y = new double[pointset.getSize()]; m_Y = new double[pointset.getSize()];
for (int i=0;i<pointset.getSize();i++) { for (int i = 0; i < pointset.getSize(); i++) {
DPoint point = pointset.getDPoint(i); DPoint point = pointset.getDPoint(i);
m_X[i] = point.x; m_X[i] = point.x;
m_Y[i] = point.y; m_Y[i] = point.y;
} }
} }
/** /**
* *
* @return
*/ */
public DPointSet getDPointSet () { public DPointSet getDPointSet() {
DPointSet ret = new DPointSet(100); DPointSet ret = new DPointSet(100);
ret.setColor(m_Color); ret.setColor(m_Color);
for (int i=0;i<m_X.length;i++) for (int i = 0; i < m_X.length; i++)
ret.addDPoint(m_X[i],m_Y[i]); ret.addDPoint(m_X[i], m_Y[i]);
return ret; return ret;
} }
/** /**
* *
* @return
*/ */
public int getSize() { public int getSize() {
return m_X.length; return m_X.length;
} }
// /** // /**
// * // *
// */ // */
// public DPointSet printPoints() { // public DPointSet printPoints() {
// for (int i = 0; i < m_ConnectedPointSet.getSize();i++) { // for (int i = 0; i < m_ConnectedPointSet.getSize();i++) {
// DPoint p = m_ConnectedPointSet.getDPoint(i); // DPoint p = m_ConnectedPointSet.getDPoint(i);
// double x = p.x; // double x = p.x;
// double y = p.y; // double y = p.y;
// //System.out.println("point "+i+ " x= "+x+"y= "+y); // //System.out.println("point "+i+ " x= "+x+"y= "+y);
// } // }
// return m_ConnectedPointSet.getDPointSet(); // return m_ConnectedPointSet.getDPointSet();
// } // }
} }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff