svn-gvsig-desktop / trunk / extensions / extSymbology / src / org / gvsig / symbology / ExtendedSymbologyExtension.java @ 22468
History | View | Annotate | Download (9.36 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
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 |
* Av. Blasco Ib??ez, 50
|
24 |
* 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 |
package org.gvsig.symbology; |
42 |
|
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 |
import org.gvsig.symbology.fmap.labeling.placements.MarkerCenteredAtPoint; |
51 |
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 |
import org.gvsig.symbology.fmap.rendering.filter.operations.OperatorsFactory; |
56 |
import org.gvsig.symbology.gui.layerproperties.BarChart3D; |
57 |
import org.gvsig.symbology.gui.layerproperties.DefaultLabeling; |
58 |
import org.gvsig.symbology.gui.layerproperties.DotDensity; |
59 |
import org.gvsig.symbology.gui.layerproperties.FeatureDependent; |
60 |
import org.gvsig.symbology.gui.layerproperties.GeneralLabeling; |
61 |
import org.gvsig.symbology.gui.layerproperties.GraduatedSymbols; |
62 |
import org.gvsig.symbology.gui.layerproperties.OnSelection; |
63 |
import org.gvsig.symbology.gui.layerproperties.PieChart3D; |
64 |
import org.gvsig.symbology.gui.layerproperties.ProportionalSymbols; |
65 |
import org.gvsig.symbology.gui.layerproperties.QuantityByCategory; |
66 |
import org.gvsig.symbology.gui.layerproperties.Statistics; |
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 |
|
93 |
public class ExtendedSymbologyExtension extends Extension { |
94 |
|
95 |
public void execute(String actionCommand) { |
96 |
|
97 |
} |
98 |
|
99 |
public void initialize() { |
100 |
|
101 |
PluginServices.getIconTheme().registerDefault( |
102 |
"high-density",
|
103 |
DotDensity.class.getClassLoader().getResource("images/high-density-sample.png")
|
104 |
); |
105 |
PluginServices.getIconTheme().registerDefault( |
106 |
"medium-density",
|
107 |
DotDensity.class.getClassLoader().getResource("images/medium-density-sample.png")
|
108 |
); |
109 |
PluginServices.getIconTheme().registerDefault( |
110 |
"low-density",
|
111 |
DotDensity.class.getClassLoader().getResource("images/low-density-sample.png")
|
112 |
); |
113 |
PluginServices.getIconTheme().registerDefault( |
114 |
"quantities-by-category",
|
115 |
QuantityByCategory.class.getClassLoader().getResource("images/QuantitiesByCategory.png")
|
116 |
); |
117 |
PluginServices.getIconTheme().registerDefault( |
118 |
"add-text-icon",
|
119 |
this.getClass().getClassLoader().getResource("images/add-text.png") |
120 |
); |
121 |
PluginServices.getIconTheme().registerDefault( |
122 |
"remove-text-icon",
|
123 |
this.getClass().getClassLoader().getResource("images/remove-text.png") |
124 |
); |
125 |
PluginServices.getIconTheme().registerDefault( |
126 |
"hand-icon",
|
127 |
this.getClass().getClassLoader().getResource("images/hand.gif") |
128 |
); |
129 |
|
130 |
PluginServices.getIconTheme().registerDefault( |
131 |
"set-high-precedence-point-label-icon",
|
132 |
this.getClass().getClassLoader().getResource("images/high-precedence.png") |
133 |
); |
134 |
PluginServices.getIconTheme().registerDefault( |
135 |
"set-normal-precedence-point-label-icon",
|
136 |
this.getClass().getClassLoader().getResource("images/normal-precedence.png") |
137 |
); |
138 |
PluginServices.getIconTheme().registerDefault( |
139 |
"set-low-precedence-point-label-icon",
|
140 |
this.getClass().getClassLoader().getResource("images/low-precedence.png") |
141 |
); |
142 |
PluginServices.getIconTheme().registerDefault( |
143 |
"set-forbidden-precedence-point-label-icon",
|
144 |
this.getClass().getClassLoader().getResource("images/forbidden-precedence.png") |
145 |
); |
146 |
|
147 |
// modules for symbol editor
|
148 |
SymbolEditor.addSymbolEditorPanel(MarkerFill.class, FShape.POLYGON); |
149 |
SymbolEditor.addSymbolEditorPanel(PictureFill.class, FShape.POLYGON); |
150 |
SymbolEditor.addSymbolEditorPanel(LineFill.class, FShape.POLYGON); |
151 |
SymbolEditor.addSymbolEditorPanel(GradientFill.class, FShape.POLYGON); |
152 |
SymbolEditor.addSymbolEditorPanel(CharacterMarker.class, FShape.POINT); |
153 |
SymbolEditor.addSymbolEditorPanel(PictureMarker.class, FShape.POINT); |
154 |
SymbolEditor.addSymbolEditorPanel(PictureLine.class, FShape.LINE); |
155 |
SymbolEditor.addSymbolEditorPanel(MarkerLine.class, FShape.LINE); |
156 |
|
157 |
// legends available in the legend page
|
158 |
LegendManager.addLegendPage(DotDensity.class); |
159 |
LegendManager.addLegendPage(GraduatedSymbols.class); |
160 |
LegendManager.addLegendPage(ProportionalSymbols.class); |
161 |
LegendManager.addLegendPage(QuantityByCategory.class); |
162 |
|
163 |
LegendManager.addLegendPage(Statistics.class); |
164 |
LegendManager.addLegendPage(BarChart3D.class); |
165 |
LegendManager.addLegendPage(PieChart3D.class); |
166 |
|
167 |
// Editor tools
|
168 |
StyleEditor.addEditorTool(LabelStylePanTool.class); |
169 |
StyleEditor.addEditorTool(LabelStyleNewTextFieldTool.class); |
170 |
StyleEditor.addEditorTool(LabelStyleRemoveLastTextField.class); |
171 |
StyleEditor.addEditorTool(LabelStyleOpenBackgroundFile.class); |
172 |
StyleEditor.addEditorTool(PointLabelHighPrecedenceTool.class); |
173 |
StyleEditor.addEditorTool(PointLabelNormalPrecedenceTool.class); |
174 |
StyleEditor.addEditorTool(PointLabelLowPrecedenceTool.class); |
175 |
StyleEditor.addEditorTool(PointLabelForbiddenPrecedenceTool.class); |
176 |
|
177 |
LabelingManager.addLabelingStrategy(GeneralLabeling.class); |
178 |
|
179 |
|
180 |
// labeling methods in the labeling page
|
181 |
// (inverse order to the wanted to be shown)
|
182 |
GeneralLabeling.addLabelingMethod(OnSelection.class); |
183 |
GeneralLabeling.addLabelingMethod(FeatureDependent.class); |
184 |
GeneralLabeling.addLabelingMethod(DefaultLabeling.class); |
185 |
|
186 |
PlacementManager.addLabelPlacement(LinePlacementAtExtremities.class); |
187 |
PlacementManager.addLabelPlacement(LinePlacementAtBest.class); |
188 |
PlacementManager.addLabelPlacement(LinePlacementInTheMiddle.class); |
189 |
PlacementManager.addLabelPlacement(MarkerPlacementOnPoint.class); |
190 |
PlacementManager.addLabelPlacement(MarkerCenteredAtPoint.class); |
191 |
PlacementManager.addLabelPlacement(MarkerPlacementAroundPoint.class); |
192 |
PlacementManager.addLabelPlacement(PolygonPlacementOnCentroid.class); |
193 |
PlacementManager.addLabelPlacement(PolygonPlacementParallel.class); |
194 |
|
195 |
LabelingFactory.setDefaultLabelingStrategy(GeneralLabelingStrategy.class); |
196 |
|
197 |
OperatorsFactory.getInstance().addOperator(SubstringFunction.class); |
198 |
OperatorsFactory.getInstance().addOperator(IndexOfFunction.class); |
199 |
} |
200 |
|
201 |
public boolean isEnabled() { |
202 |
return true; // or whatever |
203 |
} |
204 |
|
205 |
public boolean isVisible() { |
206 |
return true; // or whatever |
207 |
} |
208 |
|
209 |
|
210 |
|
211 |
} |
212 |
|
213 |
|