svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.labeling.app / org.gvsig.labeling.app.mainplugin / src / main / java / org / gvsig / labeling / ExtendedLabelingExtension.java @ 44534
History | View | Annotate | Download (6.17 KB)
1 | 40911 | jldominguez | package org.gvsig.labeling; |
---|---|---|---|
2 | |||
3 | import org.gvsig.andami.plugins.Extension; |
||
4 | import org.gvsig.app.gui.styling.StyleEditor; |
||
5 | import org.gvsig.app.project.documents.view.legend.gui.LabelingManager; |
||
6 | import org.gvsig.fmap.IconThemeHelper; |
||
7 | import org.gvsig.labeling.gui.layerproperties.DefaultLabeling; |
||
8 | import org.gvsig.labeling.gui.layerproperties.FeatureDependent; |
||
9 | import org.gvsig.labeling.gui.layerproperties.GeneralLabeling; |
||
10 | 41670 | jjdelcerro | import org.gvsig.labeling.gui.layerproperties.LabelClassPropertiesFactory; |
11 | 40911 | jldominguez | import org.gvsig.labeling.gui.layerproperties.OnSelection; |
12 | import org.gvsig.labeling.gui.styling.editortools.LabelStyleNewTextFieldTool; |
||
13 | import org.gvsig.labeling.gui.styling.editortools.LabelStyleOpenBackgroundFile; |
||
14 | import org.gvsig.labeling.gui.styling.editortools.LabelStylePanTool; |
||
15 | import org.gvsig.labeling.gui.styling.editortools.LabelStyleRemoveLastTextField; |
||
16 | import org.gvsig.labeling.gui.styling.editortools.PointLabelForbiddenPrecedenceTool; |
||
17 | import org.gvsig.labeling.gui.styling.editortools.PointLabelHighPrecedenceTool; |
||
18 | import org.gvsig.labeling.gui.styling.editortools.PointLabelLowPrecedenceTool; |
||
19 | import org.gvsig.labeling.gui.styling.editortools.PointLabelNormalPrecedenceTool; |
||
20 | import org.gvsig.labeling.label.FeatureDependentLabeled; |
||
21 | 44534 | omartinez | import org.gvsig.labeling.label.GeneralLabelingFactory; |
22 | 40911 | jldominguez | import org.gvsig.labeling.label.GeneralLabelingStrategy; |
23 | import org.gvsig.labeling.label.OnSelectionLabeled; |
||
24 | 41131 | jldominguez | import org.gvsig.labeling.label.SmartTextSymbolLabelClass; |
25 | 40911 | jldominguez | import org.gvsig.labeling.placements.AbstractPlacementConstraints; |
26 | import org.gvsig.labeling.placements.LinePlacementAtBest; |
||
27 | import org.gvsig.labeling.placements.LinePlacementAtExtremities; |
||
28 | import org.gvsig.labeling.placements.LinePlacementConstraints; |
||
29 | import org.gvsig.labeling.placements.LinePlacementInTheMiddle; |
||
30 | import org.gvsig.labeling.placements.MarkerPlacementAroundPoint; |
||
31 | import org.gvsig.labeling.placements.MarkerPlacementOnPoint; |
||
32 | import org.gvsig.labeling.placements.MultiShapePlacementConstraints; |
||
33 | import org.gvsig.labeling.placements.PlacementManager; |
||
34 | import org.gvsig.labeling.placements.PointLabelPositioner; |
||
35 | import org.gvsig.labeling.placements.PointPlacementConstraints; |
||
36 | import org.gvsig.labeling.placements.PolygonPlacementConstraints; |
||
37 | import org.gvsig.labeling.placements.PolygonPlacementInside; |
||
38 | import org.gvsig.labeling.placements.PolygonPlacementOnCentroid; |
||
39 | import org.gvsig.labeling.placements.PolygonPlacementParallel; |
||
40 | import org.gvsig.labeling.symbol.CharacterMarkerSymbol; |
||
41 | import org.gvsig.labeling.symbol.SmartTextSymbol; |
||
42 | 44534 | omartinez | import org.gvsig.symbology.SymbologyLocator; |
43 | 40911 | jldominguez | import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.LabelingFactory; |
44 | 41670 | jjdelcerro | import org.gvsig.symbology.swing.SymbologySwingLocator; |
45 | import org.gvsig.symbology.swing.SymbologySwingManager; |
||
46 | 40911 | jldominguez | |
47 | |||
48 | public class ExtendedLabelingExtension extends Extension { |
||
49 | |||
50 | public void execute(String actionCommand) { |
||
51 | |||
52 | } |
||
53 | |||
54 | public void initialize() { |
||
55 | |||
56 | registerPersistence(); |
||
57 | registerIcons(); |
||
58 | |||
59 | // Editor tools
|
||
60 | StyleEditor.addEditorTool(LabelStylePanTool.class); |
||
61 | StyleEditor.addEditorTool(LabelStyleNewTextFieldTool.class); |
||
62 | StyleEditor.addEditorTool(LabelStyleRemoveLastTextField.class); |
||
63 | StyleEditor.addEditorTool(LabelStyleOpenBackgroundFile.class); |
||
64 | StyleEditor.addEditorTool(PointLabelHighPrecedenceTool.class); |
||
65 | StyleEditor.addEditorTool(PointLabelNormalPrecedenceTool.class); |
||
66 | StyleEditor.addEditorTool(PointLabelLowPrecedenceTool.class); |
||
67 | StyleEditor.addEditorTool(PointLabelForbiddenPrecedenceTool.class); |
||
68 | |||
69 | LabelingManager.addLabelingStrategy(GeneralLabeling.class); |
||
70 | |||
71 | // labeling methods in the labeling page
|
||
72 | // (inverse order to the wanted to be shown)
|
||
73 | GeneralLabeling.addLabelingMethod(OnSelection.class); |
||
74 | GeneralLabeling.addLabelingMethod(FeatureDependent.class); |
||
75 | GeneralLabeling.addLabelingMethod(DefaultLabeling.class); |
||
76 | |||
77 | PlacementManager.addLabelPlacement(LinePlacementAtExtremities.class); |
||
78 | PlacementManager.addLabelPlacement(LinePlacementAtBest.class); |
||
79 | PlacementManager.addLabelPlacement(LinePlacementInTheMiddle.class); |
||
80 | PlacementManager.addLabelPlacement(MarkerPlacementOnPoint.class); |
||
81 | // PlacementManager.addLabelPlacement(MarkerCenteredAtPoint.class);
|
||
82 | PlacementManager.addLabelPlacement(MarkerPlacementAroundPoint.class); |
||
83 | PlacementManager.addLabelPlacement(PolygonPlacementOnCentroid.class); |
||
84 | PlacementManager.addLabelPlacement(PolygonPlacementInside.class); |
||
85 | PlacementManager.addLabelPlacement(PolygonPlacementParallel.class); |
||
86 | |||
87 | 41670 | jjdelcerro | // LabelingFactory.setDefaultLabelingStrategy(GeneralLabelingStrategy.class);
|
88 | SymbologySwingManager manager = SymbologySwingLocator.getSwingManager(); |
||
89 | manager.registerLabelClassEditor(new LabelClassPropertiesFactory());
|
||
90 | 44534 | omartinez | |
91 | SymbologyLocator.getSymbologyManager().registerLabelingStrategy(new GeneralLabelingFactory());
|
||
92 | 40911 | jldominguez | } |
93 | |||
94 | private void registerIcons() { |
||
95 | |||
96 | IconThemeHelper.registerIcon("action", "edit-add-text", this); |
||
97 | IconThemeHelper.registerIcon("action", "edit-remove-text", this); |
||
98 | IconThemeHelper.registerIcon("action", "set-forbidden-precedence", this); |
||
99 | IconThemeHelper.registerIcon("action", "set-high-precedence", this); |
||
100 | IconThemeHelper.registerIcon("action", "set-low-precedence", this); |
||
101 | IconThemeHelper.registerIcon("action", "set-normal-precedence", this); |
||
102 | |||
103 | IconThemeHelper.registerIcon("action", "edit-shift-component", this); |
||
104 | IconThemeHelper.registerIcon("action", "edit-add-background-image", this); |
||
105 | } |
||
106 | |||
107 | private void registerPersistence() { |
||
108 | |||
109 | AbstractPlacementConstraints.registerPersistent(); |
||
110 | PointPlacementConstraints.registerPersistent(); |
||
111 | LinePlacementConstraints.registerPersistent(); |
||
112 | PolygonPlacementConstraints.registerPersistent(); |
||
113 | MultiShapePlacementConstraints.registerPersistent(); |
||
114 | |||
115 | CharacterMarkerSymbol.registerPersistent(); |
||
116 | SmartTextSymbol.registerPersistent(); |
||
117 | 41131 | jldominguez | SmartTextSymbolLabelClass.registerPersistent(); |
118 | 40911 | jldominguez | |
119 | PointLabelPositioner.registerPersistent(); |
||
120 | |||
121 | GeneralLabelingStrategy.registerPersistent(); |
||
122 | |||
123 | OnSelectionLabeled.registerPersistent(); |
||
124 | FeatureDependentLabeled.registerPersistent(); |
||
125 | } |
||
126 | |||
127 | public boolean isEnabled() { |
||
128 | return false; |
||
129 | } |
||
130 | |||
131 | public boolean isVisible() { |
||
132 | return false; |
||
133 | } |
||
134 | |||
135 | |||
136 | |||
137 | } |
||
138 |