-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathmotivewave.go
55 lines (40 loc) · 1014 Bytes
/
motivewave.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
package ewa
import (
"encoding/xml"
"io/ioutil"
"time"
"github.com/apex/log"
)
func (mw *mwQuery) importMotiveWaveXML(path string) error {
log.Debug("Importing " + path)
data, err := ioutil.ReadFile(path)
if err != nil {
return err
}
return xml.Unmarshal(data, mw)
}
//PointFromMW - Point from mwPoint
func PointFromMW(mwp mwPoint) *Point {
return &Point{T: time.Unix(mwp.T, 0), P: mwp.P}
}
func setParentWave(parent *Wave, children ...*Wave) {
for _, one := range children {
one.Parent = parent
}
}
func setImpulseWaveAdjecency(waves [5]*Wave) {
waves[0].Next = waves[1]
waves[1].Prev, waves[1].Next = waves[0], waves[2]
waves[2].Prev, waves[2].Next = waves[1], waves[3]
waves[3].Prev, waves[3].Next = waves[2], waves[4]
waves[4].Prev = waves[3]
}
func (mw *mwQuery) parse() (*Markup, error) {
markup := &Markup{}
markup.processImpulses(mw)
markup.processCorrections(mw)
markup.processTriangles(mw)
markup.processTripleCombo(mw)
markup.printStack()
return markup, nil
}