Package eas.startSetup.marbBuilder

Examples of eas.startSetup.marbBuilder.DargestellterGraph


        ArrowMaster master = new ArrowMaster(this.pars);
        Knoten aktKnot = this.getAktZustand();
        if (aktKnot == null) {
            aktKnot = this.getVAut()[0].holeStartzustand();
        }
        DargestellterGraph darstellung = new DarstModEA(
                0,
                0,
                this.umg.getFeld()[0].length - 100,
                this.umg.getFeld()[0].length - 100).erzeuge(
                        this.vAuts()[0], aktKnot);
View Full Code Here


        final int height = 500;
        ArrowMaster master = new ArrowMaster(params);
       
        BufferedImage img;
        DarstModEA dar = new DarstModEA(0, 0, width, height);
        DargestellterGraph darGraph = dar.erzeuge(this, null);
        List<Object> drawList = master.graph(darGraph);
        img = Geometry2D.erzBuffImgAusObjekten(drawList);
       
        return img;
    }
View Full Code Here

    public BufferedImage generateMRTImage() {
        float nodeCount = this.marb.getKnList().size();
        float sizeConstant = 100;
        float relation = 1;
       
        DargestellterGraph g = new DarstModEA(
                0,
                0,
                (int) (sizeConstant * Math.sqrt(nodeCount)),
                (int) (relation * sizeConstant * Math.sqrt(nodeCount))).erzeuge(marb, marb.getCurrentState());
        List<Object> toPaint = master.graph(g);
View Full Code Here

     *
     * @return  Darstellung des Graphen g.
     */
    public DargestellterGraph erzeuge(final EndlicherAutomat g,
                                      final Object ausgKn) {
        DargestellterGraph darstellung = new DargestellterGraph(null);
        Iterator<Knoten> it;
        Iterator<Knoten> it1;
        Iterator<Integer> it2;
        Iterator<Transition> it3;
        Knoten knot;
        Knoten knot1;
        Knoten knot2;
        Vector2D koord1;
        Vector2D koord2;

        if (!g.istLeer()) {
            final ArrayList<Knoten> knotenListe
                = new ArrayList<Knoten>(g.holAdj().values());
            int knAnzahl = knotenListe.size();
           
            if (knAnzahl < 2) {
                knAnzahl = 2;
            }
           
            int gitterX = Math.abs(this.rechts - this.links)
                          / (int) ((Math.ceil(Math.sqrt(knAnzahl))) - 1);
            int gitterY = Math.abs(this.unten - this.oben)
                          / (int) ((Math.ceil(Math.sqrt(knAnzahl))) - 1);

            int koordX = this.links;
            int koordY = this.oben;
           
            int kX;
            int kY;
            Transition bed;
            int folgeZustand;
            String bedingung;
            int xAusgleich;
            int zaehler = 0;
           
            // Knoten
            it = knotenListe.iterator();
            while (it.hasNext()) {
                knot = it.next();

                if (this.gesetzteKn.containsKey(knot.holeName())) {
                    kX = (int) this.gesetzteKn.get(knot.holeName()).x;
                    kY = (int) this.gesetzteKn.get(knot.holeName()).y;
                    this.setzeKnoten(knot,
                                     darstellung,
                                     kX,
                                     kY,
                                     (Knoten) ausgKn);

                    if (g.istStartZ(knot)) {
                        darstellung.hinzuPfeil(kX - 60,
                                               kY - 60,
                                               kX - 45,
                                               kY - 45,
                                               0.5,
                                               false);
                    }
                } else {
                    this.setzeKnoten(knot,
                                     darstellung,
                                     koordX,
                                     koordY,
                                     (Knoten) ausgKn);

                    this.gesetzteKn.put(knot.holeName(),
                                        new Vector2D(koordX, koordY));

                    if (g.istStartZ(knot)) {
                        darstellung.hinzuPfeil(koordX - 60,
                                               koordY - 60,
                                               koordX - 45,
                                               koordY - 45,
                                               0.5,
                                               false);
                    }

                    zaehler++;
                   
                    if (zaehler < Math.ceil(Math.sqrt(knAnzahl))) {
                        koordX = koordX + gitterX;
                    } else {
                        koordX = this.links;
                        koordY = koordY + gitterY;
                        zaehler = 0;
                    }
                }
            }

            // Kanten
            it1 = knotenListe.iterator();
            while (it1.hasNext()) {
                knot1 = it1.next();
                koord1 = this.gesetzteKn.get(knot1.holeName());

                it2 = (new ArrayList<Integer>(
                                knot1.holeNachfolger().keySet())).iterator();
                while (it2.hasNext()) {
                    boolean gebogen = true;
                   
                    knot2 = g.holeKnoten(it2.next());
                    koord2 = this.gesetzteKn.get(knot2.holeName());
                    Condition cond
                        = knot1.getInfo().getTransZuZustand(
                                knot2.holeName()).get(0).getCond();
                    double staerke = StaticMethods.condStrength(cond,
                                                   ConstantsDarstellung.STAERKE_ERST,
                                                   ConstantsDarstellung.STAERKE_ZWEIT);
                   
                    if (koord1.distance(koord2) < 140
                            && !koord1.equals(koord2)) {
                        gebogen = false;
                    }
                   
                    darstellung.hinzuPfeil(
                            (int) koord1.x,
                            (int) koord1.y,
                            (int) koord2.x,
                            (int) koord2.y,
                            staerke,
                            gebogen);
                }
            }

            // Kantenbeschriftungen
            it1 = knotenListe.iterator();
            while (it1.hasNext()) {
                int kantNum = 1;
                knot1 = it1.next();
                koord1 = this.gesetzteKn.get(knot1.holeName());

                it3 = knot1.getInfo().getBeds().iterator();
                while (it3.hasNext()) {
                    Polygon p = new Polygon();
                    bed = it3.next();
                    folgeZustand = bed.getFolgezustand();
                    bedingung = bed.getCond().toString();
                    knot2 = g.holeKnoten(new Integer(folgeZustand));
                    koord2 = this.gesetzteKn.get(knot2.holeName());

                    p.addPoint((int) koord1.x, (int) koord1.y);
                    p.addPoint((int) koord2.x, (int) koord2.y);

                    if (koord1.equals(koord2)) {
                        xAusgleich = 95;
                    } else {
                        xAusgleich = 0;
                    }

                    darstellung.hinzuBeschr(
                            (int) ((koord1.x + koord2.x) / 2) + xAusgleich,
                            (int) ((koord1.y + koord2.y) / 2),
                            kantNum + ".)  " + bedingung,
                            p);
                   
View Full Code Here

TOP

Related Classes of eas.startSetup.marbBuilder.DargestellterGraph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.