Ignore:
Timestamp:
2009-09-06T23:07:33+02:00 (14 years ago)
Author:
Gubaer
Message:

new: rewrite of CombineWay action
new: conflict resolution dialog for CombineWay, including conflicts for different relation memberships
cleanup: cleanup in OsmReader, reduces memory footprint and reduces parsing time
cleanup: made most of the public fields in OsmPrimitive @deprecated, added accessors and changed the code
cleanup: replaced usages of @deprecated constructors for ExtendedDialog
fixed #3208: Combine ways brokes relation order

WARNING: this changeset touches a lot of code all over the code base. "latest" might become slightly unstable in the next days. Also experience incompatibility issues with plugins in the next few days.

Location:
trunk/src/org/openstreetmap/josm/command
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/ChangeRelationMemberRoleCommand.java

    r2025 r2070  
    4949
    5050        oldRole = relation.getMember(position).getRole();
    51         relation.getMember(position).role = newRole;
     51        relation.getMember(position).getRole().equals(newRole);
    5252
    5353        oldModified = relation.isModified();
     
    5757
    5858    @Override public void undoCommand() {
    59         relation.getMember(position).role = oldRole;
     59        relation.getMember(position).getRole().equals(oldRole);
    6060        relation.setModified(oldModified);
    6161    }
  • trunk/src/org/openstreetmap/josm/command/DeleteCommand.java

    r2054 r2070  
    9292        super.executeCommand();
    9393        for (OsmPrimitive osm : toDelete) {
    94             osm.delete(true);
     94            osm.setDeleted(true);
    9595        }
    9696        return true;
  • trunk/src/org/openstreetmap/josm/command/DeletedStateConflictResolveCommand.java

    r2039 r2070  
    7171            if (conflict.getTheir().isDeleted()) {
    7272                layer.data.unlinkReferencesToPrimitive(conflict.getMy());
    73                 conflict.getMy().delete(true);
     73                conflict.getMy().setDeleted(true);
    7474            } else {
    75                 conflict.getMy().delete(conflict.getTheir().isDeleted());
     75                conflict.getMy().setDeleted(conflict.getTheir().isDeleted());
    7676            }
    7777        } else
  • trunk/src/org/openstreetmap/josm/command/PurgePrimitivesCommand.java

    r1938 r2070  
    185185            if (pair.getParent() instanceof Way) {
    186186                Way w = (Way)pair.getParent();
    187                 System.out.println(tr("removing reference from way {0}",w.id));
     187                System.out.println(tr("removing reference from way {0}",w.getId()));
    188188                List<Node> wayNodes = w.getNodes();
    189189                wayNodes.remove(primitive);
     
    194194                if (w.getNodesCount() < 2) {
    195195                    System.out.println(tr("Warning: Purging way {0} because number of nodes dropped below 2. Current is {1}",
    196                             w.id,w.getNodesCount()));
     196                            w.getId(),w.getNodesCount()));
    197197                    if (!hive.contains(w)) {
    198198                        hive.add(w);
     
    201201            } else if (pair.getParent() instanceof Relation) {
    202202                Relation r = (Relation)pair.getParent();
    203                 System.out.println(tr("removing reference from relation {0}",r.id));
     203                System.out.println(tr("removing reference from relation {0}",r.getId()));
    204204                r.removeMembersFor(primitive);
    205205            }
  • trunk/src/org/openstreetmap/josm/command/RelationMemberConflictResolverCommand.java

    r1951 r2070  
    5656        return new DefaultMutableTreeNode(
    5757                new JLabel(
    58                         tr("Resolve conflicts in member list of relation {0}", my.id),
     58                        tr("Resolve conflicts in member list of relation {0}", my.getId()),
    5959                        ImageProvider.get("data", "object"),
    6060                        JLabel.HORIZONTAL
  • trunk/src/org/openstreetmap/josm/command/RemoveRelationMemberCommand.java

    r1990 r2070  
    5151        } else {
    5252            relation.removeMember(removeIndex);
    53             relation.modified = true;
     53            relation.setModified(true);
    5454            return true;
    5555        }
     
    5959        super.undoCommand();
    6060        relation.addMember(member);
    61         relation.modified = this.getOrig(relation).modified;
     61        relation.setModified(this.getOrig(relation).isModified());
    6262    }
    6363
     
    6666    @Override public MutableTreeNode description() {
    6767        String msg = "";
    68         switch(OsmPrimitiveType.from(member.member)) {
    69         case NODE: msg = marktr("Remove node ''{0}'' at position {1} from relation ''{2}''"); break;
    70         case WAY: msg = marktr("Remove way ''{0}'' at position {1} from relation ''{2}''"); break;
    71         case RELATION: msg = marktr("Remove relation ''{0}'' at position {1} from relation ''{2}''"); break;
     68        switch(OsmPrimitiveType.from(member.getMember())) {
     69            case NODE: msg = marktr("Remove node ''{0}'' at position {1} from relation ''{2}''"); break;
     70            case WAY: msg = marktr("Remove way ''{0}'' at position {1} from relation ''{2}''"); break;
     71            case RELATION: msg = marktr("Remove relation ''{0}'' at position {1} from relation ''{2}''"); break;
    7272        }
    7373        return new DefaultMutableTreeNode(
    7474                new JLabel(
    7575                        tr(msg,
    76                                 member.member.getDisplayName(DefaultNameFormatter.getInstance()),
     76                                member.getMember().getDisplayName(DefaultNameFormatter.getInstance()),
    7777                                relation.getMembers().indexOf(member),
    7878                                relation.getDisplayName(DefaultNameFormatter.getInstance())
  • trunk/src/org/openstreetmap/josm/command/RotateCommand.java

    r2017 r2070  
    7676            os.latlon = new LatLon(n.getCoor());
    7777            os.eastNorth = n.getEastNorth();
    78             os.modified = n.modified;
     78            os.modified = n.isModified();
    7979            oldState.put(n, os);
    8080            pivot = pivot.add(os.eastNorth.east(), os.eastNorth.north());
     
    114114            n.setEastNorth(new EastNorth(nx, ny));
    115115            if (setModified) {
    116                 n.modified = true;
     116                n.setModified(true);
    117117            }
    118118        }
     
    128128            OldState os = oldState.get(n);
    129129            n.setCoor(os.latlon);
    130             n.modified = os.modified;
     130            n.setModified(os.modified);
    131131        }
    132132    }
  • trunk/src/org/openstreetmap/josm/command/TagConflictResolveCommand.java

    r2017 r2070  
    6767        String msg = "";
    6868        switch(OsmPrimitiveType.from(conflict.getMy())) {
    69         case NODE: msg = marktr("Resolve {0} tag conflicts in node {1}"); break;
    70         case WAY: msg = marktr("Resolve {0} tag conflicts in way {1}"); break;
    71         case RELATION: msg = marktr("Resolve {0} tag conflicts in relation {1}"); break;
     69            case NODE: msg = marktr("Resolve {0} tag conflicts in node {1}"); break;
     70            case WAY: msg = marktr("Resolve {0} tag conflicts in way {1}"); break;
     71            case RELATION: msg = marktr("Resolve {0} tag conflicts in relation {1}"); break;
    7272        }
    7373        return new DefaultMutableTreeNode(
    7474                new JLabel(
    75                         tr(msg,getNumDecidedConflicts(), conflict.getMy().id),
     75                        tr(msg,getNumDecidedConflicts(), conflict.getMy().getId()),
    7676                        ImageProvider.get("data", "object"),
    7777                        JLabel.HORIZONTAL
  • trunk/src/org/openstreetmap/josm/command/UndeletePrimitivesCommand.java

    r2017 r2070  
    8080                getLayer().getConflicts().remove(primitive);
    8181            }
    82             primitive.id = 0;
     82            primitive.clearOsmId();
    8383        }
    8484        return true;
  • trunk/src/org/openstreetmap/josm/command/VersionConflictResolveCommand.java

    r2017 r2070  
    3939        String msg = "";
    4040        switch(OsmPrimitiveType.from(conflict.getMy())) {
    41         case NODE: msg = marktr("Resolve version conflicts for node {0}"); break;
    42         case WAY: msg = marktr("Resolve version conflicts for way {0}"); break;
    43         case RELATION: msg = marktr("Resolve version conflicts for relation {0}"); break;
     41            case NODE: msg = marktr("Resolve version conflicts for node {0}"); break;
     42            case WAY: msg = marktr("Resolve version conflicts for way {0}"); break;
     43            case RELATION: msg = marktr("Resolve version conflicts for relation {0}"); break;
    4444        }
    4545        return new DefaultMutableTreeNode(
    4646                new JLabel(
    47                         tr(msg,conflict.getMy().id),
     47                        tr(msg,conflict.getMy().getId()),
    4848                        ImageProvider.get("data", "object"),
    4949                        JLabel.HORIZONTAL
     
    5555    public boolean executeCommand() {
    5656        super.executeCommand();
    57         conflict.getMy().version = Math.max(conflict.getMy().version, conflict.getTheir().version);
     57        conflict.getMy().setOsmId(
     58                conflict.getMy().getId(),
     59                (int)Math.max(conflict.getMy().getVersion(), conflict.getTheir().getVersion())
     60        );
    5861        getLayer().getConflicts().remove(conflict);
    5962        rememberConflict(conflict);
  • trunk/src/org/openstreetmap/josm/command/WayNodesConflictResolverCommand.java

    r1910 r2070  
    5252        return new DefaultMutableTreeNode(
    5353                new JLabel(
    54                         tr("Resolve conflicts in node list of of way {0}", conflict.getMy().id),
     54                        tr("Resolve conflicts in node list of of way {0}", conflict.getMy().getId()),
    5555                        ImageProvider.get("data", "object"),
    5656                        JLabel.HORIZONTAL
Note: See TracChangeset for help on using the changeset viewer.