Statistics
| Revision:

root / trunk / extensions / extGeoProcessing / src / com / iver / cit / gvsig / geoprocess / manager / GeoprocessManagerExtension.java @ 6018

History | View | Annotate | Download (3.34 KB)

1
/*
2
 * Created on 23-jun-2006
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
*
46
* $Id: GeoprocessManagerExtension.java 6018 2006-06-23 19:03:52Z azabala $
47
* $Log$
48
* Revision 1.1  2006-06-23 19:03:52  azabala
49
* first version in cvs
50
*
51
*
52
*/
53
package com.iver.cit.gvsig.geoprocess.manager;
54

    
55
import com.iver.andami.PluginServices;
56
import com.iver.andami.plugins.Extension;
57
import com.iver.cit.gvsig.fmap.layers.FLayer;
58
import com.iver.cit.gvsig.fmap.layers.FLayers;
59
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
60
import com.iver.cit.gvsig.geoprocess.impl.buffer.BufferGeoprocessPlugin;
61
import com.iver.cit.gvsig.geoprocess.impl.clip.ClipGeoprocessPlugin;
62
import com.iver.cit.gvsig.geoprocess.impl.convexhull.ConvexHullGeoprocessPlugin;
63
import com.iver.cit.gvsig.gui.View;
64
import com.iver.cit.gvsig.project.ProjectView;
65
import com.iver.utiles.extensionPoints.ExtensionPoints;
66
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
67

    
68
public class GeoprocessManagerExtension extends Extension {
69

    
70
        public void initialize() {
71
                ExtensionPoints extensionPoints = 
72
                        ExtensionPointsSingleton.getInstance();
73
                extensionPoints.add("GeoprocessManager",
74
                                "BUFFER", 
75
                                BufferGeoprocessPlugin.class);
76
                extensionPoints.add("GeoprocessManager",
77
                                "CLIP", 
78
                                ClipGeoprocessPlugin.class);
79
                extensionPoints.add("GeoprocessManager",
80
                                "CONVEX HULL", 
81
                                ConvexHullGeoprocessPlugin.class);
82
        }
83

    
84
        public void execute(String actionCommand) {
85
                if(actionCommand.equalsIgnoreCase("GEOPROCESSING_MANAGER")){
86
                        PluginServices.getMDIManager().
87
                                addView(new GeoprocessManager());
88
                }
89

    
90
        }
91

    
92
        public boolean isEnabled() {
93
                return true;
94
        }
95

    
96
        public boolean isVisible() {
97
                //Meter en un geoprocessutil para todas las extensiones
98
                //de geoprocessing
99
                com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager()
100
                 .getActiveView();
101
                if (f == null) {
102
                    return false;
103
                }
104
                if (f instanceof View) {
105
                    View vista = (View) f;
106
                    ProjectView model = vista.getModel();
107
                    FLayers layers =  model.getMapContext().getLayers();
108
                    int numLayers = layers.getLayersCount();
109
                    for(int i = 0; i < numLayers; i++){
110
                            FLayer layer = layers.getLayer(i);
111
                            if(layer instanceof FLyrVect)
112
                                    return true;
113
                    }
114
                    return false;
115
                } else {
116
                    return false;
117
                }
118
        }
119

    
120
}
121