root / trunk / libraries / libGPE / src / org / gvsig / gpe / GPEDefaults.java @ 12175
History | View | Annotate | Download (4.62 KB)
1 | 11164 | jorpiell | package org.gvsig.gpe; |
---|---|---|---|
2 | |||
3 | 11655 | jorpiell | import java.util.Hashtable; |
4 | 11164 | jorpiell | |
5 | /* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
||
6 | *
|
||
7 | * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
22 | *
|
||
23 | * For more information, contact:
|
||
24 | *
|
||
25 | * Generalitat Valenciana
|
||
26 | * Conselleria d'Infraestructures i Transport
|
||
27 | * Av. Blasco Ib??ez, 50
|
||
28 | * 46010 VALENCIA
|
||
29 | * SPAIN
|
||
30 | *
|
||
31 | * +34 963862235
|
||
32 | * gvsig@gva.es
|
||
33 | * www.gvsig.gva.es
|
||
34 | *
|
||
35 | * or
|
||
36 | *
|
||
37 | * IVER T.I. S.A
|
||
38 | * Salamanca 50
|
||
39 | * 46005 Valencia
|
||
40 | * Spain
|
||
41 | *
|
||
42 | * +34 963163400
|
||
43 | * dac@iver.es
|
||
44 | */
|
||
45 | /* CVS MESSAGES:
|
||
46 | *
|
||
47 | * $Id$
|
||
48 | * $Log$
|
||
49 | 12071 | jorpiell | * Revision 1.9 2007-06-07 14:52:28 jorpiell
|
50 | * Add the schema support
|
||
51 | *
|
||
52 | * Revision 1.8 2007/05/15 10:39:14 jorpiell
|
||
53 | 11655 | jorpiell | * Add the number of decimals property
|
54 | *
|
||
55 | * Revision 1.7 2007/05/15 09:34:39 jorpiell
|
||
56 | 11644 | jorpiell | * the tag names cant have blanc spaces
|
57 | *
|
||
58 | * Revision 1.6 2007/04/26 14:23:16 jorpiell
|
||
59 | 11377 | jorpiell | * Add a getStringProperty method
|
60 | *
|
||
61 | * Revision 1.5 2007/04/19 11:50:20 csanchez
|
||
62 | 11265 | csanchez | * Actualizacion protoripo libGPE
|
63 | *
|
||
64 | * Revision 1.4 2007/04/18 11:03:36 jorpiell
|
||
65 | 11235 | jorpiell | * Add the default schema property
|
66 | *
|
||
67 | * Revision 1.3 2007/04/14 16:06:13 jorpiell
|
||
68 | 11208 | jorpiell | * The writer handler has been updated
|
69 | *
|
||
70 | * Revision 1.2 2007/04/12 17:06:42 jorpiell
|
||
71 | 11171 | jorpiell | * First GML writing tests
|
72 | *
|
||
73 | * Revision 1.1 2007/04/12 11:39:20 jorpiell
|
||
74 | 11164 | jorpiell | * Add the GPEDefaults class
|
75 | *
|
||
76 | *
|
||
77 | */
|
||
78 | /**
|
||
79 | * This class is used to add the properties that are used
|
||
80 | * by the GPE parsers.
|
||
81 | * @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
||
82 | */
|
||
83 | public class GPEDefaults { |
||
84 | 11655 | jorpiell | private static Hashtable properties = new Hashtable(); |
85 | 11235 | jorpiell | //Decimal sepatarator
|
86 | 11164 | jorpiell | public static final String DECIMAL = "decimal"; |
87 | 11235 | jorpiell | //Coordinates separator. Ex: xSEPARATORy
|
88 | 11164 | jorpiell | public static final String COORDINATES_SEPARATOR = "coordinatesSeparator"; |
89 | 11235 | jorpiell | //Set of tuples separator Ex: x1,y1SEPARATORx2,y2
|
90 | 11164 | jorpiell | public static final String TUPLES_SEPARATOR = "tuplesSeparator"; |
91 | 11655 | jorpiell | //Number of decimal digits
|
92 | public static final String DECIMAL_DIGITS = "decimalDigits"; |
||
93 | 11235 | jorpiell | //Namespace prefix to create the XML files
|
94 | 11171 | jorpiell | public static final String NAMESPACE_PREFIX = "namespacePrefix"; |
95 | 11235 | jorpiell | //Namespace URI to create the XML files
|
96 | 11171 | jorpiell | public static final String NAMESPACE_URI= "namespaceURI"; |
97 | 11235 | jorpiell | //Default schema name
|
98 | public static final String XSD_SCHEMA_FILE = "schemaName"; |
||
99 | //XML version = 1.0
|
||
100 | 11171 | jorpiell | public static final String XML_VERSION = "xmlVersion"; |
101 | 11235 | jorpiell | //XML encoding (UTF-8) by default
|
102 | 11171 | jorpiell | public static final String XML_ENCODING = "xmlEncoding"; |
103 | 11235 | jorpiell | //Default output file
|
104 | 11208 | jorpiell | public static final String DEFAULT_FILE_NAME = "defaultFileName"; |
105 | 11644 | jorpiell | //Default black space symbol
|
106 | public static final String DEFAULT_BLANC_SPACE = "defaultBlancSpace"; |
||
107 | 11164 | jorpiell | |
108 | 11235 | jorpiell | |
109 | 11655 | jorpiell | |
110 | 11164 | jorpiell | static{
|
111 | properties.put(DECIMAL, ".");
|
||
112 | properties.put(COORDINATES_SEPARATOR, ",");
|
||
113 | 11171 | jorpiell | properties.put(TUPLES_SEPARATOR, " ");
|
114 | properties.put(NAMESPACE_PREFIX, "cit");
|
||
115 | 12071 | jorpiell | properties.put(NAMESPACE_URI, "http://www.gvsig.org/cit");
|
116 | 11171 | jorpiell | properties.put(XML_VERSION, "1.0");
|
117 | properties.put(XML_ENCODING, "UTF-8");
|
||
118 | 11208 | jorpiell | properties.put(DEFAULT_FILE_NAME, "output");
|
119 | 11235 | jorpiell | properties.put(XSD_SCHEMA_FILE, "cit.xsd");
|
120 | 11655 | jorpiell | properties.put(DEFAULT_BLANC_SPACE, "_");
|
121 | properties.put(DECIMAL_DIGITS, new Integer(20)); |
||
122 | 11164 | jorpiell | } |
123 | |||
124 | /**
|
||
125 | 11377 | jorpiell | * Gets a String property
|
126 | 11164 | jorpiell | * @param key
|
127 | * Property name
|
||
128 | * @return
|
||
129 | */
|
||
130 | 11377 | jorpiell | public static String getStringProperty(String key){ |
131 | 11655 | jorpiell | Object obj = getProperty(key);
|
132 | 11171 | jorpiell | if (obj == null){ |
133 | return null; |
||
134 | } |
||
135 | return (String)obj; |
||
136 | 11164 | jorpiell | } |
137 | |||
138 | /**
|
||
139 | 11655 | jorpiell | * Gets a int property
|
140 | * @param key
|
||
141 | * Property name
|
||
142 | * @return
|
||
143 | * The int property or -1
|
||
144 | */
|
||
145 | public static int getIntPropertyProperty(String key){ |
||
146 | Object obj = getProperty(key);
|
||
147 | if (obj == null){ |
||
148 | return -1; |
||
149 | } |
||
150 | if (obj instanceof Integer){ |
||
151 | return ((Integer)obj).intValue(); |
||
152 | }return -1; |
||
153 | } |
||
154 | |||
155 | /**
|
||
156 | 11377 | jorpiell | * Gets a property
|
157 | * @param key
|
||
158 | * Property name
|
||
159 | * @return
|
||
160 | */
|
||
161 | public static Object getProperty(String key){ |
||
162 | 11655 | jorpiell | return properties.get(key);
|
163 | 11377 | jorpiell | } |
164 | |||
165 | /**
|
||
166 | 11164 | jorpiell | * Sets a property
|
167 | * @param key
|
||
168 | * @param value
|
||
169 | */
|
||
170 | public static void setProperty(String key, Object value){ |
||
171 | properties.put(key, value); |
||
172 | } |
||
173 | |||
174 | |||
175 | } |