Statistics
| Revision:

gvsig-vectorediting / org.gvsig.vectorediting / trunk / org.gvsig.vectorediting / org.gvsig.vectorediting.swing / org.gvsig.vectorediting.swing.api / src / main / java / org / gvsig / vectorediting / swing / api / EditingContext.java @ 4306

History | View | Annotate | Download (4.73 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2014 gvSIG Association
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24

    
25
package org.gvsig.vectorediting.swing.api;
26

    
27
import java.lang.ref.WeakReference;
28
import org.gvsig.expressionevaluator.SymbolTable;
29
import org.gvsig.fmap.geom.primitive.Point;
30
import org.gvsig.fmap.geom.type.GeometryType;
31
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
32
import org.gvsig.fmap.mapcontrol.MapControl;
33
import org.gvsig.fmap.mapcontrol.tools.Behavior.Behavior;
34
import org.gvsig.tools.observer.Observable;
35
import org.gvsig.vectorediting.lib.api.EditingService;
36
import org.gvsig.vectorediting.lib.api.EditingServiceParameter;
37
import org.gvsig.vectorediting.lib.api.exceptions.InvalidEntryException;
38
import org.gvsig.vectorediting.lib.api.exceptions.ParsePointException;
39
import org.gvsig.vectorediting.swing.api.console.EditingConsole;
40

    
41
public interface EditingContext extends Observable {
42

    
43
    static final int CANCEL = 0;
44
    static final int DISCARD_CHANGES = 1;
45
    static final int EXPORT_LAYER = 2;
46
    static final int SAVE_CHANGES = 3;
47
    
48
    static final String DEFAULT_TOOL = "default_tool";
49
    static final String DEFAULT_TOOL_NAME = "pointSelection";
50
    static final String DEFAULT_ACTION_NAME = "selection-simple-select-view";
51
    static final String VECTOREDITING_TOOL_NAME = "VectorEditing";
52

    
53
    static final String CHANGE_SELECTED_TOOL_NOTIFICATION = "EditingContext.changeSelectedTool";
54
    static final String REFRESH_TOOLS_NOTIFICATION = "EditingContext.refreshTools";
55
    static final String EXPORT_LAYER_NOTIFICATION = "EditingContext.exportLayer";
56
    static final String DRAWING_STATUS_NOTIFICATION = "EditingContext.drawingStatus";
57
    
58
    static final int DRAWMODE_NORMAL = 0;
59
    static final int DRAWMODE_ORTO = 1;
60

    
61
    /**
62
     * Activates service as of name and {@link MapControl}
63
     *
64
     * @param name
65
     *            of service
66
     * @param mapControl
67
     *            of
68
     */
69
    public void activateService(String name);
70

    
71
    /**
72
      * @deprecated Use {@link EditingContext#beginEdition(FLyrVect)}
73
     */
74
    public void beginEdition(FLyrVect layer, Behavior[] additionalBehaviors);
75
    
76
    /**
77
     * Begins edition of a layer
78
     *
79
     * @param layer
80
     *            to begin edition
81
     */
82
    public void beginEdition(FLyrVect layer);
83

    
84
    /**
85
     * Ends edition of a layer 
86
     *
87
     * @param layer
88
     *            to end edition
89
     */
90
    public void endEdition(FLyrVect layer);
91

    
92
    /**
93
     * Gets mapControl object. It is referenced by {@link WeakReference}.
94
     *
95
     * @return
96
     */
97
    public MapControl getMapControl();
98

    
99
    /**
100
     *
101
     * @param name
102
     * @return
103
     */
104
    public boolean isServiceCompatible(String name);
105

    
106
    /**
107
     * Updates the weak reference at editing context.
108
     *
109
     * @param mapControl
110
     */
111
    public void setMapControl(MapControl mapControl);
112

    
113

    
114
    public Behavior[] getDefaultBehaviors();
115

    
116
    public void setDefaultBehaviors(Behavior[] defaultBehaviors);
117
    
118
    /**
119
     *
120
     * @param parameter
121
     * @param value
122
     * @throws InvalidEntryException
123
     */
124
    public void setValue(EditingServiceParameter parameter, Object value) throws InvalidEntryException;
125
   
126
    /**
127
     * 
128
     * @param parameter
129
     * @param value
130
     * @param next If true call nextParameter method
131
     * @throws InvalidEntryException 
132
     */
133
    public void setValue(EditingServiceParameter parameter, Object value, boolean next) throws InvalidEntryException;
134
    
135
    public EditingService getActiveService();
136
    
137
    public Point parsePoint(String coordinates) throws ParsePointException;
138

    
139
    public GeometryType getGeometryType();
140
    
141
    public SymbolTable getContextSymbolTable();
142
    
143
    public EditingConsole getConsolePanel();
144

    
145
    public void nextParameter();
146
    
147
    public void cancelActiveService();
148
    
149
    public boolean isProcessing();
150
    
151
    public int getDrawMode();
152
    
153
    public void setDrawMode(int mode);
154
    
155
}