Latest 0.0.2
Homepage https://github.com/vornet/mapdoodle-ios
License MIT
Platforms ios 9.0
Authors

CI Status
Version
License
Platform

Screenshots

iOS library to create common map animations for MapKit and other providers. Note, work-in-progress.

Shameless Plug: This library was written for my skiing & snowboarding app, Mogul Bunny.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

MapDoodle is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "MapDoodle"

Basic Usage

Once you get an instance of MKMapView, just pass it along to an instance of MapDoodler.
Then, add your waypoints to a GeoPath.

class ViewController: UIViewController {
  @IBOutlet var mapView: MKMapView!
  var mapDoodler: MapDoodler!

  override func viewDidLoad() {
    super.viewDidLoad()

    mapDoodler = MapDoodler(mapView: mapView, refreshRate: 500)

    let pathDoodleStyle = AnimatedPathDoodleStyle()
    pathDoodleStyle.thickness = 10
    pathDoodleStyle.color = UIColor.blueColor()
    pathDoodleStyle.tracerThickness = 5.0
    pathDoodleStyle.tracerColor = UIColor.grayColor()
    pathDoodleStyle.speed = 250.0

    // Shining Sea Bikeway
    let shiningSeaBikewayPoints: [GeoPoint] = [
      GeoPoint(latitude: 41.551490, longitude: -70.627179),
      GeoPoint(latitude: 41.550410, longitude: -70.627761),
      GeoPoint(latitude: 41.534456, longitude: -70.641752),
      GeoPoint(latitude: 41.534319, longitude: -70.642047),
      GeoPoint(latitude: 41.534032, longitude: -70.642455),
      GeoPoint(latitude: 41.531242, longitude: -70.645581),
      GeoPoint(latitude: 41.524383, longitude: -70.653310),
      GeoPoint(latitude: 41.524383, longitude: -70.653310)
    ]

    let shiningSeaBikewayDoodle = mapDoodler.addAnimatedPathDoodle(pathDoodleStyle, points: shiningSeaBikewayPoints)
    mapDoodler.zoomFitAllDoodles(150, shouldAnimate: false)
  }
}

Static (not animated) path doodles can also be added.


let pathDoodleStyle = PathDoodleStyle()
pathDoodleStyle.thickness = 10
pathDoodleStyle.color = UIColor.blueColor()

let shiningSeaBikewayPoints: [GeoPoint] = [
// ...
]

let shiningSeaBikewayDoodle = mapDoodler.addPathDoodle(pathDoodleStyle, points: shiningSeaBikewayPoints)

Doodles can be added at anytime (for example, via user interaction.)

The following is supported for doodle management:

let mapDoodler = MapDoodler(mapView: mapView, refreshRate: 500)
// Add a new doodle.
let doodle = mapDoodler.addPathDoodle(style: pathDoodleStyle, points: points)
// Assign a string ID to a doodle.
doodle.id = "foo"
// Later, you can retrieve the doodle by ID.
let doodle = mapDoodler.getDoodleById(id: "foo")
// Remove a doodle from the map
mapDoodler.removeDoodle(doodle)
// Zoom to fit a doodle.
mapDoodler.zoomToFitDoodle(doodle)
// Zoom to fit all doodles on the map.
mapDoodler.zoomToFitAllDoodles()
// Change the style of a doodle. Style must be for the correct doodle type, otherwise no-op.
doodle.setStyle(style: newStyle)

Author

Vorn Mom, [email protected]

License

MapDoodle is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "MapDoodle",
    "version": "0.0.2",
    "summary": "iOS library to create common map animations",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "https://github.com/vornet/mapdoodle-ios",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Vorn Mom": "[email protected]"
    },
    "source": {
        "git": "https://github.com/vornet/mapdoodle-ios.git",
        "tag": "0.0.2"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "MapDoodle/Classes/**/*"
}

Pin It on Pinterest

Share This