Skip to content

Instantly share code, notes, and snippets.

View rockarts's full-sized avatar
💭
🐝 🇨🇦

Steven Rockarts rockarts

💭
🐝 🇨🇦
  • Edmonton, AB
View GitHub Profile
var step = 20;
for(var x = 0; x < size; x += step) {
for(var y = 0; y < size; y+= step) {
draw(x, y, step, step);
}
}
func drawLine(x:Int, y:Int, width:Int, height:Int) {
let leftToRight:Bool = Bool.random()
let path = UIBezierPath()
if(leftToRight) {
path.move(to: CGPoint(x: x, y: y))
path.addLine(to: CGPoint(x: x + width, y: y + height))
} else {
path.move(to: CGPoint(x: x + width, y: y))
class DrawView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func draw( _ rect: CGRect) {
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let draw = DrawView(frame: self.view.bounds)
view.addSubview(draw)
}
}
class DrawView: UIView {
override init(frame: CGRect) {
//create terrain geometry based on mapbox elevation data
terrainNode.fetchTerrainHeights(minWallHeight: 100.0, enableDynamicShadows: true, progress: { progress, total in }, completion: {
NSLog("Terrain load complete")
//ADD THE POINTS OF INTEREST CALL HERE!
self.addValleyofTheTenPeaksPOIMarkers()
})
func addValleyofTheTenPeaksPOIMarkers() {
let locations : [String: (CLLocationDegrees, CLLocationDegrees)] = [
"Moraine Lake": (51.320143, -116.185173),
"Mt. Fay": (51.298343, -116.163270),
"Mt Little": (51.295878, -116.183472),
"Mt Bowlen": (51.299772, -116.188203),
"Mt Tonsa": (51.296674, -116.201430),
"Mt Perren": (51.296779, -116.208143),
"Mt Allen": (51.291698, -116.219711),
"Mt Tuzo": (51.301836, -116.227780),
//Valley of the 10 Peaks
//NE & SW Corners
var minLat = 51.20
var minLon = -116.28
var maxLat = 51.32
var maxLon = -116.12
var terrainNode: TerrainNode?
var terrainNodeScale = SCNVector3(0.0003, 0.0003, 0.0003) // Scale down map (otherwise it's far too big)
import UIKit
import Mapbox
import SceneKit
import MapKit
import MapboxSceneKit
class ViewController: UIViewController {
var sceneView: SCNView = SCNView()
source 'https://github.com/CocoaPods/Specs.git'
project 'ExploreOutdoors.xcodeproj'
platform :ios, '11'
workspace 'ExploreOutdoors'
use_frameworks!
target 'ExploreOutdoors' do
pod 'Mapbox-iOS-SDK'
//
// ViewController.swift
// ExploreOutdoors
//
// Created by Steven Rockarts on 2018-09-01.
// Copyright © 2018 Figure4Software. All rights reserved.
//
import UIKit
import Mapbox