Revision 18289 trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/georeferencing/Georeferencing.java

View differences:

Georeferencing.java
104 104
	}
105 105
	
106 106
	/**
107
	 * Colocaci?n inicial de las ventanas del espacio de trabajo
107
	 * Colocaci?n inicial de las ventanas del espacio de trabajo. Carga la configuraci?n
108
	 * de ventanas con cartograf?a de referencia.
108 109
	 */
109
	private void initWindows() {
110
	private void initWindowsWithoutMap() {
111
		
112
	}
113
	
114
	/**
115
	 * Colocaci?n inicial de las ventanas del espacio de trabajo. Carga la configuraci?n
116
	 * de ventanas con cartograf?a de referencia.
117
	 */
118
	private void initWindowsWithMap() {
110 119
		MDIFrame p = (MDIFrame)PluginServices.getMainFrame();
111 120
		int wViews = p.getWidth() >> 1;
112 121
		int hViews = p.getHeight() - 178 - smallWindowsHeight;
......
128 137
		
129 138
		MapControl mapControl = null;
130 139
		IWindow[] windowList = PluginServices.getMDIManager().getAllWindows();
131
		BufferedImage imgView = null;
132
		ViewPort vp = null;
133 140
		for (int i = 0; i < windowList.length; i++) {
134
			if(windowList[i] instanceof IView && windowList[i].getWindowInfo().getTitle().endsWith(": " + selectedView)) {
135
				WindowInfo info = windowList[i].getWindowInfo();
136
				
137
				info.setX(0);
138
				info.setY(0);
139
				info.setWidth(wViews);
140
				info.setHeight(posYViews);
141
				
141
			if(windowList[i] instanceof IView && windowList[i].getWindowInfo().getTitle().endsWith(": " + selectedView)) 
142 142
				mapControl = ((IView)windowList[i]).getMapControl();
143
				imgView = ((IView)windowList[i]).getMapControl().getImage();
144
				vp = ((IView)windowList[i]).getMapControl().getViewPort();
145
			}
146 143
		}
147 144
		
145
		if(mapControl == null) {
146
			RasterToolsUtil.messageBoxError("error_lookingfor_view", this);
147
			return;
148
		}
149
		
148 150
		table = new GCPTablePanel(smallWindowsWidth, posYViews, tableWidth, smallWindowsHeight);
149 151
		
150
		//Inicializaci?n de la vista mapa
152
		//Inicializaci?n de la ventana con la vista mapa
151 153
		viewMap = new ViewDialog(0, 0, wViews, hViews, this);
152 154
		viewMap.setShowInfo(true);
153 155
		viewMapRequestManager = new ViewMapRequestManager(viewMap, mapControl);
154 156
		viewMap.setExtensionRequest(viewMapRequestManager);
155 157
		
156
		//Inicializaci?n de la vista raster
158
		//Inicializaci?n de la ventana con la vista raster
157 159
		viewRaster = new ViewDialog(wViews, 0, wViews, hViews, this);
158 160
		viewRaster.setShowInfo(true);
159 161
		viewRasterRequestManager = new ViewRasterRequestManager(viewRaster, lyrToGeoref);
160 162
		viewRaster.setExtensionRequest(viewRasterRequestManager);
161 163
		
162
		//Inicializaci?n del zoom de la vista raster
164
		//Inicializaci?n de la ventana del zoom de la vista raster
163 165
		zoomPixel = new ZoomRasterDialog(smallWindowsWidth + tableWidth, posYViews, smallWindowsWidth, smallWindowsHeight);
164 166
		zoomRasterRequestManager = new ViewRasterRequestManager(zoomPixel, lyrToGeoref);
165 167
		zoomPixel.setExtensionRequest(zoomRasterRequestManager);
166 168
		
167
		//Inicializaci?n del zoom de la vista de referencia
169
		//Inicializaci?n de la ventana del zoom de la vista de referencia
168 170
		zoomMap = new ZoomMapDialog(0, posYViews, smallWindowsWidth, smallWindowsHeight);
169 171
		zoomMapRequestManager = new ViewMapRequestManager(zoomMap, mapControl);
170 172
		zoomMap.setExtensionRequest(zoomMapRequestManager);
......
191 193
			viewRaster.setZoomCursorSize(zoomPixel.getCanvasWidth() / 3, zoomPixel.getCanvasHeight() / 3);
192 194
			
193 195
			//Inicializamos el zoom de mapa
194
			Rectangle2D mapExtent = mapControl.getMapContext().getFullExtent();
195 196
			Rectangle2D ext = viewMap.getCursorAdjustedWorldCoordinates(zoomMap.getCanvasWidth(), zoomMap.getCanvasHeight());
196 197
			zoomMapRequestManager.initRequest(mapControl.getMapContext().getFullExtent());
197
			zoomMapRequestManager.request(new Rectangle2D.Double(ext.getX(), mapExtent.getMaxY() - (mapExtent.getMinY() - ext.getY()), ext.getWidth(), ext.getHeight()));
198
			zoomMapRequestManager.request(new Rectangle2D.Double(ext.getX(), 
199
											viewRaster.getViewExtent().getMaxY() - (viewRaster.getViewExtent().getMinY() - ext.getY()), 
200
											ext.getWidth(), 
201
											ext.getHeight()));
198 202

  
199 203
			//Inicializamos el zoom de raster
200 204
			ext = viewRaster.getCursorAdjustedWorldCoordinates(zoomPixel.getCanvasWidth(), zoomPixel.getCanvasHeight());
201 205
			zoomRasterRequestManager.initRequest(lyrToGeoref.getFullExtent());
202
			zoomRasterRequestManager.request(new Rectangle2D.Double(ext.getX(), lyrToGeoref.getFullRasterExtent().maxY() - (lyrToGeoref.getFullRasterExtent().minY() - ext.getY()), ext.getWidth(), ext.getHeight()));
206
			zoomRasterRequestManager.request(new Rectangle2D.Double(ext.getX(), 
207
											viewRaster.getViewExtent().getMaxY() - (viewRaster.getViewExtent().getMinY() - ext.getY()), 
208
											ext.getWidth(), 
209
											ext.getHeight()));
210
			
203 211
		} catch (InvalidRequestException e1) {
204 212
			RasterToolsUtil.messageBoxError("error_setview_preview", this);
205 213
		}catch (Exception e1) {
......
235 243
					RasterToolsUtil.messageBoxError("layer_not_loaded", this);
236 244
				else {
237 245
					PluginServices.getMDIManager().closeWindow(initDialog);
238
					initWindows();
246
					if(initDialog.getType() == Georeferencing.WITH_MAP)
247
						initWindowsWithMap();
248
					if(initDialog.getType() == Georeferencing.WITHOUT_MAP)
249
						initWindowsWithoutMap();
239 250
				}
240 251
			}
241 252
		}

Also available in: Unified diff