svn-gvsig-desktop / branches / piloto3d / libraries / libFMap / src / com / iver / cit / gvsig / fmap / drivers / AbstractCadMemoryDriver.java @ 9588
History | View | Annotate | Download (4.92 KB)
1 |
/*
|
---|---|
2 |
* Created on 26-oct-2006
|
3 |
*
|
4 |
* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
5 |
*
|
6 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
7 |
*
|
8 |
* This program is free software; you can redistribute it and/or
|
9 |
* modify it under the terms of the GNU General Public License
|
10 |
* as published by the Free Software Foundation; either version 2
|
11 |
* of the License, or (at your option) any later version.
|
12 |
*
|
13 |
* This program is distributed in the hope that it will be useful,
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
* GNU General Public License for more details.
|
17 |
*
|
18 |
* You should have received a copy of the GNU General Public License
|
19 |
* along with this program; if not, write to the Free Software
|
20 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
21 |
*
|
22 |
* For more information, contact:
|
23 |
*
|
24 |
* Generalitat Valenciana
|
25 |
* Conselleria d'Infraestructures i Transport
|
26 |
* Av. Blasco Ib??ez, 50
|
27 |
* 46010 VALENCIA
|
28 |
* SPAIN
|
29 |
*
|
30 |
* +34 963862235
|
31 |
* gvsig@gva.es
|
32 |
* www.gvsig.gva.es
|
33 |
*
|
34 |
* or
|
35 |
*
|
36 |
* IVER T.I. S.A
|
37 |
* Salamanca 50
|
38 |
* 46005 Valencia
|
39 |
* Spain
|
40 |
*
|
41 |
* +34 963163400
|
42 |
* dac@iver.es
|
43 |
*/
|
44 |
/* CVS MESSAGES:
|
45 |
*
|
46 |
* $Id: AbstractCadMemoryDriver.java 9588 2007-01-08 13:43:09Z jcampos $
|
47 |
* $Log$
|
48 |
* Revision 1.1.4.3 2007-01-08 13:42:56 jcampos
|
49 |
* Syncronize with V10
|
50 |
*
|
51 |
* Revision 1.1.2.1 2006/11/15 04:11:12 jjdelcerro
|
52 |
* *** empty log message ***
|
53 |
*
|
54 |
* Revision 1.1 2006/10/26 17:05:30 azabala
|
55 |
* *** empty log message ***
|
56 |
*
|
57 |
*
|
58 |
*/
|
59 |
package com.iver.cit.gvsig.fmap.drivers; |
60 |
|
61 |
import java.sql.Types; |
62 |
|
63 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
64 |
|
65 |
/**
|
66 |
* Abstract base class for CAD drivers (dxf, dwg) memory drivers.
|
67 |
*
|
68 |
* Features readed with these drivers share the same schema
|
69 |
* (static FieldDescription[])
|
70 |
*
|
71 |
*
|
72 |
* */
|
73 |
public abstract class AbstractCadMemoryDriver extends MemoryDriver { |
74 |
|
75 |
protected final static int ID_FIELD_ID = 0; |
76 |
|
77 |
protected final static int ID_FIELD_FSHAPE = 1; |
78 |
|
79 |
protected final static int ID_FIELD_ENTITY = 2; |
80 |
|
81 |
protected final static int ID_FIELD_LAYER = 3; |
82 |
|
83 |
protected final static int ID_FIELD_COLOR = 4; |
84 |
|
85 |
protected final static int ID_FIELD_ELEVATION = 5; |
86 |
|
87 |
protected final static int ID_FIELD_THICKNESS = 6; |
88 |
|
89 |
protected final static int ID_FIELD_TEXT = 7; |
90 |
|
91 |
protected final static int ID_FIELD_HEIGHTTEXT = 8; |
92 |
|
93 |
protected final static int ID_FIELD_ROTATIONTEXT = 9; |
94 |
|
95 |
protected final static FieldDescription[] fields = new FieldDescription[10]; |
96 |
static{
|
97 |
FieldDescription fieldDesc = new FieldDescription();
|
98 |
fieldDesc.setFieldName("ID");
|
99 |
fieldDesc.setFieldType(Types.INTEGER);
|
100 |
fieldDesc.setFieldLength(20);
|
101 |
fieldDesc.setFieldDecimalCount(0);
|
102 |
fields[0] = fieldDesc;
|
103 |
|
104 |
fieldDesc = new FieldDescription();
|
105 |
fieldDesc.setFieldName("FShape");
|
106 |
fieldDesc.setFieldType(Types.VARCHAR);
|
107 |
fieldDesc.setFieldLength(254);
|
108 |
fieldDesc.setFieldDecimalCount(0);
|
109 |
fields[1] = fieldDesc;
|
110 |
|
111 |
fieldDesc = new FieldDescription();
|
112 |
fieldDesc.setFieldName("Entity");
|
113 |
fieldDesc.setFieldType(Types.VARCHAR);
|
114 |
fieldDesc.setFieldLength(254);
|
115 |
fieldDesc.setFieldDecimalCount(0);
|
116 |
fields[2] = fieldDesc;
|
117 |
|
118 |
fieldDesc = new FieldDescription();
|
119 |
fieldDesc.setFieldName("Layer");
|
120 |
fieldDesc.setFieldType(Types.VARCHAR);
|
121 |
fieldDesc.setFieldLength(254);
|
122 |
fieldDesc.setFieldDecimalCount(0);
|
123 |
fields[3] = fieldDesc;
|
124 |
|
125 |
fieldDesc = new FieldDescription();
|
126 |
fieldDesc.setFieldName("Color");
|
127 |
fieldDesc.setFieldType(Types.DOUBLE);
|
128 |
fieldDesc.setFieldLength(20);
|
129 |
fieldDesc.setFieldDecimalCount(5);
|
130 |
fields[4] = fieldDesc;
|
131 |
|
132 |
fieldDesc = new FieldDescription();
|
133 |
fieldDesc.setFieldName("Elevation");
|
134 |
fieldDesc.setFieldType(Types.DOUBLE);
|
135 |
fieldDesc.setFieldLength(20);
|
136 |
fieldDesc.setFieldDecimalCount(5);
|
137 |
fields[5] = fieldDesc;
|
138 |
|
139 |
fieldDesc = new FieldDescription();
|
140 |
fieldDesc.setFieldName("Thickness");
|
141 |
fieldDesc.setFieldType(Types.DOUBLE);
|
142 |
fieldDesc.setFieldLength(20);
|
143 |
fieldDesc.setFieldDecimalCount(5);
|
144 |
fields[6] = fieldDesc;
|
145 |
|
146 |
fieldDesc = new FieldDescription();
|
147 |
fieldDesc.setFieldName("Text");
|
148 |
fieldDesc.setFieldType(Types.VARCHAR);
|
149 |
fieldDesc.setFieldLength(254);
|
150 |
fieldDesc.setFieldDecimalCount(0);
|
151 |
fields[7] = fieldDesc;
|
152 |
|
153 |
fieldDesc = new FieldDescription();
|
154 |
fieldDesc.setFieldName("Height");
|
155 |
fieldDesc.setFieldType(Types.DOUBLE);
|
156 |
fieldDesc.setFieldLength(20);
|
157 |
fieldDesc.setFieldDecimalCount(5);
|
158 |
fields[8] = fieldDesc;
|
159 |
|
160 |
fieldDesc = new FieldDescription();
|
161 |
fieldDesc.setFieldName("Rotation");
|
162 |
fieldDesc.setFieldType(Types.DOUBLE);
|
163 |
fieldDesc.setFieldLength(20);
|
164 |
fieldDesc.setFieldDecimalCount(5);
|
165 |
fields[9] = fieldDesc;
|
166 |
|
167 |
} |
168 |
|
169 |
/**
|
170 |
* Returns de field type of the specified field index.
|
171 |
* @return field type of i field
|
172 |
*/
|
173 |
public int getFieldType(int i) throws DriverException { |
174 |
//azabala: we overwrite MemoryDriver because type resolution
|
175 |
//is based in first register value (it could be null)
|
176 |
if(i >= fields.length)
|
177 |
throw new DriverException("Excedido el numero de campos del dxf"); |
178 |
return fields[i].getFieldType();
|
179 |
} |
180 |
} |
181 |
|