/[schmitzm]/trunk/src/skrueger/geotools/XMapPane.java
ViewVC logotype

Diff of /trunk/src/skrueger/geotools/XMapPane.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

branches/2.0-RC1/src/skrueger/geotools/XMapPane.java revision 620 by alfonx, Mon Jan 25 17:46:06 2010 UTC branches/2.0-RC2/src/skrueger/geotools/XMapPane.java revision 649 by alfonx, Thu Jan 28 17:24:15 2010 UTC
# Line 69  import schmitzm.geotools.map.event.MapLa Line 69  import schmitzm.geotools.map.event.MapLa
69  import schmitzm.lang.LangUtil;  import schmitzm.lang.LangUtil;
70  import schmitzm.swing.JPanel;  import schmitzm.swing.JPanel;
71  import schmitzm.swing.SwingUtil;  import schmitzm.swing.SwingUtil;
72    import schmitzm.swing.event.MouseInputType;
73    
74  import com.vividsolutions.jts.geom.Coordinate;  import com.vividsolutions.jts.geom.Coordinate;
75  import com.vividsolutions.jts.geom.Envelope;  import com.vividsolutions.jts.geom.Envelope;
# Line 107  public class XMapPane extends JPanel { Line 108  public class XMapPane extends JPanel {
108    
109          private final static Logger LOGGER = Logger.getLogger(XMapPane.class);          private final static Logger LOGGER = Logger.getLogger(XMapPane.class);
110    
111            /**
112             * A flag indicating whether the {@link XMapPane} is accepting repaints from
113             * the EDT. @see {@link XMapPane#setPainting(boolean))
114             **/
115          private boolean acceptsRepaintCalls = true;          private boolean acceptsRepaintCalls = true;
116    
117          /**          /**
# Line 560  public class XMapPane extends JPanel { Line 565  public class XMapPane extends JPanel {
565    
566          /**          /**
567           * The default state is ZOOM_IN, hence by default the           * The default state is ZOOM_IN, hence by default the
568           * {@link #zoomMapPaneMouseListener} is also enabled.           * {@link #xMapPaneMouseListener} is also enabled.
569           **/           **/
570          private int state = ZOOM_IN;          private int state = ZOOM_IN;
571    
# Line 572  public class XMapPane extends JPanel { Line 577  public class XMapPane extends JPanel {
577    
578          private AffineTransform worldToScreen;          private AffineTransform worldToScreen;
579    
580            // /**
581            // * This {@link MouseListener} is managing all zoom related tasks
582            // */
583            // private final ZoomXMapPaneMouseListener zoomMapPaneMouseListener = new
584            // ZoomXMapPaneMouseListener(
585            // this);
586    
587          /**          /**
588           * This {@link MouseListener} is managing all zoom related tasks           * This {@link MouseListener} is managing all zoom related tasks
589           */           */
590          public final ZoomXMapPaneMouseListener zoomMapPaneMouseListener = new ZoomXMapPaneMouseListener(          private final XMapPaneMouseListener xMapPaneMouseListener = new XMapPaneMouseListener(
591                          this);                          this);
592    
593          /** Is set if a renderer has an error **/          /** Is set if a renderer has an error **/
# Line 617  public class XMapPane extends JPanel { Line 629  public class XMapPane extends JPanel {
629                  /**                  /**
630                   * Adding the #zoomMapPaneMouseListener                   * Adding the #zoomMapPaneMouseListener
631                   */                   */
632                  this.addMouseListener(zoomMapPaneMouseListener);                  this.addMouseListener(xMapPaneMouseListener);
633                  this.addMouseMotionListener(zoomMapPaneMouseListener);                  this.addMouseMotionListener(xMapPaneMouseListener);
634                  this.addMouseWheelListener(zoomMapPaneMouseListener);                  this.addMouseWheelListener(xMapPaneMouseListener);
635                    xMapPaneMouseListener.actions.put(MouseInputType.LClick,
636                                    XMapPaneAction.ZOOM_IN);
637                    xMapPaneMouseListener.actions.put(MouseInputType.LDrag,
638                                    XMapPaneAction.ZOOM_IN);
639                    xMapPaneMouseListener.actions.put(MouseInputType.Wheel,
640                                    XMapPaneAction.ZOOM_IN);
641    
642                    xMapPaneMouseListener.actions.put(MouseInputType.RClick,
643                                    XMapPaneAction.ZOOM_OUT);
644    
645                    xMapPaneMouseListener.actions.put(MouseInputType.RDrag,
646                                    XMapPaneAction.ZOOM_OUT);
647    
648                  /*                  /*
649                   * We use a Timer object to avoid rendering delays and flickering when                   * We use a Timer object to avoid rendering delays and flickering when
# Line 974  public class XMapPane extends JPanel { Line 998  public class XMapPane extends JPanel {
998                  // Remove all mapPaneListeners that have registered with us                  // Remove all mapPaneListeners that have registered with us
999                  mapPaneListeners.clear();                  mapPaneListeners.clear();
1000    
1001                  removeMouseMotionListener(zoomMapPaneMouseListener);                  removeMouseMotionListener(xMapPaneMouseListener);
1002                  removeMouseListener(zoomMapPaneMouseListener);                  removeMouseListener(xMapPaneMouseListener);
1003    
1004                  if (localContext != null)                  if (localContext != null)
1005                          getMapContext().clearLayerList();                          getMapContext().clearLayerList();
# Line 991  public class XMapPane extends JPanel { Line 1015  public class XMapPane extends JPanel {
1015           */           */
1016          protected void drawRectangle(final Graphics graphics, final Point startPos,          protected void drawRectangle(final Graphics graphics, final Point startPos,
1017                          final Point e) {                          final Point e) {
1018                    drawRectangle(graphics, startPos, e, Color.WHITE);
1019            }
1020    
1021            /**
1022             * Draws a rectangle in XOR mode from the origin at {@link #startPos} to the
1023             * given point. All in screen coordinates.
1024             */
1025            protected void drawRectangle(final Graphics graphics, final Point startPos,
1026                            final Point e, Color color) {
1027    
1028                  if (!isWellDefined())                  if (!isWellDefined())
1029                          return;                          return;
# Line 1006  public class XMapPane extends JPanel { Line 1039  public class XMapPane extends JPanel {
1039                  if (width == 0 && height == 0)                  if (width == 0 && height == 0)
1040                          return;                          return;
1041    
1042                  graphics.setXORMode(Color.WHITE);                  graphics.setXORMode(color);
1043                  graphics.drawRect(left, bottom, width, height);                  graphics.drawRect(left, bottom, width, height);
1044          }          }
1045    
# Line 1669  public class XMapPane extends JPanel { Line 1702  public class XMapPane extends JPanel {
1702    
1703                  if (mapArea == null)                  if (mapArea == null)
1704                          return;                          return;
1705                    
1706                  final ReferencedEnvelope refMapEnv = new ReferencedEnvelope(mapArea,                  final ReferencedEnvelope refMapEnv = new ReferencedEnvelope(mapArea,
1707                                  getMapContext().getCoordinateReferenceSystem());                                  getMapContext().getCoordinateReferenceSystem());
1708    
# Line 1962  public class XMapPane extends JPanel { Line 1995  public class XMapPane extends JPanel {
1995           *           *
1996           * @param state           * @param state
1997           */           */
1998            @Deprecated
1999          public void setState(final int state) {          public void setState(final int state) {
2000                  this.state = state;                  this.state = state;
2001    
2002                  zoomMapPaneMouseListener.setEnabled((state == ZOOM_IN                  // throw new RuntimeException("Old concept.. migrate to new concept!");
2003                                  || state == ZOOM_OUT || state == PAN));  
2004                    // xMapPaneMouseListener.setEnabled((state == ZOOM_IN
2005                    // || state == ZOOM_OUT || state == PAN));
2006    
2007                  // Je nach Aktion den Cursor umsetzen                  // Je nach Aktion den Cursor umsetzen
2008                  updateCursor();                  updateCursor();
2009          }          }
2010    
2011            public void configureMouse(MouseInputType type, XMapPaneAction action) {
2012                    xMapPaneMouseListener.actions.put(type, action);
2013            }
2014    
2015          /**          /**
2016           * Standardmaessig wird der Cursor automatisch je nach MapPane-Aktion (Zoom,           * Standardmaessig wird der Cursor automatisch je nach MapPane-Aktion (Zoom,
2017           * Auswahl, ...) gesetzt. Mit dieser Methode kann ein statischer Cursor           * Auswahl, ...) gesetzt. Mit dieser Methode kann ein statischer Cursor

Legend:
Removed from v.620  
changed lines
  Added in v.649

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26