Revision 45324 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.impl/src/main/java/org/gvsig/export/swing/impl/panels/SelectTargetProjectionPanel.java
SelectTargetProjectionPanel.java | ||
---|---|---|
90 | 90 |
doRadioButonsStateChanged(); |
91 | 91 |
} |
92 | 92 |
}); |
93 |
if (this.parameters.getSourceProjection() == null) { |
|
94 |
this.rdbtnUserProjection.setSelected(true); |
|
95 |
} else if (this.parameters.getTargetProjection() == this.parameters.getSourceProjection()) { |
|
96 |
this.rdbtnOriginalProjection.setSelected(true); |
|
97 |
} else if (this.parameters.getTargetProjection() == this.parameters.getContextProjection()) { |
|
98 |
this.rdbtnViewProjection.setSelected(true); |
|
99 |
} else { |
|
100 |
this.rdbtnUserProjection.setSelected(true); |
|
101 |
} |
|
93 |
updateSelectedRadioButton(); |
|
102 | 94 |
} |
103 | 95 |
|
104 | 96 |
private void doRadioButonsStateChanged() { |
... | ... | |
136 | 128 |
|
137 | 129 |
@Override |
138 | 130 |
public boolean validatePanel() throws ExportPanelValidationException { |
139 |
if (this.rdbtnUserProjection.isSelected()) {
|
|
140 |
if (this.projectionController.isEmpty()) {
|
|
131 |
if (parameters instanceof ExportParametersGeometry) {
|
|
132 |
if (this.getTargetProjection()==null) {
|
|
141 | 133 |
return false; |
142 | 134 |
} |
143 | 135 |
} |
... | ... | |
165 | 157 |
this.projectionController.set(sourceProjection); |
166 | 158 |
} |
167 | 159 |
|
168 |
if (targetProjection != contextProjection) { |
|
169 |
rdbtnUserProjection.setSelected(true); |
|
160 |
updateSelectedRadioButton(); |
|
161 |
} |
|
162 |
|
|
163 |
private void updateSelectedRadioButton() { |
|
164 |
if (this.parameters.getSourceProjection() == null) { |
|
165 |
this.rdbtnUserProjection.setSelected(true); |
|
166 |
} else if (this.parameters.getTargetProjection() == this.parameters.getSourceProjection()) { |
|
167 |
this.rdbtnOriginalProjection.setSelected(true); |
|
168 |
} else if (this.parameters.getTargetProjection() == this.parameters.getContextProjection()) { |
|
169 |
this.rdbtnViewProjection.setSelected(true); |
|
170 | 170 |
} else { |
171 |
if (targetProjection == sourceProjection) { |
|
172 |
rdbtnOriginalProjection.setSelected(true); |
|
173 |
} else if (targetProjection == contextProjection) { |
|
174 |
rdbtnViewProjection.setSelected(true); |
|
175 |
} |
|
171 |
this.rdbtnUserProjection.setSelected(true); |
|
176 | 172 |
} |
177 | 173 |
} |
178 |
|
|
179 |
@Override |
|
180 |
public void nextPanel() { |
|
174 |
|
|
175 |
private IProjection getTargetProjection() { |
|
176 |
if (this.rdbtnUserProjection.isSelected()) { |
|
177 |
return this.projectionController.get(); |
|
178 |
} else if (this.rdbtnOriginalProjection.isSelected()) { |
|
179 |
return this.parameters.getSourceProjection(); |
|
180 |
} else if (this.rdbtnViewProjection.isSelected()) { |
|
181 |
return this.parameters.getContextProjection(); |
|
182 |
} |
|
183 |
return null; // no deberia llegar aqui |
|
184 |
} |
|
185 |
|
|
186 |
private ICoordTrans getTargetTransformation() { |
|
181 | 187 |
if (this.rdbtnUserProjection.isSelected()) { |
182 |
this.parameters.setTargetProjection(this.projectionController.get()); |
|
183 |
this.parameters.setTargetTransformation(this.projectionController.getCoordinateTransformation()); |
|
184 |
|
|
188 |
return this.projectionController.getCoordinateTransformation(); |
|
185 | 189 |
} else if (this.rdbtnOriginalProjection.isSelected()) { |
186 |
this.parameters.setTargetProjection(null); |
|
187 |
this.parameters.setTargetTransformation(null); |
|
188 |
|
|
190 |
return null; |
|
189 | 191 |
} else if (this.rdbtnViewProjection.isSelected()) { |
190 |
this.parameters.setTargetProjection(this.parameters.getContextProjection()); |
|
191 | 192 |
ICoordTrans targetCT = this.parameters.getSourceProjection().getCT(this.parameters.getContextProjection()); |
192 |
this.parameters.setTargetTransformation(targetCT); |
|
193 |
|
|
193 |
return targetCT; |
|
194 | 194 |
} |
195 |
return null; // no deberia llegar aqui |
|
195 | 196 |
} |
196 | 197 |
|
197 | 198 |
@Override |
199 |
public void nextPanel() { |
|
200 |
this.parameters.setTargetProjection(getTargetProjection()); |
|
201 |
this.parameters.setTargetTransformation(getTargetTransformation()); |
|
202 |
} |
|
203 |
|
|
204 |
@Override |
|
198 | 205 |
public JComponent asJComponent() { |
199 | 206 |
return this; |
200 | 207 |
} |
Also available in: Unified diff