myCurLocalIndex(0),
myCurDetected(0),
myCurHighlighted(0),
+myPickingStrategy (SelectMgr_PickingStrategy_FirstAcceptable),
myIsAutoActivateSelMode(Standard_True)
{
myStyles[Prs3d_TypeOfHighlight_None] = myDefaultDrawer;
{
if (theIObj->myCTXPtr != this)
{
- Standard_ProgramError::Raise ("AIS_InteractiveContext - object has been displayed in another context!");
+ throw Standard_ProgramError("AIS_InteractiveContext - object has been displayed in another context!");
}
theIObj->SetContext (Handle(AIS_InteractiveContext)());
}
}
}
-//=======================================================================
-//function : SetColor
-//purpose :
-//=======================================================================
-void AIS_InteractiveContext::SetColor (const Handle(AIS_InteractiveObject)& theIObj,
- const Quantity_NameOfColor theColor,
- const Standard_Boolean theToUpdateViewer)
-{
- SetColor (theIObj, Quantity_Color(theColor), theToUpdateViewer);
-}
-
//=======================================================================
//function : SetColor
//purpose :
return theIObj->HasColor();
}
-//=======================================================================
-//function : Color
-//purpose :
-//=======================================================================
-Quantity_NameOfColor AIS_InteractiveContext::Color (const Handle(AIS_InteractiveObject)& theIObj) const
-{
- return theIObj->Color();
-}
-
//=======================================================================
//function : Color
//purpose :
//purpose :
//=======================================================================
void AIS_InteractiveContext::SetMaterial (const Handle(AIS_InteractiveObject)& theIObj,
- const Graphic3d_NameOfMaterial theName,
+ const Graphic3d_MaterialAspect& theMaterial,
const Standard_Boolean theToUpdateViewer)
{
if (theIObj.IsNull())
}
setContextToObject (theIObj);
- theIObj->SetMaterial (theName);
+ theIObj->SetMaterial (theMaterial);
redisplayPrsRecModes (theIObj, theToUpdateViewer);
}
//purpose :
//=======================================================================
void AIS_InteractiveContext::SetSelectedAspect (const Handle(Prs3d_BasicAspect)& theAspect,
- const Standard_Boolean ,
const Standard_Boolean theToUpdateViewer)
{
if (HasOpenedContext())
// Object removes from Detected sequence
Standard_DISABLE_DEPRECATION_WARNINGS
- for (Standard_Integer aDetIter = myDetectedSeq.Lower(); aDetIter <= myDetectedSeq.Upper(); ++aDetIter)
+ for (Standard_Integer aDetIter = myDetectedSeq.Lower(); aDetIter <= myDetectedSeq.Upper();)
{
- Handle(AIS_InteractiveObject) anObj = DetectedCurrentObject();
+ Handle(SelectMgr_EntityOwner) aPicked = myMainSel->Picked (myDetectedSeq (aDetIter));
+ Handle(AIS_InteractiveObject) anObj;
+ if (!aPicked.IsNull())
+ {
+ anObj = Handle(AIS_InteractiveObject)::DownCast (aPicked->Selectable());
+ }
+
if (!anObj.IsNull()
- && anObj != theIObj)
+ && anObj == theIObj)
{
myDetectedSeq.Remove (aDetIter);
+ if (myCurDetected == aDetIter)
+ {
+ myCurDetected = Min (myDetectedSeq.Upper(), aDetIter);
+ }
+ if (myCurHighlighted == aDetIter)
+ {
+ myCurHighlighted = 0;
+ }
+ }
+ else
+ {
+ aDetIter++;
}
}
Standard_ENABLE_DEPRECATION_WARNINGS
{
clearDynamicHighlight();
myLastinMain.Nullify();
+ myLastPicked.Nullify();
}
}
Handle(Prs3d_DatumAspect) aTrihAspect = myDefaultDrawer->DatumAspect();
const Standard_Real aLength = 100.0;
aTrihAspect->SetAxisLength (aLength, aLength, aLength);
- const Quantity_NameOfColor aColor = Quantity_NOC_LIGHTSTEELBLUE4;
- aTrihAspect->FirstAxisAspect() ->SetColor (aColor);
- aTrihAspect->SecondAxisAspect()->SetColor (aColor);
- aTrihAspect->ThirdAxisAspect() ->SetColor (aColor);
+ const Quantity_Color aColor = Quantity_NOC_LIGHTSTEELBLUE4;
+ aTrihAspect->LineAspect(Prs3d_DP_XAxis)->SetColor (aColor);
+ aTrihAspect->LineAspect(Prs3d_DP_YAxis)->SetColor (aColor);
+ aTrihAspect->LineAspect(Prs3d_DP_ZAxis)->SetColor (aColor);
Handle(Prs3d_PlaneAspect) aPlaneAspect = myDefaultDrawer->PlaneAspect();
const Standard_Real aPlaneLength = 200.0;
//=======================================================================
Standard_Real AIS_InteractiveContext::TrihedronSize() const
{
- return myDefaultDrawer->DatumAspect()->FirstAxisLength();
+ return myDefaultDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis);
}
//=======================================================================
//=======================================================================
void AIS_InteractiveContext::SetPlaneSize(const Standard_Real theValX,
const Standard_Real theValY,
- const Standard_Boolean /*updateviewer*/)
+ const Standard_Boolean theToUpdateViewer)
{
myDefaultDrawer->PlaneAspect()->SetPlaneLength (theValX, theValY);
- Redisplay (AIS_KOI_Datum, 7);
+ Redisplay (AIS_KOI_Datum, 7, theToUpdateViewer);
}
//=======================================================================
return;
}
+//=======================================================================
+//function : FitSelected
+//purpose : Fits the view corresponding to the bounds of selected objects
+//=======================================================================
+void AIS_InteractiveContext::FitSelected (const Handle(V3d_View)& theView)
+{
+ FitSelected (theView, 0.01, Standard_True);
+}
+
//=======================================================================
//function : FitSelected
//purpose : Fits the view corresponding to the bounds of selected objects