/**
 *
 * Beschreibung
 *
 * @version 1.0 vom 30.09.2012
 * @author 
 */

import java.awt.Color;
import java.awt.Graphics;

public class GPoint extends GeoObject {

    // Anfang Attribute
    private int x = 10;
    private int y = 15;
    private boolean selected;
    // Ende Attribute

    public GPoint(int x, int y) {
        super();
        this.x = x;
        this.y = y;
    }

    // Anfang Methoden
    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public boolean getSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    public void draw(Graphics gr) {
        gr.setColor(this.getColor());
        if (selected) {
            gr.fillRect(x-2, y-2, 5, 5);
        } // end of if 
        gr.drawRect(x-2, y-2, 5, 5);    
    }

    public double abstandZu(int mx, int my) {
        int dx = mx - x;
        int dy = my - y;
        double d = Math.sqrt(dx * dx + dy * dy);
        return d;
    }

    // Ende Methoden
} // end of Point
