svn-gvsig-desktop / branches / CqCMSDvp / libraries / libCq CMS for java.old / src / org / cresques / px / gml / Point.java @ 2312
History | View | Annotate | Download (2.51 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.cresques.px.gml; |
25 |
|
26 |
import java.awt.Color; |
27 |
import java.awt.geom.Point2D; |
28 |
|
29 |
import java.awt.Graphics2D; |
30 |
|
31 |
import java.awt.geom.Line2D; |
32 |
|
33 |
import org.cresques.cts.ICoordTrans; |
34 |
import org.cresques.cts.IProjection; |
35 |
import org.cresques.geo.ViewPortData; |
36 |
|
37 |
/**
|
38 |
* Geometria de tipo Point
|
39 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es>
|
40 |
*/
|
41 |
|
42 |
public class Point extends Geometry { |
43 |
public static int pointNr = 0; |
44 |
public String text = null; |
45 |
private boolean textPoint; |
46 |
|
47 |
public Point() { |
48 |
super();
|
49 |
} |
50 |
|
51 |
public void add(Point2D pt) { |
52 |
pointNr++; |
53 |
super.add(pt);
|
54 |
} |
55 |
|
56 |
private Color fColor = null; //new Color(255,222,165,64); |
57 |
private Color color = new Color(255,0,0); //Color(255,214,132,255); |
58 |
|
59 |
public Color c() {return color;} |
60 |
public Color c(Color color) {this.color = color; return color;} |
61 |
|
62 |
public Color fillColor() {return fColor;} |
63 |
public Color fillColor(Color c) {fColor = c; return fColor;} |
64 |
|
65 |
public IProjection getProjection() { return proj; } |
66 |
public void setProjection(IProjection p) { proj = p; } |
67 |
public void reProject(ICoordTrans rp) { |
68 |
// TODO metodo reProject pendiente de implementar
|
69 |
} |
70 |
|
71 |
public void draw(Graphics2D g, ViewPortData vp) { |
72 |
g.setColor(c()); |
73 |
Point2D pt = new Point2D.Double(0D, 0D); |
74 |
vp.mat.transform((Point2D) data.get(0), pt); |
75 |
g.draw(new Line2D.Double(pt, pt)); |
76 |
if (text != null) |
77 |
g.drawString(text, (int) pt.getX(), (int) pt.getY()); |
78 |
} |
79 |
|
80 |
/**
|
81 |
* @return Returns the textPoint.
|
82 |
*/
|
83 |
public boolean isTextPoint() { |
84 |
return textPoint;
|
85 |
} |
86 |
/**
|
87 |
* @param textPoint The textPoint to set.
|
88 |
*/
|
89 |
public void setTextPoint(boolean textPoint) { |
90 |
this.textPoint = textPoint;
|
91 |
} |
92 |
} |
93 |
|
94 |
|