Revision 1400

View differences:

branches/pilotoDWG/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/cad/CadTool.java
2 2

  
3 3
package com.iver.cit.gvsig.fmap.edition.cad;
4 4

  
5
import java.awt.Color;
5 6
import java.awt.Graphics;
6 7

  
8
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
9
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
7 10
import com.iver.cit.gvsig.fmap.edition.EditableFeatureSource;
8 11
import com.iver.cit.gvsig.fmap.layers.FBitSet;
9 12

  
10 13
public interface CadTool {
14
	public static FSymbol drawingSymbol =new FSymbol(FConstant.SYMBOL_TYPE_POINT, Color.RED);
15
	
11 16
    /**
12 17
     * Indica una transici?n de un estado a otro. En ?ste m?todo se deber? comprobar si el estado al que se llega con la transici?n es un estado en el que hay que modificar, a?adir o eliminar una geometr?a. 
13 18
     */
......
34 39
	 * Inicializa el estado del aut?mata de la herramienta
35 40
	 */
36 41
	void initializeStatus();
42

  
43
	public void setCadToolAdapter(CADToolAdapter cta);
44

  
45
	public CADToolAdapter getCadToolAdapter();
37 46
}
branches/pilotoDWG/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/cad/cadTools/EllipseCadTool.java
53 53
 *
54 54
 * @author Vicente Caballero Navarro
55 55
 */
56
public class EllipseCadTool implements CadTool {
56
public class EllipseCadTool extends AbstractCadTool {
57 57
	private static Status[] STATUS = {
58 58
			new Status("Precise punto final de eje de elipse"),
59 59
			new Status("Precise punto final de eje"),
branches/pilotoDWG/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/cad/cadTools/AbstractCadTool.java
1
/*
2
 * Created on 09-feb-2005
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, 
21
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.fmap.edition.cad.cadTools;
46

  
47
import com.iver.cit.gvsig.fmap.edition.cad.CADToolAdapter;
48
import com.iver.cit.gvsig.fmap.edition.cad.CadTool;
49

  
50

  
51
public abstract class AbstractCadTool implements CadTool {
52
	private CADToolAdapter cadToolAdapter;
53
	public void setCadToolAdapter(CADToolAdapter cta){
54
		cadToolAdapter = cta;
55
	}
56
	
57
	public CADToolAdapter getCadToolAdapter(){
58
		return cadToolAdapter;
59
	}
60
}
0 61

  
branches/pilotoDWG/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/cad/cadTools/ArcCadTool.java
53 53
 *
54 54
 * @author Vicente Caballero Navarro
55 55
 */
56
public class ArcCadTool implements CadTool {
56
public class ArcCadTool extends AbstractCadTool {
57 57
	private static Status[] STATUS = {
58 58
			new Status("Precise punto inicial"),
59 59
			new Status("Precise segundo punto"),
branches/pilotoDWG/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/cad/cadTools/PointCadTool.java
61 61
 *
62 62
 * @author Vicente Caballero Navarro
63 63
 */
64
public class PointCadTool implements CadTool {
64
public class PointCadTool extends AbstractCadTool {
65 65
	private static Status[] STATUS = { new Status("Precise un punto") };
66 66
	private Punto pointStatus = new Punto();
67 67

  
branches/pilotoDWG/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/cad/cadTools/PolyLineCadTool.java
59 59
 *
60 60
 * @author Vicente Caballero Navarro
61 61
 */
62
public class PolyLineCadTool implements CadTool {
62
public class PolyLineCadTool extends AbstractCadTool {
63 63
	private static Status[] STATUS = {
64 64
			new Status("Precise punto inicial"),
65 65
			new Status("Precise punto siguiente"),
branches/pilotoDWG/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/cad/cadTools/CircleCadTool.java
49 49
import com.iver.cit.gvsig.fmap.layers.FBitSet;
50 50

  
51 51
import java.awt.Graphics;
52
import java.awt.Graphics2D;
52 53
import java.awt.Point;
53 54
import java.awt.geom.Point2D;
54 55
import java.io.IOException;
......
59 60
 *
60 61
 * @author Vicente Caballero Navarro
61 62
 */
62
public class CircleCadTool implements CadTool {
63
public class CircleCadTool extends AbstractCadTool {
63 64
	private static Status[] STATUS = {
64 65
			new Status("Precise punto central"), new Status("Precise radio")
65 66
		};
......
112 113
		FBitSet selectedGeometries, double x, double y) {
113 114
		int status = circleStatus.getStatus();
114 115

  
115
		Point2D currentPoint = new Point2D.Double(x, y);
116
		double dist = currentPoint.distance(center);
117 116
		if (status == 1){
118
			g.drawArc((int) center.getX(), (int) center.getY(), (int) dist, (int) dist, 0, 360);
117
			Point2D currentPoint = new Point2D.Double(x, y);
118
			double dist = currentPoint.distance(center);
119
			ShapeFactory.createCircle(center, dist).draw((Graphics2D) g, getCadToolAdapter().getMapControl().getViewPort(), CadTool.drawingSymbol);
119 120
		}
120 121
	}
121 122

  
branches/pilotoDWG/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/cad/cadTools/RectangleCadTool.java
58 58
 *
59 59
 * @author Vicente Caballero Navarro
60 60
 */
61
public class RectangleCadTool implements CadTool {
61
public class RectangleCadTool extends AbstractCadTool {
62 62
	private static Status[] STATUS = {
63 63
			new Status("Precise primer punto de esquina"),
64 64
			new Status("Precise esquina opuesta"),
branches/pilotoDWG/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/cad/cadTools/CopyCadTool.java
54 54
 *
55 55
 * @author Vicente Caballero Navarro
56 56
 */
57
public class CopyCadTool implements CadTool {
57
public class CopyCadTool extends AbstractCadTool {
58 58
	private static Status[] STATUS = {
59 59
			new Status("Precisar punto de desplazamiento"),
60 60
			new Status("Precisar segundo punto del desplazamiento"),
branches/pilotoDWG/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/cad/cadTools/SelectionCadTool.java
60 60
 *
61 61
 * @author Vicente Caballero Navarro
62 62
 */
63
public class SelectionCadTool implements CadTool {
63
public class SelectionCadTool extends AbstractCadTool {
64 64
	private static Status[] STATUS = {
65 65
			new Status("Primer punto"),
66 66
			new Status("Siguiente punto"),
branches/pilotoDWG/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/cad/cadTools/PolygonCadTool.java
58 58
 *
59 59
 * @author Vicente Caballero Navarro
60 60
 */
61
public class PolygonCadTool implements CadTool {
61
public class PolygonCadTool extends AbstractCadTool {
62 62
	private static Status[] STATUS = {
63 63
			new Status("Indique n?mero de lados"),
64 64
			new Status("Precise centro del pol?gono"),
branches/pilotoDWG/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/cad/cadTools/LineCadTool.java
59 59
 *
60 60
 * @author Vicente Caballero Navarro
61 61
 */
62
public class LineCadTool implements CadTool {
62
public class LineCadTool extends AbstractCadTool {
63 63
	private static Status[] STATUS = {
64 64
			new Status("Precise primer punto"),
65 65
			new Status("Precise punto siguiente"),
branches/pilotoDWG/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/cad/cadTools/SplineCadTool.java
53 53
 *
54 54
 * @author Vicente Caballero Navarro
55 55
 */
56
public class SplineCadTool implements CadTool {
56
public class SplineCadTool extends AbstractCadTool {
57 57
	private static Status[] STATUS = {
58 58
			new Status("Precise primer punto"),
59 59
			new Status("Precise siguiente punto"),

Also available in: Unified diff