Revision 1721
org.gvsig.legend.heatmap/trunk/org.gvsig.legend.heatmap/org.gvsig.legend.heatmap.swing/org.gvsig.legend.heatmap.swing.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.legend.heatmap.swing.impl.HeatmapLegendSwingLibrary |
org.gvsig.legend.heatmap/trunk/org.gvsig.legend.heatmap/org.gvsig.legend.heatmap.swing/org.gvsig.legend.heatmap.swing.impl/src/main/java/org/gvsig/legend/heatmap/swing/impl/DefaultHeatmapLegendSwingManager.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2015 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.legend.heatmap.swing.impl; |
|
24 |
|
|
25 |
import org.gvsig.legend.heatmap.swing.api.HeatmapLegendEditor; |
|
26 |
import org.gvsig.legend.heatmap.swing.api.HeatmapLegendSwingManager; |
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
public class DefaultHeatmapLegendSwingManager implements HeatmapLegendSwingManager { |
|
31 |
|
|
32 |
@Override |
|
33 |
public HeatmapLegendEditor createHeatmapdLegendEditor() { |
|
34 |
return new DefaultHeatmapLegendEditor(); |
|
35 |
} |
|
36 |
|
|
37 |
|
|
38 |
} |
org.gvsig.legend.heatmap/trunk/org.gvsig.legend.heatmap/org.gvsig.legend.heatmap.swing/org.gvsig.legend.heatmap.swing.impl/src/main/java/org/gvsig/legend/heatmap/swing/impl/DefaultHeatmapLegendEditor.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.legend.heatmap.swing.impl; |
|
3 |
|
|
4 |
import javax.swing.ImageIcon; |
|
5 |
import javax.swing.JPanel; |
|
6 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
7 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
|
8 |
import org.gvsig.legend.heatmap.lib.api.HeatmapLegend; |
|
9 |
import org.gvsig.legend.heatmap.lib.api.HeatmapLegendLocator; |
|
10 |
import org.gvsig.legend.heatmap.swing.api.HeatmapLegendEditor; |
|
11 |
import org.gvsig.tools.ToolsLocator; |
|
12 |
import org.gvsig.tools.i18n.I18nManager; |
|
13 |
|
|
14 |
|
|
15 |
public class DefaultHeatmapLegendEditor extends DefaultHeatmapLegendEditorView implements HeatmapLegendEditor { |
|
16 |
|
|
17 |
private static final long serialVersionUID = 4307714097793669675L; |
|
18 |
|
|
19 |
private HeatmapLegend legend; |
|
20 |
private FLayer layer; |
|
21 |
private final Class<? extends HeatmapLegend> legendClass; |
|
22 |
|
|
23 |
public DefaultHeatmapLegendEditor() { |
|
24 |
this.legendClass = HeatmapLegendLocator.getHeatmapLegendManager().getLegendClass(); |
|
25 |
} |
|
26 |
|
|
27 |
@Override |
|
28 |
public void setData(FLayer layer, ILegend legend) { |
|
29 |
this.layer = layer; |
|
30 |
if( this.getLegendClass().isInstance(legend) ) { |
|
31 |
this.legend = (HeatmapLegend) legend; |
|
32 |
} else { |
|
33 |
this.legend = HeatmapLegendLocator.getHeatmapLegendManager().create(); |
|
34 |
} |
|
35 |
this.txtDistance.setText(String.valueOf(this.legend.getDistance())); |
|
36 |
} |
|
37 |
|
|
38 |
@Override |
|
39 |
public ILegend getLegend() { |
|
40 |
|
|
41 |
int d; |
|
42 |
try { |
|
43 |
d = Integer.parseUnsignedInt(this.txtDistance.getText()); |
|
44 |
} catch(Throwable th) { |
|
45 |
d = 20; |
|
46 |
} |
|
47 |
if( d<10 ) { |
|
48 |
d = 10; |
|
49 |
} |
|
50 |
legend.setDistance(d); |
|
51 |
return legend; |
|
52 |
} |
|
53 |
|
|
54 |
@Override |
|
55 |
public String getDescription() { |
|
56 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
57 |
return i18n.getTranslation( "_Heatmap_legend"); |
|
58 |
} |
|
59 |
|
|
60 |
@Override |
|
61 |
public ImageIcon getIcon() { |
|
62 |
// TODO: |
|
63 |
return null; |
|
64 |
} |
|
65 |
|
|
66 |
@Override |
|
67 |
public Class getParentClass() { |
|
68 |
return null; |
|
69 |
} |
|
70 |
|
|
71 |
@Override |
|
72 |
public String getTitle() { |
|
73 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
74 |
return i18n.getTranslation( "_Heatmap_legend"); |
|
75 |
} |
|
76 |
|
|
77 |
@Override |
|
78 |
public JPanel getPanel() { |
|
79 |
return this; |
|
80 |
} |
|
81 |
|
|
82 |
@Override |
|
83 |
public Class getLegendClass() { |
|
84 |
return this.legendClass; |
|
85 |
} |
|
86 |
|
|
87 |
@Override |
|
88 |
public boolean isSuitableFor(FLayer layer) { |
|
89 |
return true; |
|
90 |
} |
|
91 |
|
|
92 |
} |
org.gvsig.legend.heatmap/trunk/org.gvsig.legend.heatmap/org.gvsig.legend.heatmap.swing/org.gvsig.legend.heatmap.swing.impl/src/main/java/org/gvsig/legend/heatmap/swing/impl/HeatmapLegendSwingLibrary.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright ? 2007-2015 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 2 |
|
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 |
|
|
25 |
package org.gvsig.legend.heatmap.swing.impl; |
|
26 |
|
|
27 |
import org.gvsig.legend.heatmap.swing.api.HeatmapLegendSwingLocator; |
|
28 |
import org.gvsig.symbology.swing.SymbologySwingLibrary; |
|
29 |
import org.gvsig.symbology.swing.SymbologySwingLocator; |
|
30 |
import org.gvsig.symbology.swing.SymbologySwingManager; |
|
31 |
import org.gvsig.tools.library.AbstractLibrary; |
|
32 |
import org.gvsig.tools.library.LibraryException; |
|
33 |
|
|
34 |
|
|
35 |
public class HeatmapLegendSwingLibrary extends AbstractLibrary { |
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
@Override |
|
40 |
public void doRegistration() { |
|
41 |
registerAsImplementationOf(HeatmapLegendSwingLibrary.class); |
|
42 |
require(SymbologySwingLibrary.class); |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
protected void doInitialize() throws LibraryException { |
|
47 |
HeatmapLegendSwingLocator.registerHeatmapLegendSwingManager(DefaultHeatmapLegendSwingManager.class); |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
protected void doPostInitialize() throws LibraryException { |
|
52 |
SymbologySwingManager symmnager = SymbologySwingLocator.getSwingManager(); |
|
53 |
symmnager.registerLegendEditor(DefaultHeatmapLegendEditor.class); |
|
54 |
} |
|
55 |
|
|
56 |
} |
org.gvsig.legend.heatmap/trunk/org.gvsig.legend.heatmap/org.gvsig.legend.heatmap.swing/org.gvsig.legend.heatmap.swing.impl/src/main/java/org/gvsig/legend/heatmap/swing/impl/DefaultHeatmapLegendEditorView.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
|
|
3 |
<object classname="com.jeta.forms.store.memento.FormPackage"> |
|
4 |
<at name="fileversion"> |
|
5 |
<object classname="com.jeta.forms.store.memento.FormsVersion2"> |
|
6 |
<at name="major">2</at> |
|
7 |
<at name="minor">0</at> |
|
8 |
<at name="sub">0</at> |
|
9 |
</object> |
|
10 |
</at> |
|
11 |
<at name="form"> |
|
12 |
<object classname="com.jeta.forms.store.memento.FormMemento"> |
|
13 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
14 |
<at name="cellconstraints"> |
|
15 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
16 |
<at name="column">1</at> |
|
17 |
<at name="row">1</at> |
|
18 |
<at name="colspan">1</at> |
|
19 |
<at name="rowspan">1</at> |
|
20 |
<at name="halign">default</at> |
|
21 |
<at name="valign">default</at> |
|
22 |
<at name="insets" object="insets">0,0,0,0</at> |
|
23 |
</object> |
|
24 |
</at> |
|
25 |
<at name="componentclass">com.jeta.forms.gui.form.FormComponent</at> |
|
26 |
</super> |
|
27 |
<at name="id">/home/jjdelcerro/datos/devel/org.gvsig.legend.aggregate/org.gvsig.legend.aggregate.swing/org.gvsig.legend.aggregate.swing.impl/src/main/java/org/gvsig/legend/aggregate/swing/impl/DefaultAggregateLegendEditorView.xml</at> |
|
28 |
<at name="rowspecs">CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE</at> |
|
29 |
<at name="colspecs">FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE</at> |
|
30 |
<at name="components"> |
|
31 |
<object classname="java.util.LinkedList"> |
|
32 |
<item > |
|
33 |
<at name="value"> |
|
34 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
35 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
36 |
<at name="cellconstraints"> |
|
37 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
38 |
<at name="column">2</at> |
|
39 |
<at name="row">2</at> |
|
40 |
<at name="colspan">1</at> |
|
41 |
<at name="rowspan">1</at> |
|
42 |
<at name="halign">default</at> |
|
43 |
<at name="valign">default</at> |
|
44 |
<at name="insets" object="insets">0,0,0,0</at> |
|
45 |
</object> |
|
46 |
</at> |
|
47 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
48 |
</super> |
|
49 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
50 |
<at name="beanclass">com.jeta.forms.components.label.JETALabel</at> |
|
51 |
<at name="beanproperties"> |
|
52 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
53 |
<at name="classname">com.jeta.forms.components.label.JETALabel</at> |
|
54 |
<at name="properties"> |
|
55 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
56 |
<at name="border"> |
|
57 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
58 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
59 |
<at name="name">border</at> |
|
60 |
</super> |
|
61 |
<at name="borders"> |
|
62 |
<object classname="java.util.LinkedList"> |
|
63 |
<item > |
|
64 |
<at name="value"> |
|
65 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
66 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
67 |
<at name="name">border</at> |
|
68 |
</super> |
|
69 |
</object> |
|
70 |
</at> |
|
71 |
</item> |
|
72 |
</object> |
|
73 |
</at> |
|
74 |
</object> |
|
75 |
</at> |
|
76 |
<at name="name">lblDistance</at> |
|
77 |
<at name="width">49</at> |
|
78 |
<at name="text">Distance</at> |
|
79 |
<at name="fill"> |
|
80 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
81 |
<at name="name">fill</at> |
|
82 |
</object> |
|
83 |
</at> |
|
84 |
<at name="height">14</at> |
|
85 |
</object> |
|
86 |
</at> |
|
87 |
</object> |
|
88 |
</at> |
|
89 |
</object> |
|
90 |
</at> |
|
91 |
</item> |
|
92 |
<item > |
|
93 |
<at name="value"> |
|
94 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
95 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
96 |
<at name="cellconstraints"> |
|
97 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
98 |
<at name="column">4</at> |
|
99 |
<at name="row">2</at> |
|
100 |
<at name="colspan">1</at> |
|
101 |
<at name="rowspan">1</at> |
|
102 |
<at name="halign">default</at> |
|
103 |
<at name="valign">default</at> |
|
104 |
<at name="insets" object="insets">0,0,0,0</at> |
|
105 |
</object> |
|
106 |
</at> |
|
107 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
108 |
</super> |
|
109 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
110 |
<at name="beanclass">javax.swing.JTextField</at> |
|
111 |
<at name="beanproperties"> |
|
112 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
113 |
<at name="classname">javax.swing.JTextField</at> |
|
114 |
<at name="properties"> |
|
115 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
116 |
<at name="border"> |
|
117 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
118 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
119 |
<at name="name">border</at> |
|
120 |
</super> |
|
121 |
<at name="borders"> |
|
122 |
<object classname="java.util.LinkedList"> |
|
123 |
<item > |
|
124 |
<at name="value"> |
|
125 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
126 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
127 |
<at name="name">border</at> |
|
128 |
</super> |
|
129 |
</object> |
|
130 |
</at> |
|
131 |
</item> |
|
132 |
</object> |
|
133 |
</at> |
|
134 |
</object> |
|
135 |
</at> |
|
136 |
<at name="name">txtDistance</at> |
|
137 |
<at name="width">446</at> |
|
138 |
<at name="height">20</at> |
|
139 |
</object> |
|
140 |
</at> |
|
141 |
</object> |
|
142 |
</at> |
|
143 |
</object> |
|
144 |
</at> |
|
145 |
</item> |
|
146 |
</object> |
|
147 |
</at> |
|
148 |
<at name="properties"> |
|
149 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
150 |
<at name="classname">com.jeta.forms.gui.form.GridView</at> |
|
151 |
<at name="properties"> |
|
152 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
153 |
<at name="border"> |
|
154 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
155 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
156 |
<at name="name">border</at> |
|
157 |
</super> |
|
158 |
<at name="borders"> |
|
159 |
<object classname="java.util.LinkedList"/> |
|
160 |
</at> |
|
161 |
</object> |
|
162 |
</at> |
|
163 |
<at name="name"/> |
|
164 |
<at name="fill"> |
|
165 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
166 |
<at name="name">fill</at> |
|
167 |
</object> |
|
168 |
</at> |
|
169 |
<at name="scollBars"> |
|
170 |
<object classname="com.jeta.forms.store.properties.ScrollBarsProperty"> |
|
171 |
<at name="name">scollBars</at> |
|
172 |
<at name="verticalpolicy">21</at> |
|
173 |
<at name="horizontalpolicy">31</at> |
|
174 |
<at name="border"> |
|
175 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
176 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
177 |
<at name="name">border</at> |
|
178 |
</super> |
|
179 |
<at name="borders"> |
|
180 |
<object classname="java.util.LinkedList"> |
|
181 |
<item > |
|
182 |
<at name="value"> |
|
183 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
184 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
185 |
<at name="name">border</at> |
|
186 |
</super> |
|
187 |
</object> |
|
188 |
</at> |
|
189 |
</item> |
|
190 |
</object> |
|
191 |
</at> |
|
192 |
</object> |
|
193 |
</at> |
|
194 |
</object> |
|
195 |
</at> |
|
196 |
</object> |
|
197 |
</at> |
|
198 |
</object> |
|
199 |
</at> |
|
200 |
<at name="cellpainters"> |
|
201 |
<object classname="com.jeta.forms.store.support.Matrix"> |
|
202 |
<at name="rows"> |
|
203 |
<object classname="[Ljava.lang.Object;" size="3"> |
|
204 |
<at name="item" index="0"> |
|
205 |
<object classname="[Ljava.lang.Object;" size="5"/> |
|
206 |
</at> |
|
207 |
<at name="item" index="1"> |
|
208 |
<object classname="[Ljava.lang.Object;" size="5"/> |
|
209 |
</at> |
|
210 |
<at name="item" index="2"> |
|
211 |
<object classname="[Ljava.lang.Object;" size="5"/> |
|
212 |
</at> |
|
213 |
</object> |
|
214 |
</at> |
|
215 |
</object> |
|
216 |
</at> |
|
217 |
<at name="rowgroups"> |
|
218 |
<object classname="com.jeta.forms.store.memento.FormGroupSet"> |
|
219 |
<at name="groups"> |
|
220 |
<object classname="java.util.HashMap"/> |
|
221 |
</at> |
|
222 |
</object> |
|
223 |
</at> |
|
224 |
<at name="colgroups"> |
|
225 |
<object classname="com.jeta.forms.store.memento.FormGroupSet"> |
|
226 |
<at name="groups"> |
|
227 |
<object classname="java.util.HashMap"/> |
|
228 |
</at> |
|
229 |
</object> |
|
230 |
</at> |
|
231 |
</object> |
|
232 |
</at> |
|
233 |
</object> |
org.gvsig.legend.heatmap/trunk/org.gvsig.legend.heatmap/org.gvsig.legend.heatmap.swing/org.gvsig.legend.heatmap.swing.impl/src/main/java/org/gvsig/legend/heatmap/swing/impl/DefaultHeatmapLegendEditorView.java | ||
---|---|---|
1 |
package org.gvsig.legend.heatmap.swing.impl; |
|
2 |
|
|
3 |
import com.jeta.open.i18n.I18NUtils; |
|
4 |
import com.jgoodies.forms.layout.CellConstraints; |
|
5 |
import com.jgoodies.forms.layout.FormLayout; |
|
6 |
import java.awt.BorderLayout; |
|
7 |
import java.awt.ComponentOrientation; |
|
8 |
import java.awt.Container; |
|
9 |
import java.awt.Dimension; |
|
10 |
import javax.swing.Box; |
|
11 |
import javax.swing.ImageIcon; |
|
12 |
import javax.swing.JFrame; |
|
13 |
import javax.swing.JLabel; |
|
14 |
import javax.swing.JPanel; |
|
15 |
import javax.swing.JTextField; |
|
16 |
|
|
17 |
|
|
18 |
public class DefaultHeatmapLegendEditorView extends JPanel |
|
19 |
{ |
|
20 |
JLabel lblDistance = new JLabel(); |
|
21 |
JTextField txtDistance = new JTextField(); |
|
22 |
|
|
23 |
/** |
|
24 |
* Default constructor |
|
25 |
*/ |
|
26 |
public DefaultHeatmapLegendEditorView() |
|
27 |
{ |
|
28 |
initializePanel(); |
|
29 |
} |
|
30 |
|
|
31 |
/** |
|
32 |
* Adds fill components to empty cells in the first row and first column of the grid. |
|
33 |
* This ensures that the grid spacing will be the same as shown in the designer. |
|
34 |
* @param cols an array of column indices in the first row where fill components should be added. |
|
35 |
* @param rows an array of row indices in the first column where fill components should be added. |
|
36 |
*/ |
|
37 |
void addFillComponents( Container panel, int[] cols, int[] rows ) |
|
38 |
{ |
|
39 |
Dimension filler = new Dimension(10,10); |
|
40 |
|
|
41 |
boolean filled_cell_11 = false; |
|
42 |
CellConstraints cc = new CellConstraints(); |
|
43 |
if ( cols.length > 0 && rows.length > 0 ) |
|
44 |
{ |
|
45 |
if ( cols[0] == 1 && rows[0] == 1 ) |
|
46 |
{ |
|
47 |
/** add a rigid area */ |
|
48 |
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); |
|
49 |
filled_cell_11 = true; |
|
50 |
} |
|
51 |
} |
|
52 |
|
|
53 |
for( int index = 0; index < cols.length; index++ ) |
|
54 |
{ |
|
55 |
if ( cols[index] == 1 && filled_cell_11 ) |
|
56 |
{ |
|
57 |
continue; |
|
58 |
} |
|
59 |
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); |
|
60 |
} |
|
61 |
|
|
62 |
for( int index = 0; index < rows.length; index++ ) |
|
63 |
{ |
|
64 |
if ( rows[index] == 1 && filled_cell_11 ) |
|
65 |
{ |
|
66 |
continue; |
|
67 |
} |
|
68 |
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); |
|
69 |
} |
|
70 |
|
|
71 |
} |
|
72 |
|
|
73 |
/** |
|
74 |
* Helper method to load an image file from the CLASSPATH |
|
75 |
* @param imageName the package and name of the file to load relative to the CLASSPATH |
|
76 |
* @return an ImageIcon instance with the specified image file |
|
77 |
* @throws IllegalArgumentException if the image resource cannot be loaded. |
|
78 |
*/ |
|
79 |
public ImageIcon loadImage( String imageName ) |
|
80 |
{ |
|
81 |
try |
|
82 |
{ |
|
83 |
ClassLoader classloader = getClass().getClassLoader(); |
|
84 |
java.net.URL url = classloader.getResource( imageName ); |
|
85 |
if ( url != null ) |
|
86 |
{ |
|
87 |
ImageIcon icon = new ImageIcon( url ); |
|
88 |
return icon; |
|
89 |
} |
|
90 |
} |
|
91 |
catch( Exception e ) |
|
92 |
{ |
|
93 |
e.printStackTrace(); |
|
94 |
} |
|
95 |
throw new IllegalArgumentException( "Unable to load image: " + imageName ); |
|
96 |
} |
|
97 |
|
|
98 |
/** |
|
99 |
* Method for recalculating the component orientation for |
|
100 |
* right-to-left Locales. |
|
101 |
* @param orientation the component orientation to be applied |
|
102 |
*/ |
|
103 |
public void applyComponentOrientation( ComponentOrientation orientation ) |
|
104 |
{ |
|
105 |
// Not yet implemented... |
|
106 |
// I18NUtils.applyComponentOrientation(this, orientation); |
|
107 |
super.applyComponentOrientation(orientation); |
|
108 |
} |
|
109 |
|
|
110 |
public JPanel createPanel() |
|
111 |
{ |
|
112 |
JPanel jpanel1 = new JPanel(); |
|
113 |
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE"); |
|
114 |
CellConstraints cc = new CellConstraints(); |
|
115 |
jpanel1.setLayout(formlayout1); |
|
116 |
|
|
117 |
lblDistance.setName("lblDistance"); |
|
118 |
lblDistance.setText("Distance"); |
|
119 |
jpanel1.add(lblDistance,cc.xy(2,2)); |
|
120 |
|
|
121 |
txtDistance.setName("txtDistance"); |
|
122 |
jpanel1.add(txtDistance,cc.xy(4,2)); |
|
123 |
|
|
124 |
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3 }); |
|
125 |
return jpanel1; |
|
126 |
} |
|
127 |
|
|
128 |
/** |
|
129 |
* Initializer |
|
130 |
*/ |
|
131 |
protected void initializePanel() |
|
132 |
{ |
|
133 |
setLayout(new BorderLayout()); |
|
134 |
add(createPanel(), BorderLayout.CENTER); |
|
135 |
} |
|
136 |
|
|
137 |
|
|
138 |
} |
org.gvsig.legend.heatmap/trunk/org.gvsig.legend.heatmap/org.gvsig.legend.heatmap.swing/org.gvsig.legend.heatmap.swing.impl/pom.xml | ||
---|---|---|
1 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<parent> |
|
4 |
<groupId>org.gvsig</groupId> |
|
5 |
<artifactId>org.gvsig.legend.heatmap.swing</artifactId> |
|
6 |
<version>1.0.0-SNAPSHOT</version> |
|
7 |
</parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.legend.heatmap.swing.impl</artifactId> |
|
10 |
<dependencies> |
|
11 |
<dependency> |
|
12 |
<groupId>org.gvsig</groupId> |
|
13 |
<artifactId>org.gvsig.legend.heatmap.swing.api</artifactId> |
|
14 |
<scope>compile</scope> |
|
15 |
</dependency> |
|
16 |
<dependency> |
|
17 |
<groupId>org.gvsig</groupId> |
|
18 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
19 |
<scope>compile</scope> |
|
20 |
</dependency> |
|
21 |
<dependency> |
|
22 |
<groupId>org.gvsig</groupId> |
|
23 |
<artifactId>org.gvsig.legend.heatmap.lib.api</artifactId> |
|
24 |
<scope>compile</scope> |
|
25 |
</dependency> |
|
26 |
<dependency> |
|
27 |
<groupId>org.gvsig</groupId> |
|
28 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
29 |
<scope>compile</scope> |
|
30 |
</dependency> |
|
31 |
<dependency> |
|
32 |
<groupId>org.gvsig</groupId> |
|
33 |
<artifactId>org.gvsig.symbology.lib.api</artifactId> |
|
34 |
<scope>compile</scope> |
|
35 |
</dependency> |
|
36 |
|
|
37 |
</dependencies> |
|
38 |
</project> |
org.gvsig.legend.heatmap/trunk/org.gvsig.legend.heatmap/org.gvsig.legend.heatmap.swing/pom.xml | ||
---|---|---|
1 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<parent> |
|
4 |
<groupId>org.gvsig</groupId> |
|
5 |
<artifactId>org.gvsig.legend.heatmap</artifactId> |
|
6 |
<version>1.0.0-SNAPSHOT</version> |
|
7 |
</parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.legend.heatmap.swing</artifactId> |
|
10 |
<packaging>pom</packaging> |
|
11 |
<name>org.gvsig.legend.heatmap.swing</name> |
|
12 |
<modules> |
|
13 |
<module>org.gvsig.legend.heatmap.swing.api</module> |
|
14 |
<module>org.gvsig.legend.heatmap.swing.impl</module> |
|
15 |
</modules> |
|
16 |
</project> |
org.gvsig.legend.heatmap/trunk/org.gvsig.legend.heatmap/org.gvsig.legend.heatmap.swing/org.gvsig.legend.heatmap.swing.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.legend.heatmap.swing.api.HeatmapLegendSwingLibrary |
org.gvsig.legend.heatmap/trunk/org.gvsig.legend.heatmap/org.gvsig.legend.heatmap.swing/org.gvsig.legend.heatmap.swing.api/src/main/java/org/gvsig/legend/heatmap/swing/api/HeatmapLegendSwingLocator.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2015 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.legend.heatmap.swing.api; |
|
24 |
|
|
25 |
import org.gvsig.tools.locator.AbstractLocator; |
|
26 |
import org.gvsig.tools.locator.Locator; |
|
27 |
import org.gvsig.tools.locator.LocatorException; |
|
28 |
|
|
29 |
|
|
30 |
public class HeatmapLegendSwingLocator extends AbstractLocator { |
|
31 |
|
|
32 |
private static final String LOCATOR_NAME = "HeatmapLegendSwingLocator"; |
|
33 |
|
|
34 |
public static final String MANAGER_NAME = "HeatmapLegendSwingManager"; |
|
35 |
|
|
36 |
private static final String MANAGER_DESCRIPTION = |
|
37 |
"Swing Heatmap Manager of gvSIG"; |
|
38 |
|
|
39 |
|
|
40 |
/** |
|
41 |
* Unique instance |
|
42 |
*/ |
|
43 |
private static final HeatmapLegendSwingLocator instance = new HeatmapLegendSwingLocator(); |
|
44 |
|
|
45 |
|
|
46 |
@Override |
|
47 |
public String getLocatorName() { |
|
48 |
return LOCATOR_NAME; |
|
49 |
} |
|
50 |
|
|
51 |
|
|
52 |
/** |
|
53 |
* Registers the Class implementing the HeatmapSwingManager interface. |
|
54 |
* |
|
55 |
* @param clazz |
|
56 |
* implementing the HeatmapSwingManager interface |
|
57 |
*/ |
|
58 |
public static void registerHeatmapLegendSwingManager(Class clazz){ |
|
59 |
getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* Registers the default Class implementing the HeatmapSwingManager interface |
|
64 |
* |
|
65 |
* @param clazz |
|
66 |
* implementing the HeatmapSwingManager interface |
|
67 |
*/ |
|
68 |
public static void registerDefaultHeatmapLegendSwingManager(Class clazz){ |
|
69 |
getInstance().registerDefault(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
|
70 |
} |
|
71 |
|
|
72 |
/** |
|
73 |
* Return a reference to HeatmapLegendSwingManager. |
|
74 |
* |
|
75 |
* @return a reference to HeatmapLegendSwingManager |
|
76 |
* @throws LocatorException |
|
77 |
* if there is no access to the class or the class |
|
78 |
* cannot be instantiated |
|
79 |
* @see Locator#get(String) |
|
80 |
*/ |
|
81 |
public static HeatmapLegendSwingManager getHeatmapLegendSwingManager() throws LocatorException { |
|
82 |
return (HeatmapLegendSwingManager)(getInstance().get(MANAGER_NAME)); |
|
83 |
} |
|
84 |
|
|
85 |
/** |
|
86 |
* @return |
|
87 |
*/ |
|
88 |
public static Locator getInstance() { |
|
89 |
return instance; |
|
90 |
} |
|
91 |
|
|
92 |
} |
org.gvsig.legend.heatmap/trunk/org.gvsig.legend.heatmap/org.gvsig.legend.heatmap.swing/org.gvsig.legend.heatmap.swing.api/src/main/java/org/gvsig/legend/heatmap/swing/api/HeatmapLegendSwingLibrary.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2015 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.legend.heatmap.swing.api; |
|
24 |
|
|
25 |
import org.gvsig.legend.heatmap.lib.api.HeatmapLegendLibrary; |
|
26 |
import org.gvsig.tools.library.AbstractLibrary; |
|
27 |
import org.gvsig.tools.library.LibraryException; |
|
28 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
29 |
import org.slf4j.Logger; |
|
30 |
import org.slf4j.LoggerFactory; |
|
31 |
|
|
32 |
|
|
33 |
public class HeatmapLegendSwingLibrary extends AbstractLibrary { |
|
34 |
|
|
35 |
private static final Logger LOG = LoggerFactory.getLogger(HeatmapLegendSwingLibrary.class); |
|
36 |
|
|
37 |
@Override |
|
38 |
protected void doInitialize() throws LibraryException { |
|
39 |
registerAsAPI(HeatmapLegendSwingLibrary.class); |
|
40 |
require(HeatmapLegendLibrary.class); |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
protected void doPostInitialize() throws LibraryException { |
|
45 |
// Validate there is any implementation registered. |
|
46 |
HeatmapLegendSwingManager manager = HeatmapLegendSwingLocator.getHeatmapLegendSwingManager(); |
|
47 |
if (manager == null) { |
|
48 |
throw new ReferenceNotRegisteredException( |
|
49 |
HeatmapLegendSwingLocator.MANAGER_NAME, HeatmapLegendSwingLocator.getInstance()); |
|
50 |
} |
|
51 |
} |
|
52 |
|
|
53 |
|
|
54 |
} |
org.gvsig.legend.heatmap/trunk/org.gvsig.legend.heatmap/org.gvsig.legend.heatmap.swing/org.gvsig.legend.heatmap.swing.api/src/main/java/org/gvsig/legend/heatmap/swing/api/HeatmapLegendSwingManager.java | ||
---|---|---|
1 |
/* gvSIG. Desktop Geographic Information System. |
|
2 |
* |
|
3 |
* Copyright ? 2007-2015 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.legend.heatmap.swing.api; |
|
24 |
|
|
25 |
public interface HeatmapLegendSwingManager { |
|
26 |
|
|
27 |
public HeatmapLegendEditor createHeatmapdLegendEditor(); |
|
28 |
} |
org.gvsig.legend.heatmap/trunk/org.gvsig.legend.heatmap/org.gvsig.legend.heatmap.swing/org.gvsig.legend.heatmap.swing.api/src/main/java/org/gvsig/legend/heatmap/swing/api/HeatmapLegendEditor.java | ||
---|---|---|
1 |
|
|
2 |
package org.gvsig.legend.heatmap.swing.api; |
|
3 |
|
|
4 |
import org.gvsig.app.project.documents.view.legend.gui.ILegendPanel; |
|
5 |
|
|
6 |
|
|
7 |
public interface HeatmapLegendEditor extends ILegendPanel { |
|
8 |
|
|
9 |
} |
org.gvsig.legend.heatmap/trunk/org.gvsig.legend.heatmap/org.gvsig.legend.heatmap.swing/org.gvsig.legend.heatmap.swing.api/pom.xml | ||
---|---|---|
1 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<parent> |
|
4 |
<groupId>org.gvsig</groupId> |
|
5 |
<artifactId>org.gvsig.legend.heatmap.swing</artifactId> |
|
6 |
<version>1.0.0-SNAPSHOT</version> |
|
7 |
</parent> |
|
8 |
<groupId>org.gvsig</groupId> |
|
9 |
<artifactId>org.gvsig.legend.heatmap.swing.api</artifactId> |
|
10 |
<name>org.gvsig.legend.heatmap.swing.api</name> |
|
11 |
<dependencies> |
|
12 |
<dependency> |
|
13 |
<groupId>org.gvsig</groupId> |
|
14 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
15 |
<scope>compile</scope> |
|
16 |
</dependency> |
|
17 |
<dependency> |
|
18 |
<groupId>org.gvsig</groupId> |
|
19 |
<artifactId>org.gvsig.legend.heatmap.lib.api</artifactId> |
|
20 |
<scope>compile</scope> |
|
21 |
</dependency> |
|
22 |
<dependency> |
|
23 |
<groupId>org.gvsig</groupId> |
|
24 |
<artifactId>org.gvsig.symbology.swing.api</artifactId> |
|
25 |
<version>2.0.197-SNAPSHOT</version> |
|
26 |
<type>jar</type> |
|
27 |
</dependency> |
|
28 |
</dependencies> |
|
29 |
</project> |
Also available in: Unified diff