Changeset 25883 in osm


Ignore:
Timestamp:
2011-04-20T22:44:27+02:00 (13 years ago)
Author:
mzdila
Message:

configuration dialog constants

Location:
applications/editors/josm/plugins/simplifyarea/src/sk/zdila/josm/plugin/simplify
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/simplifyarea/src/sk/zdila/josm/plugin/simplify/SimplifyAreaAction.java

    r25560 r25883  
    203203    // average nearby nodes
    204204    private Collection<Command> averageNearbyNodes(final Collection<Way> ways, final Collection<Node> nodesAlreadyDeleted) {
    205         final double mergeThreshold = Main.pref.getDouble("simplify-area.merge.threshold", 0.2);
     205        final double mergeThreshold = Main.pref.getDouble(SimplifyAreaPreferenceSetting.MERGE_THRESHOLD, 0.2);
    206206
    207207        final Map<Node, LatLon> coordMap = new HashMap<Node, LatLon>();
     
    316316
    317317    private void addNodesToDelete(final Collection<Node> nodesToDelete, final Way w) {
    318         final double angleThreshold = Main.pref.getDouble("simplify-area.angle.threshold", 10);
    319         final double angleFactor = Main.pref.getDouble("simplify-area.angle.factor", 1.0);
    320         final double areaThreshold = Main.pref.getDouble("simplify-area.area.threshold", 5.0);
    321         final double areaFactor = Main.pref.getDouble("simplify-area.area.factor", 1.0);
    322         final double distanceThreshold = Main.pref.getDouble("simplify-area.dist.threshold", 3);
    323         final double distanceFactor = Main.pref.getDouble("simplify-area.dist.factor", 3);
     318        final double angleThreshold = Main.pref.getDouble(SimplifyAreaPreferenceSetting.ANGLE_THRESHOLD, 10);
     319        final double angleFactor = Main.pref.getDouble(SimplifyAreaPreferenceSetting.ANGLE_FACTOR, 1.0);
     320        final double areaThreshold = Main.pref.getDouble(SimplifyAreaPreferenceSetting.AREA_THRESHOLD, 5.0);
     321        final double areaFactor = Main.pref.getDouble(SimplifyAreaPreferenceSetting.AREA_FACTOR, 1.0);
     322        final double distanceThreshold = Main.pref.getDouble(SimplifyAreaPreferenceSetting.DIST_THRESHOLD, 3);
     323        final double distanceFactor = Main.pref.getDouble(SimplifyAreaPreferenceSetting.DIST_FACTOR, 3);
    324324
    325325        final List<Node> nodes = w.getNodes();
  • applications/editors/josm/plugins/simplifyarea/src/sk/zdila/josm/plugin/simplify/SimplifyAreaPreferenceSetting.java

    r25881 r25883  
    1414
    1515public class SimplifyAreaPreferenceSetting implements PreferenceSetting {
     16
     17    static final String DIST_FACTOR = "simplify-area.dist.factor";
     18    static final String DIST_THRESHOLD = "simplify-area.dist.threshold";
     19    static final String AREA_FACTOR = "simplify-area.area.factor";
     20    static final String AREA_THRESHOLD = "simplify-area.area.threshold";
     21    static final String ANGLE_FACTOR = "simplify-area.angle.factor";
     22    static final String ANGLE_THRESHOLD = "simplify-area.angle.threshold";
     23    static final String MERGE_THRESHOLD = "simplify-area.merge.threshold";
    1624
    1725    private final JTextField mergeThreshold = new JTextField(8);
     
    3644                        "Merge Nearby Nodes is another step of the simplification that merges adjanced nodes that are closer than <u>Threshold</u> meters.");
    3745
    38         angleThreshold.setText(Main.pref.get("simplify-area.angle.threshold", "10"));
     46        angleThreshold.setText(Main.pref.get(ANGLE_THRESHOLD, "10"));
    3947        tab.add(new JLabel(tr("Angle Threshold")), GBC.std());
    4048        tab.add(angleThreshold, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
    4149
    42         angleFactor.setText(Main.pref.get("simplify-area.angle.factor", "1.0"));
     50        angleFactor.setText(Main.pref.get(ANGLE_FACTOR, "1.0"));
    4351        tab.add(new JLabel(tr("Angle Factor")), GBC.std());
    4452        tab.add(angleFactor, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
    4553
    46         areaThreshold.setText(Main.pref.get("simplify-area.area.threshold", "5.0"));
     54        areaThreshold.setText(Main.pref.get(AREA_THRESHOLD, "5.0"));
    4755        tab.add(new JLabel(tr("Area Threshold")), GBC.std());
    4856        tab.add(areaThreshold, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
    4957
    50         areaFactor.setText(Main.pref.get("simplify-area.area.factor", "1.0"));
     58        areaFactor.setText(Main.pref.get(AREA_FACTOR, "1.0"));
    5159        tab.add(new JLabel(tr("Area Factor")), GBC.std());
    5260        tab.add(areaFactor, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
    5361
    54         distanceThreshold.setText(Main.pref.get("simplify-area.dist.threshold", "3"));
     62        distanceThreshold.setText(Main.pref.get(DIST_THRESHOLD, "3"));
    5563        tab.add(new JLabel(tr("Distance Threshold")), GBC.std());
    5664        tab.add(distanceThreshold, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
    5765
    58         distanceFactor.setText(Main.pref.get("simplify-area.dist.factor", "3"));
     66        distanceFactor.setText(Main.pref.get(DIST_FACTOR, "3"));
    5967        tab.add(new JLabel(tr("Distance Factor")), GBC.std());
    6068        tab.add(distanceFactor, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
    6169
    62         mergeThreshold.setText(Main.pref.get("simplify-area.merge.threshold", "0.2"));
     70        mergeThreshold.setText(Main.pref.get(MERGE_THRESHOLD, "0.2"));
    6371        // mergeThreshold.setToolTipText(tr("bla bla"));
    6472        tab.add(new JLabel(tr("Merge Nearby Nodes Threshold")), GBC.std());
     
    7078    @Override
    7179    public boolean ok() {
    72         Main.pref.put("simplify-area.merge.threshold", mergeThreshold.getText());
    73         Main.pref.put("simplify-area.angle.threshold", angleThreshold.getText());
    74         Main.pref.put("simplify-area.angle.factor", angleFactor.getText());
    75         Main.pref.put("simplify-area.area.threshold", areaThreshold.getText());
    76         Main.pref.put("simplify-area.area.factor", areaFactor.getText());
    77         Main.pref.put("simplify-area.dist.threshold", distanceThreshold.getText());
    78         Main.pref.put("simplify-area.dist.factor", distanceFactor.getText());
     80        Main.pref.put(MERGE_THRESHOLD, mergeThreshold.getText());
     81        Main.pref.put(ANGLE_THRESHOLD, angleThreshold.getText());
     82        Main.pref.put(ANGLE_FACTOR, angleFactor.getText());
     83        Main.pref.put(AREA_THRESHOLD, areaThreshold.getText());
     84        Main.pref.put(AREA_FACTOR, areaFactor.getText());
     85        Main.pref.put(DIST_THRESHOLD, distanceThreshold.getText());
     86        Main.pref.put(DIST_FACTOR, distanceFactor.getText());
    7987        return false;
    8088    }
Note: See TracChangeset for help on using the changeset viewer.