SketcherPrs_SymbolPrs::SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint,
const std::shared_ptr<GeomAPI_Ax3>& thePlane)
- : AIS_InteractiveObject(), myConstraint(theConstraint), myPlane(thePlane)
+ : AIS_InteractiveObject(), myConstraint(theConstraint), myPlane(thePlane), myIsConflicting(false)
{
SetAutoHilight(Standard_False);
}
return myIconsMap[iconName()];
}
// Load icon for the presentation
- char* aEnv = getenv("NEWGEOM_ROOT_DIR");
+ char* aEnv = getenv("SHAPERResources");
if (aEnv != NULL) {
TCollection_AsciiString aFile(aEnv);
- aFile+=FSEP;
- aFile+="resources";
aFile += FSEP;
aFile += iconName();
Handle(Image_AlienPixMap) aPixMap = new Image_AlienPixMap();
// Update points with default shift value
if (!updatePoints(20)) {
+ Events_Error::throwException("An empty AIS presentation: SketcherPrs_SymbolPrs");
return;
}
void SketcherPrs_SymbolPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
- const Standard_Integer aMode)
+ const Standard_Integer aMode)
{
ClearSelected();
if ((aMode == 0) || (aMode == SketcherPrs_Tools::Sel_Constraint)) {
}
}
+void SketcherPrs_SymbolPrs::SetConflictingConstraint(const bool& theConflicting,
+ const std::vector<int>& theColor)
+{
+ if (theConflicting)
+ {
+ if (!myAspect.IsNull())
+ myAspect->SetColor (Quantity_Color (theColor[0] / 255., theColor[1] / 255., theColor[2] / 255.,
+ Quantity_TOC_RGB));
+ myIsConflicting = true;
+ }
+ else
+ {
+ if (!myAspect.IsNull())
+ myAspect->SetColor (Quantity_Color (1.0, 1.0, 0.0, Quantity_TOC_RGB));
+ myIsConflicting = false;
+ }
+}
void SketcherPrs_SymbolPrs::Render(const Handle(OpenGl_Workspace)& theWorkspace) const
{
+ // this method is a combination of OCCT OpenGL functions. The main purpose is to have
+ // equal distance from the source object to symbol indpendently of zoom.
+ // It is base on OCCT 6.9.1 and might need changes when using later OCCT versions.
+ // The specific SHAPER modifications are marked by ShaperModification:start/end, other is OCCT code
+
// do not update presentation for invalid or already removed objects: the presentation
// should be removed soon
if (!myConstraint->data().get() || !myConstraint->data()->isValid())
const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
Handle(OpenGl_View) aView = theWorkspace->ActiveView();
+ // ShaperModification:start
double aScale = aView->Camera()->Scale();
// Update points coordinate taking the viewer scale into account
if (!updatePoints(MyDist * aScale))
return;
+ // ShaperModification:end
Handle(Graphic3d_Buffer) aAttribs = myPntArray->Attributes();
const Handle(OpenGl_PointSprite)& aSpriteNorm = anAspectMarker->SpriteRes(aCtx);
if (!aSpriteNorm.IsNull() && !aSpriteNorm->IsDisplayList()) {
- const bool toHilight = (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) != 0;
+ // ShaperModification:start : filling the presentation with color if there is a conflict
+ const bool toHilight = (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) != 0 || myIsConflicting;
+ // ShaperModification:end
+
const Handle(OpenGl_PointSprite)& aSprite = (toHilight && anAspectMarker->SpriteHighlightRes(aCtx)->IsValid())
? anAspectMarker->SpriteHighlightRes(aCtx)
: aSpriteNorm;