Changeset 20484 in osm for applications/editors


Ignore:
Timestamp:
2010-03-14T23:50:45+01:00 (14 years ago)
Author:
pieren
Message:

minor fixes

Location:
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/Buildings.java

    r20390 r20484  
    7979    BuildingsImageModifier bim = new BuildingsImageModifier();
    8080
    81     private double snapDistance = Main.pref.getDouble("cadastrewms.snap-distance", 60); // in centimeters
     81    private double snapDistance = Main.pref.getDouble("cadastrewms.snap-distance", 50); // in centimeters
    8282    private double snapDistanceSq = snapDistance*snapDistance;
    8383    private double dx, dy;
     
    173173                            cmds.add(new MoveCommand(nearestNode, dx, dy));
    174174                        }
     175                        if (i>0)
     176                            joinExistingNodesInNewSegment(way2.getNode(i-1), way2.getNode(i));
    175177                    }
    176178                    wayToAdd.addNode(wayToAdd.getNode(0));
     
    411413    }
    412414   
     415    private void joinExistingNodesInNewSegment(Node n1, Node n2) {
     416        // TODO
     417        double minx = Math.min(n1.getEastNorth().getX(), n2.getEastNorth().getX());
     418        double miny = Math.min(n1.getEastNorth().getY(), n2.getEastNorth().getY());
     419        double maxx = Math.max(n1.getEastNorth().getX(), n2.getEastNorth().getX());
     420        double maxy = Math.max(n1.getEastNorth().getY(), n2.getEastNorth().getY());
     421        BBox bbox = new BBox(minx-snapDistance, miny-snapDistance, maxx+snapDistance, maxy+snapDistance);
     422        DataSet ds = getCurrentDataSet();
     423        if (ds == null)
     424            return;
     425        List<Node> ln = ds.searchNodes(bbox);
     426        int i=0;
     427        for (Node n:ln)
     428            if (n.isUsable())
     429                i++;
     430        System.out.println("usable nodes in boxe="+i);
     431    }
     432   
    413433    private void joinNodeToExistingWays(List<WaySegment> wss, Node newNode, Collection<Command> cmds) {
    414434        HashMap<Way, List<Integer>> insertPoints = new HashMap<Way, List<Integer>>();
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java

    r20481 r20484  
    150150        System.out.println("Pluging cadastre-fr v"+VERSION+" started...");
    151151        if (Main.pref.get("cadastrewms.cacheDir").equals(""))
    152             cacheDir = Main.pref.getPreferencesDir()+"plugins"+File.pathSeparatorChar+"cadastrewms"+File.pathSeparatorChar;
     152            cacheDir = Main.pref.getPreferencesDir()+"plugins"+File.separatorChar+"cadastrewms"+File.separatorChar;
    153153        else {
    154154            cacheDir = Main.pref.get("cadastrewms.cacheDir");
    155             if (cacheDir.charAt(cacheDir.length()-1) != File.pathSeparatorChar )
    156                 cacheDir += File.pathSeparatorChar;
     155            if (cacheDir.charAt(cacheDir.length()-1) != File.separatorChar )
     156                cacheDir += File.separatorChar;
    157157        }
    158158        System.out.println("current cache directory: "+cacheDir);
     
    328328            if (oldFrame == null && newFrame != null) {
    329329                setEnabledAll(true);
    330                 Main.map.addMapMode(new IconToggleButton
    331                         (new WMSAdjustAction(Main.map)));
    332                 Main.map.addMapMode(new IconToggleButton
    333                         (new Buildings(Main.map)));
     330                Main.map.addMapMode(new IconToggleButton(new WMSAdjustAction(Main.map)));
     331                if (Main.pref.getBoolean("cadastrewms.buildingsMenu", false))
     332                    Main.map.addMapMode(new IconToggleButton(new Buildings(Main.map)));
    334333            } else if (oldFrame != null && newFrame == null) {
    335334                setEnabledAll(false);
Note: See TracChangeset for help on using the changeset viewer.