Skip to content

Instantly share code, notes, and snippets.

View mattrobmattrob's full-sized avatar
🐢

Matt Robinson mattrobmattrob

🐢
View GitHub Profile

Output Files

RDD (Report variable Data Dictionary)

List of output variables available from the run.

Add the following to get all simulation variables in the RDD:

Output:VariableDictionary,Regular; !- Key Field
@mattrobmattrob
mattrobmattrob / denver-map-edits.osc
Created April 7, 2023 03:10
OpenStreetMap OSC Format Example (added `bikestreets=1` to Tennyson)
<?xml version='1.0' encoding='UTF-8'?>
<osmChange version="0.6" generator="Osmosis 0.48.3">
<modify>
<way id="388126286" version="29" timestamp="2019-06-28T12:20:47Z" uid="2237750" user="chachafish" changeset="71705932">
<nd ref="176080105"/>
<nd ref="3934330311"/>
<nd ref="3634710176"/>
<nd ref="3935440100"/>
<nd ref="176098700"/>
<nd ref="3935444965"/>
@mattrobmattrob
mattrobmattrob / partial-sloans-lake-osm-dump.osm
Created February 22, 2023 19:53
OSM data dump of top (39.75031), bottom (39.74767), left (-105.04270), and right (-105.04020).
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="CGImap 0.8.8 (1470869 spike-08.openstreetmap.org)" copyright="OpenStreetMap and contributors" attribution="http://www.openstreetmap.org/copyright" license="http://opendatacommons.org/licenses/odbl/1-0/">
<bounds minlat="39.7476700" minlon="-105.0432100" maxlat="39.7503100" maxlon="-105.0396900"/>
<node id="176067159" visible="true" version="5" changeset="55489416" timestamp="2018-01-16T10:57:36Z" user="chachafish" uid="2237750" lat="39.7481336" lon="-105.0425879"/>
<node id="176074275" visible="true" version="12" changeset="72622402" timestamp="2019-07-25T00:40:22Z" user="chachafish" uid="2237750" lat="39.7487580" lon="-105.0404828">
<tag k="direction" v="both"/>
<tag k="highway" v="stop"/>
</node>
<node id="176074279" visible="true" version="10" changeset="72622276" timestamp="2019-07-25T00:25:56Z" user="chachafish" uid="2237750" lat="39.7511970" lon="-105.0404866">
<tag k="direction" v="both"/>
extension BubbleView {
/// Draws a set of stripes across the view up from bottom left
/// to top right at a 45 degree angle. The stripes will be
/// `stripeWidth` wide and have `stripeWidth` between them.
func drawStripes(in bubbleBounds: CGRect,
stripeColor: UIColor,
stripeWidth: CGFloat) {
guard let context = UIGraphicsGetCurrentContext() else { return }
// Current radius of the bubble that the stripes should cover.
// Clip to bubble bounds since none of the stripes should be
// drawn outside of the provided bubble bounds.
let path = CGMutablePath()
path.addArc(center: CGPoint(x: bounds.midX, y: bounds.midY),
radius: bubbleRadius,
startAngle: 0,
endAngle: 2 * CGFloat.pi,
clockwise: true)
context.addPath(path)
context.clip()
// Add all the stripes on top and bottom of the middle at the same time.
// Continue adding until we are outside of the bubble's radius since
// this area is clipped anyway.
var index = 1
// This calculation determines if the edge of the stripe (center of the current
// stripe minus half the stripe width) is within the bubble's radius.
while (CGFloat(index) * stripeWidth * 2) - (stripeWidth / 2.0) < bubbleRadius {
let offset = CGFloat(index) * stripeWidth * 2
// above the middle
// Now that we've shifted the canvas around, (0,0) from left to right now
// goes from bottom-left to top-right of the original rectangle. Stroke
// the middle stripe first since it has no mirror.
context.move(to: CGPoint(x: 0, y: 0))
context.addLine(to: CGPoint(x: maxPathLength, y: 0))
context.strokePath()
// Set line attributes
context.setLineWidth(stripeWidth)
context.setStrokeColor(stripeColor.cgColor)
// Rotate around corner
context.rotate(by: CGFloat.pi * -45.0 / 180.0)
// Translate corner to bottom of rectangle.
context.translateBy(x: 0, y: bubbleBounds.height)