meinGarten.hinzufuegenBeet(randomwertex[i] + 10, randomwertey[j] + 10, randomwertex[i + 1]-randomwertex[i]-20,randomwertey[j+1] - randomwertey[j]-20); | meinGarten.hinzufuegenBeet(randomwertex[i] + 10, randomwertey[j] + 10, randomwertex[i + 1]-randomwertex[i]-20,randomwertey[j+1] - randomwertey[j]-20); | ||||
} | } | ||||
} | } | ||||
//Beet * Weg zeichen, muss noch in Garten (geht halt so recht schön) | //Beet * Weg zeichen, muss noch in Garten (geht halt so recht schön) | ||||
flbeet.setBeet(randomwertex,randomwertey); | flbeet.setBeet(randomwertex,randomwertey); | ||||
flweg.setWeg(randomwertex,randomwertey); | flweg.setWeg(randomwertex,randomwertey); | ||||
pfl = new Pflanze1(100,100,3); | pfl = new Pflanze1(100,100,3); | ||||
//pfl2 = new Pflanze1(200,400,2); | |||||
pflanzen.add(pfl); | |||||
//pflanzen.add(pfl2); | |||||
flpfl.setPflanzen(pflanzen); | |||||
//meinGarten.hinzufuegenPflanze(pfl); | |||||
// meinGarten.hinzufuegenPflanze(pfl2); | |||||
pfl2 = new Pflanze1(200,400,4); | |||||
meinGarten.hinzufuegenPflanze(pfl); | |||||
meinGarten.hinzufuegenPflanze(pfl2); | |||||
meinGarten.zeichnePflanzen(); | meinGarten.zeichnePflanzen(); | ||||
} | } | ||||
/* | /* |
/* | |||||
* 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 garten.model; | |||||
/** | |||||
* | |||||
* @author Jan | |||||
*/ | |||||
public class Gaertner1 | |||||
{ | |||||
public Gaertner1() | |||||
{ | |||||
} | |||||
} |
void setPosition(); | void setPosition(); | ||||
//Position lieferePosition(); | //Position lieferePosition(); | ||||
//TurtleStack ts = new TurtleStack(); | |||||
//public void draw(); | //public void draw(); | ||||
public ArrayList<float[]> getPoints(); | public ArrayList<float[]> getPoints(); | ||||
{ | { | ||||
x_temp, y_temp, turtle.getX(), turtle.getY() | x_temp, y_temp, turtle.getX(), turtle.getY() | ||||
}; | }; | ||||
System.out.println("Punkte :" +x_temp + " " + y_temp + " " + turtle.getX()+ " " + turtle.getY()); | |||||
pts.add(temp); | pts.add(temp); | ||||
break; | break; | ||||
case '+': | case '+': | ||||
return pts; | return pts; | ||||
} | } | ||||
public int getPositionx() | public int getPositionx() | ||||
{ | { | ||||
return positionx; | return positionx; | ||||
{ | { | ||||
positiony = y; | positiony = y; | ||||
} | } | ||||
public void setflaeche(int flaeche) | |||||
{ | |||||
} | |||||
public int getflaeche() | public int getflaeche() | ||||
{ | { | ||||
return flaeche; | return flaeche; |
/* | |||||
* 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 garten.model; | |||||
/** | |||||
* | |||||
* @author Jan | |||||
*/ | |||||
class Pflanzengruppe | |||||
{ | |||||
private int alter; | |||||
private int pflanzentyp; | |||||
private int anzahlPflanzen = 1; | |||||
//Pflanze[] Pflanzengruppe = new Pflanze[anzahlPflanzen]; | |||||
Pflanzengruppe(int Alter,int PflanzenTyp,int AnzahlPflanzen) | |||||
{ | |||||
alter = Alter; | |||||
pflanzentyp = PflanzenTyp; | |||||
anzahlPflanzen = AnzahlPflanzen; | |||||
} | |||||
public void anzeigen() | |||||
{ | |||||
} | |||||
public void beginnebepflanzung() | |||||
{ | |||||
} | |||||
} |
/* | |||||
* 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 garten.model; | |||||
/** | |||||
* | |||||
* @author Jan | |||||
*/ | |||||
class PflanzengruppenKonfigurator | |||||
{ | |||||
private int alter = 1; | |||||
private int pflanzenTyp = 1; | |||||
private int anzahlPflanzen = 1; | |||||
public PflanzengruppenKonfigurator() | |||||
{ | |||||
} | |||||
public PflanzengruppenKonfigurator alter(int Alter) | |||||
{ | |||||
this.alter = Alter; | |||||
return this; | |||||
} | |||||
public PflanzengruppenKonfigurator pflanzenTyp(int PflanzenTyp) | |||||
{ | |||||
this.pflanzenTyp = PflanzenTyp; | |||||
return this; | |||||
} | |||||
public PflanzengruppenKonfigurator anzahlPflanzen(int AnzahlPflanzen) | |||||
{ | |||||
this.anzahlPflanzen = AnzahlPflanzen; | |||||
return this; | |||||
} | |||||
public void setanzPflanzen(int tempanz) | |||||
{ | |||||
anzahlPflanzen=tempanz; | |||||
} | |||||
public Pflanzengruppe erstellen() throws IllegalArgumentException | |||||
{ | |||||
konfigurationPruefen(); | |||||
Pflanzengruppe pflgruppe = new Pflanzengruppe(alter,pflanzenTyp,anzahlPflanzen); | |||||
return pflgruppe; | |||||
} | |||||
private void konfigurationPruefen() throws IllegalArgumentException | |||||
{ | |||||
if((this.pflanzenTyp ==2 ||this.pflanzenTyp ==3 )&& alter > 4) | |||||
{ | |||||
throw new IllegalArgumentException("Ein geringeres Alter muss gewählt werden"); | |||||
} | |||||
if(this.pflanzenTyp ==1 && alter > 5) | |||||
{ | |||||
throw new IllegalArgumentException("Ein geringeres Alter muss gewählt werden"); | |||||
} | |||||
} | |||||
} |
hauptkiste.add(flbeet); | hauptkiste.add(flbeet); | ||||
hauptkiste.add(flweg); | hauptkiste.add(flweg); | ||||
Gaertner ga = new Gaertner(view,flbeet,flweg,flpflanzen); | |||||
Gaertner ga = new Gaertner(view,flbeet,flweg,flpflanzen); | |||||
} | } | ||||
/** | /** |
g.fillRect(randomwertex[i] + 10, randomwertey[j] + 10, randomwertex[i + 1] - randomwertex[i] - 20, randomwertey[j + 1] - randomwertey[j] - 20); | g.fillRect(randomwertex[i] + 10, randomwertey[j] + 10, randomwertex[i + 1] - randomwertex[i] - 20, randomwertey[j + 1] - randomwertey[j] - 20); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
public void setBeet(int[] x, int[] y) | public void setBeet(int[] x, int[] y) | ||||
{ | { | ||||
randomwertex = x; | randomwertex = x; |
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, | ||||
RenderingHints.VALUE_ANTIALIAS_ON); | RenderingHints.VALUE_ANTIALIAS_ON); | ||||
g.setColor(colorPflanzen); | g.setColor(colorPflanzen); | ||||
System.out.println(pflanzen); | |||||
for(Pflanze p : pflanzen) | for(Pflanze p : pflanzen) | ||||
{ | { | ||||
ArrayList<float[]> pts = p.getPoints(); | ArrayList<float[]> pts = p.getPoints(); | ||||
System.out.println("Return points" + pts); | |||||
for(float[] pt : pts) | for(float[] pt : pts) | ||||
{ | { | ||||
Gerade.setLine(pt[0], pt[1], pt[2], pt[3]); | Gerade.setLine(pt[0], pt[1], pt[2], pt[3]); |