|
1 |
| -##============================================================================== |
2 |
| -## Overloading show |
3 |
| -##============================================================================== |
4 |
| -# Base.show_default(io, v) |
5 |
| -Base.show(io::IO, ::MIME"text/plain", v::DFGVariable) = show(IOContext(io, :limit=>true, :compact=>true), v) |
6 |
| - |
7 |
| -function Base.show(io::IO, ::MIME"text/plain", f::DFGFactor) |
8 |
| - # show(IOContext(io, :limit=>true, :compact=>true), f) |
9 |
| - fctt = getFactorType(f) |
10 |
| - println(io, "$(typeof(f))") |
11 |
| - println(io, " Name: $(f.label)") |
12 |
| - println(io, " VariableOrder: $(getVariableOrder(f))") |
13 |
| - println(io, " multihypo: $(getSolverData(f).multihypo)") # FIXME #477 |
14 |
| - println(io, " nullhypo: TBD") |
15 |
| - println(io, " solvable: $(f.solvable)") |
16 |
| - println(io, " timestamp: $(f.timestamp)") |
17 |
| - println(io, " nstime: $(f.nstime)") |
18 |
| - println(io, " tags: $(f.tags)") |
19 |
| - println(io, " Type: $(typeof(fctt))") |
20 |
| - println(io, " Fields: $(fieldnames(typeof(fctt)))") |
21 |
| - show(IOContext(io, :limit=>true, :compact=>true), fctt) |
22 |
| -end |
23 |
| - |
24 |
| -function Base.show(io::IO, ::MIME"text/plain", dfg::AbstractDFG) |
25 |
| - summary(io, dfg) |
26 |
| - println(io, "\n UserId: ", dfg.userId) |
27 |
| - println(io, " RobotId: ", dfg.robotId) |
28 |
| - println(io, " SessionId: ", dfg.sessionId) |
29 |
| - println(io, " Description: ", dfg.description) |
30 |
| - println(io, " Nr variables: ", length(ls(dfg))) |
31 |
| - println(io, " Nr factors: ",length(lsf(dfg))) |
32 |
| - println(io, " User Data: ", keys(dfg.userData)) |
33 |
| - println(io, " Robot Data: ", keys(dfg.robotData)) |
34 |
| - println(io, " Session Data: ", keys(dfg.sessionData)) |
35 |
| -end |
36 |
| - |
37 |
| - |
38 |
| -#default for Atom/Juno |
39 |
| -Base.show(io::IO, ::MIME"application/prs.juno.inline", x::Union{AbstractDFG, DFGVariable, DFGFactor}) = x |
40 |
| - |
41 |
| - |
42 | 1 | ##==============================================================================
|
43 | 2 | ## Printing Variables and Factors
|
44 | 3 | ##==============================================================================
|
@@ -98,11 +57,23 @@ function printFactor(io::IO, vert::DFGFactor;
|
98 | 57 |
|
99 | 58 | if short
|
100 | 59 | printstyled(ioc, summary(vert),"\n", bold=true)
|
101 |
| - println(ioc, "label: ", vert.label) |
102 |
| - println(ioc, "timestamp: ", vert.timestamp) |
103 |
| - println(ioc, "tags: ", vert.tags) |
104 |
| - println(ioc, "solvable: ", vert.solvable) |
105 |
| - println(ioc, "VariableOrder: ", vert._variableOrderSymbols) |
| 60 | + println(ioc, " label: ", vert.label) |
| 61 | + println(ioc, " solvable: ", vert.solvable) |
| 62 | + println(ioc, " VariableOrder: ", vert._variableOrderSymbols) |
| 63 | + println(ioc, " multihypo: ", getSolverData(vert).multihypo) # FIXME #477 |
| 64 | + println(ioc, " nullhypo: ", "see DFG #477") |
| 65 | + println(ioc, " timestamp: ", vert.timestamp) |
| 66 | + println(ioc, " nstime: ",vert.nstime) |
| 67 | + println(ioc, " tags: ", vert.tags) |
| 68 | + fct = getFactorType(vert) |
| 69 | + fctt = fct |> typeof |
| 70 | + println(ioc, " Type: ", fctt) |
| 71 | + # show(ioc, fctt) |
| 72 | + for f in setdiff(fieldnames(fctt), skipfields) |
| 73 | + printstyled(ioc, f,":\n", color=:blue) |
| 74 | + show(ioc, getproperty(fct, f)) |
| 75 | + println(ioc) |
| 76 | + end |
106 | 77 | else
|
107 | 78 |
|
108 | 79 | printstyled(ioc, summary(vert),"\n", bold=true, color=:blue)
|
@@ -140,3 +111,29 @@ Dev Notes
|
140 | 111 | printVariable(dfg::AbstractDFG, sym::Symbol) = print(getVariable(dfg, sym))
|
141 | 112 |
|
142 | 113 | printNode(dfg::AbstractDFG, sym::Symbol) = isVariable(dfg,sym) ? printVariable(dfg, sym) : printFactor(dfg, sym)
|
| 114 | + |
| 115 | + |
| 116 | +##============================================================================== |
| 117 | +## Overloading show |
| 118 | +##============================================================================== |
| 119 | +# Base.show_default(io, v) |
| 120 | +Base.show(io::IO, ::MIME"text/plain", v::DFGVariable) = show(IOContext(io, :limit=>true, :compact=>true), v) |
| 121 | + |
| 122 | +Base.show(io::IO, ::MIME"text/plain", f::DFGFactor) = printFactor(io, f, short=true, limit=false) |
| 123 | + |
| 124 | +function Base.show(io::IO, ::MIME"text/plain", dfg::AbstractDFG) |
| 125 | + summary(io, dfg) |
| 126 | + println(io, "\n UserId: ", dfg.userId) |
| 127 | + println(io, " RobotId: ", dfg.robotId) |
| 128 | + println(io, " SessionId: ", dfg.sessionId) |
| 129 | + println(io, " Description: ", dfg.description) |
| 130 | + println(io, " Nr variables: ", length(ls(dfg))) |
| 131 | + println(io, " Nr factors: ",length(lsf(dfg))) |
| 132 | + println(io, " User Data: ", keys(dfg.userData)) |
| 133 | + println(io, " Robot Data: ", keys(dfg.robotData)) |
| 134 | + println(io, " Session Data: ", keys(dfg.sessionData)) |
| 135 | +end |
| 136 | + |
| 137 | + |
| 138 | +#default for Atom/Juno |
| 139 | +Base.show(io::IO, ::MIME"application/prs.juno.inline", x::Union{AbstractDFG, DFGVariable, DFGFactor}) = x |
0 commit comments