Statistics
| Revision:

svn-gvsig-desktop / branches / dal_time_support / libraries / libFMap_mapcontext / src / org / gvsig / fmap / mapcontext / rendering / symbols / impl / DefaultSymbolPreferences.java @ 35116

History | View | Annotate | Download (4.56 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (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
* 2009 {}  {{Task}}
26
*/
27
package org.gvsig.fmap.mapcontext.rendering.symbols.impl;
28

    
29
import java.awt.Color;
30
import java.awt.Font;
31
import java.io.File;
32

    
33
import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport;
34
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolPreferences;
35

    
36
/**
37
 * Default {@link SymbolPreferences} implementation based on object attributes.
38
 * 
39
 * @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team
40
 */
41
public class DefaultSymbolPreferences implements SymbolPreferences {
42

    
43
        private String symbolFileExtension = ".gvssym";
44

    
45
        private Color defaultSymbolColor;
46

    
47
        private Color defaultSymbolFillColor;
48

    
49
        private boolean defaultSymbolFillColorAleatory;
50

    
51
        private Font defaultSymbolFont;
52

    
53
        private String symbolLibraryPath;
54

    
55
        /**
56
         * The unit that will be used when creating new symbols with Cartographic
57
         * support.
58
         */
59
        private int defaultCartographicSupportMeasureUnit = -1;
60

    
61
        /**
62
         * The reference system that will be used when creating new symbols with
63
         * Cartographic support.
64
         */
65
        private int defaultCartographicSupportReferenceSystem =
66
                        CartographicSupport.WORLD;
67

    
68
        public DefaultSymbolPreferences() {
69
                resetDefaultSymbolColor();
70
                resetDefaultSymbolFillColor();
71
                resetDefaultSymbolFillColorAleatory();
72
                resetSymbolLibraryPath();
73
                resetDefaultSymbolFont();
74
        }
75

    
76
        public String getSymbolFileExtension() {
77
                return symbolFileExtension;
78
        }
79

    
80
        public void setSymbolFileExtension(String symbolFileExtension) {
81
                this.symbolFileExtension = symbolFileExtension;
82
        }
83
        public String getSymbolLibraryPath() {
84
                return symbolLibraryPath;
85
        }
86

    
87
        public void setSymbolLibraryPath(String symbolLibraryPath) {
88
                this.symbolLibraryPath = symbolLibraryPath;
89
        }
90

    
91
        public void resetSymbolLibraryPath() {
92
                symbolLibraryPath =
93
                                System.getProperty("user.home") + File.separator + "gvSIG"
94
                                                + File.separator + "Symbols";
95
        }
96

    
97
        public Color getDefaultSymbolColor() {
98
                return defaultSymbolColor;
99
        }
100

    
101
        public void setDefaultSymbolColor(Color defaultSymbolColor) {
102
                this.defaultSymbolColor = defaultSymbolColor;
103
        }
104

    
105
        public void resetDefaultSymbolColor() {
106
                defaultSymbolColor = Color.GRAY;
107
        }
108

    
109
        public Color getDefaultSymbolFillColor() {
110
                return defaultSymbolFillColor;
111
        }
112

    
113
        public void setDefaultSymbolFillColor(Color defaultSymbolFillColor) {
114
                this.defaultSymbolFillColor = defaultSymbolFillColor;
115
        }
116

    
117
        public void resetDefaultSymbolFillColor() {
118
                defaultSymbolFillColor = new Color(60, 235, 235);
119
        }
120

    
121
        public boolean isDefaultSymbolFillColorAleatory() {
122
                return defaultSymbolFillColorAleatory;
123
        }
124

    
125
        public void setDefaultSymbolFillColorAleatory(
126
                        boolean defaultSymbolFillColorAleatory) {
127
                this.defaultSymbolFillColorAleatory = defaultSymbolFillColorAleatory;
128
        }
129

    
130
        public void resetDefaultSymbolFillColorAleatory() {
131
                defaultSymbolFillColorAleatory = false;
132
        }
133

    
134
        public Font getDefaultSymbolFont() {
135
                return defaultSymbolFont;
136
        }
137

    
138
        public void setDefaultSymbolFont(Font defaultSymbolFont) {
139
                this.defaultSymbolFont = defaultSymbolFont;
140
        }
141

    
142
        public void resetDefaultSymbolFont() {
143
                defaultSymbolFont = new Font("Serif", Font.PLAIN, 8);
144
        }
145

    
146
        public int getDefaultCartographicSupportMeasureUnit() {
147
                return defaultCartographicSupportMeasureUnit;
148
        }
149

    
150
        public void setDefaultCartographicSupportMeasureUnit(
151
                        int defaultCartographicSupportMeasureUnit) {
152
                this.defaultCartographicSupportMeasureUnit =
153
                                defaultCartographicSupportMeasureUnit;
154
        }
155

    
156
        public int getDefaultCartographicSupportReferenceSystem() {
157
                return defaultCartographicSupportReferenceSystem;
158
        }
159

    
160
        public void setDefaultCartographicSupportReferenceSystem(
161
                        int defaultCartographicSupportReferenceSystem) {
162
                this.defaultCartographicSupportReferenceSystem =
163
                                defaultCartographicSupportReferenceSystem;
164
        }
165
}