Revision 36944
tags/v2_0_0_Build_2038/extensions/extGazetteer/src/org/gvsig/gazetteer/gui/ConnectDialog.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package org.gvsig.gazetteer.gui; |
|
42 |
|
|
43 |
|
|
44 |
import java.awt.Frame; |
|
45 |
|
|
46 |
import javax.swing.JDialog; |
|
47 |
|
|
48 |
import org.gvsig.andami.PluginServices; |
|
49 |
import org.gvsig.andami.persistence.serverData.ServerDataPersistence; |
|
50 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
51 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
|
52 |
import org.gvsig.catalog.utils.Frames; |
|
53 |
import org.gvsig.gazetteer.ui.serverconnect.ServerConnectDialogPanel; |
|
54 |
import org.gvsig.i18n.Messages; |
|
55 |
import org.gvsig.utils.swing.jcomboServer.ServerData; |
|
56 |
|
|
57 |
|
|
58 |
/** |
|
59 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
|
60 |
*/ |
|
61 |
public class ConnectDialog extends ServerConnectDialogPanel |
|
62 |
implements IWindow { |
|
63 |
public WindowInfo m_windowInfo = null; |
|
64 |
|
|
65 |
/** |
|
66 |
* Building the dialog Window |
|
67 |
*/ |
|
68 |
public ConnectDialog(/*FLayers layers, MapControl mapCtrl*/) { |
|
69 |
super(null); |
|
70 |
init(); |
|
71 |
} |
|
72 |
|
|
73 |
/** |
|
74 |
* Establishing window properties |
|
75 |
* |
|
76 |
*/ |
|
77 |
private void init() { |
|
78 |
this.setBounds(0, 0, 610, 263); |
|
79 |
setName("connectDialog"); |
|
80 |
} |
|
81 |
|
|
82 |
public static void addServer(ServerData server) { |
|
83 |
ServerConnectDialogPanel.addTreeMapServer(server); |
|
84 |
} |
|
85 |
|
|
86 |
/* |
|
87 |
* (non-Javadoc) |
|
88 |
* @see es.gva.cit.gazetteer.ui.serverconnect.ServerConnectDialogPanel#searchButtonActionPerformed() |
|
89 |
*/ |
|
90 |
protected void searchButtonActionPerformed() { |
|
91 |
addCurrentHost(); |
|
92 |
closeJDialog(); |
|
93 |
|
|
94 |
JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false); |
|
95 |
Frames.centerFrame(panel,525,125); |
|
96 |
panel.setTitle(Messages.getText( "gazetteer_search")); |
|
97 |
SearchDialog dialog = new SearchDialog(client,this); |
|
98 |
dialog.setFrame(panel); |
|
99 |
dialog.setCurrentServer(getCurrentServer()); |
|
100 |
dialog.setFrame(panel); |
|
101 |
panel.getContentPane().add(dialog); |
|
102 |
panel.setVisible(true); |
|
103 |
} |
|
104 |
|
|
105 |
/** |
|
106 |
* Save the current host (if is neccessary) in a file using the andami |
|
107 |
* persistence |
|
108 |
* @param host |
|
109 |
* Host to save |
|
110 |
*/ |
|
111 |
private void addCurrentHost(){ |
|
112 |
String host = client.getSUri(); |
|
113 |
ServerDataPersistence persistence = new ServerDataPersistence(this,ServerData.SERVER_TYPE_GAZETTEER); |
|
114 |
persistence.addServerData(new ServerData(host, ServerData.SERVER_TYPE_GAZETTEER, client.getProtocol())); |
|
115 |
persistence.setPersistent(); |
|
116 |
} |
|
117 |
|
|
118 |
/* |
|
119 |
* (non-Javadoc) |
|
120 |
* @see es.gva.cit.gazetteer.ui.serverconnect.ServerConnectDialogPanel#closeButtonActionPerformed() |
|
121 |
*/ |
|
122 |
protected void closeButtonActionPerformed() { |
|
123 |
closeJDialog(); |
|
124 |
} |
|
125 |
|
|
126 |
/** |
|
127 |
* Cierra el Dialog |
|
128 |
*/ |
|
129 |
public void closeJDialog() { |
|
130 |
PluginServices.getMDIManager().closeWindow(ConnectDialog.this); |
|
131 |
} |
|
132 |
|
|
133 |
/* (non-Javadoc) |
|
134 |
* @see com.iver.andami.ui.mdiManager.View#getViewInfo() |
|
135 |
*/ |
|
136 |
public WindowInfo getWindowInfo() { |
|
137 |
if (m_windowInfo == null){ |
|
138 |
m_windowInfo=new WindowInfo(WindowInfo.RESIZABLE | WindowInfo.MODALDIALOG); |
|
139 |
m_windowInfo.setTitle(Messages.getText( "gazetteer_connect")); |
|
140 |
m_windowInfo.setHeight(225); |
|
141 |
m_windowInfo.setWidth(610); |
|
142 |
} |
|
143 |
return m_windowInfo; |
|
144 |
} |
|
145 |
public Object getWindowProfile(){ |
|
146 |
return WindowInfo.DIALOG_PROFILE; |
|
147 |
} |
|
148 |
|
|
149 |
} |
|
0 | 150 |
tags/v2_0_0_Build_2038/extensions/extGazetteer/src/org/gvsig/gazetteer/gui/ShowResultsDialog.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package org.gvsig.gazetteer.gui; |
|
42 |
|
|
43 |
|
|
44 |
import javax.swing.JDialog; |
|
45 |
|
|
46 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
47 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
|
48 |
import org.gvsig.gazetteer.GazetteerClient; |
|
49 |
import org.gvsig.gazetteer.loaders.FeatureLoader; |
|
50 |
import org.gvsig.gazetteer.querys.Feature; |
|
51 |
import org.gvsig.gazetteer.querys.GazetteerQuery; |
|
52 |
import org.gvsig.gazetteer.ui.showresults.ShowResultsDialogPanel; |
|
53 |
import org.gvsig.i18n.Messages; |
|
54 |
|
|
55 |
|
|
56 |
/** |
|
57 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
|
58 |
*/ |
|
59 |
public class ShowResultsDialog extends ShowResultsDialogPanel implements IWindow { |
|
60 |
private SearchDialog searchDialog = null; |
|
61 |
private JDialog frame = null; |
|
62 |
/** |
|
63 |
* @param client |
|
64 |
* @param features |
|
65 |
* @param recordsByPage |
|
66 |
*/ |
|
67 |
public ShowResultsDialog(JDialog frame,GazetteerClient client, Feature[] features, int recordsByPage, GazetteerQuery query) { |
|
68 |
super(client, features, recordsByPage,query); |
|
69 |
this.frame = frame; |
|
70 |
} |
|
71 |
|
|
72 |
/* (non-Javadoc) |
|
73 |
* @see com.iver.andami.ui.mdiManager.View#getViewInfo() |
|
74 |
*/ |
|
75 |
public WindowInfo getWindowInfo() { |
|
76 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG); |
|
77 |
m_viewinfo.setTitle(Messages.getText( "gazetteer_search")); |
|
78 |
return m_viewinfo; |
|
79 |
} |
|
80 |
public Object getWindowProfile(){ |
|
81 |
return WindowInfo.DIALOG_PROFILE; |
|
82 |
} |
|
83 |
|
|
84 |
public void closeButtonActionPerformed() { |
|
85 |
closeJDialog(); |
|
86 |
} |
|
87 |
|
|
88 |
public void closeJDialog() { |
|
89 |
frame.setVisible(false); |
|
90 |
} |
|
91 |
|
|
92 |
/** |
|
93 |
* This method have to load the selected feature into gvSIG |
|
94 |
*/ |
|
95 |
public void loadButtonActionPerformed() { |
|
96 |
Feature feature = ppalPanel.getFeature(); |
|
97 |
if (feature != null){ |
|
98 |
|
|
99 |
new FeatureLoader(client.getProjection()).load(feature,query); |
|
100 |
} |
|
101 |
closeJDialog(); |
|
102 |
//getSearchDialog().closeJDialog(); |
|
103 |
} |
|
104 |
|
|
105 |
/** |
|
106 |
* @return Returns the searchDialog. |
|
107 |
*/ |
|
108 |
public SearchDialog getSearchDialog() { |
|
109 |
return searchDialog; |
|
110 |
} |
|
111 |
/** |
|
112 |
* @param searchDialog The searchDialog to set. |
|
113 |
*/ |
|
114 |
public void setSearchDialog(SearchDialog searchDialog) { |
|
115 |
this.searchDialog = searchDialog; |
|
116 |
} |
|
117 |
} |
|
0 | 118 |
tags/v2_0_0_Build_2038/extensions/extGazetteer/src/org/gvsig/gazetteer/gui/SearchDialog.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package org.gvsig.gazetteer.gui; |
|
42 |
|
|
43 |
import java.awt.Frame; |
|
44 |
import java.awt.geom.Rectangle2D; |
|
45 |
|
|
46 |
import javax.swing.Icon; |
|
47 |
import javax.swing.JDialog; |
|
48 |
|
|
49 |
import org.gvsig.andami.PluginServices; |
|
50 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
51 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
|
52 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
|
53 |
import org.gvsig.catalog.querys.Coordinates; |
|
54 |
import org.gvsig.catalog.utils.Frames; |
|
55 |
import org.gvsig.fmap.mapcontext.events.ColorEvent; |
|
56 |
import org.gvsig.fmap.mapcontext.events.ExtentEvent; |
|
57 |
import org.gvsig.fmap.mapcontext.events.ProjectionEvent; |
|
58 |
import org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener; |
|
59 |
import org.gvsig.gazetteer.GazetteerClient; |
|
60 |
import org.gvsig.gazetteer.querys.Feature; |
|
61 |
import org.gvsig.gazetteer.ui.search.SearchDialogPanel; |
|
62 |
import org.gvsig.i18n.Messages; |
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
/** |
|
67 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
|
68 |
*/ |
|
69 |
public class SearchDialog extends SearchDialogPanel |
|
70 |
implements IWindow,ViewPortListener{ |
|
71 |
public WindowInfo m_windowInfo = null; |
|
72 |
public ConnectDialog parentDialog = null; |
|
73 |
public JDialog frame = null; |
|
74 |
|
|
75 |
public SearchDialog(GazetteerClient client,Object serverConnectFrame){ |
|
76 |
super(client,serverConnectFrame); |
|
77 |
parentDialog = (ConnectDialog)serverConnectFrame; |
|
78 |
setViewChangeListener(); |
|
79 |
loadViewPortCoordinates(); |
|
80 |
} |
|
81 |
|
|
82 |
/* (non-Javadoc) |
|
83 |
* @see com.iver.andami.ui.mdiManager.View#getViewInfo() |
|
84 |
*/ |
|
85 |
public WindowInfo getWindowInfo() { |
|
86 |
if (m_windowInfo == null){ |
|
87 |
m_windowInfo = new WindowInfo(WindowInfo.PALETTE); |
|
88 |
m_windowInfo.setTitle(Messages.getText("gazetteer_search") + " [" + |
|
89 |
getCurrentServer() + "]"); |
|
90 |
m_windowInfo.setHeight(80); |
|
91 |
m_windowInfo.setWidth(525); |
|
92 |
} |
|
93 |
return m_windowInfo; |
|
94 |
|
|
95 |
} |
|
96 |
public Object getWindowProfile(){ |
|
97 |
return WindowInfo.TOOL_PROFILE; |
|
98 |
} |
|
99 |
|
|
100 |
protected void showResultsActionPerformed(Feature[] features) { |
|
101 |
JDialog panel = new JDialog((Frame) PluginServices.getMainFrame(), false); |
|
102 |
Frames.centerFrame(panel,420,258); |
|
103 |
panel.setTitle(Messages.getText( "gazetteer_search")); |
|
104 |
panel.setResizable(false); |
|
105 |
|
|
106 |
ShowResultsDialog dialog = new ShowResultsDialog(panel, |
|
107 |
client, |
|
108 |
features, |
|
109 |
lowerPanel.getResultsByPage(), |
|
110 |
getQuery()); |
|
111 |
|
|
112 |
panel.getContentPane().add(dialog); |
|
113 |
panel.show(); |
|
114 |
} |
|
115 |
|
|
116 |
protected void closeButtonActionPerformed() { |
|
117 |
closeJDialog(); |
|
118 |
} |
|
119 |
|
|
120 |
/** |
|
121 |
* Size button action performed |
|
122 |
*/ |
|
123 |
protected void resizeButtonActionPerformed(){ |
|
124 |
if (isMinimized){ |
|
125 |
frame.setSize(frame.getWidth(),450); |
|
126 |
frame.doLayout(); |
|
127 |
getLowerPanel().setVisible(true); |
|
128 |
getUpperPanel().setIcon(getUpIcon()); |
|
129 |
}else{ |
|
130 |
frame.setSize(frame.getWidth(),115); |
|
131 |
getLowerPanel().setVisible(false); |
|
132 |
getUpperPanel().setIcon(getDownIcon()); |
|
133 |
} |
|
134 |
isMinimized = !isMinimized; |
|
135 |
} |
|
136 |
|
|
137 |
/* |
|
138 |
* (non-Javadoc) |
|
139 |
* @see org.gvsig.gazetteer.ui.search.SearchDialogPanel#getUpIcon() |
|
140 |
*/ |
|
141 |
protected Icon getUpIcon(){ |
|
142 |
return PluginServices.getIconTheme().get("catalog-up"); |
|
143 |
} |
|
144 |
|
|
145 |
/* |
|
146 |
* (non-Javadoc) |
|
147 |
* @see org.gvsig.gazetteer.ui.search.SearchDialogPanel#getDownIcon() |
|
148 |
*/ |
|
149 |
protected Icon getDownIcon(){ |
|
150 |
return PluginServices.getIconTheme().get("catalog-down"); |
|
151 |
} |
|
152 |
|
|
153 |
/** |
|
154 |
* Return button action |
|
155 |
*/ |
|
156 |
protected void lastButtonActionPerformed() { |
|
157 |
closeJDialog(); |
|
158 |
ConnectDialog serverConnect = (ConnectDialog)serverConnectFrame; |
|
159 |
parentDialog.setVisible(true); |
|
160 |
parentDialog.getControlsPanel().enableSearchButton(false); |
|
161 |
PluginServices.getMDIManager().addWindow(serverConnect); |
|
162 |
} |
|
163 |
|
|
164 |
public void closeJDialog() { |
|
165 |
frame.setVisible(false); |
|
166 |
} |
|
167 |
|
|
168 |
/** |
|
169 |
* This method loads the view coordinates to the catalog search dialog |
|
170 |
* |
|
171 |
*/ |
|
172 |
private void loadViewPortCoordinates(){ |
|
173 |
AbstractViewPanel activeView = |
|
174 |
(AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow(); |
|
175 |
|
|
176 |
Rectangle2D r2d= activeView.getMapControl().getViewPort().getExtent(); |
|
177 |
|
|
178 |
try{ |
|
179 |
getLowerPanel().setCoordinates(new Coordinates(r2d.getMinX(), |
|
180 |
r2d.getMaxY(), |
|
181 |
r2d.getMaxX(), |
|
182 |
r2d.getMinY())); |
|
183 |
}catch(NullPointerException E){ |
|
184 |
//We cant retrieve the coordinates if it doesn't |
|
185 |
//exist a loaded layer |
|
186 |
} |
|
187 |
} |
|
188 |
/* |
|
189 |
* This method joins the viewPort event to the listener |
|
190 |
*/ |
|
191 |
private void setViewChangeListener(){ |
|
192 |
AbstractViewPanel activeView = |
|
193 |
(AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow(); |
|
194 |
|
|
195 |
activeView.getMapControl().getViewPort().addViewPortListener(this); |
|
196 |
|
|
197 |
} |
|
198 |
|
|
199 |
public void extentChanged(ExtentEvent e) { |
|
200 |
loadViewPortCoordinates(); |
|
201 |
|
|
202 |
} |
|
203 |
|
|
204 |
public void backColorChanged(ColorEvent e) { |
|
205 |
// TODO Auto-generated method stub |
|
206 |
|
|
207 |
} |
|
208 |
|
|
209 |
public void projectionChanged(ProjectionEvent e) { |
|
210 |
loadViewPortCoordinates(); |
|
211 |
} |
|
212 |
|
|
213 |
/** |
|
214 |
* @param frame the frame to set |
|
215 |
*/ |
|
216 |
public void setFrame(JDialog dialog) { |
|
217 |
this.frame = dialog; |
|
218 |
} |
|
219 |
|
|
220 |
|
|
221 |
|
|
222 |
|
|
223 |
|
|
224 |
|
|
225 |
|
|
226 |
|
|
227 |
} |
|
0 | 228 |
tags/v2_0_0_Build_2038/extensions/extGazetteer/src/org/gvsig/gazetteer/GazetteerExtension.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package org.gvsig.gazetteer; |
|
42 |
|
|
43 |
import java.util.Calendar; |
|
44 |
import java.util.Date; |
|
45 |
import java.util.GregorianCalendar; |
|
46 |
|
|
47 |
import org.gvsig.andami.PluginServices; |
|
48 |
import org.gvsig.andami.persistence.serverData.ServerDataPersistence; |
|
49 |
import org.gvsig.andami.plugins.Extension; |
|
50 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
|
51 |
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel; |
|
52 |
import org.gvsig.gazetteer.gui.ConnectDialog; |
|
53 |
import org.gvsig.utils.swing.jcomboServer.ServerData; |
|
54 |
|
|
55 |
|
|
56 |
/** |
|
57 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
|
58 |
*/ |
|
59 |
public class GazetteerExtension extends Extension { |
|
60 |
// private GazetteerLibrary gazetteerLibrary = null; |
|
61 |
// private DefaultGazetteerLibrary defaultGazetteerLibrary = null; |
|
62 |
|
|
63 |
public static void main(String[] args) { |
|
64 |
} |
|
65 |
|
|
66 |
/* |
|
67 |
* (non-Javadoc) |
|
68 |
* |
|
69 |
* @see com.iver.andami.plugins.Extension#inicializar() |
|
70 |
*/ |
|
71 |
public void initialize() { |
|
72 |
// gazetteerLibrary = new GazetteerLibrary(); |
|
73 |
// gazetteerLibrary.initialize(); |
|
74 |
// |
|
75 |
// defaultGazetteerLibrary = new DefaultGazetteerLibrary(); |
|
76 |
// defaultGazetteerLibrary.initialize(); |
|
77 |
registerIcons(); |
|
78 |
} |
|
79 |
|
|
80 |
private void registerIcons() { |
|
81 |
PluginServices.getIconTheme().registerDefault( |
|
82 |
"gazetteer-search", |
|
83 |
this.getClass().getClassLoader().getResource( |
|
84 |
"images/GazzButton.png")); |
|
85 |
} |
|
86 |
|
|
87 |
/* |
|
88 |
* (non-Javadoc) |
|
89 |
* |
|
90 |
* @see com.iver.andami.plugins.Extension#postInitialize() |
|
91 |
*/ |
|
92 |
public void postInitialize() { |
|
93 |
// gazetteerLibrary.postInitialize(); |
|
94 |
// defaultGazetteerLibrary.postInitialize(); |
|
95 |
} |
|
96 |
|
|
97 |
/* |
|
98 |
* (non-Javadoc) |
|
99 |
* |
|
100 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
|
101 |
*/ |
|
102 |
public void execute(String actionCommand) { |
|
103 |
// JToolBar toolBar = |
|
104 |
// (JToolBar)PluginServices.getMainFrame().getComponentByName("Catalogo"); |
|
105 |
// System.out.println("gjkmgbghb"); |
|
106 |
// for (int i=0 ; i<toolBar.getComponentCount() ; i++){ |
|
107 |
// System.out.println(((JButton)toolBar.getComponentAtIndex(i)).getName()); |
|
108 |
// } |
|
109 |
actionConnectDialogStart(); |
|
110 |
} |
|
111 |
|
|
112 |
/** |
|
113 |
* |
|
114 |
* |
|
115 |
*/ |
|
116 |
private void actionConnectDialogStart() { |
|
117 |
System.out.println("Bot?n de Gazeteer pulsado"); |
|
118 |
restoreServerList(); |
|
119 |
ConnectDialog connectDialog = new ConnectDialog(); |
|
120 |
PluginServices.getMDIManager().addWindow(connectDialog); |
|
121 |
} |
|
122 |
|
|
123 |
private void restoreServerList() { |
|
124 |
ServerDataPersistence persistence = new ServerDataPersistence(this, |
|
125 |
ServerData.SERVER_TYPE_GAZETTEER); |
|
126 |
|
|
127 |
ServerData[] servers = persistence.getArrayOfServerData(); |
|
128 |
|
|
129 |
boolean found = false; |
|
130 |
for (int i = 0; i < servers.length; i++) { |
|
131 |
if (servers[i].getServiceType().equals( |
|
132 |
ServerData.SERVER_TYPE_GAZETTEER)) { |
|
133 |
found = true; |
|
134 |
} |
|
135 |
} |
|
136 |
|
|
137 |
if (!found) { |
|
138 |
if (servers.length == 0) { |
|
139 |
servers = getDefaultServers(); |
|
140 |
} else { |
|
141 |
ServerData[] newServers = new ServerData[servers.length |
|
142 |
+ getDefaultServers().length]; |
|
143 |
System.arraycopy(servers, 0, newServers, 0, servers.length); |
|
144 |
System.arraycopy(getDefaultServers(), 0, newServers, |
|
145 |
servers.length, getDefaultServers().length); |
|
146 |
servers = newServers; |
|
147 |
} |
|
148 |
persistence.setArrayOfServerData(servers); |
|
149 |
} |
|
150 |
|
|
151 |
for (int i = 0; i < servers.length; i++) { |
|
152 |
if (servers[i].getServiceType().equals( |
|
153 |
ServerData.SERVER_TYPE_GAZETTEER)) { |
|
154 |
ConnectDialog.addServer(servers[i]); |
|
155 |
} |
|
156 |
} |
|
157 |
} |
|
158 |
|
|
159 |
/** |
|
160 |
* It creates a server list by default |
|
161 |
* |
|
162 |
* @return |
|
163 |
*/ |
|
164 |
private ServerData[] getDefaultServers() { |
|
165 |
ServerData[] servers = new ServerData[3]; |
|
166 |
Calendar cal = new GregorianCalendar(); |
|
167 |
Date date = cal.getTime(); |
|
168 |
|
|
169 |
servers[0] = new ServerData( |
|
170 |
"http://middleware.alexandria.ucsb.edu/gaz/adlgaz/dispatch", |
|
171 |
date, date, ServerData.SERVER_TYPE_GAZETTEER, |
|
172 |
ServerData.SERVER_SUBTYPE_GAZETTEER_ADL); |
|
173 |
servers[1] = new ServerData( |
|
174 |
"http://demo.deegree.org:8080/gazetteer/wfs-g", date, date, |
|
175 |
ServerData.SERVER_TYPE_GAZETTEER, |
|
176 |
ServerData.SERVER_SUBTYPE_GAZETTEER_WFSG); |
|
177 |
servers[2] = new ServerData( |
|
178 |
"http://193.144.250.29/webservices/services/IDEC_GeoServeisPort", |
|
179 |
date, date, ServerData.SERVER_TYPE_GAZETTEER, |
|
180 |
ServerData.SERVER_SUBTYPE_GAZETTEER_IDEC); |
|
181 |
|
|
182 |
return servers; |
|
183 |
} |
|
184 |
|
|
185 |
/* |
|
186 |
* (non-Javadoc) |
|
187 |
* |
|
188 |
* @see com.iver.andami.plugins.Extension#isEnabled() |
|
189 |
*/ |
|
190 |
public boolean isEnabled() { |
|
191 |
return true; |
|
192 |
} |
|
193 |
|
|
194 |
/* |
|
195 |
* (non-Javadoc) |
|
196 |
* |
|
197 |
* @see com.iver.andami.plugins.Extension#isVisible() |
|
198 |
*/ |
|
199 |
public boolean isVisible() { |
|
200 |
org.gvsig.andami.ui.mdiManager.IWindow f = PluginServices |
|
201 |
.getMDIManager().getActiveWindow(); |
|
202 |
|
|
203 |
if (f == null) { |
|
204 |
return false; |
|
205 |
} |
|
206 |
|
|
207 |
if (f instanceof DefaultViewPanel) { |
|
208 |
if (((DefaultViewPanel) f).getMapControl().getViewPort().getAdjustedExtent() != null) { |
|
209 |
return true; |
|
210 |
} |
|
211 |
} else if (f instanceof AbstractViewPanel) |
|
212 |
return true; |
|
213 |
|
|
214 |
return false; |
|
215 |
} |
|
216 |
} |
|
0 | 217 |
tags/v2_0_0_Build_2038/extensions/extGazetteer/src/org/gvsig/gazetteer/loaders/FeatureLoader.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU General Public License |
|
7 |
* as published by the Free Software Foundation; either version 2 |
|
8 |
* of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program; if not, write to the Free Software |
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
40 |
*/ |
|
41 |
package org.gvsig.gazetteer.loaders; |
|
42 |
|
|
43 |
|
|
44 |
import java.awt.Color; |
|
45 |
import java.awt.Toolkit; |
|
46 |
import java.awt.geom.Point2D; |
|
47 |
import java.awt.geom.Rectangle2D; |
|
48 |
|
|
49 |
import org.cresques.cts.ICoordTrans; |
|
50 |
import org.cresques.cts.IProjection; |
|
51 |
import org.slf4j.Logger; |
|
52 |
import org.slf4j.LoggerFactory; |
|
53 |
|
|
54 |
import org.gvsig.andami.PluginServices; |
|
55 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
|
56 |
import org.gvsig.fmap.crs.CRSFactory; |
|
57 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
58 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
59 |
import org.gvsig.fmap.geom.GeometryManager; |
|
60 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
|
61 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
62 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
63 |
import org.gvsig.fmap.geom.primitive.Point; |
|
64 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
65 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
66 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
|
67 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
68 |
import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer; |
|
69 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
70 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol; |
|
71 |
import org.gvsig.gazetteer.DeleteSearchesExtension; |
|
72 |
import org.gvsig.gazetteer.querys.Feature; |
|
73 |
import org.gvsig.gazetteer.querys.GazetteerQuery; |
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
/** |
|
79 |
* This class is used to load a new feature like a layer in gvSIG |
|
80 |
* |
|
81 |
* @author Jorge Piera Llodra (piera_jor@gva.es) |
|
82 |
*/ |
|
83 |
public class FeatureLoader { |
|
84 |
private static final Logger LOG = |
|
85 |
LoggerFactory.getLogger(FeatureLoader.class); |
|
86 |
|
|
87 |
private static GeometryManager geometryManager = GeometryLocator.getGeometryManager(); |
|
88 |
private static MapContextManager mapContextManager = MapContextLocator.getMapContextManager(); |
|
89 |
|
|
90 |
/** |
|
91 |
* Coordinates Transformer |
|
92 |
*/ |
|
93 |
private ICoordTrans coordTrans; |
|
94 |
|
|
95 |
/** |
|
96 |
* @param projection |
|
97 |
* Server projection |
|
98 |
*/ |
|
99 |
public FeatureLoader(String sProjection){ |
|
100 |
AbstractViewPanel activeView = |
|
101 |
(AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow(); |
|
102 |
|
|
103 |
|
|
104 |
IProjection projection = CRSFactory.getCRS(sProjection); |
|
105 |
if (projection == null){ |
|
106 |
projection = activeView.getMapControl().getViewPort().getProjection(); |
|
107 |
} |
|
108 |
|
|
109 |
coordTrans= projection.getCT(activeView.getMapControl().getViewPort().getProjection()); |
|
110 |
} |
|
111 |
/** |
|
112 |
* It makes a zoom in gvSIG |
|
113 |
* @param |
|
114 |
* feature |
|
115 |
* @param |
|
116 |
* query |
|
117 |
* Query that contains advanced options to search and |
|
118 |
* to show the results |
|
119 |
* @return |
|
120 |
* true or false if fail |
|
121 |
*/ |
|
122 |
public boolean load(Feature feature,GazetteerQuery query) { |
|
123 |
addAndDrawLabel(feature, |
|
124 |
query.getOptions().getAspect().isKeepOld(), |
|
125 |
query.getOptions().getAspect().isPaintCurrent()); |
|
126 |
|
|
127 |
if (query.getOptions().getAspect().isGoTo()){ |
|
128 |
focusCenter(feature); |
|
129 |
} |
|
130 |
|
|
131 |
return true; |
|
132 |
} |
|
133 |
|
|
134 |
/** |
|
135 |
* This method focus the toponim in the center of the view |
|
136 |
* @param feature |
|
137 |
* Feature that contains the coordinates |
|
138 |
*/ |
|
139 |
private void focusCenter(Feature feature){ |
|
140 |
AbstractViewPanel activeView = |
|
141 |
(AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow(); |
|
142 |
|
|
143 |
IProjection projection = activeView.getProjection(); |
|
144 |
ViewPort viewPort = activeView.getMapControl().getViewPort(); |
|
145 |
MapContext mapContext = activeView.getMapControl().getMapContext(); |
|
146 |
Point2D point = getReprojectedPoint(feature.getCoordinates()); |
|
147 |
|
|
148 |
if (viewPort.getAdjustedEnvelope() != null){ |
|
149 |
Toolkit kit = Toolkit.getDefaultToolkit(); |
|
150 |
double dpi = kit.getScreenResolution(); |
|
151 |
|
|
152 |
Envelope envelope = viewPort.getAdjustedEnvelope(); |
|
153 |
Rectangle2D rectangle = new Rectangle2D.Double(envelope.getLowerCorner().getX(), |
|
154 |
envelope.getLowerCorner().getY(), |
|
155 |
envelope.getUpperCorner().getX() - envelope.getLowerCorner().getX(), |
|
156 |
envelope.getUpperCorner().getY() - envelope.getLowerCorner().getY()); |
|
157 |
|
|
158 |
Rectangle2D extent = projection.getExtent(rectangle, |
|
159 |
new Double(25000).doubleValue(), |
|
160 |
new Double(viewPort.getImageWidth()).doubleValue(), |
|
161 |
new Double(viewPort.getImageHeight()).doubleValue(), |
|
162 |
viewPort.getMapUnits(), |
|
163 |
viewPort.getDistanceUnits(), |
|
164 |
dpi); |
|
165 |
if (extent != null){ |
|
166 |
try { |
|
167 |
envelope = geometryManager.createEnvelope(SUBTYPES.GEOM2D); |
|
168 |
Point loweCorner = geometryManager.createPoint(point.getX() - extent.getWidth()/2, |
|
169 |
point.getY() - extent.getHeight()/2, |
|
170 |
SUBTYPES.GEOM2D); |
|
171 |
Point upperCorner = geometryManager.createPoint(point.getX() + extent.getWidth()/2, |
|
172 |
point.getY() + extent.getHeight()/2, |
|
173 |
SUBTYPES.GEOM2D); |
|
174 |
envelope.setLowerCorner(loweCorner); |
|
175 |
envelope.setUpperCorner(upperCorner); |
|
176 |
mapContext.zoomToEnvelope(envelope); |
|
177 |
} catch (CreateEnvelopeException e) { |
|
178 |
LOG.error("Error creating the envelope", e); |
|
179 |
} catch (CreateGeometryException e) { |
|
180 |
LOG.error("Error creating the envelope", e); |
|
181 |
} |
|
182 |
} |
|
183 |
} |
|
184 |
} |
|
185 |
|
|
186 |
/** |
|
187 |
* It adds a new Label to the current view |
|
188 |
* @param feature |
|
189 |
* To obtain the coordinates and the toponim name |
|
190 |
* @param isRemoveOldClicked |
|
191 |
* To remove or keep the old searches |
|
192 |
*/ |
|
193 |
private void addAndDrawLabel(Feature feature,boolean isRemoveOldClicked,boolean isMarkedPlaceClicked){ |
|
194 |
AbstractViewPanel activeView = |
|
195 |
(AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow(); |
|
196 |
|
|
197 |
GraphicLayer lyr = activeView.getMapControl().getMapContext().getGraphicsLayer(); |
|
198 |
|
|
199 |
if (isRemoveOldClicked){ |
|
200 |
lyr.clearAllGraphics(); |
|
201 |
} |
|
202 |
|
|
203 |
if (isMarkedPlaceClicked){ |
|
204 |
int idSymbol = lyr.addSymbol(getSymbol(feature.getName())); |
|
205 |
|
|
206 |
Point2D point2d = getReprojectedPoint(feature.getCoordinates()); |
|
207 |
Point point; |
|
208 |
try { |
|
209 |
point = geometryManager.createPoint(point2d.getX(), point2d.getY(), SUBTYPES.GEOM2D); |
|
210 |
lyr.addGraphic("gazetteer", point, idSymbol, feature.getName()); |
|
211 |
|
|
212 |
DeleteSearchesExtension.setVisible(); |
|
213 |
PluginServices.getMainFrame().enableControls(); |
|
214 |
} catch (CreateGeometryException e) { |
|
215 |
LOG.error("Error creating the point", e); |
|
216 |
} |
|
217 |
} |
|
218 |
|
|
219 |
activeView.getMapControl().drawGraphics(); |
|
220 |
} |
|
221 |
|
|
222 |
/** |
|
223 |
* Creates a FSymbol |
|
224 |
* @return |
|
225 |
* FSymbol |
|
226 |
*/ |
|
227 |
private ISymbol getSymbol(String text){ |
|
228 |
ITextSymbol theSymbol = |
|
229 |
(ITextSymbol) mapContextManager.getSymbolManager() |
|
230 |
.createSymbol(ITextSymbol.SYMBOL_NAME); |
|
231 |
theSymbol.setColor(Color.RED); |
|
232 |
theSymbol.setTextColor(Color.BLACK); |
|
233 |
theSymbol.setAutoresizeEnabled(false); |
|
234 |
theSymbol.setFontSize(16); |
|
235 |
theSymbol.setText(text); |
|
236 |
return theSymbol; |
|
237 |
} |
|
238 |
|
|
239 |
/** |
|
240 |
* Reprojects the new point |
|
241 |
* @param ptOrig |
|
242 |
* Origin point |
|
243 |
* @return |
|
244 |
* FPoint2D |
|
245 |
*/ |
|
246 |
private Point2D getReprojectedPoint(Point2D ptOrigin){ |
|
247 |
Point2D ptDest = null; |
|
248 |
return getCoordTrans().convert(ptOrigin, ptDest); |
|
249 |
} |
|
250 |
/** |
|
251 |
* @return the coordTrans |
|
252 |
*/ |
|
253 |
public ICoordTrans getCoordTrans() { |
|
254 |
return coordTrans; |
|
255 |
} |
|
256 |
} |
|
0 | 257 |
tags/v2_0_0_Build_2038/extensions/extGazetteer/src/org/gvsig/gazetteer/DeleteSearchesExtension.java | ||
---|---|---|
1 |
package org.gvsig.gazetteer; |
|
2 |
|
|
3 |
import java.util.Hashtable; |
|
4 |
|
|
5 |
import org.gvsig.andami.PluginServices; |
|
6 |
import org.gvsig.andami.plugins.Extension; |
|
7 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
|
8 |
import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer; |
|
9 |
|
|
10 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
11 |
* |
|
12 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
13 |
* |
|
14 |
* This program is free software; you can redistribute it and/or |
|
15 |
* modify it under the terms of the GNU General Public License |
|
16 |
* as published by the Free Software Foundation; either version 2 |
|
17 |
* of the License, or (at your option) any later version. |
|
18 |
* |
|
19 |
* This program is distributed in the hope that it will be useful, |
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
22 |
* GNU General Public License for more details. |
|
23 |
* |
|
24 |
* You should have received a copy of the GNU General Public License |
|
25 |
* along with this program; if not, write to the Free Software |
|
26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
27 |
* |
|
28 |
* For more information, contact: |
|
29 |
* |
|
30 |
* Generalitat Valenciana |
|
31 |
* Conselleria d'Infraestructures i Transport |
|
32 |
* Av. Blasco Ib??ez, 50 |
|
33 |
* 46010 VALENCIA |
|
34 |
* SPAIN |
|
35 |
* |
|
36 |
* +34 963862235 |
|
37 |
* gvsig@gva.es |
|
38 |
* www.gvsig.gva.es |
|
39 |
* |
|
40 |
* or |
|
41 |
* |
|
42 |
* IVER T.I. S.A |
|
43 |
* Salamanca 50 |
|
44 |
* 46005 Valencia |
|
45 |
* Spain |
|
46 |
* |
|
47 |
* +34 963163400 |
|
48 |
* dac@iver.es |
|
49 |
*/ |
|
50 |
/* CVS MESSAGES: |
|
51 |
* |
|
52 |
* $Id: DeleteSearchesExtension.java 499 2007-07-10 11:18:10 +0000 (Tue, 10 Jul 2007) jorpiell $ |
|
53 |
* $Log$ |
|
54 |
* Revision 1.1.2.1 2007/07/10 11:18:10 jorpiell |
|
55 |
* Added the registers |
|
56 |
* |
|
57 |
* Revision 1.7.2.4 2007/01/08 12:19:13 jcampos |
|
58 |
* Revert changes |
|
59 |
* |
|
60 |
* Revision 1.7.2.2 2006/11/15 00:08:16 jjdelcerro |
|
61 |
* *** empty log message *** |
|
62 |
* |
|
63 |
* Revision 1.9 2006/10/02 08:29:06 jorpiell |
|
64 |
* Modificados los cambios del Branch 10 al head |
|
65 |
* |
|
66 |
* Revision 1.7.2.1 2006/09/20 12:01:47 jorpiell |
|
67 |
* Se ha cambiado la versi?n de la jzkit, se ha incorporado la funcionalidad de cargar arcims |
|
68 |
* |
|
69 |
* Revision 1.8 2006/09/20 11:23:50 jorpiell |
|
70 |
* Se ha cambiado la versi?n de la librer?a jzkit de la 1 a la 2.0. Adem?s se ha modificado lo del document |
|
71 |
* |
|
72 |
* Revision 1.7 2006/08/29 07:56:34 cesar |
|
73 |
* Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc) |
|
74 |
* |
|
75 |
* Revision 1.6 2006/08/29 07:13:58 cesar |
|
76 |
* Rename class com.iver.andami.ui.mdiManager.View to com.iver.andami.ui.mdiManager.IWindow |
|
77 |
* |
|
78 |
* Revision 1.5 2006/07/24 10:10:06 jorpiell |
|
79 |
* Se ha a?adido una hashtable de vistas activas para asociar la goma de borrar con la vista activa |
|
80 |
* |
|
81 |
* Revision 1.4 2006/06/19 11:19:35 jorpiell |
|
82 |
* Cambiadas las comprobaciones de una clase con == por instanceof. |
|
83 |
* |
|
84 |
* Revision 1.3 2006/05/02 15:53:59 jorpiell |
|
85 |
* Se ha cambiado la interfaz Extension por dos clases: una interfaz (IExtension) y una clase abstract(Extension). A partir de ahora todas las extensiones deben heredar de Extension |
|
86 |
* |
|
87 |
* Revision 1.2 2006/03/10 12:40:20 jorpiell |
|
88 |
* Ahora la goma de borrar los resultados del gazetteer ya aparece y desaparece en lugar de habilitarse/deshabilitarse |
|
89 |
* |
|
90 |
* Revision 1.1 2006/03/10 11:59:31 jorpiell |
|
91 |
* Se habilita la gomita para borrar los resultados de la busqueda del gazetteer en funcion de si hay o no resultados para borrar. |
|
92 |
* |
|
93 |
* |
|
94 |
*/ |
|
95 |
/** |
|
96 |
* @autor Jorge Piera Llodr? (piera_jor@gva.es) |
|
97 |
*/ |
|
98 |
public class DeleteSearchesExtension extends Extension{ |
|
99 |
private static Hashtable views = new Hashtable(); |
|
100 |
|
|
101 |
/* |
|
102 |
* (non-Javadoc) |
|
103 |
* @see com.iver.andami.plugins.Extension#inicializar() |
|
104 |
*/ |
|
105 |
public void initialize() { |
|
106 |
// TODO Auto-generated method stub |
|
107 |
registerIcons(); |
|
108 |
} |
|
109 |
|
|
110 |
private void registerIcons(){ |
|
111 |
PluginServices.getIconTheme().registerDefault( |
|
112 |
"catalog-clear-point", |
|
113 |
this.getClass().getClassLoader().getResource("images/delone.png") |
|
114 |
); |
|
115 |
} |
|
116 |
|
|
117 |
/* |
|
118 |
* (non-Javadoc) |
|
119 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
|
120 |
*/ |
|
121 |
public void execute(String actionCommand) { |
|
122 |
deteleAllFeatures(); |
|
123 |
} |
|
124 |
|
|
125 |
/* |
|
126 |
* (non-Javadoc) |
|
127 |
* @see com.iver.andami.plugins.Extension#isEnabled() |
|
128 |
*/ |
|
129 |
public boolean isEnabled() { |
|
130 |
return true; |
|
131 |
} |
|
132 |
|
|
133 |
/* |
|
134 |
* (non-Javadoc) |
|
135 |
* @see com.iver.andami.plugins.Extension#isVisible() |
|
136 |
*/ |
|
137 |
public boolean isVisible() { |
|
138 |
org.gvsig.andami.ui.mdiManager.IWindow activeView = PluginServices.getMDIManager() |
|
139 |
.getActiveWindow(); |
|
140 |
|
|
141 |
if (activeView == null) { |
|
142 |
return false; |
|
143 |
} |
|
144 |
|
|
145 |
if (activeView instanceof AbstractViewPanel){ |
|
146 |
Boolean bool = (Boolean)views.get(activeView); |
|
147 |
if (bool == null){ |
|
148 |
return false; |
|
149 |
}else{ |
|
150 |
return bool.booleanValue(); |
|
151 |
} |
|
152 |
}else{ |
|
153 |
return false; |
|
154 |
} |
|
155 |
|
|
156 |
|
|
157 |
} |
|
158 |
|
|
159 |
/** |
|
160 |
* Delete all the current view searches |
|
161 |
* |
|
162 |
*/ |
|
163 |
public static void deteleAllFeatures(){ |
|
164 |
AbstractViewPanel activeView = |
|
165 |
(AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow(); |
|
166 |
GraphicLayer lyr = activeView.getMapControl().getMapContext().getGraphicsLayer(); |
|
167 |
lyr.clearAllGraphics(); |
|
168 |
activeView.getMapControl().getViewPort().setEnvelope(activeView.getMapControl().getViewPort().getAdjustedExtent()); |
|
169 |
views.put(activeView,new Boolean(false)); |
|
170 |
} |
|
171 |
|
|
172 |
/** |
|
173 |
* Sets the extension enabled |
|
174 |
* |
|
175 |
*/ |
|
176 |
public static void setVisible(){ |
|
177 |
AbstractViewPanel activeView = |
|
178 |
(AbstractViewPanel) PluginServices.getMDIManager().getActiveWindow(); |
|
179 |
views.put(activeView,new Boolean(true)); |
|
180 |
} |
|
181 |
|
|
182 |
} |
|
0 | 183 |
tags/v2_0_0_Build_2038/extensions/extGazetteer/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 |
|
5 |
http://maven.apache.org/maven-v4_0_0.xsd"> |
|
6 |
|
|
7 |
<modelVersion>4.0.0</modelVersion> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.gazetteer.extension</artifactId> |
|
10 |
<packaging>jar</packaging> |
|
11 |
<version>2.0-SNAPSHOT</version> |
|
12 |
<name>Web Gazetteer Service client</name> |
|
13 |
<description>Web Gazetteer Service client (geographic names locating)</description> |
|
14 |
<url>http://maven.apache.org</url> |
|
15 |
<parent> |
|
16 |
<groupId>org.gvsig</groupId> |
|
17 |
<artifactId>gvsig-base-extension-pom</artifactId> |
|
18 |
<version>2.0-SNAPSHOT</version> |
|
19 |
</parent> |
|
20 |
<distributionManagement> |
|
21 |
<site> |
|
22 |
<id>gvsig-repository</id> |
|
23 |
<url>${site-repository}/</url> |
|
24 |
</site> |
|
25 |
</distributionManagement> |
|
26 |
|
|
27 |
<dependencies> |
|
28 |
<dependency> |
|
29 |
<groupId>org.gvsig</groupId> |
|
30 |
<artifactId>org.gvsig.gazetteer</artifactId> |
|
31 |
<version>2.0-SNAPSHOT</version> |
|
32 |
<scope>compile</scope> |
|
33 |
</dependency> |
|
34 |
<dependency> |
|
35 |
<groupId>org.gvsig</groupId> |
|
36 |
<artifactId>org.gvsig.catalog</artifactId> |
|
37 |
<scope>compile</scope> |
|
38 |
</dependency> |
|
39 |
<dependency> |
|
40 |
<groupId>org.gvsig</groupId> |
|
41 |
<artifactId>org.gvsig.andami</artifactId> |
|
42 |
<scope>compile</scope> |
|
43 |
</dependency> |
|
44 |
<dependency> |
|
45 |
<groupId>org.gvsig</groupId> |
|
46 |
<artifactId>org.gvsig.app</artifactId> |
|
47 |
<version>2.0-SNAPSHOT</version> |
|
48 |
<scope>compile</scope> |
|
49 |
</dependency> |
|
50 |
<dependency> |
|
51 |
<groupId>org.gvsig</groupId> |
|
52 |
<artifactId>org.gvsig.projection</artifactId> |
|
53 |
<scope>compile</scope> |
|
54 |
</dependency> |
|
55 |
<dependency> |
|
56 |
<groupId>org.gvsig</groupId> |
|
57 |
<artifactId>org.gvsig.symbology.lib.api</artifactId> |
|
58 |
<scope>compile</scope> |
|
59 |
</dependency> |
|
60 |
<dependency> |
|
61 |
<groupId>org.gvsig</groupId> |
|
62 |
<artifactId>org.gvsig.fmap.geometry</artifactId> |
|
63 |
<scope>compile</scope> |
|
64 |
</dependency> |
|
65 |
<dependency> |
|
66 |
<groupId>org.gvsig</groupId> |
|
67 |
<artifactId>org.gvsig.fmap.mapcontext</artifactId> |
|
68 |
<scope>compile</scope> |
|
69 |
</dependency> |
|
70 |
<dependency> |
|
71 |
<groupId>org.gvsig</groupId> |
|
72 |
<artifactId>org.gvsig.i18n</artifactId> |
|
73 |
<scope>compile</scope> |
|
74 |
</dependency> |
|
75 |
<dependency> |
|
76 |
<groupId>org.gvsig</groupId> |
|
77 |
<artifactId>org.gvsig.utils</artifactId> |
|
78 |
<scope>compile</scope> |
|
79 |
</dependency> |
|
80 |
<dependency> |
|
81 |
<groupId>org.gvsig</groupId> |
|
82 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
83 |
<scope>compile</scope> |
|
84 |
</dependency> |
|
85 |
<dependency> |
|
86 |
<groupId>org.gvsig</groupId> |
|
87 |
<artifactId>org.gvsig.fmap.control</artifactId> |
|
88 |
<scope>compile</scope> |
|
89 |
</dependency> |
|
90 |
<dependency> |
|
91 |
<groupId>org.gvsig</groupId> |
|
92 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
93 |
<scope>compile</scope> |
|
94 |
</dependency> |
|
95 |
</dependencies> |
|
96 |
<build> |
|
97 |
<sourceDirectory>src</sourceDirectory> |
|
98 |
<testSourceDirectory>src-test</testSourceDirectory> |
|
99 |
<plugins> |
|
100 |
<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION --> |
|
101 |
<plugin> |
|
102 |
<groupId>org.apache.maven.plugins</groupId> |
|
103 |
<artifactId>maven-surefire-plugin</artifactId> |
|
104 |
<configuration> |
|
105 |
<skipTests>true</skipTests> |
|
106 |
</configuration> |
|
107 |
</plugin> |
|
108 |
</plugins> |
|
109 |
</build> |
|
110 |
<properties> |
|
111 |
<build-dir>${basedir}/../build</build-dir> |
|
112 |
<application-name>extGazetteer</application-name> |
|
113 |
<eclipse.project.name>extGazetteer</eclipse.project.name> |
|
114 |
</properties> |
|
115 |
</project> |
|
0 | 116 |
tags/v2_0_0_Build_2038/extensions/extGazetteer/.cvsignore | ||
---|---|---|
1 |
bin |
|
0 | 2 |
tags/v2_0_0_Build_2038/extensions/extGazetteer/distribution/distribution.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>distribution</id> |
|
3 |
<formats> |
|
4 |
<format>dir</format> |
|
5 |
</formats> |
|
6 |
<fileSets> |
|
7 |
<fileSet> |
|
8 |
<directory>config</directory> |
|
9 |
<outputDirectory>${extension.install.dir.name}</outputDirectory> |
|
10 |
</fileSet> |
|
11 |
<fileSet> |
|
12 |
<directory>images</directory> |
|
13 |
<outputDirectory>/${extension.install.dir.name}/images</outputDirectory> |
|
14 |
</fileSet> |
|
15 |
</fileSets> |
|
16 |
<files> |
|
17 |
<file> |
|
18 |
<source>package.info</source> |
|
19 |
<outputDirectory>${extension.install.dir.name} |
|
20 |
</outputDirectory> |
|
21 |
</file> |
|
22 |
</files> |
|
23 |
<dependencySets> |
|
24 |
<dependencySet> |
|
25 |
<outputDirectory>${extension.install.dir.name}/${library-dir} |
|
26 |
</outputDirectory> |
|
27 |
<includes> |
|
28 |
<include>org.gvsig:org.gvsig.gazetteer</include> |
|
29 |
<include>org.gvsig:org.gvsig.gazetteer.extension</include> |
|
30 |
<include>org.geonames:geonames:jar:java5</include> |
|
31 |
<include>com.vividsolutions:jtsio</include> |
|
32 |
</includes> |
|
33 |
</dependencySet> |
|
34 |
</dependencySets> |
|
35 |
</assembly> |
|
36 |
|
|
0 | 37 |
tags/v2_0_0_Build_2038/extensions/extGazetteer/buildNumber.properties | ||
---|---|---|
1 |
#maven.buildNumber.plugin properties file |
|
2 |
#Mon Oct 24 14:21:15 CEST 2011 |
|
3 |
buildNumber=2038 |
tags/v2_0_0_Build_2038/extensions/extGazetteer/config/text_de.properties | ||
---|---|---|
1 |
#Translations for language [de] |
|
2 |
#Wed Oct 08 17:44:19 CEST 2008 |
|
3 |
arcims_load=L\u00e4dt ArcIMS |
|
4 |
arcims_server_error=ArcIMS Server-Fehler |
|
5 |
Catalog= |
|
6 |
catalog_search=Suche nach Geodaten |
|
7 |
Catalogo= |
|
8 |
Error_accediendo_a_los_datos=Fehler beim Datenzugriff |
|
9 |
gazetteer_connect=Lokalisierung \u00fcber Namensverzeichnis |
|
10 |
gazetteer_search=Suche \u00fcber Namensverzeichnis |
|
11 |
layer=Layer |
|
12 |
link=Link |
|
13 |
linkError=Fehler beim Laden der Netzwerkressource |
|
14 |
linkLoad=Netzwerkressource laden |
|
15 |
loadWMS=WMS laden |
|
16 |
mantainold=Vorherige Suchanfragen l\u00f6schen |
|
17 |
metadata_catalog=Suche nach Geodaten - Verbindung |
|
18 |
metadata_tree=Metadatenbaum |
|
19 |
parameters=Parameter |
|
20 |
pluginNotFound=Es fehlt die n\u00f6tige Erweiterung f\u00fcr das Laden dieser Ressource. |
|
21 |
pluginNotFoundTitle=Layer laden |
|
22 |
postgisError=Fehler beim Laden der PostGIS-Datenbank |
|
23 |
postgisLoad=PostGIS laden |
|
24 |
propertiesNameWindow=Eigenschaftsfenster |
|
25 |
Recursos\ Disponibles=Verf\u00fcgbare Ressourcen |
|
26 |
search_results=Suchergebnisse |
|
27 |
server=Server |
|
28 |
wcsError=Fehler beim Laden der Coverage |
|
29 |
wcsLoad=WCS laden |
|
30 |
wfsError=Fehler beim Laden des Features |
|
31 |
wfsLoad=WFS laden |
|
32 |
wmsError=Fehler beim Laden der Karte |
|
0 | 33 |
tags/v2_0_0_Build_2038/extensions/extGazetteer/config/text_en.properties | ||
---|---|---|
1 |
#Translations for language [en] |
|
2 |
#Mon Feb 26 16:06:24 CET 2007 |
|
3 |
abstract=Abstract |
|
4 |
addLayer=Add Layer |
|
5 |
allWords=Every word |
|
6 |
anyResult=The search hasn't retrieve any result |
|
7 |
anyWord=Any word |
|
8 |
arcims_load=Loading ArcIms |
|
9 |
arcims_server_error=ArcIMS server error |
|
10 |
aspect=Aspect setup |
|
11 |
attributes=Attributes |
|
12 |
BRX=BRX\: |
|
13 |
BRY=BRY\: |
|
14 |
cancelSearchButton=Cancel |
|
15 |
catalog_search=Geodata search |
|
16 |
cathegory=Cathegory |
|
17 |
cathegoryAny=Any |
|
18 |
cathegoryBiota=Biota |
|
19 |
cathegoryBoundaries=Boundaries |
|
20 |
cathegoryClimatologyMeteorologyAtmosphere=Climatology meteorology and atmosphere |
|
21 |
cathegoryEconomy=Economy |
|
22 |
cathegoryElevation=Elevation |
|
23 |
cathegoryEnvironment=Environment |
|
24 |
cathegoryFarming=Farming |
|
25 |
cathegoryGeoscientificInformation=Geoscientific information |
|
26 |
cathegoryHealth=Health |
|
27 |
cathegoryImageryBaseMapsEarthCover=Imagery base maps earth cover |
|
28 |
cathegoryInlandWaters=Insland waters |
|
29 |
cathegoryIntelligenceMilitary=Intelligence military |
|
30 |
cathegoryLocation=Location |
Also available in: Unified diff