root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / FMultiPoint2D.java @ 1132
History | View | Annotate | Download (4.8 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package com.iver.cit.gvsig.fmap.core; |
42 |
|
43 |
import com.iver.cit.gvsig.fmap.ViewPort; |
44 |
import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
45 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
46 |
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D; |
47 |
|
48 |
import com.vividsolutions.jts.geom.Geometry; |
49 |
|
50 |
import org.cresques.cts.ICoordTrans; |
51 |
|
52 |
import java.awt.Color; |
53 |
import java.awt.Graphics2D; |
54 |
import java.awt.geom.Rectangle2D; |
55 |
|
56 |
|
57 |
/**
|
58 |
* Multipunto 2D.
|
59 |
*
|
60 |
* @author Vicente Caballero Navarro
|
61 |
*/
|
62 |
public class FMultiPoint2D implements IGeometry { |
63 |
double[] x = null; |
64 |
double[] y = null; |
65 |
|
66 |
/**
|
67 |
* Crea un nuevo MultiPoint2D.
|
68 |
*
|
69 |
* @param x DOCUMENT ME!
|
70 |
* @param y DOCUMENT ME!
|
71 |
*/
|
72 |
public FMultiPoint2D(double[] x, double[] y) { |
73 |
this.x = x;
|
74 |
this.y = y;
|
75 |
} |
76 |
public FMultiPoint2D(FPoint2D[] points) { |
77 |
double[] auxX=new double[points.length]; |
78 |
double[] auxY=new double[points.length]; |
79 |
for (int i=0;i<points.length;i++){ |
80 |
auxX[i]=points[i].getX(); |
81 |
auxY[i]=points[i].getY(); |
82 |
} |
83 |
} |
84 |
/**
|
85 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#draw(java.awt.Graphics2D,
|
86 |
* ViewPort, FStyle2D)
|
87 |
*/
|
88 |
public void draw(Graphics2D g, ViewPort vp, FStyle2D symbol) { |
89 |
int size = 2; |
90 |
int hw = 4; |
91 |
|
92 |
for (int i = 0; i < x.length; i++) { |
93 |
java.awt.geom.Point2D.Double p = new java.awt.geom.Point2D.Double(x[i],
|
94 |
y[i]); |
95 |
vp.getAffineTransform().transform(p, p); |
96 |
g.setColor(Color.red);
|
97 |
g.fillOval((int) p.x - size, (int) p.y - size, (int) hw, (int) hw); |
98 |
g.setColor(Color.black);
|
99 |
g.drawOval((int) p.x - size, (int) p.y - size, (int) hw, (int) hw); |
100 |
} |
101 |
} |
102 |
|
103 |
/**
|
104 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#toJTSGeometry()
|
105 |
*/
|
106 |
public Geometry toJTSGeometry() {
|
107 |
return null; |
108 |
} |
109 |
|
110 |
/**
|
111 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#createLabels(int, boolean)
|
112 |
*/
|
113 |
public FLabel[] createLabels(int position, boolean duplicates) { |
114 |
return null; |
115 |
} |
116 |
|
117 |
/* (non-Javadoc)
|
118 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#intersects(java.awt.geom.Rectangle2D)
|
119 |
*/
|
120 |
public boolean intersects(Rectangle2D r) { |
121 |
// TODO Auto-generated method stub
|
122 |
return false; |
123 |
} |
124 |
|
125 |
/* (non-Javadoc)
|
126 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#getBounds2D()
|
127 |
*/
|
128 |
public Rectangle2D getBounds2D() { |
129 |
// TODO Auto-generated method stub
|
130 |
return null; |
131 |
} |
132 |
|
133 |
/**
|
134 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#getGeometryType()
|
135 |
*/
|
136 |
public int getGeometryType() { |
137 |
return FShape.POINT;
|
138 |
} |
139 |
|
140 |
/* (non-Javadoc)
|
141 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#draw(java.awt.Graphics2D, com.iver.cit.gvsig.fmap.ViewPort, com.iver.cit.gvsig.fmap.core.v02.FSymbol)
|
142 |
*/
|
143 |
public void draw(Graphics2D g, ViewPort vp, FSymbol symbol) { |
144 |
int size = 2; |
145 |
int hw = 4; |
146 |
|
147 |
for (int i = 0; i < x.length; i++) { |
148 |
java.awt.geom.Point2D.Double p = new java.awt.geom.Point2D.Double(x[i],
|
149 |
y[i]); |
150 |
vp.getAffineTransform().transform(p, p); |
151 |
g.setColor(Color.red);
|
152 |
g.fillOval((int) p.x - size, (int) p.y - size, (int) hw, (int) hw); |
153 |
g.setColor(Color.black);
|
154 |
g.drawOval((int) p.x - size, (int) p.y - size, (int) hw, (int) hw); |
155 |
} |
156 |
} |
157 |
|
158 |
/* (non-Javadoc)
|
159 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#cloneGeometry()
|
160 |
*/
|
161 |
public IGeometry cloneGeometry() {
|
162 |
// TODO Auto-generated method stub
|
163 |
return null; |
164 |
} |
165 |
|
166 |
/* (non-Javadoc)
|
167 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#reProject(org.cresques.cts.ICoordTrans)
|
168 |
*/
|
169 |
public void reProject(ICoordTrans ct) { |
170 |
// TODO Auto-generated method stub
|
171 |
} |
172 |
public int getNumPoints(){ |
173 |
return x.length;
|
174 |
} |
175 |
public FPoint2D getPoint(int i){ |
176 |
return new FPoint2D(x[i],y[i]); |
177 |
} |
178 |
/**
|
179 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#getGeneralPathXIterator()
|
180 |
*/
|
181 |
public GeneralPathXIterator getGeneralPathXIterator() {
|
182 |
//TODO no est? implementado.
|
183 |
return null; |
184 |
} |
185 |
} |