svn-gvsig-desktop / trunk / extensions / extCAD / src / com / iver / cit / gvsig / gui / cad / tools / PointCADTool.java @ 3832
History | View | Annotate | Download (4.29 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 |
_fsm = new PointCADToolContext(this); |
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 |
} |
72 |
|
73 |
/**
|
74 |
* DOCUMENT ME!
|
75 |
*
|
76 |
* @param sel DOCUMENT ME!
|
77 |
* @param x DOCUMENT ME!
|
78 |
* @param y DOCUMENT ME!
|
79 |
*/
|
80 |
public void transition(double x, double y) { |
81 |
_fsm.addPoint(x, y); |
82 |
} |
83 |
|
84 |
/* (non-Javadoc)
|
85 |
* @see com.iver.cit.gvsig.gui.cad.CADTool#transition(com.iver.cit.gvsig.fmap.layers.FBitSet, double)
|
86 |
*/
|
87 |
public void transition(double d) { |
88 |
// TODO Auto-generated method stub
|
89 |
} |
90 |
|
91 |
/* (non-Javadoc)
|
92 |
* @see com.iver.cit.gvsig.gui.cad.CADTool#transition(com.iver.cit.gvsig.fmap.layers.FBitSet, java.lang.String)
|
93 |
*/
|
94 |
public void transition(String s) { |
95 |
// TODO Auto-generated method stub
|
96 |
} |
97 |
|
98 |
/**
|
99 |
* Equivale al transition del prototipo pero sin pasarle como par? metro el
|
100 |
* editableFeatureSource que ya estar? creado.
|
101 |
*
|
102 |
* @param sel Bitset con las geometr?as que est?n seleccionadas.
|
103 |
* @param x par?metro x del punto que se pase en esta transici?n.
|
104 |
* @param y par?metro y del punto que se pase en esta transici?n.
|
105 |
*/
|
106 |
public void addPoint(double x, double y) { |
107 |
PointCADToolState actualState = (PointCADToolState) _fsm.getPreviousState(); |
108 |
String status = actualState.getName();
|
109 |
|
110 |
if (status.equals("ExecuteMap.Initial") || |
111 |
(status == "ExecuteMap.First")) {
|
112 |
addGeometry(ShapeFactory.createPoint2D(x, y)); |
113 |
} |
114 |
} |
115 |
|
116 |
/**
|
117 |
* M?todo para dibujar la lo necesario para el estado en el que nos
|
118 |
* encontremos.
|
119 |
*
|
120 |
* @param g Graphics sobre el que dibujar.
|
121 |
* @param selectedGeometries BitSet con las geometr?as seleccionadas.
|
122 |
* @param x par?metro x del punto que se pase para dibujar.
|
123 |
* @param y par?metro x del punto que se pase para dibujar.
|
124 |
*/
|
125 |
public void drawOperation(Graphics g, double x, |
126 |
double y) {
|
127 |
} |
128 |
|
129 |
/**
|
130 |
* Add a diferent option.
|
131 |
*
|
132 |
* @param sel DOCUMENT ME!
|
133 |
* @param s Diferent option.
|
134 |
*/
|
135 |
public void addOption(String s) { |
136 |
// TODO Auto-generated method stub
|
137 |
} |
138 |
|
139 |
/* (non-Javadoc)
|
140 |
* @see com.iver.cit.gvsig.gui.cad.CADTool#end()
|
141 |
*/
|
142 |
public void end() { |
143 |
// TODO Auto-generated method stub
|
144 |
} |
145 |
|
146 |
/* (non-Javadoc)
|
147 |
* @see com.iver.cit.gvsig.gui.cad.CADTool#addvalue(double)
|
148 |
*/
|
149 |
public void addValue(double d) { |
150 |
// TODO Auto-generated method stub
|
151 |
} |
152 |
} |