Statistics
| Revision:

gvsig-sldtools / org.gvsig.sld / org.gvsig.sldsupport / org.gvsig.sldsupport.lib / org.gvsig.sldsupport.lib.api / src / main / java / org / gvsig / sldsupport / sld / graphic / SLDMark.java @ 46

History | View | Annotate | Download (3.95 KB)

1
/*******************************************************************************
2
 *
3
 *   gvSIG. Desktop Geographic Information System.
4
 *  
5
 *   Copyright (C) 2007-2013 gvSIG Association.
6
 *  
7
 *   This program is free software; you can redistribute it and/or
8
 *   modify it under the terms of the GNU General Public License
9
 *   as published by the Free Software Foundation; either version 3
10
 *   of the License, or (at your option) any later version.
11
 *  
12
 *   This program is distributed in the hope that it will be useful,
13
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *   GNU General Public License for more details.
16
 *  
17
 *   You should have received a copy of the GNU General Public License
18
 *   along with this program; if not, write to the Free Software
19
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
 *   MA  02110-1301, USA.
21
 *  
22
 *   For any additional information, do not hesitate to contact us
23
 *   at info AT gvsig.com, or visit our website www.gvsig.com.
24
 *   
25
 *******************************************************************************/
26
package org.gvsig.sldsupport.sld.graphic;
27

    
28
import org.gvsig.sldsupport.sld.SLDTags;
29
import org.gvsig.sldsupport.sld.symbol.misc.SLDFill;
30
import org.gvsig.sldsupport.sld.symbol.misc.SLDStroke;
31

    
32
public class SLDMark implements SLDGraphicStackElement {
33
        
34
        public static final int MARK_TYPE_SIMPLE = 0;
35
        public static final int MARK_TYPE_WELL_KNOWN_NAME = 1;
36
        public static final int MARK_TYPE_ONLINE_RESOURCE = 2;
37
        public static final int MARK_TYPE_INLINE_CONTENT = 3;
38
        
39
        /**
40
         * Used to manage four types as exclusive
41
         */
42
        protected int markType = MARK_TYPE_SIMPLE;
43
        
44
        /*
45
         * square, circle, triangle, star, cross, x
46
         */
47
        protected String wellKnownName = SLDTags.SQUARE;
48
        protected String onlineResource = null;
49
        protected byte[] inlineContent = null;
50
        
51
        protected SLDFill fill = null;
52
        protected SLDStroke stroke = null;
53
        
54
        /*
55
         * These two fields are used when type is
56
         * onlieResourec or inlineContent
57
         */
58
        protected String format = null;
59
        protected int markIndex = -1;
60
        // =========================================
61
        
62
        public SLDMark() {
63
                /*
64
                 * Defaults
65
                 */
66
                markType = MARK_TYPE_SIMPLE;
67
                fill = new SLDFill();
68
                stroke = new SLDStroke();
69
        }
70
        
71
        public SLDMark(int type) {
72
                markType = type;
73
                fill = new SLDFill();
74
                stroke = new SLDStroke();
75
        }
76
        
77
        
78
        public int getMarkType() {
79
                return this.markType;
80
        }
81
        
82
        public void setMarkType(int t) {
83
                this.markType = t;
84
        }
85
        
86
        public String getWellKnownName() {
87
                if (this.markType == MARK_TYPE_WELL_KNOWN_NAME) {
88
                        return wellKnownName;
89
                } else {
90
                        return null;
91
                }
92
        }
93
        
94
        public String getOnlineResource() {
95
                if (this.markType == MARK_TYPE_ONLINE_RESOURCE) {
96
                        return this.onlineResource;
97
                } else {
98
                        return null;
99
                }
100
        }
101
        
102
        public byte[] getInlineContent() {
103
                if (this.markType == MARK_TYPE_INLINE_CONTENT) {
104
                        return this.inlineContent;
105
                } else {
106
                        return null;
107
                }
108
        }
109
        
110
        public void setWellKnownName(String str) {
111
                this.wellKnownName = str;
112
        }
113
        
114
        public void setOnlineResource(String res) {
115
                this.onlineResource = res;
116
        }
117
        
118
        public void setInlineContent(byte[] bb) {
119
                this.inlineContent = bb;
120
        }
121
        
122
        // ====================================
123
        
124
        public SLDFill getFill() {
125
                return this.fill;
126
        }
127

    
128
        public void setFill(SLDFill f) {
129
                this.fill = f;
130
        }
131
        
132
        
133
        public SLDStroke getStroke() {
134
                return this.stroke;
135
        }
136
        
137
        public void setStroke(SLDStroke str) {
138
                this.stroke = str;
139
        }
140

    
141
        
142
        public String getFormat() {
143
                return this.format;
144
        }
145
        
146
        public void setFormat(String fmt) {
147
                this.format = fmt;
148
        }
149

    
150
        
151
        /**
152
         * Index of used element in online resource (example: TTY file)
153
         * or inline content
154
         * @return
155
         */
156
        public int getMarkIndex() {
157
                return this.markIndex;
158
        }
159
        
160
        public void setMarkIndex(int ind) {
161
                this.markIndex = ind;
162
        }
163
        
164
        
165
        
166

    
167
}