SoDatumLabel : introduce distance arc helpers.
This commit is contained in:
@@ -93,6 +93,9 @@ SoDatumLabel::SoDatumLabel()
|
||||
SO_NODE_ADD_FIELD(param2, (0.f));
|
||||
SO_NODE_ADD_FIELD(param4, (0.f));
|
||||
SO_NODE_ADD_FIELD(param5, (0.f));
|
||||
SO_NODE_ADD_FIELD(param6, (0.f));
|
||||
SO_NODE_ADD_FIELD(param7, (0.f));
|
||||
SO_NODE_ADD_FIELD(param8, (0.f));
|
||||
|
||||
useAntialiasing = true;
|
||||
|
||||
@@ -989,6 +992,43 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
|
||||
glVertex2f(ar3[0], ar3[1]);
|
||||
glVertex2f(ar4[0], ar4[1]);
|
||||
glEnd();
|
||||
|
||||
|
||||
if (this->datumtype.getValue() == DISTANCE) {
|
||||
// Draw arc helpers if needed
|
||||
float range1 = this->param4.getValue();
|
||||
if (range1 != 0.0) {
|
||||
float startangle1 = this->param3.getValue();
|
||||
float radius1 = this->param5.getValue();
|
||||
SbVec3f center = points[2];
|
||||
int countSegments = std::max(6, abs(int(50.0 * range1 / (2 * M_PI))));
|
||||
double segment = range1 / (countSegments - 1);
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
for (int i = 0; i < countSegments; i++) {
|
||||
double theta = startangle1 + segment * i;
|
||||
SbVec3f v1 = center + SbVec3f(radius1 * cos(theta), radius1 * sin(theta), 0);
|
||||
glVertex2f(v1[0], v1[1]);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
float range2 = this->param7.getValue();
|
||||
if (range2 != 0.0) {
|
||||
float startangle2 = this->param6.getValue();
|
||||
float radius2 = this->param8.getValue();
|
||||
SbVec3f center = points[3];
|
||||
int countSegments = std::max(6, abs(int(50.0 * range2 / (2 * M_PI))));
|
||||
double segment = range2 / (countSegments - 1);
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
for (int i = 0; i < countSegments; i++) {
|
||||
double theta = startangle2 + segment * i;
|
||||
SbVec3f v1 = center + SbVec3f(radius2 * cos(theta), radius2 * sin(theta), 0);
|
||||
glVertex2f(v1[0], v1[1]);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this->datumtype.getValue() == RADIUS || this->datumtype.getValue() == DIAMETER) {
|
||||
// Get the Points
|
||||
|
||||
@@ -77,6 +77,9 @@ public:
|
||||
SoSFFloat param3;
|
||||
SoSFFloat param4;
|
||||
SoSFFloat param5;
|
||||
SoSFFloat param6;
|
||||
SoSFFloat param7;
|
||||
SoSFFloat param8;
|
||||
SoMFVec3f pnts;
|
||||
SoSFVec3f norm;
|
||||
SoSFImage image;
|
||||
|
||||
Reference in New Issue
Block a user