Revision 6261 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/MapControl.java
MapControl.java | ||
---|---|---|
41 | 41 |
package com.iver.cit.gvsig.fmap; |
42 | 42 |
|
43 | 43 |
import java.awt.Color; |
44 |
import java.awt.Component; |
|
45 | 44 |
import java.awt.Dimension; |
46 | 45 |
import java.awt.Graphics; |
47 | 46 |
import java.awt.Graphics2D; |
48 | 47 |
import java.awt.GraphicsEnvironment; |
49 |
import java.awt.Point; |
|
50 | 48 |
import java.awt.event.ActionEvent; |
51 | 49 |
import java.awt.event.ActionListener; |
52 | 50 |
import java.awt.event.ComponentEvent; |
... | ... | |
422 | 420 |
} |
423 | 421 |
repaint(); |
424 | 422 |
} |
425 |
|
|
423 |
|
|
426 | 424 |
public void rePaintDirtyLayers() |
427 | 425 |
{ |
428 | 426 |
cancelDrawing(); |
429 | 427 |
status = DESACTUALIZADO; |
430 | 428 |
repaint(); |
431 | 429 |
} |
432 |
|
|
430 |
|
|
433 | 431 |
public void drawGraphics() { |
434 | 432 |
status = ONLY_GRAPHICS; |
435 | 433 |
repaint(); |
... | ... | |
541 | 539 |
gTemp.setColor(theBackColor); |
542 | 540 |
gTemp.fillRect(0, 0, viewPort.getImageWidth(), viewPort.getImageHeight()); |
543 | 541 |
status = ACTUALIZADO; |
542 |
// ESTILO MAC |
|
543 |
// BufferedImage imgMac = new BufferedImage(vp.getImageWidth(), vp.getImageHeight(), |
|
544 |
// BufferedImage.TYPE_INT_ARGB); |
|
545 |
// |
|
546 |
// mapContext.draw(imgMac, g, canceldraw, mapContext.getScaleView()); |
|
547 |
// g.drawImage(imgMac, 0, 0, null); |
|
548 |
// FIN ESTILO MAC |
|
549 |
// SIN MAC: |
|
544 | 550 |
mapContext.draw(image, g, canceldraw, mapContext.getScaleView()); |
545 | 551 |
|
546 | 552 |
} |
... | ... | |
746 | 752 |
return cancel; |
747 | 753 |
} |
748 | 754 |
} |
755 |
|
|
749 | 756 |
|
750 |
|
|
751 | 757 |
/** |
752 | 758 |
* Listener del MapTool. |
753 | 759 |
* |
... | ... | |
819 | 825 |
public void mouseWheelMoved(MouseWheelEvent e) { |
820 | 826 |
try { |
821 | 827 |
currentMapTool.mouseWheelMoved(e); |
822 |
|
|
828 |
|
|
823 | 829 |
// Si el tool actual no ha consumido el evento |
824 | 830 |
// entendemos que quiere el comportamiento por defecto. |
825 | 831 |
if (!e.isConsumed()) |
... | ... | |
840 | 846 |
} |
841 | 847 |
cancelDrawing(); |
842 | 848 |
ViewPort vp = getViewPort(); |
849 |
|
|
843 | 850 |
|
844 |
|
|
845 | 851 |
/* Point2D pReal = new Point2D.Double(vp.getAdjustedExtent().getCenterX(), |
846 | 852 |
vp.getAdjustedExtent().getCenterY()); */ |
847 | 853 |
int amount = e.getWheelRotation(); |
... | ... | |
869 | 875 |
|
870 | 876 |
vp.setExtent(r); |
871 | 877 |
} |
872 |
|
|
873 |
|
|
878 |
|
|
879 |
|
|
874 | 880 |
} |
875 | 881 |
} catch (BehaviorException t) { |
876 | 882 |
throwException(t); |
... | ... | |
926 | 932 |
if (e.getExtentEvents().length > 0) { |
927 | 933 |
redraw = true; |
928 | 934 |
} |
929 |
|
|
935 |
|
|
930 | 936 |
if (e.getProjectionEvents().length > 0) { |
931 | 937 |
//redraw = true; |
932 | 938 |
} |
933 | 939 |
|
934 |
|
|
940 |
|
|
935 | 941 |
if (e.getLayerCollectionEvents().length > 0) { |
936 | 942 |
redraw = true; |
937 | 943 |
} |
... | ... | |
973 | 979 |
public void setPrevTool() { |
974 | 980 |
setTool(prevTool); |
975 | 981 |
} |
976 |
public void zoomIn() { |
|
977 |
Behavior mapTool = (Behavior) namesMapTools.get("zoomIn"); |
|
978 |
ViewPort vp=getViewPort(); |
|
979 |
Rectangle2D r=getViewPort().getAdjustedExtent(); |
|
980 |
Point2D pCenter=vp.fromMapPoint(r.getCenterX(),r.getCenterY()); |
|
981 |
MouseEvent e=new MouseEvent((Component)this,MouseEvent.MOUSE_RELEASED,MouseEvent.ACTION_EVENT_MASK,MouseEvent.BUTTON1,(int)pCenter.getX(),(int)pCenter.getY(),1,true,MouseEvent.BUTTON1); |
|
982 |
try { |
|
983 |
mapTool.mousePressed(e); |
|
984 |
mapTool.mouseReleased(e); |
|
985 |
} catch (BehaviorException t) { |
|
986 |
throwException(t); |
|
987 |
} |
|
988 |
} |
|
989 |
public void zoomOut() { |
|
990 |
Behavior mapTool = (Behavior) namesMapTools.get("zoomOut"); |
|
991 |
ViewPort vp=getViewPort(); |
|
992 |
Rectangle2D r=getViewPort().getAdjustedExtent(); |
|
993 |
Point2D pCenter=vp.fromMapPoint(r.getCenterX(),r.getCenterY()); |
|
994 |
MouseEvent e=new MouseEvent((Component)this,MouseEvent.MOUSE_RELEASED,MouseEvent.ACTION_EVENT_MASK,MouseEvent.BUTTON1,(int)pCenter.getX(),(int)pCenter.getY(),1,true,MouseEvent.BUTTON1); |
|
995 |
try { |
|
996 |
mapTool.mousePressed(e); |
|
997 |
mapTool.mouseReleased(e); |
|
998 |
} catch (BehaviorException t) { |
|
999 |
throwException(t); |
|
1000 |
} |
|
1001 |
} |
|
982 |
|
|
1002 | 983 |
} |
Also available in: Unified diff