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);
78 // virtual void draw(RS_Painter* painter, RS_GraphicView* view,
79 virtual void draw(PaintInterface * painter, RS_GraphicView * view, double patternOffset = 0.0);
81 virtual double getLength();
82 virtual double getDistanceToPoint(const Vector & coord, RS_Entity ** entity = NULL,
83 RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
84 virtual void move(Vector offset);
85 virtual void rotate(Vector center, double angle);
86 virtual void scale(Vector center, Vector factor);
87 virtual void mirror(Vector axisPoint1, Vector axisPoint2);
88 virtual void stretch(Vector firstCorner, Vector secondCorner, Vector offset);
90 friend std::ostream & operator<<(std::ostream & os, const RS_Hatch & p);
94 RS_EntityContainer * hatch;
96 bool needOptimization;