5 #include "rs_entitycontainer.h"
8 * Holds the data that defines a hatch entity.
14 * Default constructor. Leaves the data object uninitialized.
19 * @param solid true: solid fill, false: pattern.
20 * @param scale Pattern scale or spacing.
21 * @param pattern Pattern name.
23 RS_HatchData(bool solid, double scale, double angle, const QString & pattern)
28 this->pattern = pattern;
30 //std::cout << "RS_HatchData: " << pattern.latin1() << "\n";
33 friend std::ostream & operator<<(std::ostream & os, const RS_HatchData & td)
35 os << "(" << td.pattern.toLatin1().data() << ")";
47 * Class for a hatch entity.
49 * @author Andrew Mustun
51 class RS_Hatch: public RS_EntityContainer
54 RS_Hatch(RS_EntityContainer * parent, const RS_HatchData & d);
57 virtual RS_Entity * clone();
58 virtual RS2::EntityType rtti() const;
59 virtual bool isContainer() const;
60 RS_HatchData getData() const;
64 /** @return true if this is a solid fill. false if it is a pattern hatch. */
66 void setSolid(bool solid);
68 void setPattern(const QString & pattern);
70 void setScale(double scale);
72 void setAngle(double angle);
74 virtual void calculateBorders();
76 void activateContour(bool on);
77 virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
78 virtual double getLength();
79 virtual double getDistanceToPoint(const Vector & coord, RS_Entity ** entity = NULL,
80 RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
81 virtual void move(Vector offset);
82 virtual void rotate(Vector center, double angle);
83 virtual void scale(Vector center, Vector factor);
84 virtual void mirror(Vector axisPoint1, Vector axisPoint2);
85 virtual void stretch(Vector firstCorner, Vector secondCorner, Vector offset);
87 friend std::ostream & operator<<(std::ostream & os, const RS_Hatch & p);
91 RS_EntityContainer * hatch;
93 bool needOptimization;