Assembly: Plane ViewProvider Size property and smaller standard size

This commit is contained in:
jriegel 2014-09-22 15:05:20 +02:00 committed by Stefan Tröger
parent 51b46e1e37
commit 271bb65cbd
2 changed files with 19 additions and 3 deletions

View File

@ -64,13 +64,15 @@ PROPERTY_SOURCE(Gui::ViewProviderPlane, Gui::ViewProviderGeometryObject)
ViewProviderPlane::ViewProviderPlane()
{
ADD_PROPERTY(Size,(1.0));
pMat = new SoMaterial();
pMat->ref();
const float size = 10; // Note: If you change this, you need to also adapt App/Plane.cpp getBoundBox()
float size = Size.getValue(); // Note: If you change this, you need to also adapt App/Plane.cpp getBoundBox()
static const SbVec3f verts[4] =
SbVec3f verts[4] =
{
SbVec3f(size,size,0), SbVec3f(size,-size,0),
SbVec3f(-size,-size,0), SbVec3f(-size,size,0),
@ -106,7 +108,19 @@ ViewProviderPlane::~ViewProviderPlane()
void ViewProviderPlane::onChanged(const App::Property* prop)
{
ViewProviderGeometryObject::onChanged(prop);
if (prop == &Size){
float size = Size.getValue(); // Note: If you change this, you need to also adapt App/Plane.cpp getBoundBox()
SbVec3f verts[4] =
{
SbVec3f(size,size,0), SbVec3f(size,-size,0),
SbVec3f(-size,-size,0), SbVec3f(-size,size,0),
};
pCoords->point.setValues(0, 4, verts);
}
else
ViewProviderGeometryObject::onChanged(prop);
}
std::vector<std::string> ViewProviderPlane::getDisplayModes(void) const

View File

@ -49,6 +49,8 @@ public:
ViewProviderPlane(void);
virtual ~ViewProviderPlane();
App::PropertyFloat Size;
void attach(App::DocumentObject *);
void updateData(const App::Property*);
std::vector<std::string> getDisplayModes(void) const;