// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#define UKI60826 //GG_161199 Use the requested selection color instead of default
-
-#define IMP280200 //GG Don't returns a NULL shape in SelectedShape()
-// method when the current selected is a shape !
-
-#define BUC60814 //GG_300101 Idem UKI60826
-
-#define OCC138 //VTN Avoding infinit loop in AddOrRemoveCurrentObject method.
-
-#define OCC9657
-
#include <AIS_InteractiveContext.jxx>
#include <SelectMgr_EntityOwner.hxx>
+#include <StdSelect_ViewerSelector3d.hxx>
#include <AIS_Selection.hxx>
#include <AIS_StatusOfDetection.hxx>
#include <AIS_StatusOfPick.hxx>
#include <V3d_SpotLight.hxx>
#include <V3d_DirectionalLight.hxx>
#include <V3d_AmbientLight.hxx>
+#include <Visual3d_View.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <SelectMgr_Selection.hxx>
#include <Prs3d_Presentation.hxx>
-#ifdef OCC9657
#include <AIS_MapOfInteractive.hxx>
#include <AIS_MapIteratorOfMapOfInteractive.hxx>
-#endif
+#include <AIS_InteractiveObject.hxx>
//=======================================================================
//function : MoveTo
AIS_StatusOfDetection aStatus = AIS_SOD_Nothing;
Standard_Boolean toUpdateViewer = Standard_False;
- // allonzy
+ myFilters->SetDisabledObjects (theView->View()->HiddenObjects());
myMainSel->Pick (theXPix, theYPix, theView);
// filling of myAISDetectedSeq sequence storing information about detected AIS objects
Standard_Boolean HasHiCol;
if(IsHilighted(anIObj,HasHiCol,HiCol)){
if(HasHiCol && HiCol!= mySelectionColor) {
-#ifdef UKI60826
HilightWithColor(anIObj,mySelectionColor,updateviewer);
-#else
- Hilight(anIObj,updateviewer);
-#endif
}
}
return;
sel->Init();
while (sel->More()) {
TR = sel->Value();
- IO = *((Handle(AIS_InteractiveObject)*)&TR);
+ IO = Handle(AIS_InteractiveObject)::DownCast (TR);
Unhilight(IO,Standard_False);
IO->State(0);
sel->Next();
Standard_Boolean HasHiCol;
if(IsHilighted(anIObj,HasHiCol,HiCol)){
if(HasHiCol && HiCol!= mySelectionColor) {
-#ifdef UKI60826
HilightWithColor(anIObj,mySelectionColor,Standard_False);
-#else
- Hilight(anIObj,Standard_False);
-#endif
}
}
else{
-#ifdef UKI60826
HilightWithColor(anIObj,mySelectionColor,Standard_False);
-#else
- Hilight(anIObj,Standard_False);
-#endif
}
if (updateviewer)
UpdateCurrentViewer();
}
else{
-#ifdef AIS_DEB
+#ifdef OCCT_DEBUG
cout<<"Nothing Done : Opened Local Context"<<endl;
#endif
}
Standard_Integer mod = (SelStat==AIS_SS_Added) ? 1 : 0;
anIObj->State(mod);
if(mod==1)
-#ifdef BUC60814
HilightWithColor(anIObj,mySelectionColor,Standard_False);
-#else
- Hilight(anIObj,Standard_False);
-#endif
else
Unhilight(anIObj,Standard_False);
UpdateCurrentViewer();
}
else{
-#ifdef AIS_DEB
+#ifdef OCCT_DEBUG
cout<<"Nothing Done : Opened Local Context"<<endl;
#endif
}
Handle(AIS_InteractiveObject) AIS_InteractiveContext::Current() const
{
Handle(Standard_Transient) TR = AIS_Selection::Selection(myCurrentName.ToCString())->Value();
- Handle(AIS_InteractiveObject) IO = *((Handle(AIS_InteractiveObject)*)&TR);
+ Handle(AIS_InteractiveObject) IO = Handle(AIS_InteractiveObject)::DownCast (TR);
return IO;
}
sel->Init();
while (sel->More()) {
TR = sel->Value();
- IO = *((Handle(AIS_InteractiveObject)*)&TR);
-#ifdef BUC60814
+ IO = Handle(AIS_InteractiveObject)::DownCast (TR);
HilightWithColor(IO,mySelectionColor,Standard_False);
-#else
- Hilight(IO,Standard_False);
-#endif
sel->Next();
}
if(updateviewer)
sel->Init();
while (sel->More()) {
TR = sel->Value();
- IO = *((Handle(AIS_InteractiveObject)*)&TR);
+ IO = Handle(AIS_InteractiveObject)::DownCast (TR);
Unhilight(IO,Standard_False);
sel->Next();
}
Handle(AIS_InteractiveObject) IO;
for(S->Init();S->More();S->Next()){
Tr = S->Value();
- IO = (*((Handle(AIS_InteractiveObject)*)&Tr));
+ IO = Handle(AIS_InteractiveObject)::DownCast (Tr);
IO->State(0);
Unhilight(IO,Standard_False);
}
sel->Init();
while (sel->More()) {
TR = sel->Value();
- IO = *((Handle(AIS_InteractiveObject)*)&TR);
-#ifdef BUC60814
+ IO = Handle(AIS_InteractiveObject)::DownCast (TR);
HilightWithColor(IO,mySelectionColor,Standard_False);
-#else
- Hilight(IO,Standard_False);
-#endif
sel->Next();
}
}
sel->Init();
while (sel->More()) {
TR = sel->Value();
- IO = *((Handle(AIS_InteractiveObject)*)&TR);
+ IO = Handle(AIS_InteractiveObject)::DownCast (TR);
Unhilight(IO,Standard_False);
sel->Next();
}
{
-#ifdef AIS_DEB
+#ifdef OCCT_DEBUG
cout<<"Not Yet Implemented"<<endl;
#endif
}
const Standard_Boolean updateviewer)
{
if(!HasOpenedContext()) {
-#ifdef AIS_DEB
+#ifdef OCCT_DEBUG
cout<<" Attempt to remove a selected shape with no opened local context"<<endl;
#endif
return;
const Standard_Boolean updateviewer)
{
if(!HasOpenedContext()) {
-#ifdef AIS_DEB
+#ifdef OCCT_DEBUG
cout<<" Attempt to remove a selected ownr with no opened local context"<<endl;
#endif
return;
Standard_Boolean AIS_InteractiveContext::HasSelectedShape() const
{
if(!HasOpenedContext()) {
-#ifdef IMP280200
Handle(AIS_Shape) shape =
Handle(AIS_Shape)::DownCast(SelectedInteractive());
if( !shape.IsNull() ) return Standard_True;
-#endif
return Standard_False;
}
- return myLocalContexts(myCurLocalIndex)->HasShape();
-
-
+ return myLocalContexts(myCurLocalIndex)->HasSelectedShape();
}
//=======================================================================
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (SelectedInteractive());
if (!aShape.IsNull())
{
- aResShape = aShape->Shape().Located (TopLoc_Location (SelectedInteractive()->Transformation()) * aShape->Shape().Location());
+ TopLoc_Location aLocTrsf = SelectedInteractive()->Transformation().Form() == gp_Identity ?
+ TopLoc_Location() : TopLoc_Location (SelectedInteractive()->Transformation());
+ aResShape = aShape->Shape().Located (aLocTrsf * aShape->Shape().Location());
}
return aResShape;
Handle(AIS_InteractiveObject) AIS_InteractiveContext::SelectedInteractive() const
{
if(!HasOpenedContext()){
+ if (AIS_Selection::Selection(myCurrentName.ToCString())->Extent() == 0)
+ return NULL;
Handle(Standard_Transient) TR =AIS_Selection::Selection(myCurrentName.ToCString())->Value();
- Handle(AIS_InteractiveObject) IO = *((Handle(AIS_InteractiveObject)*)&TR);
+ Handle(AIS_InteractiveObject) IO = Handle(AIS_InteractiveObject)::DownCast (TR);
return IO;}
return myLocalContexts(myCurLocalIndex)->SelectedInteractive();
//function : EntityOwners
//purpose :
//=======================================================================
-void AIS_InteractiveContext::EntityOwners(SelectMgr_IndexedMapOfOwner& theOwners,
+void AIS_InteractiveContext::EntityOwners(Handle(SelectMgr_IndexedMapOfOwner)& theOwners,
const Handle(AIS_InteractiveObject)& theIObj,
const Standard_Integer theMode) const
{
else
aModes.Append( theMode );
+ if (theOwners.IsNull())
+ theOwners = new SelectMgr_IndexedMapOfOwner();
+
TColStd_ListIteratorOfListOfInteger anItr( aModes );
for (; anItr.More(); anItr.Next() )
{
if ( !theIObj->HasSelection( aMode ) )
continue;
- Handle(SelectMgr_Selection) aSel = theIObj->Selection( aMode );
+ Handle(SelectMgr_Selection) aSel = theIObj->Selection(aMode);
for ( aSel->Init(); aSel->More(); aSel->Next() )
{
- Handle(SelectBasics_SensitiveEntity) aEntity = aSel->Sensitive();
+ Handle(SelectBasics_SensitiveEntity) aEntity = aSel->Sensitive()->BaseSensitive();
if ( aEntity.IsNull() )
continue;
Handle(SelectMgr_EntityOwner) aOwner =
Handle(SelectMgr_EntityOwner)::DownCast(aEntity->OwnerId());
if ( !aOwner.IsNull() )
- theOwners.Add( aOwner );
+ theOwners->Add( aOwner );
}
}
}