Statistics
| Revision:

gvsig-vectorediting / org.gvsig.vectorediting / trunk / org.gvsig.vectorediting / org.gvsig.vectorediting.lib / org.gvsig.vectorediting.lib.prov / org.gvsig.vectorediting.lib.prov.circlecr / src / main / java / org / gvsig / vectorediting / lib / prov / circlecr / CircleCREditingProviderFactory.java @ 322

History | View | Annotate | Download (2.92 KB)

1 159 llmarques
/**
2
 * gvSIG. Desktop Geographic Information System.
3 41 fdiaz
 *
4 159 llmarques
 * 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 28 llmarques
 */
24 159 llmarques
25 47 fdiaz
package org.gvsig.vectorediting.lib.prov.circlecr;
26 28 llmarques
27 29 llmarques
import org.gvsig.fmap.geom.Geometry;
28 28 llmarques
import org.gvsig.tools.ToolsLocator;
29
import org.gvsig.tools.dynobject.DynClass;
30
import org.gvsig.tools.dynobject.DynObject;
31
import org.gvsig.tools.service.spi.AbstractProviderFactory;
32
import org.gvsig.tools.service.spi.Provider;
33
import org.gvsig.tools.service.spi.ProviderServices;
34
import org.gvsig.vectorediting.lib.api.EditingServiceInfo;
35 29 llmarques
import org.gvsig.vectorediting.lib.spi.DefaultEditingServiceinfo;
36 28 llmarques
import org.gvsig.vectorediting.lib.spi.EditingProviderFactory;
37
38 47 fdiaz
public class CircleCREditingProviderFactory extends AbstractProviderFactory
39 227 llmarques
implements EditingProviderFactory {
40 29 llmarques
41 159 llmarques
    public static final String PROVIDER_NAME = "insert-circle-cr";
42 28 llmarques
43 159 llmarques
    private final static String PROVIDER_DESCRIPTION =
44
        "Creates circles from the center and radius";
45 41 fdiaz
46 159 llmarques
    public void initialize() {
47 88 fdiaz
48 159 llmarques
    }
49 28 llmarques
50 159 llmarques
    public EditingServiceInfo getServiceInfo() {
51
        EditingServiceInfo serviceInfo =
52
            new DefaultEditingServiceinfo(
53
                PROVIDER_NAME,
54
                "",
55
                true,
56
                null,
57
                new int[] { Geometry.TYPES.SURFACE, Geometry.TYPES.MULTISURFACE });
58 41 fdiaz
59 159 llmarques
        return serviceInfo;
60
    }
61 28 llmarques
62 159 llmarques
    @Override
63
    protected Provider doCreate(DynObject parameters, ProviderServices services) {
64
        return new CircleCREditingProvider(services, parameters);
65
    }
66 29 llmarques
67 227 llmarques
    @Override
68 159 llmarques
    public DynObject createParameters() {
69
        DynObject parameters = super.createParameters();
70
        parameters.setDynValue(PROVIDER_NAME_FIELD, PROVIDER_NAME);
71
        return parameters;
72
    }
73 28 llmarques
74 159 llmarques
    @Override
75
    protected DynClass createParametersDynClass() {
76
        DynClass dynclass =
77
            ToolsLocator.getDynObjectManager().createDynClass(PROVIDER_NAME,
78
                PROVIDER_DESCRIPTION);
79 29 llmarques
80 159 llmarques
        dynclass.addDynFieldString(PROVIDER_NAME_FIELD);
81
        dynclass.addDynFieldObject(FEATURE_STORE_FIELD);
82 322 llmarques
        dynclass.addDynFieldObject(MAPCONTEXT_FIELD);
83 159 llmarques
        return dynclass;
84 28 llmarques
85 159 llmarques
    }
86 28 llmarques
}