Revision 814 org.gvsig.proj/branches/refactor2018/org.gvsig.proj/org.gvsig.proj.swing/org.gvsig.proj.swing.impl/src/main/java/org/gvsig/proj/swing/impl/DefaultCoordinateReferenceSystemSelectorComponent.java
DefaultCoordinateReferenceSystemSelectorComponent.java | ||
---|---|---|
38 | 38 |
import org.slf4j.LoggerFactory; |
39 | 39 |
|
40 | 40 |
import org.gvsig.proj.CoordinateReferenceSystem; |
41 |
import org.gvsig.proj.CoordinateReferenceSystemException; |
|
41 | 42 |
import org.gvsig.proj.CoordinateReferenceSystemNotFoundException; |
43 |
import org.gvsig.proj.catalog.CRSDefinition; |
|
42 | 44 |
import org.gvsig.proj.swing.CoordinateReferenceSystemSelectorComponent; |
43 | 45 |
import org.gvsig.proj.swing.CoordinateReferenceSystemSwingManager; |
46 |
import org.gvsig.proj.swing.impl.DefaultCoordinateReferenceSystemSelectorComponentView; |
|
44 | 47 |
|
45 | 48 |
/** |
46 | 49 |
* Default implementation for the |
... | ... | |
49 | 52 |
* @author gvSIG Team |
50 | 53 |
* @version $Id$ |
51 | 54 |
*/ |
52 |
public class DefaultCoordinateReferenceSystemSelectorComponent extends DefaultCoordinateReferenceSystemSelectorComponentView |
|
55 |
public class DefaultCoordinateReferenceSystemSelectorComponent |
|
56 |
extends DefaultCoordinateReferenceSystemSelectorComponentView |
|
53 | 57 |
implements CoordinateReferenceSystemSelectorComponent { |
54 | 58 |
|
55 | 59 |
private static final Logger LOG = LoggerFactory |
... | ... | |
77 | 81 |
this.lblDefinition.setText(uimanager.getTranslation("definition") + ":"); |
78 | 82 |
this.btnSearch.setText(uimanager.getTranslation("Search")); |
79 | 83 |
|
80 |
authorityModel = new AuthorityComboBoxModel(uimanager.getManager()); |
|
84 |
authorityModel = new AuthorityComboBoxModel(uimanager.getCatalogManager());
|
|
81 | 85 |
this.cboAuthority.setModel(authorityModel); |
82 | 86 |
|
83 |
codeModel = new CodeListModel(uimanager.getManager(), authorityModel); |
|
87 |
codeModel = new CodeListModel(uimanager.getCatalogManager(), authorityModel);
|
|
84 | 88 |
this.lstCodes.setModel(codeModel); |
85 | 89 |
codeModel.addListDataListener(new ListDataListener() { |
86 | 90 |
|
... | ... | |
101 | 105 |
CoordinateReferenceSystem crs = |
102 | 106 |
getSelectedCoordinateReferenceSystem(); |
103 | 107 |
if (crs != null) { |
104 |
txtDefinition.setText(crs.getDefinition()); |
|
108 |
try { |
|
109 |
txtDefinition.setText(crs.getDefinition().toWKT()); |
|
110 |
} catch (org.gvsig.proj.catalog.exception.CoordinateReferenceSystemNotFoundException e1) { |
|
111 |
// TODO Auto-generated catch block |
|
112 |
e1.printStackTrace(); |
|
113 |
} catch (UnsupportedOperationException e1) { |
|
114 |
// TODO Auto-generated catch block |
|
115 |
e1.printStackTrace(); |
|
116 |
} |
|
105 | 117 |
} |
106 | 118 |
} |
107 | 119 |
}); |
... | ... | |
136 | 148 |
if( crs == null ) { |
137 | 149 |
txtDefinition.setText(""); |
138 | 150 |
} else { |
139 |
txtDefinition.setText(crs.getDefinition()); |
|
151 |
try { |
|
152 |
txtDefinition.setText(crs.getDefinition().toWKT()); |
|
153 |
} catch (org.gvsig.proj.catalog.exception.CoordinateReferenceSystemNotFoundException e1) { |
|
154 |
// TODO Auto-generated catch block |
|
155 |
e1.printStackTrace(); |
|
156 |
} catch (UnsupportedOperationException e1) { |
|
157 |
// TODO Auto-generated catch block |
|
158 |
e1.printStackTrace(); |
|
159 |
} |
|
140 | 160 |
} |
141 | 161 |
} |
142 | 162 |
}); |
... | ... | |
163 | 183 |
String code = (String) this.lstCodes.getSelectedValue(); |
164 | 184 |
if (authority != null && code != null) { |
165 | 185 |
try { |
166 |
crs = uimanager.getManager().getCoordinateReferenceSystem( |
|
167 |
authority, code |
|
168 |
); |
|
186 |
CRSDefinition def = uimanager.getCatalogManager().getCRSDefinition(authority+":"+code); |
|
187 |
return uimanager.getManager().getCoordinateReferenceSystem(def); |
|
169 | 188 |
} catch (CoordinateReferenceSystemNotFoundException e) { |
170 | 189 |
LOG.error("Could not find CRS with authority: " + authority |
171 | 190 |
+ " and code: " + code, e); |
172 |
} |
|
191 |
} catch (org.gvsig.proj.catalog.exception.CoordinateReferenceSystemNotFoundException e) { |
|
192 |
// TODO Auto-generated catch block |
|
193 |
e.printStackTrace(); |
|
194 |
} catch (CoordinateReferenceSystemException e) { |
|
195 |
// TODO Auto-generated catch block |
|
196 |
e.printStackTrace(); |
|
197 |
} |
|
173 | 198 |
} |
174 | 199 |
return crs; |
175 | 200 |
} |
176 | 201 |
|
177 | 202 |
public void setCoordinateReferenceSystem(CoordinateReferenceSystem crs) { |
178 | 203 |
if (crs != null) { |
179 |
authorityModel.setSelectedAuthority(crs.getAuthorityName()); |
|
180 |
this.lstCodes.setSelectedValue(crs.getCode(), true); |
|
181 |
this.txtDefinition.setText(crs.getDefinition()); |
|
204 |
CRSDefinition definition; |
|
205 |
try { |
|
206 |
definition = crs.getDefinition(); |
|
207 |
authorityModel.setSelectedAuthority(definition.getAuthorityName()); |
|
208 |
this.lstCodes.setSelectedValue(definition.getIdentifier(), true); |
|
209 |
this.txtDefinition.setText(definition.toWKT()); |
|
210 |
} catch (org.gvsig.proj.catalog.exception.CoordinateReferenceSystemNotFoundException |
|
211 |
| UnsupportedOperationException e) { |
|
212 |
// TODO Auto-generated catch block |
|
213 |
e.printStackTrace(); |
|
214 |
} |
|
182 | 215 |
} |
183 | 216 |
} |
184 | 217 |
} |
Also available in: Unified diff