Loading...
Searching...
No Matches
DotWriter.h
Go to the documentation of this file.
/* ----------------------------------------------------------------------------
* GTSAM Copyright 2010-2021, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
* See LICENSE for the license information
* -------------------------------------------------------------------------- */
#pragma once
#include <gtsam/base/FastVector.h>
#include <gtsam/base/Vector.h>
#include <gtsam/inference/Key.h>
#include <iosfwd>
#include <map>
#include <set>
namespace gtsam {
struct GTSAM_EXPORT DotWriter {
double figureWidthInches;
double figureHeightInches;
bool plotFactorPoints;
bool connectKeysToFactor;
bool binaryEdges;
std::map<Key, Vector2> variablePositions;
std::map<char, double> positionHints;
std::set<Key> boxes;
std::map<size_t, Vector2> factorPositions;
explicit DotWriter(double figureWidthInches = 5,
double figureHeightInches = 5,
bool plotFactorPoints = true,
bool connectKeysToFactor = true, bool binaryEdges = false)
: figureWidthInches(figureWidthInches),
figureHeightInches(figureHeightInches),
plotFactorPoints(plotFactorPoints),
connectKeysToFactor(connectKeysToFactor),
binaryEdges(binaryEdges) {}
void graphPreamble(std::ostream* os) const;
void digraphPreamble(std::ostream* os) const;
void drawVariable(Key key, const KeyFormatter& keyFormatter,
const boost::optional<Vector2>& position,
std::ostream* os) const;
static void DrawFactor(size_t i, const boost::optional<Vector2>& position,
std::ostream* os);
boost::optional<Vector2> variablePos(Key key) const;
void processFactor(size_t i, const KeyVector& keys,
const KeyFormatter& keyFormatter,
const boost::optional<Vector2>& position,
std::ostream* os) const;
};
} // namespace gtsam
Vector.h
typedef and functions to augment Eigen's VectorXd
FastVector.h
A thin wrapper around std::vector that uses a custom allocator.
Key.h
gtsam
Global functions in a separate testing namespace.
Definition chartTesting.h:28
gtsam::KeyVector
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition Key.h:86
gtsam::KeyFormatter
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition Key.h:35
gtsam::Key
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:100
gtsam::DotWriter::figureWidthInches
double figureWidthInches
The figure width on paper in inches.
Definition DotWriter.h:36
gtsam::DotWriter::plotFactorPoints
bool plotFactorPoints
Plots each factor as a dot between the variables.
Definition DotWriter.h:38
gtsam::DotWriter::connectKeysToFactor
bool connectKeysToFactor
Draw a line from each key within a factor to the dot of the factor.
Definition DotWriter.h:39
gtsam::DotWriter::variablePositions
std::map< Key, Vector2 > variablePositions
Variable positions can be optionally specified and will be included in the dot file with a "!...
Definition DotWriter.h:47
gtsam::DotWriter::binaryEdges
bool binaryEdges
just use non-dotted edges for binary factors
Definition DotWriter.h:41
gtsam::DotWriter::positionHints
std::map< char, double > positionHints
The position hints allow one to use symbol character and index to specify position.
Definition DotWriter.h:54
gtsam::DotWriter::boxes
std::set< Key > boxes
A set of keys that will be displayed as a box.
Definition DotWriter.h:57
gtsam::DotWriter::factorPositions
std::map< size_t, Vector2 > factorPositions
Factor positions can be optionally specified and will be included in the dot file with a "!...
Definition DotWriter.h:63
gtsam::DotWriter::figureHeightInches
double figureHeightInches
The figure height on paper in inches.
Definition DotWriter.h:37