mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-29 23:20:33 +05:00
Merge commits, bring-to-front, show/hide all
This commit is contained in:
parent
675ca69b6d
commit
45a135f45f
@ -22,7 +22,9 @@
|
|||||||
#include <GEOMGUI_AnnotationAttrs.h>
|
#include <GEOMGUI_AnnotationAttrs.h>
|
||||||
#include <GEOM_Annotation.hxx>
|
#include <GEOM_Annotation.hxx>
|
||||||
#include <GEOM_Client.hxx>
|
#include <GEOM_Client.hxx>
|
||||||
|
#include <GEOM_Constants.h>
|
||||||
#include <GEOM_Displayer.h>
|
#include <GEOM_Displayer.h>
|
||||||
|
|
||||||
#include <GeometryGUI.h>
|
#include <GeometryGUI.h>
|
||||||
|
|
||||||
#include <SalomeApp_Application.h>
|
#include <SalomeApp_Application.h>
|
||||||
@ -65,6 +67,7 @@ QString GEOMGUI_AnnotationMgr::GetEntrySeparator()
|
|||||||
//================================================================
|
//================================================================
|
||||||
SALOME_Prs* GEOMGUI_AnnotationMgr::CreatePresentation( const GEOMGUI_AnnotationAttrs::Properties& theProperty,
|
SALOME_Prs* GEOMGUI_AnnotationMgr::CreatePresentation( const GEOMGUI_AnnotationAttrs::Properties& theProperty,
|
||||||
GEOM::GEOM_Object_ptr theObject,
|
GEOM::GEOM_Object_ptr theObject,
|
||||||
|
SALOME_View* theView,
|
||||||
const QString& theEntry )
|
const QString& theEntry )
|
||||||
{
|
{
|
||||||
Handle ( GEOM_Annotation ) aPresentation = new GEOM_Annotation();
|
Handle ( GEOM_Annotation ) aPresentation = new GEOM_Annotation();
|
||||||
@ -104,6 +107,19 @@ SALOME_Prs* GEOMGUI_AnnotationMgr::CreatePresentation( const GEOMGUI_AnnotationA
|
|||||||
gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() );
|
gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() );
|
||||||
GEOMGUI_AnnotationAttrs::SetupPresentation( aPresentation, theProperty, aShapeLCS );
|
GEOMGUI_AnnotationAttrs::SetupPresentation( aPresentation, theProperty, aShapeLCS );
|
||||||
|
|
||||||
|
SALOME_View* aView = viewOrActiveView( theView );
|
||||||
|
if ( aView ) {
|
||||||
|
|
||||||
|
// set top-level flag correspondingly
|
||||||
|
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApplication()->activeStudy() );
|
||||||
|
int aMgrId = dynamic_cast< SUIT_ViewModel* >( aView )->getViewManager()->getGlobalId();
|
||||||
|
QVariant aVal = aStudy->getObjectProperty( aMgrId, QString( getEntry( theObject ).c_str() ), GEOM::propertyName( GEOM::TopLevel ), QVariant() );
|
||||||
|
bool isBringToFront = aVal.isValid() ? aVal.toBool() : false;
|
||||||
|
if( isBringToFront ) {
|
||||||
|
aPresentation->SetZLayer( Graphic3d_ZLayerId_Topmost );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// add Prs to preview
|
// add Prs to preview
|
||||||
SUIT_ViewWindow* vw = getApplication()->desktop()->activeWindow();
|
SUIT_ViewWindow* vw = getApplication()->desktop()->activeWindow();
|
||||||
SOCC_Prs* aPrs =
|
SOCC_Prs* aPrs =
|
||||||
@ -153,7 +169,7 @@ void GEOMGUI_AnnotationMgr::Display( const QString& theEntry, const int theIndex
|
|||||||
|
|
||||||
// display presentation in the viewer
|
// display presentation in the viewer
|
||||||
QString anEntry = QString("%1%2%3").arg(theEntry).arg(GetEntrySeparator()).arg(theIndex);
|
QString anEntry = QString("%1%2%3").arg(theEntry).arg(GetEntrySeparator()).arg(theIndex);
|
||||||
SALOME_Prs* aPrs = CreatePresentation( aProperty, anObject, anEntry );
|
SALOME_Prs* aPrs = CreatePresentation( aProperty, anObject, aView, anEntry );
|
||||||
aView->Display( getDisplayer(), aPrs );
|
aView->Display( getDisplayer(), aPrs );
|
||||||
getDisplayer()->UpdateViewer();
|
getDisplayer()->UpdateViewer();
|
||||||
|
|
||||||
@ -170,7 +186,7 @@ void GEOMGUI_AnnotationMgr::Display( const QString& theEntry, const int theIndex
|
|||||||
myVisualized[aView] = anEntryToMap;
|
myVisualized[aView] = anEntryToMap;
|
||||||
|
|
||||||
// change persistent for the entry: set visible state in true for indices which presentations are shown
|
// change persistent for the entry: set visible state in true for indices which presentations are shown
|
||||||
storeVisibleState( theEntry, theView, theIndex );
|
storeVisibleState( theEntry, theView );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOMGUI_AnnotationMgr::Erase( const QString& theEntry, const int theIndex, SALOME_View* theView )
|
void GEOMGUI_AnnotationMgr::Erase( const QString& theEntry, const int theIndex, SALOME_View* theView )
|
||||||
@ -207,7 +223,7 @@ void GEOMGUI_AnnotationMgr::Erase( const QString& theEntry, const int theIndex,
|
|||||||
myVisualized[aView] = anEntryToAnnotation;
|
myVisualized[aView] = anEntryToAnnotation;
|
||||||
|
|
||||||
// change persistent for the entry: set visible state in true for indices which presentations are shown
|
// change persistent for the entry: set visible state in true for indices which presentations are shown
|
||||||
storeVisibleState( theEntry, theView, theIndex );
|
storeVisibleState( theEntry, theView );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOMGUI_AnnotationMgr::DisplayVisibleAnnotations( const QString& theEntry, SALOME_View* theView )
|
void GEOMGUI_AnnotationMgr::DisplayVisibleAnnotations( const QString& theEntry, SALOME_View* theView )
|
||||||
@ -217,9 +233,14 @@ void GEOMGUI_AnnotationMgr::DisplayVisibleAnnotations( const QString& theEntry,
|
|||||||
const Handle(GEOMGUI_AnnotationAttrs) aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
|
const Handle(GEOMGUI_AnnotationAttrs) aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
|
||||||
if ( !aShapeAnnotations.IsNull() ) {
|
if ( !aShapeAnnotations.IsNull() ) {
|
||||||
const int aCount = aShapeAnnotations->GetNbAnnotation();
|
const int aCount = aShapeAnnotations->GetNbAnnotation();
|
||||||
|
std::vector<bool> isVisible( aCount );
|
||||||
for ( int anIndex = 0; anIndex < aCount; ++anIndex )
|
for ( int anIndex = 0; anIndex < aCount; ++anIndex )
|
||||||
{
|
{
|
||||||
if ( aShapeAnnotations->GetIsVisible( anIndex ) )
|
isVisible[anIndex] = aShapeAnnotations->GetIsVisible( anIndex );
|
||||||
|
}
|
||||||
|
for ( int anIndex = 0; anIndex < aCount; ++anIndex )
|
||||||
|
{
|
||||||
|
if ( isVisible[anIndex] )
|
||||||
Display( theEntry, anIndex, theView );
|
Display( theEntry, anIndex, theView );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -409,7 +430,7 @@ void GEOMGUI_AnnotationMgr::getObject( const QString& theEntry, const int theInd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOMGUI_AnnotationMgr::storeVisibleState( const QString& theEntry, SALOME_View* theView, const int theIndex )
|
void GEOMGUI_AnnotationMgr::storeVisibleState( const QString& theEntry, SALOME_View* theView )
|
||||||
{
|
{
|
||||||
SALOME_View* aView = viewOrActiveView( theView );
|
SALOME_View* aView = viewOrActiveView( theView );
|
||||||
if ( !aView || !myVisualized.contains( aView ) )
|
if ( !aView || !myVisualized.contains( aView ) )
|
||||||
@ -424,14 +445,15 @@ void GEOMGUI_AnnotationMgr::storeVisibleState( const QString& theEntry, SALOME_V
|
|||||||
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApplication()->activeStudy() );
|
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApplication()->activeStudy() );
|
||||||
_PTR(SObject) aSObj = aStudy->studyDS()->FindObjectID( theEntry.toStdString() );
|
_PTR(SObject) aSObj = aStudy->studyDS()->FindObjectID( theEntry.toStdString() );
|
||||||
const Handle(GEOMGUI_AnnotationAttrs) aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
|
const Handle(GEOMGUI_AnnotationAttrs) aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
|
||||||
if ( !aShapeAnnotations.IsNull() ) {
|
if ( !aShapeAnnotations.IsNull() ) {
|
||||||
|
const int aCount = aShapeAnnotations->GetNbAnnotation();
|
||||||
bool aVisible = anAnnotationToPrs.contains( theIndex );
|
for ( int anIndex = 0; anIndex < aCount; ++anIndex ) {
|
||||||
aShapeAnnotations->SetIsVisible( theIndex, aVisible );
|
bool aVisible = anAnnotationToPrs.contains( anIndex );
|
||||||
|
aShapeAnnotations->SetIsVisible( anIndex, aVisible );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : GEOMGUI_AnnotationMgr::getEntry
|
// function : GEOMGUI_AnnotationMgr::getEntry
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include <SALOME_InteractiveObject.hxx>
|
#include <SALOME_InteractiveObject.hxx>
|
||||||
|
|
||||||
class SalomeApp_Application;
|
class SalomeApp_Application;
|
||||||
class GEOM_Annotation;
|
|
||||||
class GEOM_Displayer;
|
class GEOM_Displayer;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -52,7 +51,9 @@ public:
|
|||||||
static QString GetEntrySeparator();
|
static QString GetEntrySeparator();
|
||||||
|
|
||||||
SALOME_Prs* CreatePresentation( const GEOMGUI_AnnotationAttrs::Properties& theProperty,
|
SALOME_Prs* CreatePresentation( const GEOMGUI_AnnotationAttrs::Properties& theProperty,
|
||||||
GEOM::GEOM_Object_ptr theObject, const QString& theEntry = QString() );
|
GEOM::GEOM_Object_ptr theObject,
|
||||||
|
SALOME_View* theView = 0,
|
||||||
|
const QString& theEntry = QString() );
|
||||||
|
|
||||||
bool IsDisplayed( const QString& theEntry, const int theIndex, SALOME_View* theView = 0 ) const;
|
bool IsDisplayed( const QString& theEntry, const int theIndex, SALOME_View* theView = 0 ) const;
|
||||||
void Display( const QString& theEntry, const int theIndex, SALOME_View* theView = 0 );
|
void Display( const QString& theEntry, const int theIndex, SALOME_View* theView = 0 );
|
||||||
@ -85,16 +86,12 @@ protected:
|
|||||||
GEOM::GEOM_Object_ptr& anObject,
|
GEOM::GEOM_Object_ptr& anObject,
|
||||||
GEOMGUI_AnnotationAttrs::Properties& aProperty );
|
GEOMGUI_AnnotationAttrs::Properties& aProperty );
|
||||||
|
|
||||||
void storeVisibleState( const QString& theEntry, SALOME_View* theView, const int theIndex );
|
void storeVisibleState( const QString& theEntry, SALOME_View* theView );
|
||||||
|
|
||||||
std::string getEntry( const GEOM::GEOM_Object_ptr theObject );
|
std::string getEntry( const GEOM::GEOM_Object_ptr theObject );
|
||||||
|
|
||||||
std::string getName( const GEOM::GEOM_Object_ptr theObject );
|
std::string getName( const GEOM::GEOM_Object_ptr theObject );
|
||||||
|
|
||||||
void setAISProperties( const Handle(GEOM_Annotation)& thePresentation,
|
|
||||||
const GEOMGUI_AnnotationAttrs::Properties& theProperty,
|
|
||||||
const gp_Ax3& theLCS );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SalomeApp_Application* myApplication;
|
SalomeApp_Application* myApplication;
|
||||||
|
|
||||||
|
17
src/MeasureGUI/MeasureGUI.cxx
Normal file → Executable file
17
src/MeasureGUI/MeasureGUI.cxx
Normal file → Executable file
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include <GEOMGUI_DimensionProperty.h>
|
#include <GEOMGUI_DimensionProperty.h>
|
||||||
#include <GEOMGUI_AnnotationAttrs.h>
|
#include <GEOMGUI_AnnotationAttrs.h>
|
||||||
|
#include <GEOMGUI_AnnotationMgr.h>
|
||||||
|
|
||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
#include <SUIT_OverrideCursor.h>
|
#include <SUIT_OverrideCursor.h>
|
||||||
@ -231,13 +232,16 @@ void MeasureGUI::ChangeAnnotationsVisibility( const bool theIsVisible )
|
|||||||
|| !anIObject->hasEntry() )
|
|| !anIObject->hasEntry() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_PTR(SObject) aSObj = anActiveStudy->studyDS()->FindObjectID( anIObject->getEntry() );
|
const QString aEntry = anIObject->getEntry(),c_str();
|
||||||
|
|
||||||
|
_PTR(SObject) aSObj = anActiveStudy->studyDS()->FindObjectID( aEntry.toStdString() );
|
||||||
|
|
||||||
const Handle(GEOMGUI_AnnotationAttrs)
|
const Handle(GEOMGUI_AnnotationAttrs)
|
||||||
aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
|
aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
|
||||||
|
|
||||||
if ( aShapeAnnotations.IsNull() )
|
if ( aShapeAnnotations.IsNull() ) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const int aCount = aShapeAnnotations->GetNbAnnotation();
|
const int aCount = aShapeAnnotations->GetNbAnnotation();
|
||||||
|
|
||||||
@ -247,10 +251,13 @@ void MeasureGUI::ChangeAnnotationsVisibility( const bool theIsVisible )
|
|||||||
|
|
||||||
for ( int anI = 0; anI <= aCount; ++anI ) {
|
for ( int anI = 0; anI <= aCount; ++anI ) {
|
||||||
|
|
||||||
aShapeAnnotations->SetIsVisible( anI, theIsVisible );
|
if ( !theIsVisible ) {
|
||||||
|
getGeometryGUI()->GetAnnotationMgr()->Erase( aEntry, anI );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
getGeometryGUI()->GetAnnotationMgr()->Display( aEntry , anI );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GEOM_Displayer( anActiveStudy ).Redisplay( anIObject, true );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,10 +439,6 @@ void MeasureGUI_AnnotationDlg::SelectionIntoArgument()
|
|||||||
|
|
||||||
hasAttachPoint = true;
|
hasAttachPoint = true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
|
||||||
myIsPositionDefined = false;
|
|
||||||
}
|
|
||||||
} else if ( myEditCurrentArgument == mySubShapeName ) {
|
} else if ( myEditCurrentArgument == mySubShapeName ) {
|
||||||
if ( !myShape->_is_nil() ) {
|
if ( !myShape->_is_nil() ) {
|
||||||
|
|
||||||
@ -474,13 +470,8 @@ void MeasureGUI_AnnotationDlg::SelectionIntoArgument()
|
|||||||
|
|
||||||
anAttachPoint = getAttachPoint( aSubShape );
|
anAttachPoint = getAttachPoint( aSubShape );
|
||||||
}
|
}
|
||||||
|
|
||||||
hasAttachPoint = true;
|
hasAttachPoint = true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
|
||||||
myIsPositionDefined = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
myAnnotationProperties.ShapeIndex = aSubShapeIndex;
|
myAnnotationProperties.ShapeIndex = aSubShapeIndex;
|
||||||
@ -506,6 +497,10 @@ void MeasureGUI_AnnotationDlg::SelectionIntoArgument()
|
|||||||
|
|
||||||
myIsPositionDefined = true;
|
myIsPositionDefined = true;
|
||||||
}
|
}
|
||||||
|
else if ( !hasAttachPoint ) {
|
||||||
|
|
||||||
|
myIsPositionDefined = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
redisplayPreview();
|
redisplayPreview();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user