root / branches / pilotoDWG / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / FMultiPoint2D.java @ 1532
History | View | Annotate | Download (5.65 KB)
1 | 1100 | fjp | /* 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 | 262 | fjp | package com.iver.cit.gvsig.fmap.core; |
42 | |||
43 | import com.iver.cit.gvsig.fmap.ViewPort; |
||
44 | 757 | fjp | import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
45 | 458 | fjp | import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
46 | 324 | fernando | import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D; |
47 | 1005 | vcaballero | |
48 | 703 | fjp | import com.vividsolutions.jts.geom.Geometry; |
49 | 262 | fjp | |
50 | 1005 | vcaballero | import org.cresques.cts.ICoordTrans; |
51 | 262 | fjp | |
52 | 1005 | vcaballero | import java.awt.Color; |
53 | import java.awt.Graphics2D; |
||
54 | 1440 | vcaballero | import java.awt.geom.Point2D; |
55 | 1005 | vcaballero | import java.awt.geom.Rectangle2D; |
56 | |||
57 | |||
58 | 262 | fjp | /**
|
59 | * Multipunto 2D.
|
||
60 | *
|
||
61 | * @author Vicente Caballero Navarro
|
||
62 | */
|
||
63 | 305 | fjp | public class FMultiPoint2D implements IGeometry { |
64 | 1005 | vcaballero | double[] x = null; |
65 | double[] y = null; |
||
66 | 262 | fjp | |
67 | 1005 | vcaballero | /**
|
68 | * Crea un nuevo MultiPoint2D.
|
||
69 | *
|
||
70 | * @param x DOCUMENT ME!
|
||
71 | * @param y DOCUMENT ME!
|
||
72 | */
|
||
73 | public FMultiPoint2D(double[] x, double[] y) { |
||
74 | this.x = x;
|
||
75 | this.y = y;
|
||
76 | } |
||
77 | 1132 | vcaballero | public FMultiPoint2D(FPoint2D[] points) { |
78 | double[] auxX=new double[points.length]; |
||
79 | double[] auxY=new double[points.length]; |
||
80 | for (int i=0;i<points.length;i++){ |
||
81 | auxX[i]=points[i].getX(); |
||
82 | auxY[i]=points[i].getY(); |
||
83 | } |
||
84 | } |
||
85 | 1005 | vcaballero | /**
|
86 | * @see com.iver.cit.gvsig.fmap.core.IGeometry#draw(java.awt.Graphics2D,
|
||
87 | * ViewPort, FStyle2D)
|
||
88 | */
|
||
89 | public void draw(Graphics2D g, ViewPort vp, FStyle2D symbol) { |
||
90 | int size = 2; |
||
91 | int hw = 4; |
||
92 | 262 | fjp | |
93 | 1005 | vcaballero | for (int i = 0; i < x.length; i++) { |
94 | java.awt.geom.Point2D.Double p = new java.awt.geom.Point2D.Double(x[i],
|
||
95 | y[i]); |
||
96 | vp.getAffineTransform().transform(p, p); |
||
97 | g.setColor(Color.red);
|
||
98 | g.fillOval((int) p.x - size, (int) p.y - size, (int) hw, (int) hw); |
||
99 | g.setColor(Color.black);
|
||
100 | g.drawOval((int) p.x - size, (int) p.y - size, (int) hw, (int) hw); |
||
101 | } |
||
102 | } |
||
103 | 262 | fjp | |
104 | 1005 | vcaballero | /**
|
105 | * @see com.iver.cit.gvsig.fmap.core.IGeometry#toJTSGeometry()
|
||
106 | */
|
||
107 | public Geometry toJTSGeometry() {
|
||
108 | return null; |
||
109 | } |
||
110 | 267 | fjp | |
111 | 1005 | vcaballero | /**
|
112 | * @see com.iver.cit.gvsig.fmap.core.IGeometry#createLabels(int, boolean)
|
||
113 | */
|
||
114 | public FLabel[] createLabels(int position, boolean duplicates) { |
||
115 | return null; |
||
116 | } |
||
117 | |||
118 | 267 | fjp | /* (non-Javadoc)
|
119 | 305 | fjp | * @see com.iver.cit.gvsig.fmap.core.IGeometry#intersects(java.awt.geom.Rectangle2D)
|
120 | 267 | fjp | */
|
121 | public boolean intersects(Rectangle2D r) { |
||
122 | // TODO Auto-generated method stub
|
||
123 | return false; |
||
124 | } |
||
125 | |||
126 | /* (non-Javadoc)
|
||
127 | 305 | fjp | * @see com.iver.cit.gvsig.fmap.core.IGeometry#getBounds2D()
|
128 | 267 | fjp | */
|
129 | public Rectangle2D getBounds2D() { |
||
130 | // TODO Auto-generated method stub
|
||
131 | return null; |
||
132 | } |
||
133 | 324 | fernando | |
134 | /**
|
||
135 | * @see com.iver.cit.gvsig.fmap.core.IGeometry#getGeometryType()
|
||
136 | */
|
||
137 | public int getGeometryType() { |
||
138 | return FShape.POINT;
|
||
139 | } |
||
140 | 458 | fjp | |
141 | /* (non-Javadoc)
|
||
142 | * @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)
|
||
143 | */
|
||
144 | public void draw(Graphics2D g, ViewPort vp, FSymbol symbol) { |
||
145 | 1005 | vcaballero | int size = 2; |
146 | int hw = 4; |
||
147 | |||
148 | for (int i = 0; i < x.length; i++) { |
||
149 | java.awt.geom.Point2D.Double p = new java.awt.geom.Point2D.Double(x[i],
|
||
150 | y[i]); |
||
151 | vp.getAffineTransform().transform(p, p); |
||
152 | g.setColor(Color.red);
|
||
153 | g.fillOval((int) p.x - size, (int) p.y - size, (int) hw, (int) hw); |
||
154 | g.setColor(Color.black);
|
||
155 | g.drawOval((int) p.x - size, (int) p.y - size, (int) hw, (int) hw); |
||
156 | } |
||
157 | 458 | fjp | } |
158 | 703 | fjp | |
159 | /* (non-Javadoc)
|
||
160 | * @see com.iver.cit.gvsig.fmap.core.IGeometry#cloneGeometry()
|
||
161 | */
|
||
162 | public IGeometry cloneGeometry() {
|
||
163 | // TODO Auto-generated method stub
|
||
164 | return null; |
||
165 | } |
||
166 | 885 | fjp | |
167 | /* (non-Javadoc)
|
||
168 | * @see com.iver.cit.gvsig.fmap.core.IGeometry#reProject(org.cresques.cts.ICoordTrans)
|
||
169 | */
|
||
170 | public void reProject(ICoordTrans ct) { |
||
171 | // TODO Auto-generated method stub
|
||
172 | } |
||
173 | 1132 | vcaballero | public int getNumPoints(){ |
174 | return x.length;
|
||
175 | } |
||
176 | public FPoint2D getPoint(int i){ |
||
177 | return new FPoint2D(x[i],y[i]); |
||
178 | } |
||
179 | /**
|
||
180 | * @see com.iver.cit.gvsig.fmap.core.IGeometry#getGeneralPathXIterator()
|
||
181 | */
|
||
182 | public GeneralPathXIterator getGeneralPathXIterator() {
|
||
183 | //TODO no est? implementado.
|
||
184 | return null; |
||
185 | } |
||
186 | 1298 | fjp | /* (non-Javadoc)
|
187 | * @see com.iver.cit.gvsig.fmap.core.IGeometry#fastIntersects(double, double, double, double)
|
||
188 | */
|
||
189 | public boolean fastIntersects(double x, double y, double w, double h) { |
||
190 | // TODO Auto-generated method stub
|
||
191 | return false; |
||
192 | } |
||
193 | 1404 | vcaballero | /**
|
194 | * @see com.iver.cit.gvsig.fmap.core.IGeometry#move(double, double)
|
||
195 | */
|
||
196 | public void move(double x, double y) { |
||
197 | } |
||
198 | 1408 | vcaballero | /**
|
199 | * @see com.iver.cit.gvsig.fmap.core.IGeometry#rotate(double, double, double)
|
||
200 | */
|
||
201 | public void rotate(double r, double x, double y) { |
||
202 | } |
||
203 | 1433 | vcaballero | /**
|
204 | * @see com.iver.cit.gvsig.fmap.core.IGeometry#getHandlers()
|
||
205 | */
|
||
206 | 1532 | vcaballero | public Handler[] getHandlers(int type) { |
207 | 1433 | vcaballero | return null; |
208 | } |
||
209 | 1440 | vcaballero | /**
|
210 | * @see com.iver.cit.gvsig.fmap.core.IGeometry#scale(java.awt.geom.Point2D, double, double)
|
||
211 | */
|
||
212 | public void scale(Point2D point, double x, double y) { |
||
213 | } |
||
214 | 262 | fjp | } |