Skip to content

Commit

Permalink
add nine more activity types #34
Browse files Browse the repository at this point in the history
  • Loading branch information
sobri909 committed Sep 20, 2018
1 parent 807a3e7 commit 07b9ae2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 43 deletions.
69 changes: 27 additions & 42 deletions LocoKit/Base/ActivityTypeName.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ActivityTypeName.swift
// LocoKitCore
// LocoKit
//
// Created by Matt Greenfield on 12/10/17.
// Copyright © 2017 Big Paua. All rights reserved.
Expand All @@ -9,68 +9,53 @@
/**
The possible Activity Types for a Locomotion Sample. Use an `ActivityTypeClassifier` to determine the type of a
`LocomotionSample`.
*/
public enum ActivityTypeName: String, Codable {

/**
The device's locomotion properties best match a stationary state.
- Note: The stationary type may indicate that the device is lying on a stationary surface such as a table, or that
the device is in the user's hand or pocket but the user is otherwise stationary.
*/
public enum ActivityTypeName: String, Codable {

This may indicate that the device is lying on a stationary surface such as a table, or that the device is in the
user's hand or pocket, but the user is otherwise stationary.
*/
// base types
case stationary

/**
The device's locomotion properties best match vehicle travel.

- Note: A vehicle temporarily stationary at traffic lights or a train station may instead be classified as
`stationary`.
*/
@available(*, deprecated: 7.0.0)
case transport

/// The device's locomotion properties best match walking.
case walking

/// The device's locomotion properties best match running.
case running

/// The device's locomotion properties best match cycling.
case cycling

/// The device's locomotion properties best match travelling by a car.
// transport types
case car

/// The device's locomotion properties best match travelling by a train.
case train

/// The device's locomotion properties best match travelling by a bus.
case bus

/// The device's locomotion properties best match travelling by motorcyle.
case motorcycle

/// The device's locomotion properties best match travelling by airplane.
case airplane

/// The device's locomotion properties best match travelling by a boat.
case boat

/// The device's locomotion properties best match travelling by tram.
case tram
case tractor
case tuktuk = "tuk-tuk"
case songthaew

// active types
case skateboarding
case inlineSkating = "inline skating"
case snowboarding
case skiing
case scooter
case horseback

// MARK: Convenience Arrays
@available(*, deprecated: 7.0.0)
case transport

// MARK: - Convenience Arrays

/// A convenience array containing the base activity types.
public static let baseTypes = [stationary, walking, running, cycling]

/// A convenience array containing the extended transport types.
public static let transportTypes = [car, train, bus, motorcycle, airplane, boat, tram]

/// Activity types that require a location coordinate match.
public static let coordinateBoundTypes = [car, train, bus, motorcycle, airplane, boat, tram]
public static let extendedTypes = [
car, train, bus, motorcycle, airplane, boat, tram, tractor, tuktuk, songthaew,
skateboarding, inlineSkating, snowboarding, skiing, scooter, horseback
]

/// A convenience array containing all activity types.
public static let allTypes = baseTypes + transportTypes
public static let allTypes = baseTypes + extendedTypes

}
2 changes: 1 addition & 1 deletion LocoKit/Timelines/ActivityTypes/MutableActivityType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ open class MutableActivityType: ActivityType {
name: "HORIZ ACCURACY")

// type requires a coordinate match to be non zero?
let pseudoCount = ActivityTypeName.coordinateBoundTypes.contains(name) ? 0 : 1
let pseudoCount = ActivityTypeName.extendedTypes.contains(name) ? 0 : 1

self.coordinatesMatrix = CoordinatesMatrix(coordinates: allCoordinates, latBinCount: self.numberOfLatBuckets,
lngBinCount: self.numberOfLongBuckets, latRange: self.latitudeRange,
Expand Down

0 comments on commit 07b9ae2

Please sign in to comment.