svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.symbology / org.gvsig.symbology.swing / org.gvsig.symbology.swing.api / src / main / java / org / gvsig / app / gui / styling / AbstractTypeSymbolEditor.java @ 43510
History | View | Annotate | Download (5.2 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 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 3
|
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 |
/* CVS MESSAGES:
|
25 |
*
|
26 |
* $Id: AbstractTypeSymbolEditor.java 29596 2009-06-29 16:02:00Z jpiera $
|
27 |
* $Log$
|
28 |
* Revision 1.3 2007-08-08 11:45:38 jaume
|
29 |
* some bugs fixed
|
30 |
*
|
31 |
* Revision 1.1 2007/08/03 11:29:13 jaume
|
32 |
* refactored AbstractTypeSymbolEditorPanel class name to AbastractTypeSymbolEditor
|
33 |
*
|
34 |
* Revision 1.12 2007/08/03 09:20:47 jaume
|
35 |
* refactored class names
|
36 |
*
|
37 |
* Revision 1.11 2007/08/03 09:07:01 jaume
|
38 |
* javadoc
|
39 |
*
|
40 |
* Revision 1.10 2007/08/03 07:34:15 jaume
|
41 |
* javadoc
|
42 |
*
|
43 |
* Revision 1.9 2007/07/30 12:56:04 jaume
|
44 |
* organize imports, java 5 code downgraded to 1.4 and added PictureFillSymbol
|
45 |
*
|
46 |
* Revision 1.8 2007/07/18 06:56:03 jaume
|
47 |
* continuing with cartographic support
|
48 |
*
|
49 |
* Revision 1.7 2007/07/12 10:43:55 jaume
|
50 |
* *** empty log message ***
|
51 |
*
|
52 |
* Revision 1.6 2007/06/29 13:07:33 jaume
|
53 |
* +PictureLineSymbol
|
54 |
*
|
55 |
* Revision 1.5 2007/05/08 15:44:07 jaume
|
56 |
* *** empty log message ***
|
57 |
*
|
58 |
* Revision 1.4 2007/04/20 07:54:38 jaume
|
59 |
* *** empty log message ***
|
60 |
*
|
61 |
* Revision 1.3 2007/04/05 16:08:34 jaume
|
62 |
* Styled labeling stuff
|
63 |
*
|
64 |
* Revision 1.2 2007/03/09 11:25:00 jaume
|
65 |
* Advanced symbology (start committing)
|
66 |
*
|
67 |
* Revision 1.1.2.3 2007/02/21 07:35:14 jaume
|
68 |
* *** empty log message ***
|
69 |
*
|
70 |
* Revision 1.1.2.2 2007/02/08 15:42:13 jaume
|
71 |
* *** empty log message ***
|
72 |
*
|
73 |
* Revision 1.1.2.1 2007/01/26 13:49:03 jaume
|
74 |
* *** empty log message ***
|
75 |
*
|
76 |
* Revision 1.1 2007/01/16 11:52:11 jaume
|
77 |
* *** empty log message ***
|
78 |
*
|
79 |
* Revision 1.6 2006/11/13 09:15:23 jaume
|
80 |
* javadoc and some clean-up
|
81 |
*
|
82 |
* Revision 1.5 2006/11/06 16:06:52 jaume
|
83 |
* *** empty log message ***
|
84 |
*
|
85 |
* Revision 1.4 2006/10/31 16:16:34 jaume
|
86 |
* *** empty log message ***
|
87 |
*
|
88 |
* Revision 1.3 2006/10/30 19:30:35 jaume
|
89 |
* *** empty log message ***
|
90 |
*
|
91 |
* Revision 1.2 2006/10/29 23:53:49 jaume
|
92 |
* *** empty log message ***
|
93 |
*
|
94 |
* Revision 1.1 2006/10/27 12:41:09 jaume
|
95 |
* GUI
|
96 |
*
|
97 |
*
|
98 |
*/
|
99 |
package org.gvsig.app.gui.styling; |
100 |
|
101 |
import javax.swing.JPanel; |
102 |
|
103 |
import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport; |
104 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
105 |
|
106 |
/**
|
107 |
* <p>
|
108 |
* Abstract class that all the Symbol settings GUI's must extend. <b>This
|
109 |
* is not Component by it self, but a bag of JPanels with the required
|
110 |
* interface to be operable from the SymbolEditor</b>. The panels provide
|
111 |
* by this are the tabs of the JTabbedPane of the options area in the
|
112 |
* SymbolEditor.
|
113 |
* </p>
|
114 |
* <p>
|
115 |
* The components contained by this panelset are automatically placed in
|
116 |
* the <b>SymbolEditor</b>'s symbol options area. In case other panel
|
117 |
* of this was already placed, then the old one is replaced by this.
|
118 |
* </p>
|
119 |
* <p>
|
120 |
* In order to the <b>SymbolEditor</b> owner of this to decide which
|
121 |
* <b>AbstractTypeSymbolEditorPanel</b> will be placed each symbol editor
|
122 |
* panel must define the type of the symbol it is able to configure.
|
123 |
* To do this, <b>AbstractTypeSymbolEditorPanel</b> includes the abstract
|
124 |
* method <b>getSymbolClass()</b> which will return the <b>Class</b> of
|
125 |
* the corresponding symbol. The symbol class must define an implementation
|
126 |
* of ISymbol in general, and one of IMarkerSymbol, ILineSymbol or
|
127 |
* IFillSymbol in particular, depending of the context of the symbology
|
128 |
* being edited.
|
129 |
* </p>
|
130 |
* @author jaume dominguez faus - jaume.dominguez@iver.es
|
131 |
*/
|
132 |
public abstract class AbstractTypeSymbolEditor implements TypeSymbolEditor { |
133 |
protected SymbolEditor owner;
|
134 |
private boolean applying = false; |
135 |
|
136 |
|
137 |
/**
|
138 |
* Creates a new instance of this type symbol editor panel associated to
|
139 |
* its SymbolEditor parent which will be notified of the changes in
|
140 |
* order to keep the symbol preview in sync with the user settings.
|
141 |
* @param owner, the SymbolEditor which created this.
|
142 |
*/
|
143 |
public AbstractTypeSymbolEditor(SymbolEditor owner) {
|
144 |
this.owner = owner;
|
145 |
} |
146 |
|
147 |
|
148 |
/**
|
149 |
* This overrided method returns the text shown at the SymbolEditorPanel
|
150 |
* select combobox.
|
151 |
*/
|
152 |
public final String toString() { |
153 |
return getName();
|
154 |
} |
155 |
|
156 |
protected final void fireSymbolChangedEvent() { |
157 |
if (!applying) { // avoid unnecessary events |
158 |
applying = true;
|
159 |
ISymbol sym = getLayer(); |
160 |
|
161 |
if (sym instanceof CartographicSupport) { |
162 |
CartographicSupport cs = (CartographicSupport) sym; |
163 |
cs.setReferenceSystem(owner.getUnitsReferenceSystem()); |
164 |
cs.setUnit(owner.getUnit()); |
165 |
} |
166 |
|
167 |
owner.setLayerToSymbol(sym); |
168 |
owner.refresh(); |
169 |
applying = false;
|
170 |
} |
171 |
} |
172 |
|
173 |
|
174 |
|
175 |
} |
176 |
|