Revision 142

View differences:

org.gvsig.educa.thematicmap.app/trunk/org.gvsig.educa.thematicmap.app/org.gvsig.educa.thematicmap.app.viewer/src/main/resources/config.xml
71 71
					action-command="AREA" tooltip="medir_area" position="6" />
72 72
			</tool-bar>
73 73
		</extension>
74

  
75
		<extension class-name="org.gvsig.educa.thematicmap.app.viewer.ThematicMapInfoByPointToolsExtension"
76
			description="Extensi?n encargada de gestionar la herramienta de info en los mapas tematicos."
77
			active="true"
78
			priority="29">
79
			<menu text="Vista/consulta"
80
				position="30030"
81
				is_separator="true"/>
82
			<menu text="Vista/consulta/informacion" position="3003010" action-command="INFO" icon="view-query-information"/>
83
			<tool-bar name="View_Tools_Query" position="5">
84
				<selectable-tool icon="view-query-information" action-command="INFO"  tooltip="informacion" position="1"/>
85
			</tool-bar>
86
		</extension>
74 87
	</extensions>
75 88
</plugin-config>
org.gvsig.educa.thematicmap.app/trunk/org.gvsig.educa.thematicmap.app/org.gvsig.educa.thematicmap.app.viewer/src/main/java/org/gvsig/educa/thematicmap/app/viewer/ThematicMapInfoByPointToolsExtension.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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
 */
22
package org.gvsig.educa.thematicmap.app.viewer;
23

  
24
import org.gvsig.andami.PluginServices;
25
import org.gvsig.andami.plugins.Extension;
26
import org.gvsig.andami.ui.mdiManager.IWindow;
27
import org.gvsig.app.project.documents.view.toolListeners.InfoListener;
28
import org.gvsig.educa.thematicmap.app.viewer.ui.ThematicMapDocumentViewer;
29
import org.gvsig.educa.thematicmap.swing.ThematicMapSwingLocator;
30
import org.gvsig.educa.thematicmap.swing.viewer.MapControlToolRegistrant;
31
import org.gvsig.fmap.mapcontext.layers.FLayers;
32
import org.gvsig.fmap.mapcontrol.MapControl;
33
import org.gvsig.fmap.mapcontrol.tools.Behavior.PointBehavior;
34

  
35
/**
36
 * ThematicMap Info-by-point tool
37
 * 
38
 * @author gvSIG Team
39
 * @version $Id$
40
 * 
41
 */
42
public class ThematicMapInfoByPointToolsExtension extends Extension implements
43
    MapControlToolRegistrant {
44

  
45
    public void initialize() {
46
        // Nothing to do
47

  
48
    }
49

  
50
    @Override
51
    public void postInitialize() {
52

  
53
        // Register tools
54
        ThematicMapSwingLocator.getSwingManager().addMapControlRegistrant(this);
55
    }
56

  
57
    public boolean isEnabled() {
58
        IWindow window = PluginServices.getMDIManager().getActiveWindow();
59

  
60
        if (window instanceof ThematicMapDocumentViewer) {
61
            ThematicMapDocumentViewer viewer =
62
                (ThematicMapDocumentViewer) window;
63

  
64
            FLayers layers =
65
                viewer.getThematicMap().getMapContext().getLayers();
66

  
67
            for (int i = 0; i < layers.getLayersCount(); i++) {
68
                if (layers.getLayer(i).isAvailable()) {
69
                    return true;
70
                }
71
            }
72
        }
73
        return false;
74
    }
75

  
76
    public boolean isVisible() {
77
        IWindow window = PluginServices.getMDIManager().getActiveWindow();
78
        return window instanceof ThematicMapDocumentViewer;
79
    }
80

  
81
    public void registerTools(MapControl mapControl) {
82

  
83
        // Info por punto
84
        InfoListener il = new InfoListener(mapControl);
85
        mapControl.addBehavior("info", new PointBehavior(il));
86

  
87
    }
88

  
89
    public void execute(String actionCommand) {
90
        IWindow window = PluginServices.getMDIManager().getActiveWindow();
91
        if (!(window instanceof ThematicMapDocumentViewer)) {
92
            return;
93
        }
94
        ThematicMapDocumentViewer tmDocViewer =
95
            (ThematicMapDocumentViewer) window;
96
        MapControl mapCtrl = tmDocViewer.getViewer().getMapControl();
97
        if (actionCommand.equals("INFO")) {
98
            mapCtrl.setTool("info");
99
        }
100
    }
101
}
org.gvsig.educa.thematicmap.app/trunk/org.gvsig.educa.thematicmap.app/org.gvsig.educa.thematicmap.app.viewer/src/main/java/org/gvsig/educa/thematicmap/app/viewer/ThematicMapMeasureToolsExtension.java
35 35
import org.gvsig.fmap.mapcontrol.tools.Behavior.PolylineBehavior;
36 36

  
37 37
/**
38
 * ThematicMap Measure tool extension
39
 * 
38 40
 * @author gvSIG Team
39 41
 * @version $Id$
40 42
 * 

Also available in: Unified diff