Revision 4641

View differences:

trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/fmap/tools/Behavior/GeoRedimBehavior.java
75 75
 *
76 76
 */
77 77
public class GeoRedimBehavior extends Behavior {
78
	//Params
79
	private int 							WIDTH_BORDER = 25; 
80
	private int 							LONG_CORNER = 35;
81
	private Color							rectangleColor = Color.RED;
82
	
78 83
	private RectangleListener listener;
79 84
	
80 85
	private final Image iconHoriz = new ImageIcon(MapControl.class.getResource(
......
88 93
	private final Image defaultCursor = new ImageIcon(MapControl.class.getResource(
89 94
	"images/ZoomInCursor.gif")).getImage();
90 95
	
91
	private int 							WIDTH_BORDER = 25; 
92
	private int 							LONG_CORNER = 35;
93
	
94 96
	/**
95 97
	 * Cada elemento del vector corresponde a un tipo de icono que
96 98
	 * estar? a true si est? activo y a false si no lo est?.
......
154 156
		
155 157
		BufferedImage img = getMapControl().getImage();
156 158
		g.drawImage(img, 0, 0, null);
157
		g.setColor(Color.red);
159
		g.setColor(rectangleColor);
158 160
		ViewPort vp = getMapControl().getMapContext().getViewPort();
159 161
		try{
160 162
			loadLayer();
......
307 309
	 * @param e MouseEvent
308 310
	 */
309 311
	public void mouseDragged(MouseEvent e) {
310
		double longLadoLargo = Math.abs(tmpLr.getX() - tmpUl.getX());
311
		double longLadoCorto = Math.abs(tmpLr.getY() - tmpUl.getY());
312
		double longLadoX = Math.abs(tmpLr.getX() - tmpUl.getX());
313
		double longLadoY = Math.abs(tmpLr.getY() - tmpUl.getY());
312 314
		
313 315
		if(redimActive[0]){//vertical derecha
314
			double newLadoLargo = (e.getX() - tmpUl.getX());
315
			double newLadoCorto = (newLadoLargo * longLadoCorto) / longLadoLargo;
316
			double newLadoX = (e.getX() - tmpUl.getX());
317
			double newLadoY = (newLadoX * longLadoY) / longLadoX;
316 318
			double coordCentro = tmpLr.getY() + (Math.abs(tmpLr.getY() - tmpUl.getY()) / 2);
317
			tmpUl = new Point2D.Double(tmpUl.getX(), coordCentro + (newLadoCorto/2));
318
			tmpLr = new Point2D.Double(e.getX(), coordCentro - (newLadoCorto/2));
319
			tmpUl = new Point2D.Double(tmpUl.getX(), coordCentro + (newLadoY/2));
320
			tmpLr = new Point2D.Double(e.getX(), coordCentro - (newLadoY/2));
319 321
		}
320 322
		if(redimActive[1]){//vertical izquierda
321
			double newLadoLargo = (e.getX() - tmpLr.getX());
322
			double newLadoCorto = (newLadoLargo * longLadoCorto) / longLadoLargo;
323
			double newLadoX = (e.getX() - tmpLr.getX());
324
			double newLadoY = (newLadoX * longLadoY) / longLadoX;
323 325
			double coordCentro = tmpLr.getY() + (Math.abs(tmpLr.getY() - tmpUl.getY()) / 2);
324
			tmpLr = new Point2D.Double(tmpLr.getX(), coordCentro + (newLadoCorto/2));
325
			tmpUl = new Point2D.Double(e.getX(), coordCentro - (newLadoCorto/2));
326
			tmpLr = new Point2D.Double(tmpLr.getX(), coordCentro + (newLadoY/2));
327
			tmpUl = new Point2D.Double(e.getX(), coordCentro - (newLadoY/2));
326 328
		}
327 329
		if(redimActive[2]){//horizontal abajo
328
			double newLadoCorto = (e.getY() - tmpLr.getY());
329
			double newLadoLargo = (newLadoCorto * longLadoLargo) / longLadoCorto;
330
			double newLadoY = (e.getY() - tmpLr.getY());
331
			double newLadoX = (newLadoY * longLadoX) / longLadoY;
330 332
			double coordCentro = tmpLr.getX() - (Math.abs(tmpLr.getX() - tmpUl.getX()) / 2);
331
			tmpLr = new Point2D.Double(coordCentro + (newLadoLargo/2), tmpLr.getY());
332
			tmpUl = new Point2D.Double(coordCentro - (newLadoLargo/2), e.getY());
333
			tmpLr = new Point2D.Double(coordCentro + (newLadoX/2), tmpLr.getY());
334
			tmpUl = new Point2D.Double(coordCentro - (newLadoX/2), e.getY());
333 335
		}
334 336
		if(redimActive[3]){//horizontal arriba
335
			double newLadoCorto = (e.getY() - tmpUl.getY());
336
			double newLadoLargo = (newLadoCorto * longLadoLargo) / longLadoCorto;
337
			double newLadoY = (e.getY() - tmpUl.getY());
338
			double newLadoX = (newLadoY * longLadoX) / longLadoY;
337 339
			double coordCentro = tmpLr.getX() - (Math.abs(tmpLr.getX() - tmpUl.getX()) / 2);
338
			tmpUl = new Point2D.Double(coordCentro + (newLadoLargo/2), tmpUl.getY());
339
			tmpLr = new Point2D.Double(coordCentro - (newLadoLargo/2), e.getY());
340
			tmpUl = new Point2D.Double(coordCentro + (newLadoX/2), tmpUl.getY());
341
			tmpLr = new Point2D.Double(coordCentro - (newLadoX/2), e.getY());
340 342
		}
341 343
		if(redimActive[4]){//inclinado
342 344
			double distX = (e.getX() - pointInit.getX());
343 345
			double distY = (e.getY() - pointInit.getY());
344
			double incrLadoLargo = 0D, incrLadoCorto = 0D;
345
			incrLadoLargo = distX;
346
			double incrLadoX = 0D, incrLadoY = 0D;
347
			incrLadoX = distX;
348
			
346 349
			//Calculamos la distancia que incrementaremos al lado corto
347
			boolean ejeXLargo = true; 
348
			if(longLadoCorto > longLadoLargo){
349
				double tmp = longLadoLargo;
350
				longLadoLargo = longLadoCorto;
351
				longLadoCorto = tmp;
350
			boolean ejeXLargo = true;
351
			if(longLadoY > longLadoX){
352
				double tmp = longLadoX;
353
				longLadoX = longLadoY;
354
				longLadoY = tmp;
352 355
				ejeXLargo = false;
353 356
			}	
354
			
355
			incrLadoCorto = (incrLadoLargo * longLadoCorto) / longLadoLargo;
357
						
358
			incrLadoY = (incrLadoX * longLadoY) / longLadoX;
356 359
			Point2D antUl = tmpUl;
357 360
			Point2D antLr = tmpLr;
358 361
			if(distX > 0 && e.getX() > lr.getX()){
359
				tmpUl = new Point2D.Double(rectInit.getMinX() - Math.abs(incrLadoLargo), rectInit.getMinY() + Math.abs(incrLadoCorto));
360
				tmpLr = new Point2D.Double(rectInit.getMaxX() + Math.abs(incrLadoLargo), rectInit.getMaxY() - Math.abs(incrLadoCorto));
362
				tmpUl = new Point2D.Double(rectInit.getMinX() - Math.abs(incrLadoX), rectInit.getMinY() + Math.abs(incrLadoY));
363
				tmpLr = new Point2D.Double(rectInit.getMaxX() + Math.abs(incrLadoX), rectInit.getMaxY() - Math.abs(incrLadoY));
361 364
			}else if(distX < 0 && e.getX() < ul.getX()){
362
				tmpUl = new Point2D.Double(rectInit.getMinX() - Math.abs(incrLadoLargo), rectInit.getMinY() + Math.abs(incrLadoCorto));
363
				tmpLr = new Point2D.Double(rectInit.getMaxX() + Math.abs(incrLadoLargo), rectInit.getMaxY() - Math.abs(incrLadoCorto));
365
				tmpUl = new Point2D.Double(rectInit.getMinX() - Math.abs(incrLadoX), rectInit.getMinY() + Math.abs(incrLadoY));
366
				tmpLr = new Point2D.Double(rectInit.getMaxX() + Math.abs(incrLadoX), rectInit.getMaxY() - Math.abs(incrLadoY));
364 367
			}else if(distX > 0 && e.getX() < lr.getX() && e.getX() > ul.getX()){
365
				tmpUl = new Point2D.Double(rectInit.getMinX() + Math.abs(incrLadoLargo), rectInit.getMinY() - Math.abs(incrLadoCorto));
366
				tmpLr = new Point2D.Double(rectInit.getMaxX() - Math.abs(incrLadoLargo), rectInit.getMaxY() + Math.abs(incrLadoCorto));
368
				tmpUl = new Point2D.Double(rectInit.getMinX() + Math.abs(incrLadoX), rectInit.getMinY() - Math.abs(incrLadoY));
369
				tmpLr = new Point2D.Double(rectInit.getMaxX() - Math.abs(incrLadoX), rectInit.getMaxY() + Math.abs(incrLadoY));
367 370
			}else if(distX < 0 && e.getX() < lr.getX() && e.getX() > ul.getX()){
368
				tmpUl = new Point2D.Double(rectInit.getMinX() + Math.abs(incrLadoLargo), rectInit.getMinY() - Math.abs(incrLadoCorto));
369
				tmpLr = new Point2D.Double(rectInit.getMaxX() - Math.abs(incrLadoLargo), rectInit.getMaxY() + Math.abs(incrLadoCorto));
371
				tmpUl = new Point2D.Double(rectInit.getMinX() + Math.abs(incrLadoX), rectInit.getMinY() - Math.abs(incrLadoY));
372
				tmpLr = new Point2D.Double(rectInit.getMaxX() - Math.abs(incrLadoX), rectInit.getMaxY() + Math.abs(incrLadoY));
370 373
			}
371 374
			//A partir de un tama?o m?nimo no reducimos m?s
372 375
			if((tmpLr.getX() - tmpUl.getX()) < 100 || (tmpUl.getY() - tmpLr.getY()) < 100){
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/Panels/TablePointsPanel.java
96 96
	 * 	
97 97
	 * @return javax.swing.JPanel	
98 98
	 */    
99
	private JPanel getPTable() {
99
	public JPanel getPTable() {
100 100
		if (pTable == null) {
101 101
			BorderLayout borderLayout4 = new BorderLayout();
102 102
			pTable = new JPanel();
......
113 113
	 * 	
114 114
	 * @return javax.swing.JPanel	
115 115
	 */    
116
	private JPanel getPPointSelection() {
116
	public JPanel getPPointSelection() {
117 117
		if (pPointSelection == null) {
118 118
			pPointSelection = new JPanel();
119 119
			pPointSelection.setPreferredSize(new java.awt.Dimension(widthInfPanel, heightInfPanel));
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/Panels/ConectorPanel.java
135 135
        this.getPSouth().setSize(new java.awt.Dimension(newWidth, heightSouthPanel));
136 136
        this.getPSouth().setPreferredSize(new java.awt.Dimension(newWidth, heightSouthPanel));
137 137
        
138
        //this.getDataPointsTabPanel().newFrameSize(newWidth, h);
138
        this.getDataPointsTabPanel().newFrameSize(newWidth, h);
139 139
        //this.getAdjustGeorefPanel().newFrameSize(w, h);
140 140
	}
141 141
}
trunk/extensions/extGeoreferencing/src/com/iver/cit/gvsig/gui/Panels/DataPointsTabPanel.java
114 114
			parent.resetSize();
115 115
		}
116 116
		
117
		if (((JTabbedPane)ev.getSource()).getSelectedIndex() == 1){
118
			
117
		if (((JTabbedPane)ev.getSource()).getSelectedIndex() == 1){			
119 118
			//Si la ventana ha sido redimensionada ponemos la dimensi?n temporal
120 119
		
121 120
			if(parent.getTmpWidth() > parent.getNormalWidth()){
......
179 178
					JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),
180 179
							PluginServices.getText(this, "error_capa_puntos"));
181 180
				}
181

  
182 182
			}
183 183
			
184 184
			if(getSelectPointsPanel().getTableControlerPanel().getSelectedIndex() != -1)

Also available in: Unified diff