1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0025335: Visualization - method ::SelectedShape() in AIS_LocalContext and AIS_InteractiveContext overrides shape transformation

Shape location overriding fixed by combining AIS object transformation and shape location.
Also incorrect highlight presentation (and sensitive) placement was possible.
This commit is contained in:
duv
2014-10-08 13:01:51 +04:00
committed by bugmaster
parent de6f281fe9
commit d81101039f
5 changed files with 89 additions and 15 deletions

View File

@@ -4079,6 +4079,54 @@ static int VPickShape( Draw_Interpretor& di, Standard_Integer argc, const char**
return 0;
}
//=======================================================================
//function : VPickSelected
//purpose :
//=======================================================================
static int VPickSelected (Draw_Interpretor& , Standard_Integer theArgNb, const char** theArgs)
{
static Standard_Integer aCount = 0;
TCollection_AsciiString aName = "PickedShape_";
if (theArgNb > 1)
{
aName = theArgs[1];
}
else
{
aName = aName + aCount++ + "_";
}
Standard_Integer anIdx = 0;
for (TheAISContext()->InitSelected(); TheAISContext()->MoreSelected(); TheAISContext()->NextSelected(), ++anIdx)
{
TopoDS_Shape aShape;
if (TheAISContext()->HasSelectedShape())
{
aShape = TheAISContext()->SelectedShape();
}
else
{
Handle(AIS_InteractiveObject) IO = TheAISContext()->SelectedInteractive();
aShape = (*((Handle(AIS_Shape)*) &IO))->Shape();
}
TCollection_AsciiString aCurrentName = aName;
if (anIdx > 0)
{
aCurrentName += anIdx;
}
DBRep::Set ((aCurrentName).ToCString(), aShape);
Handle(AIS_Shape) aNewShape = new AIS_Shape (aShape);
GetMapOfAIS().Bind (aNewShape, aCurrentName);
TheAISContext()->Display (aNewShape);
}
return 0;
}
//=======================================================================
//function : list of known objects
//purpose :
@@ -4636,6 +4684,9 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
theCommands.Add("vr", "vr : reading of the shape",
__FILE__,vr, group);
theCommands.Add("vpickselected", "vpickselected [name]: extract selected shape.",
__FILE__, VPickSelected, group);
}
//=====================================================================