Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libFMap_dal / src / org / gvsig / fmap / dal / DataQuery.java @ 24496

History | View | Annotate | Download (3.46 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Gobernment (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22

    
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2008 {DiSiD Technologies}  {Create Parameter object to define queries}
26
 */
27
package org.gvsig.fmap.dal;
28

    
29
import java.util.HashMap;
30
import java.util.Map;
31

    
32
import org.gvsig.tools.persistence.AbstractPersistenceManager;
33
import org.gvsig.tools.persistence.PersistenceException;
34
import org.gvsig.tools.persistence.Persistent;
35
import org.gvsig.tools.persistence.PersistentState;
36

    
37
/**
38
 * Defines the properties of a collection of data, as a result of a query
39
 * through a DataStore.
40
 * <p>
41
 * The scala parameter can be used by the DataStore as a hint about the quality
42
 * or resolution of the data needed to view or operate with the data returned.
43
 * As an example, it may use the scala to return only a representative subset of
44
 * the data, or maybe to return Data with less detail, like a point or a line
45
 * instead of a polygon.
46
 * </p>
47
 *
48
 * @author <a href="mailto:cordin@disid.com">C?sar Ordi?ana</a>
49
 */
50
public class DataQuery implements Persistent {
51

    
52
    private double scale;
53

    
54
    private Map attributes = new HashMap();
55

    
56
    /**
57
     * Empty constructor.
58
     */
59
    public DataQuery() {
60
        super();
61
    }
62

    
63
    /**
64
     * Constructor with an scale.
65
     *
66
     * @param scale
67
     *            the scale for the data
68
     */
69
    public DataQuery(double scale) {
70
        super();
71
        this.scale = scale;
72
    }
73

    
74
    /**
75
     * Returns the scale.
76
     *
77
     * @return the scale
78
     */
79
    public double getScale() {
80
        return scale;
81
    }
82

    
83
    /**
84
     * Sets the scale.
85
     *
86
     * @param scale
87
     *            the scale to set
88
     */
89
    public void setScale(double scale) {
90
        this.scale = scale;
91
    }
92

    
93
    /**
94
     * Returns the value of an attribute.
95
     *
96
     * @param name
97
     *            of the attribute
98
     * @return the attribute value
99
     */
100
    public Object getAttribute(String name) {
101
        return attributes.get(name);
102
    }
103

    
104
    /**
105
     * Sets the value of an attribute.
106
     *
107
     * @param name
108
     *            of the attribute
109
     * @param value
110
     *            for the attribute
111
     */
112
    public void setAttribute(String name, Object value) {
113
        attributes.put(name, value);
114
    }
115

    
116
        public PersistentState getState() throws PersistenceException {
117
                return AbstractPersistenceManager.getState(this);
118
        }
119

    
120
        public void loadState(PersistentState state) throws PersistenceException {
121
                // FIXME: falta por terminar de implementar
122
                state.set("scale", scale);
123
        }
124

    
125
        public void setState(PersistentState state) throws PersistenceException {
126
                // FIXME: falta por terminar de implementar
127
                this.scale = state.getDouble("scale");
128
        }
129

    
130
}