#include <Constraint.h>
Public Member Functions | |
virtual Constraint * | clone (void) const |
Constraint (const Constraint &) | |
Constraint () | |
virtual unsigned int | getMemSize (void) const |
This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB? | |
virtual PyObject * | getPyObject (void) |
This method returns the Python wrapper for a C++ object. | |
virtual Base::Type | getTypeId (void) const |
virtual void | Restore (Base::XMLReader &) |
This method is used to restore properties from an XML document. | |
virtual void | Save (Base::Writer &) const |
This method is used to save properties to an XML document. | |
~Constraint () | |
Static Public Member Functions | |
static void * | create (void) |
static Base::Type | getClassTypeId (void) |
static void | init (void) |
Public Attributes | |
int | First |
PointPos | FirstPos |
float | LabelDistance |
std::string | Name |
int | Second |
PointPos | SecondPos |
int | Third |
PointPos | ThirdPos |
ConstraintType | Type |
double | Value |
Static Public Attributes | |
static const int | GeoUndef = -2000 |
Friends | |
class | Sketch |
Definition at line 54 of file Constraint.h.
Constraint::~Constraint | ( | ) |
Definition at line 72 of file Constraint.cpp.
Constraint::Constraint | ( | ) |
Definition at line 44 of file Constraint.cpp.
Referenced by clone(), and getPyObject().
Constraint::Constraint | ( | const Constraint & | from | ) |
Definition at line 58 of file Constraint.cpp.
Constraint * Constraint::clone | ( | void | ) | const [virtual] |
Definition at line 76 of file Constraint.cpp.
References Constraint().
Referenced by Sketcher::SketchObject::addConstraint(), Sketcher::PropertyConstraintList::setValue(), and Sketcher::SketchObject::transferConstraints().
void * Sketcher::Constraint::create | ( | void | ) | [static] |
Reimplemented from Base::Persistence.
Definition at line 40 of file Constraint.cpp.
Base::Type Sketcher::Constraint::getClassTypeId | ( | void | ) | [static] |
Reimplemented from Base::Persistence.
Definition at line 40 of file Constraint.cpp.
unsigned int Constraint::getMemSize | ( | void | ) | const [virtual] |
This method is used to get the size of objects It is not meant to have the exact size, it is more or less an estimation which runs fast! Is it two bytes or a GB?
Implements Base::Persistence.
Definition at line 86 of file Constraint.cpp.
PyObject * Constraint::getPyObject | ( | void | ) | [virtual] |
This method returns the Python wrapper for a C++ object.
It's in the responsibility of the programmer to do the correct reference counting. Basically there are two ways how to implement that: Either always return a new Python object then reference counting is not a matter or return always the same Python object then the reference counter must be incremented by one. However, it's absolutely forbidden to return always the same Python object without incrementing the reference counter.
The default implementation returns 'None'.
Reimplemented from Base::BaseClass.
Definition at line 81 of file Constraint.cpp.
References Constraint().
Base::Type Sketcher::Constraint::getTypeId | ( | void | ) | const [virtual] |
Reimplemented from Base::Persistence.
Definition at line 40 of file Constraint.cpp.
void Sketcher::Constraint::init | ( | void | ) | [static] |
Reimplemented from Base::Persistence.
Definition at line 40 of file Constraint.cpp.
Referenced by initSketcher().
void Constraint::Restore | ( | Base::XMLReader & | ) | [virtual] |
This method is used to restore properties from an XML document.
It uses the XMLReader class, which bases on SAX, to read the in Save() written information. Again the Vector as an example:
void PropertyVector::Restore(Base::XMLReader &reader) { // read my Element reader.readElement("PropertyVector"); // get the value of my Attribute _cVec.x = (float)reader.getAttributeAsFloat("valueX"); _cVec.y = (float)reader.getAttributeAsFloat("valueY"); _cVec.z = (float)reader.getAttributeAsFloat("valueZ"); }
Implements Base::Persistence.
Definition at line 107 of file Constraint.cpp.
References First, FirstPos, Base::XMLReader::getAttribute(), Base::XMLReader::getAttributeAsFloat(), Base::XMLReader::getAttributeAsInteger(), Base::XMLReader::hasAttribute(), LabelDistance, Name, Base::XMLReader::readElement(), Second, SecondPos, Third, ThirdPos, and Value.
Referenced by Sketcher::PropertyConstraintList::Restore().
void Constraint::Save | ( | Base::Writer & | ) | const [virtual] |
This method is used to save properties to an XML document.
A good example you'll find in PropertyStandard.cpp, e.g. the vector:
void PropertyVector::Save (Writer &writer) const { writer << writer.ind() << "<PropertyVector valueX=\"" << _cVec.x << "\" valueY=\"" << _cVec.y << "\" valueZ=\"" << _cVec.z <<"\"/>" << endl; }
The writer.ind() expression writes the indention, just for pretty printing of the XML. As you see, the writing of the XML document is not done with a DOM implementation because of performance reasons. Therefore the programmer has to take care that a valid XML document is written. This means closing tags and writing UTF-8.
Implements Base::Persistence.
Definition at line 91 of file Constraint.cpp.
References First, FirstPos, Base::Writer::ind(), Py::int, LabelDistance, Name, Second, SecondPos, Base::Writer::Stream(), Third, ThirdPos, and Value.
friend class Sketch [friend] |
Definition at line 73 of file Constraint.h.
Definition at line 79 of file Constraint.h.
Referenced by Sketcher::Sketch::addConstraint(), Sketcher::SketchObject::delGeometry(), SketcherGui::ViewProviderSketch::draw(), Sketcher::SketchObject::fillet(), SketcherGui::ViewProviderSketch::moveConstraint(), Sketcher::ConstraintPy::PyInit(), Sketcher::ConstraintPy::representation(), Restore(), Save(), Sketcher::ConstraintPy::setFirst(), Sketcher::SketchObject::transferConstraints(), and Sketcher::SketchObject::trim().
Definition at line 80 of file Constraint.h.
Referenced by Sketcher::Sketch::addConstraint(), SketcherGui::ViewProviderSketch::draw(), SketcherGui::EditDatumDialog::exec(), Sketcher::SketchObject::fillet(), SketcherGui::ViewProviderSketch::moveConstraint(), Sketcher::ConstraintPy::PyInit(), Restore(), Save(), Sketcher::SketchObject::transferConstraints(), and Sketcher::SketchObject::trim().
const int Constraint::GeoUndef = -2000 [static] |
Definition at line 64 of file Constraint.h.
Referenced by Sketcher::Sketch::addConstraint(), SketcherGui::EditDatumDialog::exec(), and Sketcher::ConstraintPy::PyInit().
Definition at line 85 of file Constraint.h.
Referenced by CmdSketcherConstrainAngle::activated(), SketcherGui::ViewProviderSketch::draw(), SketcherGui::ViewProviderSketch::moveConstraint(), Restore(), Save(), and updateDatumDistance().
std::string Sketcher::Constraint::Name |
Definition at line 77 of file Constraint.h.
Definition at line 81 of file Constraint.h.
Referenced by Sketcher::Sketch::addConstraint(), Sketcher::SketchObject::delGeometry(), SketcherGui::ViewProviderSketch::draw(), SketcherGui::EditDatumDialog::exec(), Sketcher::SketchObject::fillet(), SketcherGui::ViewProviderSketch::moveConstraint(), Sketcher::ConstraintPy::PyInit(), Restore(), Save(), Sketcher::ConstraintPy::setSecond(), Sketcher::SketchObject::transferConstraints(), and Sketcher::SketchObject::trim().
Definition at line 82 of file Constraint.h.
Referenced by Sketcher::Sketch::addConstraint(), SketcherGui::ViewProviderSketch::draw(), Sketcher::SketchObject::fillet(), SketcherGui::ViewProviderSketch::moveConstraint(), Sketcher::ConstraintPy::PyInit(), Restore(), Save(), Sketcher::SketchObject::transferConstraints(), and Sketcher::SketchObject::trim().
Definition at line 83 of file Constraint.h.
Referenced by Sketcher::Sketch::addConstraint(), Sketcher::ConstraintPy::PyInit(), Restore(), and Save().
Definition at line 84 of file Constraint.h.
Definition at line 76 of file Constraint.h.
Referenced by Sketcher::Sketch::addConstraint(), SketcherGui::ViewProviderSketch::draw(), SketcherGui::ViewProviderSketch::editDoubleClicked(), SketcherGui::EditDatumDialog::exec(), Sketcher::SketchObject::fillet(), SketcherGui::ViewProviderSketch::moveConstraint(), Sketcher::ConstraintPy::PyInit(), and Sketcher::SketchObject::trim().
double Sketcher::Constraint::Value |
Definition at line 78 of file Constraint.h.
Referenced by Sketcher::Sketch::addConstraint(), SketcherGui::ViewProviderSketch::draw(), SketcherGui::EditDatumDialog::exec(), Sketcher::ConstraintPy::PyInit(), Restore(), Save(), and Sketcher::SketchObject::setDatum().