Statistics
| Revision:

gvsig-vectorediting / org.gvsig.vectorediting / trunk / org.gvsig.vectorediting / org.gvsig.vectorediting.lib / org.gvsig.vectorediting.lib.spi / src / main / java / org / gvsig / vectorediting / lib / spi / DefaultDrawingStatus.java @ 2616

History | View | Annotate | Download (3.3 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2014 gvSIG Association
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
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24

    
25
package org.gvsig.vectorediting.lib.spi;
26

    
27
import java.util.ArrayList;
28
import java.util.List;
29
import org.gvsig.fmap.geom.Geometry;
30
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
31
import org.gvsig.vectorediting.lib.api.DrawingStatus;
32

    
33
public class DefaultDrawingStatus implements DrawingStatus {
34

    
35
    private final List<Geometry> geometries;
36
    private final List<Status> status;
37
    private String info;
38
    private ISymbol previewSymbol;
39

    
40
    private static class DefaultStatus implements Status{
41
        private final Geometry geometry;
42
        private final ISymbol symbol;
43
        private final String text;
44

    
45
        DefaultStatus(Geometry geometry, ISymbol symbol, String text){
46
            this.geometry = geometry;
47
            this.symbol = symbol;
48
            this.text = text;
49
        }
50

    
51
        @Override
52
        public Geometry getGeometry() {
53
            return geometry;
54
        }
55

    
56
        @Override
57
        public ISymbol getSymbol() {
58
            return symbol;
59
        }
60

    
61
        @Override
62
        public String getText() {
63
            return text;
64
        }
65

    
66
    }
67

    
68
    public DefaultDrawingStatus() {
69
        geometries = new ArrayList<>();
70
        status = new ArrayList<>();
71

    
72
        info = null;
73
    }
74

    
75
//    public DefaultDrawingStatus(List<Geometry> geometries, String info) {
76
//        this.geometries = new ArrayList<Geometry>();
77
//        this.geometries.addAll(geometries);
78
//        this.info = info;
79
//    }
80

    
81
//    public void setGeometries(List<Geometry> geometries) {
82
//        this.geometries.addAll(geometries);
83
//    }
84

    
85
    @Override
86
    public List<Geometry> getGeometries() {
87
        return this.geometries;
88
    }
89

    
90
    @Override
91
    public List<Status> getStatus() {
92
        return this.status;
93
    }
94

    
95
    public void setInfo(String info) {
96
        this.info = info;
97
    }
98

    
99
    @Override
100
    public String getInfo() {
101
        return this.info;
102
    }
103

    
104
    public void addGeometry(Geometry geometry) {
105
        geometries.add(geometry);
106
        status.add(new DefaultStatus(geometry,null,null));
107
    }
108

    
109
    public void addStatus(Geometry geometry, ISymbol symbol, String text) {
110
        geometries.add(geometry);
111
        status.add(new DefaultStatus(geometry,symbol,text));
112
    }
113

    
114
    public ISymbol getPreviewSymbol() {
115
        return previewSymbol;
116
    }
117

    
118
    public void setPreviewSymbol(ISymbol previewSymbol) {
119
        this.previewSymbol = previewSymbol;
120
    }
121
    
122
}