Revision 75
org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.lib/org.gvsig.lrs.lib.api/src/main/java/org/gvsig/lrs/lib/api/MeasuresCalculator.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
public void addControlPoints(List<Point> fixedPoints); |
12 | 12 |
|
13 |
public void calculate(); |
|
13 | 14 |
public void calculate(LrsMeasureCalculationMethods calculationMethod, boolean before, boolean between, boolean after); |
14 | 15 |
|
15 | 16 |
public Geometry getResult(); |
... | ... | |
17 | 18 |
public void setMeasuresToDistances(); |
18 | 19 |
|
19 | 20 |
public void setFirstMeasure(double mvalue); |
20 |
|
|
21 | 21 |
public void setLastMeasure(double mvalue); |
22 |
|
|
22 |
|
|
23 | 23 |
} |
24 | 24 |
org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.lib/org.gvsig.lrs.lib.impl/src/main/java/org/gvsig/lrs/lib/impl/LrsCalibrateRouteAlgorithm.java | ||
---|---|---|
52 | 52 |
import org.gvsig.lrs.lib.api.LrsCalibrateRouteAlgorithmParams; |
53 | 53 |
import org.gvsig.lrs.lib.api.LrsCreateRouteAlgorithmParams; |
54 | 54 |
import org.gvsig.lrs.lib.api.LrsMeasureCalculationMethods; |
55 |
import org.gvsig.lrs.lib.api.MeasuresCalculator; |
|
55 | 56 |
import org.gvsig.lrs.lib.api.exceptions.LrsCalibrateRouteException; |
56 | 57 |
import org.gvsig.lrs.lib.api.exceptions.LrsException; |
57 | 58 |
import org.gvsig.tools.ToolsLocator; |
... | ... | |
283 | 284 |
if (points.isEmpty()){ |
284 | 285 |
return geometry; |
285 | 286 |
} |
286 |
DefaultMeasuresCalculator expandedRoute=new DefaultMeasuresCalculator(geometry, ignoreSpatialGaps);
|
|
287 |
MeasuresCalculator expandedRoute=new DefaultMeasuresCalculator(geometry, ignoreSpatialGaps); |
|
287 | 288 |
|
288 | 289 |
|
289 | 290 |
expandedRoute.addControlPoints(points); |
org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.lib/org.gvsig.lrs.lib.impl/src/main/java/org/gvsig/lrs/lib/impl/DefaultMeasuresCalculator.java | ||
---|---|---|
214 | 214 |
int mDimension = mPoint.getDimension() - 1; |
215 | 215 |
mPoint.setCoordinateAt(mDimension, mvalue); |
216 | 216 |
List<Point> points = new ArrayList<>(); |
217 |
points.add(mPoint); |
|
217 | 218 |
this.addControlPoints(points); |
218 | 219 |
} |
219 | 220 |
|
... | ... | |
223 | 224 |
int mDimension = mPoint.getDimension() - 1; |
224 | 225 |
mPoint.setCoordinateAt(mDimension, mvalue); |
225 | 226 |
List<Point> points = new ArrayList<>(); |
227 |
points.add(mPoint); |
|
226 | 228 |
this.addControlPoints(points); |
227 | 229 |
} |
228 | 230 |
|
... | ... | |
238 | 240 |
} |
239 | 241 |
} |
240 | 242 |
|
241 |
public void calculate() { |
|
243 |
@Override |
|
244 |
public void calculate() { |
|
242 | 245 |
this.calculate( |
243 | 246 |
LrsMeasureCalculationMethods.DISTANCE, |
244 | 247 |
false, |
245 | 248 |
org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/resources/JLrsCalculateMLastUsedValues.xml | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<!-- |
|
3 |
Definitions of plugin persistence org.gvsig.exportto.app.extension. |
|
4 |
--> |
|
5 |
<definitions> |
|
6 |
<version>1.0.0</version> |
|
7 |
<classes> |
|
8 |
<class name="JLrsCalculateMLastUsedValues"> |
|
9 |
<description>Persistence of the LRS plugin</description> |
|
10 |
<fields> |
|
11 |
<field name="pkInicial" type="string" mandatory="false"> |
|
12 |
<description>Initial pk selected by the user</description> |
|
13 |
</field> |
|
14 |
<field name="pkFinal" type="string" mandatory="false"> |
|
15 |
<description>Final pk selected by the user</description> |
|
16 |
</field> |
|
17 |
</fields> |
|
18 |
</class> |
|
19 |
</classes> |
|
20 |
</definitions> |
|
0 | 21 |
org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/JLrsLastUsedValues.java | ||
---|---|---|
1 |
package org.gvsig.lrs.swing.api; |
|
2 |
|
|
3 |
import org.gvsig.tools.dynobject.DynObject; |
|
4 |
|
|
5 |
public interface JLrsLastUsedValues{ |
|
6 |
|
|
7 |
public String getPkInicial(); |
|
8 |
|
|
9 |
public String getPkFinal(); |
|
10 |
|
|
11 |
public void setPkInicial(String ini); |
|
12 |
|
|
13 |
public void setPkFinal(String fin); |
|
14 |
|
|
15 |
public void setParams(DynObject pluginProperties); |
|
16 |
|
|
17 |
public DynObject getParams(); |
|
18 |
|
|
19 |
} |
|
0 | 20 |
org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/LrsAlgorithmsSwingLibrary.java | ||
---|---|---|
22 | 22 |
*/ |
23 | 23 |
package org.gvsig.lrs.swing.api; |
24 | 24 |
|
25 |
import java.io.InputStream; |
|
26 |
|
|
27 |
import org.gvsig.tools.ToolsLocator; |
|
28 |
import org.gvsig.tools.dynobject.DynStruct; |
|
25 | 29 |
import org.gvsig.tools.library.AbstractLibrary; |
26 | 30 |
import org.gvsig.tools.library.LibraryException; |
27 | 31 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
32 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
33 |
import org.slf4j.Logger; |
|
34 |
import org.slf4j.LoggerFactory; |
|
28 | 35 |
|
29 | 36 |
|
30 | 37 |
/** |
... | ... | |
33 | 40 |
*/ |
34 | 41 |
public class LrsAlgorithmsSwingLibrary extends AbstractLibrary { |
35 | 42 |
|
36 |
/* (non-Javadoc) |
|
37 |
* @see org.gvsig.tools.library.AbstractLibrary#doInitialize() |
|
38 |
*/ |
|
39 |
@Override |
|
40 |
protected void doInitialize() throws LibraryException { |
|
41 |
registerAsAPI(LrsAlgorithmsSwingLibrary.class); |
|
43 |
private static final Logger LOG = LoggerFactory.getLogger(LrsAlgorithmsSwingLibrary.class); |
|
44 |
private static final String DYNCLASS_NAME = "JLrsLastUsedValues"; |
|
45 |
|
|
46 |
/* (non-Javadoc) |
|
47 |
* @see org.gvsig.tools.library.AbstractLibrary#doInitialize() |
|
48 |
*/ |
|
49 |
@Override |
|
50 |
protected void doInitialize() throws LibraryException { |
|
51 |
registerAsAPI(LrsAlgorithmsSwingLibrary.class); |
|
52 |
|
|
53 |
registerLrsCalculateMLastUsedValuesDefinition(); |
|
54 |
|
|
55 |
|
|
56 |
// DynObjectManager dynManager = ToolsLocator.getDynObjectManager(); |
|
57 |
// InputStream resource = this.getClass().getResourceAsStream("/JLrsCalculateMLastUsedValues.xml"); |
|
58 |
// Map classes = null; |
|
59 |
// try { |
|
60 |
// classes = dynManager.importDynClassDefinitions(resource, this.getClass().getClassLoader()); |
|
61 |
// } catch (XmlPullParserException e) { |
|
62 |
// LOG.warn("Error parsing the resource.", e); |
|
63 |
// } catch (IOException e) { |
|
64 |
// LOG.warn("Error opening the resource.", e); |
|
65 |
// } |
|
66 |
// Iterator it = classes.entrySet().iterator(); |
|
67 |
// while(it.hasNext()){ |
|
68 |
// Map.Entry entry = (Map.Entry) it.next(); |
|
69 |
// DynClass dynClass = (DynClass) entry.getValue(); |
|
70 |
// if(!dynManager.has(dynClass.getFullName())){ |
|
71 |
// dynManager.add((DynClass) entry.getValue()); |
|
72 |
// } |
|
73 |
// } |
|
74 |
} |
|
75 |
|
|
76 |
|
|
77 |
private void registerLrsCalculateMLastUsedValuesDefinition(){ |
|
78 |
String name = "JLrsCalculateMLastUsedValues"; |
|
79 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
80 |
DynStruct definition = manager.getDefinition(name); |
|
81 |
if ( definition == null) { |
|
82 |
InputStream stream = this.getClass().getResourceAsStream("/JLrsCalculateMLastUsedValues.xml"); |
|
83 |
if( stream == null ) { |
|
84 |
throw new RuntimeException("Error file not found: JLrsCalculateMLastUsedValues.xml"); |
|
85 |
} |
|
86 |
definition = manager.addDefinition( |
|
87 |
this.getClass(), |
|
88 |
name, |
|
89 |
stream, |
|
90 |
this.getClass().getClassLoader(), |
|
91 |
null, |
|
92 |
null |
|
93 |
); |
|
94 |
} |
|
95 |
} |
|
42 | 96 |
|
43 |
} |
|
97 |
/* (non-Javadoc) |
|
98 |
* @see org.gvsig.tools.library.AbstractLibrary#doPostInitialize() |
|
99 |
*/ |
|
100 |
@Override |
|
101 |
protected void doPostInitialize() throws LibraryException { |
|
102 |
// Validate there is any implementation registered. |
|
103 |
LrsAlgorithmsSwingManager manager = LrsAlgorithmsSwingLocator.getLrsAlgorithmsSwingManager(); |
|
104 |
if (manager == null) { |
|
105 |
throw new ReferenceNotRegisteredException( |
|
106 |
LrsAlgorithmsSwingLocator.MANAGER_NAME, LrsAlgorithmsSwingLocator.getInstance()); |
|
107 |
} |
|
108 |
} |
|
44 | 109 |
|
45 |
/* (non-Javadoc) |
|
46 |
* @see org.gvsig.tools.library.AbstractLibrary#doPostInitialize() |
|
47 |
*/ |
|
48 |
@Override |
|
49 |
protected void doPostInitialize() throws LibraryException { |
|
50 |
// Validate there is any implementation registered. |
|
51 |
LrsAlgorithmsSwingManager manager = LrsAlgorithmsSwingLocator.getLrsAlgorithmsSwingManager(); |
|
52 |
if (manager == null) { |
|
53 |
throw new ReferenceNotRegisteredException( |
|
54 |
LrsAlgorithmsSwingLocator.MANAGER_NAME, LrsAlgorithmsSwingLocator.getInstance()); |
|
55 |
} |
|
56 |
} |
|
57 | 110 |
|
58 | 111 |
} |
org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/LrsAlgorithmsSwingManager.java | ||
---|---|---|
29 | 29 |
import org.gvsig.fmap.mapcontext.MapContext; |
30 | 30 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
31 | 31 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
32 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
32 | 33 |
import org.gvsig.lrs.lib.api.LrsCalibrateRouteAlgorithmParams; |
33 | 34 |
import org.gvsig.lrs.lib.api.LrsCreateRouteAlgorithmParams; |
34 | 35 |
import org.gvsig.lrs.lib.api.LrsEditRouteCalibrationAlgorithmParams; |
... | ... | |
37 | 38 |
import org.gvsig.lrs.lib.api.LrsShowMeasuresAlgorithmParams; |
38 | 39 |
import org.gvsig.lrs.lib.api.exceptions.LrsGettingParametersException; |
39 | 40 |
import org.gvsig.lrs.lib.api.exceptions.LrsNeededParameterException; |
41 |
import org.gvsig.tools.dynobject.DynObject; |
|
40 | 42 |
import org.gvsig.tools.service.Manager; |
41 | 43 |
import org.gvsig.tools.task.TaskStatus; |
42 | 44 |
|
... | ... | |
61 | 63 |
|
62 | 64 |
public JLrsAlgorithmParams createJLrsGenerateDynamicSegmentationAlgorithmParameters(FLayers layers, List<FeatureStore> tables, LrsGenerateDynamicSegmentationAlgorithmParams parameters) throws LrsNeededParameterException; |
63 | 65 |
|
66 |
public JLrsAlgorithmParams createJLrsCalculateMRoutePanel(FLayer layer) throws LrsNeededParameterException; |
|
67 |
|
|
68 |
public JLrsAlgorithmParams createJLrsCalculateMRoutePanel(FLayer layer, JLrsLastUsedValues params) throws LrsNeededParameterException; |
|
69 |
|
|
70 |
public JLrsLastUsedValues getJLrsLastUsedValues(DynObject pluginProperties); |
|
71 |
|
|
72 |
public JLrsLastUsedValues getJLrsLastUsedValues(); |
|
73 |
|
|
64 | 74 |
} |
65 | 75 |
org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/JLrsCalculateMRoutePanel.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/jose/Escritorio/JLrsCalculateMRoutePanel.xml</at> |
|
28 |
<at name="rowspecs">CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE</at> |
|
29 |
<at name="colspecs">FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0)</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">5</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="text">Selecciona los campos con los PKs</at> |
|
57 |
<at name="height">14</at> |
|
58 |
<at name="width">989</at> |
|
59 |
<at name="name">pkselectionlabel</at> |
|
60 |
<at name="fill"> |
|
61 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
62 |
<at name="name">fill</at> |
|
63 |
</object> |
|
64 |
</at> |
|
65 |
<at name="border"> |
|
66 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
67 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
68 |
<at name="name">border</at> |
|
69 |
</super> |
|
70 |
<at name="borders"> |
|
71 |
<object classname="java.util.LinkedList"> |
|
72 |
<item > |
|
73 |
<at name="value"> |
|
74 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
75 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
76 |
<at name="name">border</at> |
|
77 |
</super> |
|
78 |
</object> |
|
79 |
</at> |
|
80 |
</item> |
|
81 |
</object> |
|
82 |
</at> |
|
83 |
</object> |
|
84 |
</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">2</at> |
|
99 |
<at name="row">4</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">com.jeta.forms.components.label.JETALabel</at> |
|
111 |
<at name="beanproperties"> |
|
112 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
113 |
<at name="classname">com.jeta.forms.components.label.JETALabel</at> |
|
114 |
<at name="properties"> |
|
115 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
116 |
<at name="text">Pk inicial:</at> |
|
117 |
<at name="height">14</at> |
|
118 |
<at name="width">323</at> |
|
119 |
<at name="name">pkilabel</at> |
|
120 |
<at name="fill"> |
|
121 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
122 |
<at name="name">fill</at> |
|
123 |
</object> |
|
124 |
</at> |
|
125 |
<at name="border"> |
|
126 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
127 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
128 |
<at name="name">border</at> |
|
129 |
</super> |
|
130 |
<at name="borders"> |
|
131 |
<object classname="java.util.LinkedList"> |
|
132 |
<item > |
|
133 |
<at name="value"> |
|
134 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
135 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
136 |
<at name="name">border</at> |
|
137 |
</super> |
|
138 |
</object> |
|
139 |
</at> |
|
140 |
</item> |
|
141 |
</object> |
|
142 |
</at> |
|
143 |
</object> |
|
144 |
</at> |
|
145 |
</object> |
|
146 |
</at> |
|
147 |
</object> |
|
148 |
</at> |
|
149 |
</object> |
|
150 |
</at> |
|
151 |
</item> |
|
152 |
<item > |
|
153 |
<at name="value"> |
|
154 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
155 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
156 |
<at name="cellconstraints"> |
|
157 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
158 |
<at name="column">5</at> |
|
159 |
<at name="row">4</at> |
|
160 |
<at name="colspan">1</at> |
|
161 |
<at name="rowspan">1</at> |
|
162 |
<at name="halign">default</at> |
|
163 |
<at name="valign">default</at> |
|
164 |
<at name="insets" object="insets">0,0,0,0</at> |
|
165 |
</object> |
|
166 |
</at> |
|
167 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
168 |
</super> |
|
169 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
170 |
<at name="beanclass">com.jeta.forms.components.label.JETALabel</at> |
|
171 |
<at name="beanproperties"> |
|
172 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
173 |
<at name="classname">com.jeta.forms.components.label.JETALabel</at> |
|
174 |
<at name="properties"> |
|
175 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
176 |
<at name="text">Pk final:</at> |
|
177 |
<at name="height">14</at> |
|
178 |
<at name="width">45</at> |
|
179 |
<at name="name">pkflabel</at> |
|
180 |
<at name="fill"> |
|
181 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
182 |
<at name="name">fill</at> |
|
183 |
</object> |
|
184 |
</at> |
|
185 |
<at name="border"> |
|
186 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
187 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
188 |
<at name="name">border</at> |
|
189 |
</super> |
|
190 |
<at name="borders"> |
|
191 |
<object classname="java.util.LinkedList"> |
|
192 |
<item > |
|
193 |
<at name="value"> |
|
194 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
195 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
196 |
<at name="name">border</at> |
|
197 |
</super> |
|
198 |
</object> |
|
199 |
</at> |
|
200 |
</item> |
|
201 |
</object> |
|
202 |
</at> |
|
203 |
</object> |
|
204 |
</at> |
|
205 |
</object> |
|
206 |
</at> |
|
207 |
</object> |
|
208 |
</at> |
|
209 |
</object> |
|
210 |
</at> |
|
211 |
</item> |
|
212 |
<item > |
|
213 |
<at name="value"> |
|
214 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
215 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
216 |
<at name="cellconstraints"> |
|
217 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
218 |
<at name="column">3</at> |
|
219 |
<at name="row">4</at> |
|
220 |
<at name="colspan">1</at> |
|
221 |
<at name="rowspan">1</at> |
|
222 |
<at name="halign">default</at> |
|
223 |
<at name="valign">default</at> |
|
224 |
<at name="insets" object="insets">0,0,0,0</at> |
|
225 |
</object> |
|
226 |
</at> |
|
227 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
228 |
</super> |
|
229 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
230 |
<at name="beanclass">javax.swing.JComboBox</at> |
|
231 |
<at name="beanproperties"> |
|
232 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
233 |
<at name="classname">javax.swing.JComboBox</at> |
|
234 |
<at name="properties"> |
|
235 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
236 |
<at name="height">20</at> |
|
237 |
<at name="items"> |
|
238 |
<object classname="com.jeta.forms.store.properties.ItemsProperty"> |
|
239 |
<at name="name">items</at> |
|
240 |
</object> |
|
241 |
</at> |
|
242 |
<at name="width">297</at> |
|
243 |
<at name="name">pkicombo</at> |
|
244 |
<at name="border"> |
|
245 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
246 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
247 |
<at name="name">border</at> |
|
248 |
</super> |
|
249 |
<at name="borders"> |
|
250 |
<object classname="java.util.LinkedList"> |
|
251 |
<item > |
|
252 |
<at name="value"> |
|
253 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
254 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
255 |
<at name="name">border</at> |
|
256 |
</super> |
|
257 |
</object> |
|
258 |
</at> |
|
259 |
</item> |
|
260 |
</object> |
|
261 |
</at> |
|
262 |
</object> |
|
263 |
</at> |
|
264 |
</object> |
|
265 |
</at> |
|
266 |
</object> |
|
267 |
</at> |
|
268 |
</object> |
|
269 |
</at> |
|
270 |
</item> |
|
271 |
<item > |
|
272 |
<at name="value"> |
|
273 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
274 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
275 |
<at name="cellconstraints"> |
|
276 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
277 |
<at name="column">6</at> |
|
278 |
<at name="row">4</at> |
|
279 |
<at name="colspan">1</at> |
|
280 |
<at name="rowspan">1</at> |
|
281 |
<at name="halign">default</at> |
|
282 |
<at name="valign">default</at> |
|
283 |
<at name="insets" object="insets">0,0,0,0</at> |
|
284 |
</object> |
|
285 |
</at> |
|
286 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
287 |
</super> |
|
288 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
289 |
<at name="beanclass">javax.swing.JComboBox</at> |
|
290 |
<at name="beanproperties"> |
|
291 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
292 |
<at name="classname">javax.swing.JComboBox</at> |
|
293 |
<at name="properties"> |
|
294 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
295 |
<at name="height">20</at> |
|
296 |
<at name="items"> |
|
297 |
<object classname="com.jeta.forms.store.properties.ItemsProperty"> |
|
298 |
<at name="name">items</at> |
|
299 |
</object> |
|
300 |
</at> |
|
301 |
<at name="width">296</at> |
|
302 |
<at name="name">pkfcombo</at> |
|
303 |
<at name="border"> |
|
304 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
305 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
306 |
<at name="name">border</at> |
|
307 |
</super> |
|
308 |
<at name="borders"> |
|
309 |
<object classname="java.util.LinkedList"> |
|
310 |
<item > |
|
311 |
<at name="value"> |
|
312 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
313 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
314 |
<at name="name">border</at> |
|
315 |
</super> |
|
316 |
</object> |
|
317 |
</at> |
|
318 |
</item> |
|
319 |
</object> |
|
320 |
</at> |
|
321 |
</object> |
|
322 |
</at> |
|
323 |
</object> |
|
324 |
</at> |
|
325 |
</object> |
|
326 |
</at> |
|
327 |
</object> |
|
328 |
</at> |
|
329 |
</item> |
|
330 |
<item > |
|
331 |
<at name="value"> |
|
332 |
<object classname="com.jeta.forms.store.memento.BeanMemento"> |
|
333 |
<super classname="com.jeta.forms.store.memento.ComponentMemento"> |
|
334 |
<at name="cellconstraints"> |
|
335 |
<object classname="com.jeta.forms.store.memento.CellConstraintsMemento"> |
|
336 |
<at name="column">2</at> |
|
337 |
<at name="row">6</at> |
|
338 |
<at name="colspan">5</at> |
|
339 |
<at name="rowspan">1</at> |
|
340 |
<at name="halign">default</at> |
|
341 |
<at name="valign">default</at> |
|
342 |
<at name="insets" object="insets">0,0,0,0</at> |
|
343 |
</object> |
|
344 |
</at> |
|
345 |
<at name="componentclass">com.jeta.forms.gui.form.StandardComponent</at> |
|
346 |
</super> |
|
347 |
<at name="jetabeanclass">com.jeta.forms.gui.beans.JETABean</at> |
|
348 |
<at name="beanclass">javax.swing.JTable</at> |
|
349 |
<at name="beanproperties"> |
|
350 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
351 |
<at name="classname">javax.swing.JTable</at> |
|
352 |
<at name="properties"> |
|
353 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
354 |
<at name="height">32</at> |
|
355 |
<at name="width">987</at> |
|
356 |
<at name="name">routestable</at> |
|
357 |
<at name="scollBars"> |
|
358 |
<object classname="com.jeta.forms.store.properties.ScrollBarsProperty"> |
|
359 |
<at name="name">scollBars</at> |
|
360 |
<at name="verticalpolicy">20</at> |
|
361 |
<at name="horizontalpolicy">30</at> |
|
362 |
<at name="border"> |
|
363 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
364 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
365 |
<at name="name">border</at> |
|
366 |
</super> |
|
367 |
<at name="borders"> |
|
368 |
<object classname="java.util.LinkedList"> |
|
369 |
<item > |
|
370 |
<at name="value"> |
|
371 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
372 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
373 |
<at name="name">border</at> |
|
374 |
</super> |
|
375 |
</object> |
|
376 |
</at> |
|
377 |
</item> |
|
378 |
</object> |
|
379 |
</at> |
|
380 |
</object> |
|
381 |
</at> |
|
382 |
</object> |
|
383 |
</at> |
|
384 |
<at name="border"> |
|
385 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
386 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
387 |
<at name="name">border</at> |
|
388 |
</super> |
|
389 |
<at name="borders"> |
|
390 |
<object classname="java.util.LinkedList"> |
|
391 |
<item > |
|
392 |
<at name="value"> |
|
393 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
394 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
395 |
<at name="name">border</at> |
|
396 |
</super> |
|
397 |
</object> |
|
398 |
</at> |
|
399 |
</item> |
|
400 |
</object> |
|
401 |
</at> |
|
402 |
</object> |
|
403 |
</at> |
|
404 |
</object> |
|
405 |
</at> |
|
406 |
</object> |
|
407 |
</at> |
|
408 |
</object> |
|
409 |
</at> |
|
410 |
</item> |
|
411 |
</object> |
|
412 |
</at> |
|
413 |
<at name="properties"> |
|
414 |
<object classname="com.jeta.forms.store.memento.PropertiesMemento"> |
|
415 |
<at name="classname">com.jeta.forms.gui.form.GridView</at> |
|
416 |
<at name="properties"> |
|
417 |
<object classname="com.jeta.forms.store.support.PropertyMap"> |
|
418 |
<at name="name"></at> |
|
419 |
<at name="fill"> |
|
420 |
<object classname="com.jeta.forms.store.properties.effects.PaintProperty"> |
|
421 |
<at name="name">fill</at> |
|
422 |
</object> |
|
423 |
</at> |
|
424 |
<at name="scollBars"> |
|
425 |
<object classname="com.jeta.forms.store.properties.ScrollBarsProperty"> |
|
426 |
<at name="name">scollBars</at> |
|
427 |
<at name="verticalpolicy">21</at> |
|
428 |
<at name="horizontalpolicy">31</at> |
|
429 |
<at name="border"> |
|
430 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
431 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
432 |
<at name="name">border</at> |
|
433 |
</super> |
|
434 |
<at name="borders"> |
|
435 |
<object classname="java.util.LinkedList"> |
|
436 |
<item > |
|
437 |
<at name="value"> |
|
438 |
<object classname="com.jeta.forms.store.properties.DefaultBorderProperty"> |
|
439 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
440 |
<at name="name">border</at> |
|
441 |
</super> |
|
442 |
</object> |
|
443 |
</at> |
|
444 |
</item> |
|
445 |
</object> |
|
446 |
</at> |
|
447 |
</object> |
|
448 |
</at> |
|
449 |
</object> |
|
450 |
</at> |
|
451 |
<at name="border"> |
|
452 |
<object classname="com.jeta.forms.store.properties.CompoundBorderProperty"> |
|
453 |
<super classname="com.jeta.forms.store.properties.BorderProperty"> |
|
454 |
<at name="name">border</at> |
|
455 |
</super> |
|
456 |
<at name="borders"> |
|
457 |
<object classname="java.util.LinkedList"/> |
|
458 |
</at> |
|
459 |
</object> |
|
460 |
</at> |
|
461 |
</object> |
|
462 |
</at> |
|
463 |
</object> |
|
464 |
</at> |
|
465 |
<at name="cellpainters"> |
|
466 |
<object classname="com.jeta.forms.store.support.Matrix"> |
|
467 |
<at name="rows"> |
|
468 |
<object classname="[Ljava.lang.Object;" size="7"> |
|
469 |
<at name="item" index="0"> |
|
470 |
<object classname="[Ljava.lang.Object;" size="6"/> |
|
471 |
</at> |
|
472 |
<at name="item" index="1"> |
|
473 |
<object classname="[Ljava.lang.Object;" size="6"/> |
|
474 |
</at> |
|
475 |
<at name="item" index="2"> |
|
476 |
<object classname="[Ljava.lang.Object;" size="6"/> |
|
477 |
</at> |
|
478 |
<at name="item" index="3"> |
|
479 |
<object classname="[Ljava.lang.Object;" size="6"/> |
|
480 |
</at> |
|
481 |
<at name="item" index="4"> |
|
482 |
<object classname="[Ljava.lang.Object;" size="6"/> |
|
483 |
</at> |
|
484 |
<at name="item" index="5"> |
|
485 |
<object classname="[Ljava.lang.Object;" size="6"/> |
|
486 |
</at> |
|
487 |
<at name="item" index="6"> |
|
488 |
<object classname="[Ljava.lang.Object;" size="6"/> |
|
489 |
</at> |
|
490 |
</object> |
|
491 |
</at> |
|
492 |
</object> |
|
493 |
</at> |
|
494 |
<at name="rowgroups"> |
|
495 |
<object classname="com.jeta.forms.store.memento.FormGroupSet"> |
|
496 |
<at name="groups"> |
|
497 |
<object classname="java.util.HashMap"/> |
|
498 |
</at> |
|
499 |
</object> |
|
500 |
</at> |
|
501 |
<at name="colgroups"> |
|
502 |
<object classname="com.jeta.forms.store.memento.FormGroupSet"> |
|
503 |
<at name="groups"> |
|
504 |
<object classname="java.util.HashMap"/> |
|
505 |
</at> |
|
506 |
</object> |
|
507 |
</at> |
|
508 |
</object> |
|
509 |
</at> |
|
510 |
</object> |
|
0 | 511 |
org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/DefaultLrsAlgorithmsSwingManager.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import java.util.List; |
26 | 26 |
|
27 |
import org.gvsig.fmap.dal.feature.Feature; |
|
28 | 27 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
29 | 28 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
30 | 29 |
import org.gvsig.fmap.mapcontext.MapContext; |
31 | 30 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
32 | 31 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
32 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
33 | 33 |
import org.gvsig.lrs.lib.api.LrsCalibrateRouteAlgorithmParams; |
34 | 34 |
import org.gvsig.lrs.lib.api.LrsCreateRouteAlgorithmParams; |
35 | 35 |
import org.gvsig.lrs.lib.api.LrsEditRouteCalibrationAlgorithmParams; |
... | ... | |
39 | 39 |
import org.gvsig.lrs.lib.api.exceptions.LrsGettingParametersException; |
40 | 40 |
import org.gvsig.lrs.lib.api.exceptions.LrsNeededParameterException; |
41 | 41 |
import org.gvsig.lrs.swing.api.JLrsAlgorithmParams; |
42 |
import org.gvsig.lrs.swing.api.JLrsLastUsedValues; |
|
42 | 43 |
import org.gvsig.lrs.swing.api.JLrsProgressDialog; |
43 | 44 |
import org.gvsig.lrs.swing.api.LrsAlgorithmsSwingManager; |
45 |
import org.gvsig.tools.ToolsLocator; |
|
44 | 46 |
import org.gvsig.tools.dynobject.DynObject; |
47 |
import org.gvsig.tools.dynobject.DynObjectManager; |
|
45 | 48 |
import org.gvsig.tools.service.Service; |
46 | 49 |
import org.gvsig.tools.service.ServiceException; |
47 | 50 |
import org.gvsig.tools.task.TaskStatus; |
... | ... | |
53 | 56 |
*/ |
54 | 57 |
public class DefaultLrsAlgorithmsSwingManager implements LrsAlgorithmsSwingManager { |
55 | 58 |
|
56 |
/* (non-Javadoc) |
|
59 |
private JLrsLastUsedValues params; |
|
60 |
|
|
61 |
/* (non-Javadoc) |
|
57 | 62 |
* @see org.gvsig.tools.service.Manager#createServiceParameters(java.lang.String) |
58 | 63 |
*/ |
59 | 64 |
public DynObject createServiceParameters(String serviceName) throws ServiceException { |
... | ... | |
123 | 128 |
/* (non-Javadoc) |
124 | 129 |
* @see org.gvsig.lrs.swing.api.LrsAlgorithmsSwingManager#createJLrsShowMeasuresAlgorithmParameters(org.gvsig.lrs.lib.api.LrsCalibrateRouteAlgorithmParams) |
125 | 130 |
*/ |
126 |
public JLrsAlgorithmParams createJLrsGenerateDynamicSegmentationAlgorithmParameters(FLayers layers,List<FeatureStore> tables, LrsGenerateDynamicSegmentationAlgorithmParams parameters) throws LrsNeededParameterException {
|
|
131 |
public JLrsAlgorithmParams createJLrsGenerateDynamicSegmentationAlgorithmParameters(FLayers layers, List<FeatureStore> tables, LrsGenerateDynamicSegmentationAlgorithmParams parameters) throws LrsNeededParameterException{
|
|
127 | 132 |
return new JLrsGenerateDynamicSegmentationParamsController(layers, tables, parameters); |
128 | 133 |
} |
129 | 134 |
|
... | ... | |
134 | 139 |
return new DefaultProgressDialogController(taskStatus); |
135 | 140 |
} |
136 | 141 |
|
142 |
public JLrsAlgorithmParams createJLrsCalculateMRoutePanel(FLayer layer) throws LrsNeededParameterException { |
|
143 |
return createJLrsCalculateMRoutePanel(layer, null); |
|
144 |
} |
|
145 |
|
|
146 |
public JLrsAlgorithmParams createJLrsCalculateMRoutePanel(FLayer layer, JLrsLastUsedValues params) |
|
147 |
throws LrsNeededParameterException { |
|
148 |
if(params == null){ |
|
149 |
DynObjectManager dynmanager = ToolsLocator.getDynObjectManager(); |
|
150 |
params = getJLrsLastUsedValues(dynmanager.createDynObject("JLrsLastUsedValues")); |
|
151 |
} |
|
152 |
return new JLrsCalculateMRouteController(layer, params); |
|
153 |
} |
|
154 |
|
|
155 |
public JLrsLastUsedValues getJLrsLastUsedValues(DynObject pluginProperties) { |
|
156 |
if(params == null){ |
|
157 |
params = new DefaultJLrsLastUsedValues(pluginProperties); |
|
158 |
} |
|
159 |
else{ |
|
160 |
params.setParams(pluginProperties); |
|
161 |
} |
|
162 |
return params; |
|
163 |
} |
|
164 |
|
|
165 |
public JLrsLastUsedValues getJLrsLastUsedValues() { |
|
166 |
return params; |
|
167 |
} |
|
168 |
|
|
137 | 169 |
} |
org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/DefaultJLrsLastUsedValues.java | ||
---|---|---|
1 |
package org.gvsig.lrs.swing.impl; |
|
2 |
|
|
3 |
import org.gvsig.lrs.swing.api.JLrsLastUsedValues; |
|
4 |
import org.gvsig.tools.dynobject.DynObject; |
|
5 |
|
|
6 |
public class DefaultJLrsLastUsedValues implements JLrsLastUsedValues{ |
|
7 |
|
|
8 |
private DynObject values; |
|
9 |
|
|
10 |
public DefaultJLrsLastUsedValues(DynObject val){ |
|
11 |
this.values = val; |
|
12 |
} |
|
13 |
|
|
14 |
public String getPkInicial() { |
|
15 |
return (String) values.getDynValue("pkInicial"); |
|
16 |
} |
|
17 |
|
|
18 |
public String getPkFinal() { |
|
19 |
return (String) values.getDynValue("pkFinal"); |
|
20 |
} |
|
21 |
|
|
22 |
public void setPkInicial(String ini) { |
|
23 |
values.setDynValue("pkInicial", ini); |
|
24 |
} |
|
25 |
|
|
26 |
public void setPkFinal(String fin) { |
|
27 |
values.setDynValue("pkFinal", fin); |
|
28 |
} |
|
29 |
|
|
30 |
public void setParams(DynObject pluginProperties) { |
|
31 |
this.values = pluginProperties; |
|
32 |
} |
|
33 |
|
|
34 |
public DynObject getParams() { |
|
35 |
return this.values; |
|
36 |
} |
|
37 |
|
|
38 |
} |
|
0 | 39 |
org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/JLrsCalculateMRouteView.java | ||
---|---|---|
1 |
package org.gvsig.lrs.swing.impl; |
|
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.ComponentOrientation; |
|
5 |
import java.awt.Container; |
|
6 |
import java.awt.Dimension; |
|
7 |
|
|
8 |
import javax.swing.Box; |
|
9 |
import javax.swing.ImageIcon; |
|
10 |
import javax.swing.JComboBox; |
|
11 |
import javax.swing.JLabel; |
|
12 |
import javax.swing.JPanel; |
|
13 |
|
|
14 |
import org.gvsig.fmap.mapcontrol.dal.feature.swing.FeatureTablePanel; |
|
15 |
|
|
16 |
import com.jgoodies.forms.layout.CellConstraints; |
|
17 |
import com.jgoodies.forms.layout.FormLayout; |
|
18 |
|
|
19 |
|
|
20 |
public class JLrsCalculateMRouteView extends JPanel |
|
21 |
{ |
|
22 |
JPanel jLrsCalculateMRoutePanel = new JPanel(); |
|
23 |
JLabel jroutesselected = new JLabel(); |
|
24 |
JLabel pkilabel = new JLabel(); |
|
25 |
JLabel pkflabel = new JLabel(); |
|
26 |
JComboBox pkicombo = new JComboBox(); |
|
27 |
JComboBox pkfcombo = new JComboBox(); |
|
28 |
FeatureTablePanel routestable = null; |
|
29 |
|
|
30 |
/** |
|
31 |
* Default constructor |
|
32 |
*/ |
|
33 |
public JLrsCalculateMRouteView() |
|
34 |
{ |
|
35 |
initializePanel(); |
|
36 |
} |
|
37 |
|
|
38 |
/** |
|
39 |
* Adds fill components to empty cells in the first row and first column of the grid. |
|
40 |
* This ensures that the grid spacing will be the same as shown in the designer. |
|
41 |
* @param cols an array of column indices in the first row where fill components should be added. |
|
42 |
* @param rows an array of row indices in the first column where fill components should be added. |
|
43 |
*/ |
|
44 |
void addFillComponents( Container panel, int[] cols, int[] rows ) |
|
45 |
{ |
|
46 |
Dimension filler = new Dimension(10,10); |
|
47 |
|
|
48 |
boolean filled_cell_11 = false; |
|
49 |
CellConstraints cc = new CellConstraints(); |
|
50 |
if ( cols.length > 0 && rows.length > 0 ) |
|
51 |
{ |
|
52 |
if ( cols[0] == 1 && rows[0] == 1 ) |
|
53 |
{ |
|
54 |
/** add a rigid area */ |
|
55 |
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); |
|
56 |
filled_cell_11 = true; |
|
57 |
} |
|
58 |
} |
|
59 |
|
|
60 |
for( int index = 0; index < cols.length; index++ ) |
|
61 |
{ |
|
62 |
if ( cols[index] == 1 && filled_cell_11 ) |
|
63 |
{ |
|
64 |
continue; |
|
65 |
} |
|
66 |
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); |
|
67 |
} |
|
68 |
|
|
69 |
for( int index = 0; index < rows.length; index++ ) |
|
70 |
{ |
|
71 |
if ( rows[index] == 1 && filled_cell_11 ) |
|
72 |
{ |
|
73 |
continue; |
|
74 |
} |
|
75 |
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); |
|
76 |
} |
|
77 |
|
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* Helper method to load an image file from the CLASSPATH |
|
82 |
* @param imageName the package and name of the file to load relative to the CLASSPATH |
|
83 |
* @return an ImageIcon instance with the specified image file |
|
84 |
* @throws IllegalArgumentException if the image resource cannot be loaded. |
|
85 |
*/ |
|
86 |
public ImageIcon loadImage( String imageName ) |
|
87 |
{ |
|
88 |
try |
|
89 |
{ |
|
90 |
ClassLoader classloader = getClass().getClassLoader(); |
|
91 |
java.net.URL url = classloader.getResource( imageName ); |
|
92 |
if ( url != null ) |
|
93 |
{ |
|
94 |
ImageIcon icon = new ImageIcon( url ); |
|
95 |
return icon; |
|
96 |
} |
|
97 |
} |
|
98 |
catch( Exception e ) |
|
99 |
{ |
|
100 |
e.printStackTrace(); |
|
101 |
} |
|
102 |
throw new IllegalArgumentException( "Unable to load image: " + imageName ); |
|
103 |
} |
|
104 |
|
|
105 |
/** |
|
106 |
* Method for recalculating the component orientation for |
|
107 |
* right-to-left Locales. |
|
108 |
* @param orientation the component orientation to be applied |
|
109 |
*/ |
|
110 |
public void applyComponentOrientation( ComponentOrientation orientation ) |
|
111 |
{ |
|
112 |
// Not yet implemented... |
|
113 |
// I18NUtils.applyComponentOrientation(this, orientation); |
|
114 |
super.applyComponentOrientation(orientation); |
|
115 |
} |
|
116 |
|
|
117 |
public JPanel createJLrsCalculateMRoutePanel() |
|
118 |
{ |
|
119 |
jLrsCalculateMRoutePanel.setName("JLrsCreateRouteParametersPanel"); |
|
120 |
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE","FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:DEFAULT:NONE"); |
|
121 |
CellConstraints cc = new CellConstraints(); |
|
122 |
jLrsCalculateMRoutePanel.setLayout(formlayout1); |
|
123 |
|
|
124 |
jroutesselected.setName("jroutesselected"); |
|
125 |
jroutesselected.setText("pk_selected"); |
|
126 |
jLrsCalculateMRoutePanel.add(jroutesselected,cc.xyw(1,1,5)); |
|
127 |
|
|
128 |
pkilabel.setName("pkilabel"); |
|
129 |
pkilabel.setText("pk_inicial"); |
|
130 |
jLrsCalculateMRoutePanel.add(pkilabel,cc.xy(1,3)); |
|
131 |
|
|
132 |
pkflabel.setName("pkflabel"); |
|
133 |
pkflabel.setText("pk_final"); |
|
134 |
jLrsCalculateMRoutePanel.add(pkflabel,cc.xy(4,3)); |
|
135 |
|
|
136 |
pkicombo.setName("pkicombo"); |
|
137 |
jLrsCalculateMRoutePanel.add(pkicombo,cc.xy(2,3)); |
|
138 |
|
|
139 |
pkfcombo.setName("pkfcombo"); |
|
140 |
jLrsCalculateMRoutePanel.add(pkfcombo,cc.xy(5,3)); |
|
141 |
|
|
142 |
|
|
143 |
addFillComponents(jLrsCalculateMRoutePanel,new int[]{ 1,2,3,4,5,6 },new int[]{ 1,2,3,4,5,6,7}); |
|
144 |
return jLrsCalculateMRoutePanel; |
|
145 |
} |
|
146 |
|
|
147 |
|
|
148 |
/** |
|
149 |
* Initializer |
|
150 |
*/ |
|
151 |
protected void initializePanel() |
|
152 |
{ |
|
153 |
setLayout(new BorderLayout()); |
|
154 |
add(createJLrsCalculateMRoutePanel(), BorderLayout.CENTER); |
|
155 |
} |
|
156 |
|
|
157 |
|
|
158 |
} |
|
0 | 159 |
org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/JLrsCalculateMRouteController.java | ||
---|---|---|
1 |
/* |
|
2 |
* Copyright 2015 DiSiD Technologies S.L.L. All rights reserved. |
|
3 |
* |
|
4 |
* Project : DiSiD org.gvsig.lrs.swing.impl |
|
5 |
* SVN Id : $Id$ |
|
6 |
*/ |
|
7 |
package org.gvsig.lrs.swing.impl; |
|
8 |
|
|
9 |
import java.awt.Dimension; |
|
10 |
import java.awt.Rectangle; |
|
11 |
import java.awt.event.ActionEvent; |
|
12 |
import java.awt.event.ActionListener; |
|
13 |
import java.util.Locale; |
|
14 |
|
|
15 |
import javax.swing.JComponent; |
|
16 |
import javax.swing.ListCellRenderer; |
|
17 |
|
|
18 |
import org.gvsig.fmap.dal.exception.DataException; |
|
19 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
20 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
21 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
22 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
23 |
import org.gvsig.fmap.mapcontext.layers.operations.LayerCollection; |
|
24 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
25 |
import org.gvsig.fmap.mapcontrol.dal.feature.swing.FeatureTablePanel; |
|
26 |
import org.gvsig.lrs.lib.api.LrsAlgorithmParams; |
|
27 |
import org.gvsig.lrs.lib.api.exceptions.LrsGettingParametersException; |
|
28 |
import org.gvsig.lrs.lib.api.exceptions.LrsNeededParameterException; |
|
29 |
import org.gvsig.lrs.swing.api.JLrsAlgorithmParams; |
|
30 |
import org.gvsig.lrs.swing.api.JLrsLastUsedValues; |
|
31 |
import org.gvsig.tools.ToolsLocator; |
|
32 |
import org.gvsig.tools.exception.BaseException; |
|
33 |
import org.gvsig.tools.i18n.I18nManager; |
|
34 |
import org.gvsig.tools.swing.api.ActionListenerSupport; |
|
35 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
36 |
import org.slf4j.Logger; |
|
37 |
import org.slf4j.LoggerFactory; |
|
38 |
|
|
39 |
import com.jgoodies.forms.layout.CellConstraints; |
|
40 |
|
|
41 |
public class JLrsCalculateMRouteController extends JLrsCalculateMRouteView implements JLrsAlgorithmParams{ |
|
42 |
|
|
43 |
/** |
|
44 |
* |
|
45 |
*/ |
|
46 |
private static final long serialVersionUID = -9145489136943076981L; |
|
47 |
|
|
48 |
private static final Logger logger = LoggerFactory.getLogger(JLrsCalculateMRouteController.class); |
|
49 |
|
|
50 |
private boolean canceled; |
|
51 |
private ActionListenerSupport listeners = ToolsSwingLocator.getToolsSwingManager().createActionListenerSupport(); |
|
52 |
|
|
53 |
private FLayer layer; |
|
54 |
private JLrsLastUsedValues params; |
|
55 |
|
|
56 |
/** |
|
57 |
* @param layer |
|
58 |
* @throws LrsNeededParameterException |
|
59 |
* @throws |
|
60 |
* |
|
61 |
*/ |
|
62 |
public JLrsCalculateMRouteController(FLayer layer, JLrsLastUsedValues jLrsLastUsedValues) throws LrsNeededParameterException { |
|
63 |
super(); |
|
64 |
this.layer = layer; |
|
65 |
this.params = jLrsLastUsedValues; |
|
66 |
initComponents(); |
|
67 |
translate(); |
|
68 |
} |
|
69 |
|
|
70 |
public void addActionListener(ActionListener listener) { |
|
71 |
listeners.addActionListener(listener); |
|
72 |
} |
|
73 |
|
|
74 |
public void removeActionListener(ActionListener listener) { |
|
75 |
listeners.removeActionListener(listener); |
|
76 |
} |
|
77 |
|
|
78 |
private void translate() { |
|
79 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
80 |
jroutesselected |
|
81 |
.setText(i18nManager.getTranslation(jroutesselected.getText())); |
|
82 |
pkilabel.setText(i18nManager.getTranslation(pkilabel.getText())+" "); |
|
83 |
pkflabel.setText(i18nManager.getTranslation(pkflabel.getText())+" "); |
|
84 |
|
|
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* |
|
89 |
*/ |
|
90 |
public void setLocate(Locale locale) { |
|
91 |
Locale l = super.getLocale(); |
|
92 |
if (!l.equals(locale)) { |
|
93 |
translate(); |
|
94 |
} |
|
95 |
super.setLocale(locale); |
|
96 |
} |
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
/** |
|
101 |
* Validates the layers: |
|
102 |
* - At least 2 layers |
|
103 |
* - At least 1 curve layer with at least 1 non-geometric field |
|
104 |
* - At least 1 point layer with at least 1 non-geometric field and 1 numeric field |
|
105 |
* if they are not correct throws an exception |
|
106 |
* @throws LrsNeededParameterException |
|
107 |
*/ |
|
108 |
public static void validateLayers(LayerCollection layers)throws LrsNeededParameterException { |
|
109 |
logger.debug("Validating layers for Calibrate Route"); |
|
110 |
if (layers==null||layers.getLayersCount()<2){ |
|
111 |
logger.error("Two or more layers are needed"); |
|
112 |
throw new LrsNeededParameterException("two_or_more_layers_are_needed", null); |
|
113 |
} |
|
114 |
|
|
115 |
if (!JLrsUtils.validatedMCurveAndPointLayer(layers)){ |
|
116 |
logger.error("Impossible to find the layers needed"); |
|
117 |
throw new LrsNeededParameterException("impossible_to_find_needed_layers",null); |
|
118 |
} |
|
119 |
} |
|
120 |
|
|
121 |
/** |
|
122 |
* @throws LrsNeededParameterException |
|
123 |
* @throws DataException |
|
124 |
*/ |
|
125 |
private void initComponents() throws LrsNeededParameterException { |
|
126 |
|
|
127 |
// validateLayers(layers); |
|
128 |
|
|
129 |
// FeatureAttributeDescriptorsComboBoxModel idRouteFieldInitialComboBoxModel = |
|
130 |
// new FeatureAttributeDescriptorsComboBoxModel(); |
|
131 |
// FeatureAttributeDescriptorsComboBoxModel idRouteFieldFinalComboBoxModel = |
|
132 |
// new FeatureAttributeDescriptorsComboBoxModel(); |
|
133 |
// |
|
134 |
// // Renderer para los combos de attributeDescriptors |
|
135 |
// ListCellRenderer featureAttributeDescriptorCellRenderer = new FLayersAttributeDescriptorCellRenderer(); |
|
136 |
// // asignaci?n de renderers y modelos |
|
137 |
// pkicombo.setRenderer(featureAttributeDescriptorCellRenderer); |
|
138 |
// pkicombo.setModel(idRouteFieldInitialComboBoxModel); |
|
139 |
// |
|
140 |
// pkfcombo.setRenderer(featureAttributeDescriptorCellRenderer); |
|
141 |
// pkfcombo.setModel(idRouteFieldFinalComboBoxModel); |
|
142 |
// |
|
143 |
|
|
144 |
pkicombo.addActionListener(new ActionListener() { |
|
145 |
@Override |
|
146 |
public void actionPerformed(ActionEvent e) { |
|
147 |
String desc = (String) pkicombo.getSelectedItem(); |
|
148 |
if(desc != null){ |
|
149 |
logger.debug("Selected pk-initial combo option: " + desc); |
|
150 |
params.setPkInicial(desc); |
|
151 |
} |
|
152 |
} |
|
153 |
}); |
|
154 |
|
|
155 |
pkfcombo.addActionListener(new ActionListener() { |
|
156 |
@Override |
|
157 |
public void actionPerformed(ActionEvent e) { |
|
158 |
String desc = (String) pkfcombo.getSelectedItem(); |
|
159 |
if(desc != null){ |
|
160 |
logger.debug("Selected pk-final combo option: " + desc); |
|
161 |
params.setPkFinal(desc); |
|
162 |
} |
|
163 |
} |
|
164 |
}); |
|
165 |
|
|
166 |
if (layer instanceof FLyrVect) { |
|
167 |
FLyrVect lyrVect = (FLyrVect) layer; |
|
168 |
FeatureStore featStore = lyrVect.getFeatureStore(); |
|
169 |
try { |
|
170 |
FeatureType featType = featStore.getDefaultFeatureType(); |
|
171 |
FeatureAttributeDescriptor[] descrips = featType.getAttributeDescriptors(); |
|
172 |
for(int i=0; i<descrips.length; i++){ |
|
173 |
FeatureAttributeDescriptor featureAttributeDescriptor = descrips[i]; |
|
174 |
if (featureAttributeDescriptor.getDataType().isNumeric()) { |
|
175 |
pkicombo.addItem(featureAttributeDescriptor.getName()); |
|
176 |
pkfcombo.addItem(featureAttributeDescriptor.getName()); |
|
177 |
} |
|
178 |
} |
|
179 |
|
|
180 |
if(params != null){ |
|
181 |
pkicombo.setSelectedItem(params.getPkInicial()); |
|
182 |
pkfcombo.setSelectedItem(params.getPkFinal()); |
|
183 |
} |
|
184 |
|
|
185 |
routestable = new FeatureTablePanel(featStore); |
|
186 |
//routestable.setSelectionUp(true); |
|
187 |
|
|
188 |
//int selectIdx = routestable.getTable().getSelectedRow(); |
|
189 |
//routestable.getTable().getSelectionModel().setSelectionInterval(selectIdx, selectIdx); |
|
190 |
//routestable.getTable().scrollRectToVisible(new Rectangle(routestable.getTable().getCellRect(selectIdx, 0, true))); |
|
191 |
|
|
192 |
CellConstraints cc = new CellConstraints(); |
|
193 |
routestable.setName("routestable"); |
|
194 |
jLrsCalculateMRoutePanel.add(routestable,cc.xyw(1,5,5)); |
|
195 |
|
|
196 |
|
|
197 |
} catch (BaseException e) { |
|
198 |
throw new LrsNeededParameterException(e); |
|
199 |
} |
|
200 |
|
|
201 |
|
|
202 |
} |
|
203 |
|
|
204 |
|
|
205 |
canceled = false; |
|
206 |
} |
|
207 |
|
|
208 |
|
|
209 |
|
|
210 |
public boolean isCanceled() { |
|
211 |
return this.canceled; |
|
212 |
} |
|
213 |
|
|
214 |
|
|
215 |
public JComponent asJComponent() { |
|
216 |
return this; |
|
217 |
} |
|
218 |
|
|
219 |
|
|
220 |
@Override |
|
221 |
public Dimension getPreferredSize() { |
|
222 |
return new Dimension(650, 350); |
|
223 |
} |
|
224 |
|
|
225 |
public LrsAlgorithmParams getParams() throws LrsGettingParametersException, LrsNeededParameterException { |
|
226 |
// TODO Auto-generated method stub |
|
227 |
return null; |
|
228 |
} |
|
229 |
|
|
230 |
public void setParams(LrsAlgorithmParams params) { |
|
231 |
// TODO Auto-generated method stub |
|
232 |
|
|
233 |
} |
|
234 |
|
|
235 |
public void clear() { |
|
236 |
// TODO Auto-generated method stub |
|
237 |
|
|
238 |
} |
|
239 |
|
|
240 |
public void setVisibleAceptCancel(boolean visible) { |
|
241 |
// TODO Auto-generated method stub |
|
242 |
|
|
243 |
} |
|
244 |
|
|
245 |
public boolean getVisibleAceptCancel() { |
|
246 |
// TODO Auto-generated method stub |
|
247 |
return false; |
|
248 |
} |
|
249 |
|
|
250 |
|
|
251 |
|
|
252 |
} |
|
0 | 253 |
org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/DefaultLrsAlgorithmsSwingLibrary.java | ||
---|---|---|
36 | 36 |
*/ |
37 | 37 |
public class DefaultLrsAlgorithmsSwingLibrary extends AbstractLibrary { |
38 | 38 |
|
39 |
@Override |
|
39 |
|
|
40 |
|
|
41 |
@Override |
|
40 | 42 |
public void doRegistration() { |
41 | 43 |
registerAsImplementationOf(LrsAlgorithmsSwingLibrary.class); |
42 | 44 |
} |
... | ... | |
48 | 50 |
|
49 | 51 |
@Override |
50 | 52 |
protected void doPostInitialize() throws LibraryException { |
51 |
} |
|
52 | 53 |
|
54 |
} |
|
55 |
|
|
53 | 56 |
} |
org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/pom.xml | ||
---|---|---|
36 | 36 |
</dependency> |
37 | 37 |
<dependency> |
38 | 38 |
<groupId>org.gvsig</groupId> |
39 |
<artifactId>org.gvsig.fmap.control</artifactId> |
|
40 |
</dependency> |
|
41 |
<dependency> |
|
42 |
<groupId>org.gvsig</groupId> |
|
39 | 43 |
<artifactId>org.gvsig.newlayer.lib.api</artifactId> |
40 | 44 |
</dependency> |
41 | 45 |
<dependency> |
42 | 46 |
org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.app/pom.xml | ||
---|---|---|
7 | 7 |
</parent> |
8 | 8 |
<groupId>org.gvsig</groupId> |
9 | 9 |
<artifactId>org.gvsig.lrs.app</artifactId> |
10 |
<version>1.0.3-SNAPSHOT</version> |
|
11 | 10 |
<packaging>pom</packaging> |
12 | 11 |
<name>org.gvsig.lrs.app</name> |
13 | 12 |
|
Also available in: Unified diff