svn-gvsig-desktop / trunk / libraries / libGPE / src / org / gvsig / gpe / GPEDefaults.java @ 11655
History | View | Annotate | Download (4.54 KB)
1 |
package org.gvsig.gpe; |
---|---|
2 |
|
3 |
import java.util.Hashtable; |
4 |
|
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: GPEDefaults.java 11655 2007-05-15 10:39:39Z jorpiell $
|
48 |
* $Log$
|
49 |
* Revision 1.8 2007-05-15 10:39:14 jorpiell
|
50 |
* Add the number of decimals property
|
51 |
*
|
52 |
* Revision 1.7 2007/05/15 09:34:39 jorpiell
|
53 |
* the tag names cant have blanc spaces
|
54 |
*
|
55 |
* Revision 1.6 2007/04/26 14:23:16 jorpiell
|
56 |
* Add a getStringProperty method
|
57 |
*
|
58 |
* Revision 1.5 2007/04/19 11:50:20 csanchez
|
59 |
* Actualizacion protoripo libGPE
|
60 |
*
|
61 |
* Revision 1.4 2007/04/18 11:03:36 jorpiell
|
62 |
* Add the default schema property
|
63 |
*
|
64 |
* Revision 1.3 2007/04/14 16:06:13 jorpiell
|
65 |
* The writer handler has been updated
|
66 |
*
|
67 |
* Revision 1.2 2007/04/12 17:06:42 jorpiell
|
68 |
* First GML writing tests
|
69 |
*
|
70 |
* Revision 1.1 2007/04/12 11:39:20 jorpiell
|
71 |
* Add the GPEDefaults class
|
72 |
*
|
73 |
*
|
74 |
*/
|
75 |
/**
|
76 |
* This class is used to add the properties that are used
|
77 |
* by the GPE parsers.
|
78 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
79 |
*/
|
80 |
public class GPEDefaults { |
81 |
private static Hashtable properties = new Hashtable(); |
82 |
//Decimal sepatarator
|
83 |
public static final String DECIMAL = "decimal"; |
84 |
//Coordinates separator. Ex: xSEPARATORy
|
85 |
public static final String COORDINATES_SEPARATOR = "coordinatesSeparator"; |
86 |
//Set of tuples separator Ex: x1,y1SEPARATORx2,y2
|
87 |
public static final String TUPLES_SEPARATOR = "tuplesSeparator"; |
88 |
//Number of decimal digits
|
89 |
public static final String DECIMAL_DIGITS = "decimalDigits"; |
90 |
//Namespace prefix to create the XML files
|
91 |
public static final String NAMESPACE_PREFIX = "namespacePrefix"; |
92 |
//Namespace URI to create the XML files
|
93 |
public static final String NAMESPACE_URI= "namespaceURI"; |
94 |
//Default schema name
|
95 |
public static final String XSD_SCHEMA_FILE = "schemaName"; |
96 |
//XML version = 1.0
|
97 |
public static final String XML_VERSION = "xmlVersion"; |
98 |
//XML encoding (UTF-8) by default
|
99 |
public static final String XML_ENCODING = "xmlEncoding"; |
100 |
//Default output file
|
101 |
public static final String DEFAULT_FILE_NAME = "defaultFileName"; |
102 |
//Default black space symbol
|
103 |
public static final String DEFAULT_BLANC_SPACE = "defaultBlancSpace"; |
104 |
|
105 |
|
106 |
|
107 |
static{
|
108 |
properties.put(DECIMAL, ".");
|
109 |
properties.put(COORDINATES_SEPARATOR, ",");
|
110 |
properties.put(TUPLES_SEPARATOR, " ");
|
111 |
properties.put(NAMESPACE_PREFIX, "cit");
|
112 |
properties.put(NAMESPACE_URI, "http://www.gvsig.com/cit");
|
113 |
properties.put(XML_VERSION, "1.0");
|
114 |
properties.put(XML_ENCODING, "UTF-8");
|
115 |
properties.put(DEFAULT_FILE_NAME, "output");
|
116 |
properties.put(XSD_SCHEMA_FILE, "cit.xsd");
|
117 |
properties.put(DEFAULT_BLANC_SPACE, "_");
|
118 |
properties.put(DECIMAL_DIGITS, new Integer(20)); |
119 |
} |
120 |
|
121 |
/**
|
122 |
* Gets a String property
|
123 |
* @param key
|
124 |
* Property name
|
125 |
* @return
|
126 |
*/
|
127 |
public static String getStringProperty(String key){ |
128 |
Object obj = getProperty(key);
|
129 |
if (obj == null){ |
130 |
return null; |
131 |
} |
132 |
return (String)obj; |
133 |
} |
134 |
|
135 |
/**
|
136 |
* Gets a int property
|
137 |
* @param key
|
138 |
* Property name
|
139 |
* @return
|
140 |
* The int property or -1
|
141 |
*/
|
142 |
public static int getIntPropertyProperty(String key){ |
143 |
Object obj = getProperty(key);
|
144 |
if (obj == null){ |
145 |
return -1; |
146 |
} |
147 |
if (obj instanceof Integer){ |
148 |
return ((Integer)obj).intValue(); |
149 |
}return -1; |
150 |
} |
151 |
|
152 |
/**
|
153 |
* Gets a property
|
154 |
* @param key
|
155 |
* Property name
|
156 |
* @return
|
157 |
*/
|
158 |
public static Object getProperty(String key){ |
159 |
return properties.get(key);
|
160 |
} |
161 |
|
162 |
/**
|
163 |
* Sets a property
|
164 |
* @param key
|
165 |
* @param value
|
166 |
*/
|
167 |
public static void setProperty(String key, Object value){ |
168 |
properties.put(key, value); |
169 |
} |
170 |
|
171 |
|
172 |
} |