Changeset 6028 in josm for trunk/src


Ignore:
Timestamp:
2013-06-26T16:08:56+02:00 (11 years ago)
Author:
akks
Message:

fix #8447: last color & stroke customization added: ImproveWayAccuracy and ParallelWay

Location:
trunk/src/org/openstreetmap/josm/actions/mapmode
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java

    r5947 r6028  
    22package org.openstreetmap.josm.actions.mapmode;
    33
     4import static org.openstreetmap.josm.tools.I18n.marktr;
    45import static org.openstreetmap.josm.tools.I18n.tr;
    56import static org.openstreetmap.josm.tools.I18n.trn;
    67
    78import java.awt.AWTEvent;
    8 import java.awt.BasicStroke;
    99import java.awt.Color;
    1010import java.awt.Cursor;
    1111import java.awt.Graphics2D;
    1212import java.awt.Point;
     13import java.awt.Stroke;
    1314import java.awt.Toolkit;
    1415import java.awt.event.AWTEventListener;
     
    4647import org.openstreetmap.josm.gui.layer.MapViewPaintable;
    4748import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     49import org.openstreetmap.josm.gui.util.GuiHelper;
    4850import org.openstreetmap.josm.tools.ImageProvider;
    4951import org.openstreetmap.josm.tools.Pair;
     
    8183    final private Cursor cursorImproveLock;
    8284
    83     private final Color guideColor;
    84     private final BasicStroke selectTargetWayStroke;
    85     private final BasicStroke moveNodeStroke;
    86     private final BasicStroke addNodeStroke;
    87     private final BasicStroke deleteNodeStroke;
    88 
     85    private Color guideColor;
     86    private Stroke selectTargetWayStroke;
     87    private Stroke moveNodeStroke;
     88    private Stroke addNodeStroke;
     89    private Stroke deleteNodeStroke;
     90    private int dotSize;
     91   
    8992    private boolean selectionChangedBlocked = false;
    9093
     
    107110        cursorImproveLock = ImageProvider.getCursor("crosshair", "lock");
    108111
    109         guideColor = PaintColors.HIGHLIGHT.get();
    110         selectTargetWayStroke = new BasicStroke(2, BasicStroke.CAP_ROUND,
    111                 BasicStroke.JOIN_ROUND);
    112         float dash1[] = {4.0f};
    113         moveNodeStroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT,
    114                 BasicStroke.JOIN_MITER, 10.0f, dash1, 0.0f);
    115         addNodeStroke = new BasicStroke(1, BasicStroke.CAP_BUTT,
    116                 BasicStroke.JOIN_MITER);
    117         deleteNodeStroke = new BasicStroke(1, BasicStroke.CAP_BUTT,
    118                 BasicStroke.JOIN_MITER);
    119112    }
    120113
     
    129122        super.enterMode();
    130123
     124        guideColor = Main.pref.getColor(marktr("iwa guide"), null);
     125        if (guideColor == null) guideColor = PaintColors.HIGHLIGHT.get();
     126
     127        selectTargetWayStroke = GuiHelper.getCustomizedStroke(Main.pref.get("iwa.stroke.select-target", "2"));
     128        moveNodeStroke = GuiHelper.getCustomizedStroke(Main.pref.get("iwa.stroke.move-node", "1 6"));
     129        addNodeStroke = GuiHelper.getCustomizedStroke(Main.pref.get("iwa.stroke.add-node", "1"));
     130        deleteNodeStroke = GuiHelper.getCustomizedStroke(Main.pref.get("iwa.stroke.delete-node", "1"));
     131        dotSize = Main.pref.getInteger("iwa.dot-size",6);
     132               
    131133        mv = Main.map.mapView;
    132134        mousePos = null;
     
    309311            if (candidateNode != null) {
    310312                p1 = mv.getPoint(candidateNode);
    311                 g.fillRect(p1.x - 2, p1.y - 2, 6, 6);
     313                g.fillRect(p1.x - dotSize/2, p1.y - dotSize/2, dotSize, dotSize);
    312314            }
    313315
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java

    r5982 r6028  
    66
    77import java.awt.AWTEvent;
    8 import java.awt.BasicStroke;
    98import java.awt.Color;
    109import java.awt.Cursor;
     
    3130import org.openstreetmap.josm.data.osm.Way;
    3231import org.openstreetmap.josm.data.osm.WaySegment;
     32import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors;
    3333import org.openstreetmap.josm.gui.MapFrame;
    3434import org.openstreetmap.josm.gui.MapView;
     
    3838import org.openstreetmap.josm.gui.layer.MapViewPaintable;
    3939import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     40import org.openstreetmap.josm.gui.util.GuiHelper;
    4041import org.openstreetmap.josm.tools.Geometry;
     42import static org.openstreetmap.josm.tools.I18n.marktr;
    4143import org.openstreetmap.josm.tools.ImageProvider;
    4244import org.openstreetmap.josm.tools.Shortcut;
     
    123125    private EastNorth helperLineStart;
    124126    private EastNorth helperLineEnd;
     127   
     128    Stroke helpLineStroke;
     129    Stroke refLineStroke;
     130    Color mainColor;
    125131
    126132    public ParallelWayAction(MapFrame mapFrame) {
     
    148154        mv.addTemporaryLayer(this);
    149155
     156        helpLineStroke = GuiHelper.getCustomizedStroke(getStringPref("stroke.hepler-line", "1" ));
     157        refLineStroke = GuiHelper.getCustomizedStroke(getStringPref("stroke.ref-line", "1 2 2"));
     158        mainColor = Main.pref.getColor(marktr("make parallel helper line"), null);
     159        if (mainColor == null) mainColor = PaintColors.SELECTED.get();               
     160       
    150161        //// Needed to update the mouse cursor if modifiers are changed when the mouse is motionless
    151162        try {
     
    468479
    469480            // FIXME: should clip the line (gets insanely slow when zoomed in on a very long line
    470             Stroke refLineStroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10.0f, new float[] {
    471                     2f, 2f }, 0f);
    472481            g.setStroke(refLineStroke);
    473             g.setColor(Color.RED);
     482            g.setColor(mainColor);
    474483            Point p1 = mv.getPoint(referenceSegment.getFirstNode().getEastNorth());
    475484            Point p2 = mv.getPoint(referenceSegment.getSecondNode().getEastNorth());
    476485            g.drawLine(p1.x, p1.y, p2.x, p2.y);
    477486
    478             Stroke helpLineStroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);
    479487            g.setStroke(helpLineStroke);
    480             g.setColor(Color.RED);
     488            g.setColor(mainColor);
    481489            p1 = mv.getPoint(helperLineStart);
    482490            p2 = mv.getPoint(helperLineEnd);
Note: See TracChangeset for help on using the changeset viewer.