Revision 22892

View differences:

trunk/extensions/extTopology/src/org/gvsig/topology/RegisterGeoprocessesExtension.java
52 52
import com.iver.andami.plugins.Extension;
53 53
import com.iver.cit.gvsig.geoprocess.impl.fliplines.FlipLinesGeoprocessPlugin;
54 54
import com.iver.cit.gvsig.geoprocess.impl.generalization.GeneralizationGeoprocessPlugin;
55
import com.iver.cit.gvsig.geoprocess.impl.lineorpolygontopoints.LineToPointsGeoprocessPlugin;
56
import com.iver.cit.gvsig.geoprocess.impl.polytolines.PolyToLinesGeoprocessPlugin;
57
import com.iver.cit.gvsig.geoprocess.impl.referencing.ReferencingGeoprocessPlugin;
58
import com.iver.cit.gvsig.geoprocess.impl.smooth.SmoothGeoprocessPlugin;
55 59
import com.iver.cit.gvsig.geoprocess.impl.snapandcrack.SnapAndCrackGeoprocessPlugin;
56 60
import com.iver.cit.gvsig.geoprocess.impl.voronoi.VoronoiGeoprocessPlugin;
57 61
import com.iver.utiles.extensionPoints.ExtensionPoints;
......
76 80
		extensionPoints.add("GeoprocessManager",
77 81
				"FLIPLINES", 
78 82
				FlipLinesGeoprocessPlugin.class);
83
		
84
		extensionPoints.add("GeoprocessManager",
85
				"POLYGONTOLINES", 
86
				PolyToLinesGeoprocessPlugin.class);
87
		
88
		extensionPoints.add("GeoprocessManager",
89
				"POLYGONORLINESTOPOINTS", 
90
				LineToPointsGeoprocessPlugin.class);
91
		
92
		extensionPoints.add("GeoprocessManager",
93
				"SMOOTH_GEOMETRIES", 
94
				SmoothGeoprocessPlugin.class);
95
		
96
		extensionPoints.add("GeoprocessManager",
97
				"SPATIAL_ADJUST", 
98
				ReferencingGeoprocessPlugin.class);
79 99
		registerIcons();
80 100
	}
81 101
	
......
99 119
				FlipLinesGeoprocessPlugin.class.getResource("resources/flipline_desc.png")
100 120
			);
101 121
		
122
		PluginServices.getIconTheme().registerDefault(
123
				"polytolines-icon",
124
				PolyToLinesGeoprocessPlugin.class.getResource("resources/polygontoline_desc.gif")
125
			);
102 126
		
127
		PluginServices.getIconTheme().registerDefault(
128
				"linetopoints-icon",
129
				LineToPointsGeoprocessPlugin.class.getResource("resources/linetopoint_desc.gif")
130
			);
103 131
		
132
		PluginServices.getIconTheme().registerDefault(
133
				"smoothdesc-icon",
134
				SmoothGeoprocessPlugin.class.getResource("resources/smooth_desc.gif")
135
			);
136
		
137
		PluginServices.getIconTheme().registerDefault(
138
				"spatialadjustdesc-icon",
139
				ReferencingGeoprocessPlugin.class.getResource("resources/spatial_ adjust_desc.gif")
140
			);
141
		
142
		
143
		
104 144
	}
105 145
	
106 146
	public void execute(String actionCommand) {
trunk/extensions/extTopology/src/org/gvsig/topology/ReferencingExtension.java
1
/*
2
 * Created on 10-abr-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: 
47
 * $Log: 
48
 */
49
package org.gvsig.topology;
50

  
51
import com.iver.andami.PluginServices;
52
import com.iver.andami.plugins.Extension;
53
import com.iver.cit.gvsig.fmap.MapContext;
54
import com.iver.cit.gvsig.fmap.MapControl;
55
import com.iver.cit.gvsig.fmap.layers.FLayer;
56
import com.iver.cit.gvsig.fmap.layers.FLayers;
57
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
58
import com.iver.cit.gvsig.project.documents.view.IProjectView;
59
import com.iver.cit.gvsig.project.documents.view.gui.View;
60
import com.iver.cit.gvsig.referencing.VectorialReferencingPanel;
61

  
62
/**
63
 * Extension to reference vectorial layers.
64
 * 
65
 * @author Alvaro Zabala
66
 * 
67
 */
68
public class ReferencingExtension extends Extension {
69

  
70
	public void execute(String actionCommand) {
71
		com.iver.andami.ui.mdiManager.IWindow f = PluginServices
72
				.getMDIManager().getActiveWindow();
73
		View vista = (View) f;
74
		if (f != null) {
75
			MapControl mapControl = vista.getMapControl();
76
			if(mapControl != null){
77
				VectorialReferencingPanel refPanel = new VectorialReferencingPanel(mapControl.getMapContext().getLayers());
78
				PluginServices.getMDIManager().addWindow(refPanel);
79
			}// if
80
		}
81
	}
82

  
83
	public void initialize() {
84
		PluginServices.getIconTheme().registerDefault(
85
				"vectorial-adjust",
86
				this.getClass().getClassLoader().getResource(
87
						"images/vectorial-adjust.gif"));
88

  
89
		PluginServices.getIconTheme().registerDefault(
90
				"vectorial-adjust",
91
				this.getClass().getClassLoader().getResource(
92
						"images/vectorial-adjust.gif"));
93
	}
94

  
95
	public boolean isEnabled() {
96
		com.iver.andami.ui.mdiManager.IWindow f = PluginServices
97
				.getMDIManager().getActiveWindow();
98
		if (f == null) {
99
			return false;
100
		}
101
		if (f instanceof View) {
102
			View vista = (View) f;
103
			MapContext mapContext = vista.getModel().getMapContext();
104
			FLayers layers = mapContext.getLayers();
105
			int numLayers = layers.getLayersCount();
106
			for (int i = 0; i < numLayers; i++) {
107
				FLayer layer = layers.getLayer(i);
108
				if (layer instanceof FLyrVect && layer.isAvailable()
109
						&& layer.isActive()) {
110
					return true;
111

  
112
				}// if
113
			}// for
114
		}// if
115
		return false;
116
	}
117

  
118
	public boolean isVisible() {
119
		com.iver.andami.ui.mdiManager.IWindow f = PluginServices
120
				.getMDIManager().getActiveWindow();
121
		if (f == null) {
122
			return false;
123
		}
124
		if (f instanceof View) {
125
			View vista = (View) f;
126
			IProjectView model = vista.getModel();
127
			FLayers layers = model.getMapContext().getLayers();
128
			int numLayers = layers.getLayersCount();
129
			for (int i = 0; i < numLayers; i++) {
130
				FLayer layer = layers.getLayer(i);
131
				if (layer instanceof FLyrVect)
132
					return true;
133
			}
134
			return false;
135
		}
136
		return false;
137
	}
138

  
139
}

Also available in: Unified diff