void ViewProviderMeasureDistance::attach(App::DocumentObject* pcObject)
{
    ViewProviderDocumentObject::attach(pcObject);

    SoPickStyle* ps = new SoPickStyle();
    ps->style = SoPickStyle::UNPICKABLE;

    SoSeparator *lineSep = new SoSeparator();
    SoDrawStyle* style = new SoDrawStyle();
    style->lineWidth = 2.0f;
    lineSep->addChild(ps);
    lineSep->addChild(style);
    lineSep->addChild(pColor);
    lineSep->addChild(pCoords);
    lineSep->addChild(pLines);
    SoMarkerSet* points = new SoMarkerSet();
    points->markerIndex = SoMarkerSet::CROSS_9_9;
    points->numPoints=2;
    lineSep->addChild(points);

    // Making the whole measurement object selectable by 3d view can
    // become cumbersome since it has influence to any raypick action.
    // Thus, it's only selectable by its text label
    SoFCSelection* textsep = new SoFCSelection();
    textsep->objectName = pcObject->getNameInDocument();
    textsep->documentName = pcObject->getDocument()->getName();
    textsep->subElementName = "Main";
    //SoSeparator* textsep = new SoSeparator();
    textsep->addChild(pTranslation);
    textsep->addChild(pTextColor);
    textsep->addChild(pFont);
    textsep->addChild(pLabel);

    SoSeparator* sep = new SoSeparator();
    sep->addChild(lineSep);
    sep->addChild(textsep);
    addDisplayMaskMode(sep, "Base");
}
void ViewProviderOriginFeature::attach(App::DocumentObject* pcObject)
{
    ViewProviderGeometryObject::attach(pcObject);

    float defaultSz = ViewProviderOrigin::defaultSize();
    float sz = Size.getValue () / defaultSz;

    // Create an external separator
    SoSeparator  *sep = new SoSeparator();

    // Add material from the base class
    sep->addChild(pcShapeMaterial);

    // Bind same material to all part
    SoMaterialBinding* matBinding = new SoMaterialBinding;
    matBinding->value = SoMaterialBinding::OVERALL;
    sep->addChild(matBinding);

    // Scale feature to the given size
    pScale->scaleFactor = SbVec3f (sz, sz, sz);
    sep->addChild (pScale);

    // Setup font size
    SoFont *font = new SoFont ();
    font->size.setValue ( defaultSz/10.);
    sep->addChild ( font );

    // Create the selection node
    SoFCSelection *highlight = new SoFCSelection ();
    highlight->applySettings ();
    if ( !Selectable.getValue() ) {
        highlight->selectionMode = Gui::SoFCSelection::SEL_OFF;
    }
    highlight->objectName    = getObject()->getNameInDocument();
    highlight->documentName  = getObject()->getDocument()->getName();
    highlight->style = SoFCSelection::EMISSIVE_DIFFUSE;

    // Style for normal (visiable) lines
    SoDrawStyle* style = new SoDrawStyle ();
    style->lineWidth = 2.0f;
    highlight->addChild ( style );

    // Visible lines
    highlight->addChild ( pOriginFeatureRoot );

    // Hidden features
    SoAnnotation *hidden = new SoAnnotation ();

    // Style for hidden lines
    style = new SoDrawStyle ();
    style->lineWidth = 2.0f;
    style->linePattern.setValue ( 0xF000 ); // (dash-skip-skip-skip)
    hidden->addChild ( style );

    // Hidden lines
    hidden->addChild ( pOriginFeatureRoot );

    highlight->addChild ( hidden );

    sep->addChild ( highlight );

    // Setup the object label as it's text
    pLabel->string.setValue ( SbString ( pcObject->Label.getValue () ) );

    addDisplayMaskMode ( sep, "Base" );
}