Revision 1132

View differences:

org.gvsig.scripting/tags/org.gvsig.scripting-2.3.76/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/buildNumber.properties
1
#Mon Oct 07 10:52:53 CEST 2019
2
buildNumber=156
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.76/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
    <depends plugin-name="org.gvsig.app.mainplugin" />
4
    <depends plugin-name="org.gvsig.app.document.table.app.mainplugin" />
5
    <depends plugin-name="org.gvsig.raster.mainplugin" optional="true" />
6
    <resourceBundle name="text"/>
7
    <libraries library-dir="lib"/>
8
    <extensions>
9
        <extension class-name="org.gvsig.scripting.app.extension.ScriptingExtension"
10
                           description="Extensi?n para el manejo de scripts en gvSIG."
11
                           active="true"
12
                           priority="1">
13

  
14
            <action 
15
                name="tools-scripting-launcher"
16
                label="_Show_scripting_launcher" 
17
                position="908300100"  
18
                tooltip="_Show_scripting_launcher" 
19
                action-command="tools-scripting-launcher"
20
                icon="tools-scripting-launcher"
21
                accelerator=""
22
            />
23

  
24
            <action 
25
                name="tools-scripting-composer"
26
                label="_Show_scripting_composer" 
27
                position="908300200"  
28
                tooltip="_Show_scripting_composer" 
29
                action-command="tools-scripting-composer"
30
                icon="tools-scripting-composer"
31
                accelerator=""
32
            />
33

  
34
            <action 
35
                name="tools-scripting-console-jython"
36
                label="_Show_scripting_jython_console" 
37
                position="908300300"  
38
                tooltip="_Show_scripting_console-jython" 
39
                action-command="tools-scripting-console-jython"
40
                icon="tools-scripting-console-jython"
41
                accelerator=""
42
            />
43

  
44

  
45
            <menu text="tools/_Scripting"
46
                              position="908300000" 
47
                              is_separator="true"/>
48
            <menu text="tools/_Scripting/Scripting_Launcher" 
49
                              name="tools-scripting-launcher"/>
50
            <menu text="tools/_Scripting/Scripting_Composer" 
51
                              name="tools-scripting-composer"/>
52
            <menu text="tools/_Scripting/Jython_Console" 
53
                          name="tools-scripting-console-jython"/>
54
				
55
            <tool-bar name="scripting" position="2000">
56
                <action-tool name="tools-scripting-launcher"/>				
57
            </tool-bar>
58
        </extension>	
59
        <extension class-name="org.gvsig.scripting.app.extension.ScriptLaunchExtension"
60
                           description="Extensi?n para la ejecucion de scripts en gvSIG."
61
                           active="true"
62
                           priority="1">                
63
        </extension>	
64
    </extensions>
65
</plugin-config>
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.76/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/autorun.sh
1
#!/bin/sh
2
#
3
# gvSIG. Desktop Geographic Information System.
4
#
5
# Copyright (C) 2007-2013 gvSIG Association.
6
#
7
# This program is free software; you can redistribute it and/or
8
# modify it under the terms of the GNU General Public License
9
# as published by the Free Software Foundation; either version 3
10
# of the License, or (at your option) any later version.
11
#
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with this program; if not, write to the Free Software
19
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
# MA  02110-1301, USA.
21
#
22
# For any additional information, do not hesitate to contact us
23
# at info AT gvsig.com, or visit our website www.gvsig.com.
24
#
25

  
26

  
27
#
28
# Plugin autorun
29
#
30

  
31
PLUGIN_NAME=$(basename "$PLUGIN_FOLDER")
32

  
33
# https://redmine.gvsig.net/redmine/issues/3975
34
jythonjar=$(echo "$PLUGIN_FOLDER/lib/"*jython*.jar)
35
add_property python.home "$jythonjar"
36

  
37
add_property python.cachedir "$GVSIG_HOME_FOLDER/plugins/$PLUGIN_NAME/python.cachedir"
38

  
39
xmkdir -p "$GVSIG_HOME_FOLDER/plugins/$PLUGIN_NAME/scripts"
40
cd "$GVSIG_HOME_FOLDER/plugins/$PLUGIN_NAME/scripts"
41

  
42
#
43
# El find casca en win10 64 bits. Parece que hay algun problema con los
44
# pipes y el find y el ls.
45
if [ "${OS}" != "win" ] ; then
46
  sc_autoruns=$(find . -name autorun.sh)
47
  cd "$GVSIG_INSTALL_FOLDER"
48
  for sc_autorun in $sc_autoruns
49
  do
50
    sc_autorun="$GVSIG_HOME_FOLDER/plugins/$PLUGIN_NAME/scripts/$sc_autorun"
51
    if [ -r "$sc_autorun" ] ; then
52
      logger_info "Running scripting autorun from $sc_autorun"
53
      . "$sc_autorun"
54
      cd "$GVSIG_INSTALL_FOLDER"
55
    fi
56
  done
57
fi
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.76/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/gvsigsh
1
#!/bin/bash
2

  
3
#set -x
4

  
5
cd $(dirname $0)
6

  
7
if [ -f lib/org.gvsig.andami-2* ] ; then
8
  GVSIG_INSTALL_FOLDER=`dirname "$0"`
9
else
10
  if [ -f lib/org.gvsig.scripting.app.mainplugin-* ] ; then
11
    GVSIG_INSTALL_FOLDER=`dirname "$0"`/../../..
12
  else
13
    echo "Can't locate gvSIG installation folder"
14
    exit 1
15
  fi
16
fi
17

  
18
cd "${GVSIG_INSTALL_FOLDER}"
19

  
20
GVSIG_INSTALL_FOLDER="$PWD"
21

  
22
. ./gvSIG.sh --lib $@
23

  
24
for pluginName in \
25
    org.gvsig.app.document.table.app.mainplugin \
26
    org.gvsig.app.mainplugin \
27
    org.gvsig.csv.app.mainplugin \
28
    org.gvsig.geodb.app.mainplugin \
29
    org.gvsig.geometry.app.jts \
30
    org.gvsig.h2spatial.app.mainplugin \
31
    org.gvsig.installer.app.mainplugin \
32
    org.gvsig.labeling.app.mainplugin \
33
    org.gvsig.projection.app.proj4j \
34
    org.gvsig.scripting.app.mainplugin \
35
    org.gvsig.shp.app.mainplugin \
36
    org.gvsig.snapping.app.mainplugin \
37
    ;
38
    do
39
    for i in "$GVSIG_INSTALL_FOLDER/gvSIG/extensiones/$pluginName/lib/"*.jar ; do
40
      if [ "$i" != "$GVSIG_INSTALL_FOLDER/gvSIG/extensiones/$pluginName/lib/*.jar" -a "$i" != "" ]; then
41
        add_classpath "$i"
42
      fi
43
    done
44
    for i in "$GVSIG_INSTALL_FOLDER/gvSIG/extensiones/$pluginName/lib/"*.zip ; do
45
      if [ "$i" != "$GVSIG_INSTALL_FOLDER/gvSIG/extensiones/$pluginName/lib/*.zip" -a "$i" != "" ]; then
46
        add_classpath "$i"
47
      fi
48
    done
49
done
50

  
51
GVSIG_LAUNCHER=org.gvsig.scripting.app.extension.ScriptingMain
52
GVSIG_PARAMS="$@"
53

  
54
launch_gvSIG
55

  
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.76/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/plugin-persistence.def
1
<?xml version="1.0"?>
2
<!--
3
Definitions of plugin persistence org.gvsig.scripting.app.mainplugin.
4
 -->
5
<definitions>
6
  <version>1.0.0</version>
7
  <classes>
8
    <class name="org.gvsig.scripting.app.mainplugin">
9
      <description>Persistence of scripting plugin</description>
10
      <fields>
11
        <field name="ComposerUseHisWindowManager" type="boolean" mandatory="true" defaultValue="true">
12
          <description>When true the composer use his window manager instead of the gvSIG Window manager.</description>
13
        </field>
14
      </fields>
15
    </class>
16
  </classes>
17
</definitions>
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.76/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/i18n/text.properties
1
_Scripting=Scripting
2
_Show_scripting_launcher=Abrir lanzador de scripts
3
_Show_scripting_composer=Abrir editor de scripts
4
_Show_scripting_jython_console=Abrir consola Jython
5

  
6
User=Usuario
7
System=Sistema
8

  
9
Accept=Aceptar
10
Cancel=Cancelar
11
Apply=Aplicar
12

  
13
Retrieving_data=Recibiendo datos...
14

  
15
File=Fichero
16
New=Nuevo
17
Close_document=Cerrar documento
18
Close_all_documents=Cerrar todos los documentos
19
Run=Ejecutar
20
Save=Guardar
21
Close=Cerrar
22
Close_current_tab=Cerrar pesta\u00f1a actual
23
Open_edition_mode=Abrir modo edici\u00f3n
24
Run_selected_script=Ejecutar script seleccionado
25
Delete_selected_script=Borrar script seleccionado
26
Refresh_directories=Actualizar carpetas
27
Move_files=Mover ficheros
28
Set_file_preferences=Editar preferencias de fichero
29

  
30

  
31
Edit=Editar
32
Cut=Cortar
33
Copy=Copiar
34
Paste=Pegar
35
Select_all=Seleccionar todo
36

  
37
Tools=Herramientas
38
Launcher=Lanzador de scripts
39
Scripting_Launcher=Lanzador de scripts
40
Scripting_Composer=Editor de scripts
41
Jython_Console=Consola Jython
42
Import_JavaDoc=Importar JavaDoc
43
JavaDoc=Ayuda de Java (JavaDoc)
44
Remove_JavaDoc=Eliminar JavaDoc
45
Help_contents=Contenido de la ayuda
46
About_scripts_editor=Acerca del editor de scripts
47
Get_help=Ayuda
48
Help=Ayuda
49
_Package_script=Empaquetar script...
50
_Package_help=Empaquetar ayuda...
51

  
52
Problems=Errores
53
Console=Consola
54

  
55
Description=Descripci\u00f3n
56
Resource=Recurso
57
Location=Ubicaci\u00f3n
58

  
59
no_line=sin l\u00ednea
60
Line=L\u00ednea
61

  
62
Welcome_message=Bienvenido al entorno de scripting
63

  
64
Error_opening_in_edition_mode_title=Error al abrir fichero
65
Error_opening_in_edition_mode=No se pudo abrir el fichero en modo edici\u00f3n
66

  
67
New_Script=Nuevo elemento
68
New_Script_Description=Crea un nuevo script, di\u00e1logo, proyecto, directorio
69

  
70
Deleting_JavaDocs_successfully_title=Operaci\u00f3n realizada con \u00e9xito
71
Deleting_JavaDocs_successfully=Eliminaci\u00f3n de los JavaDocs exitosa
72

  
73
Import_JavaDoc_title=Importar JavaDocs desde los directorios de sistema al ScriptingFramework JavaDoc
74
Remove_JavaDoc_title=Eliminar JavaDocs del ScriptingFramework JavaDoc
75

  
76
projects_modified_title=Proyectos sin guardar
77
projects_modified=Algunos proyectos han sido modificados.\u00bfSalvar cambios?
78
project_modified=ha sido modificado.\u00bfSalvar cambios?
79

  
80
Delete_all_title=Borrar el documento
81
Delete_all_message=Esta acci\u00f3n elimina el documento o el directorio con todo su contenido. \u00bf Desea continuar ?
82

  
83
About_us_title=Informaci\u00f3n de todos los contribuidores al proyecto gvSIG
84

  
85
Success=Operaci\u00f3n realizada con \u00e9xito
86
Error=Error
87
Error_renaming=Inesperado error renombrando el fichero
88
Error_moving=Inesperado error moviendo el fichero
89
Error_help=Selecciona una ayuda
90
Rename_succesfully=Renombrado del fichero realizado con \u00e9xito
91
Select_first=Debe seleccionar un fichero primero
92
help_key=No hay ayuda para el texto
93

  
94

  
95
script_filesystem=script en el \u00e1rbol de directorio
96
Move=Mover
97
move_desc=Cambia la ubicaci\u00f3n del fichero seleccionado
98
Rename=Renombrar
99
rename_desc=Cambia el nombre y otras propiedades del fichero seleccionado
100
Moving_succesfully=Reubicaci\u00f3n del fichero realizado con \u00e9xito
101

  
102
Dialog=Di\u00e1logo
103
Code=C\u00f3digo
104
Properties=Propiedades
105

  
106
current_name=Nombre actual
107
new_name=Nuevo name
108
rename_name_title=Cambiar el nombre del fichero
109
more_properties=M\u00e1s propiedades
110

  
111
Javadoc_remove=Selecciona el JavaDoc a eliminar
112
no_Javadoc_remove=No hay JavaDoc para eliminar
113

  
114
Name=Nombre
115
Version=Versi\u00f3n
116
Created_by=Creado por
117
Description=Descripci\u00f3n
118
Type=Tipo
119
Language=Lenguaje
120
Author=Autor
121
Move_from=Mover desde
122
Move_to=Destino
123
Browse=Abrir
124
Import_from=Importar desde
125

  
126
Name_blank=El nombre no puede estar en blanco
127
Name_exists=Este nombre ya existe. Debe elegir otro
128
Import_success=Los JavaDocs se han importado satisfactoriamente
129
JavaDoc_Error=Selecciona JavaDoc a importar
130

  
131
go_to_line_Xhorizontal_ellipsisX=Ir a la l\u00ednea\u2026
132
find_Xhorizontal_ellipsisX=Buscar\u2026
133
replace_Xhorizontal_ellipsisX=Reemplazar\u2026
134
_Searching_autorun_scripts_Xhorizontal_ellipsisX=Buscando scripts de autoarranque...
135
_Running_autorun_script_from_XnameX=Ejecutando script de autoarranque desde "{0}"
136
_The_script_XscriptnameX_is_modified=El script "{0}" ha sido modificado.
137
_Save_changes_XquestionX=\u00bf Guardar cambios ?
138
_Do_you_want_to_save_changes_XquestionX=\u00bf Desea guardar los cambios ?
139

  
140
_notice=Aviso
141
_Initializing_the_scripting_plugin_Xhorizontal_ellipsisX=Inicializando el plugin de scripting...
142
_Waiting_to_terminate=Esperando que termine.
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.76/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
1
_Scripting=Scripting
2
_Show_scripting_launcher=Show scripting launcher
3
_Show_scripting_composer=Show scripting composer
4
_Show_scripting_jython_console=Show Jython console
5

  
6
User=User
7
System=System
8

  
9
Accept=Accept
10
Cancel=Cancel
11
Apply=Apply
12

  
13
Retrieving_data=Retrieving data...
14

  
15
File=File
16
New=New
17
Close_document=Close document
18
Close_all_documents=Cloase all documents
19
Run=Run
20
Save=Save
21
Close=Close
22
Close_current_tab=Close current tab
23
Open_edition_mode=Open edition mode
24
Run_selected_script=Run selected script
25
Delete_selected_script=Delete selected script
26
Refresh_directories=Refresh directories
27
Move_files=Move files
28
Set_file_preferences=Set file preferences
29
_Running_autorun_script_from_XnameX=Running autorun script from {0}
30

  
31
Edit=Edit
32
Cut=Cut
33
Copy=Copy
34
Paste=Paste
35
Select_all=Select all
36

  
37
Tools=Tools
38
Launcher=Scripting Launcher
39
Scripting_Launcher=Scripting Launcher
40
Scripting_Composer=Scripting Composer
41
Jython_Console=Jython console
42
Import_JavaDoc=Import JavaDoc
43
JavaDoc=Java Help (JavaDoc)
44
Remove_JavaDoc=Remove JavaDoc
45
Help_contents=Help contents
46
About_scripts_editor=About scripts editor
47
Get_help=Help
48
Help=Help
49
_Package_script=Package script...
50
_Package_help=Package help...
51

  
52
Problems=Errors
53
Console=Console
54

  
55
Description=Description
56
Resource=Resource
57
Location=Location
58

  
59
no_line=no line
60
Line=Line
61

  
62
Welcome_message=Welcome to the scripting framework
63

  
64
Error_opening_in_edition_mode_title=Error opening file in edition mode
65
Error_opening_in_edition_mode=The file can't be opened in edition mode
66

  
67
New_Script=New element
68
New_Script_Description=Create a new script, dialog, project, directory
69

  
70
Deleting_JavaDocs_successfully_title=Operation successful
71
Deleting_JavaDocs_successfully=Deleting JavaDocs successfully
72

  
73
Import_JavaDoc_title=Import JavaDocs from filesystem to ScriptingFramework JavaDoc
74
Remove_JavaDoc_title=Remove JavaDocs from ScriptingFramework JavaDoc
75

  
76
projects_modified_title=Projects without saving
77
projects_modified=Some projects have been modified. Save changes?
78
project_modified=has been modified. Save changes?
79

  
80
Delete_all_title=Delete document
81
Delete_all_message=This action removes the document or directory with all its content. Do you wish to continue ?
82

  
83
About_us_title=Information about all the gvSIG's contributors
84

  
85
Success=Operation done successfully
86
Error=Error
87
Error_renaming=Unexpected error renaming the file
88
Error_moving=Unexpected error moving the file
89
Error_help=Select help
90
Rename_succesfully=Renaming successfully
91
Select_first=Select a file first
92
help_key=There isn't any help to this text
93

  
94

  
95
script_filesystem=script filesystem
96
Move=Move
97
move_desc=Change location of selected file
98
Rename=Rename
99
rename_desc=Change the name and more properties of the selected file
100
Moving_succesfully=File moved succesfully
101

  
102
Dialog=Dialog
103
Code=Code
104
Properties=Properties
105

  
106
current_name=Current name
107
new_name=New name
108
rename_name_title=Change filename
109
more_properties=more properties
110

  
111
Javadoc_remove=Choose JavaDoc to delete
112
no_Javadoc_remove=There's no JavaDoc to delete
113

  
114
Name=Name
115
Version=Version
116
Created_by=Create by
117
Description=Description
118
Type=Type
119
Language=Language
120
Author=Author
121
Move_from=Move from
122
Move_to=Move to
123
Browse=Browse
124
Import_from=Import from
125

  
126
Name_blank=Name can't be blank
127
Name_exists=This name already exists. Choose another one
128
Import_success=JavaDocs imported successfully
129
JavaDoc_Error=Select JavaDoc to import
130

  
131

  
132
go_to_line_Xhorizontal_ellipsisX=Go To Line\u2026
133
find_Xhorizontal_ellipsisX=Find\u2026
134
replace_Xhorizontal_ellipsisX=Replace\u2026
135

  
136
_Searching_autorun_scripts_Xhorizontal_ellipsisX=Searching autorun scripts...
137
_Running_autorun_script_from_XnameX=Running autorun script from "{0}"
138
_The_script_XscriptnameX_is_modified=The script "{0}" has been modified.
139
_Save_changes_XquestionX=Save changes ?
140
_Do_you_want_to_save_changes_XquestionX=Do you want to save changes ?
141

  
142
_notice=Notice
143
_Initializing_the_scripting_plugin_Xhorizontal_ellipsisX=Initializing the scripting plugin...
144
_Waiting_to_terminate=Waiting to terminate.
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.76/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/License_Chalkwork_icons.txt
1
----------------------------------------------
2
CHALKWORK BASIC
3
by Dave Shea
4
mezzoblue.com/icons/chalkwork/basic
5
----------------------------------------------
6
CHALKWORK COMMERCE
7
by Dave Shea
8
mezzoblue.com/icons/chalkwork/commerce
9
----------------------------------------------
10
CHALKWORK EDITING CONTROLS
11
by Dave Shea
12
mezzoblue.com/icons/chalkwork/editing-controls
13
----------------------------------------------
14
CHALKWORK INFORMATION MANAGEMENT
15
by Dave Shea
16
mezzoblue.com/icons/chalkwork/information-management
17
----------------------------------------------
18
CHALKWORK HTML (Free Version)
19
by Dave Shea
20
mezzoblue.com/icons/chalkwork/html
21
----------------------------------------------
22

  
23
Thanks for your interest in the Chalkwork Family. Please consider subscribing to the Chalkwork news feed, which will announce new releases in the family as well as inform existing users of updates if any occur.
24

  
25
	http://mezzoblue.com/icons/chalkwork/news.xml
26

  
27
- Dave Shea
28
  mezzoblue.com
29
  @mezzoblue on Twitter
30

  
31

  
32

  
33

  
34
LICENSE AGREEMENT
35
----------------------------------------------
36
By downloading this icon set, you agree to abide by the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License under which these icons are being made available for non-commercial use.
37

  
38
	Applicable Creative Commons License: http://creativecommons.org/licenses/by-nc-sa/3.0/
39
	Attribution and additional license information: http://www.mezzoblue.com/icons/license/#license-cc
40

  
41
By purchasing a Chalkwork Commercial License, you agree to abide by the Chalkwork Royalty-Free Stock Icon License Agreement under which these icons are being made available for commercial use.
42

  
43
	Chalkwork Commercial License: http://www.mezzoblue.com/icons/license/#license-cc
44

  
45
This notice must be included any time these icons are redistributed.
46

  
47

  
48

  
49

  
50
----------------------------------------------
51
ICON FOLDER INDEX
52
----------------------------------------------
53
The icon files are broken down by file format. Due to some formats resulting in higher quality results, those are considered the preferred files and are located in the folder titled 'High Quality'. This package should contain the following folders in this hierarchy:
54

  
55
High Quality
56
    ICNS (Mac)
57
    ICO (Windows)
58
    PNG
59
    TIF
60
Lower Quality
61
    BMP
62
    GIF
63

  
64
Within each of the second-level folders, you'll find 102 further folders, one for each icon and its variations. Depending on the file format, you may find multiple sizes within these folders along with any icon variations that may exist. Please note that ICO and ICNS files contain all applicable sizes within a single file, and that ICNS files do not support the 24x24 icon size.
65

  
66

  
67
----------------------------------------------
68
CHALKWORK INFORMATION MANAGEMENT ICON INDEX
69
* indicates that variations of this icon are provided within this set
70
---------------------------------------------------------------------
71

  
72
Ad
73
	- Ad (Dollars) *
74
	- Ad (Euros) *
75
	- Ad (Pounds) *
76
Address Book *
77
Announcement *
78
API
79
Archive *
80
Attachment *
81
Authenticate
82
Blog *
83
Bookmark *
84
Briefcase *
85
Category *
86
Chart (Area) *
87
Chart (Bar) *
88
Chart (Pie) *
89
Collapse
90
Colour Palette *
91
Continue
92
Control Panel
93
Conversation *
94
Create
95
Dashboard *
96
Database *
97
Dictionary *
98
Document (Area Chart) *
99
Document (Bar Chart) *
100
Document (Blank) *
101
Document (Form) *
102
Document (Photo) *
103
Document (Pie Chart) *
104
Document (Secure) *
105
Document (Shred)
106
Documents (x2) *
107
Documents (x3) *
108
Download
109
Draw
110
Entry *
111
Excerpt *
112
Expand
113
Export
114
Fax *
115
File *
116
	- File (Closed)
117
	- File (Open)
118
Filter *
119
Flag *
120
Flag (Black) *
121
Flag (Blue) *
122
Flag (Brown) *
123
Flag (Green) *
124
Flag (Light Blue) *
125
Flag (Orange) *
126
Flag (Pink) *
127
Flag (Purple) *
128
Flag (Red) *
129
Flag (White) *
130
Flag (Yellow) *
131
Formatting
132
Hierarchy *
133
Import
134
Inbox *
135
Index *
136
List *
137
Log *
138
Map *
139
Mobile Phone *
140
Moderate
141
Module *
142
News *
143
Notes *
144
Notification *
145
Office *
146
Package *
147
Password
148
Phone *
149
	- Phone (Batphone) *
150
	- Phone (Office) *
151
Plugin *
152
Preview
153
Publish
154
Read More
155
Rebuild
156
Relationship (Data) *
157
Relationship (People) *
158
Rotate Left
159
Rotate Right
160
Schedule *
161
	- Schedule (Noun)
162
	- Schedule (Verb)
163
Script *
164
Security *
165
Sign In
166
Sign Out
167
Sort Down
168
Sort Up
169
Spam *
170
Statistics *
171
Status *
172
	- Status (Green)
173
	- Status (Off)
174
	- Status (On)
175
	- Status (Red)
176
	- Status (Yellow)
177
Support *
178
Sync
179
Template *
180
Ticket *
181
Time Zone *
182
Tools *
183
Trackback
184
View (Columns)
185
View (Lists)
186
View (Thumbnails)
187
Weather *
188
Write
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.76/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/package.rst
1

  
2
This plugin provides support for scripting to gvSIG.
3
Among other things it contains:
4

  
5
- The gvSIG scripting engine
6
- The gvSIG script editor
7
- Script engines for:
8
   - Jython
9
   - Groovy
10
   - javascript
11
   - Renjin
12

  
13
- The script install module for the add-on manager.
14
- Utilities to generate packages of complements with our scripts.
15
- Python libraries as:
16
   - Six - Utilities for writing code that runs on Python 2 and 3
17
   - PyLint - Python source code analyzer
18
   - Pygments - syntax highlighting package
19
   - CSSUtils - CSS Cascading Style Sheets library
20
   - Docutils - Python Documentation Utilities
21
   - geopy - client for several popular geocoding web services
22
   - PyInliner - CSS-to-inline-styles conversion tool for HTML
23
   - Statistics - functions for calculating statistics of data
24
   - Cartodb - simple CartoDB client to perform requests against the CartoDB API
25

  
26
- Java libraries to use from scripting as:
27
   - Abeille forms deseigner
28
   - jOpenDocument
29
   - JNumeric
30
   - CSSBox
31

  
32
This plugin can be configured to be preinstalled automatically, allowing 
33
"Script" type plugins to be installed during the application installation process. 
34
To do this, the following entries must be added to the "packages.properties" 
35
of gvspks::
36

  
37
    installers=scripts
38
    installer.scripts.initializer=org.gvsig.scripting.app.extension.ScriptsInstallerInitializer
39
    installer.scripts.package.code=org.gvsig.scripting.app.mainplugin
40
    installer.scripts.factory.name=Script
41
    installer.scripts.libs=lib
42

  
43
If the "installers" entry already exists, add "scripts" to the end separating 
44
it with a space.
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.76/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/scripting/lib.versions
1
-2_0_0=gvSIG desktop 2.2.0
org.gvsig.scripting/tags/org.gvsig.scripting-2.3.76/org.gvsig.scripting.app/org.gvsig.scripting.app.mainplugin/src/main/resources-plugin/scripting/lib-2_0_0/gvsig.py
1
# -*- coding: utf-8 -*-
2
#
3
# File: gvsig.py
4
#
5
# Copyright (c) 2011 by Model Driven Development sl and Antonio Carrasco Valero
6
#
7
# GNU General Public License (GPL)
8
#
9
# This program is free software; you can redistribute it and/or
10
# modify it under the terms of the GNU General Public License
11
# as published by the Free Software Foundation; either version 2
12
# of the License, or (at your option) any later version.
13
#
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License
20
# along with this program; if not, write to the Free Software
21
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22
# 02110-1301, USA.
23
#
24
#
25

  
26
"""
27
This module contains classes and functions to manage gvSIG Project, 
28
gvSIG DocumentView, gvSIG TableDocument and Layers.
29
Also contais functions to manage vectorial data and other utility 
30
functions
31
"""
32

  
33
__author__ = """Antonio Carrasco Valero
34
Model Driven Development sl and Antonio Carrasco Valero
35
<carrasco@modeldd.org>
36
Victor Acevedo Royer <vacevedor@gvsig.com>, <vacevedor@gmail.com>
37
"""
38

  
39
__docformat__ = 'plaintext'
40

  
41
from java.awt import Color
42

  
43
from java.lang import RuntimeException
44
from java.lang import Throwable
45
import java.lang.IndexOutOfBoundsException
46

  
47
from java.util.prefs import Preferences
48

  
49
from org.gvsig.app import ApplicationLocator
50
from org.gvsig.app.project.documents.view import ViewDocument 
51
from org.gvsig.app.project.documents.table import TableDocument
52

  
53
from org.gvsig.fmap.crs import CRSFactory
54

  
55
from org.gvsig.fmap.mapcontext import MapContextLocator
56
from org.gvsig.fmap.mapcontext.layers import FLayers
57

  
58
from org.gvsig.fmap.dal import DALLocator, DataTypes
59
from org.gvsig.fmap.dal.feature import EditableFeature, \
60
    EditableFeatureType, FeatureQueryOrder
61
from org.gvsig.fmap.dal.feature.impl import DefaultEditableFeature
62

  
63
from org.gvsig.fmap.geom import Geometry
64

  
65
from org.gvsig.tools import ToolsLocator
66

  
67
import thread
68
import random
69

  
70

  
71
def runTask(name, function, *args):
72
  manager = ToolsLocator.getTaskStatusManager()
73
  status = manager.createDefaultSimpleTaskStatus(name)
74
  status.add()
75
  args = list(args)
76
  args.append(status)
77
  try:
78
    thread.start_new_thread(function, tuple(args))
79
    status.terminate()
80
  except Exception,e:
81
    status.abort()
82
    raise e
83
     
84

  
85
class WrapperToJava(object):
86
  """Creates a wrapper that allows python object access to the Java object
87
  properties and methods
88
  """
89
  def __init__(self, javaobj):
90
    if javaobj == None:
91
      raise RuntimeException("Can't create "+ self.__class__.__name__)
92
    self._javaobj = javaobj
93

  
94
  def __call__(self):
95
    return self._javaobj
96

  
97
  def __getattr__(self,name):
98
    return getattr(self._javaobj,name)
99

  
100
class Project(WrapperToJava):
101
  """Represents a gvSIG project (org.gvsig.app.project.DefaultProject)"""
102

  
103
  def __init__(self, project):
104
    WrapperToJava.__init__(self, project)
105
  
106
  def getView(self, name=None):
107
    """
108
    Returns active view, or view called 'name'  or None
109
    :param name: view name
110
    :type name: string    
111
    """
112
    if name == None:
113
      try:
114
        activeDocument = self.getActiveDocument()
115
        if activeDocument == None:
116
            return None
117
        if isinstance(activeDocument, ViewDocument):
118
            return View(activeDocument)
119
      except Exception, ex:
120
        raise Exception("%s"%repr(ex))
121
    else:
122
      views = self.getViews()
123
      if len(views) >0:
124
        for view in views:
125
          if name == view.getName():
126
            return View(view)
127

  
128
    return None
129
    
130
  def getTable(self, name=None):
131
    """
132
    Returns active Table Document, or Table Document called 'name'  or None
133
    :param name: Table Document name
134
    :type name: string
135
    """
136
    if name == None:
137
      try:
138
        activeDocument = self.getActiveDocument()
139
        if activeDocument == None:
140
            return None
141
        if isinstance(activeDocument, TableDocument):
142
            return Table(activeDocument)
143
      except Exception, ex:
144
        raise Exception("%s"%repr(ex))
145
    else:
146
      tables = self.getDocuments("project.document.table")
147
      if len(tables) >0:
148
        for table in tables:
149
          if name == table.getName():
150
            return Table(table)
151
            
152
    return None   
153
    
154
  def getProjectionCode(self):
155
    """Returns Project projection code name string. This value is the 
156
    projects default projection that is fixed in Preferences tool, View 
157
    options. It's used when no view projection is defined.
158
    
159
    """
160
    return self.getProjection().getFullCode()
161
    
162

  
163
class View(WrapperToJava):
164
  """
165
  Represents gvSIG view document 
166
  (org.gvsig.app.project.documents.view.DefaultViewDocument).  
167
  """
168
  def __init__(self,view):
169
    WrapperToJava.__init__(self,view)
170
    
171
  def getLayer(self, name=None):
172
    """
173
    Returns one view layer. If name is None returns active 
174
    layer if the view has one, if name is not None returns layer called name 
175
    else returns None.
176
    :param name: view name in Table Of Contents
177
    :type name: string
178
    :return: View
179
    :return: None  
180
    """
181
    map = self.getMapContext();
182
    if name == None:
183
      activeLayers = map.getLayers().getActives()
184
      if len(activeLayers) != 1 :
185
        return None
186
      for layer in activeLayers:
187
        if not isinstance(layer, FLayers):
188
          return Layer(layer)
189
      return None
190
    
191
    ls = self.getLayers()
192
    for i in xrange(ls.getLayersCount()):
193
      l = ls.getLayer(i)
194
      if l.name == name:
195
        return Layer(l)
196
    
197
    return None
198
    
199
  def getMap(self):
200
    # org.gvsig.fmap.mapcontext.MapContext
201
    """Returns view mapContext"""
202
    return self.getMapContext();
203
 
204
  def addLayer(self, layer):
205
    """
206
    Adds a new layer to the view
207
    :param layer: layer to add
208
    :type layer: Layer  
209
    """
210
    if isinstance(layer, Layer):
211
      layer =layer()
212
    self.getMapContext().getLayers().addLayer(layer)
213
  
214
  def getLayers(self):
215
    """Returns iterable view layers set"""
216
    map = self.getMapContext()
217
    return Layers(map.getLayers())
218
    
219
  def getGraphicsLayer(self):
220
    """Returns view graphics layer 
221
    org.gvsig.fmap.mapcontext.layers.vectorial.impl.DefaultGraphicLayer
222
    """
223
    return self.getMapContext().getGraphicsLayer()
224
    
225
  def getProjectionCode(self):
226
    """Returns string view projection code name"""
227
    return self.getProjection().getFullCode()
228
    
229
  def isProjected(self):
230
    """Returns if view projection is projected."""
231
    self.getProjection().isProjected()
232
      
233
class Layers(WrapperToJava):
234
  """Iterable layers set 
235
  (org.gvsig.fmap.mapcontext.layers.FLayers)  
236
  """
237
  def __init__(self,layers):
238
    WrapperToJava.__init__(self, layers)
239

  
240
  def __len__(self):
241
    return self.getLayersCount()
242

  
243
  def __getitem__(self, index):
244
    return self.getLayer(index)
245

  
246
  def __iter__(self):
247
    return LayersIterator(self)
248

  
249
class LayersIterator(object):
250

  
251
  def __init__(self,layers):
252
    self.__layers = layers
253
    self.__index = -1
254

  
255
  def next(self):
256
    self.__index+=1
257
    if self.__index >= self.__layers.getLayersCount() :
258
      raise StopIteration()
259
    return Layer(self.__layers.getLayer(self.__index))    
260
  
261
class Store(WrapperToJava):
262
  """Represents gvsig store. It's used as Table/Layer objects store  
263
  (org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore)
264
  """
265
  def __init__(self,store):
266
    WrapperToJava.__init__(self, store)
267
    #self.data = None
268
    self.fset = None
269
  
270
  def features(self, expresion = None, sortBy="", asc=True):
271
    """Returns layer features set (FeatureSet class), with all layer features, 
272
    or selected featured if there are (could be empty feature set) or None if
273
    gets an Exception.
274
    :param expresion: filter to apply to the feature set to select
275
        determinates features that match with expression
276
    :type expresion: string
277
    :param sortBy: name of attribute to sort
278
    :type sortby: string
279
    :param: asc: order
280
    :type asc: boolean
281
    :return: FeatureSet
282
    """   
283
    if expresion == None and sortBy =="":
284
      self.fset = self.getFeatureSet()         
285
    else:
286
      try:
287
        application = ApplicationLocator.getManager()
288
        datamanager =  application.getDataManager()
289
        query = self.createFeatureQuery()
290
        if sortBy != "":
291
            order = FeatureQueryOrder()
292
            order.add(sortBy, asc)
293
            query.setOrder(order)
294
        if expresion != None:
295
            query.setFilter(datamanager.createExpresion(expresion))
296
        self.fset = self.getFeatureSet(query)
297
      except Exception, e:
298
        return None
299
    
300
    return FeatureSet(self.fset)    
301

  
302
  def edit(self):
303
    """Set store in edition mode"""     
304
    if not self.isEditing():
305
        self().edit() 
306
     
307
  def append(self, *valuesList, **values):
308
    """
309
    Creates a new feature from given values and insert it in the feature 
310
    set. If an error occurs raises RuntimeException.
311
    :param values: dictionary with name property value or list named params
312
    :type values: dict
313
    """
314
    try:
315
      if len(valuesList) ==1:
316
        values.update(valuesList[0])
317
      
318
      if not self.isEditing():
319
        self.edit() 
320
      f = self.createNewFeature()
321
      
322
      if f == None:
323
        raise RuntimeError("Failed to create a new Feature")
324
      for k,v in values.iteritems():
325
        f.set(k,v)
326
        self.insert(f)
327
    except Throwable, ex:
328
      raise RuntimeException("Can't append values %s to layer %s (%s)" % (
329
        repr(values), 
330
        self.getName(), 
331
        str(ex)
332
        )
333
      )
334

  
335
  def updateSchema(self, schema):
336
    """
337
    Updates store FeatureType. If an error occurs raises 
338
    RuntimeException.
339
    """
340
    try:
341
      self().update(schema._javaobj)
342
    except Throwable, ex:
343
      raise RuntimeException(repr(ex))
344
    
345
  def update(self, feature):
346
    """
347
    Updates exist feature in the layer featureSet
348
    :param editableFeature: editableFeature
349
    :type editableFeature: Java editableFeature
350
    """
351
    if not self.isEditing():
352
      self.edit() 
353
    
354
    if not isinstance(feature, EditableFeature):
355
      feature = feature._javaobj
356
    self.fset.update(feature)
357
  
358
  def getSchema(self):
359
    """Returns store data attributtes"""
360
    return Schema(self.getDefaultFeatureType())
361

  
362
  def commit(self):
363
    """
364
    Finish store edition saving changes. If an error occurs raises Throwable 
365
    Exception.
366
    """
367
    try:
368
      self.finishEditing()          
369
    except Throwable, ex:
370
      self.abort()
371
      raise Throwable("Can't finish layer edition, cancelling changes. %s" % repr(ex))
372
  
373
  def abort(self):
374
    """Finish store edition withoout saving changes and disposes itself"""
375
    self.cancelEditing() 
376
    self.dispose()
377

  
378
  def getSelection(self):
379
    """Returns store features selected set"""
380
    return FeatureSet(self().getSelection())
381

  
382
class __DefaultTable__(WrapperToJava):
383
  def __init__(self,document, data):
384
    self.data = Store(data)
385
    WrapperToJava.__init__(self,document)
386
    self.selection = None
387

  
388
  def features(self, expresion = None, sortBy="", asc=True):
389
    """
390
    Returns data features set
391
    :param expresion: filter to apply to the feature set to select
392
         determinates features that match with expression
393
    :type expresion: string
394
    :return: FeatureSet
395
    """
396
    return self.data.features(expresion, sortBy, asc)
397

  
398
  def edit(self):
399
    """Sets data in edition mode"""
400
     
401
    self.data.edit() 
402
     
403
  def append(self, *valuesList, **values):
404
    """
405
    Creates a new feature from given values and insert it in the feature set
406
    :param values: dictionary with name property value or list named params
407
    :type values: dict
408
    """
409
    self.data.append(*valuesList, **values)
410
    
411
  def updateSchema(self, schema):
412
    """
413
    Updates data data attributes properties with the given schema
414
    """
415
    self.data.updateSchema(schema)
416
    
417
  def update(self, feature):
418
    """
419
    Updates exist feature in the featureSet with the given feature
420
    :param editableFeature: editableFeature
421
    :type editableFeature: Java editableFeature
422
    """
423
    self.data.update(feature)
424
  
425
  def getSchema(self):
426
    """Returns data attributes definition"""
427
    return self.data.getSchema()
428

  
429
  def commit(self):
430
    """Finish edition saving changes"""
431
    self.data.commit()
432
  
433
  def abort(self):
434
    """Finish edition without saving changes"""
435
    self.data.abort()
436
    
437
  def getSelection(self):
438
    """Returns features selected set"""
439
    if self.selection == None:
440
      self.selection = Selection(self.data.getSelection())
441
      
442
    return self.selection
443
  
444
  def select(self, selection):
445
    """Inserts features in the features selection set"""
446
    self.getSelection().select(selection)
447

  
448
  def deselect(self, selection):
449
    """Remove features in the features selection set"""
450
    self.getSelection().deselect(selection)
451

  
452
  def isSelected(feature):
453
    """Returns True if given feature is selected"""
454
    self.getSelection().isSelect(feature)
455

  
456
  def getProjectionCode(self):
457
    """Returns projection code name"""
458
    return self.getProjection().getFullCode()
459

  
460

  
461
class Table(__DefaultTable__):
462
  """Represents gvsig table document 
463
  (org.gvsig.app.project.documents.table.TableDocument)
464
  """
465
  def __init__(self,table):
466
    __DefaultTable__.__init__(self, table, table.getStore())
467
    
468
  def getAssociatedLayer(self):
469
    """Returns table associated layer or None if there're not associated 
470
    layer
471
    """    
472
    if self._javaobj.getAssociatedLayer():
473
      return Layer(self._javaobj.getAssociatedLayer())
474
        
475
    return None
476

  
477
class Layer(__DefaultTable__):
478
  """Represents gvsig layer document. It's a wrapper from 
479
  org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect class
480
  """
481
  def __init__(self,layer):
482
    __DefaultTable__.__init__(self, layer, layer.getFeatureStore())
483
    
484
  def getTypeVectorLayer(self):
485
    """
486
    Returns layer DefaultGeometryType class 
487
    To get the geometryType use DefaultGeometryType getType() method
488
    To get the geometrySubType use DefaultGeometryType getSubType() method
489
    """
490
    return self().getTypeVectorLayer()
491
        
492
class FeatureSet(WrapperToJava):
493
  """Represents gvSIG FeatureSet 
494
  (org.gvsig.fmap.dal.feature.impl.featureset.DefaultFeatureSet)
495
  """
496
  def __init__(self,featureSet):
497
    WrapperToJava.__init__(self,featureSet)
498
    
499
  def getCount(self):
500
    """Returns the number of elements in the featureSet"""
501
    return self.getSize()
502
  
503
  def update(self, feature):
504
    """
505
    Updates exist feature in the featureSet
506
    :param editableFeature: editableFeature
507
    :type editableFeature: Java editableFeature
508
    """
509
    if not isinstance(feature, EditableFeature) and \
510
            not isinstance(feature, DefaultEditableFeature):
511
      feature = feature._javaobj
512
    self().update(feature)
513
  
514
  def __iter__(self):
515
    return  Iterator(self.fastIterator())
516
    
517
class Selection(FeatureSet):
518
  """Manage selected features set from a store. Represents gvSIG 
519
  org.gvsig.fmap.dal.feature.impl.DefaultFeatureSelection.  
520
  """
521
  def __init__(self, featureSet):
522
    FeatureSet.__init__(self, featureSet)
523
      
524
  def select(self, selection):
525
    """Inserts features in the features selection set"""
526
    if isinstance(selection,Feature) or isinstance(selection, FeatureSet):
527
      self._javaobj.select(selection._javaobj)
528
    else:
529
      self._javaobj.select(selection)
530

  
531
  def deselect(self, selection):
532
    """Removes features in the features selection set"""
533
    if isinstance(selection,Feature) or isinstance(selection, FeatureSet):
534
      self._javaobj.deselect(selection._javaobj)
535
    else:
536
      self._javaobj.deselect(selection)
537

  
538
  def isSelected(feature):
539
    """Returns True if given feature is selected"""
540
    if isinstance(feature, Feature):
541
      self._javaobj.isSelect(feature._javaobj)
542
    else:
543
      self._javaobj.isSelect(feature)
544
      
545
  def getCount(self):
546
    """Returns the number of elements in the selection"""
547
    return self.getSelectedCount()
548
    
549
    
550
class Iterator(WrapperToJava):
551

  
552
  def __init__(self,iterator):
553
    WrapperToJava.__init__(self,iterator)
554

  
555
  def next(self):
556
    if not self.hasNext():
557
      raise StopIteration()
558
    return Feature(self().next())
559
    
560
class Feature(WrapperToJava):
561
  """Represents feature data It's a wrapper from gvSIG 
562
  org.gvsig.fmap.dal.feature.impl.DefaultFeature class
563
  """
564
  def __init__(self,feature):
565
    WrapperToJava.__init__(self,feature)
566
    self.featureNoEditable = None
567

  
568
  def geometry(self):
569
    """Returns feature geometry"""
570
    return self.getDefaultGeometry()
571
   
572
  def getValues(self):
573
    """Returns dictionary with the pair name, value, feature attributes"""
574
    descriptor = self.getType()
575
    items = dict()
576
    for attr in descriptor.getAttributeDescriptors():
577
      name = attr.getName()
578
      value = self.get(attr.getName())
579
      items[name] = value
580
    return items 
581
  
582
  def edit(self):
583
    """Returns editable feature instance"""
584
    if not isinstance(self._javaobj, EditableFeature):
585
      self.featureNoEditable = self._javaobj
586
      self._javaobj = self._javaobj.getEditable()
587
  
588
  def __getitem__(self,key):
589
    return self.get(key)
590
  
591
  def __getattr__(self,name):
592
    #
593
    #FIX console error when try to introspect feature object
594
    if name in ('__methods__'):
595
        return dict()
596
    elif name in ('__members__'):
597
        return self.getValues().keys()
598
    elif name == '__dict__':
599
        return self.getValues()      
600
        
601
    try:
602
      v = getattr(self._javaobj, name, None)
603
      if v == None:
604
        v = self().get(name)        
605
      return v
606
    except Throwable, ex:
607
      raise RuntimeException("Can't access to attribute %s of feature (%s)" % (name, str(ex)))    
608

  
609
class Schema(WrapperToJava):
610
  """Stores data properties definition. Represents gvSIG FeatureType
611
  (org.gvsig.fmap.dal.feature.impl.DefaultFeatureType)
612
  """
613

  
614
  def __init__(self, featureType):
615
    WrapperToJava.__init__(self,featureType)
616
    self.featureTypeNoEditable = None
617
  
618
  def append(self, name, type, size=None, default=None, precision=4):
619
    """Adds new property to feature properties definition. If error occurs 
620
    raises RuntimeError.    
621
    :param name: Feature property name
622
    :type name: String
623
    :param type: Feature property type
624
    :type name: String
625
    :param size: Feature property size
626
    :type size: int
627
    :param default: Feature property default value
628
    :return: new atribute
629
    """
630
    if not isinstance(self._javaobj, EditableFeatureType):
631
        self.modify()
632
    
633
    if isinstance(type, str):
634
      try:
635
        application = ApplicationLocator.getManager()
636
        datamanager =  application.getDataManager()
637
        dataTypes = application.getDataTypesManager()
638
        type = dataTypes.getType(type) #dataType constant value from string
639
      except:
640
        raise RuntimeError(
641
            "Feature Property Data type (%s) is not valid.  name=%s, type=%s, size=%s, default=%s)" % (
642
                type, 
643
                name, 
644
                type, 
645
                size, 
646
                default
647
            )
648
        )
649
    if isinstance(type, int):
650
      try:
651
        type = dataTypes.get(type)
652
      except:
653
        raise RuntimeError(
654
            "Data type (%s) is not valid.  name=%s, type=%s, size=%s, default=%s)" % (
655
                type, 
656
                name, 
657
                type, 
658
                size, 
659
                default
660
            )
661
        )
662
      
663
    attribute = self.add(name, type.getType())
664
 
665
    if size != None: 
666
      attribute.setSize(size)
667
    
668
    if default != None:
669
      attribute.setDefaultValue(default)
670
      
671
    if precision != None and type.getType() in (DataTypes.DOUBLE, DataTypes.FLOAT):
672
      attribute.setPrecision(precision)
673
    
674
    if type.getType() == DataTypes.GEOMETRY and self.getDefaultGeometryAttributeName()==None:
675
      self.setDefaultGeometryAttributeName(name)
676
    
677
    return attribute
678

  
679
  def __getitem__(self, name):
680
    try:
681
      return self.ftype.getAttributeDescriptor(name)
682
    except java.lang.IndexOutOfBoundsException:
683
      raise StopIteration
684

  
685
  def get(self, name, default=None):
686
    """Returns a feature attribute descriptor that contains information about 
687
    one feature attribute, such as its name, data type or precision. 
688
    :param name: Attribute name
689
    :type name: string
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff