PVS: V688 A local variable possesses the same name as one of the class members, which can result in a confusion

This commit is contained in:
wmayer
2019-03-13 11:58:43 +01:00
parent ac92e1e98d
commit ba96c0773a
8 changed files with 156 additions and 163 deletions

View File

@@ -42,10 +42,6 @@ public:
//virtual void onChanged(const App::Property*); //no further property for viewProvider
protected:
virtual bool setEdit(int ModNum);
private:
/// Direction of the force
Base::Vector3f forceDirection;
};
} //namespace FemGui

View File

@@ -280,7 +280,7 @@ void ImportOCAF::loadShapes(const TDF_Label& label, const TopLoc_Location& loc,
}
void ImportOCAF::createShape(const TDF_Label& label, const TopLoc_Location& loc, const std::string& name,
std::vector<App::DocumentObject*>& lValue, bool merge)
std::vector<App::DocumentObject*>& lValue, bool mergeShape)
{
const TopoDS_Shape& aShape = aShapeTool->GetShape(label);
#ifdef HAVE_TBB
@@ -294,7 +294,7 @@ void ImportOCAF::createShape(const TDF_Label& label, const TopLoc_Location& loc,
std::vector<App::DocumentObject *> localValue;
App::Part *pcPart = NULL;
if (merge) {
if (mergeShape) {
// We should do that only if there is more than a single shape inside
// Computing Compounds takes time
@@ -387,7 +387,7 @@ void ImportOCAF::createShape(const TDF_Label& label, const TopLoc_Location& loc,
}
}
if (!localValue.empty() && !merge) {
if (!localValue.empty() && !mergeShape) {
pcPart = static_cast<App::Part*>(doc->addObject("App::Part",name.c_str()));
pcPart->Label.setValue(name);

View File

@@ -198,20 +198,20 @@ SoSeparator* ViewProvider2DObject::createGrid(void)
// set the grid coordinates
vts->vertex.setNum(2*lines);
SbVec3f* coords = vts->vertex.startEditing();
SbVec3f* vertex_coords = vts->vertex.startEditing();
// vertical lines
int i_offset_x = static_cast<int>(MiX / Step);
for (int i=0; i<vlines; i++) {
coords[2*i].setValue((i+i_offset_x)*Step, MiY, zGrid);
coords[2*i+1].setValue((i+i_offset_x)*Step, MaY, zGrid);
vertex_coords[2*i].setValue((i+i_offset_x)*Step, MiY, zGrid);
vertex_coords[2*i+1].setValue((i+i_offset_x)*Step, MaY, zGrid);
}
// horizontal lines
int i_offset_y = static_cast<int>(MiY / Step);
for (int i=vlines; i<lines; i++) {
coords[2*i].setValue(MiX, (i-vlines+i_offset_y)*Step, zGrid);
coords[2*i+1].setValue(MaX, (i-vlines+i_offset_y)*Step, zGrid);
vertex_coords[2*i].setValue(MiX, (i-vlines+i_offset_y)*Step, zGrid);
vertex_coords[2*i+1].setValue(MaX, (i-vlines+i_offset_y)*Step, zGrid);
}
vts->vertex.finishEditing();

View File

@@ -196,27 +196,27 @@ void ViewProviderSpline::showControlPointsOfEdge(const TopoDS_Edge& edge)
if (poles.empty())
return; // nothing to do
SoCoordinate3 * coords = new SoCoordinate3;
coords->point.setNum(nCt + knots.size());
SoCoordinate3 * controlcoords = new SoCoordinate3;
controlcoords->point.setNum(nCt + knots.size());
int index=0;
SbVec3f* verts = coords->point.startEditing();
SbVec3f* verts = controlcoords->point.startEditing();
for (std::list<gp_Pnt>::iterator p = poles.begin(); p != poles.end(); ++p) {
verts[index++].setValue((float)p->X(), (float)p->Y(), (float)p->Z());
}
for (std::list<gp_Pnt>::iterator k = knots.begin(); k != knots.end(); ++k) {
verts[index++].setValue((float)k->X(), (float)k->Y(), (float)k->Z());
}
coords->point.finishEditing();
controlcoords->point.finishEditing();
SoFCControlPoints* control = new SoFCControlPoints();
control->numPolesU = nCt;
control->numPolesV = 1;
SoFCControlPoints* controlpoints = new SoFCControlPoints();
controlpoints->numPolesU = nCt;
controlpoints->numPolesV = 1;
SoSeparator* nodes = new SoSeparator();
nodes->addChild(coords);
nodes->addChild(control);
nodes->addChild(controlcoords);
nodes->addChild(controlpoints);
pcControlPoints->addChild(nodes);
}

View File

@@ -143,10 +143,10 @@ bool ReferenceSelection::allow(App::Document* pDoc, App::DocumentObject* pObj, c
if (edge && subName.size() > 4 && subName.substr(0,4) == "Edge") {
const Part::TopoShape &shape = static_cast<const Part::Feature*>(pObj)->Shape.getValue();
TopoDS_Shape sh = shape.getSubShape(subName.c_str());
const TopoDS_Edge& edge = TopoDS::Edge(sh);
if (!edge.IsNull()) {
const TopoDS_Edge& edgeShape = TopoDS::Edge(sh);
if (!edgeShape.IsNull()) {
if (planar) {
BRepAdaptor_Curve adapt(edge);
BRepAdaptor_Curve adapt(edgeShape);
if (adapt.GetType() == GeomAbs_Line)
return true;
} else {

View File

@@ -3258,10 +3258,10 @@ public:
double ry0 = onSketchPos.y - EditCurve[0].y;
for (int i=0; i < 16; i++) {
double angle = i*M_PI/16.0;
double rx = rx0 * cos(angle) + ry0 * sin(angle);
double ry = -rx0 * sin(angle) + ry0 * cos(angle);
EditCurve[1+i] = Base::Vector2d(EditCurve[0].x + rx, EditCurve[0].y + ry);
EditCurve[17+i] = Base::Vector2d(EditCurve[0].x - rx, EditCurve[0].y - ry);
double rx1 = rx0 * cos(angle) + ry0 * sin(angle);
double ry1 = -rx0 * sin(angle) + ry0 * cos(angle);
EditCurve[1+i] = Base::Vector2d(EditCurve[0].x + rx1, EditCurve[0].y + ry1);
EditCurve[17+i] = Base::Vector2d(EditCurve[0].x - rx1, EditCurve[0].y - ry1);
}
EditCurve[33] = EditCurve[1];
@@ -3290,10 +3290,10 @@ public:
for (int i=1; i < 16; i++) {
double angle = i*M_PI/16.0;
double rx = a * cos(angle) * cos(phi) - b * sin(angle) * sin(phi);
double ry = a * cos(angle) * sin(phi) + b * sin(angle) * cos(phi);
EditCurve[1+i] = Base::Vector2d(EditCurve[0].x + rx, EditCurve[0].y + ry);
EditCurve[17+i] = Base::Vector2d(EditCurve[0].x - rx, EditCurve[0].y - ry);
double rx1 = a * cos(angle) * cos(phi) - b * sin(angle) * sin(phi);
double ry1 = a * cos(angle) * sin(phi) + b * sin(angle) * cos(phi);
EditCurve[1+i] = Base::Vector2d(EditCurve[0].x + rx1, EditCurve[0].y + ry1);
EditCurve[17+i] = Base::Vector2d(EditCurve[0].x - rx1, EditCurve[0].y - ry1);
}
EditCurve[33] = EditCurve[1];
EditCurve[17] = EditCurve[16];
@@ -3330,9 +3330,9 @@ public:
for (int i=0; i < 34; i++) {
double angle = startAngle+i*arcAngle/34.0;
double rx = a * cos(angle) * cos(phi) - b * sin(angle) * sin(phi);
double ry = a * cos(angle) * sin(phi) + b * sin(angle) * cos(phi);
EditCurve[i] = Base::Vector2d(centerPoint.x + rx, centerPoint.y + ry);
double rx1 = a * cos(angle) * cos(phi) - b * sin(angle) * sin(phi);
double ry1 = a * cos(angle) * sin(phi) + b * sin(angle) * cos(phi);
EditCurve[i] = Base::Vector2d(centerPoint.x + rx1, centerPoint.y + ry1);
}
// EditCurve[33] = EditCurve[1];
// EditCurve[17] = EditCurve[16];
@@ -4075,18 +4075,18 @@ public:
double ustartpoint =
( cos(phi) * (startingPoint.y - axisPoint.y) - (startingPoint.x - axisPoint.x) * sin(phi));
double startAngle = ustartpoint;
double startValue = ustartpoint;
double u =
( cos(phi) * (onSketchPos.y - axisPoint.y) - (onSketchPos.x - axisPoint.x) * sin(phi));
arcAngle = u - startAngle;
arcAngle = u - startValue;
if (!boost::math::isnan(arcAngle)) {
EditCurve.resize(33);
for (std::size_t i=0; i < 33; i++) {
double angle = startAngle+i*arcAngle/32.0;
double angle = startValue+i*arcAngle/32.0;
double rx = angle * angle / 4 / focal * cos(phi) - angle * sin(phi);
double ry = angle * angle / 4 / focal * sin(phi) + angle * cos(phi);
EditCurve[i] = Base::Vector2d(axisPoint.x + rx, axisPoint.y + ry);

View File

@@ -161,16 +161,16 @@ void SoDatumLabel::generatePrimitives(SoAction * action)
return;
// Get the points stored
const SbVec3f *pnts = this->pnts.getValues(0);
SbVec3f p1 = pnts[0];
SbVec3f p2 = pnts[1];
const SbVec3f *points = this->pnts.getValues(0);
SbVec3f p1 = points[0];
SbVec3f p2 = points[1];
// Change the offset and bounding box parameters depending on Datum Type
if(this->datumtype.getValue() == DISTANCE || this->datumtype.getValue() == DISTANCEX || this->datumtype.getValue() == DISTANCEY ){
float length = this->param1.getValue();
float length2 = this->param2.getValue();
SbVec3f dir, norm;
SbVec3f dir, normal;
if (this->datumtype.getValue() == DISTANCE) {
dir = (p2-p1);
} else if (this->datumtype.getValue() == DISTANCEX) {
@@ -180,10 +180,10 @@ void SoDatumLabel::generatePrimitives(SoAction * action)
}
dir.normalize();
norm = SbVec3f (-dir[1],dir[0],0);
normal = SbVec3f (-dir[1],dir[0],0);
float normproj12 = (p2-p1).dot(norm);
SbVec3f p1_ = p1 + normproj12 * norm;
float normproj12 = (p2-p1).dot(normal);
SbVec3f p1_ = p1 + normproj12 * normal;
SbVec3f midpos = (p1_ + p2)/2;
// Get magnitude of angle between horizontal
@@ -203,7 +203,7 @@ void SoDatumLabel::generatePrimitives(SoAction * action)
img3 = SbVec3f((img3[0] * c) - (img3[1] * s), (img3[0] * s) + (img3[1] * c), 0.f);
img4 = SbVec3f((img4[0] * c) - (img4[1] * s), (img4[0] * s) + (img4[1] * c), 0.f);
SbVec3f textOffset = midpos + norm * length + dir * length2;
SbVec3f textOffset = midpos + normal * length + dir * length2;
img1 += textOffset;
img2 += textOffset;
@@ -236,7 +236,6 @@ void SoDatumLabel::generatePrimitives(SoAction * action)
SbVec3f dir = (p2-p1);
dir.normalize();
SbVec3f norm (-dir[1],dir[0],0);
float length = this->param1.getValue();
SbVec3f pos = p2 + length*dir;
@@ -288,7 +287,7 @@ void SoDatumLabel::generatePrimitives(SoAction * action)
} else if (this->datumtype.getValue() == ANGLE) {
// Only the angle intersection point is needed
SbVec3f p0 = pnts[0];
SbVec3f p0 = points[0];
// Load the Parameters
float length = this->param1.getValue();
@@ -346,7 +345,7 @@ void SoDatumLabel::generatePrimitives(SoAction * action)
SbVec3f dir = (p2-p1);
dir.normalize();
SbVec3f norm (-dir[1],dir[0],0);
SbVec3f normal (-dir[1],dir[0],0);
float margin = this->imgHeight / 4.0;
@@ -354,16 +353,16 @@ void SoDatumLabel::generatePrimitives(SoAction * action)
SbVec3f ar0, ar1, ar2;
ar0 = p1 + dir * 5 * margin ;
ar1 = ar0 - dir * 0.866f * 2 * margin; // Base Point of Arrow
ar2 = ar1 + norm * margin; // Triangular corners
ar1 -= norm * margin;
ar2 = ar1 + normal * margin; // Triangular corners
ar1 -= normal * margin;
// Calculate coordinates for the second arrow
SbVec3f ar3, ar4, ar5;
ar3 = p2 - dir * 5 * margin ;
ar4 = ar3 + dir * 0.866f * 2 * margin; // Base Point of 2nd Arrow
ar5 = ar4 + norm * margin; // Triangular corners
ar4 -= norm * margin;
ar5 = ar4 + normal * margin; // Triangular corners
ar4 -= normal * margin;
SoPrimitiveVertex pv;
@@ -393,7 +392,6 @@ void SoDatumLabel::generatePrimitives(SoAction * action)
this->endShape();
}
}
void SoDatumLabel::notify(SoNotList * l)
@@ -447,7 +445,7 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
const SbString* s = string.getValues(0);
bool hasText = (s->getLength() > 0) ? true : false;
SbVec2s size;
SbVec2s imgsize;
int nc;
int srcw=1, srch=1;
@@ -457,11 +455,11 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
this->glimagevalid = true;
}
const unsigned char * dataptr = this->image.getValue(size, nc);
const unsigned char * dataptr = this->image.getValue(imgsize, nc);
if (dataptr == NULL) return; // no image
srcw = size[0];
srch = size[1];
srcw = imgsize[0];
srch = imgsize[1];
float aspectRatio = (float) srcw / (float) srch;
this->imgHeight = scale * (float) (srch);
@@ -478,7 +476,7 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
}
// Get the points stored in the pnt field
const SbVec3f *pnts = this->pnts.getValues(0);
const SbVec3f *points = this->pnts.getValues(0);
state->push();
@@ -506,16 +504,16 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
glLineWidth(2.f);
glColor3f(t[0], t[1], t[2]);
if(this->datumtype.getValue() == DISTANCE || this->datumtype.getValue() == DISTANCEX || this->datumtype.getValue() == DISTANCEY )
{
if (this->datumtype.getValue() == DISTANCE ||
this->datumtype.getValue() == DISTANCEX ||
this->datumtype.getValue() == DISTANCEY ) {
float length = this->param1.getValue();
float length2 = this->param2.getValue();
const SbVec3f *pnts = this->pnts.getValues(0);
SbVec3f p1 = pnts[0];
SbVec3f p2 = pnts[1];
SbVec3f p1 = points[0];
SbVec3f p2 = points[1];
SbVec3f dir, norm;
SbVec3f dir, normal;
if (this->datumtype.getValue() == DISTANCE) {
dir = (p2-p1);
} else if (this->datumtype.getValue() == DISTANCEX) {
@@ -525,13 +523,13 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
}
dir.normalize();
norm = SbVec3f (-dir[1],dir[0],0);
normal = SbVec3f (-dir[1],dir[0],0);
// when the datum line is not parallel to p1-p2 the projection of
// p1-p2 on norm is not zero, p2 is considered as reference and p1
// p1-p2 on normal is not zero, p2 is considered as reference and p1
// is replaced by its projection p1_
float normproj12 = (p2-p1).dot(norm);
SbVec3f p1_ = p1 + normproj12 * norm;
float normproj12 = (p2-p1).dot(normal);
SbVec3f p1_ = p1 + normproj12 * normal;
SbVec3f midpos = (p1_ + p2)/2;
@@ -546,7 +544,7 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
angle += (float)M_PI;
}
textOffset = midpos + norm * length + dir * length2;
textOffset = midpos + normal * length + dir * length2;
// Get the colour
const SbColor& t = textColor.getValue();
@@ -557,14 +555,14 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
float margin = this->imgHeight / 4.0;
SbVec3f perp1 = p1_ + norm * (length + offset1 * scale);
SbVec3f perp2 = p2 + norm * (length + offset2 * scale);
SbVec3f perp1 = p1_ + normal * (length + offset1 * scale);
SbVec3f perp2 = p2 + normal * (length + offset2 * scale);
// Calculate the coordinates for the parallel datum lines
SbVec3f par1 = p1_ + norm * length;
SbVec3f par2 = midpos + norm * length + dir * (length2 - this->imgWidth / 2 - margin);
SbVec3f par3 = midpos + norm * length + dir * (length2 + this->imgWidth / 2 + margin);
SbVec3f par4 = p2 + norm * length;
SbVec3f par1 = p1_ + normal * length;
SbVec3f par2 = midpos + normal * length + dir * (length2 - this->imgWidth / 2 - margin);
SbVec3f par3 = midpos + normal * length + dir * (length2 + this->imgWidth / 2 + margin);
SbVec3f par4 = p2 + normal * length;
bool flipTriang = false;
@@ -602,12 +600,12 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
glEnd();
SbVec3f ar1 = par1 + ((flipTriang) ? -1 : 1) * dir * 0.866f * 2 * margin;
SbVec3f ar2 = ar1 + norm * margin;
ar1 -= norm * margin;
SbVec3f ar2 = ar1 + normal * margin;
ar1 -= normal * margin;
SbVec3f ar3 = par4 - ((flipTriang) ? -1 : 1) * dir * 0.866f * 2 * margin;
SbVec3f ar4 = ar3 + norm * margin ;
ar3 -= norm * margin;
SbVec3f ar4 = ar3 + normal * margin ;
ar3 -= normal * margin;
//Draw a pretty arrowhead (Equilateral) (Eventually could be improved to other shapes?)
glBegin(GL_TRIANGLES);
@@ -629,10 +627,10 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
corners.push_back(perp2);
// Make sure that the label is inside the bounding box
corners.push_back(textOffset + dir * (this->imgWidth / 2 + margin) + norm * (srch + margin));
corners.push_back(textOffset - dir * (this->imgWidth / 2 + margin) + norm * (srch + margin));
corners.push_back(textOffset + dir * (this->imgWidth / 2 + margin) - norm * margin);
corners.push_back(textOffset - dir * (this->imgWidth / 2 + margin) - norm * margin);
corners.push_back(textOffset + dir * (this->imgWidth / 2 + margin) + normal * (srch + margin));
corners.push_back(textOffset - dir * (this->imgWidth / 2 + margin) + normal * (srch + margin));
corners.push_back(textOffset + dir * (this->imgWidth / 2 + margin) - normal * margin);
corners.push_back(textOffset - dir * (this->imgWidth / 2 + margin) - normal * margin);
float minX = p1[0], minY = p1[1], maxX = p1[0] , maxY = p1[1];
for (std::vector<SbVec3f>::const_iterator it=corners.begin(); it != corners.end(); ++it) {
@@ -643,15 +641,15 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
}
//Store the bounding box
this->bbox.setBounds(SbVec3f(minX, minY, 0.f), SbVec3f (maxX, maxY, 0.f));
} else if (this->datumtype.getValue() == RADIUS || this->datumtype.getValue() == DIAMETER) {
}
else if (this->datumtype.getValue() == RADIUS || this->datumtype.getValue() == DIAMETER) {
// Get the Points
SbVec3f p1 = pnts[0];
SbVec3f p2 = pnts[1];
SbVec3f p1 = points[0];
SbVec3f p2 = points[1];
SbVec3f dir = (p2-p1);
dir.normalize();
SbVec3f norm (-dir[1],dir[0],0);
SbVec3f normal (-dir[1],dir[0],0);
float length = this->param1.getValue();
SbVec3f pos = p2 + length*dir;
@@ -671,8 +669,8 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
// Create the arrowhead
SbVec3f ar0 = p2;
SbVec3f ar1 = p2 - dir * 0.866f * 2 * margin;
SbVec3f ar2 = ar1 + norm * margin;
ar1 -= norm * margin;
SbVec3f ar2 = ar1 + normal * margin;
ar1 -= normal * margin;
SbVec3f p3 = pos + dir * (this->imgWidth / 2 + margin);
if ((p3-p1).length() > (p2-p1).length())
@@ -701,8 +699,8 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
// create second arrowhead
SbVec3f ar0_1 = p1;
SbVec3f ar1_1 = p1 + dir * 0.866f * 2 * margin;
SbVec3f ar2_1 = ar1_1 + norm * margin;
ar1_1 -= norm * margin;
SbVec3f ar2_1 = ar1_1 + normal * margin;
ar1_1 -= normal * margin;
glBegin(GL_TRIANGLES);
glVertex2f(ar0_1[0], ar0_1[1]);
@@ -731,7 +729,7 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
this->bbox.setBounds(SbVec3f(minX, minY, 0.f), SbVec3f (maxX, maxY, 0.f));
} else if (this->datumtype.getValue() == ANGLE) {
// Only the angle intersection point is needed
SbVec3f p0 = pnts[0];
SbVec3f p0 = points[0];
// Load the Parameters
float length = this->param1.getValue();
@@ -836,12 +834,12 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
this->bbox.setBounds(SbVec3f(minX, minY, 0.f), SbVec3f (maxX, maxY, 0.f));
} else if (this->datumtype.getValue() == SYMMETRIC) {
SbVec3f p1 = pnts[0];
SbVec3f p2 = pnts[1];
SbVec3f p1 = points[0];
SbVec3f p2 = points[1];
SbVec3f dir = (p2-p1);
dir.normalize();
SbVec3f norm (-dir[1],dir[0],0);
SbVec3f normal (-dir[1],dir[0],0);
float margin = this->imgHeight / 4.0;
@@ -849,8 +847,8 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
SbVec3f ar0, ar1, ar2;
ar0 = p1 + dir * 4 * margin; // Tip of Arrow
ar1 = ar0 - dir * 0.866f * 2 * margin;
ar2 = ar1 + norm * margin;
ar1 -= norm * margin;
ar2 = ar1 + normal * margin;
ar1 -= normal * margin;
glBegin(GL_LINES);
glVertex3f(p1[0], p1[1], ZCONSTR);
@@ -865,8 +863,8 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
SbVec3f ar3, ar4, ar5;
ar3 = p2 - dir * 4 * margin; // Tip of 2nd Arrow
ar4 = ar3 + dir * 0.866f * 2 * margin;
ar5 = ar4 + norm * margin;
ar4 -= norm * margin;
ar5 = ar4 + normal * margin;
ar4 -= normal * margin;
glBegin(GL_LINES);
glVertex3f(p2[0], p2[1], ZCONSTR);
@@ -895,7 +893,7 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
}
if (hasText) {
const unsigned char * dataptr = this->image.getValue(size, nc);
const unsigned char * dataptr = this->image.getValue(imgsize, nc);
//Get the camera z-direction
SbVec3f z = vv.zVector();
@@ -953,11 +951,11 @@ void SoDatumLabel::GLRender(SoGLRenderAction * action)
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
if (!npot) {
QImage image(w, h,QImage::Format_ARGB32_Premultiplied);
image.fill(0x00000000);
QImage imagedata(w, h,QImage::Format_ARGB32_Premultiplied);
imagedata.fill(0x00000000);
int sx = (w - srcw)/2;
int sy = (h - srch)/2;
glTexImage2D(GL_TEXTURE_2D, 0, nc, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const GLvoid*)image.bits());
glTexImage2D(GL_TEXTURE_2D, 0, nc, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const GLvoid*)imagedata.bits());
glTexSubImage2D(GL_TEXTURE_2D, 0, sx, sy, srcw, srch, GL_RGBA, GL_UNSIGNED_BYTE,(const GLvoid*) dataptr);
}
else {

View File

@@ -1315,8 +1315,8 @@ void ViewProviderSketch::moveConstraint(int constNum, const Base::Vector2d &toPo
Constr->LabelDistance = vec.x * dir.x + vec.y * dir.y;
Constr->LabelPosition = atan2(dir.y, dir.x);
} else {
Base::Vector3d norm(-dir.y,dir.x,0);
Constr->LabelDistance = vec.x * norm.x + vec.y * norm.y;
Base::Vector3d normal(-dir.y,dir.x,0);
Constr->LabelDistance = vec.x * normal.x + vec.y * normal.y;
if (Constr->Type == Distance ||
Constr->Type == DistanceX || Constr->Type == DistanceY) {
vec = Base::Vector3d(toPos.x, toPos.y, 0) - (p2 + p1) / 2;
@@ -3904,18 +3904,18 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
mat->ref();
mat->diffuseColor = InformationColor;
SoLineSet *lineset = new SoLineSet;
SoLineSet *polygon = new SoLineSet;
SoCoordinate3 *coords = new SoCoordinate3;
SoCoordinate3 *polygoncoords = new SoCoordinate3;
if(spline->isPeriodic()) {
coords->point.setNum(poles.size()+1);
polygoncoords->point.setNum(poles.size()+1);
}
else {
coords->point.setNum(poles.size());
polygoncoords->point.setNum(poles.size());
}
SbVec3f *vts = coords->point.startEditing();
SbVec3f *vts = polygoncoords->point.startEditing();
int i=0;
for (std::vector<Base::Vector3d>::iterator it = poles.begin(); it != poles.end(); ++it, i++) {
@@ -3926,11 +3926,11 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
vts[poles.size()].setValue(poles[0].x,poles[0].y,zInfo);
}
coords->point.finishEditing();
polygoncoords->point.finishEditing();
sep->addChild(mat);
sep->addChild(coords);
sep->addChild(lineset);
sep->addChild(polygoncoords);
sep->addChild(polygon);
sw->addChild(sep);
@@ -3946,16 +3946,16 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
SoSeparator *sep = static_cast<SoSeparator *>(sw->getChild(0));
SoCoordinate3 *coords = static_cast<SoCoordinate3 *>(sep->getChild(GEOINFO_BSPLINE_POLYGON));
SoCoordinate3 *polygoncoords = static_cast<SoCoordinate3 *>(sep->getChild(GEOINFO_BSPLINE_POLYGON));
if(spline->isPeriodic()) {
coords->point.setNum(poles.size()+1);
polygoncoords->point.setNum(poles.size()+1);
}
else {
coords->point.setNum(poles.size());
polygoncoords->point.setNum(poles.size());
}
SbVec3f *vts = coords->point.startEditing();
SbVec3f *vts = polygoncoords->point.startEditing();
int i=0;
for (std::vector<Base::Vector3d>::iterator it = poles.begin(); it != poles.end(); ++it, i++) {
@@ -3966,7 +3966,7 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
vts[poles.size()].setValue(poles[0].x,poles[0].y,zInfo);
}
coords->point.finishEditing();
polygoncoords->point.finishEditing();
}
currentInfoNode++; // switch to next node
@@ -4023,15 +4023,15 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
mat->ref();
mat->diffuseColor = InformationColor;
SoLineSet *lineset = new SoLineSet;
SoLineSet *comblineset = new SoLineSet;
SoCoordinate3 *coords = new SoCoordinate3;
SoCoordinate3 *combcoords = new SoCoordinate3;
coords->point.setNum(3*ndiv); // 2*ndiv +1 points of ndiv separate segments + ndiv points for last segment
lineset->numVertices.setNum(ndiv+1); // ndiv separate segments of radials + 1 segment connecting at comb end
combcoords->point.setNum(3*ndiv); // 2*ndiv +1 points of ndiv separate segments + ndiv points for last segment
comblineset->numVertices.setNum(ndiv+1); // ndiv separate segments of radials + 1 segment connecting at comb end
int32_t *index = lineset->numVertices.startEditing();
SbVec3f *vts = coords->point.startEditing();
int32_t *index = comblineset->numVertices.startEditing();
SbVec3f *vts = combcoords->point.startEditing();
for(int i = 0; i < ndiv; i++) {
vts[2*i].setValue(pointatcurvelist[i].x, pointatcurvelist[i].y, zInfo); // radials
@@ -4043,12 +4043,12 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
index[ndiv] = ndiv; // comb endpoint closing segment
coords->point.finishEditing();
lineset->numVertices.finishEditing();
combcoords->point.finishEditing();
comblineset->numVertices.finishEditing();
sep->addChild(mat);
sep->addChild(coords);
sep->addChild(lineset);
sep->addChild(combcoords);
sep->addChild(comblineset);
sw->addChild(sep);
@@ -4064,15 +4064,15 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
SoSeparator *sep = static_cast<SoSeparator *>(sw->getChild(0));
SoCoordinate3 *coords = static_cast<SoCoordinate3 *>(sep->getChild(GEOINFO_BSPLINE_POLYGON));
SoCoordinate3 *combcoords = static_cast<SoCoordinate3 *>(sep->getChild(GEOINFO_BSPLINE_POLYGON));
SoLineSet *lineset = static_cast<SoLineSet *>(sep->getChild(GEOINFO_BSPLINE_POLYGON+1));
SoLineSet *comblineset = static_cast<SoLineSet *>(sep->getChild(GEOINFO_BSPLINE_POLYGON+1));
coords->point.setNum(3*ndiv); // 2*ndiv +1 points of ndiv separate segments + ndiv points for last segment
lineset->numVertices.setNum(ndiv+1); // ndiv separate segments of radials + 1 segment connecting at comb end
combcoords->point.setNum(3*ndiv); // 2*ndiv +1 points of ndiv separate segments + ndiv points for last segment
comblineset->numVertices.setNum(ndiv+1); // ndiv separate segments of radials + 1 segment connecting at comb end
int32_t *index = lineset->numVertices.startEditing();
SbVec3f *vts = coords->point.startEditing();
int32_t *index = comblineset->numVertices.startEditing();
SbVec3f *vts = combcoords->point.startEditing();
for(int i = 0; i < ndiv; i++) {
vts[2*i].setValue(pointatcurvelist[i].x, pointatcurvelist[i].y, zInfo); // radials
@@ -4084,8 +4084,8 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
index[ndiv] = ndiv; // comb endpoint closing segment
coords->point.finishEditing();
lineset->numVertices.finishEditing();
combcoords->point.finishEditing();
comblineset->numVertices.finishEditing();
}
@@ -5827,10 +5827,10 @@ void ViewProviderSketch::createEditInventorNodes(void)
edit->PointsCoordinate->setName("PointsCoordinate");
pointsRoot->addChild(edit->PointsCoordinate);
SoDrawStyle *DrawStyle = new SoDrawStyle;
DrawStyle->setName("PointsDrawStyle");
DrawStyle->pointSize = 8;
pointsRoot->addChild(DrawStyle);
SoDrawStyle *drawStyle = new SoDrawStyle;
drawStyle->setName("PointsDrawStyle");
drawStyle->pointSize = 8;
pointsRoot->addChild(drawStyle);
edit->PointSet = new SoMarkerSet;
edit->PointSet->setName("PointSet");
@@ -5853,10 +5853,10 @@ void ViewProviderSketch::createEditInventorNodes(void)
edit->CurvesCoordinate->setName("CurvesCoordinate");
curvesRoot->addChild(edit->CurvesCoordinate);
DrawStyle = new SoDrawStyle;
DrawStyle->setName("CurvesDrawStyle");
DrawStyle->lineWidth = 3;
curvesRoot->addChild(DrawStyle);
drawStyle = new SoDrawStyle;
drawStyle->setName("CurvesDrawStyle");
drawStyle->lineWidth = 3;
curvesRoot->addChild(drawStyle);
edit->CurveSet = new SoLineSet;
edit->CurveSet->setName("CurvesLineSet");
@@ -5873,10 +5873,10 @@ void ViewProviderSketch::createEditInventorNodes(void)
MtlBind->value = SoMaterialBinding::PER_FACE;
crossRoot->addChild(MtlBind);
DrawStyle = new SoDrawStyle;
DrawStyle->setName("RootCrossDrawStyle");
DrawStyle->lineWidth = 2;
crossRoot->addChild(DrawStyle);
drawStyle = new SoDrawStyle;
drawStyle->setName("RootCrossDrawStyle");
drawStyle->lineWidth = 2;
crossRoot->addChild(drawStyle);
edit->RootCrossMaterials = new SoMaterial;
edit->RootCrossMaterials->setName("RootCrossMaterials");
@@ -5903,10 +5903,10 @@ void ViewProviderSketch::createEditInventorNodes(void)
edit->EditCurvesCoordinate->setName("EditCurvesCoordinate");
editCurvesRoot->addChild(edit->EditCurvesCoordinate);
DrawStyle = new SoDrawStyle;
DrawStyle->setName("EditCurvesDrawStyle");
DrawStyle->lineWidth = 3;
editCurvesRoot->addChild(DrawStyle);
drawStyle = new SoDrawStyle;
drawStyle->setName("EditCurvesDrawStyle");
drawStyle->lineWidth = 3;
editCurvesRoot->addChild(drawStyle);
edit->EditCurveSet = new SoLineSet;
edit->EditCurveSet->setName("EditCurveLineSet");
@@ -5950,10 +5950,10 @@ void ViewProviderSketch::createEditInventorNodes(void)
edit->EditRoot->addChild(MtlBind);
// use small line width for the Constraints
DrawStyle = new SoDrawStyle;
DrawStyle->setName("ConstraintDrawStyle");
DrawStyle->lineWidth = 1;
edit->EditRoot->addChild(DrawStyle);
drawStyle = new SoDrawStyle;
drawStyle->setName("ConstraintDrawStyle");
drawStyle->lineWidth = 1;
edit->EditRoot->addChild(drawStyle);
// add the group where all the constraints has its SoSeparator
edit->constrGroup = new SmSwitchboard();
@@ -5967,16 +5967,15 @@ void ViewProviderSketch::createEditInventorNodes(void)
edit->EditRoot->addChild(MtlBind);
// use small line width for the information visual
DrawStyle = new SoDrawStyle;
DrawStyle->setName("InformationDrawStyle");
DrawStyle->lineWidth = 1;
edit->EditRoot->addChild(DrawStyle);
drawStyle = new SoDrawStyle;
drawStyle->setName("InformationDrawStyle");
drawStyle->lineWidth = 1;
edit->EditRoot->addChild(drawStyle);
// add the group where all the information entity has its SoSeparator
edit->infoGroup = new SoGroup();
edit->infoGroup->setName("InformationGroup");
edit->EditRoot->addChild(edit->infoGroup);
}
void ViewProviderSketch::unsetEdit(int ModNum)