Revision 38705

View differences:

branches/v2_0_0_prep/extensions/extEditing/config/text.properties
14 14
calculate_expresion=Calcular expresi?n
15 15
cancel=Cancelar
16 16
cancelar_edicion=Cancelar edici\u00f3n
17
Capa=Capa
17
Layer=Capa
18 18
capas_edition_cache=Por favor, marque las capas que va a usar para hacer snapping.
19 19
circle=C\u00edrculo
20 20
circle_=C\u00cdRCULO
branches/v2_0_0_prep/extensions/extEditing/config/text_zh.properties
10 10
break_=Break
11 11
cancel=\u53d6\u6d88
12 12
cancelar_edicion=\u53d6\u6d88\u7f16\u8f91
13
Capa=\u56fe\u5c42
13
Layer=\u56fe\u5c42
14 14
capas_edition_cache=\u8bf7\u70b9\u9009\u5728\u8fd0\u884c snapping \u65f6\u6240\u7528\u7684\u56fe\u5c42\u3002
15 15
circle=\u5706\u5f62
16 16
circle_=\u5706\u5f62
branches/v2_0_0_prep/extensions/extEditing/config/text_en.properties
14 14
calculate_expresion=Calculate expresion
15 15
cancel=Cancel
16 16
cancelar_edicion=Cancel edition
17
Capa=Layer
17
Layer=Layer
18 18
capas_edition_cache=Mark the layers to be used for snapping
19 19
change_the_editing_colors=Change the editing colors.
20 20
circle=Circle
branches/v2_0_0_prep/extensions/extEditing/config/text_gl.properties
10 10
break_=Break
11 11
cancel=Cancelar
12 12
cancelar_edicion=
13
Capa=Capa
13
Layer=Capa
14 14
capas_edition_cache=
15 15
circle=
16 16
circle_=C\u00cdRCULO
branches/v2_0_0_prep/extensions/extEditing/config/text_ca.properties
10 10
break_=Break
11 11
cancel=Cancel\u00b7lar
12 12
cancelar_edicion=
13
Capa=Capa
13
Layer=Capa
14 14
capas_edition_cache=
15 15
circle=Cercle
16 16
circle_=CERCLE
branches/v2_0_0_prep/extensions/extEditing/config/text_pt.properties
10 10
break_=Break
11 11
cancel=Cancelar
12 12
cancelar_edicion=
13
Capa=Capa
13
Layer=Capa
14 14
capas_edition_cache=
15 15
circle=
16 16
circle_=
branches/v2_0_0_prep/extensions/extEditing/config/config.xml
7 7
	<resourceBundle name="text"/>
8 8
	<extensions>
9 9

  
10
		<extension class-name="org.gvsig.editing.StartEditing"
11
			description="Extensi?n encargada de comenzar la edici?n sobre la capa activa."
12
			active="true">
13

  
14
            <action 
15
                name="layer-start-editing"
16
                label="start_edition" 
17
                tooltip="start_edition" 
18
                position="600700000" 
19
                action-command="layer-start-editing"
20
                icon="layer-start-editing"
21
                accelerator=""
22
                />
23
            <menu
24
                name="layer-start-editing" 
25
                text="Layer/start_edition"
26
                />
27
		</extension>
28

  
29
		<extension class-name="org.gvsig.editing.StopEditing"
30
			description="Extensi?n encargada de terminar la edici?n sobre la capa activa y guardarla sobre s? misma."
31
			active="true">
32

  
33
            <action 
34
                name="layer-stop-editing"
35
                label="stop_edition" 
36
                tooltip="stop_edition" 
37
                position="600800000" 
38
                action-command="layer-stop-editing"
39
                icon="layer-stop-editing"
40
                accelerator=""
41
                />
42
            <menu
43
                name="layer-stop-editing" 
44
                text="Layer/stop_edition"
45
                />
46
		</extension>	
47
		
48
		
49

  
10 50
		<extension class-name="org.gvsig.editing.UndoViewExtension"
11 51
			description="Extensi?n encargada de dehacer la edici?n sobre la capa activa."
12 52
			active="true" >
branches/v2_0_0_prep/extensions/extEditing/config/text_cs.properties
10 10
break_=P\u0158ERU\u0160IT
11 11
cancel=Zru\u0161it
12 12
cancelar_edicion=Zru\u0161 editaci
13
Capa=Vrstva
13
Layer=Vrstva
14 14
capas_edition_cache=Ozna\u010d vrstvy, kter\u00e9 maj\u00ed b\u00fdt pou\u017eity pro p\u0159ichyt\u00e1van\u00ed.
15 15
circle=Kruh
16 16
circle_=KRUH
branches/v2_0_0_prep/extensions/extEditing/config/text_fr.properties
10 10
break_=Break
11 11
cancel=Annuler
12 12
cancelar_edicion=
13
Capa=Couche
13
Layer=Couche
14 14
capas_edition_cache=
15 15
circle=Cercle
16 16
circle_=Cercle
branches/v2_0_0_prep/extensions/extEditing/config/text_de.properties
10 10
break_=Break
11 11
cancel=Abbrechen
12 12
cancelar_edicion=
13
Capa=Layer
13
Layer=Layer
14 14
capas_edition_cache=
15 15
circle=
16 16
circle_=
branches/v2_0_0_prep/extensions/extEditing/config/text_eu.properties
10 10
break_=Break
11 11
cancel=Utzi
12 12
cancelar_edicion=
13
Capa=Geruza
13
Layer=Geruza
14 14
capas_edition_cache=
15 15
circle=Zirkulua
16 16
circle_=ZIRKULUA
branches/v2_0_0_prep/extensions/extEditing/config/text_it.properties
10 10
break_=Break
11 11
cancel=Cancella
12 12
cancelar_edicion=Termina editing
13
Capa=Layer
13
Layer=Layer
14 14
capas_edition_cache=Marcare i layer da utilizzare per lo snapping
15 15
circle=Cerchio
16 16
circle_=CERCHIO
branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/StartEditing.java
56 56
	/**
57 57
	 * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
58 58
	 */
59
	public void execute(String actionCommand) {
60
	    
61
		org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
62
		.getActiveWindow();
59
    public void execute(String actionCommand) {
63 60

  
64
		if (f instanceof DefaultViewPanel) {
65
			DefaultViewPanel vista = (DefaultViewPanel) f;
61
        if (actionCommand.compareTo("layer-start-editing") == 0) {
66 62

  
67
			MapControl mapControl = vista.getMapControl();
68
			ViewDocument model = vista.getModel();
69
			FLayer[] actives = model.getMapContext().getLayers().getActives();
63
            org.gvsig.andami.ui.mdiManager.IWindow f =
64
                PluginServices.getMDIManager().getActiveWindow();
70 65

  
71
			// boolean bEditingStarted = false;
72
			if (actives.length == 1 &&	actives[0] instanceof FLyrVect) {
66
            if (f instanceof DefaultViewPanel) {
67
                DefaultViewPanel vista = (DefaultViewPanel) f;
73 68

  
74
			    FLyrVect lv = (FLyrVect) actives[0];
75
			    
76
			    if (!lv.getFeatureStore().getTransforms().isEmpty()) {
77
			        
78
			        // cannot edit transformed
79
                    JOptionPane.showMessageDialog(
80
                        (Component) f,
81
                        Messages.get("_Cannot_start_edition_in_transformed_layer")
82
                        + ": '" + lv.getName() + "'",
83
                        PluginServices.getText(this, "warning_title"),
84
                        JOptionPane.INFORMATION_MESSAGE);
85
	                 return;
86
			    }
69
                MapControl mapControl = vista.getMapControl();
70
                ViewDocument model = vista.getModel();
71
                FLayer[] actives =
72
                    model.getMapContext().getLayers().getActives();
87 73

  
88
			    CADExtension.initFocus();
89
				vista.showConsole();
90
				EditionManager editionManager=CADExtension.getEditionManager();
91
				editionManager.setMapControl(mapControl);
92
				/*
93
				 * for (int j = 0; j < i; j++) {
94
				 * layers.getLayer(j).setVisible(false); }
95
				 */
74
                if (actives.length == 1 && actives[0] instanceof FLyrVect) {
96 75

  
97
				// lv.setVisible(true);
98
				lv.addLayerListener(editionManager);
99
				try {
100
					// ILegend legendOriginal=lv.getLegend().cloneLegend();
76
                    FLyrVect lv = (FLyrVect) actives[0];
101 77

  
102
					if (!lv.isWritable())
103
					{
104
						JOptionPane.showMessageDialog(
105
								(Component) f,
106
								PluginServices.getText(this, "this_layer_is_not_self_editable"),
107
								PluginServices.getText(this, "warning_title"),
108
								JOptionPane.WARNING_MESSAGE);
109
					}
78
                    if (!lv.getFeatureStore().getTransforms().isEmpty()) {
110 79

  
111
					lv.setEditing(true);
112
//					FeatureType featureType=lv.getFeatureStore().getDefaultFeatureType();
113
//					featureType.getRules().clear();
114
//					if (lv.getShapeType()==Geometry.TYPES.SURFACE){
115
//						FeatureRule rulePol = new FeatureRulePolygon("PolygonRule", "Sentido correcto de un pol?gono");
116
//						featureType.addRule(rulePol);
117
//					}
80
                        // cannot edit transformed
81
                        JOptionPane
82
                            .showMessageDialog(
83
                                (Component) f,
84
                                Messages
85
                                    .get("_Cannot_start_edition_in_transformed_layer")
86
                                    + ": '" + lv.getName() + "'",
87
                                PluginServices.getText(this, "warning_title"),
88
                                JOptionPane.INFORMATION_MESSAGE);
89
                        return;
90
                    }
118 91

  
119
//					if (!(lv.getSource().getDriver() instanceof IndexedShpDriver)){
120
//						VectorialLayerEdited vle=(VectorialLayerEdited)editionManager.getLayerEdited(lv);
121
//						vle.setLegend(legendOriginal);
122
//					}
123
					lv.getFeatureStore().addObserver(mapControl);
124
//					vea.getCommandRecord().addCommandListener(mapControl);
125
					// Si existe una tabla asociada a esta capa se cambia su
126
					// modelo por el VectorialEditableAdapter.
127
					ProjectExtension pe = (ProjectExtension) PluginServices
128
					.getExtension(ProjectExtension.class);
92
                    CADExtension.initFocus();
93
                    vista.showConsole();
94
                    EditionManager editionManager =
95
                        CADExtension.getEditionManager();
96
                    editionManager.setMapControl(mapControl);
129 97

  
130
					startCommandsApplicable(vista,lv);
131
					vista.repaintMap();
98
                    lv.addLayerListener(editionManager);
99
                    try {
100
                        if (!lv.isWritable()) {
101
                            JOptionPane.showMessageDialog((Component) f,
102
                                PluginServices.getText(this,
103
                                    "this_layer_is_not_self_editable"),
104
                                PluginServices.getText(this, "warning_title"),
105
                                JOptionPane.WARNING_MESSAGE);
106
                        }
107
                        lv.setEditing(true);
108
                        lv.getFeatureStore().addObserver(mapControl);
109
                        startCommandsApplicable(vista, lv);
110
                        vista.repaintMap();
132 111

  
133
				} catch (StartEditionLayerException e) {
134
				    
135
				    logger.info("Error while starting edition: " + e.getMessage(), e);
112
                    } catch (StartEditionLayerException e) {
136 113

  
137
				    ApplicationLocator.getManager().message(
138
				        Messages.get("_Unable_to_start_edition_in_layer") + ": " + lv.getName(),
139
				        JOptionPane.ERROR_MESSAGE);
140
				    
141
					// NotificationManager.addError(e.getMessage(),e);
142
//				} catch (ReadException e) {
143
//					NotificationManager.addError(e.getMessage(),e);
144
//				} catch (DataException e) {
145
//					NotificationManager.addError(e.getMessage(),e);
146
				}
114
                        logger.info(
115
                            "Error while starting edition: " + e.getMessage(),
116
                            e);
147 117

  
148
//				return;
149
			}
150
		}
118
                        ApplicationLocator.getManager().message(
119
                            Messages.get("_Unable_to_start_edition_in_layer")
120
                                + ": " + lv.getName(),
121
                            JOptionPane.ERROR_MESSAGE);
122
                    }
123
                }
124
            }
125
        }
126
    }
151 127

  
152
		/*
153
		 * PluginServices.getMDIManager().setWaitCursor(); try { if
154
		 * (((FLyrVect) capa).getSource().getDriver().getClass() ==
155
		 * DXFCadDriver.class) { if (JOptionPane.showConfirmDialog(
156
		 * (Component) PluginServices.getMainFrame(), "Todas las geometr?as
157
		 * del formato DXF no se pueden editar, de momento podemos editar:
158
		 * Line, Point, Polyline, Arc, Circle y Ellipse. \n El resto de
159
		 * geometr?as se perder?n con la edici?n. \n ?Desea continuar?") ==
160
		 * JOptionPane.YES_OPTION) { capa.startEdition();
161
		 * vista.getMapControl().setCadTool("selection"); } else { } } else {
162
		 * capa.startEdition();
163
		 * vista.getMapControl().setCadTool("selection"); } } catch
164
		 * (EditionException e) { // TODO Auto-generated catch block
165
		 * e.printStackTrace(); }
166
		 * PluginServices.getMDIManager().restoreCursor();
167
		 */
168
		// vista.getMapControl().drawMap(false);
169
	}
170

  
171 128
//	 private void registerKeyStrokes() {
172 129
//		 JComponent theComponent = vista.getConsolePanel().getTxt();
173 130
//
branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/project/documents/view/toc/actions/StopEditingTocMenuEntry.java
40 40

  
41 41
	public void execute(ITocItem item, FLayer[] selectedItems) {
42 42
		StopEditing stopEditind=(StopEditing)PluginServices.getExtension(StopEditing.class);
43
		stopEditind.execute("STOPEDITING");
43
		stopEditind.execute("layer-stop-editing");
44 44
		PluginServices.getMainFrame().enableControls();
45 45
   }
46 46
}
branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/project/documents/view/toc/actions/StartEditingTocMenuEntry.java
46 46

  
47 47
	public void execute(ITocItem item, FLayer[] selectedItems) {
48 48
		StartEditing startEditind=(StartEditing)PluginServices.getExtension(StartEditing.class);
49
		startEditind.execute("STARTEDITING");
49
		startEditind.execute("layer-start-editing");
50 50
		PluginServices.getMainFrame().enableControls();
51 51
   }
52 52
}
branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/StopEditing.java
67 67
		MapContext mapa = model.getMapContext();
68 68
		FLayers layers = mapa.getLayers();
69 69
		EditionManager edMan = CADExtension.getEditionManager();
70
		if (s.equals("STOPEDITING")) {
70

  
71
		if (s.equals("layer-stop-editing")) {
71 72
			vista.getMapControl().getCanceldraw().setCanceled(true);
72 73
			FLayer[] actives = layers.getActives();
73 74
			// TODO: Comprobar que solo hay una activa, o al menos

Also available in: Unified diff