Changeset 16442 in josm


Ignore:
Timestamp:
2020-05-17T15:57:55+02:00 (3 weeks ago)
Author:
simon04
Message:

Fix typo "referrer"

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java

    r16441 r16442  
    116116            fixNodes.add(w.lastNode());
    117117            fixNodes.addAll(nodes);
    118             fixNodes.addAll(collectNodesWithExternReferers(ways));
     118            fixNodes.addAll(collectNodesWithExternReferrers(ways));
    119119            // Temporary closed way used to reorder nodes
    120120            Way closedWay = new Way(w);
     
    150150
    151151            fixNodes.addAll(inside);
    152             fixNodes.addAll(collectNodesWithExternReferers(ways));
     152            fixNodes.addAll(collectNodesWithExternReferrers(ways));
    153153            nodes = collectNodesAnticlockwise(ways);
    154154            if (nodes.size() < 4) {
     
    246246     * @return List of nodes with more than one referrer
    247247     */
    248     private static List<Node> collectNodesWithExternReferers(List<Way> ways) {
     248    private static List<Node> collectNodesWithExternReferrers(List<Way> ways) {
    249249        return ways.stream().flatMap(w -> w.getNodes().stream()).filter(n -> n.getReferrers().size() > 1).collect(Collectors.toList());
    250250    }
  • trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java

    r16438 r16442  
    204204            return alignMultiWay(selectedWays);
    205205        } else if (selectedNodes.size() == 1) {
    206             // Only 1 node selected -> align this node relative to referers way
     206            // Only 1 node selected -> align this node relative to referrers way
    207207            Node selectedNode = selectedNodes.get(0);
    208208            List<Way> involvedWays;
     
    266266        }
    267267        Collection<Command> cmds = new ArrayList<>(nodes.size());
    268         List<Way> referers = new ArrayList<>(ways.size());
     268        List<Way> referrers = new ArrayList<>(ways.size());
    269269        for (Node n: nodes) {
    270             referers.clear();
     270            referrers.clear();
    271271            for (OsmPrimitive o: n.getReferrers()) {
    272272                if (ways.contains(o))
    273                     referers.add((Way) o);
    274             }
    275             if (referers.size() == 1) {
    276                 Way way = referers.get(0);
     273                    referrers.add((Way) o);
     274            }
     275            if (referrers.size() == 1) {
     276                Way way = referrers.get(0);
    277277                if (way.isFirstLastNode(n)) continue;
    278278                cmds.add(lines.get(way).projectionCommand(n));
    279             } else if (referers.size() == 2) {
    280                 cmds.add(lines.get(referers.get(0)).intersectionCommand(n, lines.get(referers.get(1))));
     279            } else if (referrers.size() == 2) {
     280                cmds.add(lines.get(referrers.get(0)).intersectionCommand(n, lines.get(referrers.get(1))));
    281281            } else
    282282                throw new InvalidSelection(tr("Intersection of three or more ways can not be solved. Abort."));
  • trunk/src/org/openstreetmap/josm/io/OsmServerBackreferenceReader.java

    r16056 r16442  
    8282     *
    8383     * @param primitive the primitive
    84      * @param readFull <code>true</code>, if referers should be read fully (i.e. including their immediate children)
     84     * @param readFull <code>true</code>, if referrers should be read fully (i.e. including their immediate children)
    8585     *
    8686     */
     
    9393     * Creates a back reference reader for given primitive id
    9494     *
    95      * @param id the id of the primitive whose referers are to be read
     95     * @param id the id of the primitive whose referrers are to be read
    9696     * @param type the type of the primitive
    97      * @param readFull true, if referers should be read fully (i.e. including their immediate children)
     97     * @param readFull true, if referrers should be read fully (i.e. including their immediate children)
    9898     *
    9999     * @throws IllegalArgumentException if id &lt;= 0
     
    199199     *
    200200     * <ul>
    201      *   <li>if this reader reads referers for a {@link org.openstreetmap.josm.data.osm.Node}, referring ways are always
     201     *   <li>if this reader reads referrers for a {@link org.openstreetmap.josm.data.osm.Node}, referring ways are always
    202202     *     read fully, unless {@link #setAllowIncompleteParentWays(boolean)} is set to true.</li>
    203      *   <li>if this reader reads referers for an {@link Way} or a {@link Relation}, referring relations
     203     *   <li>if this reader reads referrers for an {@link Way} or a {@link Relation}, referring relations
    204204     *    are only read fully if {@link #setReadFull(boolean)} is set to true.</li>
    205205     * </ul>
  • trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java

    r15426 r16442  
    242242        assertNotNull(w);
    243243
    244         DataSet referers = new OsmServerBackreferenceReader(n).setReadFull(false).parseOsm(NullProgressMonitor.INSTANCE);
    245         printNumberOfPrimitives(referers);
     244        DataSet referrers = new OsmServerBackreferenceReader(n).setReadFull(false).parseOsm(NullProgressMonitor.INSTANCE);
     245        printNumberOfPrimitives(referrers);
    246246
    247247        Set<Long> expectedNodeIds = new HashSet<>();
     
    260260        }
    261261
    262         assertEquals(expectedNodeIds.size(), referers.getNodes().size());
    263         assertEquals(expectedWayIds.size(), referers.getWays().size());
    264         assertEquals(expectedRelationIds.size(), referers.getRelations().size());
    265 
    266         for (Node node : referers.getNodes()) {
     262        assertEquals(expectedNodeIds.size(), referrers.getNodes().size());
     263        assertEquals(expectedWayIds.size(), referrers.getWays().size());
     264        assertEquals(expectedRelationIds.size(), referrers.getRelations().size());
     265
     266        for (Node node : referrers.getNodes()) {
    267267            assertTrue(expectedNodeIds.contains(node.getId()));
    268268            assertFalse(node.isIncomplete());
    269269        }
    270270
    271         for (Way way : referers.getWays()) {
     271        for (Way way : referrers.getWays()) {
    272272            assertTrue(expectedWayIds.contains(way.getId()));
    273273            assertEquals(n.getReferrers().contains(way), !way.isIncomplete());
    274274        }
    275275
    276         for (Relation relation : referers.getRelations()) {
     276        for (Relation relation : referrers.getRelations()) {
    277277            assertTrue(expectedRelationIds.contains(relation.getId()));
    278278            assertFalse(relation.isIncomplete());
     
    280280    }
    281281
    282     private void printNumberOfPrimitives(DataSet referers) {
    283         System.out.println("#nodes=" + referers.getNodes().size() +
    284                 " #ways=" + referers.getWays().size() +
    285                 " #relations=" + referers.getRelations().size());
     282    private void printNumberOfPrimitives(DataSet referrers) {
     283        System.out.println("#nodes=" + referrers.getNodes().size() +
     284                " #ways=" + referrers.getWays().size() +
     285                " #relations=" + referrers.getRelations().size());
    286286    }
    287287
     
    296296        assertNotNull(n);
    297297
    298         DataSet referers = new OsmServerBackreferenceReader(n).setReadFull(true).parseOsm(NullProgressMonitor.INSTANCE);
    299         printNumberOfPrimitives(referers);
     298        DataSet referrers = new OsmServerBackreferenceReader(n).setReadFull(true).parseOsm(NullProgressMonitor.INSTANCE);
     299        printNumberOfPrimitives(referrers);
    300300
    301301        Set<Long> expectedNodeIds = new HashSet<>();
     
    313313        }
    314314
    315         assertEquals(expectedNodeIds.size(), referers.getNodes().size());
    316         assertEquals(expectedWayIds.size(), referers.getWays().size());
    317         assertEquals(expectedRelationIds.size(), referers.getRelations().size());
    318 
    319         for (Node node : referers.getNodes()) {
     315        assertEquals(expectedNodeIds.size(), referrers.getNodes().size());
     316        assertEquals(expectedWayIds.size(), referrers.getWays().size());
     317        assertEquals(expectedRelationIds.size(), referrers.getRelations().size());
     318
     319        for (Node node : referrers.getNodes()) {
    320320            assertTrue(expectedNodeIds.contains(node.getId()));
    321321            assertFalse(node.isIncomplete());
    322322        }
    323323
    324         for (Way way : referers.getWays()) {
     324        for (Way way : referrers.getWays()) {
    325325            assertTrue(expectedWayIds.contains(way.getId()));
    326326            assertFalse(way.isIncomplete());
    327327        }
    328328
    329         for (Relation relation : referers.getRelations()) {
     329        for (Relation relation : referrers.getRelations()) {
    330330            assertTrue(expectedRelationIds.contains(relation.getId()));
    331331            assertFalse(relation.isIncomplete());
     
    345345        //
    346346
    347         DataSet referers = new OsmServerBackreferenceReader(w).setReadFull(false).parseOsm(NullProgressMonitor.INSTANCE);
    348         printNumberOfPrimitives(referers);
     347        DataSet referrers = new OsmServerBackreferenceReader(w).setReadFull(false).parseOsm(NullProgressMonitor.INSTANCE);
     348        printNumberOfPrimitives(referrers);
    349349
    350350        Set<Long> expectedNodeIds = new HashSet<>();
     
    360360        }
    361361
    362         assertEquals(expectedNodeIds.size(), referers.getNodes().size());
    363         assertEquals(expectedWayIds.size(), referers.getWays().size());
    364         assertEquals(expectedRelationIds.size(), referers.getRelations().size());
    365 
    366         for (Way w1 : referers.getWays()) {
     362        assertEquals(expectedNodeIds.size(), referrers.getNodes().size());
     363        assertEquals(expectedWayIds.size(), referrers.getWays().size());
     364        assertEquals(expectedRelationIds.size(), referrers.getRelations().size());
     365
     366        for (Way w1 : referrers.getWays()) {
    367367            assertTrue(w1.isIncomplete());
    368368        }
    369         assertEquals(2, referers.getRelations().size());  // two relations referring to w
    370 
    371         Relation r = lookupRelation(referers, 0);
    372         assertNotNull(r);
    373         assertFalse(r.isIncomplete());
    374         r = lookupRelation(referers, 1);
     369        assertEquals(2, referrers.getRelations().size());  // two relations referring to w
     370
     371        Relation r = lookupRelation(referrers, 0);
     372        assertNotNull(r);
     373        assertFalse(r.isIncomplete());
     374        r = lookupRelation(referrers, 1);
    375375        assertFalse(r.isIncomplete());
    376376    }
     
    388388        //
    389389
    390         DataSet referers = new OsmServerBackreferenceReader(w).setReadFull(true).parseOsm(NullProgressMonitor.INSTANCE);
    391         assertEquals(6, referers.getWays().size());  // 6 ways referred by two relations
    392         for (Way w1 : referers.getWays()) {
     390        DataSet referrers = new OsmServerBackreferenceReader(w).setReadFull(true).parseOsm(NullProgressMonitor.INSTANCE);
     391        assertEquals(6, referrers.getWays().size());  // 6 ways referred by two relations
     392        for (Way w1 : referrers.getWays()) {
    393393            assertFalse(w1.isIncomplete());
    394394        }
    395         assertEquals(2, referers.getRelations().size());  // two relations referring to
     395        assertEquals(2, referrers.getRelations().size());  // two relations referring to
    396396        Set<Long> expectedNodeIds = new HashSet<>();
    397         for (Way way : referers.getWays()) {
     397        for (Way way : referrers.getWays()) {
    398398            Way orig = (Way) ds.getPrimitiveById(way);
    399399            for (Node n : orig.getNodes()) {
     
    401401            }
    402402        }
    403         assertEquals(expectedNodeIds.size(), referers.getNodes().size());
    404         for (Node n : referers.getNodes()) {
     403        assertEquals(expectedNodeIds.size(), referrers.getNodes().size());
     404        for (Node n : referrers.getNodes()) {
    405405            assertTrue(expectedNodeIds.contains(n.getId()));
    406406        }
    407407
    408         Relation r = lookupRelation(referers, 0);
    409         assertNotNull(r);
    410         assertFalse(r.isIncomplete());
    411         r = lookupRelation(referers, 1);
     408        Relation r = lookupRelation(referrers, 0);
     409        assertNotNull(r);
     410        assertFalse(r.isIncomplete());
     411        r = lookupRelation(referrers, 1);
    412412        assertFalse(r.isIncomplete());
    413413    }
     
    426426        //
    427427
    428         DataSet referers = new OsmServerBackreferenceReader(r).setReadFull(false).parseOsm(NullProgressMonitor.INSTANCE);
    429         printNumberOfPrimitives(referers);
     428        DataSet referrers = new OsmServerBackreferenceReader(r).setReadFull(false).parseOsm(NullProgressMonitor.INSTANCE);
     429        printNumberOfPrimitives(referrers);
    430430
    431431        Set<Long> referringRelationsIds = new HashSet<>();
    432         Relation r6 = lookupRelation(referers, 6);
     432        Relation r6 = lookupRelation(referrers, 6);
    433433        assertNotNull(r6);
    434434        assertFalse(r6.isIncomplete());
    435435        referringRelationsIds.add(r6.getId());
    436         Relation r7 = lookupRelation(referers, 7);
     436        Relation r7 = lookupRelation(referrers, 7);
    437437        assertNotNull(r7);
    438438        assertFalse(r7.isIncomplete());
    439439        referringRelationsIds.add(r7.getId());
    440         Relation r8 = lookupRelation(referers, 8);
     440        Relation r8 = lookupRelation(referrers, 8);
    441441        assertNotNull(r8);
    442442        assertFalse(r8.isIncomplete());
    443443        referringRelationsIds.add(r8.getId());
    444         Relation r9 = lookupRelation(referers, 9);
     444        Relation r9 = lookupRelation(referrers, 9);
    445445        assertNotNull(r9);
    446446        assertFalse(r9.isIncomplete());
    447447        referringRelationsIds.add(r9.getId());
    448448
    449         for (Relation r1 : referers.getRelations()) {
     449        for (Relation r1 : referrers.getRelations()) {
    450450            if (!referringRelationsIds.contains(r1.getId())) {
    451451                assertTrue(r1.isIncomplete());
     
    478478        }
    479479
    480         assertEquals(expectedWayIds.size(), referers.getWays().size());
    481         for (Way w1 : referers.getWays()) {
     480        assertEquals(expectedWayIds.size(), referrers.getWays().size());
     481        for (Way w1 : referrers.getWays()) {
    482482            assertTrue(expectedWayIds.contains(w1.getId()));
    483483            assertTrue(w1.isIncomplete());
     
    491491            }
    492492        }
    493         assertEquals(expectedNodeIds.size(), referers.getNodes().size());
     493        assertEquals(expectedNodeIds.size(), referrers.getNodes().size());
    494494    }
    495495
     
    544544        //
    545545
    546         DataSet referers = new OsmServerBackreferenceReader(r).setReadFull(true).parseOsm(NullProgressMonitor.INSTANCE);
    547 
    548         r = lookupRelation(referers, 6);
    549         assertNotNull(r);
    550         assertFalse(r.isIncomplete());
    551         r = lookupRelation(referers, 7);
    552         assertNotNull(r);
    553         assertFalse(r.isIncomplete());
    554         r = lookupRelation(referers, 8);
    555         assertNotNull(r);
    556         assertFalse(r.isIncomplete());
    557         r = lookupRelation(referers, 9);
     546        DataSet referrers = new OsmServerBackreferenceReader(r).setReadFull(true).parseOsm(NullProgressMonitor.INSTANCE);
     547
     548        r = lookupRelation(referrers, 6);
     549        assertNotNull(r);
     550        assertFalse(r.isIncomplete());
     551        r = lookupRelation(referrers, 7);
     552        assertNotNull(r);
     553        assertFalse(r.isIncomplete());
     554        r = lookupRelation(referrers, 8);
     555        assertNotNull(r);
     556        assertFalse(r.isIncomplete());
     557        r = lookupRelation(referrers, 9);
    558558        assertNotNull(r);
    559559        assertFalse(r.isIncomplete());
     
    561561        // all relations are fully loaded
    562562        //
    563         for (Relation r1 : referers.getRelations()) {
     563        for (Relation r1 : referrers.getRelations()) {
    564564            assertFalse(r1.isIncomplete());
    565565        }
     
    590590        }
    591591        for (long id : expectedWayIds) {
    592             Way w = (Way) referers.getPrimitiveById(id, OsmPrimitiveType.WAY);
     592            Way w = (Way) referrers.getPrimitiveById(id, OsmPrimitiveType.WAY);
    593593            assertNotNull(w);
    594594            assertFalse(w.isIncomplete());
     
    601601        }
    602602
    603         assertEquals(expectedNodeIds.size(), referers.getNodes().size());
    604         for (Node n : referers.getNodes()) {
     603        assertEquals(expectedNodeIds.size(), referrers.getNodes().size());
     604        for (Node n : referrers.getNodes()) {
    605605            assertTrue(expectedNodeIds.contains(n.getId()));
    606606        }
Note: See TracChangeset for help on using the changeset viewer.