/*
5 * Authors: see git history
7 * Copyright 2008 Jasper van de Gronde <th.v.d.gronde@hccnet.nl>
8 * Copyright 2013 Tavmjong Bah <tavmjong@free.fr>
9 * Copyright (C) 2018 Authors
11 * Released under GNU GPL v2+, read the file
'COPYING' for more information.
36 int precision = std::max<int>(
minprec,std::min<int>(
maxprec, prefs->
getInt(
"/options/svgoutput/numericprecision", 8)));
37 int minexp = prefs->
getInt(
"/options/svgoutput/minimumexponent", -8);
46 : _abs_state(precision, minexp)
47 , _rel_state(precision, minexp)
49 , _force_repeat_commands(force_repeat)
69 unsigned int const abs_added_size = abs_op_repeated ? 0 : 2;
70 unsigned int const rel_added_size = rel_op_repeated ? 0 : 2;
79 abs_op_repeated =
false;
92 rel_op_repeated =
false;
99 std::cerr <<
"Better not be here!" << std::endl;
135 int const digitsEnd = (int)
floor(log10(std::min(fabs(v),fabs(r)))) -
_precision;
136 double const roundeddiff =
floor((v-r)*pow(10.,-digitsEnd-1)+.5);
137 int const numDigits = (int)
floor(log10(fabs(roundeddiff)))+1;
142 }
else if (numDigits>0) {
143 appendNumber(v-r, numDigits, minexp);
159 appendRelativeCoord(v, r);
168 size_t const oldsize = str.size();
170 char* begin_of_num =
const_cast<char*
>(str.data()+oldsize);
Two-dimensional point that doubles as a vector.
Preference storage class.
bool getBool(Glib::ustring const &pref_path, bool def=false)
Retrieve a Boolean value.
static Preferences * get()
Access the singleton Preferences object.
int getInt(Glib::ustring const &pref_path, int def=0)
Retrieve an integer.
int getIntLimited(Glib::ustring const &pref_path, int def=0, int min=INT_MIN, int max=INT_MAX)
Retrieve a limited integer.
struct Inkscape::SVG::PathString::State _abs_state
bool _force_repeat_commands
PATHSTRING_FORMAT _format
PathString()
Construct a path string using Inkscape's default preferences.
void _appendOp(char abs_op, char rel_op)
struct Inkscape::SVG::PathString::State _rel_state
double Coord
Floating point type used to store coordinates.
auto floor(Geom::Rect const &rect)
Helper class to stream background task notifications as a series of messages.
Inkscape::SVG::PathString - builder for SVG path strings.
Singleton class to access the preferences file in a convenient way.
void appendNumber(double v, int precision, int minexp)
void appendRelativeCoord(Geom::Coord v, Geom::Coord r)
void appendRelative(Geom::Coord v, Geom::Coord r)
std::string sp_svg_number_write_de(double val, unsigned int tprec, int min_exp)
unsigned int sp_svg_number_read_d(gchar const *str, double *val)
TODO: insert short description here.