Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Tikz_Plane Class Reference

2D TikZ canvas storing geometry objects and emitting LaTeX output. More...

#include <tikzgeom.H>

Collaboration diagram for Aleph::Tikz_Plane:
[legend]

Classes

struct  Geom_Box
 
struct  Legend_Entry
 
struct  Mapping
 
struct  Styled_Object
 An object with its associated style, layer, and insertion order. More...
 

Public Types

using Object = std::variant< Point, Polar_Point, Segment, Triangle, Ellipse, RotatedEllipse, Text, Polygon, Regular_Polygon, Rectangle, LineEq, Tikz_Quadratic_Bezier, Tikz_Cubic_Bezier, Tikz_Polyline >
 Runtime set of supported objects.
 

Public Member Functions

 Tikz_Plane (const double &wide, const double &height, const double &xoffset=0.0, const double &yoffset=0.0)
 Construct a TikZ plane with fixed frame size.
 
const double & get_wide () const
 Plane width in millimeters.
 
const double & get_height () const
 Plane height in millimeters.
 
const double & get_xoffset () const
 Horizontal scope offset in millimeters.
 
const double & get_yoffset () const
 Vertical scope offset in millimeters.
 
const double & get_point_radius_mm () const
 Radius used to draw point primitives (millimeters).
 
const double & get_clip_padding_mm () const
 Clip expansion around the frame; <= 0 means auto (point radius).
 
size_t size () const
 Number of currently inserted objects.
 
Array< std::string > required_tikz_libraries () const
 Collect TikZ libraries required by currently emitted features.
 
const Tikz_Style & get_default_style () const
 Default style used by put(obj) and non-styled put_in_plane.
 
const Tikz_Style & get_axis_style () const
 Style used for Cartesian axes when enabled.
 
const Tikz_Style & get_grid_style () const
 Style used for coordinate grids when enabled.
 
void set_default_style (const Tikz_Style &style)
 Configure the default style for subsequent non-styled inserts.
 
void set_axis_style (const Tikz_Style &style)
 Configure the style used to draw Cartesian axes.
 
void set_grid_style (const Tikz_Style &style)
 Configure the style used to draw coordinate grids.
 
void set_point_radius_mm (const double &radius_mm)
 Configure point marker radius.
 
void set_clip_padding_mm (const double &padding_mm)
 Configure clip expansion around frame borders.
 
void put_cartesian_axis ()
 Enable Cartesian axes drawing (only when 0 lies in range).
 
void remove_cartesian_axis ()
 Disable Cartesian axes drawing.
 
void put_coordinate_grid (const double step_x=1.0, const double step_y=1.0, const bool draw_ticks=true)
 Enable coordinate grid/ticks with user step sizes.
 
void remove_coordinate_grid ()
 Disable coordinate grid rendering.
 
void enable_native_tikz_layers (const bool enabled=true)
 Enable native PGF layers (\pgfdeclarelayer).
 
void enable_auto_legend (const bool enabled=true)
 Enable auto-legend generation from style colors.
 
void add_legend_entry (const std::string &label, const Tikz_Style &style)
 Add a legend entry to be rendered in the top-left corner.
 
void clear_legend ()
 Remove user-provided legend entries.
 
void register_tikz_style (const std::string &name, const Tikz_Style &style)
 Register a reusable \tikzset style for the rendered picture.
 
void clear_tikz_styles ()
 Clear all registered \tikzset style definitions.
 
void clear ()
 Remove all inserted objects from the plane.
 
void put (const Object &obj)
 Insert an object with default style on default layer.
 
void put (const Object &obj, const Tikz_Style &style, const int layer)
 Insert an object with explicit style/layer.
 
void draw (std::ostream &output, const bool squarize=true) const
 Emit a complete tikzpicture with all inserted objects.
 

Static Public Attributes

static constexpr int Layer_Background = -100
 
static constexpr int Layer_Default = 0
 
static constexpr int Layer_Foreground = 100
 
static constexpr int Layer_Overlay = 1000
 

Private Member Functions

Geom_Box compute_box () const
 
double effective_clip_padding_mm () const
 
Mapping compute_mapping (const Geom_Box &box, const bool squarize) const
 
template<typename Out >
void draw_point (const Point &p, const Tikz_Style &style, Out &output, const Geom_Box &box, const Mapping &map) const
 
template<typename Out >
void draw_polyline (Out &output, const Array< Point > &vertices, const bool closed, const Tikz_Style &style, const Geom_Box &box, const Mapping &map) const
 
template<typename Out >
void draw_segment (const Segment &s, const Tikz_Style &style, Out &output, const Geom_Box &box, const Mapping &map) const
 
template<typename Out >
void draw_triangle (const Triangle &t, const Tikz_Style &style, Out &output, const Geom_Box &box, const Mapping &map) const
 
template<typename Out >
void draw_ellipse (const Ellipse &e, const Tikz_Style &style, Out &output, const Geom_Box &box, const Mapping &map) const
 
template<typename Out >
void draw_polygon (const Polygon &poly, const Tikz_Style &style, Out &output, const Geom_Box &box, const Mapping &map) const
 
template<typename Out >
void draw_regular_polygon (const Regular_Polygon &poly, const Tikz_Style &style, Out &output, const Geom_Box &box, const Mapping &map) const
 
template<typename Out >
void draw_rectangle (const Rectangle &r, const Tikz_Style &style, Out &output, const Geom_Box &box, const Mapping &map) const
 
template<typename Out >
void draw_line_eq (const LineEq &l, const Tikz_Style &style, Out &output, const Geom_Box &box, const Mapping &map) const
 
template<typename Out >
void draw_coordinate_grid (Out &output, const Geom_Box &box, const Mapping &map) const
 
Array< Legend_Entry > collect_legend_entries () const
 
template<typename Out >
void draw_legend (Out &output) const
 
template<typename Out >
void draw_tikzset_styles (Out &output) const
 
template<typename Out >
void draw_cartesian_axis (Out &output, const Geom_Box &box, const Mapping &map) const
 
template<typename Out >
void draw_object (const Styled_Object &entry, Out &output, const Geom_Box &box, const Mapping &map) const
 

Static Private Member Functions

static std::string fmt_double (const double v)
 
static void append_option (std::string &opts, const std::string &opt)
 
static std::string draw_options (const Tikz_Style &style, const bool allow_fill=false)
 
static std::string point_options (const Tikz_Style &style)
 
static std::string text_options (const Tikz_Style &style)
 
static bool style_requires_patterns (const Tikz_Style &style) noexcept
 Return true when rendering style needs the patterns library.
 
static Geom_Box make_box (const Geom_Number &xmin, const Geom_Number &xmax, const Geom_Number &ymin, const Geom_Number &ymax)
 
static void merge_box (Geom_Box &dst, const Geom_Box &src)
 
static Geom_Box bbox_of (const Point &p)
 
static Geom_Box bbox_of (const Polar_Point &pp)
 
static Geom_Box bbox_of (const Segment &s)
 
static Geom_Box bbox_of (const Triangle &t)
 
static Geom_Box bbox_of (const Ellipse &e)
 
static Geom_Box bbox_of (const RotatedEllipse &e)
 
static Geom_Box bbox_of (const Text &t)
 
static Geom_Box bbox_of (const Polygon &poly)
 
static Geom_Box bbox_of (const Regular_Polygon &poly)
 
static Geom_Box bbox_of (const Rectangle &r)
 
static Geom_Box bbox_of (const LineEq &l)
 
static Geom_Box bbox_of (const Tikz_Quadratic_Bezier &b)
 
static Geom_Box bbox_of (const Tikz_Cubic_Bezier &b)
 
static Geom_Box bbox_of (const Tikz_Polyline &pl)
 
static std::string escape_latex (const std::string &text)
 
static double map_x (const Geom_Number &x, const Geom_Box &box, const Mapping &map)
 
static double map_y (const Geom_Number &y, const Geom_Box &box, const Mapping &map)
 
static std::pair< double, double > map_point (const Point &p, const Geom_Box &box, const Mapping &map)
 
static double map_x_length (const Geom_Number &dx, const Mapping &map)
 
static double map_y_length (const Geom_Number &dy, const Mapping &map)
 
template<typename Out >
static void draw_rotated_ellipse (const RotatedEllipse &e, const Tikz_Style &style, Out &output, const Geom_Box &box, const Mapping &map)
 
template<typename Out >
static void draw_text (const Text &t, const Tikz_Style &style, Out &output, const Geom_Box &box, const Mapping &map)
 
template<typename Out >
static void draw_quadratic_bezier (const Tikz_Quadratic_Bezier &b, const Tikz_Style &style, Out &output, const Geom_Box &box, const Mapping &map)
 
template<typename Out >
static void draw_cubic_bezier (const Tikz_Cubic_Bezier &b, const Tikz_Style &style, Out &output, const Geom_Box &box, const Mapping &map)
 
static const char * layer_name (const int layer)
 

Private Attributes

double wide_ = 0.0
 
double height_ = 0.0
 
double xoffset_ = 0.0
 
double yoffset_ = 0.0
 
bool with_cartesian_axis_ = false
 
bool with_coordinate_grid_ = false
 
bool with_grid_ticks_ = false
 
bool with_native_layers_ = false
 
bool with_auto_legend_ = false
 
double point_radius_mm_ = 1.0
 
double clip_padding_mm_ = -1.0
 
double grid_step_x_ = 1.0
 
double grid_step_y_ = 1.0
 
double tick_size_mm_ = 1.5
 
double legend_x_mm_ = 3.0
 
double legend_y_mm_ = 3.0
 
double legend_entry_step_mm_ = 5.0
 
Tikz_Style default_style_
 
Tikz_Style axis_style_
 
Tikz_Style grid_style_
 
Array< Legend_Entry > legend_entries_
 
std::map< std::string, Tikz_Style > tikz_style_defs_
 
Array< Styled_Object > objects_
 
size_t next_order_ = 0
 

Detailed Description

2D TikZ canvas storing geometry objects and emitting LaTeX output.

Tikz_Plane:

  1. Collects geometry objects inserted with put() / put_in_plane(...).
  2. Computes a global bounding box and maps it to the fixed frame.
  3. Emits a tikzpicture block using millimeter units.

The frame (wide, height) is fixed at construction time.

Definition at line 199 of file tikzgeom.H.

Member Typedef Documentation

◆ Object

Constructor & Destructor Documentation

◆ Tikz_Plane()

Aleph::Tikz_Plane::Tikz_Plane ( const double &  wide,
const double &  height,
const double &  xoffset = 0.0,
const double &  yoffset = 0.0 
)
inline

Construct a TikZ plane with fixed frame size.

Parameters
widePlane width in millimeters.
heightPlane height in millimeters.
xoffsetX shift (mm) applied to the internal drawing scope.
yoffsetY shift (mm) applied to the internal drawing scope.
Exceptions
std::domain_errorIf wide <= 0 or height <= 0.

Definition at line 1225 of file tikzgeom.H.

References ah_domain_error_if, Aleph::blossom_maximum_cardinality_matching(), height_, and wide_.

Member Function Documentation

◆ add_legend_entry()

void Aleph::Tikz_Plane::add_legend_entry ( const std::string &  label,
const Tikz_Style &  style 
)
inline

Add a legend entry to be rendered in the top-left corner.

Definition at line 1373 of file tikzgeom.H.

References legend_entries_.

Referenced by Aleph::Tikz_Scene::add_legend_entry().

◆ append_option()

static void Aleph::Tikz_Plane::append_option ( std::string &  opts,
const std::string &  opt 
)
inlinestaticprivate

◆ bbox_of() [1/14]

◆ bbox_of() [2/14]

static Geom_Box Aleph::Tikz_Plane::bbox_of ( const LineEq &  l)
inlinestaticprivate

Definition at line 522 of file tikzgeom.H.

References Aleph::blossom_maximum_cardinality_matching(), l, make_box(), y0(), and y1().

◆ bbox_of() [3/14]

static Geom_Box Aleph::Tikz_Plane::bbox_of ( const Point &  p)
inlinestaticprivate

◆ bbox_of() [4/14]

static Geom_Box Aleph::Tikz_Plane::bbox_of ( const Polar_Point &  pp)
inlinestaticprivate

Definition at line 456 of file tikzgeom.H.

References bbox_of(), and Aleph::blossom_maximum_cardinality_matching().

◆ bbox_of() [5/14]

static Geom_Box Aleph::Tikz_Plane::bbox_of ( const Polygon &  poly)
inlinestaticprivate

◆ bbox_of() [6/14]

static Geom_Box Aleph::Tikz_Plane::bbox_of ( const Rectangle &  r)
inlinestaticprivate

Definition at line 517 of file tikzgeom.H.

References make_box(), and r.

◆ bbox_of() [7/14]

static Geom_Box Aleph::Tikz_Plane::bbox_of ( const Regular_Polygon &  poly)
inlinestaticprivate

◆ bbox_of() [8/14]

static Geom_Box Aleph::Tikz_Plane::bbox_of ( const RotatedEllipse &  e)
inlinestaticprivate

◆ bbox_of() [9/14]

◆ bbox_of() [10/14]

◆ bbox_of() [11/14]

◆ bbox_of() [12/14]

static Geom_Box Aleph::Tikz_Plane::bbox_of ( const Tikz_Polyline &  pl)
inlinestaticprivate

◆ bbox_of() [13/14]

static Geom_Box Aleph::Tikz_Plane::bbox_of ( const Tikz_Quadratic_Bezier &  b)
inlinestaticprivate

◆ bbox_of() [14/14]

◆ clear()

void Aleph::Tikz_Plane::clear ( )
inline

Remove all inserted objects from the plane.

Definition at line 1398 of file tikzgeom.H.

References next_order_, and objects_.

Referenced by Aleph::Tikz_Scene::clear().

◆ clear_legend()

void Aleph::Tikz_Plane::clear_legend ( )
inline

Remove user-provided legend entries.

Definition at line 1379 of file tikzgeom.H.

References legend_entries_.

Referenced by Aleph::Tikz_Scene::clear_legend().

◆ clear_tikz_styles()

void Aleph::Tikz_Plane::clear_tikz_styles ( )
inline

Clear all registered \tikzset style definitions.

Definition at line 1392 of file tikzgeom.H.

References tikz_style_defs_.

◆ collect_legend_entries()

◆ compute_box()

Geom_Box Aleph::Tikz_Plane::compute_box ( ) const
inlineprivate

Definition at line 559 of file tikzgeom.H.

References bbox_of(), box(), merge_box(), and objects_.

Referenced by draw().

◆ compute_mapping()

◆ draw()

void Aleph::Tikz_Plane::draw ( std::ostream &  output,
const bool  squarize = true 
) const
inline

◆ draw_cartesian_axis()

template<typename Out >
void Aleph::Tikz_Plane::draw_cartesian_axis ( Out &  output,
const Geom_Box &  box,
const Mapping &  map 
) const
inlineprivate

◆ draw_coordinate_grid()

◆ draw_cubic_bezier()

template<typename Out >
static void Aleph::Tikz_Plane::draw_cubic_bezier ( const Tikz_Cubic_Bezier &  b,
const Tikz_Style &  style,
Out &  output,
const Geom_Box &  box,
const Mapping &  map 
)
inlinestaticprivate

◆ draw_ellipse()

template<typename Out >
void Aleph::Tikz_Plane::draw_ellipse ( const Ellipse &  e,
const Tikz_Style &  style,
Out &  output,
const Geom_Box &  box,
const Mapping &  map 
) const
inlineprivate

◆ draw_legend()

template<typename Out >
void Aleph::Tikz_Plane::draw_legend ( Out &  output) const
inlineprivate

◆ draw_line_eq()

template<typename Out >
void Aleph::Tikz_Plane::draw_line_eq ( const LineEq &  l,
const Tikz_Style &  style,
Out &  output,
const Geom_Box &  box,
const Mapping &  map 
) const
inlineprivate

◆ draw_object()

◆ draw_options()

◆ draw_point()

template<typename Out >
void Aleph::Tikz_Plane::draw_point ( const Point &  p,
const Tikz_Style &  style,
Out &  output,
const Geom_Box &  box,
const Mapping &  map 
) const
inlineprivate

◆ draw_polygon()

template<typename Out >
void Aleph::Tikz_Plane::draw_polygon ( const Polygon &  poly,
const Tikz_Style &  style,
Out &  output,
const Geom_Box &  box,
const Mapping &  map 
) const
inlineprivate

◆ draw_polyline()

template<typename Out >
void Aleph::Tikz_Plane::draw_polyline ( Out &  output,
const Array< Point > &  vertices,
const bool  closed,
const Tikz_Style &  style,
const Geom_Box &  box,
const Mapping &  map 
) const
inlineprivate

◆ draw_quadratic_bezier()

template<typename Out >
static void Aleph::Tikz_Plane::draw_quadratic_bezier ( const Tikz_Quadratic_Bezier &  b,
const Tikz_Style &  style,
Out &  output,
const Geom_Box &  box,
const Mapping &  map 
)
inlinestaticprivate

◆ draw_rectangle()

template<typename Out >
void Aleph::Tikz_Plane::draw_rectangle ( const Rectangle &  r,
const Tikz_Style &  style,
Out &  output,
const Geom_Box &  box,
const Mapping &  map 
) const
inlineprivate

Definition at line 870 of file tikzgeom.H.

References Aleph::Array< T >::append(), box(), draw_polyline(), output, r, and Aleph::Array< T >::reserve().

Referenced by draw_object().

◆ draw_regular_polygon()

template<typename Out >
void Aleph::Tikz_Plane::draw_regular_polygon ( const Regular_Polygon &  poly,
const Tikz_Style &  style,
Out &  output,
const Geom_Box &  box,
const Mapping &  map 
) const
inlineprivate

◆ draw_rotated_ellipse()

◆ draw_segment()

template<typename Out >
void Aleph::Tikz_Plane::draw_segment ( const Segment &  s,
const Tikz_Style &  style,
Out &  output,
const Geom_Box &  box,
const Mapping &  map 
) const
inlineprivate

◆ draw_text()

template<typename Out >
static void Aleph::Tikz_Plane::draw_text ( const Text &  t,
const Tikz_Style &  style,
Out &  output,
const Geom_Box &  box,
const Mapping &  map 
)
inlinestaticprivate

◆ draw_tikzset_styles()

template<typename Out >
void Aleph::Tikz_Plane::draw_tikzset_styles ( Out &  output) const
inlineprivate

◆ draw_triangle()

template<typename Out >
void Aleph::Tikz_Plane::draw_triangle ( const Triangle &  t,
const Tikz_Style &  style,
Out &  output,
const Geom_Box &  box,
const Mapping &  map 
) const
inlineprivate

◆ effective_clip_padding_mm()

double Aleph::Tikz_Plane::effective_clip_padding_mm ( ) const
inlineprivate

Definition at line 571 of file tikzgeom.H.

References clip_padding_mm_, and point_radius_mm_.

Referenced by draw().

◆ enable_auto_legend()

void Aleph::Tikz_Plane::enable_auto_legend ( const bool  enabled = true)
inline

Enable auto-legend generation from style colors.

Definition at line 1367 of file tikzgeom.H.

References with_auto_legend_.

Referenced by Aleph::Tikz_Scene::enable_auto_legend(), and TEST().

◆ enable_native_tikz_layers()

void Aleph::Tikz_Plane::enable_native_tikz_layers ( const bool  enabled = true)
inline

Enable native PGF layers (\pgfdeclarelayer).

Definition at line 1361 of file tikzgeom.H.

References with_native_layers_.

Referenced by Aleph::Tikz_Scene::enable_native_tikz_layers(), and TEST().

◆ escape_latex()

static std::string Aleph::Tikz_Plane::escape_latex ( const std::string &  text)
inlinestaticprivate

Definition at line 576 of file tikzgeom.H.

References Aleph::blossom_maximum_cardinality_matching().

Referenced by draw_legend(), and draw_text().

◆ fmt_double()

static std::string Aleph::Tikz_Plane::fmt_double ( const double  v)
inlinestaticprivate

Definition at line 292 of file tikzgeom.H.

References Aleph::and, Aleph::blossom_maximum_cardinality_matching(), and out.

Referenced by draw_options(), point_options(), and text_options().

◆ get_axis_style()

const Tikz_Style & Aleph::Tikz_Plane::get_axis_style ( ) const
inline

Style used for Cartesian axes when enabled.

Definition at line 1281 of file tikzgeom.H.

References axis_style_.

◆ get_clip_padding_mm()

const double & Aleph::Tikz_Plane::get_clip_padding_mm ( ) const
inline

Clip expansion around the frame; <= 0 means auto (point radius).

Definition at line 1244 of file tikzgeom.H.

References clip_padding_mm_.

◆ get_default_style()

const Tikz_Style & Aleph::Tikz_Plane::get_default_style ( ) const
inline

Default style used by put(obj) and non-styled put_in_plane.

Definition at line 1278 of file tikzgeom.H.

References default_style_.

◆ get_grid_style()

const Tikz_Style & Aleph::Tikz_Plane::get_grid_style ( ) const
inline

Style used for coordinate grids when enabled.

Definition at line 1283 of file tikzgeom.H.

References grid_style_.

◆ get_height()

const double & Aleph::Tikz_Plane::get_height ( ) const
inline

Plane height in millimeters.

Definition at line 1236 of file tikzgeom.H.

References height_.

Referenced by TEST().

◆ get_point_radius_mm()

const double & Aleph::Tikz_Plane::get_point_radius_mm ( ) const
inline

Radius used to draw point primitives (millimeters).

Definition at line 1242 of file tikzgeom.H.

References point_radius_mm_.

◆ get_wide()

const double & Aleph::Tikz_Plane::get_wide ( ) const
inline

Plane width in millimeters.

Definition at line 1234 of file tikzgeom.H.

References wide_.

Referenced by TEST().

◆ get_xoffset()

const double & Aleph::Tikz_Plane::get_xoffset ( ) const
inline

Horizontal scope offset in millimeters.

Definition at line 1238 of file tikzgeom.H.

References xoffset_.

Referenced by TEST().

◆ get_yoffset()

const double & Aleph::Tikz_Plane::get_yoffset ( ) const
inline

Vertical scope offset in millimeters.

Definition at line 1240 of file tikzgeom.H.

References yoffset_.

Referenced by TEST().

◆ layer_name()

static const char * Aleph::Tikz_Plane::layer_name ( const int  layer)
inlinestaticprivate

Definition at line 980 of file tikzgeom.H.

References Layer_Background, Layer_Foreground, and Layer_Overlay.

Referenced by draw().

◆ make_box()

static Geom_Box Aleph::Tikz_Plane::make_box ( const Geom_Number &  xmin,
const Geom_Number &  xmax,
const Geom_Number &  ymin,
const Geom_Number &  ymax 
)
inlinestaticprivate

Definition at line 420 of file tikzgeom.H.

References box().

Referenced by bbox_of(), bbox_of(), bbox_of(), bbox_of(), bbox_of(), bbox_of(), bbox_of(), and bbox_of().

◆ map_point()

static std::pair< double, double > Aleph::Tikz_Plane::map_point ( const Point &  p,
const Geom_Box &  box,
const Mapping &  map 
)
inlinestaticprivate

◆ map_x()

◆ map_x_length()

static double Aleph::Tikz_Plane::map_x_length ( const Geom_Number &  dx,
const Mapping &  map 
)
inlinestaticprivate

◆ map_y()

◆ map_y_length()

static double Aleph::Tikz_Plane::map_y_length ( const Geom_Number &  dy,
const Mapping &  map 
)
inlinestaticprivate

◆ merge_box()

◆ point_options()

◆ put() [1/2]

void Aleph::Tikz_Plane::put ( const Object &  obj)
inline

Insert an object with default style on default layer.

Definition at line 1405 of file tikzgeom.H.

References Aleph::blossom_maximum_cardinality_matching(), default_style_, Layer_Default, and put().

Referenced by put(), Aleph::put_in_plane(), and Aleph::put_in_plane().

◆ put() [2/2]

void Aleph::Tikz_Plane::put ( const Object &  obj,
const Tikz_Style &  style,
const int  layer 
)
inline

Insert an object with explicit style/layer.

Definition at line 1411 of file tikzgeom.H.

References Aleph::blossom_maximum_cardinality_matching(), next_order_, and objects_.

◆ put_cartesian_axis()

void Aleph::Tikz_Plane::put_cartesian_axis ( )
inline

Enable Cartesian axes drawing (only when 0 lies in range).

Definition at line 1330 of file tikzgeom.H.

References with_cartesian_axis_.

Referenced by main(), Aleph::Tikz_Scene::put_cartesian_axis(), TEST(), and TEST().

◆ put_coordinate_grid()

void Aleph::Tikz_Plane::put_coordinate_grid ( const double  step_x = 1.0,
const double  step_y = 1.0,
const bool  draw_ticks = true 
)
inline

Enable coordinate grid/ticks with user step sizes.

Definition at line 1342 of file tikzgeom.H.

References ah_domain_error_if, Aleph::blossom_maximum_cardinality_matching(), grid_step_x_, grid_step_y_, with_coordinate_grid_, and with_grid_ticks_.

Referenced by Aleph::Tikz_Scene::put_coordinate_grid(), and TEST().

◆ register_tikz_style()

void Aleph::Tikz_Plane::register_tikz_style ( const std::string &  name,
const Tikz_Style &  style 
)
inline

Register a reusable \tikzset style for the rendered picture.

Definition at line 1385 of file tikzgeom.H.

References ah_domain_error_if, and tikz_style_defs_.

Referenced by Aleph::Tikz_Scene::register_tikz_style(), and TEST().

◆ remove_cartesian_axis()

void Aleph::Tikz_Plane::remove_cartesian_axis ( )
inline

Disable Cartesian axes drawing.

Definition at line 1336 of file tikzgeom.H.

References with_cartesian_axis_.

Referenced by Aleph::Tikz_Scene::remove_cartesian_axis().

◆ remove_coordinate_grid()

void Aleph::Tikz_Plane::remove_coordinate_grid ( )
inline

Disable coordinate grid rendering.

Definition at line 1355 of file tikzgeom.H.

References with_coordinate_grid_.

Referenced by Aleph::Tikz_Scene::remove_coordinate_grid().

◆ required_tikz_libraries()

Array< std::string > Aleph::Tikz_Plane::required_tikz_libraries ( ) const
inline

Collect TikZ libraries required by currently emitted features.

The result is unique and deterministic. It currently detects pattern fills in objects, legends, and registered TikZ styles.

Returns
Required library names, without \usetikzlibrary syntax.
Note
Complexity is O(n), where n is the number of stored styles and objects.

Definition at line 1257 of file tikzgeom.H.

References Aleph::append_unique_tikz_library(), Aleph::blossom_maximum_cardinality_matching(), default_style_, legend_entries_, objects_, style_requires_patterns(), and tikz_style_defs_.

Referenced by draw(), Aleph::Tikz_Scene::draw_beamer_document(), Aleph::Tikz_Scene::required_tikz_libraries(), and TEST().

◆ set_axis_style()

void Aleph::Tikz_Plane::set_axis_style ( const Tikz_Style &  style)
inline

Configure the style used to draw Cartesian axes.

Parameters
styleThe new axis style.

Definition at line 1296 of file tikzgeom.H.

References axis_style_.

Referenced by Aleph::Tikz_Scene::set_axis_style().

◆ set_clip_padding_mm()

void Aleph::Tikz_Plane::set_clip_padding_mm ( const double &  padding_mm)
inline

Configure clip expansion around frame borders.

When <= 0, the plane uses point_radius_mm_ automatically.

Definition at line 1324 of file tikzgeom.H.

References Aleph::blossom_maximum_cardinality_matching(), and clip_padding_mm_.

Referenced by TEST().

◆ set_default_style()

void Aleph::Tikz_Plane::set_default_style ( const Tikz_Style &  style)
inline

Configure the default style for subsequent non-styled inserts.

Parameters
styleThe new default style.

Definition at line 1288 of file tikzgeom.H.

References default_style_.

Referenced by Aleph::Tikz_Scene::set_default_style().

◆ set_grid_style()

void Aleph::Tikz_Plane::set_grid_style ( const Tikz_Style &  style)
inline

Configure the style used to draw coordinate grids.

Parameters
styleThe new grid style.

Definition at line 1304 of file tikzgeom.H.

References grid_style_.

Referenced by Aleph::Tikz_Scene::set_grid_style().

◆ set_point_radius_mm()

void Aleph::Tikz_Plane::set_point_radius_mm ( const double &  radius_mm)
inline

Configure point marker radius.

Parameters
radius_mmCircle radius used for Point and degenerate fallbacks.
Exceptions
std::domain_errorIf radius_mm <= 0.

Definition at line 1314 of file tikzgeom.H.

References ah_domain_error_if, Aleph::blossom_maximum_cardinality_matching(), and point_radius_mm_.

Referenced by main(), and Aleph::Tikz_Scene::set_point_radius_mm().

◆ size()

size_t Aleph::Tikz_Plane::size ( ) const
inline

Number of currently inserted objects.

Definition at line 1246 of file tikzgeom.H.

References objects_.

Referenced by TEST().

◆ style_requires_patterns()

static bool Aleph::Tikz_Plane::style_requires_patterns ( const Tikz_Style &  style)
inlinestaticprivatenoexcept

Return true when rendering style needs the patterns library.

Definition at line 414 of file tikzgeom.H.

References Aleph::and, and Aleph::blossom_maximum_cardinality_matching().

Referenced by required_tikz_libraries().

◆ text_options()

Member Data Documentation

◆ axis_style_

Tikz_Style Aleph::Tikz_Plane::axis_style_
private
Initial value:
= []()
{
Tikz_Style s;
s.draw_color = "gray";
s.with_arrow = true;
return s;
}()

Definition at line 263 of file tikzgeom.H.

Referenced by draw_cartesian_axis(), draw_coordinate_grid(), get_axis_style(), and set_axis_style().

◆ clip_padding_mm_

double Aleph::Tikz_Plane::clip_padding_mm_ = -1.0
private

Definition at line 254 of file tikzgeom.H.

Referenced by effective_clip_padding_mm(), get_clip_padding_mm(), and set_clip_padding_mm().

◆ default_style_

Tikz_Style Aleph::Tikz_Plane::default_style_
private

Definition at line 262 of file tikzgeom.H.

Referenced by get_default_style(), put(), required_tikz_libraries(), and set_default_style().

◆ grid_step_x_

double Aleph::Tikz_Plane::grid_step_x_ = 1.0
private

Definition at line 255 of file tikzgeom.H.

Referenced by draw_coordinate_grid(), and put_coordinate_grid().

◆ grid_step_y_

double Aleph::Tikz_Plane::grid_step_y_ = 1.0
private

Definition at line 256 of file tikzgeom.H.

Referenced by draw_coordinate_grid(), and put_coordinate_grid().

◆ grid_style_

Tikz_Style Aleph::Tikz_Plane::grid_style_
private
Initial value:
= []()
{
Tikz_Style s;
s.draw_color = "gray!40";
s.dotted = true;
s.line_width_mm = 0.2;
return s;
}()

Definition at line 271 of file tikzgeom.H.

Referenced by draw_coordinate_grid(), get_grid_style(), and set_grid_style().

◆ height_

double Aleph::Tikz_Plane::height_ = 0.0
private

◆ Layer_Background

constexpr int Aleph::Tikz_Plane::Layer_Background = -100
staticconstexpr

Definition at line 202 of file tikzgeom.H.

Referenced by layer_name(), main(), and TEST().

◆ Layer_Default

constexpr int Aleph::Tikz_Plane::Layer_Default = 0
staticconstexpr

Definition at line 203 of file tikzgeom.H.

Referenced by main(), put(), and TEST().

◆ Layer_Foreground

constexpr int Aleph::Tikz_Plane::Layer_Foreground = 100
staticconstexpr

Definition at line 204 of file tikzgeom.H.

Referenced by layer_name(), main(), and TEST().

◆ Layer_Overlay

constexpr int Aleph::Tikz_Plane::Layer_Overlay = 1000
staticconstexpr

Definition at line 205 of file tikzgeom.H.

Referenced by layer_name(), main(), main(), and TEST().

◆ legend_entries_

Array<Legend_Entry> Aleph::Tikz_Plane::legend_entries_
private

◆ legend_entry_step_mm_

double Aleph::Tikz_Plane::legend_entry_step_mm_ = 5.0
private

Definition at line 260 of file tikzgeom.H.

Referenced by draw_legend().

◆ legend_x_mm_

double Aleph::Tikz_Plane::legend_x_mm_ = 3.0
private

Definition at line 258 of file tikzgeom.H.

Referenced by draw_legend().

◆ legend_y_mm_

double Aleph::Tikz_Plane::legend_y_mm_ = 3.0
private

Definition at line 259 of file tikzgeom.H.

Referenced by draw_legend().

◆ next_order_

size_t Aleph::Tikz_Plane::next_order_ = 0
private

Definition at line 290 of file tikzgeom.H.

Referenced by clear(), and put().

◆ objects_

Array<Styled_Object> Aleph::Tikz_Plane::objects_
private

◆ point_radius_mm_

double Aleph::Tikz_Plane::point_radius_mm_ = 1.0
private

◆ tick_size_mm_

double Aleph::Tikz_Plane::tick_size_mm_ = 1.5
private

Definition at line 257 of file tikzgeom.H.

Referenced by draw_coordinate_grid().

◆ tikz_style_defs_

std::map<std::string, Tikz_Style> Aleph::Tikz_Plane::tikz_style_defs_
private

◆ wide_

double Aleph::Tikz_Plane::wide_ = 0.0
private

◆ with_auto_legend_

bool Aleph::Tikz_Plane::with_auto_legend_ = false
private

Definition at line 252 of file tikzgeom.H.

Referenced by collect_legend_entries(), and enable_auto_legend().

◆ with_cartesian_axis_

bool Aleph::Tikz_Plane::with_cartesian_axis_ = false
private

Definition at line 248 of file tikzgeom.H.

Referenced by draw_cartesian_axis(), put_cartesian_axis(), and remove_cartesian_axis().

◆ with_coordinate_grid_

bool Aleph::Tikz_Plane::with_coordinate_grid_ = false
private

Definition at line 249 of file tikzgeom.H.

Referenced by draw_coordinate_grid(), put_coordinate_grid(), and remove_coordinate_grid().

◆ with_grid_ticks_

bool Aleph::Tikz_Plane::with_grid_ticks_ = false
private

Definition at line 250 of file tikzgeom.H.

Referenced by draw_coordinate_grid(), and put_coordinate_grid().

◆ with_native_layers_

bool Aleph::Tikz_Plane::with_native_layers_ = false
private

Definition at line 251 of file tikzgeom.H.

Referenced by draw(), and enable_native_tikz_layers().

◆ xoffset_

double Aleph::Tikz_Plane::xoffset_ = 0.0
private

Definition at line 245 of file tikzgeom.H.

Referenced by draw(), and get_xoffset().

◆ yoffset_

double Aleph::Tikz_Plane::yoffset_ = 0.0
private

Definition at line 246 of file tikzgeom.H.

Referenced by draw(), and get_yoffset().


The documentation for this class was generated from the following file: