+ fixes #0001735: Ellipsoids visibility problems

This commit is contained in:
wmayer
2014-10-16 19:36:54 +02:00
parent 84bd9a4a88
commit dd392efeb1
4 changed files with 39 additions and 102 deletions

View File

@@ -1132,59 +1132,3 @@ void ViewProviderPartBase::showControlPointsOfFace(const TopoDS_Face& face)
pcControlPoints->addChild(nodes);
}
// ----------------------------------------------------------------------------
PROPERTY_SOURCE(PartGui::ViewProviderEllipsoid, PartGui::ViewProviderPartBase)
ViewProviderEllipsoid::ViewProviderEllipsoid()
{
pSphere = new SoSphere();
pSphere->ref();
pScaling = new SoScale();
pScaling->ref();
sPixmap = "Tree_Part_Ellipsoid_Parametric.svg";
}
ViewProviderEllipsoid::~ViewProviderEllipsoid()
{
pSphere->unref();
pScaling->unref();
}
void ViewProviderEllipsoid::updateData(const App::Property* prop)
{
if (prop->getTypeId() == Part::PropertyPartShape::getClassTypeId()) {
const TopoDS_Shape& cShape = static_cast<const Part::PropertyPartShape*>(prop)->getValue();
// clear anchor nodes
//vertexShapeMap.clear();
EdgeRoot->removeAllChildren();
FaceRoot->removeAllChildren();
VertexRoot->removeAllChildren();
// do nothing if shape is empty
if (cShape.IsNull())
return;
App::DocumentObject* object = this->getObject();
if (object && object->isDerivedFrom(Part::Ellipsoid::getClassTypeId())) {
double angle1 = static_cast<Part::Ellipsoid*>(object)->Angle1.getValue();
double angle2 = static_cast<Part::Ellipsoid*>(object)->Angle2.getValue();
double angle3 = static_cast<Part::Ellipsoid*>(object)->Angle3.getValue();
float radius1 = static_cast<Part::Ellipsoid*>(object)->Radius1.getValue();
float radius2 = static_cast<Part::Ellipsoid*>(object)->Radius2.getValue();
if (angle1 == -90.0 && angle2 == 90.0 && angle3 == 360.0) {
float scale = radius1/radius2;
pScaling->scaleFactor.setValue(1,1,scale);
pSphere->radius.setValue(radius2);
FaceRoot->addChild(pScaling);
FaceRoot->addChild(pSphere);
return; // ok, done
}
}
// if not a full ellipsoid do it the general way
ViewProviderPartBase::updateData(prop);
}
else {
Gui::ViewProviderGeometryObject::updateData(prop);
}
}