Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / layout / fframes / FFrameGraphics.java @ 23074

History | View | Annotate | Download (22.9 KB)

1
/*
2
 * Created on 22-jun-2004
3
 *
4
 */
5
/* 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
package com.iver.cit.gvsig.project.documents.layout.fframes;
46

    
47
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

    
55
import javax.print.attribute.PrintRequestAttributeSet;
56

    
57
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
58
import com.iver.andami.PluginServices;
59
import com.iver.cit.gvsig.fmap.core.FShape;
60
import com.iver.cit.gvsig.fmap.core.SymbologyFactory;
61
import com.iver.cit.gvsig.fmap.core.adapter.CircleAdapter;
62
import com.iver.cit.gvsig.fmap.core.adapter.GeometryAdapter;
63
import com.iver.cit.gvsig.fmap.core.adapter.PointAdapter;
64
import com.iver.cit.gvsig.fmap.core.adapter.PolyLineAdapter;
65
import com.iver.cit.gvsig.fmap.core.adapter.PolygonAdapter;
66
import com.iver.cit.gvsig.fmap.core.adapter.RectangleAdapter;
67
import com.iver.cit.gvsig.fmap.core.symbols.IMarkerSymbol;
68
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol;
69
import com.iver.cit.gvsig.fmap.core.symbols.SimpleFillSymbol;
70
import com.iver.cit.gvsig.project.documents.exceptions.SaveException;
71
import com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.FFrameGraphicsDialog;
72
import com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.IFFrameDialog;
73
import com.iver.cit.gvsig.project.documents.layout.gui.Layout;
74
import com.iver.utiles.XMLEntity;
75

    
76

    
77
/**
78
 * FFrame para contener un gr?fico.
79
 *
80
 * @author Vicente Caballero Navarro
81
 */
82
public class FFrameGraphics extends FFrame implements IFFrameEditableVertex {
83
    private static double TOL = 0.2;
84
    public static final int POINT = 21;
85
    public static final int LINE = 22;
86
    public static final int POLYLINE = 23;
87
    public static final int RECTANGLE = 24;
88
    public static final int CIRCLE = 25;
89
    public static final int POLYGON = 26;
90
    public static final int RECTANGLEGROUP = 16;
91
    public static final int RECTANGLESYMBOL = 17;
92
    private int m_type = POINT;
93
    private ISymbol m_symbol = null;
94
    private Color m_color = null;
95
    private GeometryAdapter geometry;
96
    private GeometryAdapter geometryEdit;
97
    private boolean editing = false;
98
    private double size = 0.5;
99
    private BitSet index = new BitSet();
100

    
101
    /**
102
     * Crea un nuevo FFrameGraphics.
103
     */
104
    public FFrameGraphics() {
105
    }
106

    
107
    /**
108
     * DOCUMENT ME!
109
     *
110
     * @param geom DOCUMENT ME!
111
     */
112
    public void setGeometryAdapter(GeometryAdapter geom) {
113
        geometry = geom;
114
    }
115

    
116
    /**
117
     * Rellena el color que se utlizar? para dibujar el s?mbolo.
118
     *
119
     * @param color
120
     */
121
    public void setColor(Color color) {
122
        m_color = color;
123
    }
124

    
125
    /**
126
     * Actualiza el Fsymbol a partir del tipo de Gr?fico que se pase como
127
     * par?metro.
128
     *
129
     * @param type tipo de gr?fico.
130
     * @param at Transformada.
131
     */
132
    public void update(int type, AffineTransform at) {
133
        m_type = type;
134

    
135
        //aT = at;
136
        if (m_color == null) {
137
            m_color = Color.black;
138
        }
139
        int shapeType = -1;
140
        /*
141
         * (jaume) moved to ISymbol
142
         * switch (m_type) {
143
            case (POINT):
144

145
                    FSymbol symbolPoint= new FSymbol(FConstant.SHAPE_TYPE_POINT, m_color);
146
                       symbolPoint.setSize((int) FLayoutUtilities.fromSheetDistance(
147
                        size, at));
148
                       m_symbol=symbolPoint;
149
                break;
150

151
            case (RECTANGLE):
152
                    FSymbol symbolRectangle= new FSymbol(FConstant.SYMBOL_TYPE_FILL, m_color);
153
                symbolRectangle.setColor(null);
154
                m_symbol=symbolRectangle;
155
                break;
156

157
            case (LINE):
158
                    FSymbol symbolLine= new FSymbol(FConstant.SYMBOL_TYPE_LINE, m_color);
159
                    m_symbol=symbolLine;
160
                break;
161

162
            case (POLYLINE):
163
                    FSymbol symbolPolyline= new FSymbol(FConstant.SYMBOL_TYPE_LINE, m_color);
164
                    m_symbol=symbolPolyline;
165
                break;
166

167
            case (POLYGON):
168
                    FSymbol symbolPolygon= new FSymbol(FConstant.SYMBOL_TYPE_FILL, m_color);
169
                symbolPolygon.setStyle(FConstant.SYMBOL_STYLE_FILL_SOLID);
170
                symbolPolygon.setOutlined(true);
171
                symbolPolygon.setOutlineColor(m_color);
172
                symbolPolygon.setColor(null);
173
                m_symbol=symbolPolygon;
174
                break;
175

176
            case (CIRCLE):
177
                    FSymbol symbolCircle= new FSymbol(FConstant.SYMBOL_TYPE_FILL, m_color);
178
                symbolCircle.setStyle(FConstant.SYMBOL_STYLE_FILL_SOLID);
179
                symbolCircle.setOutlined(true);
180
                symbolCircle.setOutlineColor(m_color);
181
                symbolCircle.setColor(null);
182
                m_symbol=symbolCircle;
183
                break;
184
        }
185
        */
186
        switch (m_type) {
187
        case (POINT):
188
                shapeType = FShape.POINT;
189
            break;
190

    
191
        case (RECTANGLE):
192
        case (POLYGON):
193
        case (CIRCLE):
194
                shapeType = FShape.POLYGON;
195
            break;
196

    
197
        case (LINE):
198
        case (POLYLINE):
199
                shapeType = FShape.LINE;
200
            break;
201
        }
202
        m_symbol = SymbologyFactory.createDefaultSymbolByShapeType(shapeType);
203
        if (shapeType==FShape.POLYGON){
204
                ((SimpleFillSymbol)m_symbol).setFillColor(null);
205
        }
206
    }
207

    
208
    /**
209
     * Devuelve el FSymbol que se representa.
210
     *
211
     * @return DOCUMENT ME!
212
     */
213
    public ISymbol getFSymbol() {
214
        return m_symbol;
215
    }
216

    
217
    /**
218
     * Rellena el FSymbol que se representara al dibujar.
219
     *
220
     * @param fs2d
221
     */
222
    public void setFSymbol(ISymbol symbol) {
223
        m_symbol = symbol;
224
    }
225

    
226
    /**
227
     * M?todo que dibuja sobre el graphics que se le pasa como par?metro, seg?n
228
     * la transformada afin que se debe de aplicar y el rect?ngulo que se debe
229
     * de dibujar.
230
     *
231
     * @param g Graphics
232
     * @param at Transformada afin.
233
     * @param rv rect?ngulo sobre el que hacer un clip.
234
     * @param imgBase DOCUMENT ME!
235
     */
236
    public void draw(Graphics2D g, AffineTransform at, Rectangle2D rv,
237
        BufferedImage imgBase) throws ReadDriverException {
238
        Rectangle2D.Double rect = getBoundingBox(at);
239
        g.rotate(Math.toRadians(getRotation()), rect.x + (rect.width / 2),
240
            rect.y + (rect.height / 2));
241
        if (intersects(rv, rect)) {
242
            g.setColor(Color.black);
243

    
244
            if (m_type == POINT) {
245
                ((IMarkerSymbol)m_symbol).setSize((int) (rect.getWidth() * 0.7));
246
            }
247
//            float stroke=0;
248
//            if (((FSymbol)m_symbol).getStroke() != null) {
249
//                    stroke=((BasicStroke)((FSymbol)m_symbol).getStroke()).getLineWidth();
250
//                BasicStroke basicStroke = new BasicStroke((float)FLayoutUtilities.fromSheetDistance(stroke,at)/100);
251
//                ((FSymbol)m_symbol).setStroke(basicStroke);
252
//            }
253
            geometry.draw(g, at, m_symbol);
254

    
255
//            if (((FSymbol)m_symbol).getStroke() != null) {
256
//                BasicStroke basicStroke = new BasicStroke(stroke);
257
//                ((FSymbol)m_symbol).setStroke(basicStroke);
258
//            }
259

    
260
            if (editing) {
261
                g.setColor(Color.red);
262
                geometry.drawVertex(g, at);
263
            }
264
        }
265

    
266
        g.rotate(Math.toRadians(-getRotation()), rect.x + (rect.width / 2),
267
            rect.y + (rect.height / 2));
268
    }
269

    
270
    /**
271
     * @see com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame#getXMLEntity()
272
     */
273
    public XMLEntity getXMLEntity() throws SaveException {
274
        XMLEntity xml = super.getXMLEntity();
275

    
276
        try {
277
//            xml.putProperty("type", Layout.GRAPHICS);
278
            xml.putProperty("m_type", m_type);
279
            xml.addChild(m_symbol.getXMLEntity());
280
            if (geometry!=null) {
281
                xml.addChild(geometry.getXMLEntity());
282
            }
283
           // xml.addChild(geometryEdit.getXMLEntity());
284
        } catch (Exception e) {
285
            throw new SaveException(e, this.getClass().getName());
286
        }
287

    
288
        return xml;
289
    }
290

    
291
    /**
292
     * @see com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame#updateNum()
293
     */
294
    public void updateNum() {
295
    }
296

    
297
    /**
298
     * @see com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame#getNum()
299
     */
300
    public int getNum() {
301
        return 0;
302
    }
303

    
304
    /**
305
     * @see com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame#setXMLEntity(com.iver.utiles.XMLEntity,
306
     *      com.iver.cit.gvsig.project.Project)
307
     */
308
    public void setXMLEntity(XMLEntity xml) {
309
        m_Selected = xml.getIntProperty("m_Selected");
310

    
311
        setRotation(xml.getDoubleProperty("m_rotation"));
312
        // jaume; m_symbol = FSymbol.createFromXML(xml.getChild(0));
313
        m_symbol = SymbologyFactory.createSymbolFromXML(xml.getChild(0), null);
314
        if (xml.contains("m_type")) {
315
            m_type = xml.getIntProperty("m_type");
316
           // return;
317
        }
318
        if (m_type==RECTANGLESYMBOL)
319
            return;
320
        if (xml.getChildrenCount() ==1) {
321
            Rectangle2D r = (Rectangle2D) getBoundBox().clone();
322

    
323
            if (m_type == LINE) {
324
                geometry = new PolyLineAdapter();
325
            } else if (m_type == RECTANGLE ||
326
                    m_type == RECTANGLEGROUP) {
327
                geometry = new RectangleAdapter();
328
                geometry.addPoint(new Point2D.Double(r.getX(), r.getY()));
329
                geometry.addPoint(new Point2D.Double(r.getMaxX(), r.getMaxY()));
330
            } else if (m_type == POLYLINE) {
331
                geometry = new PolyLineAdapter();
332
            } else if (m_type == POLYGON) {
333
                geometry = new PolygonAdapter();
334
            } else if (m_type == CIRCLE) {
335
                geometry = new CircleAdapter();
336
                geometry.addPoint(new Point2D.Double(r.getCenterX(),
337
                        r.getCenterY()));
338

    
339
                if (r.getWidth() < r.getHeight()) {
340
                    geometry.addPoint(new Point2D.Double(r.getMaxX(),
341
                            r.getCenterY()));
342
                } else {
343
                    geometry.addPoint(new Point2D.Double(r.getCenterX(),
344
                            r.getY()));
345
                }
346
            } else if (m_type == POINT) {
347
                geometry = new PointAdapter();
348
                geometry.addPoint(new Point2D.Double(r.getCenterX(),
349
                        r.getCenterY()));
350
            }
351

    
352
            geometry.end();
353
        } else {
354
            geometry = GeometryAdapter.createFromXML(xml.getChild(1));
355
           // geometryEdit = GeometryAdapter.createFromXML(xml.getChild(2));
356
        }
357
    }
358

    
359
    /**
360
     * @see com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame#setXMLEntity(com.iver.utiles.XMLEntity,
361
     *      com.iver.cit.gvsig.project.Project)
362
     */
363
    public void setXMLEntity03(XMLEntity xml, Layout p) {
364
        m_Selected = xml.getIntProperty("m_Selected");
365
        m_type = xml.getIntProperty("m_type");
366
        // jaume; m_symbol = FSymbol.createFromXML(xml.getChild(0));
367
        m_symbol = SymbologyFactory.createSymbolFromXML(xml.getChild(0), null);
368

    
369
        Rectangle2D r = (Rectangle2D) getBoundBox().clone();
370

    
371
        if (m_type == LINE) {
372
            geometry = new PolyLineAdapter();
373
        } else if (m_type == RECTANGLE) {
374
            geometry = new RectangleAdapter();
375
            geometry.addPoint(new Point2D.Double(r.getX(), r.getY()));
376
            geometry.addPoint(new Point2D.Double(r.getMaxX(), r.getMaxY()));
377
        } else if (m_type == POLYLINE) {
378
            geometry = new PolyLineAdapter();
379
        } else if (m_type == POLYGON) {
380
            geometry = new PolygonAdapter();
381
        } else if (m_type == CIRCLE) {
382
            geometry = new CircleAdapter();
383
            geometry.addPoint(new Point2D.Double(r.getCenterX(), r.getCenterY()));
384

    
385
            if (r.getWidth() < r.getHeight()) {
386
                geometry.addPoint(new Point2D.Double(r.getMaxX(), r.getCenterY()));
387
            } else {
388
                geometry.addPoint(new Point2D.Double(r.getCenterX(), r.getY()));
389
            }
390
        } else if (m_type == POINT) {
391
            geometry = new PointAdapter();
392
            geometry.addPoint(new Point2D.Double(r.getCenterX(), r.getCenterY()));
393
        }
394

    
395
        geometry.end();
396
    }
397

    
398
    /**
399
     * @see com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame#getNameFFrame()
400
     */
401
    public String getNameFFrame() {
402
        return PluginServices.getText(this, "Graficos")+ num;
403
    }
404

    
405
    /**
406
     * Inserta el tama?o del punto.
407
     *
408
     * @param size entero que representa el tama?o del punto.
409
     */
410
    public void setSize(double size) {
411
        this.size = size;
412
        if (m_type==RECTANGLESYMBOL) {
413
            return;
414
        }
415
        Rectangle2D r = geometry.getBounds2D();
416
        super.setBoundBox(new Rectangle2D.Double(r.getX() - size,
417
                r.getY() - size, size * 2, size * 2));
418
    }
419

    
420
    /**
421
     * Devuelve el tipo de gr?fico que contiene el fframe.
422
     *
423
     * @return tipo de
424
     */
425
    public int getType() {
426
        return m_type;
427
    }
428
    public void setType(int type) {
429
        m_type = type;
430
    }
431
    /**
432
     * DOCUMENT ME!
433
     *
434
     * @param r DOCUMENT ME!
435
     */
436
    public void setBoundBox(Rectangle2D r) {
437
        if (m_type==RECTANGLESYMBOL) {
438
            super.setBoundBox(r);
439
            return;
440
        }
441
        AffineTransform aT = new AffineTransform();
442

    
443
        if (getBoundBox().getWidth() != 0) {
444
            double w = r.getWidth() / getBoundBox().getWidth();
445
            double h = r.getHeight() / getBoundBox().getHeight();
446

    
447
            AffineTransform trans2 = AffineTransform.getTranslateInstance(r.getX(),
448
                    r.getY());
449
            aT.concatenate(trans2);
450

    
451
            AffineTransform scale1 = AffineTransform.getScaleInstance(w, h);
452
            aT.concatenate(scale1);
453

    
454
            AffineTransform trans1 = AffineTransform.getTranslateInstance(-getBoundBox()
455
                                                                               .getX(),
456
                    -getBoundBox().getY());
457
            aT.concatenate(trans1);
458
            geometry.applyTransform(aT);
459

    
460
            size = aT.getScaleX() * size;
461
        }
462

    
463
        super.setBoundBox(r);
464
    }
465

    
466
    /**
467
     * DOCUMENT ME!
468
     */
469
    public void startEditing() {
470
        editing = true;
471
    }
472

    
473
    /**
474
     * DOCUMENT ME!
475
     */
476
    public void stopEditing() {
477
        editing = false;
478
    }
479

    
480
    /**
481
     * DOCUMENT ME!
482
     *
483
     * @return DOCUMENT ME!
484
     */
485
    public boolean isEditing() {
486
        return editing;
487
    }
488

    
489
    /**
490
     * DOCUMENT ME!
491
     *
492
     * @param point DOCUMENT ME!
493
     * @param geom DOCUMENT ME!
494
     */
495
    public void pointReleased(Point2D point, GeometryAdapter geom) {
496
        index.clear();
497
        geometry = geom;
498

    
499
        Rectangle2D r = geometry.getBounds2D();
500
        super.setBoundBox(r);
501
    }
502

    
503
    /**
504
     * DOCUMENT ME!
505
     *
506
     * @param point DOCUMENT ME!
507
     */
508
    public void pointPressed(Point2D point) {
509
        Rectangle2D.Double rect = getBoundBox();
510
        Point2D[] points = geometry.getPoints();
511
        geometryEdit = geometry.cloneAdapter();//GeometryAdapter.createFromXML(geometry.getXMLEntity());
512

    
513
        Point2D pAux1 = new Point2D.Double();
514
        index.clear();
515
        for (int i = 0; i < points.length; i++) {
516
            if (getRotation() != 0) {
517
                AffineTransform af = AffineTransform.getRotateInstance(Math.toRadians(
518
                            -getRotation()), rect.x + (rect.width / 2),
519
                        rect.y + (rect.height / 2));
520
                af.transform(point, pAux1);
521

    
522
                if (points[i].distance(pAux1) <= TOL) {
523
                    index.set(i);
524
                }
525
            } else {
526
                if (points[i].distance(point) <= TOL) {
527
                    index.set(i);
528
                }
529
            }
530
        }
531
    }
532

    
533
    /**
534
     * DOCUMENT ME!
535
     *
536
     * @param point DOCUMENT ME!
537
     */
538
    public void pointDragged(Point2D point) {
539
        //Point2D[] points = geometry.getPoints();
540

    
541
        for (int j = index.nextSetBit(0); j >= 0;
542
                j = index.nextSetBit(j + 1)) {
543
            if (getRotation() != 0) {
544
                Rectangle2D.Double rect = getBoundBox();
545
                AffineTransform af = AffineTransform.getRotateInstance(Math.toRadians(
546
                            -getRotation()), rect.x + (rect.width / 2),
547
                        rect.y + (rect.height / 2));
548
                af.transform(point, point);
549
            }
550

    
551
            //points[j] = new Point2D.Double(point.getX(), point.getY());
552
            geometryEdit.changePoint(j,point);
553
        }
554
        //geometryEdit.setPoints(points);
555
        geometryEdit.end();
556
    }
557

    
558
    /**
559
     * DOCUMENT ME!
560
     *
561
     * @param g DOCUMENT ME!
562
     * @param at DOCUMENT ME!
563
     */
564
    public void paint(Graphics2D g, AffineTransform at) {
565
        if (geometryEdit != null) {
566
            Rectangle2D.Double rect = getBoundingBox(at);
567
            if (getRotation()!=0){
568
            g.rotate(Math.toRadians(getRotation()), rect.x + (rect.width / 2),
569
                rect.y + (rect.height / 2));
570
            geometryEdit.paint(g,at,false);
571
          /*  FShape m_shape = null;
572
            GeneralPathX polyLine = new GeneralPathX(geometryEdit.getShape());
573
            polyLine.transform(at);
574
            m_shape = new FPolyline2D(polyLine);
575
            FGraphicUtilities.DrawShape(g, mT, m_shape, m_symbol);
576
*/
577
            g.rotate(Math.toRadians(-getRotation()), rect.x + (rect.width / 2),
578
                rect.y + (rect.height / 2));
579
            }else{
580
                 geometryEdit.paint(g,at,false);
581
            }
582
        }
583
    }
584

    
585
    /**
586
     * DOCUMENT ME!
587
     *
588
     * @return DOCUMENT ME!
589
     */
590
    public GeometryAdapter getGeometry() {
591
        return geometryEdit;
592
    }
593

    
594
    public void initialize() {
595
        // TODO Auto-generated method stub
596

    
597
    }
598
     /**
599
     * Devuelve un entero que representa donde esta contenido el punto que se
600
     * pasa como par?metro.
601
     *
602
     * @param p punto a comparar.
603
     *
604
     * @return entero que representa como esta contenido el punto.
605
     */
606
    public int getContains(Point2D p) {
607
        if (geometry instanceof CircleAdapter) {
608
            if (ne.contains(p.getX(), p.getY())) {
609
                return NE;
610
            } else if (se.contains(p.getX(), p.getY())) {
611
                return SE;
612
            } else if (so.contains(p.getX(), p.getY())) {
613
                return SO;
614
            } else if (no.contains(p.getX(), p.getY())) {
615
                return NO;
616
            } else if (getBoundingBox(null).contains(p.getX(), p.getY())) {
617
                return RECT;
618
            }
619
            return NOSELECT;
620
        }
621
            return super.getContains(p);
622
    }
623

    
624
    /**
625
     * Dibuja los handlers sobre el boundingBox en el graphics que se pasa como
626
     * par?metro.
627
     *
628
     * @param g
629
     *            Graphics sobre el que dibujar.
630
     */
631
    public void drawHandlers(Graphics2D g) {
632
        if (geometry instanceof CircleAdapter) {
633
            int size = 10;
634
            Rectangle2D r = getBoundingBox(null);
635
            Point2D p = new Point2D.Double();
636
            g.rotate(Math.toRadians(getRotation()), r.getX()
637
                    + (r.getWidth() / 2), r.getY() + (r.getHeight() / 2));
638

    
639
            AffineTransform atRotate = new AffineTransform();
640
            atRotate.rotate(Math.toRadians(getRotation()), r.getX()
641
                    + (r.getWidth() / 2), r.getY() + (r.getHeight() / 2));
642

    
643
            g.fillRect((int) r.getX() - size, (int) r.getY() - size,
644
                            size, size);
645
            atRotate.transform(new Point2D.Double(r.getX() - size, r.getY()
646
                    - size), p);
647
            no.setRect((int) p.getX(), (int) p.getY(), size, size);
648

    
649
            g.fillRect((int) r.getMaxX(), (int) r.getY() - size, size, size);
650
            atRotate.transform(
651
                    new Point2D.Double(r.getMaxX(), r.getY() - size), p);
652
            ne.setRect((int) p.getX(), (int) p.getY(), size, size);
653

    
654
            g.fillRect((int) r.getX() - size, (int) r.getMaxY(), size, size);
655
            atRotate.transform(
656
                    new Point2D.Double(r.getX() - size, r.getMaxY()), p);
657
            so.setRect((int) p.getX(), (int) p.getY(), size, size);
658

    
659
            g.fillRect((int) r.getMaxX(), (int) r.getMaxY(), size, size);
660
            atRotate.transform(new Point2D.Double(r.getMaxX(), r.getMaxY()), p);
661
            se.setRect((int) p.getX(), (int) p.getY(), size, size);
662

    
663
            g.rotate(Math.toRadians(-getRotation()), r.getX()
664
                    + (r.getWidth() / 2), r.getY() + (r.getHeight() / 2));
665
        }
666
        else
667
            super.drawHandlers(g);
668
    }
669

    
670
        public void cloneActions(IFFrame frame) {
671
                // TODO Auto-generated method stub
672

    
673
        }
674

    
675
        public IFFrameDialog getPropertyDialog() {
676
                return new FFrameGraphicsDialog(getLayout(),this);
677
        }
678
         public int getShapeType(){
679
                    int shapeType=0;
680
                    switch (m_type) {
681
                case (POINT):
682
                        shapeType = FShape.POINT;
683
                    break;
684

    
685
                case (RECTANGLE):
686
                case (POLYGON):
687
                case (CIRCLE):
688
                        shapeType = FShape.POLYGON;
689
                    break;
690

    
691
                case (LINE):
692
                case (POLYLINE):
693
                        shapeType = FShape.LINE;
694
                    break;
695
                }
696
                    return shapeType;
697
            }
698
        public void print(Graphics2D g, AffineTransform at, FShape shape, PrintRequestAttributeSet printingProperties) throws ReadDriverException {
699
                 Rectangle2D.Double rect = getBoundingBox(at);
700
             g.rotate(Math.toRadians(getRotation()), rect.x + (rect.width / 2),
701
                    rect.y + (rect.height / 2));
702
             g.setColor(Color.black);
703

    
704
             if (m_type == POINT) {
705
                 ((IMarkerSymbol)m_symbol).setSize((int) (rect.getWidth() * 0.7));
706
             }
707
             m_symbol.print(g,at,geometry.getShape(at),printingProperties);
708
             //geometry.print(g, at, m_symbol, printingProperties);
709
             g.rotate(Math.toRadians(-getRotation()), rect.x + (rect.width / 2),
710
                    rect.y + (rect.height / 2));
711
        }
712

    
713

    
714
}