301 |
final MapLayer layer = event.getLayer(); |
final MapLayer layer = event.getLayer(); |
302 |
layer.addMapLayerListener(bgMapLayerListener); |
layer.addMapLayerListener(bgMapLayerListener); |
303 |
requestStartRendering(); |
requestStartRendering(); |
|
|
|
304 |
} |
} |
305 |
|
|
306 |
@Override |
@Override |
639 |
XMapPaneAction.ZOOM_IN); |
XMapPaneAction.ZOOM_IN); |
640 |
|
|
641 |
xMapPaneMouseListener.actions.put(MouseInputType.RClick, |
xMapPaneMouseListener.actions.put(MouseInputType.RClick, |
642 |
XMapPaneAction.ZOOM_OUT); |
XMapPaneAction.SELECT_ALL); |
643 |
|
|
644 |
xMapPaneMouseListener.actions.put(MouseInputType.RDrag, |
xMapPaneMouseListener.actions.put(MouseInputType.RDrag, |
645 |
XMapPaneAction.PAN); |
XMapPaneAction.PAN); |
1014 |
*/ |
*/ |
1015 |
protected void drawRectangle(final Graphics graphics, final Point startPos, |
protected void drawRectangle(final Graphics graphics, final Point startPos, |
1016 |
final Point e) { |
final Point e) { |
1017 |
drawRectangle(graphics, startPos, e, Color.WHITE); |
drawRectangle(graphics, startPos, e, Color.WHITE, false); |
1018 |
} |
} |
1019 |
|
|
1020 |
/** |
/** |
1022 |
* given point. All in screen coordinates. |
* given point. All in screen coordinates. |
1023 |
*/ |
*/ |
1024 |
protected void drawRectangle(final Graphics graphics, final Point startPos, |
protected void drawRectangle(final Graphics graphics, final Point startPos, |
1025 |
final Point e, Color color) { |
final Point e, Color color, boolean fill) { |
1026 |
|
|
1027 |
if (!isWellDefined()) |
if (!isWellDefined()) |
1028 |
return; |
return; |
1039 |
return; |
return; |
1040 |
|
|
1041 |
graphics.setXORMode(color); |
graphics.setXORMode(color); |
1042 |
|
|
1043 |
|
if (fill) { |
1044 |
|
graphics.fillRect(left, bottom, width, height); |
1045 |
|
graphics.setXORMode(Color.WHITE); |
1046 |
|
} |
1047 |
|
|
1048 |
|
|
1049 |
graphics.drawRect(left, bottom, width, height); |
graphics.drawRect(left, bottom, width, height); |
1050 |
} |
} |
1051 |
|
|
1393 |
*/ |
*/ |
1394 |
public void pan(final int dX, final int dY) { |
public void pan(final int dX, final int dY) { |
1395 |
|
|
|
// if ((getState() == XMapPane.PAN) |
|
|
// || ((event.getModifiersEx() & InputEvent.BUTTON3_DOWN_MASK) != 0)) { |
|
|
|
|
1396 |
// Panning needs a panning coursor |
// Panning needs a panning coursor |
1397 |
if (getCursor() != SwingUtil.PANNING_CURSOR) { |
if (getCursor() != SwingUtil.PANNING_CURSOR) { |
1398 |
setCursor(SwingUtil.PANNING_CURSOR); |
setCursor(SwingUtil.PANNING_CURSOR); |
1957 |
|
|
1958 |
// /** Stored the time used for the last real rendering in ms. **/ |
// /** Stored the time used for the last real rendering in ms. **/ |
1959 |
private long lastRenderingDuration = 1000; |
private long lastRenderingDuration = 1000; |
1960 |
|
private XMapPaneTool tool = XMapPaneTool.INFO; |
1961 |
|
|
1962 |
/** |
/** |
1963 |
* Set the minimum (nearest) allowed zoom scale. This is the bigger number |
* Set the minimum (nearest) allowed zoom scale. This is the bigger number |
2011 |
public void configureMouse(MouseInputType type, XMapPaneAction action) { |
public void configureMouse(MouseInputType type, XMapPaneAction action) { |
2012 |
xMapPaneMouseListener.actions.put(type, action); |
xMapPaneMouseListener.actions.put(type, action); |
2013 |
} |
} |
2014 |
|
|
2015 |
|
/** |
2016 |
|
* Configure the tool that active on the map |
2017 |
|
*/ |
2018 |
|
public void setTool(XMapPaneTool tool) { |
2019 |
|
this.tool = tool; |
2020 |
|
xMapPaneMouseListener.configure(tool); |
2021 |
|
setCursor(tool.cursor); |
2022 |
|
} |
2023 |
|
|
2024 |
/** |
/** |
2025 |
* Standardmaessig wird der Cursor automatisch je nach MapPane-Aktion (Zoom, |
* Standardmaessig wird der Cursor automatisch je nach MapPane-Aktion (Zoom, |
2177 |
repaint(); |
repaint(); |
2178 |
} |
} |
2179 |
} |
} |
2180 |
|
|
2181 |
|
// |
2182 |
// wenn manueller Cursor gesetzt ist, dann diesen verwenden (unabhaengig |
// wenn manueller Cursor gesetzt ist, dann diesen verwenden (unabhaengig |
2183 |
// von der aktuellen Aktion |
// von der aktuellen Aktion |
2184 |
if (this.staticCursor != null) { |
if (this.staticCursor != null) { |
2185 |
setCursor(staticCursor); |
setCursor(staticCursor); |
2186 |
return; |
return; |
2187 |
} |
} |
2188 |
|
|
2189 |
if (getCursor() == SwingUtil.PANNING_CURSOR) { |
if (getCursor() == SwingUtil.PANNING_CURSOR) { |
2190 |
// This cursor will reset itself |
// This cursor will reset itself |
2191 |
return; |
return; |
2192 |
} |
} |
2193 |
|
|
2194 |
// Set the cursor depending on what tool is in use... |
setCursor(tool.cursor); |
2195 |
switch (state) { |
// |
2196 |
case SELECT_TOP: |
// // Set the cursor depending on what tool is in use... |
2197 |
case SELECT_ONE_FROM_TOP: |
// switch (state) { |
2198 |
case SELECT_ALL: |
// case SELECT_TOP: |
2199 |
setCursor(SwingUtil.CROSSHAIR_CURSOR); |
// case SELECT_ONE_FROM_TOP: |
2200 |
break; |
// case SELECT_ALL: |
2201 |
case ZOOM_IN: |
// setCursor(SwingUtil.CROSSHAIR_CURSOR); |
2202 |
setCursor(SwingUtil.ZOOMIN_CURSOR); |
// break; |
2203 |
break; |
// case ZOOM_IN: |
2204 |
case ZOOM_OUT: |
// setCursor(SwingUtil.ZOOMIN_CURSOR); |
2205 |
setCursor(SwingUtil.ZOOMOUT_CURSOR); |
// break; |
2206 |
break; |
// case ZOOM_OUT: |
2207 |
case PAN: |
// setCursor(SwingUtil.ZOOMOUT_CURSOR); |
2208 |
setCursor(SwingUtil.PAN_CURSOR); |
// break; |
2209 |
break; |
// case PAN: |
2210 |
default: |
// setCursor(SwingUtil.PAN_CURSOR); |
2211 |
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
// break; |
2212 |
break; |
// default: |
2213 |
} |
// setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
2214 |
|
// break; |
2215 |
|
// } |
2216 |
} |
} |
2217 |
|
|
2218 |
/** |
/** |