Sketcher::SketchObject Class Reference

#include <SketchObject.h>

Inheritance diagram for Sketcher::SketchObject:
Part::Part2DObject Part::Feature App::GeoFeature App::DocumentObject App::PropertyContainer Base::Persistence Base::BaseClass

List of all members.

Public Member Functions

int addConstraint (const Constraint *constraint)
 add constraint
int addConstraints (const std::vector< Constraint * > &ConstraintList)
 add all constraints in the list
int addExternal (App::DocumentObject *Obj, const char *SubName)
 add an external geometry reference
int addGeometry (const std::vector< Part::Geometry * > &geoList)
 add unspecified geometry
int addGeometry (const Part::Geometry *geo)
 add unspecified geometry
int delConstraint (int ConstrId)
 delete constraint
int delConstraintOnPoint (int VertexId, bool onlyCoincident=true)
int delConstraintOnPoint (int GeoId, PointPos PosId, bool onlyCoincident=true)
int delExternal (int ConstrId)
 delete external
int delGeometry (int GeoNbr)
 delete geometry
int fillet (int geoId1, int geoId2, const Base::Vector3d &refPnt1, const Base::Vector3d &refPnt2, double radius, bool trim=true)
int fillet (int geoId, PointPos pos, double radius, bool trim=true)
 create a fillet
void getCoincidentPoints (int VertexId, std::vector< int > &GeoIdList, std::vector< PointPos > &PosIdList)
void getCoincidentPoints (int GeoId, PointPos PosId, std::vector< int > &GeoIdList, std::vector< PointPos > &PosIdList)
 retrieves for a Vertex number a list with all coincident points
std::vector< Part::Geometry * > getExternalGeometry (void)
 returns a list of projected external geoms
void getGeoVertexIndex (int VertexId, int &GeoId, PointPos &PosId)
 retrieves for a Vertex number the corresponding GeoId and PosId
int getHighestCurveIndex (void)
int getHighestVertexIndex (void)
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?
Base::Vector3d getPoint (int geoIndex1, PointPos Pos1)
 retrieves the coordinates of a point
virtual PyObjectgetPyObject (void)
 This method returns the Python wrapper for a C++ object.
virtual Base::Type getTypeId (void) const
int hasConflicts (void) const
 returns non zero if the sketch contains conflicting constraints
int movePoint (int geoIndex1, PointPos Pos1, const Base::Vector3d &toPoint, bool relative=false)
 move this point to a new location and solve
void rebuildVertexIndex (void)
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.
int setDatum (int ConstrId, double Datum)
 set the datum of a Distance or Angle constraint and solve
 SketchObject ()
int toggleConstruction (int GeoNbr)
 toggle geometry to draft line
int transferConstraints (int fromGeoId, PointPos fromPosId, int toGeoId, PointPos toPosId)
 transfers all contraints of a point to a new point
int trim (int geoId, const Base::Vector3d &point)
 trim a curve
methods overide Feature



App::DocumentObjectExecReturnexecute (void)
 recalculate the Feature
const char * getViewProviderName (void) const
 returns the type name of the ViewProvider

Static Public Member Functions

static void appendConflictMsg (const std::vector< int > &conflicting, std::string &msg)
 generates a warning message about constraint conflicts and appends it to the given message
static void * create (void)
static Base::Type getClassTypeId (void)
static void init (void)

Public Attributes

Sketcher::PropertyConstraintList Constraints
App::PropertyLinkSubList ExternalConstraints
Part::PropertyGeometryList Geometry
 Property.

Protected Member Functions

virtual const App::PropertyDatagetPropertyData (void) const
virtual void onChanged (const App::Property *)
 get called by the container when a property has changed

Static Protected Member Functions

static const App::PropertyDatagetPropertyDataPtr (void)

Detailed Description

Definition at line 39 of file SketchObject.h.


Constructor & Destructor Documentation

SketchObject::SketchObject (  ) 

Definition at line 51 of file SketchObject.cpp.

References ADD_PROPERTY_TYPE, and App::Prop_None.


Member Function Documentation

int SketchObject::addConstraint ( const Constraint constraint  ) 
int SketchObject::addConstraints ( const std::vector< Constraint * > &  ConstraintList  ) 

add all constraints in the list

Definition at line 291 of file SketchObject.cpp.

int SketchObject::addExternal ( App::DocumentObject Obj,
const char *  SubName 
)
int SketchObject::addGeometry ( const std::vector< Part::Geometry * > &  geoList  ) 

add unspecified geometry

Definition at line 225 of file SketchObject.cpp.

int SketchObject::addGeometry ( const Part::Geometry geo  ) 
void SketchObject::appendConflictMsg ( const std::vector< int > &  conflicting,
std::string &  msg 
) [static]

generates a warning message about constraint conflicts and appends it to the given message

Definition at line 1076 of file SketchObject.cpp.

Referenced by execute().

void * Sketcher::SketchObject::create ( void   )  [static]

Reimplemented from Part::Part2DObject.

Definition at line 48 of file SketchObject.cpp.

int SketchObject::delConstraint ( int  ConstrId  ) 
int SketchObject::delConstraintOnPoint ( int  VertexId,
bool  onlyCoincident = true 
)

Definition at line 320 of file SketchObject.cpp.

References delConstraintOnPoint(), and getGeoVertexIndex().

int SketchObject::delConstraintOnPoint ( int  GeoId,
PointPos  PosId,
bool  onlyCoincident = true 
)
int SketchObject::delExternal ( int  ConstrId  ) 

delete external

Definition at line 989 of file SketchObject.cpp.

int SketchObject::delGeometry ( int  GeoNbr  ) 
App::DocumentObjectExecReturn * SketchObject::execute ( void   )  [virtual]
int SketchObject::fillet ( int  geoId1,
int  geoId2,
const Base::Vector3d refPnt1,
const Base::Vector3d refPnt2,
double  radius,
bool  trim = true 
)
int SketchObject::fillet ( int  geoId,
PointPos  pos,
double  radius,
bool  trim = true 
)
Base::Type Sketcher::SketchObject::getClassTypeId ( void   )  [static]
void SketchObject::getCoincidentPoints ( int  VertexId,
std::vector< int > &  GeoIdList,
std::vector< PointPos > &  PosIdList 
)

Definition at line 1067 of file SketchObject.cpp.

References getCoincidentPoints(), and getGeoVertexIndex().

void SketchObject::getCoincidentPoints ( int  GeoId,
PointPos  PosId,
std::vector< int > &  GeoIdList,
std::vector< PointPos > &  PosIdList 
)

retrieves for a Vertex number a list with all coincident points

Definition at line 1039 of file SketchObject.cpp.

References Sketcher::Coincident, Constraints, and Sketcher::PropertyConstraintList::getValues().

Referenced by fillet(), getCoincidentPoints(), and DrawSketchHandlerFillet::releaseButton().

std::vector<Part::Geometry *> Sketcher::SketchObject::getExternalGeometry ( void   ) 

returns a list of projected external geoms

void SketchObject::getGeoVertexIndex ( int  VertexId,
int &  GeoId,
PointPos PosId 
)
int Sketcher::SketchObject::getHighestCurveIndex ( void   )  [inline]
int Sketcher::SketchObject::getHighestVertexIndex ( void   )  [inline]
unsigned int SketchObject::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?

Reimplemented from App::PropertyContainer.

Definition at line 1099 of file SketchObject.cpp.

Base::Vector3d SketchObject::getPoint ( int  geoIndex1,
PointPos  Pos1 
)
const App::PropertyData & Sketcher::SketchObject::getPropertyData ( void   )  const [protected, virtual]

Reimplemented from Part::Part2DObject.

Definition at line 48 of file SketchObject.cpp.

const App::PropertyData * Sketcher::SketchObject::getPropertyDataPtr ( void   )  [static, protected]

Reimplemented from Part::Part2DObject.

Definition at line 48 of file SketchObject.cpp.

PyObject * SketchObject::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 Part::Feature.

Definition at line 1090 of file SketchObject.cpp.

References Py::_None(), Py::Object::is(), Py::new_reference_to(), and App::DocumentObject::PythonObject.

Base::Type Sketcher::SketchObject::getTypeId ( void   )  const [virtual]

Reimplemented from Part::Part2DObject.

Definition at line 48 of file SketchObject.cpp.

const char* Sketcher::SketchObject::getViewProviderName ( void   )  const [inline, virtual]

returns the type name of the ViewProvider

Reimplemented from Part::Part2DObject.

Definition at line 56 of file SketchObject.h.

int SketchObject::hasConflicts ( void   )  const
void Sketcher::SketchObject::init ( void   )  [static]

Reimplemented from Part::Part2DObject.

Definition at line 48 of file SketchObject.cpp.

Referenced by initSketcher().

int SketchObject::movePoint ( int  geoIndex1,
PointPos  Pos1,
const Base::Vector3d toPoint,
bool  relative = false 
)
void SketchObject::onChanged ( const App::Property prop  )  [protected, virtual]

get called by the container when a property has changed

Reimplemented from Part::Feature.

Definition at line 1118 of file SketchObject.cpp.

References Sketcher::PropertyConstraintList::checkGeometry(), Constraints, Geometry, and Part::PropertyGeometryList::getValues().

void SketchObject::rebuildVertexIndex ( void   ) 
void SketchObject::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");
 }

Reimplemented from App::PropertyContainer.

Definition at line 1110 of file SketchObject.cpp.

References Sketcher::PropertyConstraintList::acceptGeometry(), Constraints, Geometry, Part::PropertyGeometryList::getValues(), and rebuildVertexIndex().

void SketchObject::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.

See also:
Base::Writer

Reimplemented from App::DocumentObject.

Definition at line 1104 of file SketchObject.cpp.

int SketchObject::setDatum ( int  ConstrId,
double  Datum 
)
int SketchObject::toggleConstruction ( int  GeoNbr  ) 
int SketchObject::transferConstraints ( int  fromGeoId,
PointPos  fromPosId,
int  toGeoId,
PointPos  toPosId 
)
int SketchObject::trim ( int  geoId,
const Base::Vector3d point 
)

Member Data Documentation

Definition at line 49 of file SketchObject.h.

Referenced by addExternal().

Part ::PropertyGeometryList Sketcher::SketchObject::Geometry

The documentation for this class was generated from the following files:

Generated on Wed Nov 23 19:02:47 2011 for FreeCAD by  doxygen 1.6.1