Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libDXF / src / org / gvsig / dxf / px / gml / Point.java @ 29630

History | View | Annotate | Download (2.73 KB)

1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 *
22
 * cresques@gmail.com
23
 */
24
package org.gvsig.dxf.px.gml;
25

    
26
import java.awt.Color;
27
import java.awt.Graphics2D;
28
import java.awt.geom.Line2D;
29
import java.awt.geom.Point2D;
30

    
31
import org.cresques.cts.ICoordTrans;
32
import org.cresques.cts.IProjection;
33
import org.cresques.geo.ViewPortData;
34

    
35

    
36
/**
37
 * Geometria de tipo Point
38
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
39
 */
40
public class Point extends Geometry {
41
    public static int pointNr = 0;
42
    public String text = null;
43
    private boolean textPoint;
44
    private Color fColor = null; //new Color(255,222,165,64);
45
    private Color color = new Color(255, 0, 0); //Color(255,214,132,255);
46

    
47
    public Point() {
48
        super();
49
    }
50

    
51
    public void add(Point2D pt) {
52
        pointNr++;
53
        super.add(pt);
54
    }
55

    
56
    public Color c() {
57
        return color;
58
    }
59

    
60
    public Color c(Color color) {
61
        this.color = color;
62

    
63
        return color;
64
    }
65

    
66
    public Color fillColor() {
67
        return fColor;
68
    }
69

    
70
    public Color fillColor(Color c) {
71
        fColor = c;
72

    
73
        return fColor;
74
    }
75

    
76
    public IProjection getProjection() {
77
        return proj;
78
    }
79

    
80
    public void setProjection(IProjection p) {
81
        proj = p;
82
    }
83

    
84
    public void reProject(ICoordTrans rp) {
85
        // TODO metodo reProject pendiente de implementar
86
    }
87

    
88
    public void draw(Graphics2D g, ViewPortData vp) {
89
        g.setColor(c());
90

    
91
        Point2D pt = new Point2D.Double(0D, 0D);
92
        vp.mat.transform((Point2D) data.get(0), pt);
93
        g.draw(new Line2D.Double(pt, pt));
94

    
95
        if (text != null) {
96
            g.drawString(text, (int) pt.getX(), (int) pt.getY());
97
        }
98
    }
99

    
100
    /**
101
     * @return Returns the textPoint.
102
     */
103
    public boolean isTextPoint() {
104
        return textPoint;
105
    }
106

    
107
    /**
108
     * @param textPoint The textPoint to set.
109
     */
110
    public void setTextPoint(boolean textPoint) {
111
        this.textPoint = textPoint;
112
    }
113
}