svn-gvsig-desktop / trunk / extensions / extSymbology / src / org / gvsig / symbology / ExtendedSymbologyExtension.java @ 29007
History | View | Annotate | Download (10.3 KB)
1 | 22489 | jdominguez | /* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
|
---|---|---|---|
2 | 22458 | jvidal | *
|
3 | * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
|
||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
||
18 | *
|
||
19 | * For more information, contact:
|
||
20 | *
|
||
21 | * Generalitat Valenciana
|
||
22 | * Conselleria d'Infraestructures i Transport
|
||
23 | 22489 | jdominguez | * Av. Blasco Ib��ez, 50
|
24 | 22458 | jvidal | * 46010 VALENCIA
|
25 | * SPAIN
|
||
26 | *
|
||
27 | * +34 963862235
|
||
28 | * gvsig@gva.es
|
||
29 | * www.gvsig.gva.es
|
||
30 | *
|
||
31 | * or
|
||
32 | *
|
||
33 | * IVER T.I. S.A
|
||
34 | * Salamanca 50
|
||
35 | * 46005 Valencia
|
||
36 | * Spain
|
||
37 | *
|
||
38 | * +34 963163400
|
||
39 | * dac@iver.es
|
||
40 | */
|
||
41 | 22468 | vcaballero | package org.gvsig.symbology; |
42 | 22458 | jvidal | |
43 | import org.gvsig.symbology.fmap.labeling.GeneralLabelingStrategy; |
||
44 | import org.gvsig.symbology.fmap.labeling.PlacementManager; |
||
45 | import org.gvsig.symbology.fmap.labeling.lang.functions.IndexOfFunction; |
||
46 | import org.gvsig.symbology.fmap.labeling.lang.functions.SubstringFunction; |
||
47 | import org.gvsig.symbology.fmap.labeling.placements.LinePlacementAtBest; |
||
48 | import org.gvsig.symbology.fmap.labeling.placements.LinePlacementAtExtremities; |
||
49 | import org.gvsig.symbology.fmap.labeling.placements.LinePlacementInTheMiddle; |
||
50 | 26063 | vcaballero | //import org.gvsig.symbology.fmap.labeling.placements.MarkerCenteredAtPoint;
|
51 | 22458 | jvidal | import org.gvsig.symbology.fmap.labeling.placements.MarkerPlacementAroundPoint; |
52 | import org.gvsig.symbology.fmap.labeling.placements.MarkerPlacementOnPoint; |
||
53 | import org.gvsig.symbology.fmap.labeling.placements.PolygonPlacementOnCentroid; |
||
54 | import org.gvsig.symbology.fmap.labeling.placements.PolygonPlacementParallel; |
||
55 | 26387 | vcaballero | import org.gvsig.symbology.fmap.labeling.placements.PolygonPlacementInside; |
56 | 22458 | jvidal | import org.gvsig.symbology.fmap.rendering.filter.operations.OperatorsFactory; |
57 | 23407 | vcaballero | import org.gvsig.symbology.gui.layerproperties.BarChart3D; |
58 | 22458 | jvidal | import org.gvsig.symbology.gui.layerproperties.DefaultLabeling; |
59 | import org.gvsig.symbology.gui.layerproperties.DotDensity; |
||
60 | import org.gvsig.symbology.gui.layerproperties.FeatureDependent; |
||
61 | import org.gvsig.symbology.gui.layerproperties.GeneralLabeling; |
||
62 | import org.gvsig.symbology.gui.layerproperties.GraduatedSymbols; |
||
63 | import org.gvsig.symbology.gui.layerproperties.OnSelection; |
||
64 | 23407 | vcaballero | import org.gvsig.symbology.gui.layerproperties.PieChart3D; |
65 | 22458 | jvidal | import org.gvsig.symbology.gui.layerproperties.ProportionalSymbols; |
66 | import org.gvsig.symbology.gui.layerproperties.QuantityByCategory; |
||
67 | import org.gvsig.symbology.gui.styling.CharacterMarker; |
||
68 | import org.gvsig.symbology.gui.styling.GradientFill; |
||
69 | import org.gvsig.symbology.gui.styling.LineFill; |
||
70 | import org.gvsig.symbology.gui.styling.MarkerFill; |
||
71 | import org.gvsig.symbology.gui.styling.MarkerLine; |
||
72 | import org.gvsig.symbology.gui.styling.PictureFill; |
||
73 | import org.gvsig.symbology.gui.styling.PictureLine; |
||
74 | import org.gvsig.symbology.gui.styling.PictureMarker; |
||
75 | import org.gvsig.symbology.gui.styling.editortools.LabelStyleNewTextFieldTool; |
||
76 | import org.gvsig.symbology.gui.styling.editortools.LabelStyleOpenBackgroundFile; |
||
77 | import org.gvsig.symbology.gui.styling.editortools.LabelStylePanTool; |
||
78 | import org.gvsig.symbology.gui.styling.editortools.LabelStyleRemoveLastTextField; |
||
79 | import org.gvsig.symbology.gui.styling.editortools.PointLabelForbiddenPrecedenceTool; |
||
80 | import org.gvsig.symbology.gui.styling.editortools.PointLabelHighPrecedenceTool; |
||
81 | import org.gvsig.symbology.gui.styling.editortools.PointLabelLowPrecedenceTool; |
||
82 | import org.gvsig.symbology.gui.styling.editortools.PointLabelNormalPrecedenceTool; |
||
83 | |||
84 | import com.iver.andami.PluginServices; |
||
85 | import com.iver.andami.plugins.Extension; |
||
86 | import com.iver.cit.gvsig.fmap.core.FShape; |
||
87 | import com.iver.cit.gvsig.fmap.rendering.styling.labeling.LabelingFactory; |
||
88 | import com.iver.cit.gvsig.gui.styling.StyleEditor; |
||
89 | import com.iver.cit.gvsig.gui.styling.SymbolEditor; |
||
90 | import com.iver.cit.gvsig.project.documents.view.legend.gui.LabelingManager; |
||
91 | import com.iver.cit.gvsig.project.documents.view.legend.gui.LegendManager; |
||
92 | 23407 | vcaballero | import com.iver.cit.gvsig.project.documents.view.legend.gui.Statistics; |
93 | 22458 | jvidal | |
94 | 22832 | vcaballero | |
95 | 22458 | jvidal | public class ExtendedSymbologyExtension extends Extension { |
96 | |||
97 | public void execute(String actionCommand) { |
||
98 | 22832 | vcaballero | |
99 | 22458 | jvidal | } |
100 | |||
101 | public void initialize() { |
||
102 | 22832 | vcaballero | |
103 | 22458 | jvidal | PluginServices.getIconTheme().registerDefault( |
104 | "high-density",
|
||
105 | DotDensity.class.getClassLoader().getResource("images/high-density-sample.png")
|
||
106 | ); |
||
107 | PluginServices.getIconTheme().registerDefault( |
||
108 | "medium-density",
|
||
109 | DotDensity.class.getClassLoader().getResource("images/medium-density-sample.png")
|
||
110 | ); |
||
111 | PluginServices.getIconTheme().registerDefault( |
||
112 | "low-density",
|
||
113 | DotDensity.class.getClassLoader().getResource("images/low-density-sample.png")
|
||
114 | ); |
||
115 | PluginServices.getIconTheme().registerDefault( |
||
116 | "quantities-by-category",
|
||
117 | QuantityByCategory.class.getClassLoader().getResource("images/QuantitiesByCategory.png")
|
||
118 | ); |
||
119 | PluginServices.getIconTheme().registerDefault( |
||
120 | 24817 | vcaballero | "dot-density",
|
121 | QuantityByCategory.class.getClassLoader().getResource("images/DotDensity.PNG")
|
||
122 | ); |
||
123 | |||
124 | PluginServices.getIconTheme().registerDefault( |
||
125 | "graduated-symbols",
|
||
126 | QuantityByCategory.class.getClassLoader().getResource("images/GraduatedSymbols.PNG")
|
||
127 | ); |
||
128 | |||
129 | PluginServices.getIconTheme().registerDefault( |
||
130 | "proportional-symbols",
|
||
131 | QuantityByCategory.class.getClassLoader().getResource("images/ProportionalSymbols.PNG")
|
||
132 | ); |
||
133 | 24825 | vcaballero | |
134 | 24817 | vcaballero | PluginServices.getIconTheme().registerDefault( |
135 | 24825 | vcaballero | "filter-expressions",
|
136 | QuantityByCategory.class.getClassLoader().getResource("images/FilterExpressions.PNG")
|
||
137 | ); |
||
138 | PluginServices.getIconTheme().registerDefault( |
||
139 | 22458 | jvidal | "add-text-icon",
|
140 | this.getClass().getClassLoader().getResource("images/add-text.png") |
||
141 | 22832 | vcaballero | ); |
142 | 22458 | jvidal | PluginServices.getIconTheme().registerDefault( |
143 | "remove-text-icon",
|
||
144 | this.getClass().getClassLoader().getResource("images/remove-text.png") |
||
145 | ); |
||
146 | PluginServices.getIconTheme().registerDefault( |
||
147 | "hand-icon",
|
||
148 | this.getClass().getClassLoader().getResource("images/hand.gif") |
||
149 | ); |
||
150 | 22832 | vcaballero | |
151 | 22458 | jvidal | PluginServices.getIconTheme().registerDefault( |
152 | "set-high-precedence-point-label-icon",
|
||
153 | this.getClass().getClassLoader().getResource("images/high-precedence.png") |
||
154 | ); |
||
155 | PluginServices.getIconTheme().registerDefault( |
||
156 | "set-normal-precedence-point-label-icon",
|
||
157 | this.getClass().getClassLoader().getResource("images/normal-precedence.png") |
||
158 | ); |
||
159 | PluginServices.getIconTheme().registerDefault( |
||
160 | "set-low-precedence-point-label-icon",
|
||
161 | this.getClass().getClassLoader().getResource("images/low-precedence.png") |
||
162 | ); |
||
163 | PluginServices.getIconTheme().registerDefault( |
||
164 | "set-forbidden-precedence-point-label-icon",
|
||
165 | this.getClass().getClassLoader().getResource("images/forbidden-precedence.png") |
||
166 | ); |
||
167 | 22832 | vcaballero | |
168 | 23407 | vcaballero | |
169 | 22458 | jvidal | // modules for symbol editor
|
170 | SymbolEditor.addSymbolEditorPanel(MarkerFill.class, FShape.POLYGON); |
||
171 | SymbolEditor.addSymbolEditorPanel(PictureFill.class, FShape.POLYGON); |
||
172 | SymbolEditor.addSymbolEditorPanel(LineFill.class, FShape.POLYGON); |
||
173 | SymbolEditor.addSymbolEditorPanel(GradientFill.class, FShape.POLYGON); |
||
174 | SymbolEditor.addSymbolEditorPanel(CharacterMarker.class, FShape.POINT); |
||
175 | SymbolEditor.addSymbolEditorPanel(PictureMarker.class, FShape.POINT); |
||
176 | SymbolEditor.addSymbolEditorPanel(PictureLine.class, FShape.LINE); |
||
177 | SymbolEditor.addSymbolEditorPanel(MarkerLine.class, FShape.LINE); |
||
178 | |||
179 | 23556 | vcaballero | |
180 | 22458 | jvidal | // legends available in the legend page
|
181 | LegendManager.addLegendPage(DotDensity.class); |
||
182 | LegendManager.addLegendPage(GraduatedSymbols.class); |
||
183 | LegendManager.addLegendPage(ProportionalSymbols.class); |
||
184 | LegendManager.addLegendPage(QuantityByCategory.class); |
||
185 | 22832 | vcaballero | |
186 | 23556 | vcaballero | // LegendManager.addLegendPage(Statistics.class);
|
187 | 22489 | jdominguez | // LegendManager.addLegendPage(BarChart3D.class);
|
188 | // LegendManager.addLegendPage(PieChart3D.class);
|
||
189 | 22832 | vcaballero | |
190 | 22458 | jvidal | // Editor tools
|
191 | StyleEditor.addEditorTool(LabelStylePanTool.class); |
||
192 | StyleEditor.addEditorTool(LabelStyleNewTextFieldTool.class); |
||
193 | StyleEditor.addEditorTool(LabelStyleRemoveLastTextField.class); |
||
194 | StyleEditor.addEditorTool(LabelStyleOpenBackgroundFile.class); |
||
195 | StyleEditor.addEditorTool(PointLabelHighPrecedenceTool.class); |
||
196 | StyleEditor.addEditorTool(PointLabelNormalPrecedenceTool.class); |
||
197 | StyleEditor.addEditorTool(PointLabelLowPrecedenceTool.class); |
||
198 | StyleEditor.addEditorTool(PointLabelForbiddenPrecedenceTool.class); |
||
199 | 22832 | vcaballero | |
200 | 22458 | jvidal | LabelingManager.addLabelingStrategy(GeneralLabeling.class); |
201 | |||
202 | // labeling methods in the labeling page
|
||
203 | // (inverse order to the wanted to be shown)
|
||
204 | GeneralLabeling.addLabelingMethod(OnSelection.class); |
||
205 | GeneralLabeling.addLabelingMethod(FeatureDependent.class); |
||
206 | GeneralLabeling.addLabelingMethod(DefaultLabeling.class); |
||
207 | |||
208 | PlacementManager.addLabelPlacement(LinePlacementAtExtremities.class); |
||
209 | PlacementManager.addLabelPlacement(LinePlacementAtBest.class); |
||
210 | PlacementManager.addLabelPlacement(LinePlacementInTheMiddle.class); |
||
211 | PlacementManager.addLabelPlacement(MarkerPlacementOnPoint.class); |
||
212 | 26063 | vcaballero | // PlacementManager.addLabelPlacement(MarkerCenteredAtPoint.class);
|
213 | 22458 | jvidal | PlacementManager.addLabelPlacement(MarkerPlacementAroundPoint.class); |
214 | PlacementManager.addLabelPlacement(PolygonPlacementOnCentroid.class); |
||
215 | 26387 | vcaballero | PlacementManager.addLabelPlacement(PolygonPlacementInside.class); |
216 | 22458 | jvidal | PlacementManager.addLabelPlacement(PolygonPlacementParallel.class); |
217 | 22832 | vcaballero | |
218 | 22458 | jvidal | LabelingFactory.setDefaultLabelingStrategy(GeneralLabelingStrategy.class); |
219 | 22832 | vcaballero | |
220 | 22458 | jvidal | OperatorsFactory.getInstance().addOperator(SubstringFunction.class); |
221 | OperatorsFactory.getInstance().addOperator(IndexOfFunction.class); |
||
222 | } |
||
223 | |||
224 | public boolean isEnabled() { |
||
225 | return true; // or whatever |
||
226 | } |
||
227 | |||
228 | public boolean isVisible() { |
||
229 | return true; // or whatever |
||
230 | } |
||
231 | |||
232 | |||
233 | |||
234 | } |
||
235 |