static Events_Loop* aLoop = Events_Loop::loop();
static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_VISUAL_ATTRIBUTES);
+ static Events_ID EVENT_REDISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
std::set<ObjectPtr>::const_iterator anIt = theObjects.begin(), aLast = theObjects.end();
- for (; anIt != aLast; anIt++)
- aECreator->sendUpdated(*anIt, EVENT_DISP);
-
+ for (; anIt != aLast; anIt++) {
+ ObjectPtr aObj = *anIt;
+ aECreator->sendUpdated(aObj, EVENT_DISP);
+ aECreator->sendUpdated(aObj, EVENT_REDISP);
+ }
aLoop->flush(EVENT_DISP);
+ aLoop->flush(EVENT_REDISP);
}
PartSet_Module* PartSet_OverconstraintListener::module() const
workshop()->selectionActivate()->updateSelectionFilters();
workshop()->selectionActivate()->updateSelectionModes();
- Events_Loop::loop()->flush(EVENT_DISP);
Events_Loop::loop()->flush(EVENT_ATTR);
+ Events_Loop::loop()->flush(EVENT_DISP);
myExternalPointsMgr = new PartSet_ExternalPointsMgr(myModule->workshop(), myCurrentSketch);
PartSet_OverconstraintListener* aOCListener = myModule->overconstraintListener();
std::string aKind = theFeature->getKind();
+ if (aOCListener->isConflictingObject(theObject)) {
+ return Config_PropManager::color("Visualization", "sketch_overconstraint_color");
+ }
+ if (aOCListener->isFullyConstrained()) {
+ return Config_PropManager::color("Visualization", "sketch_fully_constrained_color");
+ }
if (isDistanceKind(aKind)) {
- if (aOCListener->isConflictingObject(theObject))
- return Config_PropManager::color("Visualization", "sketch_overconstraint_color");
return Config_PropManager::color("Visualization", "sketch_dimension_color");
}
+ if (aKind == SketchPlugin_ConstraintCoincidence::ID())
+ return std::vector<int>(3, 0);
+
if (isExternal(theFeature))
return Config_PropManager::color("Visualization", "sketch_external_color");
if (isConstruction)
return Config_PropManager::color("Visualization", "sketch_auxiliary_color");
- if (aOCListener->isFullyConstrained()) {
- return Config_PropManager::color("Visualization", "sketch_fully_constrained_color");
- }
- else if (aOCListener->isConflictingObject(theObject)) {
- return Config_PropManager::color("Visualization", "sketch_overconstraint_color");
- }
return Config_PropManager::color("Visualization", "sketch_entity_color");
}
#include <SketchPlugin_Constraint.h>
#include <SketchPlugin_ConstraintCoincidence.h>
+#include <AIS_InteractiveContext.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_ArrayOfPoints.hxx>
#include <Prs3d_PointAspect.hxx>
SketcherPrs_Coincident::SketcherPrs_Coincident(ModelAPI_Feature* theConstraint,
SketchPlugin_Sketch* theSketch)
: AIS_InteractiveObject(), myConstraint(theConstraint), mySketch(theSketch),
- myPoint(gp_Pnt(0.0, 0.0, 0.0)), myIsCustomColor(false)
+ myPoint(gp_Pnt(0.0, 0.0, 0.0))
{
+ SetColor(Quantity_NOC_BLACK);
}
bool SketcherPrs_Coincident::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
}
}
}
- Quantity_Color aExternalColor = aIsEdge ? Quantity_NOC_BLACK : Quantity_NOC_YELLOW;
- Quantity_Color aInternalColor = aIsEdge ? Quantity_NOC_YELLOW : Quantity_NOC_BLACK;
+ Quantity_Color aMainColor;
+ Color(aMainColor);
+ Quantity_Color aExternalColor = aIsEdge ? aMainColor : Quantity_NOC_YELLOW;
+ Quantity_Color aInternalColor = aIsEdge ? Quantity_NOC_YELLOW : aMainColor;
int aRatio = SketcherPrs_Tools::pixelRatio();
// Create the presentation as a combination of standard point markers
- bool aCustomColor = myIsCustomColor;
// The external yellow contour
Handle(Graphic3d_AspectMarker3d) aPtA = new Graphic3d_AspectMarker3d();
aPtA->SetType(Aspect_TOM_RING3);
aPtA->SetScale(2. * aRatio);
- aPtA->SetColor(!aCustomColor ? aExternalColor : myCustomColor);
+ aPtA->SetColor(aExternalColor);
Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePresentation);
aGroup->SetPrimitivesAspect(aPtA);
aPtA = new Graphic3d_AspectMarker3d();
aPtA->SetType(aIsEdge ? Aspect_TOM_STAR : Aspect_TOM_RING1);
aPtA->SetScale(1. * aRatio);
- aPtA->SetColor(!aCustomColor ? aInternalColor : myCustomColor);
+ aPtA->SetColor(aInternalColor);
aGroup->SetPrimitivesAspect(aPtA);
aGroup->AddPrimitiveArray (aPntArray);
aPtA = new Graphic3d_AspectMarker3d();
aPtA->SetType(Aspect_TOM_POINT);
aPtA->SetScale(5. * aRatio);
- aPtA->SetColor(!aCustomColor ? aInternalColor : myCustomColor);
+ aPtA->SetColor(aInternalColor);
aGroup->SetPrimitivesAspect(aPtA);
aGroup->AddPrimitiveArray (aPntArray);
{
// There is no selection of coincident - a point is selected instead of coincidence
}
-
-void SketcherPrs_Coincident::SetColor(const Quantity_NameOfColor aCol)
-{
- SetColor(Quantity_Color(aCol));
-}
-
-void SketcherPrs_Coincident::SetColor(const Quantity_Color &aCol)
-{
- hasOwnColor=Standard_True;
-}
-
-void SketcherPrs_Coincident::SetCustomColor(const std::vector<int>& theColor)
-{
- myIsCustomColor = !theColor.empty();
- if (myIsCustomColor)
- myCustomColor = Quantity_Color(theColor[0] / 255., theColor[1] / 255.,
- theColor[2] / 255., Quantity_TOC_RGB);
- else
- myCustomColor = Quantity_Color();
-}
Standard_EXPORT SketcherPrs_Coincident(ModelAPI_Feature* theConstraint,
SketchPlugin_Sketch* theSketch);
- /// Defines color for the presentation
- /// \param aColor a color object
- Standard_EXPORT virtual void SetColor(const Quantity_Color& aColor);
-
- /// Defines color for the presentation
- /// \param aColor a color name
- Standard_EXPORT virtual void SetColor(const Quantity_NameOfColor aColor);
-
- /// Set state of the presentation, in case of custom color, the icon of the presentation is
- /// visualized in error color.
- /// \param theColor a custom color for object presentation
- Standard_EXPORT void SetCustomColor(const std::vector<int>& theColor);
-
/// Returns true if the constraint feature arguments are correcly filled to build AIS presentation
/// \param theConstraint a constraint feature
/// \param thePlane a coordinate plane of current sketch
ModelAPI_Feature* myConstraint;
SketchPlugin_Sketch* mySketch;
gp_Pnt myPoint;
- bool myIsCustomColor; /// state if the presentation is visualized in custom color
- Quantity_Color myCustomColor; /// the color of mid ring if there is a conflict
};
aScreen->setViewScale(getViewScale());
}
anAIS = aPrs->getAISObject(anAIS);
+ if (anAIS.get())
+ myWorkshop->module()->customizePresentation(theObject, anAIS);
} else {
anAIS = myWorkshop->module()->createPresentation(theObject);
isShading = true;