Revision 2409
org.gvsig.raster.postgis/tags/gvSIGv2_1_0_Build_2218/org.gvsig.raster.postgis.app.postgisrasterclient/buildNumber.properties | ||
---|---|---|
1 |
#maven.buildNumber.plugin properties file |
|
2 |
#Wed May 15 12:27:18 CEST 2013 |
|
3 |
buildNumber=48 |
|
0 | 4 |
org.gvsig.raster.postgis/tags/gvSIGv2_1_0_Build_2218/org.gvsig.raster.postgis.app.postgisrasterclient/src/main/java/org/gvsig/raster/postgis/app/postgisrasterclient/PostGISRasterExtension.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 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 |
package org.gvsig.raster.postgis.app.postgisrasterclient; |
|
20 |
|
|
21 |
import org.gvsig.about.AboutManager; |
|
22 |
import org.gvsig.about.AboutParticipant; |
|
23 |
import org.gvsig.andami.plugins.Extension; |
|
24 |
import org.gvsig.app.ApplicationLocator; |
|
25 |
import org.gvsig.app.ApplicationManager; |
|
26 |
import org.gvsig.app.extension.AddLayer; |
|
27 |
import org.gvsig.raster.postgis.app.postgisrasterclient.gui.AddPostGISRasterLayerWizard; |
|
28 |
|
|
29 |
/** |
|
30 |
* Entry point for PostGISRaster extension |
|
31 |
* |
|
32 |
* @author Nacho Brodin (nachobrodin@gmail.org) |
|
33 |
*/ |
|
34 |
public class PostGISRasterExtension extends Extension { |
|
35 |
/** |
|
36 |
* Initializes the wizard panel |
|
37 |
* |
|
38 |
*/ |
|
39 |
public void initialize() { |
|
40 |
initializeIcons(); |
|
41 |
} |
|
42 |
|
|
43 |
/** |
|
44 |
* @see com.iver.andami.plugins.IExtension#postInitialize() |
|
45 |
*/ |
|
46 |
@Override |
|
47 |
public void postInitialize() { |
|
48 |
super.postInitialize(); |
|
49 |
addAboutInfo(); |
|
50 |
|
|
51 |
AddLayer.addWizard(AddPostGISRasterLayerWizard.class); |
|
52 |
} |
|
53 |
|
|
54 |
private void addAboutInfo() { |
|
55 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
56 |
|
|
57 |
AboutManager about = application.getAbout(); |
|
58 |
about.addDeveloper("PRODEVELOP", getClass().getClassLoader() |
|
59 |
.getResource("about/postgisraster-about.html"), 2); |
|
60 |
|
|
61 |
AboutParticipant participant = about.getDeveloper("PRODEVELOP"); |
|
62 |
participant.addContribution( |
|
63 |
"PostGIS Raster", |
|
64 |
"Soporte para BBDD r?ster usando PostGIS", |
|
65 |
2011,12,1, |
|
66 |
2011,12,31 |
|
67 |
); |
|
68 |
} |
|
69 |
|
|
70 |
public void execute(String actionCommand) { |
|
71 |
//Removes Gdal dependency |
|
72 |
/*try { |
|
73 |
test(); |
|
74 |
} catch (GdalException e) { |
|
75 |
e.printStackTrace(); |
|
76 |
} catch (IOException e) { |
|
77 |
e.printStackTrace(); |
|
78 |
}*/ |
|
79 |
} |
|
80 |
|
|
81 |
//Removes Gdal dependency |
|
82 |
/*private void test() throws GdalException, IOException{ |
|
83 |
Gdal gdal = new Gdal(); |
|
84 |
gdal.open("PG:host='130.0.2.122' port='5432' dbname='testgis' user='postgres' password='postgres' schema='public' table='small_world_1tile'", Gdal.GA_ReadOnly); |
|
85 |
int w = gdal.getRasterXSize(); |
|
86 |
int h = gdal.getRasterYSize(); |
|
87 |
System.out.println(w + " " + h); |
|
88 |
GdalRasterBand[] b = new GdalRasterBand[3]; |
|
89 |
b[0] = gdal.getRasterBand(1); |
|
90 |
b[1] = gdal.getRasterBand(2); |
|
91 |
b[2] = gdal.getRasterBand(3); |
|
92 |
|
|
93 |
int dt = b[0].getRasterDataType(); |
|
94 |
GdalBuffer buf = b[0].readRaster(0, 0, w, h, w, h, dt); |
|
95 |
byte[] bb = buf.buffByte; |
|
96 |
for(int i = 0; i < 10; i++) { |
|
97 |
System.out.print(bb[i] + " "); |
|
98 |
} |
|
99 |
gdal.close(); |
|
100 |
}*/ |
|
101 |
|
|
102 |
|
|
103 |
public boolean isEnabled() { |
|
104 |
return true; |
|
105 |
} |
|
106 |
|
|
107 |
public boolean isVisible() { |
|
108 |
return true; |
|
109 |
} |
|
110 |
|
|
111 |
void initializeIcons(){ |
|
112 |
|
|
113 |
} |
|
114 |
} |
|
0 | 115 |
org.gvsig.raster.postgis/tags/gvSIGv2_1_0_Build_2218/org.gvsig.raster.postgis.app.postgisrasterclient/src/main/java/org/gvsig/raster/postgis/app/postgisrasterclient/gui/AddPostGISRasterLayerWizard.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.raster.postgis.app.postgisrasterclient.gui; |
|
23 |
|
|
24 |
import java.awt.event.ActionEvent; |
|
25 |
import java.awt.event.ActionListener; |
|
26 |
import java.util.HashMap; |
|
27 |
import java.util.Iterator; |
|
28 |
import java.util.List; |
|
29 |
import java.util.Map; |
|
30 |
import java.util.Map.Entry; |
|
31 |
|
|
32 |
import javax.swing.JComboBox; |
|
33 |
import javax.swing.JPanel; |
|
34 |
import javax.swing.event.ListSelectionEvent; |
|
35 |
import javax.swing.event.ListSelectionListener; |
|
36 |
|
|
37 |
import org.gvsig.andami.PluginServices; |
|
38 |
import org.gvsig.andami.PluginsLocator; |
|
39 |
import org.gvsig.andami.PluginsManager; |
|
40 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
41 |
import org.gvsig.app.gui.WizardPanel; |
|
42 |
import org.gvsig.app.gui.wizards.WizardListener; |
|
43 |
import org.gvsig.app.gui.wizards.WizardListenerSupport; |
|
44 |
import org.gvsig.app.project.documents.view.gui.AbstractViewPanel; |
|
45 |
import org.gvsig.compat.net.ICancellable; |
|
46 |
import org.gvsig.fmap.dal.DALLocator; |
|
47 |
import org.gvsig.fmap.dal.DataManager; |
|
48 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
49 |
import org.gvsig.fmap.dal.exception.DataException; |
|
50 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
51 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
52 |
import org.gvsig.fmap.dal.exception.ReadException; |
|
53 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
54 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
55 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
56 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
57 |
import org.gvsig.fmap.dal.serverexplorer.db.DBServerExplorer; |
|
58 |
import org.gvsig.fmap.dal.serverexplorer.db.DBServerExplorerParameters; |
|
59 |
import org.gvsig.fmap.dal.store.db.DBStoreParameters; |
|
60 |
import org.gvsig.geodb.ExtDB_Spatial; |
|
61 |
import org.gvsig.geodb.vectorialdb.wizard.MyExplorer; |
|
62 |
import org.gvsig.geodb.vectorialdb.wizard.VectorialDBConnectionParamsDialog; |
|
63 |
import org.gvsig.raster.postgis.io.PostGISRasterCoreException; |
|
64 |
import org.gvsig.raster.postgis.swing.AddLayerUI; |
|
65 |
import org.gvsig.raster.postgis.swing.PostGISRasterSwingLocator; |
|
66 |
import org.gvsig.raster.util.CancelTaskImpl; |
|
67 |
import org.gvsig.tools.dynobject.DynObject; |
|
68 |
import org.slf4j.Logger; |
|
69 |
import org.slf4j.LoggerFactory; |
|
70 |
|
|
71 |
/** |
|
72 |
* Wizard panel to add a new PostGIS raster layer |
|
73 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
74 |
*/ |
|
75 |
public class AddPostGISRasterLayerWizard extends WizardPanel implements ActionListener, ListSelectionListener { |
|
76 |
private static final long serialVersionUID = 1L; |
|
77 |
private static final String TAB_NAME = "PostGIS Raster"; |
|
78 |
private static Logger logger = LoggerFactory.getLogger(AddPostGISRasterLayerWizard.class.getName()); |
|
79 |
private AbstractViewPanel view = null; |
|
80 |
private AddLayerUI apiUI = null; |
|
81 |
private ICancellable cancel = null; |
|
82 |
private LayerLoaderManager layerLoaderManager = null; |
|
83 |
private WizardListenerSupport listenerSupport = null; |
|
84 |
|
|
85 |
/** |
|
86 |
* Thread to connect to a PostGIS raster server |
|
87 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
88 |
*/ |
|
89 |
public class ConnectThread extends Thread { |
|
90 |
private ICancellable cancel = null; |
|
91 |
|
|
92 |
public ConnectThread(ICancellable cancel) { |
|
93 |
this.cancel = cancel; |
|
94 |
} |
|
95 |
|
|
96 |
public void run() { |
|
97 |
try { |
|
98 |
layerLoaderManager.loadLayers(); |
|
99 |
} finally { |
|
100 |
((CancelTaskImpl)cancel).setCanceled(false); |
|
101 |
} |
|
102 |
} |
|
103 |
} |
|
104 |
|
|
105 |
public AddPostGISRasterLayerWizard() { |
|
106 |
super(); |
|
107 |
initialize(); |
|
108 |
} |
|
109 |
|
|
110 |
private void initialize() { |
|
111 |
setTabName(PluginServices.getText(this, TAB_NAME)); |
|
112 |
setLayout(null); |
|
113 |
|
|
114 |
IWindow iw = PluginServices.getMDIManager().getActiveWindow(); |
|
115 |
|
|
116 |
if (iw == null) { |
|
117 |
return; |
|
118 |
} |
|
119 |
|
|
120 |
if (!(iw instanceof AbstractViewPanel)) { |
|
121 |
return; |
|
122 |
} |
|
123 |
|
|
124 |
apiUI = PostGISRasterSwingLocator.getSwingManager().createAddLayerUI(); |
|
125 |
apiUI.addListenerToBDSelectionCombo(this); |
|
126 |
apiUI.addListenerToNewDBButton(this); |
|
127 |
apiUI.addListenerToTableSelector(this); |
|
128 |
|
|
129 |
view = (AbstractViewPanel) iw; |
|
130 |
setMapCtrl(view.getMapControl()); |
|
131 |
|
|
132 |
JPanel mainPanel = (JPanel)apiUI.getComponent(); |
|
133 |
mainPanel.setBounds(new java.awt.Rectangle(0, 0, 501, 350)); |
|
134 |
add(mainPanel, null); |
|
135 |
|
|
136 |
layerLoaderManager = new LayerLoaderManager(apiUI); |
|
137 |
|
|
138 |
loadVectorialDBDatasourcesCombo(null); |
|
139 |
} |
|
140 |
|
|
141 |
private WizardListenerSupport getWizardListenerSupport() { |
|
142 |
if(listenerSupport == null) |
|
143 |
listenerSupport = new WizardListenerSupport(); |
|
144 |
return listenerSupport; |
|
145 |
} |
|
146 |
|
|
147 |
/** |
|
148 |
* This method checks for the options selected within the configuration |
|
149 |
* dialog are correct. |
|
150 |
* |
|
151 |
* @return true if you're done, false if not. |
|
152 |
*/ |
|
153 |
public boolean areSettingsValid() { |
|
154 |
return (apiUI.getSelectedTables() != null && apiUI.getSelectedTables().size() > 0); |
|
155 |
} |
|
156 |
|
|
157 |
public void addWizardListener(WizardListener listener) { |
|
158 |
getWizardListenerSupport().addWizardListener(listener); |
|
159 |
getWizardListenerSupport().callStateChanged(false); |
|
160 |
} |
|
161 |
|
|
162 |
public void removeWizardListener(WizardListener listener) { |
|
163 |
getWizardListenerSupport().removeWizardListener(listener); |
|
164 |
} |
|
165 |
|
|
166 |
/** |
|
167 |
* Loads the ComboBox for listing connections |
|
168 |
* @param sel |
|
169 |
*/ |
|
170 |
private void loadVectorialDBDatasourcesCombo(MyExplorer sel) { |
|
171 |
JComboBox combo = apiUI.getDBCombo(); |
|
172 |
PluginsManager manager = PluginsLocator.getManager(); |
|
173 |
DynObject values = manager.getPlugin(ExtDB_Spatial.class).getPluginProperties(); |
|
174 |
Map connections = (Map) values.getDynValue("db_connections"); |
|
175 |
if (connections != null){ |
|
176 |
Iterator it = connections.entrySet().iterator(); |
|
177 |
combo.removeAllItems(); |
|
178 |
combo.addItem(""); |
|
179 |
while (it.hasNext()){ |
|
180 |
Map.Entry entry = (Entry) it.next(); |
|
181 |
MyExplorer myExplorer = new MyExplorer(); |
|
182 |
myExplorer.setDbExplorerParameters((DBServerExplorerParameters) entry.getValue()); |
|
183 |
myExplorer.setName((String) entry.getKey()); |
|
184 |
combo.addItem(myExplorer); |
|
185 |
if(sel!=null && sel.getName().equalsIgnoreCase(myExplorer.getName())){ |
|
186 |
combo.setSelectedItem(myExplorer); |
|
187 |
} |
|
188 |
} |
|
189 |
} else { |
|
190 |
connections = new HashMap(); |
|
191 |
values.setDynValue("db_connections", connections); |
|
192 |
} |
|
193 |
} |
|
194 |
|
|
195 |
@Override |
|
196 |
public void close() { |
|
197 |
|
|
198 |
} |
|
199 |
|
|
200 |
@Override |
|
201 |
public void execute() { |
|
202 |
layerLoaderManager.showConnectionInfoMessage(PluginServices.getText(this, "loading_postgis_raster_layer")); |
|
203 |
cancel = new CancelTaskImpl(); |
|
204 |
new ConnectThread(cancel).start(); |
|
205 |
} |
|
206 |
|
|
207 |
@Override |
|
208 |
public DataStoreParameters[] getParameters() { |
|
209 |
return null; |
|
210 |
} |
|
211 |
|
|
212 |
@Override |
|
213 |
public void initWizard() { |
|
214 |
|
|
215 |
} |
|
216 |
|
|
217 |
/** |
|
218 |
* Updates the JList component with the list of tables of |
|
219 |
* the selected database. |
|
220 |
* |
|
221 |
* @param dbSeverExplorerParameters2 |
|
222 |
*/ |
|
223 |
private void updateTableList( |
|
224 |
DBServerExplorerParameters dbSeverExplorerParameters2) { |
|
225 |
if (dbSeverExplorerParameters2 == null) { |
|
226 |
return; |
|
227 |
} |
|
228 |
DataManager dm = DALLocator.getDataManager(); |
|
229 |
DBServerExplorer dbExplorer = null; |
|
230 |
try { |
|
231 |
dbExplorer = (DBServerExplorer) dm.openServerExplorer(dbSeverExplorerParameters2.getExplorerName(), dbSeverExplorerParameters2); |
|
232 |
|
|
233 |
if(dbExplorer == null) { |
|
234 |
throw new Exception(); |
|
235 |
} |
|
236 |
|
|
237 |
List<?> parameters = dbExplorer.list(); |
|
238 |
|
|
239 |
Iterator<?> iter = parameters.iterator(); |
|
240 |
DBStoreParameters param = null; |
|
241 |
apiUI.clearList(); |
|
242 |
while (iter.hasNext()) { |
|
243 |
param = (DBStoreParameters) iter.next(); |
|
244 |
|
|
245 |
//Criterios para a�adir la tabla a la lista |
|
246 |
try { |
|
247 |
if(isTableNamePreffixValid(param) && isRasterTable(param)) { |
|
248 |
apiUI.addElementToTable(new TableListItem(dbExplorer, param)); |
|
249 |
} |
|
250 |
} catch (PostGISRasterCoreException e) { |
|
251 |
logger.info("While getting table names: " + e.getMessage(), e); |
|
252 |
} |
|
253 |
} |
|
254 |
|
|
255 |
} catch (ReadException e) { |
|
256 |
logger.info("While getting table names: " + e.getMessage(), e); |
|
257 |
layerLoaderManager.showConnectionErrorMessage(PluginServices.getText(this, "error_getting_tables")); |
|
258 |
return; |
|
259 |
} catch (Exception e) { |
|
260 |
logger.info("While getting table names: " + e.getMessage(), e); |
|
261 |
layerLoaderManager.showConnectionErrorMessage(PluginServices.getText(this, "error_getting_tables")); |
|
262 |
return; |
|
263 |
} |
|
264 |
} |
|
265 |
|
|
266 |
private boolean isTableNamePreffixValid(DBStoreParameters param) { |
|
267 |
return !param.getTable().startsWith("o_"); |
|
268 |
} |
|
269 |
|
|
270 |
/** |
|
271 |
* Checks is the table has the structure to contain a raster |
|
272 |
* @param param |
|
273 |
* @return |
|
274 |
* @throws PostGISRasterCoreException |
|
275 |
*/ |
|
276 |
private boolean isRasterTable(DBStoreParameters param) throws PostGISRasterCoreException { |
|
277 |
DataManager dm = DALLocator.getDataManager(); |
|
278 |
FeatureStore store; |
|
279 |
try { |
|
280 |
store = (FeatureStore)dm.openStore(param.getDataStoreName(), param); |
|
281 |
|
|
282 |
FeatureType featureType = store.getDefaultFeatureType(); |
|
283 |
if(featureType.size() == 2) { |
|
284 |
if(existsAttr(featureType, "rid") && existsAttr(featureType, "rast")) |
|
285 |
return true; |
|
286 |
} |
|
287 |
store.dispose(); |
|
288 |
} catch (ValidateDataParametersException e) { |
|
289 |
throw new PostGISRasterCoreException(e); |
|
290 |
} catch (InitializeException e) { |
|
291 |
throw new PostGISRasterCoreException(e); |
|
292 |
} catch (ProviderNotRegisteredException e) { |
|
293 |
throw new PostGISRasterCoreException(e); |
|
294 |
} catch (DataException e) { |
|
295 |
throw new PostGISRasterCoreException(e); |
|
296 |
} |
|
297 |
return false; |
|
298 |
} |
|
299 |
|
|
300 |
private boolean existsAttr(FeatureType featureType, String attr) { |
|
301 |
Iterator<?> it = featureType.iterator(); |
|
302 |
while( it.hasNext() ) { |
|
303 |
FeatureAttributeDescriptor attribute = (FeatureAttributeDescriptor)it.next(); |
|
304 |
if(attribute.getName().compareTo(attr) == 0) { |
|
305 |
return true; |
|
306 |
} |
|
307 |
} |
|
308 |
return false; |
|
309 |
} |
|
310 |
|
|
311 |
public void actionPerformed(ActionEvent e) { |
|
312 |
if (apiUI.isAddDBEventObject(e.getSource())) { |
|
313 |
MyExplorer sel = addNewConnection(); |
|
314 |
|
|
315 |
if (sel != null) { |
|
316 |
DBServerExplorerParameters dbExplorerParameters = sel.getDbSeverExplorerParameters(); |
|
317 |
layerLoaderManager.setDBServerExplorerParameters(dbExplorerParameters); |
|
318 |
loadVectorialDBDatasourcesCombo(sel); |
|
319 |
apiUI.getDBCombo().setSelectedItem(sel); |
|
320 |
} |
|
321 |
} |
|
322 |
|
|
323 |
if(e.getSource() == apiUI.getDBCombo()) { |
|
324 |
JComboBox dbCombo = apiUI.getDBCombo(); |
|
325 |
if(dbCombo.getItemCount() == 0) { |
|
326 |
apiUI.clearList(); |
|
327 |
} else { |
|
328 |
Object selected = dbCombo.getSelectedItem(); |
|
329 |
if(selected == null) |
|
330 |
return; |
|
331 |
if (selected instanceof MyExplorer) { |
|
332 |
MyExplorer sel_obj = (MyExplorer) selected; |
|
333 |
dbCombo.repaint(); |
|
334 |
DBServerExplorerParameters dbExplorerParameters = sel_obj.getDbSeverExplorerParameters(); |
|
335 |
layerLoaderManager.setDBServerExplorerParameters(dbExplorerParameters); |
|
336 |
updateTableList(dbExplorerParameters); |
|
337 |
} |
|
338 |
} |
|
339 |
} |
|
340 |
} |
|
341 |
|
|
342 |
/** |
|
343 |
* Adds a new connection using the generic dialog. This function |
|
344 |
* is used when the button add new connection is pressed by the user |
|
345 |
* @return |
|
346 |
*/ |
|
347 |
@SuppressWarnings("unchecked") |
|
348 |
private MyExplorer addNewConnection() { |
|
349 |
MyExplorer myExplorer = new MyExplorer(); |
|
350 |
DBServerExplorerParameters resp = null; |
|
351 |
|
|
352 |
VectorialDBConnectionParamsDialog newco = new VectorialDBConnectionParamsDialog(); |
|
353 |
newco.showDialog(); |
|
354 |
|
|
355 |
if (newco.isOkPressed()) { |
|
356 |
try { |
|
357 |
resp = newco.getParameters(); |
|
358 |
} catch (Exception e) { |
|
359 |
layerLoaderManager.showConnectionErrorMessage(e.getMessage()); |
|
360 |
return null; |
|
361 |
} |
|
362 |
PluginsManager manager = PluginsLocator.getManager(); |
|
363 |
DynObject values = manager.getPlugin(ExtDB_Spatial.class).getPluginProperties(); |
|
364 |
Map connections = (Map) values.getDynValue("db_connections"); |
|
365 |
if(connections == null){ |
|
366 |
connections = new HashMap(); |
|
367 |
values.setDynValue("db_connections", connections); |
|
368 |
} |
|
369 |
connections.put(newco.getConnectionName(), resp); |
|
370 |
|
|
371 |
myExplorer.setDbExplorerParameters(resp); |
|
372 |
myExplorer.setName(newco.getConnectionName()); |
|
373 |
return myExplorer; |
|
374 |
} else { |
|
375 |
return null; |
|
376 |
} |
|
377 |
} |
|
378 |
|
|
379 |
public void valueChanged(ListSelectionEvent e) { |
|
380 |
if (apiUI.isAddTableEvent(e.getSource())) { |
|
381 |
List<Object> tables = apiUI.getSelectedTables(); |
|
382 |
apiUI.clearSubdatasetList(); |
|
383 |
|
|
384 |
if(tables.size() == 1) { |
|
385 |
TableListItem item = (TableListItem)tables.get(0); |
|
386 |
String schema = item.getSchema(); |
|
387 |
String table = item.getTableName(); |
|
388 |
long columns = layerLoaderManager.getNumberOfColumns(schema, table); |
|
389 |
for (int i = 0; i < columns; i++) { |
|
390 |
apiUI.addSubdatasetToTable(schema + "." + table + " rid = " + i); |
|
391 |
} |
|
392 |
} |
|
393 |
getWizardListenerSupport().callStateChanged(areSettingsValid()); |
|
394 |
} |
|
395 |
} |
|
396 |
|
|
397 |
} |
|
0 | 398 |
org.gvsig.raster.postgis/tags/gvSIGv2_1_0_Build_2218/org.gvsig.raster.postgis.app.postgisrasterclient/src/main/java/org/gvsig/raster/postgis/app/postgisrasterclient/gui/TableListItem.java | ||
---|---|---|
1 |
package org.gvsig.raster.postgis.app.postgisrasterclient.gui; |
|
2 |
|
|
3 |
import org.gvsig.fmap.dal.serverexplorer.db.DBServerExplorer; |
|
4 |
import org.gvsig.fmap.dal.store.db.DBStoreParameters; |
|
5 |
|
|
6 |
/** |
|
7 |
* Represents an element in the list of tables. |
|
8 |
* |
|
9 |
* @author Nacho Brodin (nachobrodin@gmail.org) |
|
10 |
*/ |
|
11 |
public class TableListItem { |
|
12 |
private DBStoreParameters parameters = null; |
|
13 |
private DBServerExplorer explorer = null; |
|
14 |
private String tableName = ""; |
|
15 |
|
|
16 |
public TableListItem(DBServerExplorer explorer, |
|
17 |
DBStoreParameters param) { |
|
18 |
tableName = param.getTable(); |
|
19 |
this.parameters = param; |
|
20 |
this.explorer = explorer; |
|
21 |
} |
|
22 |
|
|
23 |
public String toString() { |
|
24 |
return tableName; |
|
25 |
} |
|
26 |
|
|
27 |
public String getTableName() { |
|
28 |
return tableName; |
|
29 |
} |
|
30 |
|
|
31 |
public String getSchema() { |
|
32 |
return (String)parameters.getDynValue("Schema"); |
|
33 |
} |
|
34 |
|
|
35 |
public DBStoreParameters getDBStoreParameters() { |
|
36 |
return parameters; |
|
37 |
} |
|
38 |
|
|
39 |
public DBServerExplorer getExplorer() { |
|
40 |
return explorer; |
|
41 |
} |
|
42 |
} |
|
0 | 43 |
org.gvsig.raster.postgis/tags/gvSIGv2_1_0_Build_2218/org.gvsig.raster.postgis.app.postgisrasterclient/src/main/java/org/gvsig/raster/postgis/app/postgisrasterclient/gui/LayerLoaderManager.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.raster.postgis.app.postgisrasterclient.gui; |
|
23 |
|
|
24 |
import java.util.List; |
|
25 |
|
|
26 |
import javax.swing.JOptionPane; |
|
27 |
|
|
28 |
import org.gvsig.andami.PluginServices; |
|
29 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
30 |
import org.gvsig.fmap.dal.DALLocator; |
|
31 |
import org.gvsig.fmap.dal.DataManager; |
|
32 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
33 |
import org.gvsig.fmap.dal.coverage.store.parameter.TileDataParameters; |
|
34 |
import org.gvsig.fmap.dal.exception.DataException; |
|
35 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
36 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
|
37 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
38 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
39 |
import org.gvsig.fmap.dal.serverexplorer.db.DBServerExplorerParameters; |
|
40 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
41 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
42 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
|
43 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
|
44 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
45 |
import org.gvsig.raster.fmap.layers.DefaultFLyrRaster; |
|
46 |
import org.gvsig.raster.fmap.layers.FLyrRaster; |
|
47 |
import org.gvsig.raster.postgis.io.PostGISRasterDataParameters; |
|
48 |
import org.gvsig.raster.postgis.io.PostGISRasterServerExplorer; |
|
49 |
import org.gvsig.raster.postgis.io.PostGISRasterServerExplorerParameters; |
|
50 |
import org.gvsig.raster.postgis.swing.AddLayerUI; |
|
51 |
import org.gvsig.raster.util.RasterNotLoadException; |
|
52 |
import org.slf4j.Logger; |
|
53 |
import org.slf4j.LoggerFactory; |
|
54 |
|
|
55 |
/** |
|
56 |
* Manager to load layers in TOC. There are some strategies, load a entire layer |
|
57 |
* or load subdatasets depending on the user selection or the layer structure. |
|
58 |
* |
|
59 |
* @author Nacho Brodin (nachobrodin@gmail.com) |
|
60 |
*/ |
|
61 |
public class LayerLoaderManager { |
|
62 |
private static int ALL_SUBDATASETS = -2; |
|
63 |
private static int ENTIRE = -1; |
|
64 |
|
|
65 |
private static Logger logger = LoggerFactory.getLogger(AddPostGISRasterLayerWizard.class.getName()); |
|
66 |
private AddLayerUI apiUI = null; |
|
67 |
private DBServerExplorerParameters dbExplorerParameters = null; |
|
68 |
private MapContext mapContext = null; |
|
69 |
|
|
70 |
public LayerLoaderManager(AddLayerUI ui) { |
|
71 |
this.apiUI = ui; |
|
72 |
} |
|
73 |
|
|
74 |
/** |
|
75 |
* Assigns a {@link DBServerExplorerParameters} |
|
76 |
* @param params |
|
77 |
*/ |
|
78 |
public void setDBServerExplorerParameters(DBServerExplorerParameters params) { |
|
79 |
this.dbExplorerParameters = params; |
|
80 |
} |
|
81 |
|
|
82 |
/** |
|
83 |
* Gets the {@link DBServerExplorerParameters} |
|
84 |
* @return {@link DBServerExplorerParameters} |
|
85 |
*/ |
|
86 |
public DBServerExplorerParameters getDBServerExplorerParameters() { |
|
87 |
return this.dbExplorerParameters; |
|
88 |
} |
|
89 |
|
|
90 |
/** |
|
91 |
* Return FLayers if user performs multi selection. |
|
92 |
*/ |
|
93 |
public void loadLayers() { |
|
94 |
if(dbExplorerParameters == null) |
|
95 |
return; |
|
96 |
|
|
97 |
List<Object> tables = apiUI.getSelectedTables(); |
|
98 |
|
|
99 |
//Para una tabla seleccionada |
|
100 |
if(tables.size() == 1) { |
|
101 |
TableListItem item = (TableListItem)tables.get(0); |
|
102 |
String schema = item.getSchema(); |
|
103 |
String table = item.getTableName(); |
|
104 |
|
|
105 |
//Sin subdatasets |
|
106 |
if(getNumberOfColumns(schema, table) == 1) { |
|
107 |
loadOneLayer(item, ENTIRE); |
|
108 |
} |
|
109 |
//Con subdatasets |
|
110 |
else { |
|
111 |
int[] subdatasets = apiUI.getSelectedSubdatasets(); |
|
112 |
if(subdatasets == null || subdatasets.length <= 0) { |
|
113 |
loadOneLayer(item, ALL_SUBDATASETS); |
|
114 |
} else { |
|
115 |
long cols = getNumberOfColumns(schema, table); |
|
116 |
for (int i = 0; i < cols; i++) { |
|
117 |
loadOneLayer(item, i + 1); |
|
118 |
} |
|
119 |
} |
|
120 |
} |
|
121 |
} |
|
122 |
|
|
123 |
//Para m?s de una tabla seleccionada (se usan todos los subdatasets) |
|
124 |
if(tables.size() > 1) { |
|
125 |
for (int i = 0; i < tables.size(); i++) { |
|
126 |
TableListItem item = (TableListItem)tables.get(i); |
|
127 |
String schema = item.getSchema(); |
|
128 |
String table = item.getTableName(); |
|
129 |
long subdatasets = getNumberOfColumns(schema, table); |
|
130 |
if(subdatasets == 1) { |
|
131 |
loadOneLayer(item, ENTIRE); |
|
132 |
} |
|
133 |
if(subdatasets > 1) { |
|
134 |
loadOneLayer(item, ALL_SUBDATASETS); |
|
135 |
} |
|
136 |
} |
|
137 |
} |
|
138 |
|
|
139 |
} |
|
140 |
|
|
141 |
/** |
|
142 |
* Loads only one layer |
|
143 |
* @param item |
|
144 |
* @param subdataset |
|
145 |
*/ |
|
146 |
private void loadOneLayer(TableListItem item, int subdataset) { |
|
147 |
String host = dbExplorerParameters.getHost(); |
|
148 |
if(host.compareTo("localhost") == 0) |
|
149 |
host = "127.0.0.1"; |
|
150 |
Integer port = dbExplorerParameters.getPort(); |
|
151 |
String dbname = dbExplorerParameters.getDBName(); |
|
152 |
String user = dbExplorerParameters.getUser(); |
|
153 |
String password = dbExplorerParameters.getPassword(); |
|
154 |
String schema = item.getSchema(); |
|
155 |
String table = item.getTableName(); |
|
156 |
String connString = null; |
|
157 |
if(schema == null) |
|
158 |
connString = "PG:host='" + host + "' port='" + port + "' dbname='" + dbname + "' user='" + user + "' password='" + password + "' table='" + table + "'"; |
|
159 |
else |
|
160 |
connString = "PG:host='" + host + "' port='" + port + "' dbname='" + dbname + "' user='" + user + "' password='" + password + "' schema='" + schema + "' table='" + table + "'"; |
|
161 |
|
|
162 |
if(subdataset == ALL_SUBDATASETS) |
|
163 |
connString += " mode='2'"; |
|
164 |
|
|
165 |
if(subdataset >= 0) |
|
166 |
connString += " column='rast' where='rid = "+ subdataset + "'"; |
|
167 |
|
|
168 |
try { |
|
169 |
FLayer layer = createLayer(getFormatedRasterFileName(connString), connString, item, getNumberOfColumns(schema, table)); |
|
170 |
|
|
171 |
//Adds the layer to the view |
|
172 |
getMapContext().beginAtomicEvent(); |
|
173 |
layer.setVisible(true); |
|
174 |
getMapContext().getLayers().addLayer(layer); |
|
175 |
getMapContext().callLegendChanged(); |
|
176 |
getMapContext().endAtomicEvent(); |
|
177 |
getMapContext().invalidate(); |
|
178 |
} catch (LoadLayerException e) { |
|
179 |
logger.info("Error creating layer: " + e.getMessage(), e); |
|
180 |
//showConnectionErrorMessage(PluginServices.getText(this, "error_creating_layer") + ""); |
|
181 |
} |
|
182 |
} |
|
183 |
|
|
184 |
/** |
|
185 |
* Gets the MapContext |
|
186 |
* @return |
|
187 |
*/ |
|
188 |
private MapContext getMapContext() { |
|
189 |
if(mapContext == null) { |
|
190 |
IWindow[] w = PluginServices.getMDIManager().getAllWindows(); |
|
191 |
for (int i = 0; i < w.length; i++) { |
|
192 |
if (w[i] instanceof org.gvsig.app.project.documents.view.gui.AbstractViewPanel) { |
|
193 |
mapContext = ((org.gvsig.app.project.documents.view.gui.AbstractViewPanel)w[i]).getMapControl().getMapContext(); |
|
194 |
} |
|
195 |
} |
|
196 |
} |
|
197 |
return mapContext; |
|
198 |
} |
|
199 |
|
|
200 |
/** |
|
201 |
* Builds a new raster layer |
|
202 |
* @param fileName |
|
203 |
* @return |
|
204 |
* @throws RasterNotLoadException |
|
205 |
* @throws LoadLayerException |
|
206 |
*/ |
|
207 |
@SuppressWarnings("deprecation") |
|
208 |
public FLyrRaster createLayer(String layerName, String conn, TableListItem item, long nColumns) throws LoadLayerException { |
|
209 |
DataManager dataManager = DALLocator.getDataManager(); |
|
210 |
DefaultFLyrRaster lyr = null; |
|
211 |
try { |
|
212 |
PostGISRasterServerExplorerParameters explorerParams = (PostGISRasterServerExplorerParameters) dataManager.createServerExplorerParameters(PostGISRasterServerExplorer.NAME); |
|
213 |
explorerParams.setHost(conn); |
|
214 |
PostGISRasterServerExplorer explorer = (PostGISRasterServerExplorer) dataManager.createServerExplorer(explorerParams); |
|
215 |
PostGISRasterDataParameters storeParameters = (PostGISRasterDataParameters)explorer.getStoredParameters(); |
|
216 |
storeParameters.setURI(conn); |
|
217 |
storeParameters.setDBExplorer(item.getExplorer()); |
|
218 |
storeParameters.setNumberOfBlocks(nColumns); |
|
219 |
storeParameters.setDBStoreParameters(item.getDBStoreParameters()); |
|
220 |
storeParameters.setDBExplorerParameters(dbExplorerParameters); |
|
221 |
|
|
222 |
MapContextManager mcm = MapContextLocator.getMapContextManager(); |
|
223 |
|
|
224 |
if(apiUI.isLayerTiled()) { |
|
225 |
DataManager manager = DALLocator.getDataManager(); |
|
226 |
TileDataParameters tileParams = null; |
|
227 |
try { |
|
228 |
tileParams = (TileDataParameters) manager.createStoreParameters("Tile Store"); |
|
229 |
} catch (InitializeException e) { |
|
230 |
throw new LoadLayerException("", e); |
|
231 |
} catch (ProviderNotRegisteredException e) { |
|
232 |
throw new LoadLayerException("", e); |
|
233 |
} |
|
234 |
tileParams.setDataParameters(storeParameters); |
|
235 |
lyr = (DefaultFLyrRaster) mcm.createLayer(layerName, tileParams); |
|
236 |
//dataStore = dataManager.createStore(tileParams); |
|
237 |
} else { |
|
238 |
lyr = (DefaultFLyrRaster) mcm.createLayer(layerName, storeParameters); |
|
239 |
//dataStore = dataManager.createStore(storeParameters); |
|
240 |
} |
|
241 |
} catch (ValidateDataParametersException e) { |
|
242 |
throw new LoadLayerException("Error validating parameters", e); |
|
243 |
} catch (InitializeException e) { |
|
244 |
throw new LoadLayerException("Error initializating layer.", e); |
|
245 |
} catch (ProviderNotRegisteredException e) { |
|
246 |
throw new LoadLayerException("Provider not registered.", e); |
|
247 |
} |
|
248 |
|
|
249 |
return lyr; |
|
250 |
} |
|
251 |
|
|
252 |
/** |
|
253 |
* Gets the number of column of the selected table |
|
254 |
* @param schema |
|
255 |
* @param table |
|
256 |
* @return |
|
257 |
*/ |
|
258 |
@SuppressWarnings("deprecation") |
|
259 |
public long getNumberOfColumns(String schema, String table) { |
|
260 |
DataManager manager = DALLocator.getDataManager(); |
|
261 |
try { |
|
262 |
DataStoreParameters params = manager.createStoreParameters("PostgreSQL"); |
|
263 |
|
|
264 |
params.setDynValue("host", dbExplorerParameters.getHost()); |
|
265 |
params.setDynValue("port", dbExplorerParameters.getPort()); |
|
266 |
params.setDynValue("dbuser", dbExplorerParameters.getUser()); |
|
267 |
params.setDynValue("password", dbExplorerParameters.getPassword()); |
|
268 |
params.setDynValue("schema", schema); |
|
269 |
params.setDynValue("dbname", dbExplorerParameters.getDBName()); |
|
270 |
params.setDynValue("table", table); |
|
271 |
|
|
272 |
FeatureStore store = (FeatureStore)manager.createStore(params); |
|
273 |
long size = store.getFeatureCount(); |
|
274 |
store.dispose(); |
|
275 |
return size; |
|
276 |
} catch (DataException e) { |
|
277 |
return 0; |
|
278 |
} catch (ValidateDataParametersException e) { |
|
279 |
return 0; |
|
280 |
} |
|
281 |
} |
|
282 |
|
|
283 |
/** |
|
284 |
* Gets the name of a raster file |
|
285 |
*/ |
|
286 |
private String getFormatedRasterFileName(String name) { |
|
287 |
String newName = ""; |
|
288 |
String schema = null; |
|
289 |
String table = null; |
|
290 |
int index = name.indexOf(" schema='") + 8; |
|
291 |
if(index != -1) { |
|
292 |
try { |
|
293 |
schema = name.substring(index + 1, name.indexOf("'", index + 1)); |
|
294 |
newName += schema + "."; |
|
295 |
} catch (StringIndexOutOfBoundsException e) { |
|
296 |
} |
|
297 |
} |
|
298 |
index = name.indexOf(" table='") + 7; |
|
299 |
if(index != -1) { |
|
300 |
try { |
|
301 |
table = name.substring(index + 1, name.indexOf("'", index + 1)); |
|
302 |
newName += table; |
|
303 |
} catch (StringIndexOutOfBoundsException e) { |
|
304 |
} |
|
305 |
} |
|
306 |
return newName; |
|
307 |
} |
|
308 |
|
|
309 |
/** |
|
310 |
* Shows an error |
|
311 |
* @param _msg |
|
312 |
*/ |
|
313 |
public void showConnectionErrorMessage(String _msg) { |
|
314 |
String msg = (_msg.length() > 300) ? "" : (": " + _msg); |
|
315 |
String title = PluginServices.getText(this, "connection_error"); |
|
316 |
JOptionPane.showMessageDialog(apiUI.getComponent(), title + msg, title, |
|
317 |
JOptionPane.ERROR_MESSAGE); |
|
318 |
} |
|
319 |
|
|
320 |
/** |
|
321 |
* Shows a information window |
|
322 |
* @param _msg |
|
323 |
*/ |
|
324 |
public void showConnectionInfoMessage(String _msg) { |
|
325 |
String msg = (_msg.length() > 300) ? "" : (": " + _msg); |
|
326 |
String title = PluginServices.getText(this, "warning"); |
|
327 |
JOptionPane.showMessageDialog(apiUI.getComponent(), title + msg, title, |
|
328 |
JOptionPane.WARNING_MESSAGE); |
|
329 |
} |
|
330 |
} |
|
0 | 331 |
org.gvsig.raster.postgis/tags/gvSIGv2_1_0_Build_2218/org.gvsig.raster.postgis.app.postgisrasterclient/src/main/java/TestReadBandData.java | ||
---|---|---|
1 |
|
|
2 |
|
|
3 |
import java.io.IOException; |
|
4 |
|
|
5 |
import org.gvsig.jgdal.Gdal; |
|
6 |
import org.gvsig.jgdal.GdalRasterBand; |
|
7 |
import org.gvsig.jgdal.GdalException; |
|
8 |
import org.gvsig.jgdal.GdalBuffer; |
|
9 |
|
|
10 |
public class TestReadBandData { |
|
11 |
private Gdal gdal = null; |
|
12 |
private GdalRasterBand band = null; |
|
13 |
private String file1 = "PG:host='130.0.2.122' port='5432' dbname='testgis' user='postgres' password='postgres' schema='public' table='small_world_1tile'"; |
|
14 |
private String file = "/home/nacho/prueba.png"; |
|
15 |
|
|
16 |
public TestReadBandData() throws GdalException, IOException{ |
|
17 |
gdal = new Gdal(); |
|
18 |
gdal.open(file1, 0); |
|
19 |
testStack(); |
|
20 |
} |
|
21 |
|
|
22 |
public void testStack() throws GdalException, IOException{ |
|
23 |
String[] metadata = gdal.getMetadata(); |
|
24 |
for (int i = 0 ; i<metadata.length ; i++){ |
|
25 |
System.out.println("Metadato: " + metadata[i]); |
|
26 |
} |
|
27 |
|
|
28 |
metadata = gdal.getMetadata("Image Structure Metadata"); |
|
29 |
for (int i = 0 ; i<metadata.length ; i++){ |
|
30 |
System.out.println("Metadato: " + metadata[i]); |
|
31 |
} |
|
32 |
|
|
33 |
int w = gdal.getRasterXSize(); |
|
34 |
int h = gdal.getRasterYSize(); |
|
35 |
System.out.println(w + " " + h); |
|
36 |
GdalRasterBand[] b = new GdalRasterBand[3]; |
|
37 |
b[0] = gdal.getRasterBand(1); |
|
38 |
b[1] = gdal.getRasterBand(2); |
|
39 |
b[2] = gdal.getRasterBand(3); |
|
40 |
|
|
41 |
int dt = b[0].getRasterDataType(); |
|
42 |
System.out.println("-- " + dt); |
|
43 |
//GdalBuffer buf = b[0].readRaster(50, 50, 100, 100, 100, 100, dt); |
|
44 |
GdalBuffer buf = b[0].readRaster(0, 0, w, h, w, h, dt); |
|
45 |
byte[] bb = buf.buffByte; |
|
46 |
for(int i = 0; i < /*bb.length*/500; i++) { |
|
47 |
System.out.print(bb[i] + " "); |
|
48 |
} |
|
49 |
//while(true); |
|
50 |
|
|
51 |
} |
|
52 |
|
|
53 |
public static void main(String[] s) { |
|
54 |
try { |
|
55 |
TestReadBandData t = new TestReadBandData(); |
|
56 |
} catch (Exception e) { |
|
57 |
} |
|
58 |
} |
|
59 |
} |
|
0 | 60 |
org.gvsig.raster.postgis/tags/gvSIGv2_1_0_Build_2218/org.gvsig.raster.postgis.app.postgisrasterclient/src/main/resources-plugin/plugin.dtd | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO_8859-1"?> |
|
2 |
<!ELEMENT class EMPTY > |
|
3 |
<!ATTLIST class name NMTOKEN #REQUIRED > |
|
4 |
|
|
5 |
<!ELEMENT extension ( class | menu | toolBar | toolBoxItem | popupMenu)* > |
|
6 |
<!ATTLIST extension enabled NMTOKEN #IMPLIED > |
|
7 |
<!ATTLIST extension position NMTOKEN #IMPLIED > |
|
8 |
|
|
9 |
<!ELEMENT fileExtension ( class ) > |
|
10 |
<!ATTLIST fileExtension description CDATA #REQUIRED > |
|
11 |
<!ATTLIST fileExtension enabled NMTOKEN #IMPLIED > |
|
12 |
<!ATTLIST fileExtension endsWith CDATA #REQUIRED > |
|
13 |
<!ATTLIST fileExtension dialog CDATA #REQUIRED > |
|
14 |
|
|
15 |
<!ELEMENT import EMPTY > |
|
16 |
<!ATTLIST import plugin NMTOKEN #REQUIRED > |
|
17 |
|
|
18 |
<!ELEMENT libraries ( library+ ) > |
|
19 |
|
|
20 |
<!ELEMENT library EMPTY > |
|
21 |
<!ATTLIST library file NMTOKEN #REQUIRED > |
|
22 |
|
|
23 |
<!ELEMENT menu EMPTY > |
|
24 |
<!ATTLIST menu actionCommand NMTOKEN #IMPLIED > |
|
25 |
<!ATTLIST menu enableText CDATA #IMPLIED > |
|
26 |
<!ATTLIST menu key NMTOKEN #IMPLIED > |
|
27 |
<!ATTLIST menu mnemonic NMTOKEN #IMPLIED > |
|
28 |
<!ATTLIST menu icon CDATA #IMPLIED > |
|
29 |
<!ATTLIST menu text CDATA #REQUIRED > |
|
30 |
<!ATTLIST menu tooltip CDATA #IMPLIED > |
|
31 |
|
|
32 |
<!ELEMENT plugin ( import*, libraries, resourceBundle, labelSet*, extension*, fileExtension*, icon*) > |
|
33 |
|
|
34 |
<!ELEMENT icon EMPTY > |
|
35 |
<!ATTLIST icon src CDATA #REQUIRED > |
|
36 |
<!ATTLIST icon text CDATA #REQUIRED > |
|
37 |
|
|
38 |
<!ELEMENT resourceBundle EMPTY > |
|
39 |
<!ATTLIST resourceBundle name NMTOKEN #REQUIRED > |
|
40 |
|
|
41 |
<!ELEMENT tool EMPTY > |
|
42 |
<!ATTLIST tool actionCommand NMTOKEN #IMPLIED > |
|
43 |
<!ATTLIST tool enableText CDATA #IMPLIED > |
|
44 |
<!ATTLIST tool icon CDATA #IMPLIED > |
|
45 |
<!ATTLIST tool text NMTOKEN #IMPLIED > |
|
46 |
<!ATTLIST tool tooltip CDATA #IMPLIED > |
|
47 |
|
|
48 |
<!ELEMENT toolBar ( tool+ ) > |
|
49 |
<!ATTLIST toolBar name NMTOKEN #IMPLIED > |
|
50 |
|
|
51 |
<!ELEMENT entry EMPTY > |
|
52 |
<!ATTLIST entry text CDATA #IMPLIED > |
|
53 |
<!ATTLIST entry enableText CDATA #IMPLIED > |
|
54 |
<!ATTLIST entry tooltip CDATA #IMPLIED > |
|
55 |
<!ATTLIST entry actionCommand NMTOKEN #IMPLIED > |
|
56 |
|
|
57 |
<!ELEMENT popupMenu ( entry+ ) > |
|
58 |
<!ATTLIST popupMenu name NMTOKEN #IMPLIED > |
|
59 |
|
|
60 |
<!ELEMENT labelSet ( label+ ) > |
|
61 |
<!ATTLIST labelSet class NMTOKEN #REQUIRED > |
|
62 |
|
|
63 |
<!ELEMENT label EMPTY > |
|
64 |
<!ATTLIST label text NMTOKEN #REQUIRED > |
|
65 |
<!ATTLIST label size NMTOKEN #IMPLIED> |
|
66 |
|
|
67 |
<!ELEMENT toolBoxItem EMPTY > |
|
68 |
<!ATTLIST toolBoxItem default NMTOKEN #IMPLIED > |
|
69 |
<!ATTLIST toolBoxItem actionCommand NMTOKEN #IMPLIED > |
|
70 |
<!ATTLIST toolBoxItem icon CDATA #IMPLIED > |
|
71 |
<!ATTLIST toolBoxItem text CDATA #IMPLIED > |
|
72 |
<!ATTLIST toolBoxItem tooltip CDATA #IMPLIED > |
org.gvsig.raster.postgis/tags/gvSIGv2_1_0_Build_2218/org.gvsig.raster.postgis.app.postgisrasterclient/src/main/resources-plugin/about/postgisraster-about.html | ||
---|---|---|
1 |
<html> |
|
2 |
<head> |
|
3 |
<style type="text/css"> |
|
4 |
BODY { background-image: url(logo.png); background-repeat: no-repeat; background-position: 100% 0% } |
|
5 |
</style> |
|
6 |
</head> |
|
7 |
<body> |
|
8 |
<h2>Soporte PostGIS Raster para gvSIG</h2> |
|
9 |
<p><b>Prodevelop S.L.</b> ha incorporado el soporte al formato raster en |
|
10 |
base de datos <b>PostGres</b></p> |
|
11 |
|
|
12 |
<p><b>Desarrollo:</b></p> |
|
13 |
|
|
14 |
<p>Director del proyecto:</p> |
|
15 |
<ul> |
|
16 |
<li>Miguel Montesinos Lajara</li> |
|
17 |
</ul> |
|
18 |
<p>Equipo de desarrollo:</p> |
|
19 |
<ul> |
|
20 |
<li>Nacho Brodin</li> |
|
21 |
</ul> |
|
22 |
|
|
23 |
<p><b>Colaboradores:</b></p> |
|
24 |
|
|
25 |
<p>Deimos:</p> |
|
26 |
<ul> |
|
27 |
<li>Jorge Arevalo</li> |
|
28 |
</ul> |
|
29 |
|
|
30 |
<p>Build Number de la extensión: 1</p> |
|
31 |
<center> |
|
32 |
<p><b><a href="http://www.prodevelop.es" title="Prodevelop">http://www.prodevelop.es</a></b></p> |
|
33 |
</center> |
|
34 |
|
|
35 |
</body> |
|
36 |
</html> |
|
0 | 37 |
org.gvsig.raster.postgis/tags/gvSIGv2_1_0_Build_2218/org.gvsig.raster.postgis.app.postgisrasterclient/src/main/resources-plugin/text.properties | ||
---|---|---|
1 |
error_getting_tables=Error conectando a la BBDD u obteniendo las tablas |
|
2 |
error_creating_layer=Error creando la capa PostGIS |
|
3 |
loading_postgis_raster_layer=La capa se est? cargando.\n. Esta operaci?n puede tardar un poco.\n Por favor, espere a que aparezca en la vista. |
|
4 |
warning=Aviso |
|
0 | 5 |
org.gvsig.raster.postgis/tags/gvSIGv2_1_0_Build_2218/org.gvsig.raster.postgis.app.postgisrasterclient/src/main/resources-plugin/text_en.properties | ||
---|---|---|
1 |
error_getting_tables=Error connecting to database or getting the tables |
|
2 |
error_creating_layer=Error creating PostGIS layer |
|
3 |
loading_postgis_raster_layer=The layer is loading.\n. This operation could last a little.\n Please, wait. |
|
4 |
warning=Warning |
|
0 | 5 |
org.gvsig.raster.postgis/tags/gvSIGv2_1_0_Build_2218/org.gvsig.raster.postgis.app.postgisrasterclient/src/main/resources-plugin/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugin-config> |
|
3 |
<depends plugin-name="org.gvsig.raster.gdal.app" /> |
|
4 |
<depends plugin-name="org.gvsig.geodb"/> |
|
5 |
<libraries library-dir="./lib"/> |
|
6 |
<resourceBundle name="text"/> |
|
7 |
<extensions> |
|
8 |
<extension class-name="org.gvsig.raster.postgis.app.postgisrasterclient.PostGISRasterExtension" |
|
9 |
description="M?dulo de PostGIS Raster." |
|
10 |
active="true" |
|
11 |
priority="1"> |
|
12 |
<!--test<tool-bar name="Test" position="40000"> |
|
13 |
<action-tool icon="none" action-command="" tooltip="" position="1"/> |
|
14 |
</tool-bar>--> |
|
15 |
</extension> |
|
16 |
</extensions> |
|
17 |
</plugin-config> |
|
0 | 18 |
org.gvsig.raster.postgis/tags/gvSIGv2_1_0_Build_2218/org.gvsig.raster.postgis.app.postgisrasterclient/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<assembly> |
|
2 |
<id>gvsig-plugin-package</id> |
|
3 |
<formats> |
|
4 |
<format>zip</format> |
|
5 |
</formats> |
|
6 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
7 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
8 |
<files> |
|
9 |
<file> |
|
10 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
11 |
<outputDirectory>lib</outputDirectory> |
|
12 |
</file> |
|
13 |
<file> |
|
14 |
<source>target/package.info</source> |
|
15 |
</file> |
|
16 |
</files> |
|
17 |
|
|
18 |
<fileSets> |
|
19 |
<fileSet> |
|
20 |
<directory>src/main/resources-plugin</directory> |
|
21 |
<outputDirectory>.</outputDirectory> |
|
22 |
</fileSet> |
|
23 |
</fileSets> |
|
24 |
|
|
25 |
|
|
26 |
<dependencySets> |
|
27 |
<dependencySet> |
|
28 |
<useProjectArtifact>false</useProjectArtifact> |
|
29 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
30 |
<outputDirectory>lib</outputDirectory> |
|
31 |
<includes> |
|
32 |
<include>org.gvsig:org.gvsig.raster.postgis.app.postgisrasterclient:jar</include> |
|
33 |
<include>org.gvsig:org.gvsig.raster.postgis.io:jar</include> |
|
34 |
<include>org.gvsig:org.gvsig.raster.postgis.swing.api:jar</include> |
|
35 |
<include>org.gvsig:org.gvsig.raster.postgis.swing.impl:jar</include> |
|
36 |
</includes> |
|
37 |
</dependencySet> |
|
38 |
</dependencySets> |
|
39 |
</assembly> |
|
0 | 40 |
org.gvsig.raster.postgis/tags/gvSIGv2_1_0_Build_2218/org.gvsig.raster.postgis.app.postgisrasterclient/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<artifactId>org.gvsig.raster.postgis.app.postgisrasterclient</artifactId> |
|
6 |
<packaging>jar</packaging> |
|
7 |
<name>Format: PostGIS raster format support</name> |
|
8 |
<description>PostGIS raster adapter for gvSIG</description> |
|
9 |
<parent> |
|
10 |
<groupId>org.gvsig</groupId> |
|
11 |
<artifactId>org.gvsig.raster.postgis</artifactId> |
|
12 |
<version>2.2.0-SNAPSHOT</version> |
|
13 |
</parent> |
|
14 |
|
|
15 |
<scm> |
|
16 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.postgis/trunk/org.gvsig.raster.postgis</connection> |
|
17 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-raster/org.gvsig.raster.postgis/trunk/org.gvsig.raster.postgis</developerConnection> |
|
18 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-raster/repository/show/org.gvsig.raster.postgis/trunk/org.gvsig.raster.postgis</url> |
|
19 |
</scm> |
|
20 |
|
|
21 |
<dependencies> |
|
22 |
<dependency> |
|
23 |
<groupId>org.gvsig</groupId> |
|
24 |
<artifactId>org.gvsig.about.api</artifactId> |
|
25 |
<scope>compile</scope> |
|
26 |
</dependency> |
|
27 |
<dependency> |
|
28 |
<groupId>org.gvsig</groupId> |
|
29 |
<artifactId>org.gvsig.raster.lib.api</artifactId> |
|
30 |
<scope>compile</scope> |
|
31 |
</dependency> |
|
32 |
<dependency> |
|
33 |
<groupId>org.gvsig</groupId> |
|
34 |
<artifactId>org.gvsig.raster.postgis.swing.api</artifactId> |
|
35 |
<scope>compile</scope> |
|
36 |
</dependency> |
|
37 |
<dependency> |
|
38 |
<groupId>org.gvsig</groupId> |
|
39 |
<artifactId>org.gvsig.raster.postgis.swing.impl</artifactId> |
|
40 |
<scope>runtime</scope> |
|
41 |
</dependency> |
|
42 |
<dependency> |
|
43 |
<groupId>org.gvsig</groupId> |
|
44 |
<artifactId>org.gvsig.raster.postgis.io</artifactId> |
|
45 |
<scope>compile</scope> |
|
46 |
</dependency> |
|
47 |
<dependency> |
|
48 |
<groupId>org.gvsig</groupId> |
|
49 |
<artifactId>org.gvsig.ui</artifactId> |
|
50 |
<scope>compile</scope> |
|
51 |
</dependency> |
|
52 |
<dependency> |
|
53 |
<groupId>org.gvsig</groupId> |
|
54 |
<artifactId>org.gvsig.raster.fmap</artifactId> |
|
55 |
<scope>compile</scope> |
|
56 |
</dependency> |
|
57 |
<dependency> |
|
58 |
<groupId>org.gvsig</groupId> |
|
59 |
<artifactId>org.gvsig.app.mainplugin</artifactId> |
|
60 |
<scope>compile</scope> |
|
61 |
</dependency> |
|
62 |
|
|
63 |
<dependency> |
|
64 |
<groupId>org.gvsig</groupId> |
|
65 |
<artifactId>org.gvsig.fmap.control</artifactId> |
|
66 |
<scope>compile</scope> |
|
67 |
</dependency> |
|
68 |
<dependency> |
|
69 |
<groupId>org.gvsig</groupId> |
|
70 |
<artifactId>org.gvsig.metadata.lib.basic.api</artifactId> |
|
71 |
<scope>compile</scope> |
|
72 |
</dependency> |
|
73 |
<dependency> |
|
74 |
<groupId>org.gvsig</groupId> |
|
75 |
<artifactId>org.gvsig.i18n</artifactId> |
|
76 |
<scope>compile</scope> |
|
77 |
</dependency> |
|
78 |
<dependency> |
|
79 |
<groupId>org.gvsig</groupId> |
|
80 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
81 |
<scope>compile</scope> |
|
82 |
</dependency> |
|
83 |
<dependency> |
|
84 |
<groupId>org.slf4j</groupId> |
|
85 |
<artifactId>slf4j-api</artifactId> |
|
86 |
<scope>compile</scope> |
|
87 |
</dependency> |
|
88 |
<dependency> |
|
89 |
<groupId>org.slf4j</groupId> |
|
90 |
<artifactId>slf4j-log4j12</artifactId> |
|
91 |
<scope>runtime</scope> |
|
92 |
</dependency> |
|
93 |
<dependency> |
|
94 |
<groupId>org.gvsig</groupId> |
|
95 |
<artifactId>org.gvsig.andami</artifactId> |
|
96 |
<scope>compile</scope> |
|
97 |
</dependency> |
|
98 |
|
|
99 |
<dependency> |
|
100 |
<groupId>org.gvsig</groupId> |
|
101 |
<artifactId>org.gvsig.geodb.app.mainplugin</artifactId> |
|
102 |
<scope>compile</scope> |
|
103 |
</dependency> |
|
104 |
<dependency> |
|
105 |
<groupId>org.gvsig</groupId> |
|
106 |
<artifactId>org.gvsig.fmap.mapcontext.api</artifactId> |
|
107 |
<scope>compile</scope> |
|
108 |
</dependency> |
|
109 |
<dependency> |
|
110 |
<groupId>org.gvsig</groupId> |
|
111 |
<artifactId>org.gvsig.fmap.mapcontext.impl</artifactId> |
|
112 |
<scope>runtime</scope> |
|
113 |
</dependency> |
|
114 |
<dependency> |
|
115 |
<groupId>org.gvsig</groupId> |
|
116 |
<artifactId>org.gvsig.fmap.mapcontext.operation</artifactId> |
|
117 |
<scope>runtime</scope> |
|
118 |
</dependency> |
|
119 |
|
|
120 |
<dependency> |
|
121 |
<groupId>org.gvsig</groupId> |
|
122 |
<artifactId>org.gvsig.projection.api</artifactId> |
|
123 |
<scope>compile</scope> |
|
124 |
</dependency> |
|
125 |
<dependency> |
|
126 |
<groupId>org.gvsig</groupId> |
|
127 |
<artifactId>org.gvsig.projection.cresques.impl</artifactId> |
|
128 |
<scope>runtime</scope> |
|
129 |
</dependency> |
|
130 |
<dependency> |
|
131 |
<groupId>org.gvsig</groupId> |
|
132 |
<artifactId>org.gvsig.compat.api</artifactId> |
|
133 |
<scope>compile</scope> |
|
134 |
</dependency> |
|
135 |
<dependency> |
|
136 |
<groupId>org.gvsig</groupId> |
|
137 |
<artifactId>org.gvsig.compat.se</artifactId> |
|
138 |
<scope>compile</scope> |
|
139 |
</dependency> |
|
140 |
<dependency> |
|
141 |
<groupId>org.gvsig</groupId> |
|
142 |
<artifactId>org.gvsig.fmap.dal.api</artifactId> |
|
143 |
<scope>compile</scope> |
|
144 |
</dependency> |
|
145 |
<dependency> |
|
146 |
<groupId>org.gvsig</groupId> |
|
147 |
<artifactId>org.gvsig.fmap.dal.impl</artifactId> |
|
148 |
<scope>compile</scope> |
|
149 |
</dependency> |
|
150 |
<dependency> |
|
151 |
<groupId>org.gvsig</groupId> |
|
152 |
<artifactId>org.gvsig.fmap.dal.file.lib</artifactId> |
|
153 |
<scope>compile</scope> |
|
154 |
</dependency> |
|
155 |
<dependency> |
|
156 |
<groupId>org.gvsig</groupId> |
|
157 |
<artifactId>org.gvsig.fmap.dal.spi</artifactId> |
|
158 |
<scope>compile</scope> |
|
159 |
</dependency> |
|
160 |
<dependency> |
|
161 |
<groupId>org.gvsig</groupId> |
|
162 |
<artifactId>org.gvsig.fmap.dal.db.lib</artifactId> |
|
163 |
<scope>compile</scope> |
|
164 |
</dependency> |
|
165 |
<dependency> |
|
166 |
<groupId>org.gvsig</groupId> |
|
167 |
<artifactId>org.gvsig.fmap.geometry.api</artifactId> |
|
168 |
<scope>compile</scope> |
|
169 |
</dependency> |
|
170 |
<dependency> |
|
171 |
<groupId>org.gvsig</groupId> |
|
172 |
<artifactId>org.gvsig.fmap.geometry.impl</artifactId> |
|
173 |
<scope>runtime</scope> |
|
174 |
</dependency> |
|
175 |
<dependency> |
|
176 |
<groupId>org.gvsig</groupId> |
|
177 |
<artifactId>org.gvsig.fmap.geometry.operation</artifactId> |
|
178 |
<scope>runtime</scope> |
|
179 |
</dependency> |
|
180 |
</dependencies> |
|
181 |
<build> |
|
182 |
<plugins> |
|
183 |
<!-- TODO: MAKE TESTS WORK AND REMOVE THIS OPTION |
|
184 |
<plugin> |
|
185 |
<groupId>org.apache.maven.plugins</groupId> |
|
186 |
<artifactId>maven-surefire-plugin</artifactId> |
|
187 |
<configuration> |
|
188 |
<excludes> |
|
189 |
<exclude>**/TestReadBandData.java</exclude> |
|
190 |
</excludes> |
|
191 |
</configuration> |
|
192 |
</plugin> --> |
|
193 |
</plugins> |
|
194 |
</build> |
|
195 |
<properties> |
|
196 |
<gvsig.package.info.state>testing</gvsig.package.info.state> |
|
197 |
<gvsig.package.info.dependencies>required: org.gvsig.raster.tilecache.app -ge 2, required: org.gvsig.raster.gdal.app -ge 2</gvsig.package.info.dependencies> |
|
198 |
<gvsig.package.info.poolURL>http://devel.gvsig.org/download/projects/Raster/pool</gvsig.package.info.poolURL> |
|
199 |
<gvsig.package.info.categories>Database,Raster,Formats</gvsig.package.info.categories> |
|
200 |
<gvsig.package.info.official>true</gvsig.package.info.official> |
|
201 |
</properties> |
|
202 |
</project> |
|
0 | 203 |
Also available in: Unified diff