svn-gvsig-desktop / branches / v10 / extensions / extGPE-gvSIG / src / org / gvsig / gpe / GPEReaderExtension.java @ 18292
History | View | Annotate | Download (3.77 KB)
1 |
package org.gvsig.gpe; |
---|---|
2 |
|
3 |
import java.io.File; |
4 |
import java.io.FileNotFoundException; |
5 |
|
6 |
import org.gvsig.fmap.drivers.gpe.addlayer.GPEFileOpen; |
7 |
import org.gvsig.fmap.drivers.gpe.reader.GMLVectorialDriver; |
8 |
import org.gvsig.fmap.drivers.gpe.reader.KMLVectorialDriver; |
9 |
import org.gvsig.gpe.gui.preferencespage.GPEPreferencesPage; |
10 |
|
11 |
import com.hardcode.driverManager.DriverManager; |
12 |
import com.iver.andami.messages.NotificationManager; |
13 |
import com.iver.andami.plugins.Extension; |
14 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
15 |
import com.iver.utiles.extensionPoints.ExtensionPoints; |
16 |
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton; |
17 |
|
18 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
19 |
*
|
20 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
21 |
*
|
22 |
* This program is free software; you can redistribute it and/or
|
23 |
* modify it under the terms of the GNU General Public License
|
24 |
* as published by the Free Software Foundation; either version 2
|
25 |
* of the License, or (at your option) any later version.
|
26 |
*
|
27 |
* This program is distributed in the hope that it will be useful,
|
28 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
29 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
30 |
* GNU General Public License for more details.
|
31 |
*
|
32 |
* You should have received a copy of the GNU General Public License
|
33 |
* along with this program; if not, write to the Free Software
|
34 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
35 |
*
|
36 |
* For more information, contact:
|
37 |
*
|
38 |
* Generalitat Valenciana
|
39 |
* Conselleria d'Infraestructures i Transport
|
40 |
* Av. Blasco Ib??ez, 50
|
41 |
* 46010 VALENCIA
|
42 |
* SPAIN
|
43 |
*
|
44 |
* +34 963862235
|
45 |
* gvsig@gva.es
|
46 |
* www.gvsig.gva.es
|
47 |
*
|
48 |
* or
|
49 |
*
|
50 |
* IVER T.I. S.A
|
51 |
* Salamanca 50
|
52 |
* 46005 Valencia
|
53 |
* Spain
|
54 |
*
|
55 |
* +34 963163400
|
56 |
* dac@iver.es
|
57 |
*/
|
58 |
/* CVS MESSAGES:
|
59 |
*
|
60 |
* $Id$
|
61 |
* $Log$
|
62 |
*
|
63 |
*/
|
64 |
/**
|
65 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
66 |
*/
|
67 |
public class GPEReaderExtension extends Extension{ |
68 |
private String parsersFile = "gvSIG" + File.separatorChar + "extensiones" + File.separatorChar + |
69 |
"org.gvsig.gpe" + File.separatorChar + "parser.properties"; |
70 |
private String driversDir = "gvSIG" + File.separatorChar + "extensiones" + File.separatorChar + |
71 |
"org.gvsig.gpe" + File.separatorChar + "lib"; |
72 |
|
73 |
/*
|
74 |
* (non-Javadoc)
|
75 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
|
76 |
*/
|
77 |
public void execute(String actionCommand) { |
78 |
// TODO Auto-generated method stub
|
79 |
|
80 |
} |
81 |
|
82 |
/*
|
83 |
* (non-Javadoc)
|
84 |
* @see com.iver.andami.plugins.IExtension#initialize()
|
85 |
*/
|
86 |
public void initialize() { |
87 |
loadParsers(); |
88 |
ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance(); |
89 |
extensionPoints.add("FileExtendingOpenDialog", "FileOpenGPE", new GPEFileOpen()); |
90 |
//Register the GML driver
|
91 |
DriverManager driverManager = LayerFactory.getDM();
|
92 |
driverManager.addDriver(new File(driversDir), GMLVectorialDriver.DRIVERNAME, GMLVectorialDriver.class); |
93 |
driverManager.addDriver(new File(driversDir), KMLVectorialDriver.DRIVERNAME, KMLVectorialDriver.class); |
94 |
//Register the GML driver in the WFS Driver
|
95 |
extensionPoints.add("FMAPWFSDriver","FMAPWFSDriver", GMLVectorialDriver.class); |
96 |
} |
97 |
|
98 |
private void loadParsers(){ |
99 |
File file = new File(parsersFile); |
100 |
if (!file.exists()){
|
101 |
NotificationManager.addWarning("File not found",
|
102 |
new FileNotFoundException()); |
103 |
return;
|
104 |
} |
105 |
try {
|
106 |
GPERegister.addParsersFile(file); |
107 |
} catch (Exception e) { |
108 |
NotificationManager.addWarning("GPE parsers file not found",
|
109 |
new FileNotFoundException()); |
110 |
} |
111 |
} |
112 |
|
113 |
/*
|
114 |
* (non-Javadoc)
|
115 |
* @see com.iver.andami.plugins.IExtension#isEnabled()
|
116 |
*/
|
117 |
public boolean isEnabled() { |
118 |
return false; |
119 |
} |
120 |
|
121 |
/*
|
122 |
* (non-Javadoc)
|
123 |
* @see com.iver.andami.plugins.IExtension#isVisible()
|
124 |
*/
|
125 |
public boolean isVisible() { |
126 |
return false; |
127 |
} |
128 |
|
129 |
} |