Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ class FeatureTree(featureCollection: FeatureCollection?) {
var newItem: EntryWithDistance? = if (newItemIterator.hasNext()) newItemIterator.next() else null

while((initialItem != null) or (newItem != null)) {
if(featureCollection.features.size > maxCount) break
if(featureCollection.features.size >= maxCount) break
if (initialItem != null) {
var addInitial = false
if (newItem == null) addInitial = true
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@
<!-- Notification, Information how to turn on callouts. Ensure that "Callouts" is translated the same as `menu.manage_callouts` and "Callouts Off" is translated the same as `callouts.callouts_off` and "Allow callouts" is translated the same as `callouts.allow_callouts`. Quotes written as \". Where it says top-right that should be translated as top-left for right-to-left languages. -->
<string name="help_text_automatic_callouts_how_1">"**Turning callouts on or off :**\n\n Turning callouts off will silence the app. Callouts can be turned on or off in the *\"Manage Callouts\"* section of the *\"Settings\"* screen where you can tap the *\"Allow Callouts\"* toggle to turn callouts on or off. You can also turn callouts on or off by using the *\"skip forward\"* command (double tap and hold) if your headphones have media control buttons. Alternatively, you can use the *\"Sleep\"* button in the top-right corner of the home screen to stop Soundscape from making callouts until you choose to wake it up again."</string>
<!-- Notification, Information how to turn on callouts continued. Ensure that "Callouts" is translated the same as `menu.manage_callouts` and "Allow callouts" is translated the same as `callouts.allow_callouts`. Quotes written as \" -->
<string name="help_text_automatic_callouts_how_2">"**Managing which callouts you hear :**\n\n To choose the types of things Soundscape will automatically callout, go to the *\"Settings\"* screen using the menu on the home screen. The *\"Callouts\"* section of the *\"Settings\"* screen contains a list of types of things the app can callout. Each item has a toggle button that you can turn on or off. If you wish to turn off all callouts, tap the *\"Allow Callouts\"* toggle at the top of the list."</string>
<string name="help_text_automatic_callouts_how_2">"**Managing which callouts you hear :**\n\n To choose the types of things Soundscape will automatically call out, go to the *\"Settings\"* screen using the menu on the home screen. The *\"Manage Callouts\"* section of the *\"Settings\"* screen contains a list of types of things the app can call out. Each item has a toggle button that you can turn on or off. If you wish to turn off all callouts, tap the *\"Allow Callouts\"* toggle at the top of the list."</string>
<!-- Notification, Information about what My Location does. Ensure that "My Location" is translated the same as `directions.my_location`. Quotes written as \" -->
<string name="help_text_my_location_what">"The *\"My Location\"* button quickly gives you information that helps you figure out where you currently are. *\"My Location\"* tells you about your current location including things like the direction you are facing, where nearby roads or intersections are, and where nearby points of interest are."</string>
<!-- Notification, Information on when you would need to use My Location. Ensure that "My Location" is translated the same as `directions.my_location`. Quotes written as \" -->
Expand Down
28 changes: 28 additions & 0 deletions app/src/test/java/org/scottishtecharmy/soundscape/MvtTileTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,34 @@ class MvtTileTest {
// Clone is cloning all of the hashmap entries
}

@Test
fun testGetNearestCollection(){
val userGeometry = UserGeometry(LngLatAlt(-4.313, 55.945245))
val gridState = getGridStateForLocation(userGeometry.location, MAX_ZOOM_LEVEL, 2)

val collection = gridState.getFeatureTree(TreeId.WAYS_SELECTION)
.getNearestCollection(userGeometry.location, 2000.0, 10, gridState.ruler)

println("collection size ${collection.features.size}")
assertEquals(10, collection.features.size)
}

@Test
fun testGetNearestCollectionWithinTriangle(){
val userGeometry = UserGeometry(LngLatAlt(-4.313, 55.945245), fovDistance = 2000.0)
val gridState = getGridStateForLocation(userGeometry.location, MAX_ZOOM_LEVEL, 2)

val triangle = getFovTriangle(userGeometry, true)

val duration = measureTime {
val collection = gridState.getFeatureTree(TreeId.WAYS_SELECTION)
.getNearestCollectionWithinTriangle(triangle, 10, gridState.ruler)

println("collection size ${collection.features.size}")
assertEquals(10, collection.features.size)
}
println("Processing time $duration")
}

@Test
fun testRoadBearing(){
Expand Down