Jan 4 years ago
parent
commit
91d1bbbec8

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

@@ -72,18 +72,15 @@ public class Gaertner
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)
flbeet.setBeet(randomwertex,randomwertey);
flweg.setWeg(randomwertex,randomwertey);
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();
}
/*

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

@@ -0,0 +1,19 @@
/*
* 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

@@ -17,7 +17,6 @@ public interface Pflanze
void setPosition();
//Position lieferePosition();
//TurtleStack ts = new TurtleStack();
//public void draw();
public ArrayList<float[]> getPoints();

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

@@ -71,7 +71,6 @@ public class PflanzeImpl extends JComponent implements Pflanze
{
x_temp, y_temp, turtle.getX(), turtle.getY()
};
System.out.println("Punkte :" +x_temp + " " + y_temp + " " + turtle.getX()+ " " + turtle.getY());
pts.add(temp);
break;
case '+':
@@ -109,7 +108,6 @@ public class PflanzeImpl extends JComponent implements Pflanze
return pts;
}


public int getPositionx()
{
return positionx;
@@ -129,11 +127,7 @@ public class PflanzeImpl extends JComponent implements Pflanze
{
positiony = y;
}

public void setflaeche(int flaeche)
{
}

public int getflaeche()
{
return flaeche;

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

@@ -0,0 +1,37 @@
/*
* 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

@@ -0,0 +1,67 @@
/*
* 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

@@ -41,7 +41,7 @@ public class start
hauptkiste.add(flbeet);
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

@@ -39,9 +39,7 @@ public class FlaecheBeet extends JPanel
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)
{
randomwertex = x;

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

@@ -41,14 +41,10 @@ public class FlaechePflanzen extends JPanel

g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);

g.setColor(colorPflanzen);
System.out.println(pflanzen);
for(Pflanze p : pflanzen)
{
ArrayList<float[]> pts = p.getPoints();
System.out.println("Return points" + pts);
for(float[] pt : pts)
{
Gerade.setLine(pt[0], pt[1], pt[2], pt[3]);

Loading…
Cancel
Save