HYDROGUI_ZLevelsOp.h
HYDROGUI_OrderedListWidget.h
HYDROGUI_ListSelector.h
+ HYDROGUI_ZLayers.h
)
QT4_WRAP_CPP(PROJECT_HEADERS_MOC ${PROJECT_HEADERS})
HYDROGUI_ZLevelsOp.cxx
HYDROGUI_OrderedListWidget.cxx
HYDROGUI_ListSelector.cxx
+ HYDROGUI_ZLayers.cxx
+ HYDROGUI_ZLayers2.cxx
)
add_definitions(
#include "HYDROGUI_Shape.h"
#include "HYDROGUI_Operation.h"
#include "HYDROGUI_DataObject.h"
+#include "HYDROGUI_ZLayers.h"
#include <AIS_InteractiveContext.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
aHOp->updatePreviewZLayer( aLayerId );
}
+ HYDROGUI_ZLayersIterator anIt( aViewer->getViewer3d() );
+ int aMaxLayer = anIt.MaxLayer();
+ UpdateZLayersOfHilightPresentationsOfDisplayedObjects( aCtx, aMaxLayer );
+
if ( theDoFitAll )
{
OCCViewer_ViewManager* aViewManager
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <HYDROGUI_ZLayers.h>
+#include <PrsMgr_PresentableObject.hxx>
+#include <PrsMgr_ModedPresentation.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
+
+class PrsMgr_PresentationManager
+{
+public:
+ static void SetZLayer( const Handle_PrsMgr_PresentableObject& thePresentableObject,
+ const Standard_Integer theMode,
+ const Standard_Integer theLayerId )
+ {
+ PrsMgr_Presentations& aPresentations = thePresentableObject->Presentations();
+ for (Standard_Integer aIdx = 1; aIdx <= aPresentations.Length (); aIdx++)
+ {
+ Handle(PrsMgr_Presentation) aPrs = aPresentations (aIdx).Presentation ();
+ if ( aPresentations (aIdx).Mode() == theMode )
+ aPrs->SetZLayer (theLayerId);
+ }
+ }
+};
+
+void SetPrsZLayer( const Handle_PrsMgr_PresentableObject& thePresentableObject,
+ const int theMode, const int theLayerId )
+{
+ PrsMgr_PresentationManager::SetZLayer( thePresentableObject, theMode, theLayerId );
+}
+
+HYDROGUI_ZLayersIterator::HYDROGUI_ZLayersIterator( const Handle_V3d_Viewer& theViewer )
+ : myIndex( 0 ), myNewZLayer( -1 ), myViewer( theViewer )
+{
+ Init( theViewer );
+}
+
+HYDROGUI_ZLayersIterator::~HYDROGUI_ZLayersIterator()
+{
+}
+
+void HYDROGUI_ZLayersIterator::Init( const Handle_V3d_Viewer& theViewer )
+{
+ TColStd_SequenceOfInteger anExistingZLayers;
+ theViewer->GetAllZLayers( anExistingZLayers );
+
+ int n = anExistingZLayers.Length();
+ myZLayers.resize( n );
+ for( int i=1; i<=n; i++ )
+ myZLayers[i-1] = anExistingZLayers( i );
+
+ myIndex = 0;
+}
+
+bool HYDROGUI_ZLayersIterator::More() const
+{
+ return myIndex <= (int)myZLayers.size() || myNewZLayer >= 0;
+}
+
+void HYDROGUI_ZLayersIterator::Next()
+{
+ if( myIndex < (int)myZLayers.size() )
+ myIndex++;
+ else if( !myViewer.IsNull() )
+ {
+ bool isOK = myViewer->AddZLayer( myNewZLayer )==Standard_True;
+ if( !isOK )
+ myNewZLayer = -1;
+ }
+}
+
+int HYDROGUI_ZLayersIterator::MaxLayer() const
+{
+ int aMaxLayer = -1;
+ for( int i=0, n=myZLayers.size(); i<n; i++ )
+ if( myZLayers[i] > aMaxLayer )
+ aMaxLayer = myZLayers[i];
+ return aMaxLayer;
+}
+
+
+int HYDROGUI_ZLayersIterator::LayerId() const
+{
+ if( More() )
+ return myZLayers[myIndex];
+ else
+ return myNewZLayer;
+}
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef HYDROGUI_ZLAYERS_H
+#define HYDROGUI_ZLAYERS_H
+
+#include <vector>
+#include <V3d_Viewer.hxx>
+
+class Handle_PrsMgr_PresentableObject;
+class Handle_AIS_InteractiveContext;
+
+class HYDROGUI_ZLayersIterator
+{
+public:
+ HYDROGUI_ZLayersIterator( const Handle_V3d_Viewer& );
+ ~HYDROGUI_ZLayersIterator();
+
+ void Init( const Handle_V3d_Viewer& );
+ bool More() const;
+ void Next();
+ int LayerId() const;
+ int MaxLayer() const;
+
+private:
+ std::vector<int> myZLayers;
+ int myIndex;
+ int myNewZLayer;
+ Handle_V3d_Viewer myViewer;
+};
+
+void SetPrsZLayer( const Handle_PrsMgr_PresentableObject& thePresentableObject,
+ const int theMode, const int theLayerId );
+void UpdateZLayersOfHilightPresentationsOfDisplayedObjects( const Handle_AIS_InteractiveContext&, int theLayer );
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <HYDROGUI_ZLayers.h>
+#include <AIS_InteractiveContext.hxx>
+#include <AIS_InteractiveObject.hxx>
+#include <AIS_ListOfInteractive.hxx>
+#include <AIS_ListIteratorOfListOfInteractive.hxx>
+#include <PrsMgr_PresentationManager3d.hxx>
+
+void UpdateZLayersOfHilightPresentationsOfDisplayedObjects( const Handle_AIS_InteractiveContext& theContext,
+ int theLayer )
+{
+ AIS_ListOfInteractive aDisplayedObjects;
+ theContext->DisplayedObjects( aDisplayedObjects );
+
+ AIS_ListIteratorOfListOfInteractive aListIter( aDisplayedObjects );
+ for ( ; aListIter.More(); aListIter.Next() )
+ {
+ Handle(AIS_InteractiveObject) aPrsObj = aListIter.Value();
+ if( !aPrsObj.IsNull() )
+ {
+ theContext->MainPrsMgr()->Color( aPrsObj );
+ int aMode = 0;//aPrsObj->HilightMode();
+ SetPrsZLayer( aPrsObj, aMode, theLayer );
+ theContext->MainPrsMgr()->Unhighlight( aPrsObj, aMode );
+ }
+ }
+}