From 7ac1ab6a6dc949699d8afa3f01242a03e99e4932 Mon Sep 17 00:00:00 2001 From: Alexander Golubev Date: Wed, 9 Sep 2015 03:49:57 +0300 Subject: [PATCH] PartDesign/Gui: make Datums use general material interface - Make Datums colorable and transparent - Change default datums color to yellow and transparency to 60% - Rework Lines and Points datum view provider - Add ViewProviderDatum::defaultBoundBox() --- src/Mod/PartDesign/Gui/ViewProviderDatum.cpp | 62 ++++++------ src/Mod/PartDesign/Gui/ViewProviderDatum.h | 13 ++- .../PartDesign/Gui/ViewProviderDatumCS.cpp | 28 +++--- .../PartDesign/Gui/ViewProviderDatumLine.cpp | 95 +++++++------------ .../PartDesign/Gui/ViewProviderDatumLine.h | 7 +- .../PartDesign/Gui/ViewProviderDatumPlane.cpp | 19 ++-- .../PartDesign/Gui/ViewProviderDatumPoint.cpp | 59 ++++++------ .../PartDesign/Gui/ViewProviderDatumPoint.h | 5 +- 8 files changed, 139 insertions(+), 149 deletions(-) diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp b/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp index 39e507079..2fb6a4504 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderDatum.cpp @@ -58,6 +58,7 @@ #include #include #include +#include #include #include @@ -82,6 +83,16 @@ ViewProviderDatum::ViewProviderDatum() pShapeSep = new SoSeparator(); pShapeSep->ref(); + // set default color for datums (golden yellow with 60% transparency) + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath ( + "User parameter:BaseApp/Preferences/Mod/PartDesign"); + unsigned long shcol = hGrp->GetUnsigned ( "DefaultDatumColor", 0xFFD70099 ); + + App::Color col ( (uint32_t) shcol ); + ShapeColor.setValue ( col ); + + Transparency.setValue (col.a * 100); + oldWb = ""; oldTip = NULL; } @@ -93,8 +104,9 @@ ViewProviderDatum::~ViewProviderDatum() void ViewProviderDatum::attach(App::DocumentObject *obj) { - ViewProviderGeometryObject::attach(obj); + ViewProviderGeometryObject::attach ( obj ); + // TODO remove this field (2015-09-08, Fat-Zer) App::DocumentObject* o = getObject(); if (o->getTypeId() == PartDesign::Plane::getClassTypeId()) datumType = QObject::tr("Plane"); @@ -108,21 +120,21 @@ void ViewProviderDatum::attach(App::DocumentObject *obj) SoShapeHints* hints = new SoShapeHints(); hints->shapeType.setValue(SoShapeHints::UNKNOWN_SHAPE_TYPE); hints->vertexOrdering.setValue(SoShapeHints::COUNTERCLOCKWISE); - SoMaterialBinding* bind = new SoMaterialBinding(); SoDrawStyle* fstyle = new SoDrawStyle(); fstyle->style = SoDrawStyle::FILLED; - SoBaseColor* color = new SoBaseColor(); - color->rgb.setValue(0.9f, 0.9f, 0.3f); - SoSeparator* sep = new SoSeparator(); - SoPickStyle* ps = new SoPickStyle(); - ps->style = SoPickStyle::SHAPE; + SoPickStyle* pickStyle = new SoPickStyle(); + pickStyle->style = SoPickStyle::SHAPE; + SoMaterialBinding* matBinding = new SoMaterialBinding; + matBinding->value = SoMaterialBinding::OVERALL; + SoSeparator* sep = new SoSeparator(); sep->addChild(hints); - sep->addChild(bind); sep->addChild(fstyle); - sep->addChild(color); - sep->addChild(ps); + sep->addChild(pickStyle); + sep->addChild(matBinding); + sep->addChild(pcShapeMaterial); sep->addChild(pShapeSep); + addDisplayMaskMode(sep, "Base"); } @@ -138,10 +150,7 @@ bool ViewProviderDatum::onDelete(const std::vector &) std::vector ViewProviderDatum::getDisplayModes(void) const { - // add modes - std::vector StrList; - StrList.push_back("Base"); - return StrList; + return { "Base" }; } void ViewProviderDatum::setDisplayMode(const char* ModeName) @@ -151,16 +160,6 @@ void ViewProviderDatum::setDisplayMode(const char* ModeName) ViewProviderGeometryObject::setDisplayMode(ModeName); } -void ViewProviderDatum::onChanged(const App::Property* prop) -{ - /*if (prop == &Shape) { - updateData(prop); - } - else {*/ - ViewProviderGeometryObject::onChanged(prop); - //} -} - std::string ViewProviderDatum::getElement(const SoDetail* detail) const { if (detail) { @@ -222,7 +221,7 @@ bool ViewProviderDatum::setEdit(int ModNum) { if (!ViewProvider::setEdit(ModNum)) return false; - + // TODO Share this code with Features view providers somehow (2015-09-08, Fat-Zer) if (ModNum == ViewProvider::Default ) { // When double-clicking on the item for this datum feature the // object unsets and sets its edit mode without closing @@ -268,8 +267,11 @@ bool ViewProviderDatum::doubleClicked(void) std::string Msg("Edit "); Msg += this->pcObject->Label.getValue(); Gui::Command::openCommand(Msg.c_str()); - PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject(PDBODYKEY); + PartDesign::Body* activeBody = getActiveView()->getActiveObject(PDBODYKEY); + // TODO check if this feature belongs to the active body + // and if not set the body it belongs to as active (2015-09-08, Fat-Zer) if (activeBody != NULL) { + // TODO Rewrite this (2015-09-08, Fat-Zer) // Drop into insert mode so that the user doesn't see all the geometry that comes later in the tree // Also, this way the user won't be tempted to use future geometry as external references for the sketch oldTip = activeBody->Tip.getValue(); @@ -344,8 +346,7 @@ SbBox3f ViewProviderDatum::getRelevantBoundBox () const { SbBox3f bbox = getRelevantBoundBox (bboxAction, objs); if ( bbox.getVolume () < Precision::Confusion() ) { - bbox.extendBy ( SbVec3f (-10.0,-10.0,-10.0) ); - bbox.extendBy ( SbVec3f ( 10.0, 10.0, 10.0) ); + bbox.extendBy ( defaultBoundBox () ); } return bbox; @@ -379,3 +380,8 @@ SbBox3f ViewProviderDatum::getRelevantBoundBox ( return bbox; } + +SbBox3f ViewProviderDatum::defaultBoundBox () { + double defSz = Gui::ViewProviderOrigin::defaultSize (); + return SbBox3f ( -defSz, -defSz, -defSz, defSz, defSz, defSz ); +} diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatum.h b/src/Mod/PartDesign/Gui/ViewProviderDatum.h index 92322459a..fc8f2bbe3 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatum.h +++ b/src/Mod/PartDesign/Gui/ViewProviderDatum.h @@ -47,7 +47,6 @@ public: virtual void attach(App::DocumentObject *); virtual bool onDelete(const std::vector &); - virtual void updateData(const App::Property* prop) { Gui::ViewProviderGeometryObject::updateData(prop); } virtual bool doubleClicked(void); std::vector getDisplayModes(void) const; void setDisplayMode(const char* ModeName); @@ -88,8 +87,13 @@ public: SoGetBoundingBoxAction &bboxAction, const std::vector &objs); + // Returnd default bounding box if relevant is can't be used for some reason + static SbBox3f defaultBoundBox (); + + // Returns a default marging factor (part of size ) + static double margingFactor () { return 0.1; }; + protected: - void onChanged(const App::Property* prop); virtual bool setEdit(int ModNum); virtual void unsetEdit(int ModNum); @@ -104,7 +108,10 @@ protected: */ SbBox3f getRelevantBoundBox() const; -protected: + // Get the separator to fill with datum content + SoSeparator *getShapeRoot () { return pShapeSep; } + +private: SoSeparator* pShapeSep; std::string oldWb; App::DocumentObject* oldTip; diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatumCS.cpp b/src/Mod/PartDesign/Gui/ViewProviderDatumCS.cpp index 8adcbee1d..62dba9662 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatumCS.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderDatumCS.cpp @@ -71,8 +71,8 @@ ViewProviderDatumCoordinateSystem::ViewProviderDatumCoordinateSystem() material->diffuseColor.set1Value(3, SbColor(0.f, 0.f, 1.f)); SoMaterialBinding* binding = new SoMaterialBinding(); binding->value = SoMaterialBinding::PER_FACE_INDEXED; - pShapeSep->addChild(binding); - pShapeSep->addChild(material); + getShapeRoot ()->addChild(binding); + getShapeRoot ()->addChild(material); font = new SoFont(); font->ref(); @@ -122,7 +122,7 @@ void ViewProviderDatumCoordinateSystem::setExtents (Base::BoundBox3d bbox) { PartGui::SoBrepEdgeSet* lineSet; SoCoordinate3* coord; - if (pShapeSep->getNumChildren() == 2) { + if (getShapeRoot ()->getNumChildren() == 2) { coord = new SoCoordinate3(); coord->point.setNum(4); coord->point.set1Value(0, base.x, base.y, base.z); @@ -130,7 +130,7 @@ void ViewProviderDatumCoordinateSystem::setExtents (Base::BoundBox3d bbox) { coord->point.set1Value(2, y.x, y.y, y.z); coord->point.set1Value(3, z.x, z.y, z.z); - pShapeSep->addChild(coord); + getShapeRoot ()->addChild(coord); lineSet = new PartGui::SoBrepEdgeSet(); lineSet->coordIndex.setNum(9); lineSet->coordIndex.set1Value(0, 0); @@ -146,31 +146,31 @@ void ViewProviderDatumCoordinateSystem::setExtents (Base::BoundBox3d bbox) { lineSet->materialIndex.set1Value(0,1); lineSet->materialIndex.set1Value(1,2); lineSet->materialIndex.set1Value(2,3); - pShapeSep->addChild(lineSet); + getShapeRoot ()->addChild(lineSet); - pShapeSep->addChild(font); + getShapeRoot ()->addChild(font); font->size = axis.Length()/10.; - pShapeSep->addChild(transX); + getShapeRoot ()->addChild(transX); transX->translation.setValue(SbVec3f(x.x,x.y,x.z)); SoAsciiText* t = new SoAsciiText(); t->string = "X"; - pShapeSep->addChild(t); - pShapeSep->addChild(transY); + getShapeRoot ()->addChild(t); + getShapeRoot ()->addChild(transY); transY->translation.setValue(SbVec3f(-x.x + y.x, x.y + y.y, -x.z + y.z)); t = new SoAsciiText(); t->string = "Y"; - pShapeSep->addChild(t); - pShapeSep->addChild(transZ); + getShapeRoot ()->addChild(t); + getShapeRoot ()->addChild(transZ); auto* rot = new SoRotation(); rot->rotation = SbRotation(SbVec3f(0,1,0), M_PI/2); - pShapeSep->addChild(rot); + getShapeRoot ()->addChild(rot); transZ->translation.setValue(SbVec3f(-y.x + z.x, -y.y + z.y, -y.z + z.z)); t = new SoAsciiText(); t->string = "Z"; - pShapeSep->addChild(t); + getShapeRoot ()->addChild(t); } else { - coord = static_cast(pShapeSep->getChild(2)); + coord = static_cast(getShapeRoot ()->getChild(2)); coord->point.set1Value(0, base.x, base.y, base.z); coord->point.set1Value(1, x.x, x.y, x.z); coord->point.set1Value(2, y.x, y.y, y.z); diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatumLine.cpp b/src/Mod/PartDesign/Gui/ViewProviderDatumLine.cpp index bb60d58a1..717b02a9f 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatumLine.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderDatumLine.cpp @@ -20,50 +20,48 @@ * * ***************************************************************************/ - #include "PreCompiled.h" #ifndef _PreComp_ # include -# include # include -# include -# include -# include -# include -# include -# include -# include -# include #endif -#include "ViewProviderDatumLine.h" -#include "TaskDatumParameters.h" -#include #include -#include #include -#include -#include -#include + +#include "ViewProviderDatumLine.h" using namespace PartDesignGui; PROPERTY_SOURCE(PartDesignGui::ViewProviderDatumLine,PartDesignGui::ViewProviderDatum) -ViewProviderDatumLine::ViewProviderDatumLine() -{ +ViewProviderDatumLine::ViewProviderDatumLine() { sPixmap = "PartDesign_Line.svg"; - // TODO Let the base class handle material (2015-09-07, Fat-Zer) - SoMaterial* material = new SoMaterial(); - material->diffuseColor.setValue(0.9f, 0.9f, 0.13f); - material->transparency.setValue(0.2f); - pShapeSep->addChild(material); + + pCoords = new SoCoordinate3(); + pCoords->ref (); } -ViewProviderDatumLine::~ViewProviderDatumLine() -{ +ViewProviderDatumLine::~ViewProviderDatumLine() { + pCoords->unref (); +} +void ViewProviderDatumLine::attach ( App::DocumentObject *obj ) { + ViewProviderDatum::attach ( obj ); + + PartGui::SoBrepEdgeSet* lineSet; + + ViewProviderDatum::setExtents ( defaultBoundBox () ); + getShapeRoot ()->addChild(pCoords); + + lineSet = new PartGui::SoBrepEdgeSet(); + lineSet->coordIndex.setNum(3); + lineSet->coordIndex.set1Value(0, 0); + lineSet->coordIndex.set1Value(1, 1); + lineSet->coordIndex.set1Value(2, SO_END_LINE_INDEX); + + getShapeRoot ()->addChild(lineSet); } void ViewProviderDatumLine::updateData(const App::Property* prop) @@ -82,42 +80,17 @@ void ViewProviderDatumLine::updateData(const App::Property* prop) void ViewProviderDatumLine::setExtents (Base::BoundBox3d bbox) { PartDesign::Line* pcDatum = static_cast(this->getObject()); - Base::Placement plm = pcDatum->Placement.getValue(); - plm.invert(); - Base::Vector3d base(0,0,0); - Base::Vector3d dir(0,0,1); + Base::Placement plm = pcDatum->Placement.getValue ().inverse (); - // TODO transform point rather the bbox (2015-09-07, Fat-Zer) - Base::BoundBox3d my_bbox = bbox.Transformed(plm.toMatrix()); - Base::Vector3d p1, p2; - if (my_bbox.IsInBox(base)) { - my_bbox.IntersectionPoint(base, dir, p1, Precision::Confusion()); - my_bbox.IntersectionPoint(base, -dir, p2, Precision::Confusion()); - } else { - my_bbox.IntersectWithLine(base, dir, p1, p2); - if ((p1 == Base::Vector3d(0,0,0)) && (p2 == Base::Vector3d(0,0,0))) - my_bbox.IntersectWithLine(base, -dir, p1, p2); - } + // Transform the box to the line's coordinates, the result line will be larger than the bbox + bbox = bbox.Transformed ( plm.toMatrix() ); + // Add origin of the line to the box if it's not + bbox.Add ( Base::Vector3d (0, 0, 0) ); + + double marging = bbox.LengthZ () * margingFactor (); // Display the line - PartGui::SoBrepEdgeSet* lineSet; - SoCoordinate3* coord; - - // TODO Move initialization to the attach() (2015-09-07, Fat-Zer) - if (pShapeSep->getNumChildren() == 1) { - coord = new SoCoordinate3(); - coord->point.setNum(2); - coord->point.set1Value(0, p1.x, p1.y, p1.z); - coord->point.set1Value(1, p2.x, p2.y, p2.z); - pShapeSep->addChild(coord); - lineSet = new PartGui::SoBrepEdgeSet(); - lineSet->coordIndex.setNum(2); - lineSet->coordIndex.set1Value(0, 0); - lineSet->coordIndex.set1Value(1, 1); - pShapeSep->addChild(lineSet); - } else { - coord = static_cast(pShapeSep->getChild(1)); - coord->point.set1Value(0, p1.x, p1.y, p1.z); - coord->point.set1Value(1, p2.x, p2.y, p2.z); - } + pCoords->point.setNum (2); + pCoords->point.set1Value(0, 0, 0, bbox.MaxZ + marging ); + pCoords->point.set1Value(1, 0, 0, bbox.MinZ - marging ); } diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatumLine.h b/src/Mod/PartDesign/Gui/ViewProviderDatumLine.h index a0a62438d..4ef0116de 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatumLine.h +++ b/src/Mod/PartDesign/Gui/ViewProviderDatumLine.h @@ -24,9 +24,10 @@ #ifndef PARTGUI_ViewProviderDatumLine_H #define PARTGUI_ViewProviderDatumLine_H -#include "Gui/ViewProviderGeometryObject.h" #include "ViewProviderDatum.h" +class SoCoordinate3; + namespace PartDesignGui { class PartDesignGuiExport ViewProviderDatumLine : public PartDesignGui::ViewProviderDatum @@ -38,9 +39,13 @@ public: ViewProviderDatumLine(); virtual ~ViewProviderDatumLine(); + virtual void attach ( App::DocumentObject *obj ); virtual void updateData(const App::Property*); virtual void setExtents (Base::BoundBox3d bbox); + +private: + SoCoordinate3 *pCoords; }; } // namespace PartDesignGui diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatumPlane.cpp b/src/Mod/PartDesign/Gui/ViewProviderDatumPlane.cpp index 56070ccd9..350a27912 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatumPlane.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderDatumPlane.cpp @@ -55,11 +55,6 @@ PROPERTY_SOURCE(PartDesignGui::ViewProviderDatumPlane,PartDesignGui::ViewProvide ViewProviderDatumPlane::ViewProviderDatumPlane() { sPixmap = "PartDesign_Plane.svg"; - // TODO Use general material object (2015-09-07, Fat-Zer) - SoMaterial* material = new SoMaterial(); - material->diffuseColor.setValue(0.9f, 0.9f, 0.13f); - material->transparency.setValue(0.5f); - pShapeSep->addChild(material); } ViewProviderDatumPlane::~ViewProviderDatumPlane() @@ -193,7 +188,7 @@ void ViewProviderDatumPlane::setExtents (Base::BoundBox3d bbox) { PartGui::SoBrepFaceSet* faceSet; SoIndexedLineSet* lineSet; - if (pShapeSep->getNumChildren() == 1) { + if (getShapeRoot ()->getNumChildren() == 0) { // The polygon must be split up into triangles because the SoBRepFaceSet only handles those if (points.size() < 3) return; @@ -201,7 +196,7 @@ void ViewProviderDatumPlane::setExtents (Base::BoundBox3d bbox) { coord->point.setNum(points.size()); for (unsigned int p = 0; p < points.size(); p++) coord->point.set1Value(p, points[p].x, points[p].y, points[p].z); - pShapeSep->addChild(coord); + getShapeRoot ()->addChild(coord); faceSet = new PartGui::SoBrepFaceSet(); faceSet->partIndex.setNum(1); // One face @@ -219,7 +214,7 @@ void ViewProviderDatumPlane::setExtents (Base::BoundBox3d bbox) { faceSet->coordIndex.set1Value(4 + 4*(p-3) + 2, p); faceSet->coordIndex.set1Value(4 + 4*(p-3) + 3, SO_END_FACE_INDEX); } - pShapeSep->addChild(faceSet); + getShapeRoot ()->addChild(faceSet); lineSet = new SoIndexedLineSet(); lineSet->coordIndex.setNum(points.size()+2); @@ -227,13 +222,13 @@ void ViewProviderDatumPlane::setExtents (Base::BoundBox3d bbox) { lineSet->coordIndex.set1Value(p, p); lineSet->coordIndex.set1Value(points.size(), 0); lineSet->coordIndex.set1Value(points.size()+1, SO_END_LINE_INDEX); - pShapeSep->addChild(lineSet); + getShapeRoot ()->addChild(lineSet); } else { - coord = static_cast(pShapeSep->getChild(1)); + coord = static_cast(getShapeRoot ()->getChild(0)); coord->point.setNum(points.size()); for (unsigned int p = 0; p < points.size(); p++) coord->point.set1Value(p, points[p].x, points[p].y, points[p].z); - faceSet = static_cast(pShapeSep->getChild(2)); + faceSet = static_cast(getShapeRoot ()->getChild(1)); faceSet->partIndex.setNum(1); // One face faceSet->partIndex.set1Value(0, points.size()-3 + 1); // with this many triangles faceSet->coordIndex.setNum(4 + 4*(points.size()-3)); @@ -249,7 +244,7 @@ void ViewProviderDatumPlane::setExtents (Base::BoundBox3d bbox) { faceSet->coordIndex.set1Value(4 + 4*(p-3) + 2, p); faceSet->coordIndex.set1Value(4 + 4*(p-3) + 3, SO_END_FACE_INDEX); } - lineSet = static_cast(pShapeSep->getChild(3)); + lineSet = static_cast(getShapeRoot ()->getChild(2)); lineSet->coordIndex.setNum(points.size()+2); for (unsigned int p = 0; p < points.size(); p++) lineSet->coordIndex.set1Value(p, p); diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatumPoint.cpp b/src/Mod/PartDesign/Gui/ViewProviderDatumPoint.cpp index 929a08ede..315bc2b6d 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatumPoint.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderDatumPoint.cpp @@ -30,9 +30,7 @@ #endif #include "ViewProviderDatumPoint.h" -#include -#include -#include +// #include #include using namespace PartDesignGui; @@ -42,38 +40,41 @@ PROPERTY_SOURCE(PartDesignGui::ViewProviderDatumPoint,PartDesignGui::ViewProvide ViewProviderDatumPoint::ViewProviderDatumPoint() { sPixmap = "PartDesign_Point.svg"; - - SoMFVec3f v; - v.setNum(1); - v.set1Value(0, 0,0,0); - SoVertexProperty* vprop = new SoVertexProperty(); - vprop->vertex = v; - // Using a marker gives a larger point but it doesn't do highlighting automatically like the SoBrepPointSet - SoMarkerSet* marker = new SoMarkerSet(); - marker->markerIndex = SoMarkerSet::DIAMOND_FILLED_9_9; - marker->vertexProperty = vprop; - marker->numPoints = 1; - PartGui::SoBrepPointSet* points = new PartGui::SoBrepPointSet(); - points->vertexProperty = vprop; - points->numPoints = 1; - pShapeSep->addChild(points); - pShapeSep->addChild(marker); + + // SoMarkerSet won't be drawn if transparency is nonzero, so disabble it + Transparency.setValue (0); + Transparency.StatusBits.set ( 3, true ); //< make transparency hidden } ViewProviderDatumPoint::~ViewProviderDatumPoint() { } -void ViewProviderDatumPoint::updateData(const App::Property* prop) -{ - // TODO Review this (2015-09-07, Fat-Zer) - if (strcmp(prop->getName(),"Placement") == 0) { - // The only reason to do this is to display the point in the correct position after loading the document - SoMarkerSet* marker = static_cast(pShapeSep->getChild(1)); - marker->touch(); - PartGui::SoBrepPointSet* points = static_cast(pShapeSep->getChild(0)); - points->touch(); +void ViewProviderDatumPoint::attach ( App::DocumentObject *obj ) { + ViewProviderDatum::attach ( obj ); + + SoMFVec3f v; + v.setNum(1); + v.set1Value(0, 0,0,0); + + SoVertexProperty* vprop = new SoVertexProperty(); + vprop->vertex = v; + + // Using a marker gives a larger point but it doesn't do highlighting automatically like the SoBrepPointSet + // TODO Fix the highlight (may be via additional pcHighlight node?) (2015-09-09, Fat-Zer) + SoMarkerSet* marker = new SoMarkerSet(); + marker->vertexProperty = vprop; + marker->numPoints = 1; + marker->markerIndex = SoMarkerSet::DIAMOND_FILLED_9_9; + + getShapeRoot ()->addChild(marker); +} + +void ViewProviderDatumPoint::onChanged (const App::Property* prop) { + // Forbid to set trancparency + if (prop == &Transparency && Transparency.getValue() != 0) { + Transparency.setValue (0); } - ViewProviderDatum::updateData(prop); + ViewProviderDatum::onChanged (prop); } diff --git a/src/Mod/PartDesign/Gui/ViewProviderDatumPoint.h b/src/Mod/PartDesign/Gui/ViewProviderDatumPoint.h index 91e8ba196..3ff5514f5 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderDatumPoint.h +++ b/src/Mod/PartDesign/Gui/ViewProviderDatumPoint.h @@ -38,9 +38,12 @@ public: ViewProviderDatumPoint(); virtual ~ViewProviderDatumPoint(); - virtual void updateData(const App::Property*); + virtual void attach ( App::DocumentObject *obj ); // Note: don't overload setExtents () here because point doesn't really depends on it + +protected: + virtual void onChanged(const App::Property* prop); }; } // namespace PartDesignGui