Statistics
| Revision:

root / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / layers / VectorialAdapter.java @ 1100

History | View | Annotate | Download (4.17 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.fmap.layers;
42

    
43
import com.hardcode.driverManager.DriverLoadException;
44

    
45
import com.hardcode.gdbms.engine.data.DataSource;
46

    
47
import com.iver.cit.gvsig.fmap.DriverException;
48
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
49
import com.iver.cit.gvsig.fmap.drivers.VectorialDriver;
50
import com.iver.cit.gvsig.fmap.operations.strategies.ShapeInfo;
51
import com.iver.cit.gvsig.fmap.rendering.indexes.Indexable;
52

    
53
import java.awt.geom.Rectangle2D;
54

    
55

    
56
/**
57
 * Clase padre de los adaptadores de los drivers. De momento mantiene solo el
58
 * ?ndice creado sobre la capa
59
 */
60
public abstract class VectorialAdapter implements ReadableVectorial, Indexable {
61
        private VectorialDriver driver;
62
        private ShapeInfo shapeInfo;
63

    
64
        /**
65
         * Establece el driver sobre el que act?a el adaptador
66
         *
67
         * @param driver
68
         */
69
        public void setDriver(VectorialDriver driver) {
70
                this.driver = driver;
71
        }
72

    
73
        /**
74
         * Obtiene una referencia al objeto que implementa la interfaz vectorial
75
         * con el fin de que las Strategy puedan optimizar en funci?n del driver.
76
         *
77
         * @return VectorialDriver
78
         */
79
        public VectorialDriver getDriver() {
80
                return driver;
81
        }
82

    
83
        /**
84
         * Crea un ?ndice para la capa. Se comprueba si el driver implementa
85
         * Indexable. Si lo es, se delega la creaci?n en el driver, si no se crea
86
         * un ?ndice interno con IndexFactory
87
         *
88
         * @param boundingBox Rect?ngulo.
89
         *
90
         * @throws DriverIOException
91
         */
92
        public void createIndex(Rectangle2D boundingBox) throws DriverIOException {
93
        }
94

    
95
        /**
96
         * Mira si la capa tiene un ?ndice, bien propio del tipo de capa, bien
97
         * interno de gvSIG
98
         *
99
         * @return True si la capa contiene ?ndice.
100
         */
101
        public boolean hasIndex() {
102
                //TODO Implementar bien
103
                return false;
104
        }
105

    
106
        /**
107
         * Si el driver es indexable devuelve el valor de la invocaci?n a
108
         * getIndexFile del driver, si no, devuelve la ruta del fichero de ?ndices
109
         * interno de gvSIG
110
         *
111
         * @return String.
112
         */
113
        public String getIndexFile() {
114
                //TODO implementar bien
115
                return null;
116
        }
117

    
118
        /**
119
         * @see com.iver.cit.gvsig.fmap.rendering.indexes.Index#openIndexFile(java.lang.String)
120
         */
121
        public void openIndexFile(String file) {
122
        }
123

    
124
        /**
125
         * @see com.iver.cit.gvsig.fmap.rendering.indexes.Index#closeIndexFile()
126
         */
127
        public void closeIndexFile() {
128
        }
129

    
130
        /**
131
         * Devuelve el DataSource a pasrtir del nombre.
132
         *
133
         * @param name Nombre.
134
         *
135
         * @return DataSource.
136
         *
137
         * @throws DriverLoadException
138
         */
139
        public abstract DataSource getRecordset(String name)
140
                throws DriverLoadException;
141

    
142
        /**
143
         * Devuelve el ShapeInfo.
144
         *
145
         * @return Returns the shapeInfo.
146
         */
147
        public ShapeInfo getShapeInfo() {
148
                return shapeInfo;
149
        }
150

    
151
        /**
152
         * Inserta el ShapeInfo.
153
         *
154
         * @param shapeInfo The shapeInfo to set.
155
         */
156
        public void setShapeInfo(ShapeInfo shapeInfo) {
157
                this.shapeInfo = shapeInfo;
158
        }
159

    
160
        /**
161
         * M?todo abstracto que se ejecutar? cuando se cambie el nombre del
162
         * DataSource.
163
         *
164
         * @param newName Nuevo nombre.
165
         *
166
         * @throws DriverException
167
         */
168
        public abstract void changeRecordsetName(String newName)
169
                throws DriverException;
170
}