Package fmg.fmg8.graphVis.darstellungsModi

Examples of fmg.fmg8.graphVis.darstellungsModi.Konstanten


     *                  
     * @return         Die linke obere und rechte untere Koordinate des
     *                 Rahmens.
     */
    public static Polygon2D rahmen(final List<Object> objekte) {
        Vektor2D maxPkt = new Vektor2D(Double.NEGATIVE_INFINITY,
                                   Double.NEGATIVE_INFINITY);
        Vektor2D minPkt = new Vektor2D(Double.POSITIVE_INFINITY,
                                   Double.POSITIVE_INFINITY);
        Vektor2D zwischMax = new Vektor2D(Vektor2D.NULL_VEKTOR);
        Vektor2D zwischMin = new Vektor2D(Vektor2D.NULL_VEKTOR);
        Polygon2D rahmen = new Polygon2D(2);
        int stringPos = 0;
        int stringX = 0;
        int stringY = 0;
       
        for (Object o : objekte) {
            if (o.getClass().equals(Polygon.class)) {
                Polygon p = (Polygon) o;
                zwischMax.x = p.getBounds().getMaxX();
                zwischMax.y = p.getBounds().getMaxY();
                zwischMin.x = p.getBounds().getMinX();
                zwischMin.y = p.getBounds().getMinY();
            } else if (o.getClass().equals(Kreis2D.class)) {
                Kreis2D k = (Kreis2D) o;
                zwischMax = new Vektor2D(k.holeMitte());
                zwischMin = new Vektor2D(k.holeMitte());
                zwischMax.add(new Vektor2D(k.holeRadius(), k.holeRadius()));
                zwischMin.sub(new Vektor2D(k.holeRadius(), k.holeRadius()));
            } else if (o.getClass().equals(Integer.class)) {
                if (stringPos == 0) {
                    stringX = (Integer) o;
                    stringPos++;
                } else {
                    stringY = (Integer) o;
                    stringPos = 0;
                }
            } else if (o.getClass().equals(String.class)) {
                String s = (String) o;
                double stringHeight = 10;
                double stringWidth = s.length() * 6;
                zwischMin = new Vektor2D(stringX, stringY - stringHeight);
                zwischMax = new Vektor2D(stringX + stringWidth, stringY);
            } else {
                zwischMax = new Vektor2D(maxPkt);
                zwischMin = new Vektor2D(minPkt);
            }

            if (zwischMax.x > maxPkt.x) {
                maxPkt.x = zwischMax.x;
            }
View Full Code Here


    **/
    public static BufferedImage erzBuffImgAusObjekten(
            final List<Object> oL,
            final Parametersatz params) {
        Polygon2D rahmen = fmg.fmg8.graphVis.zeichenModi.Geometrie2D.rahmen(oL);
        Vektor2D rahmenMin = rahmen.get(0);
        Vektor2D rahmenMax = rahmen.get(1);
        rahmenMin.sub(new Vektor2D(10, 10));
        rahmenMax.add(new Vektor2D(10, 10));

        double breite = rahmenMax.x - rahmenMin.x;
        double hoehe = rahmenMax.y - rahmenMin.y;
       
        if (breite <= 0) {
View Full Code Here

             final Vektor2D p3,
             final double dicke) {
        
         Polygon2D pkte = new Polygon2D(2);
        
         Vektor2D v1 = new Vektor2D(p2.x - p1.x, p2.y - p1.y);
         Vektor2D v2 = new Vektor2D(p3.x - p2.x, p3.y - p2.y);
         Vektor2D c1 = new Vektor2D(v1.y, -v1.x);
         Vektor2D c2 = new Vektor2D(v2.y, -v2.x);
         Vektor2D p11;
         Vektor2D p12;
         Vektor2D p01;
         Vektor2D p02;
         Gerade2D g1, h1, g2, h2;
        
         c1.mult(dicke / (c1.laenge() * 2));
         c2.mult(dicke / (c2.laenge() * 2));
        
         p11 = new Vektor2D(p1);
         p12 = new Vektor2D(p3);
         p01 = new Vektor2D(p1);
         p02 = new Vektor2D(p3);
        
         p11.add(c1);
         p12.add(c2);
         p01.sub(c1);
         p02.sub(c2);
        
         v1.laengeFestlegen(p1.distanz(p2));
         v2.laengeFestlegen(p2.distanz(p3));
        
         g1 = new Gerade2D(p11, v1);
View Full Code Here

     * @param nummer  Die Nummer des Endentyps.
     *
     * @return  Eine Liste mit Punkten, die diesen Endentyp beschreiben.
     */
    private static Pfeilspitze erzeugeKonstanteEnden(final int nummer) {
        Vektor2D v;
        Pfeilspitze a = null;
       
        if (nummer == 0) {
            a = new Pfeilspitze(0, "Gerades Ende");
        }

        if (nummer == 1) {
            a = new Pfeilspitze("Pfeilspitze 1");
            v = new Vektor2D(1.8, -0.7);
            a.add(v);
            v = new Vektor2D(0, 5);
            a.add(v);
            v = new Vektor2D(-1.8, -0.7);
            a.add(v);
        }

        if (nummer == 2) {
            a = new Pfeilspitze(1, "Doppelspitzes Ende");
            v = new Vektor2D(Vektor2D.NULL_VEKTOR);
            v.sub(new Vektor2D(0, 0.3));
            a.add(v);
        }

        if (nummer == 3) {
            a = new Pfeilspitze(
                    fmg.fmg8.graphVis.zeichenModi.Geometrie2D.bezierKurve(
                            new Vektor2D(0.5, 0),
                            new Vektor2D(5, 5),
                            new Vektor2D(-5, 5),
                            new Vektor2D(-0.5, 0),
                            0.0001),
                    "Kugelende");
        }
       
        if (nummer == 4) {
            a = new Pfeilspitze(3, "Pfeilspitze 2");
            v = new Vektor2D(1.8, 0);
            a.add(v);
            v = new Vektor2D(0, 7);
            a.add(v);
            v = new Vektor2D(-1.8, 0);
            a.add(v);
        }
       
        if (nummer == 5) {
            a = new Pfeilspitze(6, "Pfeilspitze 3");
            v = new Vektor2D(2.3, -1.7);
            a.add(v);
            v = new Vektor2D(2.85, -1.7);
            a.add(v);
            v = new Vektor2D(0, 1.1);
            a.add(v);
            v = new Vektor2D(-2.85, -1.7);
            a.add(v);
            v = new Vektor2D(-2.3, -1.7);
            a.add(v);
        }

        if (nummer == 6) {
            Parametersatz params = new Parametersatz(new String[0]);
            params.ergaenze();
            PfeilMaster zeichnen = new PfeilMaster(params);

            ArrayList<Double> dicken = new ArrayList<Double>();
            Polygon2D bez = new Polygon2D();

            for (double i = 0.5 * Math.PI; i <= Math.PI * 1.5; i += 0.001) {
                bez.add(new Vektor2D(
                        -(Math.sin(i) * 4 - Math.sin(0.5 * Math.PI) * 4),
                        -(Math.cos(i) * 4 - Math.cos(0.5 * Math.PI) * 4)));
            }
           
            for (double i = 0; i < bez.size(); i += 1) {
                dicken.add(1.0);
            }

            a = new Pfeilspitze(
                    zeichnen.segmentPfeilPol2D(
                            bez,
                            dicken,
                            PfeilMaster.EINFACHER_ABSCHLUSS,
                            PfeilMaster.EINFACHE_SPITZE_1,
                            new Vektor2D(1, 1),
                            new Vektor2D(0.75, 0.75)),
                            "R�ckpfeil");
        }

        return a;
    }
View Full Code Here

        double y1d;
        double y2d;
        Polygon2D bez;
        ArrayList<Double> dick;
       
        Vektor2D pk0, pk1, pk2, pk3;
       
        if (!gebogen) {
            Vektor2D p1 = new Vektor2D(xx1, yy1);
            Vektor2D p2 = new Vektor2D(xx2, yy2);
            Polygon2D a = new Polygon2D(2);
            a.add(p1);
            a.add(p2);
            dick = new ArrayList<Double>(2);
            dick.add(staerke * Konstanten.DICKEN_REG_ST 
                             + this.pfeilDicke);
            dick.add((double) this.pfeilDicke);
           
            return this.segmentPfeilPol(a,
                                     dick,
                                     DOPPELSPITZES_ENDE,
                                     EINFACHE_SPITZE_1,
                                     new Vektor2D(1, 1),
                                     new Vektor2D(1, 1),
                                     1,
                                     Vektor2D.NULL_VEKTOR);
        }
       
        if (x1 == x2 && y1 == y2) {
            letztX = x1 + Konstanten.KN_DURCHM / 2;
            letztY = y1 + Konstanten.KN_DURCHM / 2;
           
            pk0 = new Vektor2D(letztX,
                             letztY);
            pk1 = new Vektor2D(letztX + 80,
                             letztY + 40);
            pk2 = new Vektor2D(letztX + 80,
                             y1 - Konstanten.KN_DURCHM / 2
                                  + this.pfeilDicke / 2 - 30);
            pk3 = new Vektor2D(letztX + this.pfeilSpLaenge - 2,
                             y1 - Konstanten.KN_DURCHM / 2
                                + this.pfeilDicke / 2 - 9);
           
            bez = fmg.fmg8.graphVis.zeichenModi.Geometrie2D.bezierKurve(
                    pk0,
                    pk1,
                    pk2,
                    pk3,
                    this.pars.getBezier());
           
//            if (this.pars.getEinfacheDar()) {
//                dick = null;
//            } else {
            dick = new ArrayList<Double>(bez.size());
            for (double i = 0; i <= bez.size(); i++) {
                dick.add((bez.size() - i) * staerke / bez.size()
                        * Konstanten.DICKEN_REG_ST 
                         + this.pfeilDicke);
            }
//            }
           
            return this.segmentPfeilPol(bez,
                                     dick,
                                     DOPPELSPITZES_ENDE,
                                     EINFACHE_SPITZE_1,
                                     new Vektor2D(1, 1),
                                     new Vektor2D(1, 1),
                                     1,
                                     Vektor2D.NULL_VEKTOR);
           
        } else {
            Vektor2D vv = new Vektor2D(x2, y2);
            vv.sub(new Vektor2D(x1, y1));
            vv.normal();
            vv.mult(35);
           
            x1 += vv.x;
            y1 += vv.y;
            x2 -= vv.x;
            y2 -= vv.y;

            // Die aktuelle Kante ist eine Doppelkante.
            if (this.aktGraph.enthaeltPfeil(xx2, yy2, xx1, yy1)) {
                x1d = (double) x1;
                x2d = (double) x2;
                y1d = (double) y1;
                y2d = (double) y2;
                vektorLen = Math.sqrt(Math.pow(x2d - x1d, 2)
                                    + Math.pow(y1d - y2d, 2));

                dieseKante = new Polygon();
                dieseKante.addPoint(x1, y1);
                dieseKante.addPoint(x2, y2);

                if (this.dopp.contains(dieseKante)) {
                    x1d = x1d + ((y1d - y2d) / vektorLen) * konstVersch;
                    x2d = x2d + ((y1d - y2d) / vektorLen) * konstVersch;
                    y1d = y1d + ((x2d - x1d) / vektorLen) * konstVersch;
                    y2d = y2d + ((x2d - x1d) / vektorLen) * konstVersch;
                } else {
                    x1d = x1d - ((y1d - y2d) / vektorLen) * konstVersch;
                    x2d = x2d - ((y1d - y2d) / vektorLen) * konstVersch;
                    y1d = y1d - ((x2d - x1d) / vektorLen) * konstVersch;
                    y2d = y2d - ((x2d - x1d) / vektorLen) * konstVersch;
                    this.dopp.add(dieseKante);
                }
                x1 = (int) x1d;
                x2 = (int) x2d;
                y1 = (int) y1d;
                y2 = (int) y2d;
            } else {
                Vektor2D v0 = new Vektor2D(x2, y2);
                v0.sub(new Vektor2D(x1, y1));
                v0.ortho();
                v0.normal();
                v0.mult(12);
               
                x1 += v0.x;
                x2 += v0.x;
                y1 += v0.y;
                y2 += v0.y;
            }

            Polygon pol1 = new Polygon();
            Polygon pol2 = new Polygon();

            pol1.addPoint(xx1, yy1);
            pol1.addPoint(xx2, yy2);
            pol2.addPoint(x1, y1);
            pol2.addPoint(x2, y2);

            this.urspKanten.add(pol1);
            this.echteKant.add(pol2);

            Vektor2D v = new Vektor2D(x2, y2);
            double dist = new Vektor2D(x1, y1).distanz(new Vektor2D(x2, y2));
           
            v.sub(new Vektor2D(x1, y1));
            v.normal();
            v.mult(this.pfeilSpLaenge);
            Vektor2D v1 = new Vektor2D(x1, y1);
            Vektor2D v2 = new Vektor2D(x2, y2);
            v2.sub(v);
           
            Vektor2D n1 = new Vektor2D((x1 + x2) / 2, (y1 + y2) / 2);
            Vektor2D n2 = new Vektor2D((x1 + x2) / 2, (y1 + y2) / 2);
            v.ortho();
            v.normal();
            Vektor2D zwisch = new Vektor2D(x2, y2);
            zwisch.sub(new Vektor2D(x1, y2));
           
            v.mult(Math.sqrt(Math.max(dist - 100, 0)) + 0.1);
           
           
            n1.add(v);
            n2.add(v);
           
            bez = fmg.fmg8.graphVis.zeichenModi.Geometrie2D.bezierKurve(
                    v1,
                    n1,
                    n2,
                    v2,
                    this.pars.getBezier());
//            if (this.pars.getEinfacheDar()) {
//                dick = null;
//            } else {
            dick = new ArrayList<Double>(bez.size());
            for (double i = 0; i <= bez.size(); i++) {
                dick.add((bez.size() - i) * staerke / bez.size()
                        * Konstanten.DICKEN_REG_ST
                         + this.pfeilDicke);
            }
//            }

            return this.segmentPfeilPol(bez,
                                     dick,
                                     DOPPELSPITZES_ENDE,
                                     EINFACHE_SPITZE_1,
                                     new Vektor2D(1, 1),
                                     new Vektor2D(1, 1),
                                     1,
                                     Vektor2D.NULL_VEKTOR);
        }
    }
View Full Code Here

     *
     * @param v1  Vektor f�r linke obere Ecke.
     * @param v2  Vektor f�r rechte untere Ecke.
     */
    public Rechteck2D(final Vektor2D v1, final Vektor2D v2) {
        this.linksOben = new Vektor2D(Vektor2D.NULL_VEKTOR);
        this.rechtsUnten = new Vektor2D(Vektor2D.NULL_VEKTOR);
        this.set(v1, v2);
    }
View Full Code Here

     * Setzt eine Seite des Rechtecks neu.
     *
     * @param xx1  Der zu setzende neue Wert.
     */
    public void setLinks(final double xx1) {
        this.set(new Vektor2D(xx1, this.y1), this.rechtsUnten);
    }
View Full Code Here

     * Setzt eine Seite des Rechtecks neu.
     *
     * @param xx2  Der zu setzende neue Wert.
     */
    public void setRechts(final double xx2) {
        this.set(this.linksOben, new Vektor2D(xx2, this.y2));
    }
View Full Code Here

     * Setzt eine Seite des Rechtecks neu.
     *
     * @param yy1  Der zu setzende neue Wert.
     */
    public void setOben(final double yy1) {
        this.set(new Vektor2D(this.x1, yy1), this.rechtsUnten);
    }
View Full Code Here

     * Setzt eine Seite des Rechtecks neu.
     *
     * @param yy2  Der zu setzende neue Wert.
     */
    public void setUnten(final double yy2) {
        this.set(this.linksOben, new Vektor2D(this.x2, yy2));
    }
View Full Code Here

TOP

Related Classes of fmg.fmg8.graphVis.darstellungsModi.Konstanten

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.