Ignore:
Timestamp:
2008-08-10T20:09:05+02:00 (18 years ago)
Author:
tim
Message:

ADDED:
Quick and dirty implementation to switch between Mapnik and Osmarender map tiles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/slippy_map_chooser/src/OsmMapControl.java

    r9585 r9623  
    3131
    3232        private SizeButton iSizeButton = null;
     33        private SourceButton iSourceButton = null;
    3334
    3435        /**
    3536         * Create a new OsmMapControl
    3637         */
    37         public OsmMapControl(SlippyMapChooser navComp, JPanel contentPane, SizeButton sizeButton) {
     38        public OsmMapControl(SlippyMapChooser navComp, JPanel contentPane, SizeButton sizeButton, SourceButton sourceButton) {
    3839                this.iSlippyMapChooser = navComp;
    3940                iSlippyMapChooser.addMouseListener(this);
     
    5354                }
    5455                iSizeButton = sizeButton;
     56                iSourceButton = sourceButton;
    5557        }
    5658
     
    8688        public void mouseReleased(MouseEvent e) {
    8789                if (e.getButton() == MouseEvent.BUTTON1) {
     90                       
     91                        int sourceButton = iSourceButton.hit(e.getPoint());
     92                       
    8893                        if (iSizeButton.hit(e.getPoint())) {
    8994                                iSizeButton.toggle();
    9095                                iSlippyMapChooser.resizeSlippyMap();
    91                         } else {
     96                        }
     97                        else if(sourceButton == SourceButton.HIDE_OR_SHOW) {
     98                                iSourceButton.toggle();
     99                                iSlippyMapChooser.repaint();
     100                               
     101                        }else if(sourceButton == SourceButton.MAPNIK || sourceButton == SourceButton.OSMARENDER) {
     102                                iSlippyMapChooser.toggleMapSource(sourceButton);
     103                        }
     104                        else {
    92105                                if (e.getClickCount() == 1) {
    93106                                        iSlippyMapChooser.setSelection(iStartSelectionPoint, e.getPoint());
     
    98111                                }
    99112                        }
     113                       
    100114                }
    101115        }
Note: See TracChangeset for help on using the changeset viewer.