Skip to content

Commit

Permalink
Add integration test and update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpoole committed Dec 2, 2024
1 parent f781c43 commit 92d2084
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
8 changes: 7 additions & 1 deletion documentation/docs/help/en/Multiselect.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ Remove the objects from the data.

Merge multiple selected ways resulting in a single way. Ways will be reversed if necessary. This option will only be available if only ways with common start/end nodes are selected, or the selection is two closed ways (polygons), in the later case if the polygons do not have common nodes a multi-polygon relation will be created and the ways added as members. If post-merge tag conflicts are detected you will be alerted.

### Add node at intersection
### Extract segment

If you have selected exactly two nodes on the same way, you can extract the segment of the way between the two nodes. If the way is closed the segment extracted will between the first and 2nd node selected in the winding direction (clockwise or counterclockwise) of the way.

If the way has _highway_ or _waterway_ tagging a number of shortcuts will be displayed, for example to change a _footway_ in to _steps_.

### Add node at intersectionn

If two or more ways are selected and they intersect without a common node, a new node will be added at the first intersection found.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

Expand Down Expand Up @@ -271,4 +271,37 @@ public void undoInsertion() {
TestUtils.clickText(device, false, context.getString(R.string.okay), true); // click away tip
assertTrue(TestUtils.findText(device, false, context.getResources().getQuantityString(R.plurals.actionmode_object_count, 1, 2)));
}

/**
* Select node, select 2nd node, extract segment
*/
@Test
public void extractSegment() {
TestUtils.loadTestData(main, "test2.osm");
TestUtils.zoomToLevel(device, main, 20); // if we are zoomed in too far we might not get the selection popups
map.getDataLayer().setVisible(true);
TestUtils.unlock(device);
TestUtils.sleep(2000);
TestUtils.clickAtCoordinates(device, map, 8.3894224, 47.3891963, true);
TestUtils.clickText(device, true, context.getString(R.string.okay), true, false); // Tip
assertTrue(TestUtils.findText(device, false, context.getString(R.string.actionmode_nodeselect)));
assertTrue(TestUtils.clickOverflowButton(device));
assertTrue(TestUtils.clickText(device, false, context.getString(R.string.menu_extend_selection), true, false));
assertTrue(TestUtils.findText(device, false, context.getString(R.string.actionmode_multiselect)));
TestUtils.clickAtCoordinates(device, map, 8.389856, 47.3891991, true);

assertTrue(TestUtils.findText(device, false, context.getResources().getQuantityString(R.plurals.actionmode_object_count, 2, 2), 5000));
List<Node> nodes = new ArrayList<>(App.getLogic().getSelectedNodes());
assertTrue(TestUtils.clickOverflowButton(device));
assertTrue(TestUtils.clickText(device, false, context.getString(R.string.menu_extract_segment), true, false));

assertTrue(TestUtils.findText(device, false, context.getString(R.string.actionmode_wayselect)));

Way way = App.getLogic().getSelectedWay();
final List<Node> wayNodes = way.getNodes();
assertEquals(2, wayNodes.size());
assertTrue(wayNodes.contains(nodes.get(0)));
assertTrue(wayNodes.contains(nodes.get(1)));
}

}
3 changes: 3 additions & 0 deletions src/main/assets/help/en/Multiselect.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ <h3><img src="../images/tag_menu_delete.png" alt="Delete" /> Delete</h3>
<p>Remove the objects from the data.</p>
<h3><img src="../images/tag_menu_merge.png" alt="Merge" /> Merge ways</h3>
<p>Merge multiple selected ways resulting in a single way. Ways will be reversed if necessary. This option will only be available if only ways with common start/end nodes are selected, or the selection is two closed ways (polygons), in the later case if the polygons do not have common nodes a multi-polygon relation will be created and the ways added as members. If post-merge tag conflicts are detected you will be alerted.</p>
<h3>Extract segment</h3>
<p>If you have selected exactly two nodes on the same way, you can extract the segment of the way between the two nodes. If the way is closed the segment extracted will between the first and 2nd node selected in the winding direction (clockwise or counterclockwise) of the way.</p>
<p>If the way has <em>highway</em> or <em>waterway</em> tagging a number of shortcuts will be displayed, for example to change a <em>footway</em> in to <em>steps</em>.</p>
<h3>Add node at intersection</h3>
<p>If two or more ways are selected and they intersect without a common node, a new node will be added at the first intersection found.</p>
<h3>Create circle</h3>
Expand Down

0 comments on commit 92d2084

Please sign in to comment.