forked from reaction-eng/restlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
132 lines (104 loc) · 2.9 KB
/
main.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// Copyright 2019 Reaction Engineering International. All rights reserved.
// Use of this source code is governed by the MIT license in the file LICENSE.txt.
package main
import (
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
"github.com/reaction-eng/restlib/notification"
"github.com/reaction-eng/restlib/stl"
"github.com/reaction-eng/restlib/users"
"log"
"os"
"time"
)
//Define the global variables that are setup in the main
//var calcsRepo calcs.Repo
func main2() {
file, err := os.Open("/Users/mcgurn/Desktop/TorusAscii.stl")
//file, err := os.Open("/Users/mcgurn/Downloads/AirAssis_mod_si.stl")
if err != nil {
log.Fatal(err)
}
defer file.Close()
stlMesh, err := stl.ReadMesh(file)
//Now try writing it
// Write the body to file
out, err := os.Create("/Users/mcgurn/Downloads/output.stl")
if err != nil {
log.Fatal(err)
}
defer out.Close()
//Output the mesh
stlMesh.WriteMeshBinary(out)
fmt.Println(stlMesh)
fmt.Println(err)
}
func main3() {
//Layout some points
pts := []stl.Vertex{
{0.0, 0.0, 0.0},
{0.5, 0.5, 0.0},
{.75, 0.75, 0.0},
{.3, 0.9, 0.0},
{.6, 1.3, 0.0},
{.9, 1.3, 0.0},
{.9, 1.6, 0.0},
{0.0, 1.6, 0.0},
}
incPts, _ := stl.IncreaseLineResolution(pts, 0.1, 1.0)
//incPts := pts
mesh, _ := stl.RotateAndCreateMesh(incPts, 10)
//Now try writing it
// Write the body to file
out, err := os.Create("/Users/mcgurn/Downloads/output.stl")
if err != nil {
log.Fatal(err)
}
defer out.Close()
//Now try writing it
// Write the body to file
ptsout, err := os.Create("/Users/mcgurn/Downloads/output.pts")
if err != nil {
log.Fatal(err)
}
defer out.Close()
//Now try writing it
// Write the body to file
triout, err := os.Create("/Users/mcgurn/Downloads/output.tri")
if err != nil {
log.Fatal(err)
}
defer out.Close()
//Output the mesh
mesh.WriteMeshAscii(out)
mesh.WriteUintahPts(ptsout)
mesh.WriteUintahTri(triout)
}
func main() {
greetingNotif := notification.Notification{
Message: "Sup my man!",
Priority: 5,
Expiration: time.Now(),
Send: time.Now(),
UserID: 1,
}
//userGrant := users.BasicUser{
// Id_:2,
// Email_:"[email protected]",
// Token_:"1234567890",
//}
//config, _ := configuration.NewConfiguration("config.mysql.json", "config.host.json")
localSql, err := sql.Open("mysql", "root:P1p3sh0p@tcp(:3306)/localDB?parseTime=true") //"root:P1p3sh0p@tcp(:3306)/localDB?parseTime=true"
sqlConnectiont := users.NewRepoMySql(localSql, "users")
//include some kind of db call to get email to who'm we send to
userG, err := sqlConnectiont.GetUser(2)
if err != nil {
log.Println("Getting user through error. ", err.Error())
}
dumNotifier := notification.NewDummyNotifier()
webNotif := notification.NewWebPushNotifier("config.deleteME.json", localSql)
//mailNotifier := Notification.NewEmailNotifier()
err = dumNotifier.Notify(greetingNotif, userG)
err = webNotif.Notify(greetingNotif, userG)
}