Ignore:
Timestamp:
29.09.2005 00:33:19 (7 years ago)
Author:
imi
Message:

Added selection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/gui/MapView.java

    r1 r2  
    44import java.awt.Component; 
    55import java.awt.Graphics; 
     6import java.awt.Point; 
    67import java.awt.event.ActionEvent; 
    78import java.awt.event.ComponentEvent; 
     
    126127                addComponentListener(this); 
    127128                 
     129                // initialize the movement listener 
     130                new MapMover(this); 
     131                 
    128132                // initialize the projection 
    129133                setProjection(Main.pref.projection.clone()); 
     
    152156                        getProjection().xy2latlon(p); 
    153157                return p; 
     158        } 
     159         
     160        /** 
     161         * Return the point on the screen where this GeoPoint would be. 
     162         * @param point The point, where this geopoint would be drawn. 
     163         * @return The point on screen where "point" would be drawn, relative 
     164         *              to the own top/left. 
     165         */ 
     166        public Point getScreenPoint(GeoPoint point) { 
     167                GeoPoint p; 
     168                if (!Double.isNaN(point.x) && !Double.isNaN(point.y)) 
     169                        p = point; 
     170                else { 
     171                        if (Double.isNaN(point.lat) || Double.isNaN(point.lon)) 
     172                                throw new IllegalArgumentException("point: Either lat/lon or x/y must be set."); 
     173                        p = point.clone(); 
     174                        projection.latlon2xy(p); 
     175                } 
     176                return new Point(toScreenX(p.x), toScreenY(p.y)); 
    154177        } 
    155178         
     
    225248                 
    226249                // draw tracks 
    227                 g.setColor(Color.RED); 
    228250                if (dataSet.tracks != null) 
    229251                        for (Track track : dataSet.tracks) 
    230                                 for (LineSegment ls : track.segments) 
     252                                for (LineSegment ls : track.segments) { 
     253                                        g.setColor(ls.selected ? Color.WHITE : Color.GRAY); 
    231254                                        g.drawLine(toScreenX(ls.start.coor.x), toScreenY(ls.start.coor.y), 
    232255                                                        toScreenX(ls.end.coor.x), toScreenY(ls.end.coor.y)); 
     256                                } 
    233257 
    234258                // draw nodes 
    235                 g.setColor(Color.YELLOW); 
    236259                for (Node w : dataSet.allNodes) { 
     260                        g.setColor(w.selected ? Color.WHITE : Color.RED); 
    237261                        g.drawArc(toScreenX(w.coor.x), toScreenY(w.coor.y), 3, 3, 0, 360); 
    238262                } 
Note: See TracChangeset for help on using the changeset viewer.