gvsig-scripting / org.gvsig.scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.app / org.gvsig.scripting.app.mainplugin / src / main / resources-plugin / scripting / lib / gvsig / javadocs / scripting / gvsig.java @ 784
History | View | Annotate | Download (11.1 KB)
1 |
package scripting; |
---|---|
2 |
|
3 |
import org.cresques.cts.IProjection; |
4 |
import org.gvsig.fmap.dal.DataStore; |
5 |
import org.gvsig.fmap.dal.feature.FeatureType; |
6 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
7 |
import org.gvsig.scripting.app.extension.ScriptingExtension; |
8 |
|
9 |
/**
|
10 |
* Representa al modulo python "gvsig".
|
11 |
*
|
12 |
* Es el modulo base que nos facilita el acceso a todos los componentes de
|
13 |
* gvSIG.
|
14 |
*
|
15 |
*/
|
16 |
public class gvsig { |
17 |
|
18 |
public static int LOGGER_INFO = ScriptingExtension.INFO; |
19 |
public static int LOGGER_WARN = ScriptingExtension.WARN; |
20 |
public static int LOGGER_ERROR = ScriptingExtension.ERROR; |
21 |
|
22 |
/**
|
23 |
* Returns a new and empty attributes definition.
|
24 |
*
|
25 |
* @return the new FeatureType
|
26 |
*/
|
27 |
public static FeatureType createFeatureType() { |
28 |
return null; |
29 |
} |
30 |
|
31 |
/**
|
32 |
* Returns a new and empty attributes definition based in an existing
|
33 |
* FeatureType.
|
34 |
*
|
35 |
* All attributes in the feature type pased as parameters are created in the
|
36 |
* new definition
|
37 |
*
|
38 |
* @param featureType from the new attributes are copied
|
39 |
* @return The new FeatureType
|
40 |
*/
|
41 |
public static FeatureType createFeatureType(FeatureType featureType) { |
42 |
return null; |
43 |
} |
44 |
|
45 |
/**
|
46 |
* Create a new layer with the specified parameters.
|
47 |
*
|
48 |
* The paramaters are used to connect to the server type and create the
|
49 |
* layer. These parameters are specific of each type of layer.
|
50 |
*
|
51 |
* Valid values of server type are:
|
52 |
* <ul>
|
53 |
* <li>FilesystemExplorer</li>
|
54 |
* <li>PostgreSQLExplorer</li>
|
55 |
* <li>WFSServerExplorer</li>
|
56 |
* <li>Wms Store</li>
|
57 |
* <li>...</li>
|
58 |
* </ul>
|
59 |
*
|
60 |
* Valid values of layer type are:
|
61 |
* <ul>
|
62 |
* <li>Shape</li>
|
63 |
* <li>Dbf</li>
|
64 |
* <li>DXF</li>
|
65 |
* <li>DGN</li>
|
66 |
* <li>DWG</li>
|
67 |
* <li>JExcel</li>
|
68 |
* <li>PostgreSQL</li>
|
69 |
* <li>WFSStore</li>
|
70 |
* <li>Gdal Store</li>
|
71 |
* <li>...</li>
|
72 |
* </ul>
|
73 |
*
|
74 |
* Excamples of use:<br>
|
75 |
* <code>
|
76 |
* layer = createLayer(schema=schema,
|
77 |
* servertype="FilesystemExplorer",
|
78 |
* layertype="Shape",
|
79 |
* shpFile="/home/osc/temp/test1.shp",
|
80 |
* CRS="EPSG:25830",
|
81 |
* geometryType=POINT
|
82 |
* )
|
83 |
* </code>
|
84 |
*
|
85 |
* @param schema the schema to use to create la layer.
|
86 |
* @param serverType The server type (filesystem, BBDD, ...)
|
87 |
* @param layerType The layer type to create (Shape, ...)
|
88 |
* @param parameters the specific parameters to create the new layer
|
89 |
* @return the new created layer
|
90 |
*
|
91 |
*/
|
92 |
public static FLayer createLayer(FeatureType schema, String serverType, String layerType, Object... parameters) { |
93 |
return null; |
94 |
} |
95 |
|
96 |
/**
|
97 |
* Create a new layer with the specified parameters.
|
98 |
*
|
99 |
* Use as default serverType the "FilesystemExplorer".
|
100 |
*
|
101 |
* @param schema
|
102 |
* @param layerType
|
103 |
* @param parameters
|
104 |
* @return
|
105 |
*/
|
106 |
public static FLayer createLayer(FeatureType schema, String layerType, Object... parameters) { |
107 |
return null; |
108 |
} |
109 |
|
110 |
/**
|
111 |
* Create a new shape with the specified parameters. If filename is not established, a temp filename will be set.
|
112 |
* If CRS is None, it will be created with the CRS of the current view.
|
113 |
*
|
114 |
* Example:
|
115 |
* schema = createSchema()
|
116 |
* schema.append("ID", "INTEGER", 10)
|
117 |
* schema.append("GEOMETRY", "GEOMETRY")
|
118 |
* schema.get("GEOMETRY").setGeometryType(POINT, D2)
|
119 |
* newshape = createShape(schema, prefixname="newshape")
|
120 |
*
|
121 |
*
|
122 |
* @param schema
|
123 |
* @param filename, string, optional
|
124 |
* @param geometryType, optional, integer, established in the schema
|
125 |
* @param CRS, optional, string epsg code
|
126 |
* @param prefixname, optional, string layer name with a prefix if filename is not established
|
127 |
* @return
|
128 |
*/
|
129 |
public static FLayer createShape(FeatureType schema, Object... parameters) { |
130 |
return null; |
131 |
} |
132 |
|
133 |
/**
|
134 |
* Create a new table with the specified parameters.
|
135 |
*
|
136 |
* Use as default serverType the "FilesystemExplorer".
|
137 |
*
|
138 |
* @param schema
|
139 |
* @param servertype
|
140 |
* @param layerType
|
141 |
* @param parameters
|
142 |
* @return
|
143 |
*/
|
144 |
public static FLayer createTable(FeatureType schema, String servertype, String layerType, Object... parameters) { |
145 |
return null; |
146 |
} |
147 |
|
148 |
* Create a new table with the specified parameters. If DbfFile is not established, a temp filename will be set.
|
149 |
* |
150 |
* Example: |
151 |
* schema = createSchema() |
152 |
* schema.append("ID", "INTEGER", 10) |
153 |
* newdbf = createDBF(schema, prefixname="newshape")
|
154 |
* |
155 |
* |
156 |
* @param schema
|
157 |
* @param DbfFile, optional, string
|
158 |
* @param prefixname, optional, string layer name with a prefix if filename is not established |
159 |
* @return
|
160 |
*/ |
161 |
public static FLayer createDBF(FeatureType schema, Object... parameters) { |
162 |
return null; |
163 |
} |
164 |
|
165 |
/**
|
166 |
* Load an existing table file.
|
167 |
*
|
168 |
* @param dbffile, string, path to the table file to load
|
169 |
* @return
|
170 |
*
|
171 |
*/
|
172 |
public static FLayer loadDBF(String dbffile) { |
173 |
return null; |
174 |
} |
175 |
|
176 |
/**
|
177 |
* Load an existing table file.
|
178 |
*
|
179 |
* Example:
|
180 |
* table = loadTable(format="DBF",DbfFile=dbffile)
|
181 |
*
|
182 |
* @param format, string
|
183 |
* @param path, string, path to the table file to load
|
184 |
* @return
|
185 |
*
|
186 |
*/
|
187 |
public static FLayer loadTable(String format, Object... parameters) { |
188 |
return null; |
189 |
} |
190 |
|
191 |
/**
|
192 |
* Load an existing shape file in the current view.
|
193 |
*
|
194 |
* @param path path to the shape file to load
|
195 |
* @param projection to use to load the shape file
|
196 |
* @return
|
197 |
*
|
198 |
*/
|
199 |
public static FLayer loadShapeFile(String path, String projection) { |
200 |
return null; |
201 |
} |
202 |
|
203 |
/**
|
204 |
* Load an existing shape file in the current view.
|
205 |
*
|
206 |
* Use as default projection "CRS:84"
|
207 |
*
|
208 |
* @param path path to the shape file to load
|
209 |
* @return
|
210 |
*
|
211 |
*/
|
212 |
public static FLayer loadShapeFile(String path) { |
213 |
return null; |
214 |
} |
215 |
|
216 |
/**
|
217 |
* Load an existing raster file in the current view.
|
218 |
*
|
219 |
* @param path path to the raster file to load
|
220 |
* @param projection to use to load the raster file
|
221 |
* @return
|
222 |
*
|
223 |
*/
|
224 |
public static FLayer loadRasterFile(String path, String projection) { |
225 |
return null; |
226 |
} |
227 |
|
228 |
/**
|
229 |
* Load an existing raster file in the current view.
|
230 |
*
|
231 |
* Use as default projection "CRS:84"
|
232 |
*
|
233 |
* @param path path to the raster file to load
|
234 |
* @return
|
235 |
*
|
236 |
*/
|
237 |
public static FLayer loadRasterFile(String path) { |
238 |
return null; |
239 |
} |
240 |
|
241 |
/**
|
242 |
* Load an existing layer and return it.
|
243 |
*
|
244 |
* Valid values of layer type are:
|
245 |
* - Shape
|
246 |
* - Gdal Store
|
247 |
* - TODO
|
248 |
*
|
249 |
* Examples:
|
250 |
* loadLayer("Shape", shpFile=xfile, CRS="EPSG:25830")
|
251 |
* loadLayer("Gdal Store", uri=raster_uri)
|
252 |
*
|
253 |
* @param layerType
|
254 |
* @param parameters
|
255 |
* @return
|
256 |
*
|
257 |
*/
|
258 |
public static FLayer loadLayer(String layerType, Object... parameters) { |
259 |
return null; |
260 |
} |
261 |
|
262 |
/**
|
263 |
* Send a message to the log system.
|
264 |
*
|
265 |
* The values of mode are:
|
266 |
* <ul>
|
267 |
* <li>LOGGER_INFO</li>
|
268 |
* <li>LOGGER_WARN</li>
|
269 |
* <li>LOGGER_ERROR</li>
|
270 |
* </ul>
|
271 |
*
|
272 |
* @param msg to send to log
|
273 |
* @param mode message type, is optional with default of LOGGER_INFO.
|
274 |
* @param exception an exception to log, is optional.
|
275 |
*/
|
276 |
public static void logger(String msg, int mode, Throwable exception) { |
277 |
|
278 |
} |
279 |
|
280 |
/**
|
281 |
* Create the path to a resource.
|
282 |
*
|
283 |
* This function runs like the os.path.join, but if the first argument is a
|
284 |
* full path name to a file, it only get the dirname of it.
|
285 |
*
|
286 |
* This is usefull to use with the variable __file__ as the first argument
|
287 |
* to get a path name to a resource relative to the current module.
|
288 |
*
|
289 |
* Explample:<br>
|
290 |
* <code>
|
291 |
* pathname = getResource(__file__,"data","icon.png")
|
292 |
* </code>
|
293 |
*
|
294 |
* @param parameters parts of path to the resource.
|
295 |
* @return the path name to the resource.
|
296 |
*/
|
297 |
public String getResource(String... parameters) { |
298 |
return null; |
299 |
} |
300 |
|
301 |
/**
|
302 |
* Open an existen data store an return it.
|
303 |
*
|
304 |
* The type of store depened of store to be opened. It can be:
|
305 |
* <ul>
|
306 |
* <li>Shape</li>
|
307 |
* <li>Dbf</li>
|
308 |
* <li>DXF</li>
|
309 |
* <li>DGN</li>
|
310 |
* <li>DWG</li>
|
311 |
* <li>JExcel</li>
|
312 |
* <li>PostgreSQL</li>
|
313 |
* <li>WFSStore</li>
|
314 |
* <li>Gdal Store</li>
|
315 |
* </ul>
|
316 |
*
|
317 |
* Example with PostgreSQL connection:
|
318 |
* <code>
|
319 |
* from gvsig.utils import openStore
|
320 |
*
|
321 |
* os = openStore('PostgreSQL',_entity_='Persistence%3APostgreSQLStoreParameters',
|
322 |
* port='5432',
|
323 |
* JDBCDriverClass='org.postgresql.Driver',
|
324 |
* UseSSL='false',
|
325 |
* Schema='public',
|
326 |
* Catalog='',
|
327 |
* URL='jdbc%3Apostgresql%3A%2F%2Flocalhost%3A5432%2Fej1',
|
328 |
* BaseOrder='',
|
329 |
* Workingarea=None,
|
330 |
* CRS='EPSG:23030',
|
331 |
* PKFields='gid',
|
332 |
* BaseFilter='',
|
333 |
* DefaultGeometryField='geom',
|
334 |
* Fields='gid%2Cnombre%2Cpoblacion%2Cgeom',
|
335 |
* Table='ciudades',
|
336 |
* SQL='',
|
337 |
* password='postgres',
|
338 |
* dbname='ej1',
|
339 |
* host='localhost',
|
340 |
* dbuser='postgres',
|
341 |
* ProviderName='PostgreSQL')
|
342 |
* </code>
|
343 |
*
|
344 |
* @param storeType the type of store to open.
|
345 |
* @param parameters to open the store.
|
346 |
* @return the opened data store
|
347 |
*/
|
348 |
public DataStore openStore(String storeType, Object... parameters) { |
349 |
return null; |
350 |
} |
351 |
|
352 |
/**
|
353 |
* Create a new projectionobject associated with the passed name of
|
354 |
* the projection.
|
355 |
*
|
356 |
* Usually, the name is the abbreviation of the projection.
|
357 |
*
|
358 |
* Is preferable to use this method <code>CRSFactory.getCRS(name)</code> instead.
|
359 |
*
|
360 |
* @param name abbreviation of the projection
|
361 |
* @return the projection object associated with the name
|
362 |
*/
|
363 |
public IProjection getCRS(String name) { |
364 |
return null; |
365 |
} |
366 |
|
367 |
/**
|
368 |
* Return the default data folder of gvSIG.
|
369 |
* This is configured in the preferences of gvSIG.
|
370 |
*
|
371 |
* @return the data folder of gvSIG
|
372 |
*/
|
373 |
public String getDataFolder() { |
374 |
return null; |
375 |
} |
376 |
|
377 |
/**
|
378 |
* Return the default projects folder of gvSIG.
|
379 |
* This is configured in the preferences of gvSIG.
|
380 |
*
|
381 |
* @return the projects folder of gvSIG.
|
382 |
*/
|
383 |
public String getProjectsFolder() { |
384 |
return null; |
385 |
} |
386 |
} |