+++ /dev/null
-#ifndef __HATCH_H__
-#define __HATCH_H__
-
-#include "entity.h"
-#include "entitycontainer.h"
-
-/**
- * Holds the data that defines a hatch entity.
- */
-class HatchData
-{
- public:
- /**
- * Default constructor. Leaves the data object uninitialized.
- */
- HatchData() {}
-
- /**
- * @param solid true: solid fill, false: pattern.
- * @param scale Pattern scale or spacing.
- * @param pattern Pattern name.
- */
- HatchData(bool solid, double scale, double angle, const QString & pattern)
- {
- this->solid = solid;
- this->scale = scale;
- this->angle = angle;
- this->pattern = pattern;
-
- //std::cout << "RS_H__atchData: " << pattern.latin1() << "\n";
- }
-
- friend std::ostream & operator<<(std::ostream & os, const HatchData & td)
- {
- os << "(" << td.pattern.toAscii().data() << ")";
- return os;
- }
-
- public:
- bool solid;
- double scale;
- double angle;
- QString pattern;
-};
-
-/**
- * Class for a hatch entity.
- *
- * @author James Hammons
- * @author Andrew Mustun
- */
-class Hatch: public EntityContainer
-{
- public:
- Hatch(EntityContainer * parent, const HatchData & d);
- virtual ~Hatch();
-
- virtual Entity * clone();
- virtual RS2::EntityType rtti() const;
- virtual bool isContainer() const;
- HatchData getData() const;
- bool validate();
- int countLoops();
-
- /** @return true if this is a solid fill. false if it is a pattern hatch. */
- bool isSolid() const;
- void setSolid(bool solid);
- QString getPattern();
- void setPattern(const QString & pattern);
- double getScale();
- void setScale(double scale);
- double getAngle();
- void setAngle(double angle);
-
- virtual void calculateBorders();
- void update();
- void activateContour(bool on);
- virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
- virtual double getLength();
- virtual double getDistanceToPoint(const Vector & coord, Entity ** entity = NULL,
- RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
- virtual void move(Vector offset);
- virtual void rotate(Vector center, double angle);
- virtual void scale(Vector center, Vector factor);
- virtual void mirror(Vector axisPoint1, Vector axisPoint2);
- virtual void stretch(Vector firstCorner, Vector secondCorner, Vector offset);
-
- friend std::ostream & operator<<(std::ostream & os, const Hatch & p);
-
- protected:
- HatchData data;
- EntityContainer * hatch;
- bool updateRunning;
- bool needOptimization;
-};
-
-#endif // __HATCH_H__