104 |
// private static final int IMAGETYPE_withAlpha = |
// private static final int IMAGETYPE_withAlpha = |
105 |
// BufferedImage.TYPE_INT_ARGB; |
// BufferedImage.TYPE_INT_ARGB; |
106 |
private static final int IMAGETYPE = BufferedImage.TYPE_3BYTE_BGR; |
private static final int IMAGETYPE = BufferedImage.TYPE_3BYTE_BGR; |
107 |
|
public XMapPaneTool getTool() { |
108 |
|
return tool; |
109 |
|
} |
110 |
|
|
111 |
private static final int IMAGETYPE_withAlpha = BufferedImage.TYPE_4BYTE_ABGR; |
private static final int IMAGETYPE_withAlpha = BufferedImage.TYPE_4BYTE_ABGR; |
112 |
|
|
113 |
private final static Logger LOGGER = Logger.getLogger(XMapPane.class); |
private final static Logger LOGGER = Logger.getLogger(XMapPane.class); |
178 |
* Flag for no-tool. |
* Flag for no-tool. |
179 |
*/ |
*/ |
180 |
public static final int NONE = -123; |
public static final int NONE = -123; |
181 |
|
// |
182 |
/** |
// /** |
183 |
* Flag fuer Modus "Kartenausschnitt bewegen". Nicht fuer Window-Auswahl |
// * Flag fuer Modus "Kartenausschnitt bewegen". Nicht fuer Window-Auswahl |
184 |
* moeglich! |
// * moeglich! |
185 |
* |
// * |
186 |
* @see #setState(int) |
// * @see #setState(int) |
187 |
*/ |
// */ |
188 |
public static final int PAN = 1; |
// public static final int PAN = 1; |
189 |
|
// |
190 |
/** |
// /** |
191 |
* Flag fuer Modus "Heran zoomen". |
// * Flag fuer Modus "Heran zoomen". |
192 |
* |
// * |
193 |
* @see #setState(int) |
// * @see #setState(int) |
194 |
* @see #setState(int) |
// * @see #setState(int) |
195 |
*/ |
// */ |
196 |
public static final int ZOOM_IN = 2; |
// public static final int ZOOM_IN = 2; |
197 |
|
// |
198 |
/** |
// /** |
199 |
* Flag fuer Modus "Heraus zoomen". Nicht fuer Window-Auswahl moeglich! |
// * Flag fuer Modus "Heraus zoomen". Nicht fuer Window-Auswahl moeglich! |
200 |
* |
// * |
201 |
* @see #setState(int) |
// * @see #setState(int) |
202 |
*/ |
// */ |
203 |
public static final int ZOOM_OUT = 3; |
// public static final int ZOOM_OUT = 3; |
|
|
|
|
/** |
|
|
* Flag fuer Modus "SimpleFeature-Auswahl auf allen (sichtbaren) Layern". |
|
|
* |
|
|
* @see #setState(int) |
|
|
* @see #setState(int) |
|
|
*/ |
|
|
public static final int SELECT_ALL = 103; |
|
|
/** |
|
|
* Flag fuer Modus |
|
|
* "Auswahl nur eines Features, das erste sichtbare von Oben". |
|
|
* |
|
|
* @see #setState(int) |
|
|
* @see #setState(int) |
|
|
*/ |
|
|
public static final int SELECT_ONE_FROM_TOP = 104; |
|
|
/** |
|
|
* Flag fuer Modus |
|
|
* "SimpleFeature-Auswahl auf dem obersten (sichtbaren) Layer". |
|
|
* |
|
|
* @see #setState(int) |
|
|
* @see #setState(int) |
|
|
*/ |
|
|
public static final int SELECT_TOP = 4; |
|
204 |
|
|
205 |
/** |
/** |
206 |
* {@link Font} used to paint the wait messages into the map |
* {@link Font} used to paint the wait messages into the map |
541 |
* thread. |
* thread. |
542 |
*/ |
*/ |
543 |
final private Timer startRenderThreadsTimer; |
final private Timer startRenderThreadsTimer; |
544 |
|
// |
545 |
/** |
// /** |
546 |
* The default state is ZOOM_IN, hence by default the |
// * The default state is ZOOM_IN, hence by default the |
547 |
* {@link #xMapPaneMouseListener} is also enabled. |
// * {@link #xMapPaneMouseListener} is also enabled. |
548 |
**/ |
// **/ |
549 |
private int state = ZOOM_IN; |
// private int state = ZOOM_IN; |
550 |
|
|
551 |
/** |
/** |
552 |
* Manuell gesetzter statischer Cursor, unabhaengig von der aktuellen |
* Manuell gesetzter statischer Cursor, unabhaengig von der aktuellen |
611 |
this.addMouseListener(xMapPaneMouseListener); |
this.addMouseListener(xMapPaneMouseListener); |
612 |
this.addMouseMotionListener(xMapPaneMouseListener); |
this.addMouseMotionListener(xMapPaneMouseListener); |
613 |
this.addMouseWheelListener(xMapPaneMouseListener); |
this.addMouseWheelListener(xMapPaneMouseListener); |
614 |
xMapPaneMouseListener.actions.put(MouseInputType.LClick, |
|
615 |
XMapPaneAction.ZOOM_IN); |
// By default the XMapPAne uses the ZOOM_IN tool. |
616 |
xMapPaneMouseListener.actions.put(MouseInputType.LDrag, |
setTool(XMapPaneTool.ZOOM_IN); |
617 |
XMapPaneAction.ZOOM_IN); |
|
|
xMapPaneMouseListener.actions.put(MouseInputType.Wheel, |
|
|
XMapPaneAction.ZOOM_IN); |
|
|
|
|
|
xMapPaneMouseListener.actions.put(MouseInputType.RClick, |
|
|
XMapPaneAction.SELECT_ALL); |
|
|
|
|
|
xMapPaneMouseListener.actions.put(MouseInputType.RDrag, |
|
|
XMapPaneAction.PAN); |
|
|
|
|
618 |
/* |
/* |
619 |
* We use a Timer object to avoid rendering delays and flickering when |
* We use a Timer object to avoid rendering delays and flickering when |
620 |
* the user is drag-resizing the parent container of this map pane. |
* the user is drag-resizing the parent container of this map pane. |
1288 |
return new AffineTransform(screenToWorld); |
return new AffineTransform(screenToWorld); |
1289 |
} |
} |
1290 |
|
|
1291 |
public int getState() { |
// public int getState() { |
1292 |
return state; |
// return state; |
1293 |
} |
// } |
1294 |
|
|
1295 |
/** |
/** |
1296 |
* Liefert den statisch eingestellten Cursor, der unabhaengig von der |
* Liefert den statisch eingestellten Cursor, der unabhaengig von der |
1928 |
|
|
1929 |
// /** Stored the time used for the last real rendering in ms. **/ |
// /** Stored the time used for the last real rendering in ms. **/ |
1930 |
private long lastRenderingDuration = 1000; |
private long lastRenderingDuration = 1000; |
1931 |
private XMapPaneTool tool = XMapPaneTool.INFO; |
private XMapPaneTool tool = null; |
1932 |
|
|
1933 |
/** |
/** |
1934 |
* Set the minimum (nearest) allowed zoom scale. This is the bigger number |
* Set the minimum (nearest) allowed zoom scale. This is the bigger number |
1960 |
this.rendererHints = rendererHints; |
this.rendererHints = rendererHints; |
1961 |
} |
} |
1962 |
|
|
1963 |
/** |
// @Deprecated |
1964 |
* Enables/Disables the ZOOM Mouse Listener. Upates the Cursor and stops the |
// public void setState(final int state) { |
1965 |
* repaint Timer if |
// this.state = state; |
1966 |
* |
// |
1967 |
* @param state |
// // throw new RuntimeException("Old concept.. migrate to new concept!"); |
1968 |
*/ |
// |
1969 |
@Deprecated |
// // xMapPaneMouseListener.setEnabled((state == ZOOM_IN |
1970 |
public void setState(final int state) { |
// // || state == ZOOM_OUT || state == PAN)); |
1971 |
this.state = state; |
// |
1972 |
|
// // Je nach Aktion den Cursor umsetzen |
1973 |
// throw new RuntimeException("Old concept.. migrate to new concept!"); |
// updateCursor(); |
1974 |
|
// } |
|
// xMapPaneMouseListener.setEnabled((state == ZOOM_IN |
|
|
// || state == ZOOM_OUT || state == PAN)); |
|
|
|
|
|
// Je nach Aktion den Cursor umsetzen |
|
|
updateCursor(); |
|
|
} |
|
1975 |
|
|
1976 |
public void configureMouse(MouseInputType type, XMapPaneAction action) { |
public void configureMouse(MouseInputType type, XMapPaneAction action) { |
1977 |
xMapPaneMouseListener.actions.put(type, action); |
xMapPaneMouseListener.actions.put(type, action); |
1978 |
} |
} |
1979 |
|
|
1980 |
/** |
/** |
1981 |
* Configure the tool that active on the map |
* Configure the {@link XMapPaneTool} that active on the map. Passing |
1982 |
|
* <code>null</code> will set the NO_ACTION tool. |
1983 |
*/ |
*/ |
1984 |
public void setTool(XMapPaneTool tool) { |
public void setTool(XMapPaneTool tool) { |
1985 |
|
if (tool == null) |
1986 |
|
tool = XMapPaneTool.NO_ACTION; |
1987 |
this.tool = tool; |
this.tool = tool; |
1988 |
xMapPaneMouseListener.configure(tool); |
xMapPaneMouseListener.configure(tool); |
1989 |
setCursor(tool.cursor); |
setCursor(tool.cursor); |
2160 |
} |
} |
2161 |
|
|
2162 |
setCursor(tool.cursor); |
setCursor(tool.cursor); |
2163 |
|
|
2164 |
// |
// |
2165 |
// // Set the cursor depending on what tool is in use... |
// // Set the cursor depending on what tool is in use... |
2166 |
// switch (state) { |
// switch (state) { |