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