Statistics
| Revision:

root / trunk / extensions / extCAD / src / com / iver / cit / gvsig / gui / cad / tools / PointCADTool.java @ 3883

History | View | Annotate | Download (4.12 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.gui.cad.tools;
42

    
43
import java.awt.Graphics;
44

    
45
import com.iver.cit.gvsig.fmap.core.ShapeFactory;
46
import com.iver.cit.gvsig.gui.cad.DefaultCADTool;
47
import com.iver.cit.gvsig.gui.cad.tools.smc.PointCADToolContext;
48
import com.iver.cit.gvsig.gui.cad.tools.smc.PointCADToolContext.PointCADToolState;
49

    
50

    
51
/**
52
 * DOCUMENT ME!
53
 *
54
 * @author Vicente Caballero Navarro
55
 */
56
public class PointCADTool extends DefaultCADTool {
57
    private PointCADToolContext _fsm;
58

    
59
    /**
60
     * Crea un nuevo PointCADTool.
61
     */
62
    public PointCADTool() {
63

    
64
    }
65

    
66
    /**
67
     * M?todo de incio, para poner el c?digo de todo lo que se requiera de una
68
     * carga previa a la utilizaci?n de la herramienta.
69
     */
70
    public void init() {
71
            _fsm = new PointCADToolContext(this);
72
    }
73

    
74
    /**
75
     * DOCUMENT ME!
76
     *
77
     * @param sel DOCUMENT ME!
78
     * @param x DOCUMENT ME!
79
     * @param y DOCUMENT ME!
80
     */
81
    public void transition(double x, double y) {
82
        _fsm.addPoint(x, y);
83
    }
84

    
85
    /* (non-Javadoc)
86
     * @see com.iver.cit.gvsig.gui.cad.CADTool#transition(com.iver.cit.gvsig.fmap.layers.FBitSet, double)
87
     */
88
    public void transition(double d) {
89
        // TODO Auto-generated method stub
90
    }
91

    
92
    /* (non-Javadoc)
93
     * @see com.iver.cit.gvsig.gui.cad.CADTool#transition(com.iver.cit.gvsig.fmap.layers.FBitSet, java.lang.String)
94
     */
95
    public void transition(String s) {
96
        _fsm.addOption(s);
97
    }
98

    
99
    /**
100
     * Equivale al transition del prototipo pero sin pasarle como par? metro el
101
     * editableFeatureSource que ya estar? creado.
102
     *
103
     * @param sel Bitset con las geometr?as que est?n seleccionadas.
104
     * @param x par?metro x del punto que se pase en esta transici?n.
105
     * @param y par?metro y del punto que se pase en esta transici?n.
106
     */
107
    public void addPoint(double x, double y) {
108
        PointCADToolState actualState = (PointCADToolState) _fsm.getPreviousState();
109
        String status = actualState.getName();
110

    
111
        if (status.equals("ExecuteMap.Initial") ||
112
                (status == "ExecuteMap.First")) {
113
            addGeometry(ShapeFactory.createPoint2D(x, y));
114
        }
115
    }
116

    
117
    /**
118
     * M?todo para dibujar la lo necesario para el estado en el que nos
119
     * encontremos.
120
     *
121
     * @param g Graphics sobre el que dibujar.
122
     * @param selectedGeometries BitSet con las geometr?as seleccionadas.
123
     * @param x par?metro x del punto que se pase para dibujar.
124
     * @param y par?metro x del punto que se pase para dibujar.
125
     */
126
    public void drawOperation(Graphics g, double x,
127
        double y) {
128
    }
129

    
130
    /**
131
     * Add a diferent option.
132
     *
133
     * @param sel DOCUMENT ME!
134
     * @param s Diferent option.
135
     */
136
    public void addOption(String s) {
137
        // TODO Auto-generated method stub
138
    }
139

    
140
    /* (non-Javadoc)
141
     * @see com.iver.cit.gvsig.gui.cad.CADTool#addvalue(double)
142
     */
143
    public void addValue(double d) {
144
        // TODO Auto-generated method stub
145
    }
146

    
147
}