Revision 25153

View differences:

tags/tmp_build/extensions/extCAD/src/com/iver/cit/gvsig/StopEditingToShp.java
1
package com.iver.cit.gvsig;
2

  
3
import java.awt.Component;
4
import java.io.File;
5

  
6
import javax.swing.JFileChooser;
7

  
8
import com.iver.andami.PluginServices;
9
import com.iver.andami.messages.NotificationManager;
10
import com.iver.andami.plugins.Extension;
11
import com.iver.cit.gvsig.fmap.MapContext;
12
import com.iver.cit.gvsig.fmap.MapControl;
13
import com.iver.cit.gvsig.fmap.edition.EditionEvent;
14
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter;
15
import com.iver.cit.gvsig.fmap.edition.writers.shp.ShpWriter;
16
import com.iver.cit.gvsig.fmap.layers.FLayer;
17
import com.iver.cit.gvsig.fmap.layers.FLayers;
18
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
19
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
20
import com.iver.cit.gvsig.project.documents.view.IProjectView;
21
import com.iver.cit.gvsig.project.documents.view.gui.View;
22
import com.iver.utiles.SimpleFileFilter;
23

  
24

  
25

  
26

  
27
/**
28
 * DOCUMENT ME!
29
 *
30
 * @author Vicente Caballero Navarro
31
 */
32
public class StopEditingToShp extends Extension {
33
    private  View vista;
34
	/**
35
     * @see com.iver.andami.plugins.IExtension#initialize()
36
     */
37
    public void initialize() {
38
    }
39

  
40
    /**
41
     * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
42
     */
43
    public void execute(String s) {
44
        com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
45
                                                             .getActiveWindow();
46

  
47
        vista = (View) f;
48

  
49
        IProjectView model = vista.getModel();
50
        MapContext mapa = model.getMapContext();
51
            FLayers layers = mapa.getLayers();
52
            if (s.equals("STOPEDITING"))
53
            {
54
            	FLayer[] actives = layers.getActives();
55
            	// TODO: Comprobar que solo hay una activa, o al menos
56
            	// que solo hay una en edici?n que est? activa, etc, etc
57
            	for (int i = 0; i < actives.length; i++)
58
            	{
59
            		if (actives[i] instanceof FLyrVect &&
60
                        actives[i].isEditing())
61
            		{
62
            			FLyrVect lv = (FLyrVect) actives[i];
63
            			MapControl mapControl = vista.getMapControl();
64
            			stopEditing(lv,mapControl);
65
            		}
66
            	}
67
            }
68
            PluginServices.getMainFrame().enableControls();
69
    }
70

  
71
    /**
72
     * @see com.iver.andami.plugins.IExtension#isEnabled()
73
     */
74
    public boolean isEnabled() {
75
        return true;
76
    }
77

  
78
    /**
79
     * DOCUMENT ME!
80
     */
81
    public void stopEditing(FLyrVect layer,MapControl mapControl) {
82
        try {
83
            JFileChooser jfc = new JFileChooser();
84
            SimpleFileFilter filterShp = new SimpleFileFilter("shp", PluginServices.getText(this,"shp_files"));
85
            jfc.setFileFilter(filterShp);
86
            if (jfc.showSaveDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION) {
87
        		    File newFile = jfc.getSelectedFile();
88
        		    String path = newFile.getAbsolutePath();
89
        		    if (!(path.toLowerCase().endsWith(".shp")))
90
        		    {
91
        		    	path = path + ".shp";
92
        		    }
93
        		    newFile = new File(path);
94
        			VectorialEditableAdapter vea = (VectorialEditableAdapter) layer.getSource();
95
        			// File newFile = vea.getDriver().
96

  
97
        			ShpWriter writer= (ShpWriter)LayerFactory.getWM().getWriter("Shape Writer");
98
        			writer.initialize(layer);
99

  
100
                    vea.stopEdition(writer,EditionEvent.GRAPHIC);
101
                    vea.getCommandRecord().removeCommandListener(mapControl);
102

  
103
                    layer.setEditing(false);
104
                    vista.hideConsole();
105
                }
106
        } catch (Exception e) {
107
        	NotificationManager.addError(e.getMessage(),e);
108
        }
109
    }
110

  
111
    /**
112
     * @see com.iver.andami.plugins.IExtension#isVisible()
113
     */
114
    public boolean isVisible() {
115
        if (EditionUtilities.getEditionStatus() == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE)
116
        	return true;
117
      	return false;
118

  
119
    }
120
}
0 121

  
tags/tmp_build/extensions/extCAD/src/com/iver/cit/gvsig/TableCommandStackExtension.java
1
package com.iver.cit.gvsig;
2

  
3
import com.iver.andami.PluginServices;
4
import com.iver.andami.plugins.Extension;
5
import com.iver.cit.gvsig.fmap.edition.IEditableSource;
6
import com.iver.cit.gvsig.fmap.edition.commands.CommandRecord;
7
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
8
import com.iver.cit.gvsig.gui.command.CommandStackDialog;
9
import com.iver.cit.gvsig.project.documents.table.ProjectTable;
10
import com.iver.cit.gvsig.project.documents.table.gui.Table;
11

  
12
/**
13
 * DOCUMENT ME!
14
 *
15
 * @author Vicente Caballero Navarro
16
 */
17
public class TableCommandStackExtension extends Extension {
18
	/**
19
	 * @see com.iver.andami.plugins.IExtension#initialize()
20
	 */
21
	public void initialize() {
22
		PluginServices.getIconTheme().registerDefault(
23
				"commands-stack",
24
				this.getClass().getClassLoader().getResource("images/commandstack.png")
25
			);
26
	}
27

  
28
	/**
29
	 * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
30
	 */
31
	public void execute(String s) {
32
		com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
33
				.getActiveWindow();
34

  
35
		Table table = (Table) f;
36
		ProjectTable model = table.getModel();
37
		if (s.equals("COMMANDSTACK")) {
38
			CommandRecord cr=null;
39

  
40
			if (model.getAssociatedTable()!=null){
41
				cr=((IEditableSource)((FLyrVect)model.getAssociatedTable()).getSource()).getCommandRecord();
42
				cr.addCommandListener(table);
43
			}else{
44
				cr=model.getModelo().getCommandRecord();
45
				cr.addCommandListener(table);
46
			}
47
			CommandStackDialog csd = new CommandStackDialog();
48
			csd.setModel(cr);
49
			PluginServices.getMDIManager().addWindow(csd);
50
		}
51
	}
52

  
53
	/**
54
	 * @see com.iver.andami.plugins.IExtension#isEnabled()
55
	 */
56
	public boolean isEnabled() {
57
		return true;
58
	}
59

  
60
	/**
61
	 * @see com.iver.andami.plugins.IExtension#isVisible()
62
	 */
63
	public boolean isVisible() {
64
		com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
65
		.getActiveWindow();
66
		if (f instanceof Table){
67
		Table table = (Table) f;
68
		ProjectTable model = table.getModel();
69
		if (model.getModelo().isEditing())
70
			return true;
71
		}
72
			return false;
73

  
74
	}
75
}
0 76

  
tags/tmp_build/extensions/extCAD/src/com/iver/cit/gvsig/CreateNewLayer.java
1
package com.iver.cit.gvsig;
2

  
3
import java.util.ArrayList;
4

  
5
import javax.swing.ImageIcon;
6

  
7
import com.hardcode.driverManager.Driver;
8
import com.hardcode.driverManager.DriverLoadException;
9
import com.hardcode.driverManager.DriverManager;
10
import com.iver.andami.PluginServices;
11
import com.iver.andami.messages.NotificationManager;
12
import com.iver.andami.plugins.Extension;
13
import com.iver.andami.ui.wizard.WizardAndami;
14
import com.iver.cit.gvsig.fmap.MapControl;
15
import com.iver.cit.gvsig.fmap.edition.ISpatialWriter;
16
import com.iver.cit.gvsig.fmap.edition.IWriteable;
17
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
18
import com.iver.cit.gvsig.gui.cad.CADToolAdapter;
19
import com.iver.cit.gvsig.gui.cad.MyFinishAction;
20
import com.iver.cit.gvsig.gui.cad.panels.ChooseGeometryType;
21
import com.iver.cit.gvsig.gui.cad.panels.FileBasedPanel;
22
import com.iver.cit.gvsig.gui.cad.panels.JPanelFieldDefinition;
23
import com.iver.cit.gvsig.gui.cad.panels.PostGISpanel;
24
import com.iver.cit.gvsig.project.documents.view.gui.View;
25

  
26
/**
27
 * DOCUMENT ME!
28
 *
29
 * @author Vicente Caballero Navarro
30
 */
31
public class CreateNewLayer extends Extension {
32
	static ImageIcon LOGO;
33

  
34
	/**
35
	 * @see com.iver.andami.plugins.IExtension#initialize()
36
	 */
37
	public void initialize() {
38
	}
39

  
40
	/**
41
	 * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
42
	 */
43
public void execute(String actionCommand) {
44
		com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
45
				.getActiveWindow();
46

  
47
		if (f instanceof View) {
48
			try {
49
				View vista = (View) f;
50

  
51
				LOGO = new javax.swing.ImageIcon(this.getClass()
52
						.getClassLoader().getResource(
53
								"images/package_graphics.png"));
54
				CADToolAdapter cta = CADExtension.getCADToolAdapter();
55
				MapControl mapControl = vista.getMapControl();
56
				cta.setMapControl(mapControl);
57
				/*
58
				 * SimpleLogoJWizardFrame wizardFrame = new
59
				 * SimpleLogoJWizardFrame( LOGO);
60
				 * wizardFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
61
				 *
62
				 * SwingUtilities.updateComponentTreeUI(wizardFrame);
63
				 *
64
				 * wizardFrame.setTitle("Creaci?n de un nuevo Tema");
65
				 */
66
				WizardAndami wizard = new WizardAndami(LOGO);
67

  
68
				DriverManager writerManager = LayerFactory.getDM();
69
				ArrayList spatialDrivers = new ArrayList();
70
				String[] writerNames = writerManager.getDriverNames();
71
				for (int i = 0; i < writerNames.length; i++) {
72
					Driver drv = writerManager.getDriver(writerNames[i]);
73
					if (drv instanceof ISpatialWriter)
74
						spatialDrivers.add(drv.getName());
75
				}
76

  
77
				ChooseGeometryType panelChoose = new ChooseGeometryType(wizard
78
						.getWizardComponents());
79
				JPanelFieldDefinition panelFields = new JPanelFieldDefinition(
80
						wizard.getWizardComponents());
81

  
82
				if (actionCommand.equals("SHP")) {
83
					wizard.getWizardComponents().addWizardPanel(panelChoose);
84
					wizard.getWizardComponents().addWizardPanel(panelFields);
85

  
86
					Driver driver = writerManager.getDriver("gvSIG shp driver");
87
					panelFields.setWriter(((IWriteable) driver).getWriter());
88
					panelChoose.setDriver(driver);
89
					FileBasedPanel filePanel = new FileBasedPanel(wizard
90
							.getWizardComponents());
91
					filePanel.setFileExtension("shp");
92
					wizard.getWizardComponents().addWizardPanel(filePanel);
93

  
94
					wizard.getWizardComponents().setFinishAction(
95
							new MyFinishAction(wizard.getWizardComponents(),
96
									vista, actionCommand));
97
				}
98
				if (actionCommand.equals("DXF")) {
99
					panelChoose.setDriver(writerManager
100
							.getDriver("gvSIG DXF Memory Driver"));
101
					FileBasedPanel filePanel = new FileBasedPanel(wizard
102
							.getWizardComponents());
103
					filePanel.setFileExtension("dxf");
104
					wizard.getWizardComponents().addWizardPanel(filePanel);
105
					wizard.getWizardComponents().getBackButton().setEnabled(
106
							false);
107
					wizard.getWizardComponents().getNextButton().setEnabled(
108
							false);
109

  
110
					wizard.getWizardComponents().setFinishAction(
111
							new MyFinishAction(wizard.getWizardComponents(),
112
									vista, actionCommand));
113
				}
114
				if (actionCommand.equals("POSTGIS")) {
115
					wizard.getWizardComponents().addWizardPanel(panelChoose);
116
					wizard.getWizardComponents().addWizardPanel(panelFields);
117
					Driver driver = writerManager
118
							.getDriver("PostGIS JDBC Driver");
119
					panelChoose.setDriver(driver);
120
					panelFields.setWriter(((IWriteable) driver).getWriter());
121
					wizard.getWizardComponents().addWizardPanel(
122
							new PostGISpanel(wizard.getWizardComponents()));
123

  
124
					wizard.getWizardComponents().setFinishAction(
125
							new MyFinishAction(wizard.getWizardComponents(),
126
									vista, actionCommand));
127
				}
128

  
129
				wizard.getWizardComponents().getFinishButton()
130
						.setEnabled(false);
131
				wizard.getWindowInfo().setWidth(640);
132
				wizard.getWindowInfo().setHeight(350);
133
				wizard.getWindowInfo().setTitle(
134
						PluginServices.getText(this, "new_layer"));
135
				// Utilities.centerComponentOnScreen(wizard);
136
				// wizardFrame.show();
137
				PluginServices.getMDIManager().addWindow(wizard);
138
				// System.out.println("Salgo con " + panelChoose.getLayerName());
139
			} catch (DriverLoadException e) {
140
				NotificationManager.addError(e.getMessage(),e);
141
			}
142
		}
143
	}
144
	/**
145
	 * @see com.iver.andami.plugins.IExtension#isEnabled()
146
	 */
147
	public boolean isEnabled() {
148
		View f = (View) PluginServices.getMDIManager().getActiveWindow();
149

  
150
		if (f == null)
151
			return false;
152
		return true;
153
	}
154

  
155
	/**
156
	 * @see com.iver.andami.plugins.IExtension#isVisible()
157
	 */
158
	public boolean isVisible() {
159
		com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
160
				.getActiveWindow();
161

  
162
		if (f == null) {
163
			return false;
164
		}
165

  
166
		if (f instanceof View)
167
			return true;
168
		return false;
169
	}
170
}
0 171

  
tags/tmp_build/extensions/extCAD/src/com/iver/cit/gvsig/InsertPointExtension.java
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;
42

  
43
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
44
import com.iver.andami.PluginServices;
45
import com.iver.andami.messages.NotificationManager;
46
import com.iver.andami.plugins.Extension;
47
import com.iver.cit.gvsig.fmap.MapControl;
48
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
49
import com.iver.cit.gvsig.gui.cad.tools.PointCADTool;
50
import com.iver.cit.gvsig.project.documents.view.gui.View;
51
/**
52
 * Extensi?n que gestiona la inserci?n de puntos en edici?n.
53
 *
54
 * @author Vicente Caballero Navarro
55
 */
56
public class InsertPointExtension extends Extension {
57
   private View view;
58
   private MapControl mapControl;
59
   private PointCADTool point;
60

  
61
   /**
62
     * @see com.iver.andami.plugins.IExtension#initialize()
63
     */
64
    public void initialize() {
65
        point = new PointCADTool();
66
        CADExtension.addCADTool("_point", point);
67
    
68
        registerIcons();
69
    }
70

  
71
    private void registerIcons(){
72
    	PluginServices.getIconTheme().registerDefault(
73
				"edition-insert-geometry-point",
74
				this.getClass().getClassLoader().getResource("images/Point.png")
75
			);
76
    	
77
    }
78
    
79
    /**
80
     * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
81
     */
82
    public void execute(String s) {
83
    	CADExtension.initFocus();
84

  
85
        if (s.equals("_point")) {
86
        	CADExtension.setCADTool("_point",true);
87
        	CADExtension.getEditionManager().setMapControl(mapControl);
88
        }
89
        CADExtension.getCADToolAdapter().configureMenu();
90
    }
91
    /**
92
     * @see com.iver.andami.plugins.IExtension#isEnabled()
93
     */
94
    public boolean isEnabled() {
95

  
96
      	try {
97
			if (EditionUtilities.getEditionStatus() == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE){
98
				view = (View) PluginServices.getMDIManager().getActiveWindow();
99
		        mapControl = view.getMapControl();
100
		        if (CADExtension.getEditionManager().getActiveLayerEdited()==null)
101
					return false;
102
		        FLyrVect lv=(FLyrVect)CADExtension.getEditionManager().getActiveLayerEdited().getLayer();
103
				if (point.isApplicable(lv.getShapeType())){
104
					return true;
105
				}
106
			}
107
		} catch (ReadDriverException e) {
108
			NotificationManager.addError(e.getMessage(),e);
109
		}
110
		return false;
111
    }
112

  
113
    /**
114
     * @see com.iver.andami.plugins.IExtension#isVisible()
115
     */
116
    public boolean isVisible() {
117
    	if (EditionUtilities.getEditionStatus() == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE)
118
			return true;
119
		return false;
120
    }
121
	}
0 122

  
tags/tmp_build/extensions/extCAD/src/com/iver/cit/gvsig/InsertPolyLineExtension.java
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;
42

  
43
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
44
import com.iver.andami.PluginServices;
45
import com.iver.andami.messages.NotificationManager;
46
import com.iver.andami.plugins.Extension;
47
import com.iver.cit.gvsig.fmap.MapControl;
48
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
49
import com.iver.cit.gvsig.gui.cad.tools.PolylineCADTool;
50
import com.iver.cit.gvsig.gui.cad.tools.SplineCADTool;
51
import com.iver.cit.gvsig.project.documents.view.gui.View;
52

  
53
/**
54
 * Extensi?n que gestiona la inserci?n de polil?neas en edici?n.
55
 *
56
 * @author Vicente Caballero Navarro
57
 */
58
public class InsertPolyLineExtension extends Extension {
59
	private View view;
60

  
61
	private MapControl mapControl;
62
	private PolylineCADTool polyline;
63
	private SplineCADTool spline;
64

  
65
	/**
66
	 * @see com.iver.andami.plugins.IExtension#initialize()
67
	 */
68
	public void initialize() {
69
		polyline = new PolylineCADTool();
70
		spline = new SplineCADTool();
71
		CADExtension.addCADTool("_polyline", polyline);
72
		CADExtension.addCADTool("_spline", spline);
73
		
74
		registerIcons();
75
	}
76

  
77
	private void registerIcons(){
78
		PluginServices.getIconTheme().registerDefault(
79
				"edition-insert-geometry-polyline",
80
				this.getClass().getClassLoader().getResource("images/Line.png")
81
			);
82
		
83
		PluginServices.getIconTheme().registerDefault(
84
				"edition-insert-geometry-spline",
85
				this.getClass().getClassLoader().getResource("images/Spline.png")
86
			);
87
	}
88
	/**
89
	 * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
90
	 */
91
	public void execute(String s) {
92
		CADExtension.initFocus();
93
		if (s.equals("_polyline")) {
94
			CADExtension.setCADTool("_polyline",true);
95
		}else if (s.equals("_spline")) {
96
			CADExtension.setCADTool("_spline",true);
97
		}
98
		CADExtension.getEditionManager().setMapControl(mapControl);
99
		CADExtension.getCADToolAdapter().configureMenu();
100
	}
101

  
102
	/**
103
	 * @see com.iver.andami.plugins.IExtension#isEnabled()
104
	 */
105
	public boolean isEnabled() {
106

  
107
		try {
108
			if (EditionUtilities.getEditionStatus() == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE) {
109
				view = (View) PluginServices.getMDIManager().getActiveWindow();
110
				mapControl = view.getMapControl();
111
				if (CADExtension.getEditionManager().getActiveLayerEdited()==null)
112
					return false;
113
				FLyrVect lv=(FLyrVect)CADExtension.getEditionManager().getActiveLayerEdited().getLayer();
114
				if (polyline.isApplicable(lv.getShapeType())){
115
					return true;
116
				}
117
			}
118
		} catch (ReadDriverException e) {
119
			NotificationManager.addError(e.getMessage(),e);
120
		}
121
		return false;
122
	}
123

  
124
	/**
125
	 * @see com.iver.andami.plugins.IExtension#isVisible()
126
	 */
127
	public boolean isVisible() {
128
		if (EditionUtilities.getEditionStatus() == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE)
129
			return true;
130
		return false;
131
	}
132
}
0 133

  
tags/tmp_build/extensions/extCAD/src/com/iver/cit/gvsig/writers/WriterGT2.java
1
/**
2
 *
3
 */
4
package com.iver.cit.gvsig.writers;
5

  
6
import java.io.IOException;
7
import java.sql.Types;
8

  
9
import org.geotools.data.DataUtilities;
10
import org.geotools.data.DefaultTransaction;
11
import org.geotools.data.FeatureReader;
12
import org.geotools.data.FeatureStore;
13
import org.geotools.data.Transaction;
14
import org.geotools.feature.AttributeType;
15
import org.geotools.feature.AttributeTypeFactory;
16
import org.geotools.feature.Feature;
17
import org.geotools.feature.FeatureType;
18
import org.geotools.feature.FeatureTypes;
19
import org.geotools.feature.IllegalAttributeException;
20
import org.geotools.feature.SchemaException;
21
import org.geotools.filter.Filter;
22
import org.geotools.filter.FilterFactory;
23

  
24
import com.hardcode.gdbms.driver.exceptions.InitializeWriterException;
25
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
26
import com.hardcode.gdbms.engine.values.NullValue;
27
import com.iver.cit.gvsig.exceptions.visitors.ProcessWriterVisitorException;
28
import com.iver.cit.gvsig.exceptions.visitors.StartWriterVisitorException;
29
import com.iver.cit.gvsig.exceptions.visitors.StopWriterVisitorException;
30
import com.iver.cit.gvsig.fmap.core.FShape;
31
import com.iver.cit.gvsig.fmap.core.IFeature;
32
import com.iver.cit.gvsig.fmap.drivers.ITableDefinition;
33
import com.iver.cit.gvsig.fmap.edition.IRowEdited;
34
import com.iver.cit.gvsig.fmap.edition.writers.AbstractWriter;
35
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
36
import com.vividsolutions.jts.geom.Geometry;
37
import com.vividsolutions.jts.geom.MultiLineString;
38
import com.vividsolutions.jts.geom.MultiPoint;
39
import com.vividsolutions.jts.geom.MultiPolygon;
40
import com.vividsolutions.jts.geom.Point;
41

  
42
/**
43
 * @author fjp
44
 *
45
 * Example of using a Geotools featureStore to write features
46
 * Example of use: Inside the extension, open a dataStore and
47
 * get the featureStore. Then create this class with it.
48
 *
49
 */
50
public class WriterGT2 extends AbstractWriter {
51

  
52
	FilterFactory filterFactory = FilterFactory.createFilterFactory();
53
	FeatureStore featStore;
54
	AttributeType[] types;
55
	Transaction t;
56
	int numReg = 0;
57
	public static Class getClassBySqlTYPE(int type)
58
    {
59
        switch (type)
60
        {
61
            case Types.SMALLINT:
62
                return Integer.class;
63
            case Types.INTEGER:
64
            	return Integer.class;
65
            case Types.BIGINT:
66
            	return Integer.class;
67
            case Types.BOOLEAN:
68
            	return Boolean.class;
69
            case Types.DECIMAL:
70
            	return Double.class;
71
            case Types.DOUBLE:
72
            	return Double.class;
73
            case Types.FLOAT:
74
            	return Double.class;
75
            case Types.CHAR:
76
            	return Character.class;
77
            case Types.VARCHAR:
78
            	return String.class;
79
            case Types.LONGVARCHAR:
80
            	return String.class;
81
        }
82
        return NullValue.class;
83
    }
84

  
85
	public static FeatureType getFeatureType(FLyrVect layer, String geomField, String featName) throws SchemaException, ReadDriverException {
86

  
87
		Class geomType = findBestGeometryClass(layer.getShapeType());
88
		// geomType = Geometry.class;
89
		AttributeType geom = AttributeTypeFactory.newAttributeType(geomField, geomType);
90
		int numFields = layer.getRecordset().getFieldCount() + 1;
91
		AttributeType[] att = new AttributeType[numFields];
92
		att[0] = geom;
93
		for (int i=1; i < numFields; i++)
94
		{
95
			att[i] = AttributeTypeFactory.newAttributeType(
96
					layer.getRecordset().getFieldName(i-1),
97
					getClassBySqlTYPE(layer.getRecordset().getFieldType(i-1)));
98
		}
99
		FeatureType featType = FeatureTypes.newFeatureType(att,featName);
100
		return featType;
101
	}
102

  
103
	  public static final Class findBestGeometryClass(int layerType) {
104
		    Class best = Geometry.class;
105
		    switch (layerType)
106
		    {
107
		    case FShape.LINE:
108
		      best = MultiLineString.class;
109
		      break;
110
		    case FShape.MULTIPOINT:
111
		      best = MultiPoint.class;
112
		      break;
113
		    case FShape.POINT:
114
		      best = Point.class;
115
		      break;
116
		    case FShape.POLYGON:
117
		      best = MultiPolygon.class;
118
		      break;
119
		    case FShape.MULTI:
120
			      best = Geometry.class;
121
			      break;
122
		    default:
123
		      throw new RuntimeException("Unknown gvSigShapeType->GeometryClass : " + layerType);
124
		    }
125
		    return best;
126
		  }
127

  
128

  
129
	public WriterGT2(FeatureStore featureStore, boolean writeAllFeatures)
130
	{
131
		this.featStore = featureStore;
132
		this.bWriteAll = writeAllFeatures;
133
	}
134

  
135
	/* (non-Javadoc)
136
	 * @see com.iver.cit.gvsig.fmap.edition.IWriter#preProcess()
137
	 */
138
	public void preProcess() throws StartWriterVisitorException{
139
		try {
140
			types = featStore.getSchema().getAttributeTypes();
141
			t = new DefaultTransaction("handle");
142
			featStore.setTransaction(t);
143

  
144
			t.addAuthorization("handle");  // provide authoriztion
145

  
146

  
147
		} catch (IOException e) {
148
			throw new StartWriterVisitorException(getName(),e);
149
		}
150

  
151

  
152
	}
153

  
154
	/* (non-Javadoc)
155
	 * @see com.iver.cit.gvsig.fmap.edition.IWriter#process(com.iver.cit.gvsig.fmap.edition.IRowEdited)
156
	 */
157
	public void process(IRowEdited row) throws ProcessWriterVisitorException {
158

  
159
		IFeature feat = (IFeature) row.getLinkedRow();
160
		// FeatureType featType = featStore.getSchema();
161
		// TODO: OJO CON EL ORDEN DE LOS CAMPOS, QUE NO ES EL MISMO
162
		Object[] values = new Object[types.length];
163
		values[0] = feat.getGeometry().toJTSGeometry();
164
		for (int i=1; i < types.length; i++)
165
			values[i] = feat.getAttribute(i-1);
166

  
167
		Filter theFilter = filterFactory.createFidFilter(feat.getID());
168
        try {
169
        	// System.out.println("Escribiendo numReg=" + numReg + " con STATUS=" + row.getStatus());
170
        	switch (row.getStatus())
171
        	{
172
        		case IRowEdited.STATUS_ADDED:
173
        			Feature featGT2 = featStore.getSchema().create(values);
174
        			FeatureReader reader = DataUtilities.reader(
175
        					new Feature[] {featGT2});
176
        			featStore.addFeatures(reader);
177
        			break;
178
        		case IRowEdited.STATUS_MODIFIED:
179
        			featStore.modifyFeatures(types, values, theFilter);
180
        			break;
181
        		case IRowEdited.STATUS_ORIGINAL:
182
        			if (bWriteAll)
183
        			{
184
            			featGT2 = featStore.getSchema().create(values);
185
            			reader = DataUtilities.reader(
186
            					new Feature[] {featGT2});
187
            			featStore.addFeatures(reader);
188
        			}
189
        			break;
190
        		case IRowEdited.STATUS_DELETED:
191
            		featStore.removeFeatures(theFilter);
192
        			break;
193
        	}
194

  
195

  
196
			numReg++;
197
		} catch (IOException e) {
198
			throw new ProcessWriterVisitorException(getName(),e);
199
		} catch (IllegalAttributeException e) {
200
			throw new ProcessWriterVisitorException(getName(),e);
201
		}
202

  
203

  
204

  
205

  
206
	}
207

  
208
	/* (non-Javadoc)
209
	 * @see com.iver.cit.gvsig.fmap.edition.IWriter#postProcess()
210
	 */
211
	public void postProcess() throws StopWriterVisitorException  {
212
		try
213
		{
214
			t.commit(); // commit opperations
215
		}
216
		catch (IOException io){
217
			try {
218
				t.rollback();
219
			} catch (IOException e) {
220
				throw new StopWriterVisitorException(getName(),e);
221
			} // cancel opperations
222
		}
223
		finally {
224
			try {
225
				t.close();
226
			} catch (IOException e) {
227
				throw new StopWriterVisitorException(getName(),e);
228
			} // free resources
229
		}
230

  
231
	}
232

  
233
	public String getName() {
234
		return "JDBC Writer from Geotools";
235
	}
236

  
237
	public boolean canWriteGeometry(int gvSIGgeometryType) {
238
		switch (gvSIGgeometryType)
239
		{
240
		case FShape.POINT:
241
			return true;
242
		case FShape.LINE:
243
			return true;
244
		case FShape.POLYGON:
245
			return true;
246
		case FShape.ARC:
247
			return false;
248
		case FShape.ELLIPSE:
249
			return false;
250
		case FShape.MULTIPOINT:
251
			return true;
252
		case FShape.TEXT:
253
			return false;
254
		}
255
		return false;
256
	}
257

  
258
	public boolean canWriteAttribute(int sqlType) {
259
		switch (sqlType)
260
		{
261
		case Types.DOUBLE:
262
		case Types.FLOAT:
263
		case Types.INTEGER:
264
		case Types.BIGINT:
265
			return true;
266
		case Types.DATE:
267
			return true;
268
		case Types.BIT:
269
		case Types.BOOLEAN:
270
			return true;
271
		case Types.VARCHAR:
272
		case Types.CHAR:
273
		case Types.LONGVARCHAR:
274
			return true; // TODO: Revisar esto, porque no creo que admita campos muy grandes
275

  
276
		}
277

  
278
		return false;
279
	}
280

  
281
	public void setFlatness(double flatness) {
282
		// TODO Auto-generated method stub
283

  
284
	}
285

  
286
	public void initialize(ITableDefinition tableDefinition) throws InitializeWriterException {
287
		super.initialize(tableDefinition);
288

  
289
	}
290

  
291
	public boolean canAlterTable() {
292
		// TODO Auto-generated method stub
293
		return false;
294
	}
295

  
296
	public boolean canSaveEdits() {
297
		// TODO Auto-generated method stub
298
		return true;
299
	}
300

  
301
}
0 302

  
tags/tmp_build/extensions/extCAD/src/com/iver/cit/gvsig/writers/WriterGT2Shp.java
1
/**
2
 *
3
 */
4
package com.iver.cit.gvsig.writers;
5

  
6
import java.io.File;
7
import java.io.IOException;
8
import java.net.URL;
9
import java.sql.Types;
10

  
11
import org.geotools.data.DefaultTransaction;
12
import org.geotools.data.FeatureStore;
13
import org.geotools.data.Transaction;
14
import org.geotools.data.shapefile.ShapefileDataStore;
15
import org.geotools.feature.AttributeType;
16
import org.geotools.filter.Filter;
17
import org.geotools.filter.FilterFactory;
18

  
19
import com.hardcode.gdbms.driver.exceptions.InitializeWriterException;
20
import com.iver.cit.gvsig.exceptions.visitors.ProcessWriterVisitorException;
21
import com.iver.cit.gvsig.exceptions.visitors.StartWriterVisitorException;
22
import com.iver.cit.gvsig.exceptions.visitors.StopWriterVisitorException;
23
import com.iver.cit.gvsig.fmap.core.FShape;
24
import com.iver.cit.gvsig.fmap.core.IFeature;
25
import com.iver.cit.gvsig.fmap.drivers.ITableDefinition;
26
import com.iver.cit.gvsig.fmap.drivers.VectorialDriver;
27
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver;
28
import com.iver.cit.gvsig.fmap.edition.IRowEdited;
29
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter;
30
import com.iver.cit.gvsig.fmap.edition.writers.AbstractWriter;
31
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
32

  
33
/**
34
 * @author fjp
35
 *
36
 * Example of using a Geotools dataStore to write ONLY
37
 * the modified features. So: you put the theme in editing mode,
38
 * add, modify or delete features and when you come back to
39
 * non editing mode, the changes will be saved into the original
40
 * shapefile.
41
 *
42
 */
43
public class WriterGT2Shp extends AbstractWriter {
44

  
45
	FilterFactory filterFactory = FilterFactory.createFilterFactory();
46
	FLyrVect lyrVect;
47
	boolean bFromShp;
48
	File file;
49
	FeatureStore featStore;
50
	AttributeType[] types;
51
	Transaction t;
52
	int numReg = 0;
53

  
54
	public WriterGT2Shp(FLyrVect lyrVect) throws IOException
55
	{
56
		this.lyrVect = lyrVect;
57
		VectorialEditableAdapter vea = (VectorialEditableAdapter) lyrVect.getSource();
58
		VectorialDriver vd = vea.getOriginalAdapter().getDriver();
59
		bFromShp = false;
60
		if (vd instanceof VectorialFileDriver)
61
		{
62
			VectorialFileDriver vfd = (VectorialFileDriver) vd;
63
			file = vfd.getFile();
64
			String filePath = file.getAbsolutePath();
65
			if ((filePath.endsWith(".shp"))
66
					|| (filePath.endsWith(".SHP")))
67
			{
68
				bFromShp = true;
69
			}
70
		}
71

  
72
	}
73

  
74
	/* (non-Javadoc)
75
	 * @see com.iver.cit.gvsig.fmap.edition.IWriter#preProcess()
76
	 */
77
	public void preProcess() throws StartWriterVisitorException {
78
//		feature attributes creation
79
		URL theUrl;
80
		try {
81
			theUrl = file.toURL();
82
			ShapefileDataStore dataStore = new ShapefileDataStore(theUrl);
83
			String featureName = dataStore.getTypeNames()[0];
84
			featStore = (FeatureStore) dataStore.getFeatureSource(featureName);
85
			types = featStore.getSchema().getAttributeTypes();
86
			t = new DefaultTransaction("handle");
87
			featStore.setTransaction(t);
88

  
89
			t.addAuthorization("handle");  // provide authoriztion
90

  
91

  
92
			// types = new AttributeType[lyrVect.getRecordset().getFieldCount() +1];
93
		} catch (IOException e) {
94
			throw new StartWriterVisitorException(getName(),e);
95
		}
96

  
97

  
98
	}
99

  
100
	/* (non-Javadoc)
101
	 * @see com.iver.cit.gvsig.fmap.edition.IWriter#process(com.iver.cit.gvsig.fmap.edition.IRowEdited)
102
	 */
103
	public void process(IRowEdited row) throws ProcessWriterVisitorException {
104

  
105
		IFeature feat = (IFeature) row.getLinkedRow();
106
		Object[] values = new Object[types.length];
107
		values[0] = feat.getGeometry().toJTSGeometry();
108
		for (int i=1; i < types.length; i++)
109
			values[i] = feat.getAttribute(i);
110

  
111
		Filter theFilter = filterFactory.createFidFilter(feat.getID());
112
        try {
113

  
114
        	// Aqu? habr?a que mirar si es una modificaci?n, a?adido o borrado
115
        	if ((numReg % 2) == 0)
116
        		featStore.modifyFeatures(types, values, theFilter);
117
        	else
118
        		featStore.removeFeatures(theFilter);
119
			numReg++;
120
		} catch (IOException e) {
121
			throw new ProcessWriterVisitorException(getName(),e);
122
		}
123

  
124

  
125

  
126

  
127
	}
128

  
129
	/* (non-Javadoc)
130
	 * @see com.iver.cit.gvsig.fmap.edition.IWriter#postProcess()
131
	 */
132
	public void postProcess() throws StopWriterVisitorException {
133
		try
134
		{
135
			t.commit(); // commit opperations
136
		}
137
		catch (IOException io){
138
			try {
139
				t.rollback();
140
			} catch (IOException e) {
141
				throw new StopWriterVisitorException(getName(),e);
142
			} // cancel opperations
143
		}
144
		finally {
145
			try {
146
				t.close();
147
			} catch (IOException e) {
148
				throw new StopWriterVisitorException(getName(),e);
149
			} // free resources
150
		}
151

  
152
	}
153

  
154
	public String getName() {
155
		return "Shp Writer from Geotools";
156
	}
157

  
158
	public boolean canWriteGeometry(int gvSIGgeometryType) {
159
		switch (gvSIGgeometryType)
160
		{
161
		case FShape.POINT:
162
			return true;
163
		case FShape.LINE:
164
			return true;
165
		case FShape.POLYGON:
166
			return true;
167
		case FShape.ARC:
168
			return false;
169
		case FShape.ELLIPSE:
170
			return false;
171
		case FShape.MULTIPOINT:
172
			return true;
173
		case FShape.TEXT:
174
			return false;
175
		}
176
		return false;
177
	}
178

  
179
	public boolean canWriteAttribute(int sqlType) {
180
		switch (sqlType)
181
		{
182
		case Types.DOUBLE:
183
		case Types.FLOAT:
184
		case Types.INTEGER:
185
		case Types.BIGINT:
186
			return true;
187
		case Types.DATE:
188
			return true;
189
		case Types.BIT:
190
		case Types.BOOLEAN:
191
			return true;
192
		case Types.VARCHAR:
193
		case Types.CHAR:
194
		case Types.LONGVARCHAR:
195
			return true; // TODO: Revisar esto, porque no creo que admita campos muy grandes
196

  
197
		}
198

  
199
		return false;
200
	}
201

  
202
	public void setFlatness(double flatness) {
203
		// TODO Auto-generated method stub
204

  
205
	}
206

  
207
	public void initialize(ITableDefinition tableDefinition) throws InitializeWriterException {
208
		super.initialize(tableDefinition);
209

  
210
	}
211

  
212
	public boolean canAlterTable() {
213
		// TODO Auto-generated method stub
214
		return false;
215
	}
216

  
217
	public boolean canSaveEdits() {
218
		// TODO Auto-generated method stub
219
		return true;
220
	}
221

  
222
}
0 223

  
tags/tmp_build/extensions/extCAD/src/com/iver/cit/gvsig/MoveGeometryExtension.java
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;
42

  
43
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
44
import com.iver.andami.PluginServices;
45
import com.iver.andami.messages.NotificationManager;
46
import com.iver.andami.plugins.Extension;
47
import com.iver.cit.gvsig.fmap.MapControl;
48
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
49
import com.iver.cit.gvsig.gui.cad.tools.MoveCADTool;
50

  
51
/**
52
 * Extensi?n que gestiona la herramienta de mover.
53
 *
54
 * @author Vicente Caballero Navarro
55
 */
56
public class MoveGeometryExtension extends Extension {
57

  
58
	private MapControl mapControl;
59
	private MoveCADTool move;
60
	/**
61
	 * @see com.iver.andami.plugins.IExtension#initialize()
62
	 */
63
	public void initialize() {
64
		move=new MoveCADTool();
65
		CADExtension.addCADTool("_move",move);
66
		
67
		registerIcons();
68
	}
69

  
70
	private void registerIcons(){
71
		PluginServices.getIconTheme().registerDefault(
72
				"edition-geometry-move",
73
				this.getClass().getClassLoader().getResource("images/Move.png")
74
			);
75
	}
76
	/**
77
	 * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
78
	 */
79
	public void execute(String s) {
80
		CADExtension.initFocus();
81
		 if (s.equals("_move")) {
82
			 CADExtension.setCADTool("_move",true);
83
	        }
84
		CADExtension.getEditionManager().setMapControl(mapControl);
85
		CADExtension.getCADToolAdapter().configureMenu();
86
	}
87

  
88
	/**
89
	 * @see com.iver.andami.plugins.IExtension#isEnabled()
90
	 */
91
	public boolean isEnabled() {
92
		if (CADExtension.getEditionManager().getActiveLayerEdited()==null)
93
			return false;
94
		FLyrVect lv=(FLyrVect)CADExtension.getEditionManager().getActiveLayerEdited().getLayer();
95
		try {
96
			return move.isApplicable(lv.getShapeType());
97
		} catch (ReadDriverException e) {
98
			NotificationManager.addError(e.getMessage(),e);
99
		}
100
		return false;
101
	}
102

  
103
	/**
104
	 * @see com.iver.andami.plugins.IExtension#isVisible()
105
	 */
106
	public boolean isVisible() {
107
		if (EditionUtilities.getEditionStatus() == EditionUtilities.EDITION_STATUS_ONE_VECTORIAL_LAYER_ACTIVE_AND_EDITABLE){
108
			return true;
109
		}
110
		return false;
111
	}
112
}
0 113

  
tags/tmp_build/extensions/extCAD/src/com/iver/cit/gvsig/layers/DefaultLayerEdited.java
1
package com.iver.cit.gvsig.layers;
2

  
3
import com.iver.cit.gvsig.fmap.layers.FLayer;
4

  
5
/**
6
 * @author fjp
7
 * 
8
 * Clase padre de las capas en edici?n, por si alguna vez
9
 * necesitamos editar Raster
10
 */
11
public class DefaultLayerEdited implements ILayerEdited {
12
	private FLayer lyr;
13
	
14
	public DefaultLayerEdited(FLayer lyr)
15
	{
16
		this.lyr = lyr;
17
	}
18
	
19
	/* (non-Javadoc)
20
	 * @see com.iver.cit.gvsig.ILayerEdited#getLayer()
21
	 */
22
	public FLayer getLayer() {
23
		return lyr;
24
	}
25
}
0 26

  
tags/tmp_build/extensions/extCAD/src/com/iver/cit/gvsig/layers/FactoryLayerEdited.java
1
package com.iver.cit.gvsig.layers;
2

  
3
import com.iver.cit.gvsig.fmap.layers.FLayer;
4
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
5

  
6
public class FactoryLayerEdited {
7

  
8
	public static ILayerEdited createLayerEdited(FLayer lyr) {
9
		if (lyr instanceof FLyrVect)
10
			return new VectorialLayerEdited(lyr);
11
		return null;
12
	}
13

  
14
}
0 15

  
tags/tmp_build/extensions/extCAD/src/com/iver/cit/gvsig/layers/ILayerEdited.java
1
package com.iver.cit.gvsig.layers;
2

  
3
import com.iver.cit.gvsig.fmap.layers.FLayer;
4

  
5
public interface ILayerEdited {
6

  
7
	/**
8
	 * @return Returns the lyr.
9
	 */
10
	public FLayer getLayer();
11
	
12

  
13
}
0 14

  
tags/tmp_build/extensions/extCAD/src/com/iver/cit/gvsig/layers/VectorialLayerEdited.java
1
package com.iver.cit.gvsig.layers;
2

  
3
import java.awt.Graphics2D;
4
import java.awt.Image;
5
import java.awt.geom.Point2D;
6
import java.awt.geom.Rectangle2D;
7
import java.awt.image.BufferedImage;
8
import java.util.ArrayList;
9
import java.util.EmptyStackException;
10

  
11
import org.cresques.cts.ICoordTrans;
12

  
13
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
14
import com.iver.andami.PluginServices;
15
import com.iver.andami.messages.NotificationManager;
16
import com.iver.andami.ui.mdiManager.IWindow;
17
import com.iver.cit.gvsig.CADExtension;
18
import com.iver.cit.gvsig.StartEditing;
19
import com.iver.cit.gvsig.ViewCommandStackExtension;
20
import com.iver.cit.gvsig.fmap.ViewPort;
21
import com.iver.cit.gvsig.fmap.core.DefaultFeature;
22
import com.iver.cit.gvsig.fmap.core.Handler;
23
import com.iver.cit.gvsig.fmap.core.IFeature;
24
import com.iver.cit.gvsig.fmap.core.IGeometry;
25
import com.iver.cit.gvsig.fmap.core.v02.FGraphicUtilities;
26
import com.iver.cit.gvsig.fmap.edition.DefaultRowEdited;
27
import com.iver.cit.gvsig.fmap.edition.IEditableSource;
28
import com.iver.cit.gvsig.fmap.edition.IRowEdited;
29
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter;
30
import com.iver.cit.gvsig.fmap.layers.CancelationException;
31
import com.iver.cit.gvsig.fmap.layers.FBitSet;
32
import com.iver.cit.gvsig.fmap.layers.FLayer;
33
import com.iver.cit.gvsig.fmap.layers.FLyrAnnotation;
34
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
35
import com.iver.cit.gvsig.fmap.layers.LayerDrawEvent;
36
import com.iver.cit.gvsig.fmap.layers.LayerDrawingListener;
37
import com.iver.cit.gvsig.fmap.layers.LayerEvent;
38
import com.iver.cit.gvsig.fmap.layers.SelectionEvent;
39
import com.iver.cit.gvsig.fmap.layers.SelectionListener;
40
import com.iver.cit.gvsig.fmap.rendering.ILegend;
41
import com.iver.cit.gvsig.gui.cad.CADTool;
42
import com.iver.cit.gvsig.gui.cad.CADToolAdapter;
43
import com.iver.cit.gvsig.gui.cad.DefaultCADTool;
44
import com.iver.cit.gvsig.gui.cad.tools.SelectionCADTool;
45
import com.iver.cit.gvsig.project.documents.view.gui.View;
46
import com.vividsolutions.jts.geom.Geometry;
47

  
48
public class VectorialLayerEdited extends DefaultLayerEdited implements LayerDrawingListener, SelectionListener{
49
	private ArrayList selectedHandler = new ArrayList();
50
	private ArrayList selectedRow = new ArrayList();
51
	private Point2D lastPoint;
52
	private Point2D firstPoint;
53
	private CADTool cadtool=null;
54

  
55
	private ArrayList snappers = new ArrayList();
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff