01: /*
02: * uDig - User Friendly Desktop Internet GIS client http://udig.refractions.net (C) 2004,
03: * Refractions Research Inc. This library is free software; you can redistribute it and/or modify it
04: * under the terms of the GNU Lesser General Public License as published by the Free Software
05: * Foundation; version 2.1 of the License. This library is distributed in the hope that it will be
06: * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
07: * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
08: */
09: package net.refractions.udig.project.command;
10:
11: import net.refractions.udig.project.ILayer;
12: import net.refractions.udig.project.IMap;
13: import net.refractions.udig.project.internal.Layer;
14: import net.refractions.udig.project.internal.Map;
15: import net.refractions.udig.project.internal.commands.AddLayerCommand;
16: import net.refractions.udig.project.internal.commands.ChangeCRSCommand;
17: import net.refractions.udig.project.internal.commands.DeleteLayerCommand;
18:
19: import org.opengis.referencing.crs.CoordinateReferenceSystem;
20:
21: /**
22: * Creates Edit commands which must be used to modify editable feature data. API internal classes
23: * are in the returned API
24: *
25: * @author jeichar
26: * @deprecated
27: * @since 0.3
28: */
29: public class BasicCommandFactory {
30: /**
31: * Creates a new EditCommandFactory object
32: *
33: * @return a new EditCommandFactory object
34: */
35: public static BasicCommandFactory getInstance() {
36: return instance;
37: }
38:
39: private static final BasicCommandFactory instance = new BasicCommandFactory();
40:
41: protected BasicCommandFactory() {
42: // no op
43: }
44:
45: /**
46: * Create a delete layer command
47: *
48: * @param map the map containing the layer
49: * @param layer the layer to delete
50: * @return a new {@linkplain DeleteLayerCommand}object that deletes the layer.
51: * @see DeleteLayerCommand
52: */
53: public UndoableMapCommand createDeleteLayer(ILayer layer) {
54: return new DeleteLayerCommand((Layer) layer);
55: }
56:
57: /**
58: * Create an Add Layer command
59: *
60: * @param layer the layer to add to the map.
61: * @return a new {@linkplain AddLayerCommand}object that deletes the feature.
62: * @see AddLayerCommand
63: */
64: public UndoableMapCommand createAddLayer(ILayer layer) {
65: return new AddLayerCommand((Layer) layer);
66: }
67:
68: /**
69: * Create an Add Layer command
70: *
71: * @param layer the layer to add to the map.
72: * @param index the zorder where the layer will be added.
73: * @return a new {@linkplain AddLayerCommand}object that deletes the feature.
74: * @see AddLayerCommand
75: */
76: public UndoableMapCommand createAddLayer(ILayer layer, int index) {
77: return new AddLayerCommand((Layer) layer, index);
78: }
79:
80: /**
81: * Create a Change CRS command
82: *
83: * @param map the map for which the CRS is going to change.
84: * @return a new {@linkplain ChangeCRSCommand}object that changes the CRS.
85: * @see ChangeCRSCommand
86: */
87: public UndoableMapCommand createChangeCRS(IMap map,
88: CoordinateReferenceSystem crs) {
89: return new ChangeCRSCommand((Map) map, crs);
90: }
91:
92: }
|