Ignore:
Timestamp:
2012-03-10T06:18:26+01:00 (13 years ago)
Author:
joshdoe
Message:

utilsplugin2, conflation: better assignment of nodes with Replace Geometry

Move Hungarian code from conflation to utilsplugin2, since the former depends on the latter already.

Location:
applications/editors/josm/plugins/conflation/src/org/openstreetmap/josm/plugins/conflation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/conflation/src/org/openstreetmap/josm/plugins/conflation/ConflationCandidateList.java

    r27971 r28027  
    1 /*
    2  * To change this template, choose Tools | Templates
    3  * and open the template in the editor.
    4  */
    51package org.openstreetmap.josm.plugins.conflation;
    62
  • applications/editors/josm/plugins/conflation/src/org/openstreetmap/josm/plugins/conflation/ConflationToggleDialog.java

    r27997 r28027  
    11package org.openstreetmap.josm.plugins.conflation;
    22
     3import utilsplugin2.dumbutils.HungarianAlgorithm;
    34import java.awt.BorderLayout;
    45import java.awt.Component;
     
    206207        @Override
    207208        public void actionPerformed(ActionEvent e) {
     209            //FIXME: should layer listen for selection change?
    208210            ConflationCandidate c = conflationLayer.getSelectedCandidate();
     211            if (c.getReferenceLayer() != c.getSubjectLayer()) {
     212                JOptionPane.showMessageDialog(Main.parent, tr("Conflation between layers isn't supported yet."),
     213                        tr("Cannot conflate between layes"), JOptionPane.ERROR_MESSAGE);
     214                return;
     215            }
    209216            if (ReplaceGeometryUtils.replace(c.getReferenceObject(), c.getSubjectObject())) {
    210217                candidates.remove(c);
     
    331338            int n = subjectSelection.size();
    332339            int m = referenceSelection.size();
    333             int maxLen = Math.max(n, m);
    334             double cost[][] = new double[maxLen][maxLen];
     340            double cost[][] = new double[n][m];
    335341
    336342            // calculate cost matrix
     
    345351            OsmPrimitive subObject, refObject;
    346352            candidates.clear();
    347             for (int i = 0; i < maxLen; i++) {
     353            for (int i = 0; i < n; i++) {
    348354                int subIdx = assignment[i][0];
    349355                int refIdx = assignment[i][1];
Note: See TracChangeset for help on using the changeset viewer.