Revision 6630 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/ViewPort.java

View differences:

ViewPort.java
322 322
	}
323 323

  
324 324
	/**
325
	 * Inserta la escala.
326
     * TODO: (FJP) Que alguien me explique qu? sentido tiene esto
327
	 *
328
	 * @param scale escala.
325
	 * Refresca el extent.
326
     *
329 327
	 */
330
	public void setScale() {
328
	public void refreshExtent() {
331 329
		//this.scale = scale;
332 330

  
333 331
		//Calcula la transformaci?n af?n
......
417 415
		}
418 416
	}
419 417

  
420
	
418

  
421 419
	/**
422 420
	 * C?lculo de la matriz de transformaci?n.
423 421
	 *
......
656 654
	 */
657 655
	public void setProjection(IProjection proj) {
658 656
		if(this.proj == null || !this.proj.getAbrev().equals(proj.getAbrev())) {
659
			this.proj = proj;		
657
			this.proj = proj;
660 658
			callProjectionChanged(proj);
661 659
		}
662 660
	}
......
781 779
		}
782 780

  
783 781
		//vp.setScale(xml.getDoubleProperty("scale"));
784
		vp.setScale();
782
		vp.refreshExtent();
785 783
		return vp;
786 784
	}
787 785

  
......
842 840
		}
843 841

  
844 842
		//vp.setScale(xml.getDoubleProperty("scale"));
845
		vp.setScale();
843
		vp.refreshExtent();
846 844
		return vp;
847 845
	}
848 846

  
......
880 878
		Point2D p1=fromMapPoint((int)r.getX(),(int)r.getY());
881 879
		return new Rectangle2D.Double(p1.getX(),p1.getY(),w,h);
882 880
	}
881
	public void setScale(long s){
882
		double x=extent.getX();
883
		double y=extent.getY();
884
		double escalaX = imageSize.getWidth() / extent.getWidth();
885
		double w=imageSize.getWidth() / s;
886
		double h=imageSize.getHeight() / s;
887
		double difw = escalaX/s;
883 888

  
889
		double x1 = (-x * difw) -
890
            x+
891
            extent.getWidth()/2;
892
        double y1 = (-y * difw) -
893
            y +
894
            extent.getHeight()/2;
895
        double w1=extent.getWidth()*difw;
896
        double h1=extent.getHeight()*difw;
897
		extent.setRect(-x1,-y1,w1,h1);
898
	}
884 899

  
885 900
}

Also available in: Unified diff