root / trunk / libraries / libDXF / src / org / cresques / px / gml / Geometry.java @ 13047
History | View | Annotate | Download (3.06 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 org.cresques.cts.ICoordTrans; |
27 |
import org.cresques.cts.IProjection; |
28 |
|
29 |
import org.cresques.geo.Projected; |
30 |
import org.cresques.geo.ViewPortData; |
31 |
|
32 |
import org.cresques.px.Extent; |
33 |
import org.cresques.px.PxObj; |
34 |
|
35 |
import java.awt.Graphics2D; |
36 |
import java.awt.geom.Point2D; |
37 |
|
38 |
import java.util.Vector; |
39 |
|
40 |
|
41 |
/**
|
42 |
* Clase base para geometr?as.
|
43 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es>
|
44 |
*/
|
45 |
abstract public class Geometry extends PxObj implements Projected { |
46 |
protected IProjection proj;
|
47 |
|
48 |
// protected Extent extent = null;
|
49 |
Vector data = null; |
50 |
|
51 |
/**
|
52 |
* Constructor de Geometry.
|
53 |
*/
|
54 |
public Geometry() {
|
55 |
extent = new Extent();
|
56 |
data = new Vector(); |
57 |
} |
58 |
|
59 |
/**
|
60 |
* Permite a?adir un punto a la Geometry.
|
61 |
* @param pt
|
62 |
*/
|
63 |
public void add(Point2D pt) { |
64 |
extent.add(pt); |
65 |
data.add(pt); |
66 |
} |
67 |
|
68 |
/**
|
69 |
* Devuelve un punto de la Geometry dado por su ?ndice.
|
70 |
* @param i, ?ndice.
|
71 |
* @return Point2D.
|
72 |
*/
|
73 |
public Point2D get(int i) { |
74 |
return (Point2D) data.get(i); |
75 |
} |
76 |
|
77 |
/**
|
78 |
* Devuelve el n?mero de puntos que componen la Geometry.
|
79 |
* @return int
|
80 |
*/
|
81 |
public int pointNr() { |
82 |
return data.size();
|
83 |
} |
84 |
|
85 |
/**
|
86 |
* Devuelve el conjunto de objetos que conforman la Geometry en forma de Vector.
|
87 |
* @return Vector de objetos.
|
88 |
*/
|
89 |
public Vector getData() { |
90 |
return data;
|
91 |
} |
92 |
|
93 |
/**
|
94 |
* Devuelve el extent de la Geometry.
|
95 |
* @return Extent, el rect?ngulo que contiene la Geometry.
|
96 |
*/
|
97 |
public Extent getExtent() {
|
98 |
return extent;
|
99 |
} |
100 |
|
101 |
/**
|
102 |
* Devuelve la proyecci?n cartogr?fica en la que se encuentra la Geometry.
|
103 |
* @return IProjection, la proyecci?n cartogr?fica.
|
104 |
*/
|
105 |
abstract public IProjection getProjection(); |
106 |
|
107 |
/**
|
108 |
* Permite reproyectar la Geometry en funci?n de unas coordenadas de transformaci?n.
|
109 |
* @param rp, Coordenadas de transformaci?n.
|
110 |
*/
|
111 |
abstract public void reProject(ICoordTrans rp); |
112 |
|
113 |
/**
|
114 |
* Permite dibujar la Geometry.
|
115 |
* @param g, Graphics2D.
|
116 |
* @param vp, ViewPortData.
|
117 |
*/
|
118 |
public void draw(Graphics2D g, ViewPortData vp) { |
119 |
} |
120 |
} |