Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.mapcontext / org.gvsig.fmap.mapcontext.api / src / main / java / org / gvsig / fmap / mapcontext / rendering / symbols / impl / DefaultSymbolPreferences.java @ 40489

History | View | Annotate | Download (4.64 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
            
93
                symbolLibraryPath =
94
                                System.getProperty("user.home") + File.separator + "gvSIG"
95
                                + File.separator + "plugins" + File.separator +
96
                                "org.gvsig.app.mainplugin" + File.separator + "Symbols";
97
        }
98

    
99
        public Color getDefaultSymbolColor() {
100
                return defaultSymbolColor;
101
        }
102

    
103
        public void setDefaultSymbolColor(Color defaultSymbolColor) {
104
                this.defaultSymbolColor = defaultSymbolColor;
105
        }
106

    
107
        public void resetDefaultSymbolColor() {
108
                defaultSymbolColor = Color.GRAY;
109
        }
110

    
111
        public Color getDefaultSymbolFillColor() {
112
                return defaultSymbolFillColor;
113
        }
114

    
115
        public void setDefaultSymbolFillColor(Color defaultSymbolFillColor) {
116
                this.defaultSymbolFillColor = defaultSymbolFillColor;
117
        }
118

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

    
123
        public boolean isDefaultSymbolFillColorAleatory() {
124
                return defaultSymbolFillColorAleatory;
125
        }
126

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

    
132
        public void resetDefaultSymbolFillColorAleatory() {
133
                defaultSymbolFillColorAleatory = false;
134
        }
135

    
136
        public Font getDefaultSymbolFont() {
137
                return defaultSymbolFont;
138
        }
139

    
140
        public void setDefaultSymbolFont(Font defaultSymbolFont) {
141
                this.defaultSymbolFont = defaultSymbolFont;
142
        }
143

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

    
148
        public int getDefaultCartographicSupportMeasureUnit() {
149
                return defaultCartographicSupportMeasureUnit;
150
        }
151

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

    
158
        public int getDefaultCartographicSupportReferenceSystem() {
159
                return defaultCartographicSupportReferenceSystem;
160
        }
161

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