Ignore:
Timestamp:
2013-04-23T13:17:15+02:00 (12 years ago)
Author:
donvip
Message:

[josm_plugins] Do not use Main.map.mapView instead of mv parameter in paint() methods

Location:
applications/editors/josm/plugins
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java

    r29457 r29531  
    238238            g.setColor(lineColor);
    239239            Point lp=line.getLastPoint();
    240             Point mp=Main.map.mapView.getMousePosition();
     240            Point mp=mv.getMousePosition();
    241241            if (lp!=null && mp!=null) g.drawLine(lp.x,lp.y,mp.x,mp.y);
    242242        }
  • applications/editors/josm/plugins/ImportImagePlugin/src/org/openstreetmap/josm/plugins/ImportImagePlugin/ImageLayer.java

    r28954 r29531  
    162162
    163163            // Position image at the right graphical place
    164             EastNorth center = Main.map.mapView.getCenter();
    165             EastNorth leftop = Main.map.mapView.getEastNorth(0, 0);
    166             double pixel_per_east_unit = (Main.map.mapView.getWidth() / 2.0)
     164            EastNorth center = mv.getCenter();
     165            EastNorth leftop = mv.getEastNorth(0, 0);
     166            double pixel_per_east_unit = (mv.getWidth() / 2.0)
    167167                    / (center.east() - leftop.east());
    168             double pixel_per_north_unit = (Main.map.mapView.getHeight() / 2.0)
     168            double pixel_per_north_unit = (mv.getHeight() / 2.0)
    169169                    / (leftop.north() - center.north());
    170170
     
    182182
    183183            // Determine scale to fit JOSM extents
    184             ProjectionBounds projbounds = Main.map.mapView
    185                     .getProjectionBounds();
     184            ProjectionBounds projbounds = mv.getProjectionBounds();
    186185
    187186            double width = projbounds.maxEast - projbounds.minEast;
     
    193192                    / height;
    194193
    195             double pixels4bbox_width = ratio_x * Main.map.mapView.getWidth();
    196             double pixels4bbox_height = ratio_y * Main.map.mapView.getHeight();
     194            double pixels4bbox_width = ratio_x * mv.getWidth();
     195            double pixels4bbox_height = ratio_y * mv.getHeight();
    197196
    198197            // Scale image to JOSM extents
  • applications/editors/josm/plugins/editgpx/src/org/openstreetmap/josm/plugins/editgpx/EditGpxLayer.java

    r27977 r29531  
    109109                    for (EditGpxWayPoint wayPoint: segment.getWayPoints()) {
    110110                        if (!wayPoint.isDeleted()) {
    111                             Point pnt = Main.map.mapView.getPoint(wayPoint.getCoor().getEastNorth());
     111                            Point pnt = mv.getPoint(wayPoint.getCoor().getEastNorth());
    112112                            g.drawOval(pnt.x - 2, pnt.y - 2, 4, 4);
    113113                        }
  • applications/editors/josm/plugins/measurement/src/org/openstreetmap/josm/plugins/measurement/MeasurementLayer.java

    r28898 r29531  
    7676        Point l = null;
    7777        for(WayPoint p:points){
    78             Point pnt = Main.map.mapView.getPoint(p.getCoor());
     78            Point pnt = mv.getPoint(p.getCoor());
    7979            if (l != null){
    8080                g.drawLine(l.x, l.y, pnt.x, pnt.y);
  • applications/editors/josm/plugins/piclayer/src/org/openstreetmap/josm/plugins/piclayer/layer/PicLayerAbstract.java

    r28559 r29531  
    232232
    233233            // Position image at the right graphical place
    234             EastNorth center = Main.map.mapView.getCenter();
    235             EastNorth leftop = Main.map.mapView.getEastNorth( 0, 0 );
     234            EastNorth center = mv.getCenter();
     235            EastNorth leftop = mv.getEastNorth( 0, 0 );
    236236            // Number of pixels for one unit in east north space.
    237237            // This is the same in x- and y- direction.
    238             double pixel_per_en = ( Main.map.mapView.getWidth() / 2.0 ) / ( center.east() - leftop.east() );
     238            double pixel_per_en = ( mv.getWidth() / 2.0 ) / ( center.east() - leftop.east() );
    239239
    240240            //     This is now the offset in screen pixels
     
    258258
    259259            // Draw additional rectangle for the active pic layer
    260             if ( Main.map.mapView.getActiveLayer() == this ) {
     260            if ( mv.getActiveLayer() == this ) {
    261261                g.setColor( new Color( 0xFF0000 ) );
    262262                g.drawRect(
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/ChosenRelation.java

    r28814 r29531  
    114114        }
    115115
    116         OsmDataLayer dataLayer = Main.map.mapView.getEditLayer();
     116        OsmDataLayer dataLayer = mv.getEditLayer();
    117117        float opacity = dataLayer == null ? 0.0f : !dataLayer.isVisible() ? 0.0f : (float)dataLayer.getOpacity();
    118118        if( opacity < 0.01 )
  • applications/editors/josm/plugins/videomapping/src/org/openstreetmap/josm/plugins/videomapping/VideoPositionLayer.java

    r28924 r29531  
    6969        Collections.sort(ls); //sort basing upon time
    7070        return ls;
    71                
    7271        }
    7372
    7473        @Override
    7574        public void paint(Graphics2D g, MapView map, Bounds bound) {
    76                 paintGpsTrack(g);
    77                 paintSyncedTrack(g);
    78                 paintPositionIcon(g);
     75                paintGpsTrack(g, map);
     76                paintSyncedTrack(g, map);
     77                paintPositionIcon(g, map);
    7978                //paintInterpolatedSegment(g); //just a test for my own
    8079        }
    8180
    82         private void paintGpsTrack(Graphics2D g) {
     81        private void paintGpsTrack(Graphics2D g, MapView map) {
    8382                g.setColor(Color.YELLOW);
    8483        for(WayPoint n: gpsTrack) {
    85             Point p = Main.map.mapView.getPoint(n.getEastNorth());
     84            Point p = map.getPoint(n.getEastNorth());
    8685            g.drawOval(p.x - 2, p.y - 2, 4, 4);
    8786        }
    8887        }
    8988       
    90         private void paintSyncedTrack(Graphics2D g) {
     89        private void paintSyncedTrack(Graphics2D g, MapView map) {
    9190                g.setColor(Color.GREEN);
    9291                for (WayPoint n : gpsTrack) {
    9392                        if (n.attr.containsKey("synced"))
    9493                        {
    95                                 Point p = Main.map.mapView.getPoint(n.getEastNorth());
     94                                Point p = map.getPoint(n.getEastNorth());
    9695                    g.drawOval(p.x - 2, p.y - 2, 4, 4);
    9796                        }                               
     
    10099        }
    101100
    102         private void paintPositionIcon(Graphics2D g) {
    103                 Point p=Main.map.mapView.getPoint(iconPosition.getEastNorth());
     101        private void paintPositionIcon(Graphics2D g, MapView map) {
     102                Point p=map.getPoint(iconPosition.getEastNorth());
    104103        layerIcon.paintIcon(null, g, p.x-layerIcon.getIconWidth()/2, p.y-layerIcon.getIconHeight()/2);
    105104        g.drawString(gpsTimeFormat.format(iconPosition.getTime()),p.x-15,p.y-15);
Note: See TracChangeset for help on using the changeset viewer.