Ignore:
Timestamp:
2011-10-08T12:00:46+02:00 (13 years ago)
Author:
zverik
Message:

fix a couple of bugs

Location:
applications/editors/josm/plugins/utilsplugin2/src/utilsplugin2/dumbutils
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/utilsplugin2/src/utilsplugin2/dumbutils/PasteRelationsAction.java

    r26269 r26804  
    5555            boolean changed = false;
    5656            for( OsmPrimitive p : selection ) {
    57                 if( !r.getMemberPrimitives().contains(p) ) {
     57                if( !r.getMemberPrimitives().contains(p) && !r.equals(p) ) {
    5858                    r.addMember(new RelationMember(relations.get(rel), p));
    5959                    changed = true;
  • applications/editors/josm/plugins/utilsplugin2/src/utilsplugin2/dumbutils/ReplaceGeometryAction.java

    r25887 r26804  
    3232    }
    3333
     34    @Override
    3435    public void actionPerformed( ActionEvent e ) {
    3536        if( getCurrentDataSet() == null ) return;
     
    4344        }
    4445        int idxNew = selection.get(0).isNew() ? 0 : 1;
     46        boolean overrideNewCheck = false;
     47        if( selection.get(1-idxNew).isNew() ) {
     48            // if both are new, select the one with all the DB nodes
     49            boolean areNewNodes = false;
     50            for( Node n : selection.get(0).getNodes() )
     51                if( n.isNew() )
     52                    areNewNodes = true;
     53            idxNew = areNewNodes ? 0 : 1;
     54            overrideNewCheck = true;
     55            for( Node n : selection.get(1-idxNew).getNodes() )
     56                if( n.isNew() )
     57                    overrideNewCheck = false;
     58        }
    4559        Way geometry = selection.get(idxNew);
    4660        Way way = selection.get(1 - idxNew);
    47         if( way.isNew() || !geometry.isNew() ) {
     61        if( !overrideNewCheck && (way.isNew() || !geometry.isNew()) ) {
    4862            JOptionPane.showMessageDialog(Main.parent,
    4963                    tr("Please select one way that exists in the database and one new way with correct geometry."),
Note: See TracChangeset for help on using the changeset viewer.