Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.geometrymeasurement.app / org.gvsig.geometrymeasurement.app.mainplugin / src / main / java / org / gvsig / geometrymeasurement / app / extension / AddXYPointThemeExtension.java @ 44616

History | View | Annotate | Download (2.45 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 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 3
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
package org.gvsig.geometrymeasurement.app.extension;
25

    
26
import org.gvsig.andami.IconThemeHelper;
27
import org.gvsig.app.project.documents.table.TableDocument;
28
import org.gvsig.fmap.dal.DataStoreProviderFactory;
29
import org.gvsig.fmap.dal.feature.FeatureStore;
30
import org.gvsig.fmap.dal.feature.FeatureStoreProviderFactory;
31
import org.gvsig.fmap.geom.Geometry;
32
import org.gvsig.geometrymeasurement.app.extension.utils.Operations;
33

    
34
/**
35
 * Andami extension to show PerimeterMeasurementExtension in the application.
36
 *
37
 * @author gvSIG Team
38
 * @version $Id$
39
 */
40
public class AddXYPointThemeExtension extends
41
        AbstractGeometryMeasurementExtension {
42

    
43
    @Override
44
    public void initialize() {
45
        super.initialize();
46
        IconThemeHelper.registerIcon("action", "table-add-xy", this);
47
    }
48

    
49
    @Override
50
    protected void execute(String actionCommand, FeatureStore featureStore)
51
            throws Exception {
52
        new Operations().addXYPoints(featureStore, "X", "Y");
53
    }
54

    
55
    @Override
56
    protected boolean isVisibleForTable(TableDocument tableDocument) {
57
        DataStoreProviderFactory factory = tableDocument.getFeatureStore().getProviderFactory();
58
        if (factory instanceof FeatureStoreProviderFactory) {
59
            FeatureStoreProviderFactory ffactory = (FeatureStoreProviderFactory) factory;
60
            if (ffactory.allowEditableFeatureType() == FeatureStoreProviderFactory.NO) {
61
                return false;
62
            }
63
        }
64
        return isStoreOfAnyType(tableDocument, new int[]{Geometry.TYPES.POINT});
65
    }
66
}