Revision 12208
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/MapControl.java | ||
---|---|---|
93 | 93 |
//private static Logger logger = Logger.getLogger(MapControl.class.getName()); |
94 | 94 |
private MapContext mapContext = null; |
95 | 95 |
//private boolean drawerAlive = false; |
96 |
private HashMap namesMapTools = new HashMap();
|
|
97 |
private Behavior currentMapTool = null;
|
|
96 |
protected HashMap namesMapTools = new HashMap();
|
|
97 |
protected Behavior currentMapTool = null;
|
|
98 | 98 |
private int status = DESACTUALIZADO; |
99 | 99 |
private BufferedImage image = null; |
100 |
private String currentTool;
|
|
100 |
protected String currentTool;
|
|
101 | 101 |
private CancelDraw canceldraw; |
102 | 102 |
//private boolean isCancelled = true; |
103 | 103 |
private Timer timer; |
... | ... | |
109 | 109 |
private MapContextListener mapContextListener = new MapContextListener(); |
110 | 110 |
private ExceptionHandlingSupport exceptionHandlingSupport = new ExceptionHandlingSupport(); |
111 | 111 |
|
112 |
private String prevTool;
|
|
112 |
protected String prevTool;
|
|
113 | 113 |
|
114 | 114 |
/** |
115 | 115 |
* We need this to avoid not wanted refresh. REMEMBER TO SET TO TRUE!! |
... | ... | |
802 | 802 |
*/ |
803 | 803 |
public void mouseClicked(MouseEvent e) { |
804 | 804 |
try { |
805 |
currentMapTool.mouseClicked(e); |
|
805 |
if (currentMapTool != null) |
|
806 |
currentMapTool.mouseClicked(e); |
|
806 | 807 |
} catch (BehaviorException t) { |
807 | 808 |
throwException(t); |
808 | 809 |
} |
... | ... | |
813 | 814 |
*/ |
814 | 815 |
public void mouseEntered(MouseEvent e) { |
815 | 816 |
try { |
816 |
currentMapTool.mouseEntered(e); |
|
817 |
if (currentMapTool != null) |
|
818 |
currentMapTool.mouseEntered(e); |
|
817 | 819 |
} catch (BehaviorException t) { |
818 | 820 |
throwException(t); |
819 | 821 |
} |
... | ... | |
824 | 826 |
*/ |
825 | 827 |
public void mouseExited(MouseEvent e) { |
826 | 828 |
try { |
827 |
currentMapTool.mouseExited(e); |
|
829 |
if (currentMapTool != null) |
|
830 |
currentMapTool.mouseExited(e); |
|
828 | 831 |
} catch (BehaviorException t) { |
829 | 832 |
throwException(t); |
830 | 833 |
} |
... | ... | |
835 | 838 |
*/ |
836 | 839 |
public void mousePressed(MouseEvent e) { |
837 | 840 |
try { |
838 |
currentMapTool.mousePressed(e); |
|
841 |
if (currentMapTool != null) |
|
842 |
currentMapTool.mousePressed(e); |
|
839 | 843 |
} catch (BehaviorException t) { |
840 | 844 |
throwException(t); |
841 | 845 |
} |
... | ... | |
846 | 850 |
*/ |
847 | 851 |
public void mouseReleased(MouseEvent e) { |
848 | 852 |
try { |
849 |
currentMapTool.mouseReleased(e); |
|
853 |
if (currentMapTool != null) |
|
854 |
currentMapTool.mouseReleased(e); |
|
850 | 855 |
} catch (BehaviorException t) { |
851 | 856 |
throwException(t); |
852 | 857 |
} |
... | ... | |
857 | 862 |
*/ |
858 | 863 |
public void mouseWheelMoved(MouseWheelEvent e) { |
859 | 864 |
try { |
865 |
if (currentMapTool == null) |
|
866 |
return; |
|
867 |
|
|
860 | 868 |
currentMapTool.mouseWheelMoved(e); |
861 | 869 |
|
862 | 870 |
// Si el tool actual no ha consumido el evento |
... | ... | |
921 | 929 |
*/ |
922 | 930 |
public void mouseDragged(MouseEvent e) { |
923 | 931 |
try { |
924 |
currentMapTool.mouseDragged(e); |
|
932 |
if (currentMapTool != null) |
|
933 |
currentMapTool.mouseDragged(e); |
|
925 | 934 |
} catch (BehaviorException t) { |
926 | 935 |
throwException(t); |
927 | 936 |
} |
... | ... | |
932 | 941 |
*/ |
933 | 942 |
public void mouseMoved(MouseEvent e) { |
934 | 943 |
try { |
935 |
currentMapTool.mouseMoved(e); |
|
944 |
if (currentMapTool != null) |
|
945 |
currentMapTool.mouseMoved(e); |
|
936 | 946 |
} catch (BehaviorException t) { |
937 | 947 |
throwException(t); |
938 | 948 |
} |
... | ... | |
1041 | 1051 |
throwException(t); |
1042 | 1052 |
} |
1043 | 1053 |
} |
1044 |
|
|
1045 |
|
|
1054 |
public MapToolListener getMapToolListener() { |
|
1055 |
return mapToolListener; |
|
1056 |
} |
|
1057 |
// mapTool can be null, for instance, in 3D's navigation tools |
|
1058 |
public void setCurrentMapTool(Behavior mapTool ){ |
|
1059 |
currentMapTool = mapTool; |
|
1060 |
} |
|
1046 | 1061 |
} |
Also available in: Unified diff