El 19 de diciembre de 2014, 1:19, Piotr Pachół <[email protected]>
escribió:

> Hola,
> He creado  en el script un fichero dbf (con funccion createDBF) y quiero
> anadir este dbf  (por medio de script) en proyecto.
> Es posible ?
>
>
Hola  Piotr,
poderse se puede hacer. Basicamente desde script se puede hacer cualquier
cosa que pudieses hacer desde java.
Para algunas cosas se han creado funciones python para tratar de facilitar
las cosas, pero por desgracia gvSIG es muy grande y han quedado muchas
cosas por hacer.
Te dejo aqui un pedazo de script que hace lo que quieres,


> from gvsig import *
>
> from org.gvsig.app.project.documents.table import TableManager
>
> def loadTable(format, **parameters):
>
    try:
>         application = ApplicationLocator.getManager()
>         datamanager =  application.getDataManager()
>
>         # Loding the data store
>         store_parameters = datamanager.createStoreParameters(format)
>         copyToDynObject(parameters, store_parameters)
>         store = datamanager.openStore(format, store_parameters)
>
>         # Creating a Table document and initialize with the data store
>         project = currentProject()
>         table = project().createDocument(TableManager.TYPENAME)
>         table.setStore(store)
>         table.setName(store.getName())
>
>         # Add the Table document to the project
>         project().addDocument(table)
>
>     except Throwable, ex:
>         raise RuntimeException("Can't load table, "+ str(ex))
>
>     return table
>
> def loadDBF(dbffile):
>   table = loadTable(format="DBF",DbfFile=dbffile)
>   return table
>
> def main(*args):
>   # Get the path to the dbf to load,
>   # getResource search the file next to the script .
>   f = script.getResource("puntos1.dbf")
>   loadDBF(f)
>
>


Si tienes dudas pregunta, intentare contestar mas rapido la proxima vez ;)
Un saludo
Joaquin




Por analogia como se crea el fichero shp (con funccion createShape) y
> anade en proyecto (con funccion addLayer ).
> Saludos,
> Piotr
> _______________________________________________
> gvSIG_desarrolladores mailing list
> [email protected]
> Para ver histórico de mensajes, editar sus preferencias de usuario o darse
> de baja en esta lista, acuda a la siguiente dirección:
> http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_desarrolladores
>



-- 
--------------------------------------
Joaquin Jose del Cerro Murciano
Development and software arquitecture manager at gvSIG Team
[email protected]
[email protected]
gvSIG Association
www.gvsig.com
www.gvsig.org
_______________________________________________
gvSIG_desarrolladores mailing list
[email protected]
Para ver histórico de mensajes, editar sus preferencias de usuario o darse de 
baja en esta lista, acuda a la siguiente dirección: 
http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_desarrolladores

Responder a