/// The factor determining the vertical distance between levels (default = 0.3)
float level_height_factor;
- /**
- * Cell labeling (fixed order).
- *
- * The following booleans determine which properties of the cell shall be
- * displayed as text in the middle of each cell.
- */
- bool label_level_number; // default: true
- bool label_cell_index; // default: true
- bool label_material_id; // default: false
- bool label_subdomain_id; // default: false
- bool label_level_subdomain_id; // default: false
+ /// Scaling of the font for cell annotations. Defaults to 1.
+ float cell_font_scaling;
+ /// Write level number into each cell. Defaults to true
+ bool label_level_number;
+ /// Write cell index into each cell. Defaults to true
+ bool label_cell_index;
+ /// Write material id of each cell. Defaults to false
+ bool label_material_id;
+ /// Write subdomain id of each cell. Defaults to false
+ bool label_subdomain_id;
+ /// Write level subdomain id of each cell. Defaults to false
+ bool label_level_subdomain_id;
/// Draw a colorbar next to the plotted grid with respect to the chosen coloring of the cells
bool draw_colorbar;
coloring(coloring),
convert_level_number_to_height(convert_level_number_to_height),
level_height_factor(0.3f),
+ cell_font_scaling(1.f),
label_level_number(label_level_number),
label_cell_index(label_cell_index),
label_material_id(label_material_id),
unsigned int min_level, max_level;
- // Svg files require an underlying drawing grid.
- // We set the number of height elements of this
- // grid to 4000 and adapt the number of width
- // elements with respect to the bounding box of
- // the given triangulation.
+ // Svg files require an underlying drawing grid. The size of this
+ // grid is provided in the parameters height and width. Each of them
+ // may be zero, such that it is computed from the other. Obviously,
+ // both of them zero does not produce reasonable output.
unsigned int height = svg_flags.height;
unsigned int width = svg_flags.width;
Assert (height != 0 || width != 0, ExcMessage("You have to set at least one of width and height"));
unsigned int additional_width = 0;
// font size for date, time, legend, and colorbar
unsigned int font_size = static_cast<unsigned int>(.5 + (height/100.) * 1.75);
- cell_label_font_size = static_cast<unsigned int>((int)(.5 + (height/100.) * 2.75) * 9. * (min_level_min_vertex_distance / std::min(x_dimension, y_dimension)));
+ cell_label_font_size = static_cast<unsigned int>(.5 +
+ (height * .15
+ * svg_flags.cell_font_scaling
+ * min_level_min_vertex_distance
+ / std::min(x_dimension, y_dimension)));
if (svg_flags.draw_legend && (svg_flags.label_level_number || svg_flags.label_cell_index || svg_flags.label_material_id || svg_flags.label_subdomain_id || svg_flags.label_level_subdomain_id ))
{
else x_offset = static_cast<unsigned int>(.5 + height * .025);
out << " <text x=\"" << x_offset << "\" y=\"" << static_cast<unsigned int>(.5 + height * .0525) << '\"'
- << " style=\"font-weight:100; fill:lightsteelblue; text-anchor:start; font-family:Courier; font-size:" << static_cast<unsigned int>(.5 + height * .045) << "\">"
+ << " style=\"font-weight:100; fill:lightsteelblue; text-anchor:start; font-family:Courier; font-size:" << static_cast<unsigned int>(.5 + height * .045) << "px\">"
<< "deal.II" << "</text>" << '\n';
// out << " <text x=\"" << x_offset + static_cast<unsigned int>(.5 + height * .045 * 4.75) << "\" y=\"" << static_cast<unsigned int>(.5 + height * .0525) << '\"'
projection_decomposition = GridOut::svg_project_point(point, camera_position, camera_direction, camera_horizontal, camera_focus);
+ const unsigned int font_size_this_cell = static_cast<unsigned int>(.5 + cell_label_font_size * pow(.5, (float)cell->level() - 4. + 3.5 * distance_factor));
+
out << " <text"
<< " x=\"" << static_cast<unsigned int>(.5 + ((projection_decomposition[0] - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent))
- << "\" y=\"" << static_cast<unsigned int>(.5 + height - (height/100.) * margin_in_percent - ((projection_decomposition[1] - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent))
- << "\" style=\"font-size:" << static_cast<unsigned int>(.5 + cell_label_font_size * pow(.5, (float)cell->level() - 4. + 3.5 * distance_factor))
- << "\">";
+ << "\" y=\"" << static_cast<unsigned int>(.5 + height - (height/100.) * margin_in_percent - ((projection_decomposition[1] - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent) + 0.5 * font_size_this_cell)
+ << "\" style=\"font-size:" << font_size_this_cell
+ << "px\">";
if (svg_flags.label_level_number)
{
out << " <text x=\"" << width + additional_width + static_cast<unsigned int>(.5 + (height/100.) * 1.25)
<< "\" y=\"" << static_cast<unsigned int>(.5 + (height/100.) * margin_in_percent + (++line_offset) * 1.5 * font_size)
<< "\" style=\"text-anchor:start; font-weight:bold; font-size:" << font_size
- << "\">" << "cell label"
+ << "px\">" << "cell label"
<< "</text>" << '\n';
if (svg_flags.label_level_number)
out << " <text x=\"" << width + additional_width + static_cast<unsigned int>(.5 + (height/100.) * 2.)
<< "\" y=\"" << static_cast<unsigned int>(.5 + (height/100.) * margin_in_percent + (++line_offset) * 1.5 * font_size)
<< "\" style=\"text-anchor:start; font-style:oblique; font-size:" << font_size
- << "\">" << "level_number";
+ << "px\">" << "level_number";
if (svg_flags.label_cell_index || svg_flags.label_material_id || svg_flags.label_subdomain_id || svg_flags.label_level_subdomain_id)
out << ',';
out << " <text x=\"" << width + additional_width + static_cast<unsigned int>(.5 + (height/100.) * 2.)
<< "\" y=\"" << static_cast<unsigned int>(.5 + (height/100.) * margin_in_percent + (++line_offset) * 1.5 * font_size )
<< "\" style=\"text-anchor:start; font-style:oblique; font-size:" << font_size
- << "\">"
+ << "px\">"
<< "cell_index";
if (svg_flags.label_material_id || svg_flags.label_subdomain_id || svg_flags.label_level_subdomain_id)
out << " <text x=\"" << width + additional_width + static_cast<unsigned int>(.5 + (height/100.) * 2.)
<< "\" y=\"" << static_cast<unsigned int>(.5 + (height/100.) * margin_in_percent + (++line_offset) * 1.5 * font_size )
<< "\" style=\"text-anchor:start; font-style:oblique; font-size:" << font_size
- << "\">"
+ << "px\">"
<< "material_id";
if (svg_flags.label_subdomain_id || svg_flags.label_level_subdomain_id)
out << " <text x= \"" << width + additional_width + static_cast<unsigned int>(.5 + (height/100.) * 2.)
<< "\" y=\"" << static_cast<unsigned int>(.5 + (height/100.) * margin_in_percent + (++line_offset) * 1.5 * font_size )
<< "\" style=\"text-anchor:start; font-style:oblique; font-size:" << font_size
- << "\">"
+ << "px\">"
<< "subdomain_id";
if (svg_flags.label_level_subdomain_id)
out << " <text x= \"" << width + additional_width + static_cast<unsigned int>(.5 + (height/100.) * 2.)
<< "\" y=\"" << static_cast<unsigned int>(.5 + (height/100.) * margin_in_percent + (++line_offset) * 1.5 * font_size )
<< "\" style=\"text-anchor:start; font-style:oblique; font-size:" << font_size
- << "\">"
+ << "px\">"
<< "level_subdomain_id"
<< "</text>" << '\n';
}
{
out << " <text x=\"" << width + additional_width
<< "\" y=\"" << static_cast<unsigned int>(.5 + (height/100.) * margin_in_percent + 10.75 * font_size)
- << "\" style=\"text-anchor:start; font-size:" << font_size << "\">"
+ << "\" style=\"text-anchor:start; font-size:" << font_size << "px\">"
<< "azimuth: " << svg_flags.azimuth_angle << "°, polar: " << svg_flags.polar_angle << "°</text>" << '\n';
}
out << " <text x=\"" << width + additional_width
<< "\" y=\"" << static_cast<unsigned int>(.5 + (height/100.) * (margin_in_percent + 29.) - (font_size/1.25))
- << "\" style=\"text-anchor:start; font-weight:bold; font-size:" << font_size << "\">";
+ << "\" style=\"text-anchor:start; font-weight:bold; font-size:" << font_size << "px\">";
switch (svg_flags.coloring)
{
out << " <text x=\"" << width + additional_width + 1.5 * element_width
<< "\" y=\"" << static_cast<unsigned int>(.5 + (height/100.) * (margin_in_percent + 29)) + (n-index-1 + .5) * element_height + static_cast<unsigned int>(.5 + font_size * .35) << "\""
- << " style=\"text-anchor:start; font-size:" << static_cast<unsigned int>(.5 + font_size);
+ << " style=\"text-anchor:start; font-size:" << static_cast<unsigned int>(.5 + font_size) << "px";
if (index == 0 || index == n-1) out << "; font-weight:bold";