Package fmg.fmg8.graphVis

Examples of fmg.fmg8.graphVis.SteuerFenster


     *
     * @param stuetz  Der St�tzpunkt.
     * @param richt   Die Richtung.
     */
    public Gerade2D(final Vektor2D stuetz, final Vektor2D richt) {
        this.stuetzPunkt = new Vektor2D(stuetz);
        this.richtung = new Vektor2D(richt);
    }
View Full Code Here


     * Konstruktor, der die Gerade als Verl�ngerung einer Strecke erzeugt.
     *
     * @param s  Die Strecke, aus der die Gerade erzeugt werden soll.
     */
    public Gerade2D(final Strecke2D s) {
        this.stuetzPunkt = new Vektor2D(s.getAnfPkt());
        this.richtung = new Vektor2D(s.getEndPkt());
        this.richtung.sub(s.getEndPkt());
    }
View Full Code Here

     *          v1.x * v2.y - v2.x * v1.y > konst
     *          gilt, mit konst = 0.0001.
     */
    public Vektor2D schnPktSpezial(final Gerade2D h) {
        final double nullKonst = 0.0001;
        final Vektor2D p1 = this.stuetzPunkt;
        final Vektor2D v1 = this.richtung;
        final Vektor2D p2 = h.stuetzPunkt;
        final Vektor2D v2 = h.richtung;
        Vektor2D zwisch;
       
        // Der Schnittpunkt der Geraden.
        Vektor2D q = new Vektor2D(p1);
        q.add(p2);
        q.div(2);

        if (v1.distanz(Vektor2D.NULL_VEKTOR) < nullKonst
            || v2.distanz(Vektor2D.NULL_VEKTOR) < nullKonst
            || Double.isNaN(v1.x) || Double.isNaN(v1.y)
            || Double.isNaN(v2.x) || Double.isNaN(v2.y)
            || Double.isNaN(p1.x) || Double.isNaN(p1.y)
            || Double.isNaN(p2.x) || Double.isNaN(p2.y)
            ) {
            if (Double.isNaN(p1.x) || Double.isNaN(p1.y)) {
                q = new Vektor2D(p2);
            }
            if (Double.isNaN(p2.x) || Double.isNaN(p2.y)) {
                q = new Vektor2D(p1);
            }
        } else {
            zwisch = this.schnPkt(h);
           
            if (zwisch != null) {
View Full Code Here

     */
    public Vektor2D schnPkt(final Gerade2D h) {
        double t;
        double div;
        final double nullKonst = 0.0001;
        Vektor2D q = null;
        final Vektor2D p1 = this.stuetzPunkt;
        final Vektor2D v1 = this.richtung;
        final Vektor2D p2 = h.stuetzPunkt;
        final Vektor2D v2 = h.richtung;
       
        t = v1.y * (p2.x - p1.x) - v1.x * (p2.y - p1.y);
        div = v1.x * v2.y - v2.x * v1.y;
       
        if (Math.abs(div) > nullKonst) {
            t /= div;
            q = new Vektor2D(v2);
            q.mult(t);
            q.add(p2);
        }
       
        return q;
View Full Code Here

     *
     * @param anfang  Der Anfangspunkt der Geraden.
     * @param ende    Der Endpunkt der Geraden.
     */
    public Strecke2D(final Vektor2D anfang, final Vektor2D ende) {
       this.anfPkt = new Vektor2D(anfang);
       this.endPkt = new Vektor2D(ende);
    }
View Full Code Here

     * Gibt die Richtung der Gerade normiert zur�ck.
     *
     * @return  Die Richtung der Geraden.
     */
    public Vektor2D getNormRicht() {
        Vektor2D richt = new Vektor2D(this.endPkt);
        richt.sub(anfPkt);
        richt.normal();
        return richt;
    }
View Full Code Here

     *
     * @return  Der Schnittpunkt von g ung h. Wenn die Strecken keinen
     *          Schnittpunkt haben, wird <code>null</code> zur�ckgegeben.
     */
    public Vektor2D schnPkt(final Strecke2D q) {
        Vektor2D vp, vq;
        Gerade2D g, h;
        vp = this.getNormRicht();
        vq = q.getNormRicht();
       
        g = new Gerade2D(this.anfPkt, vp);
        h = new Gerade2D(q.anfPkt, vq);
       
        Vektor2D strSchnPkt = g.schnPkt(h);
       
        if (strSchnPkt == null) {
            return null;
        }
       
        if (strSchnPkt.istInRechteckOR(this.anfPkt, this.endPkt)
            && strSchnPkt.istInRechteckOR(q.anfPkt, q.endPkt)) {
            return strSchnPkt;
        } else {
            return null;
        }
    }
View Full Code Here

     * @param rad  Radius des Kreises.
     */
    public Kreis2D(final double x,
                   final double y,
                   final double rad) {
        this.mittelpunkt = new Vektor2D(x, y);
        this.radius      = rad;
    }
View Full Code Here

     * @param mit  Mittelpunkt des Kreises.
     * @param rad  Radius des Kreises.
     */
    public Kreis2D(final Vektor2D mit,
                   final double rad) {
        this.mittelpunkt = new Vektor2D(mit);
        this.radius      = rad;
    }
View Full Code Here

            final int ident) {

        super(fenstertitel);

        this.skalierung = 1;
        this.verschiebung = new Vektor2D(Vektor2D.NULL_VEKTOR);
       
        this.markierte = new LinkedList<Integer>();
        this.userSegs = new LinkedList<SegSpez>();
        this.setSize(750, 700);
       
        this.aktDicke = fmg.fmg8.graphVis.zeichenModi.Konstanten.PFEIL_DICKE;
        this.pfeilPol = new Polygon2D();
        this.pars = params;
        this.zeichenArt = new PfeilMaster(this.pars);
        this.segBeschr = new SegSpez[1000];
       
        this.addMouseWheelListener(this);
       
        this.addComponentListener(new ComponentListener() {
            @Override
            public void componentHidden(final ComponentEvent e) {

            }

            @Override
            public void componentMoved(final ComponentEvent e) {

            }

            @Override
            public void componentResized(final ComponentEvent e) {
                ZeichFen.this.neuZeichnen();
            }

            @Override
            public void componentShown(final ComponentEvent e) {
               
            }
        }
        );

        this.addMouseMotionListener(new MouseMotionAdapter() {
            public void mouseDragged(final MouseEvent event) {
                Vektor2D vek = new Vektor2D(
                        (event.getX() - verschiebung.x) / skalierung,
                        (event.getY() - verschiebung.y) / skalierung);
                Vektor2D neu;

                if (ZeichFen.this.vekClick != null) {
                    for (int i = 0; i < ZeichFen.this.pfeilPol.size(); i++) {
                        if (ZeichFen.this.markierte.contains(i)) {
                           
                            neu = new Vektor2D(ZeichFen.this.pfeilPol.get(i));
                            neu.add(vek);
                            neu.sub(ZeichFen.this.ersteEcke);
                           
                            ZeichFen.this.pfeilPol.set(i, neu);
                        }
                    }
                   
                    ZeichFen.this.vekClick
                        = ZeichFen.this.containsPoint(vek);

                    ZeichFen.this.ersteEcke = vek;
                   
                    ZeichFen.this.neuZeichnen();
                } else {
                    ZeichFen.this.zweiteEcke
                        = new Vektor2D(
                                (event.getX() - verschiebung.x) / skalierung,
                                (event.getY() - verschiebung.y) / skalierung);
                   
                    ZeichFen.this.neuZeichnen();
                }
            }
        });

        this.addMouseListener(new MouseAdapter() {
            public void mousePressed(final MouseEvent event) {
                Vektor2D vek = new Vektor2D(
                        (event.getX() - verschiebung.x) / skalierung,
                        (event.getY() - verschiebung.y) / skalierung);
               
                ZeichFen.this.ersteEcke = new Vektor2D(vek);
               
                ZeichFen.this.vekClick
                    = ZeichFen.this.containsPoint(vek);
               
                ZeichFen.this.mark1 = ZeichFen.this.mark2;
                ZeichFen.this.mark2 = ZeichFen.this.pfeilPol.realIndexOf(
                        ZeichFen.this.vekClick);
               
                if (ZeichFen.this.mark1 != null
                        && ZeichFen.this.mark1 < 0) {
                    ZeichFen.this.mark1 = null;
                }
                if (ZeichFen.this.mark2 != null
                        && ZeichFen.this.mark2 < 0) {
                    ZeichFen.this.mark2 = null;
                }
               
                if (ZeichFen.this.mark1 != null
                        && !ZeichFen.this.markierte.contains(
                                ZeichFen.this.mark1)) {
                    ZeichFen.this.markierte.add(ZeichFen.this.mark1);
                }
                if (ZeichFen.this.mark2 != null
                        && !ZeichFen.this.markierte.contains(
                                ZeichFen.this.mark2)) {
                    ZeichFen.this.markierte.add(ZeichFen.this.mark2);
                }
            }
           
            public void mouseClicked(final MouseEvent event) {
                Vektor2D vek = new Vektor2D(
                        (event.getX() - verschiebung.x) / skalierung,
                        (event.getY() - verschiebung.y) / skalierung);

                if (event.getButton() == 3) {
                    skaliere();
                    zentriere();
                    return;
                }
               
                if (ZeichFen.this.containsPoint(vek) == null
                        && (ZeichFen.this.mark1 != null
                        || ZeichFen.this.mark2 != null
                        || ZeichFen.this.markierte.size() > 0)) {
                    ZeichFen.this.markierte.clear();
                    ZeichFen.this.mark1 = null;
                    ZeichFen.this.mark2 = null;
                } else {
                    if (ZeichFen.this.vekClick == null
                            && event.getClickCount() >= 2) {
                        ZeichFen.this.pfeilPol.add(new Vektor2D(vek));
                        ZeichFen.this.dicken.add(ZeichFen.this.aktDicke);
                    }
                }
            }
           
View Full Code Here

TOP

Related Classes of fmg.fmg8.graphVis.SteuerFenster

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.