OpenIndy-Core  0.2.0.43
slottedhole.h
Go to the documentation of this file.
1 #ifndef SLOTTEDHOLE_H
2 #define SLOTTEDHOLE_H
3 
4 #include <QObject>
5 #include <QtXml>
6 #include <QtMath>
7 
8 #include "geometry.h"
9 #include "position.h"
10 #include "radius.h"
11 #include "direction.h"
12 
13 namespace oi{
14 
20 {
21  Q_OBJECT
22 
23 public:
24  SlottedHole(const bool &isNominal, QObject *parent = 0);
25  SlottedHole(const bool &isNominal, const Position &center, const Direction &normal,
26  const Radius &radius, const double &length, const Direction &holeAxis, QObject *parent = 0);
27  SlottedHole(const bool &isNominal, const Position &circleCenterA, const Position &circleCenterB,
28  const Direction &normal, const Radius &radius, QObject *parent = 0);
29 
30  SlottedHole(const SlottedHole &copy, QObject *parent = 0);
31 
32  SlottedHole &operator=(const SlottedHole &copy);
33 
34  ~SlottedHole();
35 
36  //########################################
37  //order of unknown parameters (Qxx-matrix)
38  //########################################
39 
41  unknownCenterX = 0,
51  unknownHoleAxisK
52  };
53 
54  //###################################################################
55  //check wether this geometry has a direction, a position and a radius
56  //###################################################################
57 
58  bool hasDirection() const;
59  bool hasPosition() const;
60  bool hasRadius() const;
61 
62  //##################################
63  //get or set slotted hole parameters
64  //##################################
65 
66  const Radius &getRadius() const;
67  const Direction &getDirection() const;
68  const Position &getPosition() const;
69 
70  const Position &getCircleCenterA() const;
71  const Position &getCircleCenterB() const;
72  const Direction &getHoleAxis() const;
73  const double &getLength() const;
74 
75  void setSlottedHole(const Position &center, const Direction &normal, const Radius &radius, const double &length, const Direction &holeAxis);
76  void setSlottedHole(const Position &circleCenterA, const Position &circleCenterB, const Direction &normal, const Radius &radius);
77 
78  //#############################
79  //get or set unknown parameters
80  //#############################
81 
82  virtual QMap<GeometryParameters, QString> getUnknownParameters(const QMap<DimensionType, UnitType> &displayUnits,
83  const QMap<DimensionType, int> &displayDigits) const;
84  virtual void setUnknownParameters(const QMap<GeometryParameters, double> &parameters);
85 
86  //###########################
87  //reexecute the function list
88  //###########################
89 
90  void recalc();
91 
92  //#################
93  //save and load XML
94  //#################
95 
96  QDomElement toOpenIndyXML(QDomDocument &xmlDoc) const;
97  bool fromOpenIndyXML(QDomElement &xmlElem);
98 
99  //###############
100  //display methods
101  //###############
102 
103  QString getDisplayX(const UnitType &type, const int &digits, const bool &showDiff = false) const;
104  QString getDisplayY(const UnitType &type, const int &digits, const bool &showDiff = false) const;
105  QString getDisplayZ(const UnitType &type, const int &digits, const bool &showDiff = false) const;
106  QString getDisplayPrimaryI(const int &digits, const bool &showDiff = false) const;
107  QString getDisplayPrimaryJ(const int &digits, const bool &showDiff = false) const;
108  QString getDisplayPrimaryK(const int &digits, const bool &showDiff = false) const;
109  QString getDisplayRadiusA(const UnitType &type, const int &digits, const bool &showDiff = false) const;
110  QString getDisplaySecondaryI(const int &digits, const bool &showDiff = false) const;
111  QString getDisplaySecondaryJ(const int &digits, const bool &showDiff = false) const;
112  QString getDisplaySecondaryK(const int &digits, const bool &showDiff = false) const;
113  QString getDisplayLength(const UnitType &type, const int &digits, const bool &showDiff = false) const;
114 
115 private:
116 
117  //#######################
118  //slotted hole attributes
119  //#######################
120 
121  Position center; //center of the slotted hole
122  Direction normal; //normal vector
123  Radius radius; //radius of the outer circles
124  double length; //length of the slotted hole (= distance of the circle centers + 2 * radius)
125  Direction holeAxis; //vector pointing from one circle center to the other)
126 
127  Position circleCenterA; //center of one circle
128  Position circleCenterB; //center of the other circle
129 
130 };
131 
132 }
133 
134 #endif // SLOTTEDHOLE_H
Definition: slottedhole.h:48
Definition: slottedhole.h:47
The Position class.
Definition: position.h:16
Definition: slottedhole.h:44
Definition: coordinatesystem.h:15
Definition: slottedhole.h:50
The SlottedHole class Defines an elongated bore with one radius.
Definition: slottedhole.h:19
SlottedHoleUnknowns
Definition: slottedhole.h:40
The Radius class.
Definition: radius.h:13
The Geometry class.
Definition: geometry.h:26
Definition: slottedhole.h:45
Definition: slottedhole.h:49
Definition: slottedhole.h:46
UnitType
Definition: types.h:354
Definition: direction.h:13
#define OI_CORE_EXPORT
Definition: types.h:11
Definition: slottedhole.h:42
Definition: slottedhole.h:43