-
Notifications
You must be signed in to change notification settings - Fork 76
/
viz.go
49 lines (44 loc) · 1.47 KB
/
viz.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"github.com/mitroadmaps/gomapinfer/common"
"fmt"
"os"
)
func main() {
graph, err := common.ReadGraph(os.Args[2])
if err != nil {
panic(err)
}
var rect common.Rectangle
if os.Args[1] == "chicago" {
rect = common.Rectangle{
common.Point{-4096, -8192},
common.Point{4096, 0},
}
} else if os.Args[1] == "la" || os.Args[1] == "ny" || os.Args[1] == "toronto" || os.Args[1] == "amsterdam" || os.Args[1] == "denver" || os.Args[1] == "kansascity" || os.Args[1] == "montreal" || os.Args[1] == "paris" || os.Args[1] == "pittsburgh" || os.Args[1] == "saltlakecity" || os.Args[1] == "tokyo" || os.Args[1] == "vancouver" || os.Args[1] == "doha" || os.Args[1] == "sandiego" || os.Args[1] == "denver" || os.Args[1] == "atlanta" {
rect = common.Rectangle{
common.Point{-4096, -4096},
common.Point{4096, 4096},
}
} else if os.Args[1] == "boston" {
rect = common.Rectangle{
common.Point{4096, -4096},
common.Point{12288, 4096},
}
} else {
fmt.Printf("unknown type %s\n", os.Args[1])
}
boundables := []common.Boundable{common.EmbeddedImage{
Src: rect.Min,
Dst: rect.Max,
Image: fmt.Sprintf("./%s.png", os.Args[1]),
}}
boundables = append(boundables, common.ColoredBoundable{graph, "yellow"})
outname := "out.svg"
if len(os.Args) >= 4 {
outname = os.Args[3]
}
if err := common.CreateSVG(outname, [][]common.Boundable{boundables}, common.SVGOptions{StrokeWidth: 2.0, Zoom: 2, Bounds: rect, Unflip: true}); err != nil {
panic(err)
}
}