Adopt planes to Part size
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
#include <Inventor/nodes/SoMaterial.h>
|
||||
#include <Inventor/nodes/SoAnnotation.h>
|
||||
#include <Inventor/details/SoLineDetail.h>
|
||||
#include <Inventor/nodes/SoAsciiText.h>
|
||||
#include "ViewProviderPlane.h"
|
||||
#include "SoFCSelection.h"
|
||||
#include "Application.h"
|
||||
@@ -96,6 +97,16 @@ ViewProviderPlane::ViewProviderPlane()
|
||||
pLines->ref();
|
||||
pLines->coordIndex.setNum(6);
|
||||
pLines->coordIndex.setValues(0, 6, lines);
|
||||
|
||||
pFont = new SoFont();
|
||||
pFont->size.setValue(Size.getValue()/10.);
|
||||
|
||||
pTranslation = new SoTranslation();
|
||||
pTranslation->translation.setValue(SbVec3f(-1,9./10.,0));
|
||||
|
||||
pText = new SoAsciiText();
|
||||
pText->width.setValue(-1);
|
||||
|
||||
sPixmap = "view-measurement";
|
||||
}
|
||||
|
||||
@@ -118,6 +129,8 @@ void ViewProviderPlane::onChanged(const App::Property* prop)
|
||||
};
|
||||
|
||||
pCoords->point.setValues(0, 4, verts);
|
||||
pFont->size.setValue(Size.getValue()/10.);
|
||||
pTranslation->translation.setValue(SbVec3f(-size,size*9./10.,0));
|
||||
}
|
||||
else
|
||||
ViewProviderGeometryObject::onChanged(prop);
|
||||
@@ -144,27 +157,29 @@ void ViewProviderPlane::attach(App::DocumentObject* pcObject)
|
||||
|
||||
SoAnnotation *lineSep = new SoAnnotation();
|
||||
|
||||
|
||||
SoAutoZoomTranslation *zoom = new SoAutoZoomTranslation;
|
||||
|
||||
SoDrawStyle* style = new SoDrawStyle();
|
||||
style->lineWidth = 1.0f;
|
||||
|
||||
SoMaterialBinding* matBinding = new SoMaterialBinding;
|
||||
matBinding->value = SoMaterialBinding::PER_FACE;
|
||||
|
||||
lineSep->addChild(zoom);
|
||||
|
||||
lineSep->addChild(style);
|
||||
lineSep->addChild(matBinding);
|
||||
lineSep->addChild(pMat);
|
||||
lineSep->addChild(pCoords);
|
||||
lineSep->addChild(pLines);
|
||||
lineSep->addChild(pFont);
|
||||
|
||||
pText->string.setValue(SbString(pcObject->Label.getValue()));
|
||||
lineSep->addChild(pTranslation);
|
||||
lineSep->addChild(pText);
|
||||
|
||||
addDisplayMaskMode(lineSep, "Base");
|
||||
}
|
||||
|
||||
void ViewProviderPlane::updateData(const App::Property* prop)
|
||||
{
|
||||
pText->string.setValue(SbString(pcObject->Label.getValue()));
|
||||
ViewProviderGeometryObject::updateData(prop);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user