Revision 287
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.43/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.lrs.swing.api.LrsAlgorithmsSwingLibrary |
|
0 | 2 |
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.43/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/tags/org.gvsig.lrs-1.0.43/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/JLrsGenerateDynamicSegmentationAlgorithmParams.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.lrs.swing.api; |
|
24 |
|
|
25 |
|
|
26 |
/** |
|
27 |
* @author fdiaz |
|
28 |
* |
|
29 |
*/ |
|
30 |
public interface JLrsGenerateDynamicSegmentationAlgorithmParams extends JLrsAlgorithmParams { |
|
31 |
|
|
32 |
} |
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.43/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/JLrsAlgorithmParams.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.lrs.swing.api; |
|
24 |
|
|
25 |
import java.awt.event.ActionListener; |
|
26 |
|
|
27 |
import org.gvsig.lrs.lib.api.LrsAlgorithmParams; |
|
28 |
import org.gvsig.lrs.lib.api.exceptions.LrsGettingParametersException; |
|
29 |
import org.gvsig.lrs.lib.api.exceptions.LrsNeededParameterException; |
|
30 |
import org.gvsig.tools.dynobject.DynObject; |
|
31 |
import org.gvsig.tools.swing.api.Component; |
|
32 |
|
|
33 |
|
|
34 |
/** |
|
35 |
* @author fdiaz |
|
36 |
* |
|
37 |
*/ |
|
38 |
public interface JLrsAlgorithmParams extends Component { |
|
39 |
|
|
40 |
public LrsAlgorithmParams getParams() throws LrsGettingParametersException, LrsNeededParameterException; |
|
41 |
|
|
42 |
public void setParams(LrsAlgorithmParams params); |
|
43 |
|
|
44 |
public void clear(); |
|
45 |
|
|
46 |
public boolean isCanceled(); |
|
47 |
|
|
48 |
public void setVisibleAceptCancel(boolean visible); |
|
49 |
|
|
50 |
public boolean getVisibleAceptCancel(); |
|
51 |
|
|
52 |
public void addActionListener(ActionListener listener); |
|
53 |
|
|
54 |
public void removeActionListener(ActionListener listener); |
|
55 |
} |
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.43/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/LrsAlgorithmsSwingLocator.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.lrs.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 |
/** |
|
31 |
* @author fdiaz |
|
32 |
* |
|
33 |
*/ |
|
34 |
public class LrsAlgorithmsSwingLocator extends AbstractLocator { |
|
35 |
/** |
|
36 |
* LrsSwing locator name |
|
37 |
*/ |
|
38 |
private static final String LOCATOR_NAME = "LrsAlgorithmsSwingLocator"; |
|
39 |
|
|
40 |
/** |
|
41 |
* LrsSwing manager name |
|
42 |
*/ |
|
43 |
public static final String MANAGER_NAME = "LrsAlgorithmsSwingManager"; |
|
44 |
|
|
45 |
/** |
|
46 |
* LrsSwing manager description |
|
47 |
*/ |
|
48 |
private static final String MANAGER_DESCRIPTION = |
|
49 |
"Lrs Swing Algorithms Manager of gvSIG"; |
|
50 |
|
|
51 |
|
|
52 |
/** |
|
53 |
* Unique instance |
|
54 |
*/ |
|
55 |
private static final LrsAlgorithmsSwingLocator instance = new LrsAlgorithmsSwingLocator(); |
|
56 |
|
|
57 |
|
|
58 |
/* (non-Javadoc) |
|
59 |
* @see org.gvsig.tools.locator.Locator#getLocatorName() |
|
60 |
*/ |
|
61 |
public String getLocatorName() { |
|
62 |
return LOCATOR_NAME; |
|
63 |
} |
|
64 |
|
|
65 |
|
|
66 |
/** |
|
67 |
* Registers the Class implementing the LrsSwingManager interface. |
|
68 |
* |
|
69 |
* @param clazz |
|
70 |
* implementing the LrsAlgorthmsSwingManager interface |
|
71 |
*/ |
|
72 |
public static void registerLrsAlgorithmsSwingManager(Class clazz){ |
|
73 |
getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
|
74 |
} |
|
75 |
|
|
76 |
/** |
|
77 |
* Registers the default Class implementing the LrsSwingManager interface |
|
78 |
* |
|
79 |
* @param clazz |
|
80 |
* implementing the LrsAlgorthmsSwingManager interface |
|
81 |
*/ |
|
82 |
public static void registerDefaultLrsAlgorithmsSwingManager(Class clazz){ |
|
83 |
getInstance().registerDefault(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* Return a reference to LrsAlgorithmsSwingManager. |
|
88 |
* |
|
89 |
* @return a reference to LrsAlgorithmsSwingManager |
|
90 |
* @throws LocatorException |
|
91 |
* if there is no access to the class or the class |
|
92 |
* cannot be instantiated |
|
93 |
* @see Locator#get(String) |
|
94 |
*/ |
|
95 |
public static LrsAlgorithmsSwingManager getLrsAlgorithmsSwingManager() throws LocatorException { |
|
96 |
return (LrsAlgorithmsSwingManager)(getInstance().get(MANAGER_NAME)); |
|
97 |
} |
|
98 |
|
|
99 |
/** |
|
100 |
* @return |
|
101 |
*/ |
|
102 |
public static Locator getInstance() { |
|
103 |
return instance; |
|
104 |
} |
|
105 |
|
|
106 |
} |
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.43/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/LrsAlgorithmsSwingLibrary.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.lrs.swing.api; |
|
24 |
|
|
25 |
import java.io.InputStream; |
|
26 |
|
|
27 |
import org.gvsig.tools.ToolsLocator; |
|
28 |
import org.gvsig.tools.dynobject.DynStruct; |
|
29 |
import org.gvsig.tools.library.AbstractLibrary; |
|
30 |
import org.gvsig.tools.library.LibraryException; |
|
31 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
32 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
33 |
import org.slf4j.Logger; |
|
34 |
import org.slf4j.LoggerFactory; |
|
35 |
|
|
36 |
|
|
37 |
/** |
|
38 |
* @author fdiaz |
|
39 |
* |
|
40 |
*/ |
|
41 |
public class LrsAlgorithmsSwingLibrary extends AbstractLibrary { |
|
42 |
|
|
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 |
} |
|
96 |
|
|
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 |
} |
|
109 |
|
|
110 |
|
|
111 |
} |
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.43/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/JLrsCreateRouteAlgorithmParams.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.lrs.swing.api; |
|
24 |
|
|
25 |
|
|
26 |
/** |
|
27 |
* @author fdiaz |
|
28 |
* |
|
29 |
*/ |
|
30 |
public interface JLrsCreateRouteAlgorithmParams extends JLrsAlgorithmParams { |
|
31 |
|
|
32 |
} |
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.43/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/JLrsCalibrateRouteAlgorithmParams.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.lrs.swing.api; |
|
24 |
|
|
25 |
|
|
26 |
/** |
|
27 |
* @author fdiaz |
|
28 |
* |
|
29 |
*/ |
|
30 |
public interface JLrsCalibrateRouteAlgorithmParams extends JLrsAlgorithmParams { |
|
31 |
|
|
32 |
} |
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.43/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/LrsAlgorithmsSwingManager.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.lrs.swing.api; |
|
24 |
|
|
25 |
import java.util.List; |
|
26 |
|
|
27 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
28 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
29 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
30 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
31 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
32 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
33 |
import org.gvsig.lrs.lib.api.LrsCalibrateRouteAlgorithmParams; |
|
34 |
import org.gvsig.lrs.lib.api.LrsCreateRouteAlgorithmParams; |
|
35 |
import org.gvsig.lrs.lib.api.LrsEditRouteCalibrationAlgorithmParams; |
|
36 |
import org.gvsig.lrs.lib.api.LrsEditRouteCalibrationSelectIdRouteAlgorithmParams; |
|
37 |
import org.gvsig.lrs.lib.api.LrsGenerateDynamicSegmentationAlgorithmParams; |
|
38 |
import org.gvsig.lrs.lib.api.LrsShowMeasuresAlgorithmParams; |
|
39 |
import org.gvsig.lrs.lib.api.exceptions.LrsGettingParametersException; |
|
40 |
import org.gvsig.lrs.lib.api.exceptions.LrsNeededParameterException; |
|
41 |
import org.gvsig.tools.dynobject.DynObject; |
|
42 |
import org.gvsig.tools.service.Manager; |
|
43 |
import org.gvsig.tools.task.TaskStatus; |
|
44 |
|
|
45 |
|
|
46 |
/** |
|
47 |
* @author fdiaz |
|
48 |
* |
|
49 |
*/ |
|
50 |
public interface LrsAlgorithmsSwingManager extends Manager { |
|
51 |
|
|
52 |
public JLrsAlgorithmParams createJLrsCreateRouteAlgorithmParameters(FLayers layers, LrsCreateRouteAlgorithmParams parameters) throws LrsNeededParameterException; |
|
53 |
|
|
54 |
public JLrsProgressDialog createJLrsProgressDialog(TaskStatus taskStatus); |
|
55 |
|
|
56 |
public JLrsAlgorithmParams createJLrsCalibrateRouteAlgorithmParameters(FLayers layers, LrsCalibrateRouteAlgorithmParams parameters) throws LrsNeededParameterException; |
|
57 |
|
|
58 |
public JLrsAlgorithmParams createJLrsEditRouteCalibrationSelectIdRouteAlgorithmParameters(FLayer layer, LrsEditRouteCalibrationSelectIdRouteAlgorithmParams parameters) throws LrsNeededParameterException; |
|
59 |
|
|
60 |
public JLrsAlgorithmParams createJLrsEditRouteCalibrationAlgorithmParameters(FLayer layer, MapContext mapContext, FeatureAttributeDescriptor selectedIdRoute, LrsEditRouteCalibrationAlgorithmParams parameters) throws LrsNeededParameterException, LrsGettingParametersException; |
|
61 |
|
|
62 |
public JLrsAlgorithmParams createJLrsShowMeasuresAlgorithmParameters(FLayer layer, LrsShowMeasuresAlgorithmParams parameters) throws LrsNeededParameterException; |
|
63 |
|
|
64 |
public JLrsAlgorithmParams createJLrsGenerateDynamicSegmentationAlgorithmParameters(FLayers layers, List<FeatureStore> tables, LrsGenerateDynamicSegmentationAlgorithmParams parameters) throws LrsNeededParameterException; |
|
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 |
|
|
74 |
} |
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.43/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/tags/org.gvsig.lrs-1.0.43/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/JLrsProgressDialog.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.lrs.swing.api; |
|
24 |
|
|
25 |
import java.awt.event.ActionListener; |
|
26 |
|
|
27 |
import org.gvsig.tools.swing.api.Component; |
|
28 |
|
|
29 |
|
|
30 |
/** |
|
31 |
* @author fdiaz |
|
32 |
* |
|
33 |
*/ |
|
34 |
public interface JLrsProgressDialog extends Component { |
|
35 |
public boolean isCanceled(); |
|
36 |
|
|
37 |
public void addActionListener(ActionListener listener); |
|
38 |
|
|
39 |
public void removeActionListener(ActionListener listener); |
|
40 |
} |
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.43/org.gvsig.lrs.swing/org.gvsig.lrs.swing.api/src/main/java/org/gvsig/lrs/swing/api/JLrsEditRouteCalibrationAlgorithmParams.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.lrs.swing.api; |
|
24 |
|
|
25 |
|
|
26 |
/** |
|
27 |
* @author fdiaz |
|
28 |
* |
|
29 |
*/ |
|
30 |
public interface JLrsEditRouteCalibrationAlgorithmParams extends JLrsAlgorithmParams { |
|
31 |
|
|
32 |
} |
|
0 | 33 |
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.43/org.gvsig.lrs.swing/org.gvsig.lrs.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.lrs.swing</artifactId> |
|
6 |
<version>1.0.43</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.lrs.swing.api</artifactId> |
|
9 |
<name>${project.artifactId}</name> |
|
10 |
<dependencies> |
|
11 |
<dependency> |
|
12 |
<groupId>org.gvsig</groupId> |
|
13 |
<artifactId>org.gvsig.fmap.mapcontext.api</artifactId> |
|
14 |
</dependency> |
|
15 |
<dependency> |
|
16 |
<groupId>org.gvsig</groupId> |
|
17 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
18 |
</dependency> |
|
19 |
<dependency> |
|
20 |
<groupId>org.gvsig</groupId> |
|
21 |
<artifactId>org.gvsig.lrs.lib.api</artifactId> |
|
22 |
</dependency> |
|
23 |
</dependencies> |
|
24 |
</project> |
|
0 | 25 |
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.43/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/FeatureStoresComboBoxModel.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.lrs.swing.impl; |
|
24 |
|
|
25 |
import java.util.ArrayList; |
|
26 |
import java.util.List; |
|
27 |
|
|
28 |
import javax.swing.AbstractListModel; |
|
29 |
import javax.swing.MutableComboBoxModel; |
|
30 |
|
|
31 |
import org.slf4j.Logger; |
|
32 |
import org.slf4j.LoggerFactory; |
|
33 |
|
|
34 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
35 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
36 |
|
|
37 |
/** |
|
38 |
* @author dmartinez |
|
39 |
* |
|
40 |
*/ |
|
41 |
public class FeatureStoresComboBoxModel extends AbstractListModel<FeatureStore> implements MutableComboBoxModel<FeatureStore> { |
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
private static final Logger logger = LoggerFactory.getLogger(FeatureStoresComboBoxModel.class); |
|
46 |
|
|
47 |
private List<FeatureStore> featureStores; |
|
48 |
private FeatureStore selected; |
|
49 |
|
|
50 |
/** |
|
51 |
* |
|
52 |
*/ |
|
53 |
public FeatureStoresComboBoxModel(List<FeatureStore> featureStores) { |
|
54 |
this.featureStores = featureStores; |
|
55 |
} |
|
56 |
|
|
57 |
/* |
|
58 |
* (non-Javadoc) |
|
59 |
* |
|
60 |
* @see javax.swing.ListModel#getSize() |
|
61 |
*/ |
|
62 |
public int getSize() { |
|
63 |
return featureStores.size(); |
|
64 |
} |
|
65 |
|
|
66 |
/* |
|
67 |
* (non-Javadoc) |
|
68 |
* |
|
69 |
* @see javax.swing.ListModel#getElementAt(int) |
|
70 |
*/ |
|
71 |
public FeatureStore getElementAt(int index) { |
|
72 |
return featureStores.get(index); |
|
73 |
} |
|
74 |
|
|
75 |
/* |
|
76 |
* (non-Javadoc) |
|
77 |
* |
|
78 |
* @see javax.swing.ComboBoxModel#setSelectedItem(java.lang.Object) |
|
79 |
*/ |
|
80 |
public void setSelectedItem(final Object anItem) { |
|
81 |
selected = (FeatureStore) anItem; |
|
82 |
fireContentsChanged(this, -1, -1); |
|
83 |
} |
|
84 |
|
|
85 |
/* |
|
86 |
* (non-Javadoc) |
|
87 |
* |
|
88 |
* @see javax.swing.ComboBoxModel#getSelectedItem() |
|
89 |
*/ |
|
90 |
public Object getSelectedItem() { |
|
91 |
return selected; |
|
92 |
} |
|
93 |
|
|
94 |
/* (non-Javadoc) |
|
95 |
* @see javax.swing.MutableComboBoxModel#addElement(java.lang.Object) |
|
96 |
*/ |
|
97 |
public void addElement(FeatureStore item) { |
|
98 |
featureStores.add(item); |
|
99 |
fireIntervalAdded(this, featureStores.size()-1, featureStores.size()-1); |
|
100 |
} |
|
101 |
|
|
102 |
/* (non-Javadoc) |
|
103 |
* @see javax.swing.MutableComboBoxModel#removeElement(java.lang.Object) |
|
104 |
*/ |
|
105 |
public void removeElement(Object obj) { |
|
106 |
int index = featureStores.indexOf(obj); |
|
107 |
featureStores.remove(obj); |
|
108 |
fireIntervalRemoved(this, index, index); |
|
109 |
} |
|
110 |
|
|
111 |
/* (non-Javadoc) |
|
112 |
* @see javax.swing.MutableComboBoxModel#insertElementAt(java.lang.Object, int) |
|
113 |
*/ |
|
114 |
public void insertElementAt(FeatureStore item, int index) { |
|
115 |
featureStores.add(index, item); |
|
116 |
fireIntervalAdded(this, index, index); |
|
117 |
} |
|
118 |
|
|
119 |
/* (non-Javadoc) |
|
120 |
* @see javax.swing.MutableComboBoxModel#removeElementAt(int) |
|
121 |
*/ |
|
122 |
public void removeElementAt(int index) { |
|
123 |
featureStores.remove(index); |
|
124 |
fireIntervalRemoved(this, index, index); |
|
125 |
} |
|
126 |
|
|
127 |
} |
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.43/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/JLrsEditRouteCalibrationParamsView.java | ||
---|---|---|
1 |
package org.gvsig.lrs.swing.impl; |
|
2 |
|
|
3 |
import com.jgoodies.forms.layout.CellConstraints; |
|
4 |
import com.jgoodies.forms.layout.FormLayout; |
|
5 |
import java.awt.BorderLayout; |
|
6 |
import java.awt.ComponentOrientation; |
|
7 |
import java.awt.Container; |
|
8 |
import java.awt.Dimension; |
|
9 |
import javax.swing.Box; |
|
10 |
import javax.swing.ImageIcon; |
|
11 |
import javax.swing.JButton; |
|
12 |
import javax.swing.JComboBox; |
|
13 |
import javax.swing.JFrame; |
|
14 |
import javax.swing.JLabel; |
|
15 |
import javax.swing.JPanel; |
|
16 |
import javax.swing.JScrollPane; |
|
17 |
import javax.swing.JTable; |
|
18 |
import javax.swing.JTextField; |
|
19 |
|
|
20 |
|
|
21 |
public class JLrsEditRouteCalibrationParamsView extends JPanel |
|
22 |
{ |
|
23 |
JLabel lblIdRouteField = new JLabel(); |
|
24 |
JLabel lblMinimum = new JLabel(); |
|
25 |
JLabel lblMaximum = new JLabel(); |
|
26 |
JTable tblLayerInfo = new JTable(); |
|
27 |
JButton btnInvert = new JButton(); |
|
28 |
JButton btnApply = new JButton(); |
|
29 |
JButton btnAccept = new JButton(); |
|
30 |
JButton btnCancel = new JButton(); |
|
31 |
JComboBox cmbRoute = new JComboBox(); |
|
32 |
JTextField txtMaximum = new JTextField(); |
|
33 |
JTextField txtMinimum = new JTextField(); |
|
34 |
|
|
35 |
/** |
|
36 |
* Default constructor |
|
37 |
*/ |
|
38 |
public JLrsEditRouteCalibrationParamsView() |
|
39 |
{ |
|
40 |
initializePanel(); |
|
41 |
} |
|
42 |
|
|
43 |
/** |
|
44 |
* Adds fill components to empty cells in the first row and first column of the grid. |
|
45 |
* This ensures that the grid spacing will be the same as shown in the designer. |
|
46 |
* @param cols an array of column indices in the first row where fill components should be added. |
|
47 |
* @param rows an array of row indices in the first column where fill components should be added. |
|
48 |
*/ |
|
49 |
void addFillComponents( Container panel, int[] cols, int[] rows ) |
|
50 |
{ |
|
51 |
Dimension filler = new Dimension(10,10); |
|
52 |
|
|
53 |
boolean filled_cell_11 = false; |
|
54 |
CellConstraints cc = new CellConstraints(); |
|
55 |
if ( cols.length > 0 && rows.length > 0 ) |
|
56 |
{ |
|
57 |
if ( cols[0] == 1 && rows[0] == 1 ) |
|
58 |
{ |
|
59 |
/** add a rigid area */ |
|
60 |
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); |
|
61 |
filled_cell_11 = true; |
|
62 |
} |
|
63 |
} |
|
64 |
|
|
65 |
for( int index = 0; index < cols.length; index++ ) |
|
66 |
{ |
|
67 |
if ( cols[index] == 1 && filled_cell_11 ) |
|
68 |
{ |
|
69 |
continue; |
|
70 |
} |
|
71 |
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); |
|
72 |
} |
|
73 |
|
|
74 |
for( int index = 0; index < rows.length; index++ ) |
|
75 |
{ |
|
76 |
if ( rows[index] == 1 && filled_cell_11 ) |
|
77 |
{ |
|
78 |
continue; |
|
79 |
} |
|
80 |
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); |
|
81 |
} |
|
82 |
|
|
83 |
} |
|
84 |
|
|
85 |
/** |
|
86 |
* Helper method to load an image file from the CLASSPATH |
|
87 |
* @param imageName the package and name of the file to load relative to the CLASSPATH |
|
88 |
* @return an ImageIcon instance with the specified image file |
|
89 |
* @throws IllegalArgumentException if the image resource cannot be loaded. |
|
90 |
*/ |
|
91 |
public ImageIcon loadImage( String imageName ) |
|
92 |
{ |
|
93 |
try |
|
94 |
{ |
|
95 |
ClassLoader classloader = getClass().getClassLoader(); |
|
96 |
java.net.URL url = classloader.getResource( imageName ); |
|
97 |
if ( url != null ) |
|
98 |
{ |
|
99 |
ImageIcon icon = new ImageIcon( url ); |
|
100 |
return icon; |
|
101 |
} |
|
102 |
} |
|
103 |
catch( Exception e ) |
|
104 |
{ |
|
105 |
e.printStackTrace(); |
|
106 |
} |
|
107 |
throw new IllegalArgumentException( "Unable to load image: " + imageName ); |
|
108 |
} |
|
109 |
|
|
110 |
/** |
|
111 |
* Method for recalculating the component orientation for |
|
112 |
* right-to-left Locales. |
|
113 |
* @param orientation the component orientation to be applied |
|
114 |
*/ |
|
115 |
public void applyComponentOrientation( ComponentOrientation orientation ) |
|
116 |
{ |
|
117 |
// Not yet implemented... |
|
118 |
// I18NUtils.applyComponentOrientation(this, orientation); |
|
119 |
super.applyComponentOrientation(orientation); |
|
120 |
} |
|
121 |
|
|
122 |
public JPanel createPanel() |
|
123 |
{ |
|
124 |
JPanel jpanel1 = new JPanel(); |
|
125 |
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:120PX:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:73PX:GROW(1.0),FILL:4DLU:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:74PX:GROW(1.0),FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:4DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE"); |
|
126 |
CellConstraints cc = new CellConstraints(); |
|
127 |
jpanel1.setLayout(formlayout1); |
|
128 |
|
|
129 |
lblIdRouteField.setName("lblIdRouteField"); |
|
130 |
lblIdRouteField.setText("id_route_field"); |
|
131 |
jpanel1.add(lblIdRouteField,cc.xy(2,4)); |
|
132 |
|
|
133 |
lblMinimum.setName("lblMinimum"); |
|
134 |
lblMinimum.setText("minimum"); |
|
135 |
jpanel1.add(lblMinimum,cc.xy(6,4)); |
|
136 |
|
|
137 |
lblMaximum.setName("lblMaximum"); |
|
138 |
lblMaximum.setText("maximum"); |
|
139 |
jpanel1.add(lblMaximum,cc.xy(10,4)); |
|
140 |
|
|
141 |
tblLayerInfo.setName("tblLayerInfo"); |
|
142 |
JScrollPane jscrollpane1 = new JScrollPane(); |
|
143 |
jscrollpane1.setViewportView(tblLayerInfo); |
|
144 |
jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); |
|
145 |
jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
|
146 |
jpanel1.add(jscrollpane1,cc.xywh(2,2,11,1)); |
|
147 |
|
|
148 |
jpanel1.add(createPanel1(),new CellConstraints(2,6,11,1,CellConstraints.RIGHT,CellConstraints.DEFAULT)); |
|
149 |
jpanel1.add(createPanel2(),new CellConstraints(2,8,11,1,CellConstraints.RIGHT,CellConstraints.DEFAULT)); |
|
150 |
cmbRoute.setName("cmbRoute"); |
|
151 |
jpanel1.add(cmbRoute,cc.xy(4,4)); |
|
152 |
|
|
153 |
txtMaximum.setName("txtMaximum"); |
|
154 |
jpanel1.add(txtMaximum,cc.xy(12,4)); |
|
155 |
|
|
156 |
txtMinimum.setName("txtMinimum"); |
|
157 |
jpanel1.add(txtMinimum,cc.xy(8,4)); |
|
158 |
|
|
159 |
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 },new int[]{ 1,2,3,4,5,6,7,8,9 }); |
|
160 |
return jpanel1; |
|
161 |
} |
|
162 |
|
|
163 |
public JPanel createPanel1() |
|
164 |
{ |
|
165 |
JPanel jpanel1 = new JPanel(); |
|
166 |
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE"); |
|
167 |
CellConstraints cc = new CellConstraints(); |
|
168 |
jpanel1.setLayout(formlayout1); |
|
169 |
|
|
170 |
btnInvert.setActionCommand("_Invert"); |
|
171 |
btnInvert.setName("btnInvert"); |
|
172 |
btnInvert.setText("_Invert"); |
|
173 |
jpanel1.add(btnInvert,new CellConstraints(1,1,1,1,CellConstraints.CENTER,CellConstraints.DEFAULT)); |
|
174 |
|
|
175 |
btnApply.setActionCommand("_Apply"); |
|
176 |
btnApply.setName("btnApply"); |
|
177 |
btnApply.setText("_Apply"); |
|
178 |
jpanel1.add(btnApply,cc.xy(3,1)); |
|
179 |
|
|
180 |
addFillComponents(jpanel1,new int[]{ 2 },new int[0]); |
|
181 |
return jpanel1; |
|
182 |
} |
|
183 |
|
|
184 |
public JPanel createPanel2() |
|
185 |
{ |
|
186 |
JPanel jpanel1 = new JPanel(); |
|
187 |
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE"); |
|
188 |
CellConstraints cc = new CellConstraints(); |
|
189 |
jpanel1.setLayout(formlayout1); |
|
190 |
|
|
191 |
btnAccept.setActionCommand("_Accept"); |
|
192 |
btnAccept.setName("btnAccept"); |
|
193 |
btnAccept.setText("_Accept"); |
|
194 |
jpanel1.add(btnAccept,new CellConstraints(1,1,1,1,CellConstraints.CENTER,CellConstraints.DEFAULT)); |
|
195 |
|
|
196 |
btnCancel.setActionCommand("_Cancel"); |
|
197 |
btnCancel.setName("btnCancel"); |
|
198 |
btnCancel.setText("_Cancel"); |
|
199 |
jpanel1.add(btnCancel,cc.xy(3,1)); |
|
200 |
|
|
201 |
addFillComponents(jpanel1,new int[]{ 2 },new int[0]); |
|
202 |
return jpanel1; |
|
203 |
} |
|
204 |
|
|
205 |
/** |
|
206 |
* Initializer |
|
207 |
*/ |
|
208 |
protected void initializePanel() |
|
209 |
{ |
|
210 |
setLayout(new BorderLayout()); |
|
211 |
add(createPanel(), BorderLayout.CENTER); |
|
212 |
} |
|
213 |
|
|
214 |
|
|
215 |
} |
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.43/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/JLrsGenerateDynamicSegmentationParamsView.java | ||
---|---|---|
1 |
package org.gvsig.lrs.swing.impl; |
|
2 |
|
|
3 |
import com.jgoodies.forms.layout.CellConstraints; |
|
4 |
import com.jgoodies.forms.layout.FormLayout; |
|
5 |
import java.awt.BorderLayout; |
|
6 |
import java.awt.ComponentOrientation; |
|
7 |
import java.awt.Container; |
|
8 |
import java.awt.Dimension; |
|
9 |
import javax.swing.Box; |
|
10 |
import javax.swing.ImageIcon; |
|
11 |
import javax.swing.JButton; |
|
12 |
import javax.swing.JComboBox; |
|
13 |
import javax.swing.JFrame; |
|
14 |
import javax.swing.JLabel; |
|
15 |
import javax.swing.JPanel; |
|
16 |
import javax.swing.JTextField; |
|
17 |
|
|
18 |
|
|
19 |
public class JLrsGenerateDynamicSegmentationParamsView extends JPanel |
|
20 |
{ |
|
21 |
JLabel lblInputLayer = new JLabel(); |
|
22 |
JComboBox cmbInputLayer = new JComboBox(); |
|
23 |
JLabel lblIdRouteField = new JLabel(); |
|
24 |
JComboBox cmbIdRouteField = new JComboBox(); |
|
25 |
JLabel lblTable = new JLabel(); |
|
26 |
JComboBox cmbTable = new JComboBox(); |
|
27 |
JLabel lblTableIdRouteField = new JLabel(); |
|
28 |
JComboBox cmbTableIdRouteField = new JComboBox(); |
|
29 |
JLabel lblLandmarkField = new JLabel(); |
|
30 |
JComboBox cmbLandmarkField = new JComboBox(); |
|
31 |
JLabel lblFinalLandmarkField = new JLabel(); |
|
32 |
JLabel lblValueField = new JLabel(); |
|
33 |
JComboBox cmbFinalLandmarkField = new JComboBox(); |
|
34 |
JComboBox cmbValueField = new JComboBox(); |
|
35 |
JLabel lblOutputFile = new JLabel(); |
|
36 |
JTextField txtOutputFile = new JTextField(); |
|
37 |
JButton btnBrowser = new JButton(); |
|
38 |
JButton btnAccept = new JButton(); |
|
39 |
JButton btnCancel = new JButton(); |
|
40 |
|
|
41 |
/** |
|
42 |
* Default constructor |
|
43 |
*/ |
|
44 |
public JLrsGenerateDynamicSegmentationParamsView() |
|
45 |
{ |
|
46 |
initializePanel(); |
|
47 |
} |
|
48 |
|
|
49 |
/** |
|
50 |
* Adds fill components to empty cells in the first row and first column of the grid. |
|
51 |
* This ensures that the grid spacing will be the same as shown in the designer. |
|
52 |
* @param cols an array of column indices in the first row where fill components should be added. |
|
53 |
* @param rows an array of row indices in the first column where fill components should be added. |
|
54 |
*/ |
|
55 |
void addFillComponents( Container panel, int[] cols, int[] rows ) |
|
56 |
{ |
|
57 |
Dimension filler = new Dimension(10,10); |
|
58 |
|
|
59 |
boolean filled_cell_11 = false; |
|
60 |
CellConstraints cc = new CellConstraints(); |
|
61 |
if ( cols.length > 0 && rows.length > 0 ) |
|
62 |
{ |
|
63 |
if ( cols[0] == 1 && rows[0] == 1 ) |
|
64 |
{ |
|
65 |
/** add a rigid area */ |
|
66 |
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); |
|
67 |
filled_cell_11 = true; |
|
68 |
} |
|
69 |
} |
|
70 |
|
|
71 |
for( int index = 0; index < cols.length; index++ ) |
|
72 |
{ |
|
73 |
if ( cols[index] == 1 && filled_cell_11 ) |
|
74 |
{ |
|
75 |
continue; |
|
76 |
} |
|
77 |
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); |
|
78 |
} |
|
79 |
|
|
80 |
for( int index = 0; index < rows.length; index++ ) |
|
81 |
{ |
|
82 |
if ( rows[index] == 1 && filled_cell_11 ) |
|
83 |
{ |
|
84 |
continue; |
|
85 |
} |
|
86 |
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); |
|
87 |
} |
|
88 |
|
|
89 |
} |
|
90 |
|
|
91 |
/** |
|
92 |
* Helper method to load an image file from the CLASSPATH |
|
93 |
* @param imageName the package and name of the file to load relative to the CLASSPATH |
|
94 |
* @return an ImageIcon instance with the specified image file |
|
95 |
* @throws IllegalArgumentException if the image resource cannot be loaded. |
|
96 |
*/ |
|
97 |
public ImageIcon loadImage( String imageName ) |
|
98 |
{ |
|
99 |
try |
|
100 |
{ |
|
101 |
ClassLoader classloader = getClass().getClassLoader(); |
|
102 |
java.net.URL url = classloader.getResource( imageName ); |
|
103 |
if ( url != null ) |
|
104 |
{ |
|
105 |
ImageIcon icon = new ImageIcon( url ); |
|
106 |
return icon; |
|
107 |
} |
|
108 |
} |
|
109 |
catch( Exception e ) |
|
110 |
{ |
|
111 |
e.printStackTrace(); |
|
112 |
} |
|
113 |
throw new IllegalArgumentException( "Unable to load image: " + imageName ); |
|
114 |
} |
|
115 |
|
|
116 |
/** |
|
117 |
* Method for recalculating the component orientation for |
|
118 |
* right-to-left Locales. |
|
119 |
* @param orientation the component orientation to be applied |
|
120 |
*/ |
|
121 |
public void applyComponentOrientation( ComponentOrientation orientation ) |
|
122 |
{ |
|
123 |
// Not yet implemented... |
|
124 |
// I18NUtils.applyComponentOrientation(this, orientation); |
|
125 |
super.applyComponentOrientation(orientation); |
|
126 |
} |
|
127 |
|
|
128 |
public JPanel createPanel() |
|
129 |
{ |
|
130 |
JPanel jpanel1 = new JPanel(); |
|
131 |
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:256PX:GROW(1.0),FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:2DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:NONE"); |
|
132 |
CellConstraints cc = new CellConstraints(); |
|
133 |
jpanel1.setLayout(formlayout1); |
|
134 |
|
|
135 |
lblInputLayer.setName("lblInputLayer"); |
|
136 |
lblInputLayer.setText("source"); |
|
137 |
jpanel1.add(lblInputLayer,cc.xy(2,2)); |
|
138 |
|
|
139 |
cmbInputLayer.setName("cmbInputLayer"); |
|
140 |
jpanel1.add(cmbInputLayer,cc.xy(4,2)); |
|
141 |
|
|
142 |
lblIdRouteField.setName("lblIdRouteField"); |
|
143 |
lblIdRouteField.setText("id_route_field"); |
|
144 |
jpanel1.add(lblIdRouteField,cc.xy(2,3)); |
|
145 |
|
|
146 |
cmbIdRouteField.setName("cmbIdRouteField"); |
|
147 |
jpanel1.add(cmbIdRouteField,cc.xy(4,3)); |
|
148 |
|
|
149 |
lblTable.setName("lblTable"); |
|
150 |
lblTable.setText("table"); |
|
151 |
jpanel1.add(lblTable,cc.xy(2,4)); |
|
152 |
|
|
153 |
cmbTable.setName("cmbTable"); |
|
154 |
jpanel1.add(cmbTable,cc.xy(4,4)); |
|
155 |
|
|
156 |
lblTableIdRouteField.setName("lblTableIdRouteField"); |
|
157 |
lblTableIdRouteField.setText("table_id_route_field"); |
|
158 |
jpanel1.add(lblTableIdRouteField,cc.xy(2,5)); |
|
159 |
|
|
160 |
cmbTableIdRouteField.setName("cmbTableIdRouteField"); |
|
161 |
jpanel1.add(cmbTableIdRouteField,cc.xy(4,5)); |
|
162 |
|
|
163 |
lblLandmarkField.setName("lblLandmarkField"); |
|
164 |
lblLandmarkField.setText("landmark_field"); |
|
165 |
jpanel1.add(lblLandmarkField,cc.xy(2,6)); |
|
166 |
|
|
167 |
cmbLandmarkField.setName("cmbLandmarkField"); |
|
168 |
jpanel1.add(cmbLandmarkField,cc.xy(4,6)); |
|
169 |
|
|
170 |
lblFinalLandmarkField.setName("lblFinalLandmarkField"); |
|
171 |
lblFinalLandmarkField.setText("final_landmark_field"); |
|
172 |
jpanel1.add(lblFinalLandmarkField,cc.xy(2,7)); |
|
173 |
|
|
174 |
lblValueField.setName("lblValueField"); |
|
175 |
lblValueField.setText("value_field"); |
|
176 |
jpanel1.add(lblValueField,cc.xy(2,8)); |
|
177 |
|
|
178 |
cmbFinalLandmarkField.setName("cmbFinalLandmarkField"); |
|
179 |
jpanel1.add(cmbFinalLandmarkField,cc.xy(4,7)); |
|
180 |
|
|
181 |
cmbValueField.setName("cmbValueField"); |
|
182 |
jpanel1.add(cmbValueField,cc.xy(4,8)); |
|
183 |
|
|
184 |
lblOutputFile.setName("lblOutputFile"); |
|
185 |
lblOutputFile.setText("output_file"); |
|
186 |
jpanel1.add(lblOutputFile,cc.xy(2,9)); |
|
187 |
|
|
188 |
jpanel1.add(createPanel1(),cc.xy(4,9)); |
|
189 |
jpanel1.add(createPanel2(),new CellConstraints(2,12,3,1,CellConstraints.RIGHT,CellConstraints.DEFAULT)); |
|
190 |
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 }); |
|
191 |
return jpanel1; |
|
192 |
} |
|
193 |
|
|
194 |
public JPanel createPanel1() |
|
195 |
{ |
|
196 |
JPanel jpanel1 = new JPanel(); |
|
197 |
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0),FILL:36PX:NONE","CENTER:DEFAULT:NONE"); |
|
198 |
CellConstraints cc = new CellConstraints(); |
|
199 |
jpanel1.setLayout(formlayout1); |
|
200 |
|
|
201 |
txtOutputFile.setName("txtOutputFile"); |
|
202 |
txtOutputFile.setHorizontalAlignment(JTextField.LEFT); |
|
203 |
jpanel1.add(txtOutputFile,cc.xy(1,1)); |
|
204 |
|
|
205 |
btnBrowser.setActionCommand("JButton"); |
|
206 |
btnBrowser.setName("btnBrowser"); |
|
207 |
btnBrowser.setOpaque(false); |
|
208 |
btnBrowser.setRolloverEnabled(true); |
|
209 |
btnBrowser.setText("..."); |
|
210 |
jpanel1.add(btnBrowser,cc.xy(2,1)); |
|
211 |
|
|
212 |
addFillComponents(jpanel1,new int[0],new int[0]); |
|
213 |
return jpanel1; |
|
214 |
} |
|
215 |
|
|
216 |
public JPanel createPanel2() |
|
217 |
{ |
|
218 |
JPanel jpanel1 = new JPanel(); |
|
219 |
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:NONE,FILL:4DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE"); |
|
220 |
CellConstraints cc = new CellConstraints(); |
|
221 |
jpanel1.setLayout(formlayout1); |
|
222 |
|
|
223 |
btnAccept.setActionCommand("_Accept"); |
|
224 |
btnAccept.setName("btnAccept"); |
|
225 |
btnAccept.setText("_Accept"); |
|
226 |
jpanel1.add(btnAccept,cc.xy(1,1)); |
|
227 |
|
|
228 |
btnCancel.setActionCommand("_Cancel"); |
|
229 |
btnCancel.setName("btnCancel"); |
|
230 |
btnCancel.setText("_Cancel"); |
|
231 |
jpanel1.add(btnCancel,cc.xy(3,1)); |
|
232 |
|
|
233 |
addFillComponents(jpanel1,new int[]{ 2 },new int[0]); |
|
234 |
return jpanel1; |
|
235 |
} |
|
236 |
|
|
237 |
/** |
|
238 |
* Initializer |
|
239 |
*/ |
|
240 |
protected void initializePanel() |
|
241 |
{ |
|
242 |
setLayout(new BorderLayout()); |
|
243 |
add(createPanel(), BorderLayout.CENTER); |
|
244 |
} |
|
245 |
|
|
246 |
|
|
247 |
} |
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.43/org.gvsig.lrs.swing/org.gvsig.lrs.swing.impl/src/main/java/org/gvsig/lrs/swing/impl/JLrsEditRouteCalibrationController.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.Color; |
|
10 |
import java.awt.event.ActionEvent; |
|
11 |
import java.awt.event.ActionListener; |
|
12 |
import java.awt.event.ItemEvent; |
|
13 |
import java.awt.event.ItemListener; |
|
14 |
import java.text.MessageFormat; |
|
15 |
import java.util.ArrayList; |
|
16 |
import java.util.List; |
|
17 |
import java.util.Locale; |
|
18 |
|
|
19 |
import javax.swing.ComboBoxModel; |
|
20 |
import javax.swing.DefaultComboBoxModel; |
|
21 |
import javax.swing.JComponent; |
|
22 |
import javax.swing.event.DocumentEvent; |
|
23 |
import javax.swing.event.DocumentListener; |
|
24 |
import javax.swing.event.ListSelectionEvent; |
|
25 |
import javax.swing.event.ListSelectionListener; |
|
26 |
import javax.swing.event.TableModelEvent; |
|
27 |
import javax.swing.event.TableModelListener; |
|
28 |
|
|
29 |
import org.cresques.cts.ICoordTrans; |
|
30 |
import org.slf4j.Logger; |
|
31 |
import org.slf4j.LoggerFactory; |
|
32 |
|
|
33 |
import org.gvsig.fmap.dal.exception.DataException; |
|
34 |
import org.gvsig.fmap.dal.exception.ReadException; |
|
35 |
import org.gvsig.fmap.dal.feature.Feature; |
|
36 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
37 |
import org.gvsig.fmap.dal.feature.FeatureSelection; |
|
38 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
39 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
40 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
41 |
import org.gvsig.fmap.geom.Geometry; |
|
42 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
43 |
import org.gvsig.fmap.geom.GeometryManager; |
|
44 |
import org.gvsig.fmap.geom.aggregate.MultiLine; |
|
45 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
46 |
import org.gvsig.fmap.geom.primitive.Line; |
|
47 |
import org.gvsig.fmap.geom.primitive.Point; |
|
48 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
49 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
50 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
51 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
52 |
import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer; |
|
53 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
54 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager; |
|
55 |
import org.gvsig.lrs.lib.api.LrsAlgorithmParams; |
|
56 |
import org.gvsig.lrs.lib.api.LrsAlgorithmsLocator; |
|
57 |
import org.gvsig.lrs.lib.api.LrsAlgorithmsManager; |
|
58 |
import org.gvsig.lrs.lib.api.LrsEditRouteCalibrationAlgorithmParams; |
|
59 |
import org.gvsig.lrs.lib.api.exceptions.LrsGettingParametersException; |
|
60 |
import org.gvsig.lrs.lib.api.exceptions.LrsNeededParameterException; |
|
61 |
import org.gvsig.lrs.swing.api.JLrsAlgorithmParams; |
|
62 |
import org.gvsig.tools.ToolsLocator; |
|
63 |
import org.gvsig.tools.dispose.DisposableIterator; |
|
64 |
import org.gvsig.tools.exception.BaseException; |
|
65 |
import org.gvsig.tools.i18n.I18nManager; |
|
66 |
import org.gvsig.tools.swing.api.ActionListenerSupport; |
|
67 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
68 |
import org.gvsig.tools.visitor.VisitCanceledException; |
|
69 |
import org.gvsig.tools.visitor.Visitor; |
|
70 |
|
|
71 |
public class JLrsEditRouteCalibrationController extends |
|
72 |
JLrsEditRouteCalibrationParamsView implements JLrsAlgorithmParams { |
|
73 |
|
|
74 |
/** |
|
75 |
* |
|
76 |
*/ |
|
77 |
private static final long serialVersionUID = 7762321351616631999L; |
|
78 |
|
|
79 |
private static final Logger logger = LoggerFactory |
|
80 |
.getLogger(JLrsEditRouteCalibrationController.class); |
|
81 |
|
|
82 |
private boolean canceled; |
|
83 |
private boolean hasWarnings; |
|
84 |
private List<String> warnings; |
|
85 |
private ActionListenerSupport listeners = |
|
86 |
ToolsSwingLocator.getToolsSwingManager().createActionListenerSupport(); |
|
87 |
|
|
88 |
private FLayer layer; |
|
89 |
private FeatureAttributeDescriptor fieldIdRoute; |
|
90 |
private FeatureSet selectedFeatures; |
|
91 |
private Feature editedFeature; |
|
92 |
private Double editedFeatureMax; |
|
93 |
private Double editedFeatureMin; |
|
94 |
private MapContext mapContext; |
|
95 |
GraphicLayer graphics; |
|
96 |
private int idMarkerSymbol; |
|
97 |
private int idLineSymbol; |
|
98 |
|
|
99 |
public static final String EDIT_ROUTECALIBRATION_GRAPHICS_ID = "EditRouteCalibration"; |
|
100 |
|
|
101 |
/** |
|
102 |
* @param layer |
|
103 |
* @throws LrsNeededParameterException |
|
104 |
* @throws LrsGettingParametersException |
|
105 |
* |
|
106 |
*/ |
|
107 |
public JLrsEditRouteCalibrationController(FLayer layer, MapContext mapContext, FeatureAttributeDescriptor fieldIdRoute, |
|
108 |
LrsAlgorithmParams params) throws LrsNeededParameterException, LrsGettingParametersException { |
|
109 |
super(); |
|
110 |
this.layer = layer; |
|
111 |
this.fieldIdRoute=fieldIdRoute; |
|
112 |
this.mapContext = mapContext; |
|
113 |
initializeGraphics(mapContext); |
Also available in: Unified diff