Revision 23163 trunk/extensions/extTopology/src/com/iver/cit/gvsig/geoprocess/impl/referencing/gui/ReferencingGeoprocessPanel.java

View differences:

ReferencingGeoprocessPanel.java
57 57
import javax.swing.JLabel;
58 58
import javax.vecmath.MismatchedSizeException;
59 59

  
60
import org.geotools.referencefork.referencing.operation.transform.AbstractMathTransform;
60
import org.geotools.referencefork.referencing.operation.builder.RubberSheetBuilder;
61 61
import org.gvsig.referencing.MappedPositionContainer;
62
import org.gvsig.referencing.ReferencingUtil;
62 63
import org.gvsig.topology.ui.util.GUIUtil;
63 64
import org.opengis.referencing.FactoryException;
64 65
import org.opengis.referencing.operation.MathTransform;
......
69 70
import com.iver.andami.ui.mdiManager.IWindow;
70 71
import com.iver.cit.gvsig.fmap.MapControl;
71 72
import com.iver.cit.gvsig.fmap.layers.FLayers;
73
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
72 74
import com.iver.cit.gvsig.geoprocess.core.fmap.GeoprocessException;
73 75
import com.iver.cit.gvsig.geoprocess.core.gui.AbstractGeoprocessGridbagPanel;
74 76
import com.iver.cit.gvsig.geoprocess.impl.referencing.IReferencingGeoprocessUserEntries;
75 77
import com.iver.cit.gvsig.project.documents.view.gui.View;
76
import com.iver.cit.gvsig.referencing.DisactivableMappedPositionContainerImpl;
77 78
import com.iver.cit.gvsig.referencing.TransformationsRegistry;
78 79
import com.iver.cit.gvsig.referencing.TransformationsRegistry.TransformationRegistryEntry;
79 80

  
......
81 82

  
82 83
	private MapControl currentView;
83 84
	
84
	private MappedPositionContainer verrorList;
85
//	private MappedPositionContainer verrorList;
85 86

  
86 87
//	private String controlPointsTitle;
87 88

  
......
107 108
			MapControl mapControl = vista.getMapControl();
108 109
			this.currentView = mapControl;
109 110
		}
110
		verrorList = new DisactivableMappedPositionContainerImpl();
111 111
		
112
		
112 113
//		controlPointsTitle = PluginServices.getText(null, "Control_points");
113 114
		transformationTitle = PluginServices.getText(null, "Transform");
114 115
		
......
117 118
//		addComponent(controlPointsLbl);
118 119
		
119 120
		JComboBox cb = getTransformationOptionCb();
120
		addComponent(vectorErrorTable = new VectorErrorTable(currentView, verrorList, (TransformationRegistryEntry)cb.getSelectedItem() ));
121
		addComponent(vectorErrorTable = new VectorErrorTable(currentView, 
122
														 getInputLayer(),
123
														 (TransformationRegistryEntry)cb.getSelectedItem() ));
121 124
		
122 125
		
123 126
		JLabel transformTitleLbl = new JLabel(transformationTitle);
......
173 176
	}
174 177
	
175 178
	@Override
179
	/**
180
	 * This method is called when layer combo box selection changes.
181
	 */
176 182
	protected void processLayerComboBoxStateChange(ItemEvent e) {
183
		vectorErrorTable.setAdjustingLyr(getInputLayer());
177 184
	}
178 185

  
179 186
	public MathTransform getMathTransform() throws GeoprocessException {
180 187
		try {
181
			return  ((TransformationRegistryEntry)getTransformationOptionCb().getSelectedItem()).
182
							createTransformBuilder(verrorList.getAsList()).getMathTransform();
188
//			return  ((TransformationRegistryEntry)getTransformationOptionCb().getSelectedItem()).
189
//							createTransformBuilder(verrorList.getAsList()).getMathTransform();
190
			MappedPositionContainer mp = this.vectorErrorTable.getVerrorContainer();
191
			return  ((TransformationRegistryEntry)getTransformationOptionCb().
192
															getSelectedItem()).
193
															createTransformBuilder(mp.getAsList()).
194
															getMathTransform();
183 195
		} catch (FactoryException e) {
184 196
			throw new GeoprocessException(e);
185 197
		}catch(RuntimeException re){
......
192 204
		return isFirstOnlySelected();
193 205
	}
194 206

  
207

  
208

  
209
	public FLyrVect[] getAuxiliarLyrs() {
210
		if(hasAuxiliarLyrs()){
211
			MappedPositionContainer mp = this.vectorErrorTable.getVerrorContainer();
212
			TransformationRegistryEntry transformRegistryEntry = 
213
				(TransformationRegistryEntry)getTransformationOptionCb().getSelectedItem();
214
			RubberSheetBuilder transformBuilder = 
215
				(RubberSheetBuilder) transformRegistryEntry.createTransformBuilder(mp.getAsList());
216
			FLyrVect tinLyr = ReferencingUtil.getInstance().getTinAsFMapLyr(transformBuilder, currentView.getProjection());
217
			return new FLyrVect[]{tinLyr};
218
		}else{
219
			return new FLyrVect[]{};
220
		}
221
	}
222

  
223

  
224

  
225
	public boolean hasAuxiliarLyrs() {
226
		//by now, the only transformation with auxiliar layers is Rubber Sheet Transform,
227
		//being this auxiliar layer TIN formed with mapped positions.
228
		TransformationRegistryEntry transformRegistryEntry = 
229
			(TransformationRegistryEntry)getTransformationOptionCb().getSelectedItem();
230
		return transformRegistryEntry.getName().
231
			equals(PluginServices.getText(null, "RUBBER_SHEET_TRANSFORM"));
232
	}
233

  
195 234
}

Also available in: Unified diff