Revision 40728

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.editing.app/org.gvsig.editing.app.mainplugin/src/main/java/org/gvsig/editing/gui/cad/tools/AutoCompletePolygon.java
23 23
 */
24 24
package org.gvsig.editing.gui.cad.tools;
25 25

  
26
import javax.swing.JOptionPane;
27

  
26 28
import org.gvsig.andami.PluginServices;
27 29
import org.gvsig.andami.messages.NotificationManager;
30
import org.gvsig.app.ApplicationLocator;
28 31
import org.gvsig.fmap.dal.feature.Feature;
29 32
import org.gvsig.fmap.dal.feature.FeatureSet;
30 33
import org.gvsig.fmap.geom.Geometry;
......
32 35
import org.gvsig.fmap.geom.primitive.GeneralPathX;
33 36
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
34 37
import org.gvsig.fmap.mapcontrol.MapControlDrawer;
38
import org.gvsig.i18n.Messages;
35 39
import org.gvsig.tools.dispose.DisposableIterator;
40
import org.slf4j.Logger;
41
import org.slf4j.LoggerFactory;
36 42

  
37 43
public class AutoCompletePolygon extends PolylineCADTool {
38 44

  
39
    @Override
45
	private static Logger logger =
46
			LoggerFactory.getLogger(AutoCompletePolygon.class);
40 47
    /**
41 48
     * M?todo para dibujar la lo necesario para el estado en el que nos
42 49
     * encontremos.
......
87 94
                digitizedGeom = digitizedGeom.difference(aux);
88 95
            }
89 96
        } catch (Exception e) {
90
            NotificationManager.showMessageError(
91
                PluginServices.getText(this,
92
                    "Error_in_Autocomplete_Polygon_Tool_")
93
                    + " "
94
                    + e.getLocalizedMessage(), e);
97
        	
98
        	throw new CreateGeometryException(
99
        			digitizedGeom.getGeometryType().getType(),
100
        			digitizedGeom.getGeometryType().getSubType(), e);
95 101
        } finally {
96 102
            if (iterator != null) {
97 103
                iterator.dispose();
......
103 109

  
104 110
        return digitizedGeom;
105 111
    }
106

  
107
    @Override
112
    
108 113
    public Feature insertGeometry(Geometry geometry) {
109 114
        Geometry newGeom;
110 115
        try {
111 116
            newGeom = autoComplete(geometry);
112 117
            return super.insertGeometry(newGeom);
113 118
        } catch (CreateGeometryException e) {
114
            NotificationManager.addError(e);
119
            logger.info("Error in autocomplete polygon.", e);
120
        	JOptionPane.showMessageDialog(
121
        			ApplicationLocator.getManager().getRootComponent(),
122
        			Messages.getText(
123
        					"_Unable_to_complete_operation_Probably_invalid_polygon"),
124
        			Messages.getText("autocomplete-polygon"),
125
        			JOptionPane.ERROR_MESSAGE);
115 126
        }
116 127
        return null;
117 128
    }
129

  
130
    public Feature insertAndSelectGeometry(Geometry geometry) {
131
        Geometry newGeom;
132
        try {
133
            newGeom = autoComplete(geometry);
134
            return super.insertAndSelectGeometry(newGeom);
135
        } catch (CreateGeometryException e) {
136
        	
137
            logger.info("Error in autocomplete polygon.", e);
138
        	JOptionPane.showMessageDialog(
139
        			ApplicationLocator.getManager().getRootComponent(),
140
        			Messages.getText(
141
        					"_Unable_to_complete_operation_Probably_invalid_polygon"),
142
        			Messages.getText("autocomplete-polygon"),
143
        			JOptionPane.ERROR_MESSAGE);
144
        	
145
        }
146
        return null;
147
    }
148
    
118 149
}
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.editing.app/org.gvsig.editing.app.mainplugin/src/main/resources-plugin/i18n/text.properties
401 401
_No_features_found_in_clipboard=No se han encontrado elementos en el portapapeles
402 402
_Unable_to_save_edits_The_cause_is=No es posible guardar los cambios. La causa es
403 403
_Include_alphanumeric_attributes_Question=?Incluir campos alfanum?ricos?
404
_Unable_to_complete_operation_Probably_invalid_polygon=No se pudo realizar la operaci?n. Quiz? se ha digitalizado un pol?gono no v?lido.
404 405

  
405 406

  
407

  
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.editing.app/org.gvsig.editing.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
398 398
_No_features_found_in_clipboard=No features found in clipboard
399 399
_Unable_to_save_edits_The_cause_is=Unable to save edits. The cause is
400 400
_Include_alphanumeric_attributes_Question=Include alphanumeric attributes?
401
_Unable_to_complete_operation_Probably_invalid_polygon=Unable to complete operation. Probably due to invalid input polygon.
401 402

  
402 403

  
403 404

  

Also available in: Unified diff