Revision 25606 trunk/extensions/extTopology/src/org/gvsig/topology/ui/preferencespage/TopologyPreferences.java
TopologyPreferences.java | ||
---|---|---|
43 | 43 |
*/ |
44 | 44 |
/* CVS MESSAGES: |
45 | 45 |
* |
46 |
* $Id:
|
|
47 |
* $Log:
|
|
46 |
* $Id: |
|
47 |
* $Log: |
|
48 | 48 |
*/ |
49 | 49 |
package org.gvsig.topology.ui.preferencespage; |
50 | 50 |
|
... | ... | |
64 | 64 |
|
65 | 65 |
/** |
66 | 66 |
* Preferences page of the topology extension. |
67 |
*
|
|
67 |
* |
|
68 | 68 |
* @author Alvaro Zabala |
69 | 69 |
* |
70 | 70 |
*/ |
... | ... | |
75 | 75 |
private static String id = TopologyPreferences.class.getName(); |
76 | 76 |
|
77 | 77 |
private JTextField topologyFilesPath; |
78 |
|
|
78 |
|
|
79 | 79 |
private JSpinner generalizationFactor; |
80 | 80 |
|
81 |
private ImageIcon icon; |
|
81 |
private ImageIcon icon=null;
|
|
82 | 82 |
|
83 | 83 |
public static final String DEFAULT_TOPOLOGY_FILES_PATH = "TopologyFilesPath"; |
84 | 84 |
public static final String SMOOTH_FACTOR = "GeneralizationFactor"; |
85 | 85 |
|
86 | 86 |
public TopologyPreferences() { |
87 | 87 |
|
88 |
icon = PluginServices.getIconTheme().get("create-topology"); |
|
89 | 88 |
addComponent(PluginServices.getText(this, "topology_files_path"), |
90 | 89 |
topologyFilesPath = new JTextField(25)); |
91 |
|
|
92 |
|
|
90 |
|
|
91 |
|
|
93 | 92 |
SpinnerNumberModel model = new SpinnerNumberModel(1d, 0d, 100d, 0.1); |
94 | 93 |
addComponent(PluginServices.getText(this, "generalization_factor"), |
95 | 94 |
generalizationFactor = new JSpinner(model)); |
... | ... | |
102 | 101 |
public void storeValues() throws StoreException { |
103 | 102 |
String filesDirectory = topologyFilesPath.getText(); |
104 | 103 |
GUIUtil.getInstance().setFilesDirectory(filesDirectory); |
105 |
|
|
104 |
|
|
106 | 105 |
Double smoothFactor = (Double) generalizationFactor.getValue(); |
107 | 106 |
JtsUtil.GENERALIZATION_FACTOR = smoothFactor; |
108 |
|
|
107 |
|
|
109 | 108 |
PluginServices ps = PluginServices.getPluginServices(this); |
110 | 109 |
XMLEntity xml = ps.getPersistentXML(); |
111 | 110 |
xml.putProperty(DEFAULT_TOPOLOGY_FILES_PATH, filesDirectory); |
... | ... | |
117 | 116 |
} |
118 | 117 |
|
119 | 118 |
public ImageIcon getIcon() { |
119 |
if (icon == null){ |
|
120 |
icon = PluginServices.getIconTheme().get("create-topology"); |
|
121 |
} |
|
120 | 122 |
return icon; |
121 | 123 |
} |
122 | 124 |
|
... | ... | |
143 | 145 |
}else{ |
144 | 146 |
topologyFilesPath.setText(GUIUtil.DEFAULT_TOPO_FILES_DIRECTORY); |
145 | 147 |
} |
146 |
|
|
148 |
|
|
147 | 149 |
if (xml.contains(SMOOTH_FACTOR)) { |
148 | 150 |
Double factor = xml.getDoubleProperty(SMOOTH_FACTOR); |
149 | 151 |
JtsUtil.GENERALIZATION_FACTOR = factor; |
Also available in: Unified diff