17#include <glibmm/i18n.h>
78 std::stringstream
temp;
89 double const ex = em * 0.5;
154 double const w =
ictx->viewport.width();
155 double const h =
ictx->viewport.height();
157 double const ex = 0.5 * em;
196 std::cerr <<
"SPGenericRect::write(): unknown type." << std::endl;
209 std::cerr <<
"SPGenericRect::write(): unknown type." << std::endl;
246 return _(
"Rectangle");
267 double const w2 = w / 2;
268 double const h2 = h / 2;
269 double const rx = std::min(( this->rx._set
275 double const ry = std::min(( this->ry._set
289 if ((rx > 1e-18) && (
ry > 1e-18)) {
299 c.lineto(
x +
w,
y + h -
ry);
305 c.lineto(
x +
rx,
y + h);
316 c.moveto(
x + 0.0,
y + 0.0);
317 c.lineto(
x +
w,
y + 0.0);
318 c.lineto(
x +
w,
y + h);
319 c.lineto(
x + 0.0,
y + h);
430 pos = pos *
ret.inverse();
467 this->i2doc_affine());
480 this->i2doc_affine());
494 this->i2doc_affine());
505 this->i2doc_affine());
554 this->i2doc_affine());
563 this->i2doc_affine());
576 this->i2doc_affine());
587 this->i2doc_affine());
627 if (!prefs->
getBool(
"/tools/shapes/rect/convertguides",
true)) {
633 std::list<std::pair<Geom::Point, Geom::Point> > pts;
642 pts.emplace_back(
A1, A2);
643 pts.emplace_back(A2,
A3);
644 pts.emplace_back(
A3,
A4);
645 pts.emplace_back(
A4,
A1);
gchar const * sp_attribute_name(SPAttr id)
Get attribute name by id.
Lookup dictionary for attributes/properties.
3x3 matrix representing an affine transformation.
C height() const
Get the vertical extent of the rectangle.
C width() const
Get the horizontal extent of the rectangle.
Two-dimensional point that doubles as a vector.
Axis aligned, non-empty rectangle.
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.
Storing of snapping preferences.
bool isTargetSnappable(Inkscape::SnapTargetType const target) const
Interface for refcounted XML nodes.
bool setAttributeSvgLength(Util::const_char_ptr key, SVGLength const &val)
virtual void setCodeUnsafe(int code)=0
Set the integer GQuark code for the name of the node.
void setAttribute(Util::const_char_ptr key, Util::const_char_ptr value)
Change an attribute of this node.
void removeAttribute(Inkscape::Util::const_char_ptr key)
Remove an attribute of this node.
Wrapper around a Geom::PathVector object.
Typed SVG document implementation.
Inkscape::XML::Document * getReprDoc()
Our Inkscape::XML::Document.
Geom::Affine i2dt_affine() const
Returns the transformation from item to desktop coords.
void adjust_gradient(Geom::Affine const &postmul, bool set=false)
void adjust_pattern(Geom::Affine const &postmul, bool set=false, PaintServerTransform=TRANSFORM_BOTH)
void adjust_stroke(double ex)
virtual void convert_to_guides() const
bool hasPathEffectOnClipOrMaskRecursive(SPLPEItem *shape) const
returns true when any LPE apply to clip or mask.
bool pathEffectsEnabled() const
bool optimizeTransforms()
returns false when LPE write unoptimiced
Inkscape::XML::Node * repr
SPStyle * style
Represents the style properties, whether from presentation attributes, the style attribute,...
Inkscape::XML::Node * updateRepr(unsigned int flags=SP_OBJECT_WRITE_EXT)
Updates the object's repr based on the object's state.
void readAttr(char const *key)
Read value of key attribute from XML node into object.
Inkscape::XML::Node * getRepr()
Returns the XML representation of tree.
void objectTrace(std::string const &, bool in=true, unsigned flags=0)
void requestDisplayUpdate(unsigned int flags)
Queues an deferred update of this object's display.
void convert_to_guides() const override
void setVisibleHeight(double ry)
Inkscape::XML::Node * write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags) override
bool set_rect_path_attribute(Inkscape::XML::Node *repr)
void setRx(bool set, double value)
double getVisibleHeight() const
void setVisibleRx(double rx)
double getVisibleRx() const
void build(SPDocument *doc, Inkscape::XML::Node *repr) override
void set(SPAttr key, char const *value) override
const char * typeName() const override
The item's type name, not node tag name.
const char * displayName() const override
The item's type name as a translated human string.
void tag_name_changed(gchar const *oldname, gchar const *newname) override
double getVisibleRy() const
void setVisibleWidth(double rx)
void modified(unsigned int flags) override
void update_patheffect(bool write) override
void setVisibleRy(double ry)
Geom::Affine set_transform(Geom::Affine const &xform) override
void setRy(bool set, double value)
void snappoints(std::vector< Inkscape::SnapCandidatePoint > &p, Inkscape::SnapPreferences const *snapprefs) const override
void compensateRxRy(Geom::Affine xform)
Geom::Rect getRect() const
void set_shape() override
void setPosition(double x, double y, double width, double height)
void update(SPCtx *ctx, unsigned int flags) override
static double vectorStretch(Geom::Point p0, Geom::Point p1, Geom::Affine xform)
Returns the ratio in which the vector from p0 to p1 is stretched by transform.
double getVisibleWidth() const
Base class for shapes, including <path> element.
void update(SPCtx *ctx, unsigned int flags) override
void setCurveInsync(SPCurve const *)
bool prepareShapeForLPE(SPCurve const *c)
void modified(unsigned int flags) override
void set(SPAttr key, char const *value) override
void setCurveBeforeLPE(SPCurve const *)
void build(SPDocument *document, Inkscape::XML::Node *repr) override
void update_patheffect(bool write) override
std::shared_ptr< SPCurve const > _curve
Inkscape::XML::Node * write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, unsigned int flags) override
bool checkBrokenPathEffect()
T< SPAttr::FONT_SIZE, SPIFontSize > font_size
Size of the font.
bool read(char const *str)
void readOrUnset(char const *str, Unit u=NONE, float v=0, float c=0)
void unset(Unit u=NONE, float v=0, float c=0)
void update(double em, double ex, double scale)
Angle distance(Angle const &a, Angle const &b)
@ SNAPSOURCE_OBJECT_MIDPOINT
@ SNAPSOURCE_LINE_MIDPOINT
@ SNAPTARGET_LINE_MIDPOINT
@ SNAPTARGET_OBJECT_MIDPOINT
static cairo_user_data_key_t key
Singleton class to access the preferences file in a convenient way.
Some utility classes to store various kinds of snap candidates.
void sp_guide_pt_pairs_to_guides(SPDocument *doc, std::list< std::pair< Geom::Point, Geom::Point > > &pts)
@ SP_GENERIC_RECT_UNDEFINED
Interface for XML documents.
Contains transformations to document/viewport and the viewport size.
SPStyle - a style object for SPItem objects.
static void sp_svg_write_path(Inkscape::SVG::PathString &str, Geom::Path const &p, bool normalize=false)