Jan 4 years ago
parent
commit
91d1bbbec8

+ 4
- 7
Garten/src/garten/model/Gaertner.java View File

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();
} }
/* /*

+ 19
- 0
Garten/src/garten/model/Gaertner1.java View File

/*
* 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()
{

}
}

+ 0
- 1
Garten/src/garten/model/Pflanze.java View File

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();

+ 1
- 7
Garten/src/garten/model/PflanzeImpl.java View File

{ {
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;

+ 37
- 0
Garten/src/garten/model/Pflanzengruppe.java View File

/*
* 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()
{
}
}

+ 67
- 0
Garten/src/garten/model/PflanzengruppenKonfigurator.java View File

/*
* 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");
}
}
}

+ 1
- 1
Garten/src/garten/start.java View File

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);
} }


/** /**

+ 0
- 2
Garten/src/garten/view/FlaecheBeet.java View File

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;

+ 0
- 4
Garten/src/garten/view/FlaechePflanzen.java View File



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]);

Loading…
Cancel
Save