Skip to content

Commit b26b493

Browse files
Affiedehann
authored andcommitted
FEATURE lsWho, lsfWho
1 parent d956859 commit b26b493

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/Common.jl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,35 @@ function lsTypes(dfg::G)::Dict{Symbol, Vector{String}} where G <: AbstractDFG
230230
end
231231
return alltypes
232232
end
233+
234+
235+
"""
236+
$(SIGNATURES)
237+
Gives back all factor labels that fit the bill:
238+
lsWho(dfg, :Pose3)
239+
"""
240+
function lsWho(dfg::AbstractDFG, type::Symbol; solveKey::Symbol=:default)::Vector{Symbol}
241+
vars = getVariables(dfg)
242+
labels = Symbol[]
243+
for v in vars
244+
varType = typeof(getVariableType(v, solveKey=solveKey)).name |> Symbol
245+
varType == type && push!(labels, v.label)
246+
end
247+
return labels
248+
end
249+
250+
251+
"""
252+
$(SIGNATURES)
253+
Gives back all factor labels that fit the bill:
254+
lsfWho(dfg, :Point2Point2)
255+
"""
256+
function lsfWho(dfg::AbstractDFG, type::Symbol)::Vector{Symbol}
257+
facs = getFactors(dfg)
258+
labels = Symbol[]
259+
for f in facs
260+
facType = typeof(getFactorType(f)).name |> Symbol
261+
facType == type && push!(labels, f.label)
262+
end
263+
return labels
264+
end

0 commit comments

Comments
 (0)