|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.Collections; |
|
|
import java.util.Collections; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.logging.Logger; |
|
|
import java.util.prefs.Preferences; |
|
|
import java.util.prefs.Preferences; |
|
|
|
|
|
|
|
|
|
|
|
import mvcgrafik.util.OhmLogger; |
|
|
/** |
|
|
/** |
|
|
* |
|
|
* |
|
|
* @author le |
|
|
* @author le |
|
|
*/ |
|
|
*/ |
|
|
public class GrafikModel |
|
|
public class GrafikModel |
|
|
{ |
|
|
{ |
|
|
private ArrayList<Point> punkte; |
|
|
|
|
|
private ArrayList<ArrayList> figuren; |
|
|
|
|
|
private Preferences pref; |
|
|
|
|
|
|
|
|
private Figur aktuelleFigur; |
|
|
|
|
|
private ArrayList<Figur> figuren; |
|
|
|
|
|
private Preferences pref; |
|
|
|
|
|
private static Logger lg = OhmLogger.getLogger(); |
|
|
|
|
|
|
|
|
public GrafikModel() |
|
|
public GrafikModel() |
|
|
{ |
|
|
{ |
|
|
punkte = new ArrayList<>(); |
|
|
|
|
|
|
|
|
aktuelleFigur = new Figur(); |
|
|
figuren = new ArrayList<>(); |
|
|
figuren = new ArrayList<>(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void addPoint(Point p) |
|
|
public void addPoint(Point p) |
|
|
{ |
|
|
{ |
|
|
punkte.add(p); |
|
|
|
|
|
|
|
|
aktuelleFigur.addPoint(p); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public List<Point> getPunkte() |
|
|
public List<Point> getPunkte() |
|
|
{ |
|
|
{ |
|
|
return Collections.unmodifiableList(punkte); |
|
|
|
|
|
|
|
|
return aktuelleFigur.getPunkte(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public List<ArrayList> getFiguren(){ |
|
|
|
|
|
|
|
|
public List<Figur> getFiguren(){ |
|
|
return Collections.unmodifiableList(figuren); |
|
|
return Collections.unmodifiableList(figuren); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (daten instanceof ArrayList liste) |
|
|
if (daten instanceof ArrayList liste) |
|
|
{ |
|
|
{ |
|
|
figuren = liste; |
|
|
figuren = liste; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//lg.info(figuren.getFirst().getPunkte().getFirst().toString()); |
|
|
|
|
|
} |
|
|
|
|
|
lg.info("Einlesen ende"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void endShape() { |
|
|
public void endShape() { |
|
|
figuren.add(new ArrayList<Point>(punkte)); |
|
|
|
|
|
punkte.clear(); |
|
|
|
|
|
|
|
|
figuren.add(aktuelleFigur); |
|
|
|
|
|
aktuelleFigur = new Figur(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
pref.put(lastDirectory, lastAdress); |
|
|
pref.put(lastDirectory, lastAdress); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|