svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / layout / fframes / FFrameGraphics.java @ 4203
History | View | Annotate | Download (16.2 KB)
1 | 312 | fernando | /*
|
---|---|---|---|
2 | * Created on 22-jun-2004
|
||
3 | *
|
||
4 | */
|
||
5 | 1103 | fjp | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
6 | *
|
||
7 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
8 | *
|
||
9 | * This program is free software; you can redistribute it and/or
|
||
10 | * modify it under the terms of the GNU General Public License
|
||
11 | * as published by the Free Software Foundation; either version 2
|
||
12 | * of the License, or (at your option) any later version.
|
||
13 | *
|
||
14 | * This program is distributed in the hope that it will be useful,
|
||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
17 | * GNU General Public License for more details.
|
||
18 | *
|
||
19 | * You should have received a copy of the GNU General Public License
|
||
20 | * along with this program; if not, write to the Free Software
|
||
21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
22 | *
|
||
23 | * For more information, contact:
|
||
24 | *
|
||
25 | * Generalitat Valenciana
|
||
26 | * Conselleria d'Infraestructures i Transport
|
||
27 | * Av. Blasco Ib??ez, 50
|
||
28 | * 46010 VALENCIA
|
||
29 | * SPAIN
|
||
30 | *
|
||
31 | * +34 963862235
|
||
32 | * gvsig@gva.es
|
||
33 | * www.gvsig.gva.es
|
||
34 | *
|
||
35 | * or
|
||
36 | *
|
||
37 | * IVER T.I. S.A
|
||
38 | * Salamanca 50
|
||
39 | * 46005 Valencia
|
||
40 | * Spain
|
||
41 | *
|
||
42 | * +34 963163400
|
||
43 | * dac@iver.es
|
||
44 | */
|
||
45 | 312 | fernando | package com.iver.cit.gvsig.gui.layout.fframes; |
46 | |||
47 | 3679 | caballero | import java.awt.Color; |
48 | import java.awt.Graphics2D; |
||
49 | import java.awt.geom.AffineTransform; |
||
50 | import java.awt.geom.Point2D; |
||
51 | import java.awt.geom.Rectangle2D; |
||
52 | import java.awt.image.BufferedImage; |
||
53 | import java.util.BitSet; |
||
54 | 3553 | caballero | |
55 | 3679 | caballero | import com.iver.andami.PluginServices; |
56 | 1073 | vcaballero | import com.iver.cit.gvsig.fmap.DriverException; |
57 | 3553 | caballero | import com.iver.cit.gvsig.fmap.core.adapter.CircleAdapter; |
58 | import com.iver.cit.gvsig.fmap.core.adapter.GeometryAdapter; |
||
59 | import com.iver.cit.gvsig.fmap.core.adapter.PointAdapter; |
||
60 | import com.iver.cit.gvsig.fmap.core.adapter.PolyLineAdapter; |
||
61 | import com.iver.cit.gvsig.fmap.core.adapter.PolygonAdapter; |
||
62 | import com.iver.cit.gvsig.fmap.core.adapter.RectangleAdapter; |
||
63 | 1073 | vcaballero | import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
64 | import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
||
65 | 2745 | caballero | import com.iver.cit.gvsig.gui.layout.FLayoutUtilities; |
66 | 1073 | vcaballero | import com.iver.cit.gvsig.gui.layout.Layout; |
67 | 3185 | caballero | import com.iver.cit.gvsig.gui.project.SaveException; |
68 | 1073 | vcaballero | import com.iver.utiles.XMLEntity; |
69 | |||
70 | 312 | fernando | |
71 | /**
|
||
72 | * FFrame para contener un gr?fico.
|
||
73 | *
|
||
74 | * @author Vicente Caballero Navarro
|
||
75 | */
|
||
76 | 3610 | caballero | public class FFrameGraphics extends FFrame implements IFFrameEditable { |
77 | 3679 | caballero | private static double TOL = 0.2; |
78 | 3610 | caballero | private int m_type = FConstant.SHAPE_TYPE_POINT; |
79 | 2745 | caballero | private FSymbol m_symbol = null; |
80 | private Color m_color = null; |
||
81 | private AffineTransform mT = null; |
||
82 | 3553 | caballero | private GeometryAdapter geometry;
|
83 | private GeometryAdapter geometryEdit;
|
||
84 | 3610 | caballero | private boolean editing = false; |
85 | private double size = 0.5; |
||
86 | private BitSet index = new BitSet(); |
||
87 | |||
88 | /**
|
||
89 | * Crea un nuevo FFrameGraphics.
|
||
90 | */
|
||
91 | public FFrameGraphics() {
|
||
92 | mT = new AffineTransform(); |
||
93 | mT.setToIdentity(); |
||
94 | 2745 | caballero | } |
95 | 3610 | caballero | |
96 | /**
|
||
97 | * DOCUMENT ME!
|
||
98 | *
|
||
99 | * @param geom DOCUMENT ME!
|
||
100 | */
|
||
101 | public void setGeometryAdapter(GeometryAdapter geom) { |
||
102 | geometry = geom; |
||
103 | 3115 | caballero | } |
104 | 3553 | caballero | |
105 | 2745 | caballero | /**
|
106 | * Rellena el color que se utlizar? para dibujar el s?mbolo.
|
||
107 | *
|
||
108 | * @param color
|
||
109 | */
|
||
110 | public void setColor(Color color) { |
||
111 | m_color = color; |
||
112 | } |
||
113 | 312 | fernando | |
114 | 2745 | caballero | /**
|
115 | * Actualiza el Fsymbol a partir del tipo de Gr?fico que se pase como
|
||
116 | * par?metro.
|
||
117 | *
|
||
118 | * @param type tipo de gr?fico.
|
||
119 | * @param at Transformada.
|
||
120 | */
|
||
121 | public void update(int type, AffineTransform at) { |
||
122 | m_type = type; |
||
123 | 312 | fernando | |
124 | 2745 | caballero | //aT = at;
|
125 | if (m_color == null) { |
||
126 | 3679 | caballero | m_color = Color.black;
|
127 | 2745 | caballero | } |
128 | 1073 | vcaballero | |
129 | 2745 | caballero | switch (m_type) {
|
130 | case (Layout.POINT):
|
||
131 | m_symbol = new FSymbol(FConstant.SHAPE_TYPE_POINT, m_color);
|
||
132 | 3610 | caballero | m_symbol.setSize((int) FLayoutUtilities.fromSheetDistance(
|
133 | size, at)); |
||
134 | |||
135 | 2745 | caballero | break;
|
136 | 1073 | vcaballero | |
137 | 2745 | caballero | case (Layout.RECTANGLESIMPLE):
|
138 | m_symbol = new FSymbol(FConstant.SYMBOL_TYPE_FILL, m_color);
|
||
139 | m_symbol.setColor(null);
|
||
140 | 1073 | vcaballero | |
141 | 2745 | caballero | break;
|
142 | 1073 | vcaballero | |
143 | 2745 | caballero | case (Layout.LINE):
|
144 | m_symbol = new FSymbol(FConstant.SYMBOL_TYPE_LINE, m_color);
|
||
145 | 3610 | caballero | |
146 | 2745 | caballero | break;
|
147 | 1073 | vcaballero | |
148 | 2745 | caballero | case (Layout.POLYLINE):
|
149 | 3553 | caballero | m_symbol = new FSymbol(FConstant.SYMBOL_TYPE_LINE, m_color);
|
150 | 1073 | vcaballero | |
151 | 2745 | caballero | break;
|
152 | 1073 | vcaballero | |
153 | 2745 | caballero | case (Layout.POLYGON):
|
154 | 3610 | caballero | m_symbol = new FSymbol(FConstant.SYMBOL_TYPE_FILL, m_color);
|
155 | m_symbol.setStyle(FConstant.SYMBOL_STYLE_FILL_SOLID); |
||
156 | m_symbol.setOutlined(true);
|
||
157 | 3679 | caballero | m_symbol.setOutlineColor(m_color); |
158 | 3610 | caballero | m_symbol.setColor(null);
|
159 | 1073 | vcaballero | |
160 | 2745 | caballero | break;
|
161 | 1073 | vcaballero | |
162 | 2745 | caballero | case (Layout.CIRCLE):
|
163 | m_symbol = new FSymbol(FConstant.SYMBOL_TYPE_FILL, m_color);
|
||
164 | 3553 | caballero | m_symbol.setStyle(FConstant.SYMBOL_STYLE_FILL_SOLID); |
165 | 2745 | caballero | m_symbol.setOutlined(true);
|
166 | 3679 | caballero | m_symbol.setOutlineColor(m_color); |
167 | 2745 | caballero | m_symbol.setColor(null);
|
168 | 312 | fernando | |
169 | 2745 | caballero | break;
|
170 | } |
||
171 | } |
||
172 | 312 | fernando | |
173 | 2745 | caballero | /**
|
174 | * Devuelve el FSymbol que se representa.
|
||
175 | *
|
||
176 | * @return DOCUMENT ME!
|
||
177 | */
|
||
178 | public FSymbol getFSymbol() {
|
||
179 | return m_symbol;
|
||
180 | } |
||
181 | 312 | fernando | |
182 | 2745 | caballero | /**
|
183 | * Rellena el FSymbol que se representara al dibujar.
|
||
184 | *
|
||
185 | * @param symbol
|
||
186 | */
|
||
187 | public void setFSymbol(FSymbol symbol) { |
||
188 | m_symbol = symbol; |
||
189 | } |
||
190 | 312 | fernando | |
191 | 2745 | caballero | /**
|
192 | * M?todo que dibuja sobre el graphics que se le pasa como par?metro, seg?n
|
||
193 | * la transformada afin que se debe de aplicar y el rect?ngulo que se debe
|
||
194 | * de dibujar.
|
||
195 | *
|
||
196 | * @param g Graphics
|
||
197 | * @param at Transformada afin.
|
||
198 | * @param rv rect?ngulo sobre el que hacer un clip.
|
||
199 | * @param imgBase DOCUMENT ME!
|
||
200 | */
|
||
201 | public void draw(Graphics2D g, AffineTransform at, Rectangle2D rv, |
||
202 | BufferedImage imgBase) {
|
||
203 | Rectangle2D.Double rect = getBoundingBox(at);
|
||
204 | g.rotate(Math.toRadians(getRotation()), rect.x + (rect.width / 2), |
||
205 | rect.y + (rect.height / 2));
|
||
206 | 1073 | vcaballero | |
207 | 2745 | caballero | if (intersects(rv, rect)) {
|
208 | g.setColor(Color.black);
|
||
209 | 3610 | caballero | |
210 | if (m_type == Layout.POINT) {
|
||
211 | m_symbol.setSize((int) (rect.getWidth() * 0.7)); |
||
212 | } |
||
213 | |||
214 | geometry.draw(g, at, m_symbol); |
||
215 | 4203 | caballero | |
216 | 3610 | caballero | if (editing) {
|
217 | 3679 | caballero | g.setColor(Color.red);
|
218 | geometry.drawVertex(g, at); |
||
219 | 3610 | caballero | } |
220 | 2745 | caballero | } |
221 | 398 | vcaballero | |
222 | 2745 | caballero | g.rotate(Math.toRadians(-getRotation()), rect.x + (rect.width / 2), |
223 | rect.y + (rect.height / 2));
|
||
224 | } |
||
225 | 2183 | fernando | |
226 | 2745 | caballero | /**
|
227 | * @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#getXMLEntity()
|
||
228 | */
|
||
229 | 3610 | caballero | public XMLEntity getXMLEntity() throws SaveException { |
230 | XMLEntity xml = super.getXMLEntity();
|
||
231 | |||
232 | try {
|
||
233 | xml.putProperty("type", Layout.GRAPHICS);
|
||
234 | xml.putProperty("m_type", m_type);
|
||
235 | xml.addChild(m_symbol.getXMLEntity()); |
||
236 | xml.addChild(geometry.getXMLEntity()); |
||
237 | } catch (Exception e) { |
||
238 | throw new SaveException(e, this.getClass().getName()); |
||
239 | } |
||
240 | |||
241 | 2745 | caballero | return xml;
|
242 | } |
||
243 | |||
244 | /**
|
||
245 | * @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#updateNum()
|
||
246 | */
|
||
247 | public void updateNum() { |
||
248 | } |
||
249 | |||
250 | /**
|
||
251 | * @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#getNum()
|
||
252 | */
|
||
253 | public int getNum() { |
||
254 | return 0; |
||
255 | } |
||
256 | |||
257 | /**
|
||
258 | * @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#setXMLEntity(com.iver.utiles.XMLEntity,
|
||
259 | * com.iver.cit.gvsig.project.Project)
|
||
260 | */
|
||
261 | 3135 | caballero | public void setXMLEntity(XMLEntity xml) { |
262 | 2745 | caballero | m_Selected = xml.getIntProperty("m_Selected");
|
263 | m_type = xml.getIntProperty("m_type");
|
||
264 | setRotation(xml.getDoubleProperty("m_rotation"));
|
||
265 | m_symbol = FSymbol.createFromXML(xml.getChild(0));
|
||
266 | 3610 | caballero | |
267 | if (xml.getChild(1) == null) { |
||
268 | Rectangle2D r = (Rectangle2D) getBoundBox().clone(); |
||
269 | |||
270 | 3553 | caballero | if (m_type == Layout.LINE) {
|
271 | 3610 | caballero | geometry = new PolyLineAdapter();
|
272 | 3553 | caballero | } else if (m_type == Layout.RECTANGLESIMPLE) { |
273 | 3610 | caballero | geometry = new RectangleAdapter();
|
274 | geometry.addPoint(new Point2D.Double(r.getX(), r.getY())); |
||
275 | geometry.addPoint(new Point2D.Double(r.getMaxX(), r.getMaxY())); |
||
276 | 3553 | caballero | } else if (m_type == Layout.POLYLINE) { |
277 | 3610 | caballero | geometry = new PolyLineAdapter();
|
278 | 3553 | caballero | } else if (m_type == Layout.POLYGON) { |
279 | 3610 | caballero | geometry = new PolygonAdapter();
|
280 | 3553 | caballero | } else if (m_type == Layout.CIRCLE) { |
281 | 3610 | caballero | geometry = new CircleAdapter();
|
282 | geometry.addPoint(new Point2D.Double(r.getCenterX(), |
||
283 | r.getCenterY())); |
||
284 | |||
285 | if (r.getWidth() < r.getHeight()) {
|
||
286 | geometry.addPoint(new Point2D.Double(r.getMaxX(), |
||
287 | r.getCenterY())); |
||
288 | } else {
|
||
289 | geometry.addPoint(new Point2D.Double(r.getCenterX(), |
||
290 | r.getY())); |
||
291 | } |
||
292 | 3553 | caballero | } else if (m_type == Layout.POINT) { |
293 | 3610 | caballero | geometry = new PointAdapter();
|
294 | geometry.addPoint(new Point2D.Double(r.getCenterX(), |
||
295 | r.getCenterY())); |
||
296 | } |
||
297 | |||
298 | 3553 | caballero | geometry.end(); |
299 | 3610 | caballero | } else {
|
300 | geometry = GeometryAdapter.createFromXML(xml.getChild(1));
|
||
301 | 3553 | caballero | } |
302 | 2745 | caballero | } |
303 | |||
304 | /**
|
||
305 | * @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#setXMLEntity(com.iver.utiles.XMLEntity,
|
||
306 | * com.iver.cit.gvsig.project.Project)
|
||
307 | */
|
||
308 | 3610 | caballero | public void setXMLEntity03(XMLEntity xml, Layout p) { |
309 | 2745 | caballero | m_Selected = xml.getIntProperty("m_Selected");
|
310 | m_type = xml.getIntProperty("m_type");
|
||
311 | m_symbol = FSymbol.createFromXML03(xml.getChild(0));
|
||
312 | 3610 | caballero | |
313 | Rectangle2D r = (Rectangle2D) getBoundBox().clone(); |
||
314 | |||
315 | 3553 | caballero | if (m_type == Layout.LINE) {
|
316 | 3610 | caballero | geometry = new PolyLineAdapter();
|
317 | 3553 | caballero | } else if (m_type == Layout.RECTANGLESIMPLE) { |
318 | 3610 | caballero | geometry = new RectangleAdapter();
|
319 | geometry.addPoint(new Point2D.Double(r.getX(), r.getY())); |
||
320 | geometry.addPoint(new Point2D.Double(r.getMaxX(), r.getMaxY())); |
||
321 | 3553 | caballero | } else if (m_type == Layout.POLYLINE) { |
322 | 3610 | caballero | geometry = new PolyLineAdapter();
|
323 | 3553 | caballero | } else if (m_type == Layout.POLYGON) { |
324 | 3610 | caballero | geometry = new PolygonAdapter();
|
325 | 3553 | caballero | } else if (m_type == Layout.CIRCLE) { |
326 | 3610 | caballero | geometry = new CircleAdapter();
|
327 | geometry.addPoint(new Point2D.Double(r.getCenterX(), r.getCenterY())); |
||
328 | |||
329 | if (r.getWidth() < r.getHeight()) {
|
||
330 | geometry.addPoint(new Point2D.Double(r.getMaxX(), r.getCenterY())); |
||
331 | } else {
|
||
332 | geometry.addPoint(new Point2D.Double(r.getCenterX(), r.getY())); |
||
333 | } |
||
334 | 3553 | caballero | } else if (m_type == Layout.POINT) { |
335 | 3610 | caballero | geometry = new PointAdapter();
|
336 | geometry.addPoint(new Point2D.Double(r.getCenterX(), r.getCenterY())); |
||
337 | } |
||
338 | |||
339 | 3553 | caballero | geometry.end(); |
340 | 2745 | caballero | } |
341 | |||
342 | /**
|
||
343 | * @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#getNameFFrame()
|
||
344 | */
|
||
345 | public String getNameFFrame() { |
||
346 | return PluginServices.getText(this, "Gr?ficos") + num; |
||
347 | } |
||
348 | |||
349 | /**
|
||
350 | * @see com.iver.cit.gvsig.gui.layout.fframes.IFFrame#print(java.awt.Graphics2D,
|
||
351 | * java.awt.geom.AffineTransform)
|
||
352 | */
|
||
353 | public void print(Graphics2D g, AffineTransform at) |
||
354 | throws DriverException {
|
||
355 | draw(g, at, null, null); |
||
356 | } |
||
357 | |||
358 | /**
|
||
359 | * Inserta el tama?o del punto.
|
||
360 | *
|
||
361 | * @param size entero que representa el tama?o del punto.
|
||
362 | */
|
||
363 | 3553 | caballero | public void setSize(double size) { |
364 | 3610 | caballero | this.size = size;
|
365 | |||
366 | 3679 | caballero | Rectangle2D r = geometry.getBounds2D();
|
367 | 3610 | caballero | super.setBoundBox(new Rectangle2D.Double(r.getX() - size, |
368 | r.getY() - size, size * 2, size * 2)); |
||
369 | 2745 | caballero | } |
370 | 2847 | caballero | |
371 | /**
|
||
372 | * Devuelve el tipo de gr?fico que contiene el fframe.
|
||
373 | *
|
||
374 | * @return tipo de
|
||
375 | */
|
||
376 | public int getType() { |
||
377 | return m_type;
|
||
378 | } |
||
379 | 3610 | caballero | |
380 | /**
|
||
381 | * DOCUMENT ME!
|
||
382 | *
|
||
383 | * @param r DOCUMENT ME!
|
||
384 | */
|
||
385 | 3553 | caballero | public void setBoundBox(Rectangle2D r) { |
386 | 3610 | caballero | AffineTransform aT = new AffineTransform(); |
387 | |||
388 | if (getBoundBox().getWidth() != 0) { |
||
389 | double w = r.getWidth() / getBoundBox().getWidth();
|
||
390 | double h = r.getHeight() / getBoundBox().getHeight();
|
||
391 | AffineTransform trans2 = AffineTransform.getTranslateInstance(r.getX(), |
||
392 | r.getY()); |
||
393 | aT.concatenate(trans2); |
||
394 | |||
395 | AffineTransform scale1 = AffineTransform.getScaleInstance(w, h); |
||
396 | aT.concatenate(scale1); |
||
397 | |||
398 | AffineTransform trans1 = AffineTransform.getTranslateInstance(-getBoundBox() |
||
399 | .getX(), |
||
400 | -getBoundBox().getY()); |
||
401 | aT.concatenate(trans1); |
||
402 | geometry.applyTransform(aT); |
||
403 | size = aT.getScaleX() * size; |
||
404 | } |
||
405 | |||
406 | super.setBoundBox(r);
|
||
407 | 3553 | caballero | } |
408 | |||
409 | 3610 | caballero | /**
|
410 | * DOCUMENT ME!
|
||
411 | */
|
||
412 | public void startEditing() { |
||
413 | editing = true;
|
||
414 | } |
||
415 | 3553 | caballero | |
416 | 3610 | caballero | /**
|
417 | * DOCUMENT ME!
|
||
418 | */
|
||
419 | public void stopEditing() { |
||
420 | editing = false;
|
||
421 | } |
||
422 | |||
423 | /**
|
||
424 | * DOCUMENT ME!
|
||
425 | *
|
||
426 | * @return DOCUMENT ME!
|
||
427 | */
|
||
428 | public boolean isEditing() { |
||
429 | return editing;
|
||
430 | } |
||
431 | |||
432 | /**
|
||
433 | * DOCUMENT ME!
|
||
434 | *
|
||
435 | * @param point DOCUMENT ME!
|
||
436 | * @param geom DOCUMENT ME!
|
||
437 | */
|
||
438 | public void pointReleased(Point2D point, GeometryAdapter geom) { |
||
439 | index.clear(); |
||
440 | geometry = geom; |
||
441 | |||
442 | 3679 | caballero | Rectangle2D r = geometry.getBounds2D();
|
443 | 3610 | caballero | super.setBoundBox(r);
|
444 | } |
||
445 | |||
446 | /**
|
||
447 | * DOCUMENT ME!
|
||
448 | *
|
||
449 | * @param point DOCUMENT ME!
|
||
450 | */
|
||
451 | public void pointPressed(Point2D point) { |
||
452 | Rectangle2D.Double rect = getBoundBox();
|
||
453 | Point2D[] points = geometry.getPoints(); |
||
454 | 3679 | caballero | geometryEdit = geometry.cloneAdapter();//GeometryAdapter.createFromXML(geometry.getXMLEntity());
|
455 | 3610 | caballero | |
456 | Point2D pAux1 = new Point2D.Double(); |
||
457 | |||
458 | for (int i = 0; i < points.length; i++) { |
||
459 | if (getRotation() != 0) { |
||
460 | AffineTransform af = AffineTransform.getRotateInstance(Math.toRadians( |
||
461 | -getRotation()), rect.x + (rect.width / 2),
|
||
462 | rect.y + (rect.height / 2));
|
||
463 | af.transform(point, pAux1); |
||
464 | |||
465 | if (points[i].distance(pAux1) <= TOL) {
|
||
466 | index.set(i); |
||
467 | } |
||
468 | } else {
|
||
469 | if (points[i].distance(point) <= TOL) {
|
||
470 | index.set(i); |
||
471 | } |
||
472 | } |
||
473 | } |
||
474 | } |
||
475 | |||
476 | /**
|
||
477 | * DOCUMENT ME!
|
||
478 | *
|
||
479 | * @param point DOCUMENT ME!
|
||
480 | */
|
||
481 | public void pointDragged(Point2D point) { |
||
482 | Point2D[] points = geometry.getPoints(); |
||
483 | |||
484 | for (int j = index.nextSetBit(0); j >= 0; |
||
485 | j = index.nextSetBit(j + 1)) {
|
||
486 | if (getRotation() != 0) { |
||
487 | Rectangle2D.Double rect = getBoundBox();
|
||
488 | AffineTransform af = AffineTransform.getRotateInstance(Math.toRadians( |
||
489 | -getRotation()), rect.x + (rect.width / 2),
|
||
490 | rect.y + (rect.height / 2));
|
||
491 | af.transform(point, point); |
||
492 | } |
||
493 | |||
494 | points[j] = new Point2D.Double(point.getX(), point.getY()); |
||
495 | 3679 | caballero | geometryEdit.changePoint(j,points[j]); |
496 | 3610 | caballero | } |
497 | 3679 | caballero | //geometryEdit.setPoints(points);
|
498 | 3610 | caballero | geometryEdit.end(); |
499 | } |
||
500 | |||
501 | /**
|
||
502 | * DOCUMENT ME!
|
||
503 | *
|
||
504 | * @param g DOCUMENT ME!
|
||
505 | * @param at DOCUMENT ME!
|
||
506 | */
|
||
507 | public void paint(Graphics2D g, AffineTransform at) { |
||
508 | if (geometryEdit != null) { |
||
509 | Rectangle2D.Double rect = getBoundingBox(at);
|
||
510 | 3679 | caballero | if (getRotation()!=0){ |
511 | 3610 | caballero | g.rotate(Math.toRadians(getRotation()), rect.x + (rect.width / 2), |
512 | rect.y + (rect.height / 2));
|
||
513 | 3679 | caballero | geometryEdit.paint(g,at,false);
|
514 | /* FShape m_shape = null;
|
||
515 | 3610 | caballero | GeneralPathX polyLine = new GeneralPathX(geometryEdit.getShape());
|
516 | polyLine.transform(at);
|
||
517 | m_shape = new FPolyline2D(polyLine);
|
||
518 | FGraphicUtilities.DrawShape(g, mT, m_shape, m_symbol);
|
||
519 | 3679 | caballero | */
|
520 | 3610 | caballero | g.rotate(Math.toRadians(-getRotation()), rect.x + (rect.width / 2), |
521 | rect.y + (rect.height / 2));
|
||
522 | 3679 | caballero | }else{
|
523 | geometryEdit.paint(g,at,false);
|
||
524 | } |
||
525 | 3610 | caballero | } |
526 | } |
||
527 | |||
528 | /**
|
||
529 | * DOCUMENT ME!
|
||
530 | *
|
||
531 | * @return DOCUMENT ME!
|
||
532 | */
|
||
533 | public GeometryAdapter getGeometry() {
|
||
534 | return geometryEdit;
|
||
535 | } |
||
536 | 4203 | caballero | |
537 | public void initialize() { |
||
538 | // TODO Auto-generated method stub
|
||
539 | |||
540 | } |
||
541 | 312 | fernando | } |