root / org.gvsig.legend.vectorfilterexpression.app.mainplugin / trunk / org.gvsig.legend.vectorfilterexpression.app.mainplugin / src / main / java / org / gvsig / symbology / library / VectorFilterExpressionLibrary.java @ 459
History | View | Annotate | Download (4.15 KB)
1 |
/* gvSIG. Desktop Geographic Information System.
|
---|---|
2 |
*
|
3 |
* Copyright ? 2007-2013 gvSIG Association
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18 |
* MA 02110-1301, USA.
|
19 |
*
|
20 |
* For any additional information, do not hesitate to contact us
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
22 |
*/
|
23 |
package org.gvsig.symbology.library; |
24 |
|
25 |
import org.gvsig.andami.IconThemeHelper; |
26 |
import org.gvsig.app.project.documents.view.legend.gui.SymbolTable; |
27 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
28 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
29 |
import org.gvsig.fmap.mapcontext.rendering.legend.ISingleSymbolLegend; |
30 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager; |
31 |
import org.gvsig.symbology.SymbologyLibrary; |
32 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.driver.impl.PersistenceBasedLegendReader; |
33 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.driver.impl.PersistenceBasedLegendWriter; |
34 |
import org.gvsig.symbology.fmap.rendering.VectorFilterExpressionLegend; |
35 |
import org.gvsig.symbology.gui.layerproperties.ExpressionFieldCellEditor; |
36 |
import org.gvsig.symbology.gui.layerproperties.VectorFilterExpressionPanel; |
37 |
import org.gvsig.symbology.swing.SymbologySwingLocator; |
38 |
import org.gvsig.tools.library.AbstractLibrary; |
39 |
import org.gvsig.tools.library.LibraryException; |
40 |
import org.gvsig.tools.persistence.xml.XMLPersistenceLibrary; |
41 |
import org.gvsig.tools.util.Caller; |
42 |
import org.gvsig.tools.util.impl.DefaultCaller; |
43 |
|
44 |
|
45 |
/**
|
46 |
* Simple library to register vector filter expression legend
|
47 |
*
|
48 |
* @author jldominguez
|
49 |
*
|
50 |
*/
|
51 |
public class VectorFilterExpressionLibrary extends AbstractLibrary { |
52 |
|
53 |
|
54 |
public void doRegistration() { |
55 |
registerAsImplementationOf(VectorFilterExpressionLibrary.class); |
56 |
/*
|
57 |
* This checks map context library registration
|
58 |
*/
|
59 |
require(SymbologyLibrary.class); |
60 |
/*
|
61 |
* This is because we need to use persistence manager
|
62 |
*/
|
63 |
require(XMLPersistenceLibrary.class); |
64 |
} |
65 |
|
66 |
protected void doInitialize() throws LibraryException { |
67 |
|
68 |
} |
69 |
|
70 |
|
71 |
protected void doPostInitialize() throws LibraryException { |
72 |
|
73 |
IconThemeHelper.registerIcon("legend",
|
74 |
"legend-overview-vector-filter-expression", this); |
75 |
IconThemeHelper.registerIcon("legend",
|
76 |
"legend-overview-vectorial-unique-value", this); |
77 |
IconThemeHelper.registerIcon("symbol",
|
78 |
"symbol-layer-move-down", this); |
79 |
IconThemeHelper.registerIcon("symbol",
|
80 |
"symbol-layer-move-up", this); |
81 |
|
82 |
Caller caller = new DefaultCaller();
|
83 |
|
84 |
caller.add(new VectorFilterExpressionLegend.RegisterLegend());
|
85 |
caller.add(new VectorFilterExpressionLegend.RegisterPersistence());
|
86 |
|
87 |
/*
|
88 |
* Do register of all
|
89 |
*/
|
90 |
if( !caller.call() ) {
|
91 |
throw new LibraryException( |
92 |
VectorFilterExpressionLibrary.class, |
93 |
caller.getExceptions()); |
94 |
} |
95 |
|
96 |
MapContextManager mcoman = MapContextLocator.getMapContextManager(); |
97 |
mcoman.registerLegendWriter( |
98 |
VectorFilterExpressionLegend.class, |
99 |
SymbolManager.LEGEND_FILE_EXTENSION.substring(1),
|
100 |
PersistenceBasedLegendWriter.class); |
101 |
|
102 |
SymbologySwingLocator.getSwingManager().registerLegendEditor(VectorFilterExpressionPanel.class); |
103 |
|
104 |
|
105 |
|
106 |
SymbolTable.addNewCellEditor("expressions",
|
107 |
new ExpressionFieldCellEditor());
|
108 |
|
109 |
} |
110 |
|
111 |
|
112 |
|
113 |
} |