mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-15 04:10:33 +05:00
Port on IR-2016-11-02.
Bug in edit mode when switching 2D/3D. Preview for edit mode.
This commit is contained in:
parent
3d5732ec1d
commit
d448d82dba
@ -38,7 +38,6 @@
|
|||||||
#include <SUIT_ViewManager.h>
|
#include <SUIT_ViewManager.h>
|
||||||
|
|
||||||
#include <SOCC_Prs.h>
|
#include <SOCC_Prs.h>
|
||||||
#include <SOCC_ViewModel.h>
|
|
||||||
#include <SOCC_ViewWindow.h>
|
#include <SOCC_ViewWindow.h>
|
||||||
|
|
||||||
#include <Quantity_Color.hxx>
|
#include <Quantity_Color.hxx>
|
||||||
@ -68,9 +67,14 @@ 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,
|
SOCC_Viewer* theView,
|
||||||
const QString& theEntry )
|
const QString& theEntry )
|
||||||
{
|
{
|
||||||
|
SOCC_Viewer* aView = viewOrActiveView( theView );
|
||||||
|
if ( !aView ) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
Handle ( GEOM_Annotation ) aPresentation = new GEOM_Annotation();
|
Handle ( GEOM_Annotation ) aPresentation = new GEOM_Annotation();
|
||||||
if ( !theEntry.isEmpty() ) {
|
if ( !theEntry.isEmpty() ) {
|
||||||
// owner should be set to provide selection mechanizm
|
// owner should be set to provide selection mechanizm
|
||||||
@ -81,7 +85,7 @@ SALOME_Prs* GEOMGUI_AnnotationMgr::CreatePresentation( const GEOMGUI_AnnotationA
|
|||||||
|
|
||||||
aPresentation->SetIsScreenFixed( theProperty.IsScreenFixed );
|
aPresentation->SetIsScreenFixed( theProperty.IsScreenFixed );
|
||||||
|
|
||||||
setDisplayProperties( aPresentation, theView, getEntry( theObject ).c_str() );
|
setDisplayProperties( aPresentation, aView, getEntry( theObject ).c_str() );
|
||||||
|
|
||||||
TopoDS_Shape aShape = GEOM_Client::get_client().GetShape( GeometryGUI::GetGeomGen(), theObject );
|
TopoDS_Shape aShape = GEOM_Client::get_client().GetShape( GeometryGUI::GetGeomGen(), theObject );
|
||||||
gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() );
|
gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() );
|
||||||
@ -90,8 +94,7 @@ SALOME_Prs* GEOMGUI_AnnotationMgr::CreatePresentation( const GEOMGUI_AnnotationA
|
|||||||
// 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 =
|
||||||
dynamic_cast<SOCC_Prs*>( ( ( SOCC_Viewer* ) ( vw->getViewManager()->getViewModel() ) )->CreatePrs(
|
dynamic_cast<SOCC_Prs*>( ( aView )->CreatePrs( 0 ) );
|
||||||
0 ) );
|
|
||||||
|
|
||||||
if ( aPrs )
|
if ( aPrs )
|
||||||
aPrs->AddObject( aPresentation );
|
aPrs->AddObject( aPresentation );
|
||||||
@ -99,9 +102,9 @@ SALOME_Prs* GEOMGUI_AnnotationMgr::CreatePresentation( const GEOMGUI_AnnotationA
|
|||||||
return aPrs;
|
return aPrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GEOMGUI_AnnotationMgr::IsDisplayed( const QString& theEntry, const int theIndex, SALOME_View* theView ) const
|
bool GEOMGUI_AnnotationMgr::IsDisplayed( const QString& theEntry, const int theIndex, SOCC_Viewer* theView ) const
|
||||||
{
|
{
|
||||||
SALOME_View* aView = viewOrActiveView( theView );
|
SOCC_Viewer* aView = viewOrActiveView( theView );
|
||||||
if ( !aView || !myVisualized.contains( aView ) )
|
if ( !aView || !myVisualized.contains( aView ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -121,9 +124,9 @@ bool GEOMGUI_AnnotationMgr::IsDisplayed( const QString& theEntry, const int theI
|
|||||||
// purpose : Displays annotation shape presentation in view. It creates an annotation presentation
|
// purpose : Displays annotation shape presentation in view. It creates an annotation presentation
|
||||||
// and stores it in an internal container
|
// and stores it in an internal container
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void GEOMGUI_AnnotationMgr::Display( const QString& theEntry, const int theIndex, SALOME_View* theView )
|
void GEOMGUI_AnnotationMgr::Display( const QString& theEntry, const int theIndex, SOCC_Viewer* theView )
|
||||||
{
|
{
|
||||||
SALOME_View* aView = viewOrActiveView( theView );
|
SOCC_Viewer* aView = viewOrActiveView( theView );
|
||||||
if ( !aView )
|
if ( !aView )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -137,7 +140,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, aView, anEntry );
|
SALOME_Prs* aPrs = CreatePresentation( aProperty, anObject, aView, anEntry );
|
||||||
aView->Display( getDisplayer(), aPrs );
|
((SALOME_View*)aView)->Display( getDisplayer(), aPrs );
|
||||||
getDisplayer()->UpdateViewer();
|
getDisplayer()->UpdateViewer();
|
||||||
|
|
||||||
EntryToAnnotations anEntryToMap;
|
EntryToAnnotations anEntryToMap;
|
||||||
@ -175,7 +178,7 @@ void GEOMGUI_AnnotationMgr::Redisplay( const QString& theEntry, const int theInd
|
|||||||
SUIT_ViewModel* vmodel = vman->getViewModel();
|
SUIT_ViewModel* vmodel = vman->getViewModel();
|
||||||
if ( vmodel )
|
if ( vmodel )
|
||||||
{
|
{
|
||||||
SALOME_View* aView = dynamic_cast<SALOME_View*>(vmodel);
|
SOCC_Viewer* aView = dynamic_cast<SOCC_Viewer*>(vmodel);
|
||||||
if ( aView )
|
if ( aView )
|
||||||
Redisplay( theEntry, theIndex, theProperty, aView );
|
Redisplay( theEntry, theIndex, theProperty, aView );
|
||||||
}
|
}
|
||||||
@ -186,9 +189,9 @@ void GEOMGUI_AnnotationMgr::Redisplay( const QString& theEntry, const int theInd
|
|||||||
|
|
||||||
void GEOMGUI_AnnotationMgr::Redisplay( const QString& theEntry, const int theIndex,
|
void GEOMGUI_AnnotationMgr::Redisplay( const QString& theEntry, const int theIndex,
|
||||||
const GEOMGUI_AnnotationAttrs::Properties& theProperty,
|
const GEOMGUI_AnnotationAttrs::Properties& theProperty,
|
||||||
SALOME_View* theView )
|
SOCC_Viewer* theView )
|
||||||
{
|
{
|
||||||
SALOME_View* aView = viewOrActiveView( theView );
|
SOCC_Viewer* aView = viewOrActiveView( theView );
|
||||||
if ( !aView )
|
if ( !aView )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -212,8 +215,7 @@ void GEOMGUI_AnnotationMgr::Redisplay( const QString& theEntry, const int theInd
|
|||||||
// erase presentation from the viewer
|
// erase presentation from the viewer
|
||||||
SALOME_Prs* aPrs = anAnnotationToPrs[theIndex];
|
SALOME_Prs* aPrs = anAnnotationToPrs[theIndex];
|
||||||
SOCC_Prs* anOCCPrs = dynamic_cast<SOCC_Prs*>( aPrs );
|
SOCC_Prs* anOCCPrs = dynamic_cast<SOCC_Prs*>( aPrs );
|
||||||
SOCC_Viewer* anOCCViewer = dynamic_cast<SOCC_Viewer*>(theView);
|
if ( anOCCPrs ) {
|
||||||
if ( anOCCPrs && anOCCViewer ) {
|
|
||||||
AIS_ListOfInteractive anIOs;
|
AIS_ListOfInteractive anIOs;
|
||||||
anOCCPrs->GetObjects( anIOs );
|
anOCCPrs->GetObjects( anIOs );
|
||||||
AIS_ListIteratorOfListOfInteractive anIter( anIOs );
|
AIS_ListIteratorOfListOfInteractive anIter( anIOs );
|
||||||
@ -223,14 +225,14 @@ void GEOMGUI_AnnotationMgr::Redisplay( const QString& theEntry, const int theInd
|
|||||||
Handle(GEOM_Annotation) aPresentation = Handle(GEOM_Annotation)::DownCast( aPrs );
|
Handle(GEOM_Annotation) aPresentation = Handle(GEOM_Annotation)::DownCast( aPrs );
|
||||||
|
|
||||||
GEOMGUI_AnnotationAttrs::SetupPresentation( aPresentation, theProperty, aShapeLCS );
|
GEOMGUI_AnnotationAttrs::SetupPresentation( aPresentation, theProperty, aShapeLCS );
|
||||||
anOCCViewer->getAISContext()->Redisplay(aPresentation);
|
aView->getAISContext()->Redisplay( aPresentation );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOMGUI_AnnotationMgr::Erase( const QString& theEntry, const int theIndex, SALOME_View* theView )
|
void GEOMGUI_AnnotationMgr::Erase( const QString& theEntry, const int theIndex, SOCC_Viewer* theView )
|
||||||
{
|
{
|
||||||
SALOME_View* aView = viewOrActiveView( theView );
|
SOCC_Viewer* aView = viewOrActiveView( theView );
|
||||||
if ( !aView )
|
if ( !aView )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -247,7 +249,7 @@ void GEOMGUI_AnnotationMgr::Erase( const QString& theEntry, const int theIndex,
|
|||||||
|
|
||||||
// erase presentation from the viewer
|
// erase presentation from the viewer
|
||||||
SALOME_Prs* aPrs = anAnnotationToPrs[theIndex];
|
SALOME_Prs* aPrs = anAnnotationToPrs[theIndex];
|
||||||
aView->Erase( getDisplayer(), aPrs );
|
((SALOME_View*)aView)->Erase( getDisplayer(), aPrs );
|
||||||
getDisplayer()->UpdateViewer();
|
getDisplayer()->UpdateViewer();
|
||||||
|
|
||||||
// remove displayed parameters from an internal container
|
// remove displayed parameters from an internal container
|
||||||
@ -265,7 +267,7 @@ void GEOMGUI_AnnotationMgr::Erase( const QString& theEntry, const int theIndex,
|
|||||||
storeVisibleState( theEntry, theView );
|
storeVisibleState( theEntry, theView );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOMGUI_AnnotationMgr::DisplayVisibleAnnotations( const QString& theEntry, SALOME_View* theView )
|
void GEOMGUI_AnnotationMgr::DisplayVisibleAnnotations( const QString& theEntry, SOCC_Viewer* theView )
|
||||||
{
|
{
|
||||||
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() );
|
||||||
@ -285,9 +287,9 @@ void GEOMGUI_AnnotationMgr::DisplayVisibleAnnotations( const QString& theEntry,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOMGUI_AnnotationMgr::EraseVisibleAnnotations( const QString& theEntry, SALOME_View* theView )
|
void GEOMGUI_AnnotationMgr::EraseVisibleAnnotations( const QString& theEntry, SOCC_Viewer* theView )
|
||||||
{
|
{
|
||||||
SALOME_View* aView = viewOrActiveView( theView );
|
SOCC_Viewer* aView = viewOrActiveView( theView );
|
||||||
if ( !myVisualized.contains( aView ) )
|
if ( !myVisualized.contains( aView ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -308,7 +310,7 @@ void GEOMGUI_AnnotationMgr::EraseVisibleAnnotations( const QString& theEntry, SA
|
|||||||
|
|
||||||
// erase presentation from the viewer
|
// erase presentation from the viewer
|
||||||
SALOME_Prs* aPrs = anAnnotationToPrs[anIndex];
|
SALOME_Prs* aPrs = anAnnotationToPrs[anIndex];
|
||||||
aView->Erase( getDisplayer(), aPrs );
|
((SALOME_View*)aView)->Erase( getDisplayer(), aPrs );
|
||||||
}
|
}
|
||||||
getDisplayer()->UpdateViewer();
|
getDisplayer()->UpdateViewer();
|
||||||
anEntryToAnnotation.remove( theEntry );
|
anEntryToAnnotation.remove( theEntry );
|
||||||
@ -319,9 +321,9 @@ void GEOMGUI_AnnotationMgr::EraseVisibleAnnotations( const QString& theEntry, SA
|
|||||||
// function : GEOMGUI_AnnotationMgr::UpdateVisibleAnnotations
|
// function : GEOMGUI_AnnotationMgr::UpdateVisibleAnnotations
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void GEOMGUI_AnnotationMgr::UpdateVisibleAnnotations( const QString& theEntry, SALOME_View* theView )
|
void GEOMGUI_AnnotationMgr::UpdateVisibleAnnotations( const QString& theEntry, SOCC_Viewer* theView )
|
||||||
{
|
{
|
||||||
SALOME_View* aView = viewOrActiveView( theView );
|
SOCC_Viewer* aView = viewOrActiveView( theView );
|
||||||
if ( !myVisualized.contains( aView ) )
|
if ( !myVisualized.contains( aView ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -352,13 +354,44 @@ void GEOMGUI_AnnotationMgr::UpdateVisibleAnnotations( const QString& theEntry, S
|
|||||||
getDisplayer()->UpdateViewer();
|
getDisplayer()->UpdateViewer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GEOMGUI_AnnotationMgr::SetPreviewStyle( const QString& theEntry, const int theIndex, const bool theIsPreview )
|
||||||
|
{
|
||||||
|
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
|
||||||
|
const QColor aFontColor = aResMgr->colorValue( "Geometry", "shape_annotation_font_color", QColor( 255, 255, 255 ) );
|
||||||
|
const QColor aLineColor = aResMgr->colorValue( "Geometry", "shape_annotation_line_color", QColor( 255, 255, 255 ) );
|
||||||
|
|
||||||
|
const Quantity_Color aOcctFontColor( aFontColor.redF(), aFontColor.greenF(), aFontColor.blueF(), Quantity_TOC_RGB );
|
||||||
|
const Quantity_Color aOcctLineColor( aLineColor.redF(), aLineColor.greenF(), aLineColor.blueF(), Quantity_TOC_RGB );
|
||||||
|
|
||||||
|
QMap<SOCC_Viewer*, EntryToAnnotations>::Iterator aViewIt = myVisualized.begin();
|
||||||
|
for (; aViewIt != myVisualized.end(); ++aViewIt ) {
|
||||||
|
|
||||||
|
Handle(GEOM_Annotation) aPresentation = getAISPresentation ( theEntry, theIndex, aViewIt.key() );
|
||||||
|
if ( aPresentation.IsNull() ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( theIsPreview ) {
|
||||||
|
aPresentation->SetTextColor( Quantity_NOC_VIOLET );
|
||||||
|
aPresentation->SetLineColor( Quantity_NOC_VIOLET );
|
||||||
|
aPresentation->SetDepthCulling( Standard_False );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aPresentation->SetTextColor( aOcctFontColor );
|
||||||
|
aPresentation->SetLineColor( aOcctLineColor );
|
||||||
|
aPresentation->SetDepthCulling( Standard_True );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getDisplayer()->UpdateViewer();
|
||||||
|
}
|
||||||
|
|
||||||
Handle(SALOME_InteractiveObject) GEOMGUI_AnnotationMgr::FindInteractiveObject( const QString& theEntry,
|
Handle(SALOME_InteractiveObject) GEOMGUI_AnnotationMgr::FindInteractiveObject( const QString& theEntry,
|
||||||
const int theIndex,
|
const int theIndex,
|
||||||
SALOME_View* theView ) const
|
SOCC_Viewer* theView ) const
|
||||||
{
|
{
|
||||||
Handle(SALOME_InteractiveObject) anIO;
|
Handle(SALOME_InteractiveObject) anIO;
|
||||||
|
|
||||||
SALOME_View* aView = viewOrActiveView( theView );
|
SOCC_Viewer* aView = viewOrActiveView( theView );
|
||||||
if ( !myVisualized.contains( aView ) )
|
if ( !myVisualized.contains( aView ) )
|
||||||
return anIO;
|
return anIO;
|
||||||
|
|
||||||
@ -381,17 +414,17 @@ Handle(SALOME_InteractiveObject) GEOMGUI_AnnotationMgr::FindInteractiveObject( c
|
|||||||
for ( ; anIter.More() && anIO.IsNull(); anIter.Next() ) {
|
for ( ; anIter.More() && anIO.IsNull(); anIter.Next() ) {
|
||||||
Handle(AIS_InteractiveObject) aPrs = anIter.Value();
|
Handle(AIS_InteractiveObject) aPrs = anIter.Value();
|
||||||
if ( aPrs->GetOwner() )
|
if ( aPrs->GetOwner() )
|
||||||
anIO = Handle(SALOME_InteractiveObject)::DownCast(aPrs->GetOwner());
|
anIO = Handle(SALOME_InteractiveObject)::DownCast( aPrs->GetOwner() );
|
||||||
}
|
}
|
||||||
return anIO;
|
return anIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GEOMGUI_AnnotationMgr::FindAnnotationIndex( Handle(SALOME_InteractiveObject) theIO,
|
int GEOMGUI_AnnotationMgr::FindAnnotationIndex( Handle(SALOME_InteractiveObject) theIO,
|
||||||
SALOME_View* theView )
|
SOCC_Viewer* theView )
|
||||||
{
|
{
|
||||||
int anIndex = -1;
|
int anIndex = -1;
|
||||||
|
|
||||||
SALOME_View* aView = viewOrActiveView( theView );
|
SOCC_Viewer* aView = viewOrActiveView( theView );
|
||||||
if ( !myVisualized.contains( aView ) )
|
if ( !myVisualized.contains( aView ) )
|
||||||
return anIndex;
|
return anIndex;
|
||||||
|
|
||||||
@ -431,13 +464,13 @@ int GEOMGUI_AnnotationMgr::FindAnnotationIndex( Handle(SALOME_InteractiveObject)
|
|||||||
// function : GEOMGUI_AnnotationMgr::RemoveView
|
// function : GEOMGUI_AnnotationMgr::RemoveView
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void GEOMGUI_AnnotationMgr::RemoveView( SALOME_View* theView )
|
void GEOMGUI_AnnotationMgr::RemoveView( SOCC_Viewer* theView )
|
||||||
{
|
{
|
||||||
if ( !theView && myVisualized.contains( theView ) )
|
if ( !theView && myVisualized.contains( theView ) )
|
||||||
myVisualized.remove( theView );
|
myVisualized.remove( theView );
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GEOMGUI_AnnotationMgr::getDisplayedIndicesInfo( const QString& theEntry, SALOME_View* theView ) const
|
QString GEOMGUI_AnnotationMgr::getDisplayedIndicesInfo( const QString& theEntry, SOCC_Viewer* theView ) const
|
||||||
{
|
{
|
||||||
QString aDisplayedIndices;
|
QString aDisplayedIndices;
|
||||||
|
|
||||||
@ -462,7 +495,7 @@ QString GEOMGUI_AnnotationMgr::getDisplayedIndicesInfo( const QString& theEntry,
|
|||||||
return aDisplayedIndices;
|
return aDisplayedIndices;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOMGUI_AnnotationMgr::setDisplayedIndicesInfo( const QString& theEntry, SALOME_View* theView,
|
void GEOMGUI_AnnotationMgr::setDisplayedIndicesInfo( const QString& theEntry, SOCC_Viewer* theView,
|
||||||
const QString theIndicesInfo )
|
const QString theIndicesInfo )
|
||||||
{
|
{
|
||||||
if ( theIndicesInfo.isEmpty() )
|
if ( theIndicesInfo.isEmpty() )
|
||||||
@ -480,19 +513,22 @@ GEOM_Displayer* GEOMGUI_AnnotationMgr::getDisplayer() const
|
|||||||
return dynamic_cast<GEOM_Displayer*>( aModule->displayer() );
|
return dynamic_cast<GEOM_Displayer*>( aModule->displayer() );
|
||||||
}
|
}
|
||||||
|
|
||||||
SALOME_View* GEOMGUI_AnnotationMgr::viewOrActiveView(SALOME_View* theView) const
|
SOCC_Viewer* GEOMGUI_AnnotationMgr::viewOrActiveView( SOCC_Viewer* theView ) const
|
||||||
{
|
{
|
||||||
if ( theView ) {
|
SOCC_Viewer* aView = theView;
|
||||||
return dynamic_cast<SOCC_Viewer*>( theView );
|
if ( !aView ) {
|
||||||
}
|
|
||||||
else {
|
|
||||||
SalomeApp_Application* anApp = getApplication();
|
SalomeApp_Application* anApp = getApplication();
|
||||||
SUIT_ViewWindow* anActiveWindow = anApp->desktop()->activeWindow();
|
SUIT_ViewWindow* anActiveWindow = anApp->desktop()->activeWindow();
|
||||||
if ( anActiveWindow ) {
|
if ( anActiveWindow ) {
|
||||||
return dynamic_cast<SOCC_Viewer*>( anActiveWindow->getViewManager()->getViewModel() );
|
aView = dynamic_cast<SOCC_Viewer*>( anActiveWindow->getViewManager()->getViewModel() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return aView;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GEOMGUI_AnnotationMgr::makeAnnotationEntry( const QString& theEntry, const int theIndex )
|
||||||
|
{
|
||||||
|
return QString("%1%2%3").arg(theEntry).arg(GetEntrySeparator()).arg(theIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOMGUI_AnnotationMgr::getObject( const QString& theEntry, const int theIndex,
|
void GEOMGUI_AnnotationMgr::getObject( const QString& theEntry, const int theIndex,
|
||||||
@ -509,9 +545,9 @@ void GEOMGUI_AnnotationMgr::getObject( const QString& theEntry, const int theInd
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOMGUI_AnnotationMgr::storeVisibleState( const QString& theEntry, SALOME_View* theView )
|
void GEOMGUI_AnnotationMgr::storeVisibleState( const QString& theEntry, SOCC_Viewer* theView )
|
||||||
{
|
{
|
||||||
SALOME_View* aView = viewOrActiveView( theView );
|
SOCC_Viewer* aView = viewOrActiveView( theView );
|
||||||
if ( !aView || !myVisualized.contains( aView ) )
|
if ( !aView || !myVisualized.contains( aView ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -524,12 +560,12 @@ 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();
|
const int aCount = aShapeAnnotations->GetNbAnnotation();
|
||||||
for ( int anIndex = 0; anIndex < aCount; ++anIndex ) {
|
for ( int anIndex = 0; anIndex < aCount; ++anIndex ) {
|
||||||
bool aVisible = anAnnotationToPrs.contains( anIndex );
|
bool aVisible = anAnnotationToPrs.contains( anIndex );
|
||||||
aShapeAnnotations->SetIsVisible( anIndex, aVisible );
|
aShapeAnnotations->SetIsVisible( anIndex, aVisible );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -588,7 +624,7 @@ std::string GEOMGUI_AnnotationMgr::getName( const GEOM::GEOM_Object_ptr theObjec
|
|||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void GEOMGUI_AnnotationMgr::setDisplayProperties( const Handle(GEOM_Annotation)& thePrs,
|
void GEOMGUI_AnnotationMgr::setDisplayProperties( const Handle(GEOM_Annotation)& thePrs,
|
||||||
SALOME_View* theView,
|
SOCC_Viewer* theView,
|
||||||
const QString& theEntry )
|
const QString& theEntry )
|
||||||
{
|
{
|
||||||
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
|
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
|
||||||
@ -610,8 +646,9 @@ void GEOMGUI_AnnotationMgr::setDisplayProperties( const Handle(GEOM_Annotation)&
|
|||||||
thePrs->SetLineWidth( aLineWidth );
|
thePrs->SetLineWidth( aLineWidth );
|
||||||
thePrs->SetLineStyle( static_cast<Aspect_TypeOfLine>( aLineStyle ) );
|
thePrs->SetLineStyle( static_cast<Aspect_TypeOfLine>( aLineStyle ) );
|
||||||
thePrs->SetAutoHide( isAutoHide ? Standard_True : Standard_False );
|
thePrs->SetAutoHide( isAutoHide ? Standard_True : Standard_False );
|
||||||
|
thePrs->SetDepthCulling( Standard_True );
|
||||||
|
|
||||||
SALOME_View* aView = viewOrActiveView( theView );
|
SOCC_Viewer* aView = viewOrActiveView( theView );
|
||||||
if ( aView && !theEntry.isEmpty() ) {
|
if ( aView && !theEntry.isEmpty() ) {
|
||||||
|
|
||||||
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApplication()->activeStudy() );
|
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApplication()->activeStudy() );
|
||||||
@ -629,3 +666,38 @@ void GEOMGUI_AnnotationMgr::setDisplayProperties( const Handle(GEOM_Annotation)&
|
|||||||
thePrs->SetDefaultZLayer();
|
thePrs->SetDefaultZLayer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : GEOMGUI_AnnotationMgr::getAISPresentation
|
||||||
|
// purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Handle(GEOM_Annotation) GEOMGUI_AnnotationMgr::getAISPresentation ( const QString& theEntry,
|
||||||
|
const int theIndex,
|
||||||
|
SOCC_Viewer* theView )
|
||||||
|
{
|
||||||
|
if ( !myVisualized.contains( theView ) ) {
|
||||||
|
return Handle(GEOM_Annotation)();
|
||||||
|
}
|
||||||
|
|
||||||
|
EntryToAnnotations& aEntryToAnnotation = myVisualized[theView];
|
||||||
|
if ( !aEntryToAnnotation.contains( theEntry ) ) {
|
||||||
|
return Handle(GEOM_Annotation)();
|
||||||
|
}
|
||||||
|
|
||||||
|
AnnotationToPrs& aAnnotationToPrs = aEntryToAnnotation[theEntry];
|
||||||
|
if ( !aAnnotationToPrs.contains( theIndex ) ) {
|
||||||
|
return Handle(GEOM_Annotation)();
|
||||||
|
}
|
||||||
|
|
||||||
|
SALOME_Prs* aPrs = aAnnotationToPrs[theIndex];
|
||||||
|
|
||||||
|
// set or unset preview style for the presentation
|
||||||
|
AIS_ListOfInteractive aIObjects;
|
||||||
|
((SOCC_Prs*)aPrs)->GetObjects( aIObjects );
|
||||||
|
AIS_ListOfInteractive::Iterator aIOIt( aIObjects );
|
||||||
|
for ( ; aIOIt.More(); aIOIt.Next() ) {
|
||||||
|
return Handle(GEOM_Annotation)::DownCast( aIOIt.Value() );
|
||||||
|
}
|
||||||
|
|
||||||
|
return Handle(GEOM_Annotation)();
|
||||||
|
}
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
#include <SALOME_Prs.h>
|
#include <SALOME_Prs.h>
|
||||||
#include <SALOME_InteractiveObject.hxx>
|
#include <SALOME_InteractiveObject.hxx>
|
||||||
|
|
||||||
|
#include <SOCC_ViewModel.h>
|
||||||
|
|
||||||
class SalomeApp_Application;
|
class SalomeApp_Application;
|
||||||
class GEOM_Annotation;
|
class GEOM_Annotation;
|
||||||
class GEOM_Displayer;
|
class GEOM_Displayer;
|
||||||
@ -53,32 +55,35 @@ public:
|
|||||||
|
|
||||||
SALOME_Prs* CreatePresentation( const GEOMGUI_AnnotationAttrs::Properties& theProperty,
|
SALOME_Prs* CreatePresentation( const GEOMGUI_AnnotationAttrs::Properties& theProperty,
|
||||||
GEOM::GEOM_Object_ptr theObject,
|
GEOM::GEOM_Object_ptr theObject,
|
||||||
SALOME_View* theView = 0,
|
SOCC_Viewer* theView = 0,
|
||||||
const QString& theEntry = QString() );
|
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, SOCC_Viewer* theView = 0 ) const;
|
||||||
void Display( const QString& theEntry, const int theIndex, SALOME_View* theView = 0 );
|
void Display( const QString& theEntry, const int theIndex, SOCC_Viewer* theView = 0 );
|
||||||
void Erase( const QString& theEntry, const int theIndex, SALOME_View* theView = 0 );
|
void Erase( const QString& theEntry, const int theIndex, SOCC_Viewer* theView = 0 );
|
||||||
void Redisplay( const QString& theEntry, const int theIndex,
|
void Redisplay( const QString& theEntry, const int theIndex,
|
||||||
const GEOMGUI_AnnotationAttrs::Properties& theProperties);
|
const GEOMGUI_AnnotationAttrs::Properties& theProperties);
|
||||||
void Redisplay( const QString& theEntry, const int theIndex,
|
void Redisplay( const QString& theEntry, const int theIndex,
|
||||||
const GEOMGUI_AnnotationAttrs::Properties& theProperties, SALOME_View* theView );
|
const GEOMGUI_AnnotationAttrs::Properties& theProperties, SOCC_Viewer* theView );
|
||||||
|
|
||||||
void DisplayVisibleAnnotations( const QString& theEntry, SALOME_View* theView = 0 );
|
void DisplayVisibleAnnotations( const QString& theEntry, SOCC_Viewer* theView = 0 );
|
||||||
void EraseVisibleAnnotations( const QString& theEntry, SALOME_View* theView = 0 );
|
void EraseVisibleAnnotations( const QString& theEntry, SOCC_Viewer* theView = 0 );
|
||||||
void UpdateVisibleAnnotations( const QString& theEntry, SALOME_View* theView = 0 );
|
void UpdateVisibleAnnotations( const QString& theEntry, SOCC_Viewer* theView = 0 );
|
||||||
|
void SetPreviewStyle( const QString& theEntry, const int theIndex, const bool theIsPreview );
|
||||||
|
|
||||||
void RemoveView( SALOME_View* theView);
|
void RemoveView( SOCC_Viewer* theView );
|
||||||
|
|
||||||
int FindAnnotationIndex( Handle(SALOME_InteractiveObject) theIO,
|
int FindAnnotationIndex( Handle(SALOME_InteractiveObject) theIO,
|
||||||
SALOME_View* theView = 0 );
|
SOCC_Viewer* theView = 0 );
|
||||||
|
|
||||||
Handle(SALOME_InteractiveObject) FindInteractiveObject( const QString& theEntry, const int theIndex,
|
Handle(SALOME_InteractiveObject) FindInteractiveObject( const QString& theEntry, const int theIndex,
|
||||||
SALOME_View* theView = 0 ) const;
|
SOCC_Viewer* theView = 0 ) const;
|
||||||
|
|
||||||
QString getDisplayedIndicesInfo( const QString& theEntry, SALOME_View* theView ) const;
|
QString getDisplayedIndicesInfo( const QString& theEntry, SOCC_Viewer* theView ) const;
|
||||||
|
|
||||||
void setDisplayedIndicesInfo( const QString& theEntry, SALOME_View* theView, const QString theIndicesInfo );
|
void setDisplayedIndicesInfo( const QString& theEntry, SOCC_Viewer* theView, const QString theIndicesInfo );
|
||||||
|
|
||||||
|
QString makeAnnotationEntry( const QString& theEntry, const int theIndex );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -86,27 +91,31 @@ protected:
|
|||||||
|
|
||||||
GEOM_Displayer* getDisplayer() const;
|
GEOM_Displayer* getDisplayer() const;
|
||||||
|
|
||||||
SALOME_View* viewOrActiveView(SALOME_View* theView) const;
|
SOCC_Viewer* viewOrActiveView( SOCC_Viewer* theView ) const;
|
||||||
|
|
||||||
void getObject( const QString& theEntry, const int theIndex,
|
void getObject( const QString& theEntry, const int theIndex,
|
||||||
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 );
|
void storeVisibleState( const QString& theEntry, SOCC_Viewer* 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 setDisplayProperties( const Handle(GEOM_Annotation)& thePrs,
|
void setDisplayProperties( const Handle(GEOM_Annotation)& thePrs,
|
||||||
SALOME_View* theView = 0,
|
SOCC_Viewer* theView = 0,
|
||||||
const QString& theEntry = QString() );
|
const QString& theEntry = QString() );
|
||||||
|
|
||||||
|
Handle(GEOM_Annotation) getAISPresentation ( const QString& theEntry,
|
||||||
|
const int theIndex,
|
||||||
|
SOCC_Viewer* theView );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SalomeApp_Application* myApplication;
|
SalomeApp_Application* myApplication;
|
||||||
|
|
||||||
typedef QMap<int, SALOME_Prs*> AnnotationToPrs;
|
typedef QMap<int, SALOME_Prs*> AnnotationToPrs;
|
||||||
typedef QMap<QString, AnnotationToPrs> EntryToAnnotations;
|
typedef QMap<QString, AnnotationToPrs> EntryToAnnotations;
|
||||||
QMap<SALOME_View*, EntryToAnnotations> myVisualized;
|
QMap<SOCC_Viewer*, EntryToAnnotations> myVisualized;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -515,7 +515,8 @@ GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st )
|
|||||||
#if OCC_VERSION_MAJOR >= 7
|
#if OCC_VERSION_MAJOR >= 7
|
||||||
myColorScale = new AIS_ColorScale;
|
myColorScale = new AIS_ColorScale;
|
||||||
myColorScale->SetZLayer (Graphic3d_ZLayerId_TopOSD);
|
myColorScale->SetZLayer (Graphic3d_ZLayerId_TopOSD);
|
||||||
myColorScale->SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt (-1,-1,0));
|
myColorScale->SetTransformPersistence (
|
||||||
|
Graphic3d_TransformPers::FromDeprecatedParams(Graphic3d_TMF_2d, gp_Pnt (-1,-1,0)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
myFieldDataType = GEOM::FDT_Double;
|
myFieldDataType = GEOM::FDT_Double;
|
||||||
@ -703,10 +704,10 @@ void GEOM_Displayer::Redisplay( const Handle(SALOME_InteractiveObject)& theIO,
|
|||||||
GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( anApp->activeModule() );
|
GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( anApp->activeModule() );
|
||||||
if ( aModule ) {
|
if ( aModule ) {
|
||||||
if ( !theViewFrame->isVisible( theIO ) ) {
|
if ( !theViewFrame->isVisible( theIO ) ) {
|
||||||
aModule->GetAnnotationMgr()->EraseVisibleAnnotations(QString(theIO->getEntry()), theViewFrame);
|
aModule->GetAnnotationMgr()->EraseVisibleAnnotations(QString(theIO->getEntry()), dynamic_cast<SOCC_Viewer*>( theViewFrame ));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
aModule->GetAnnotationMgr()->DisplayVisibleAnnotations(QString(theIO->getEntry()), theViewFrame);
|
aModule->GetAnnotationMgr()->DisplayVisibleAnnotations(QString(theIO->getEntry()), dynamic_cast<SOCC_Viewer*>( theViewFrame ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2082,9 +2083,9 @@ void GEOM_Displayer::AfterDisplay( SALOME_View* v, const SALOME_OCCPrs* p )
|
|||||||
GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( anApp->activeModule() );
|
GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( anApp->activeModule() );
|
||||||
if ( aModule ) {
|
if ( aModule ) {
|
||||||
if ( !myIsRedisplayed ) {
|
if ( !myIsRedisplayed ) {
|
||||||
aModule->GetAnnotationMgr()->DisplayVisibleAnnotations(QString(p->GetEntry()), v);
|
aModule->GetAnnotationMgr()->DisplayVisibleAnnotations(QString(p->GetEntry()), dynamic_cast<SOCC_Viewer*>( v ));
|
||||||
} else {
|
} else {
|
||||||
aModule->GetAnnotationMgr()->UpdateVisibleAnnotations(QString(p->GetEntry()), v);
|
aModule->GetAnnotationMgr()->UpdateVisibleAnnotations(QString(p->GetEntry()), dynamic_cast<SOCC_Viewer*>( v ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2106,7 +2107,7 @@ void GEOM_Displayer::AfterErase( SALOME_View* v, const SALOME_OCCPrs* p )
|
|||||||
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
|
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
|
||||||
GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( anApp->activeModule() );
|
GeometryGUI* aModule = dynamic_cast<GeometryGUI*>( anApp->activeModule() );
|
||||||
if ( aModule )
|
if ( aModule )
|
||||||
aModule->GetAnnotationMgr()->EraseVisibleAnnotations(QString(p->GetEntry()), v);
|
aModule->GetAnnotationMgr()->EraseVisibleAnnotations(QString(p->GetEntry()), dynamic_cast<SOCC_Viewer*>( v ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2079,7 +2079,10 @@ void GeometryGUI::onViewManagerRemoved( SUIT_ViewManager* vm )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GetAnnotationMgr()->RemoveView(dynamic_cast<SALOME_View*>(viewer));
|
SOCC_Viewer* aSOCCView = dynamic_cast<SOCC_Viewer*>(viewer);
|
||||||
|
if ( aSOCCView ) {
|
||||||
|
GetAnnotationMgr()->RemoveView( aSOCCView );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
@ -2851,6 +2854,12 @@ void GeometryGUI::preferencesChanged( const QString& section, const QString& par
|
|||||||
SALOME_ListIO aVisible;
|
SALOME_ListIO aVisible;
|
||||||
aViewer->GetVisible( aVisible );
|
aViewer->GetVisible( aVisible );
|
||||||
aDisplayer.Redisplay( aVisible, false, aViewer );
|
aDisplayer.Redisplay( aVisible, false, aViewer );
|
||||||
|
|
||||||
|
GEOMGUI_AnnotationMgr* aAnnotationMgr = GetAnnotationMgr();
|
||||||
|
SALOME_ListIteratorOfListIO Iter( aVisible );
|
||||||
|
for ( ; Iter.More(); Iter.Next() ) {
|
||||||
|
aAnnotationMgr->DisplayVisibleAnnotations( QString(Iter.Value()->getEntry()), aViewer );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ( param == QString( "label_color" ) ) {
|
if ( param == QString( "label_color" ) ) {
|
||||||
ViewManagerList aVMsVTK;
|
ViewManagerList aVMsVTK;
|
||||||
@ -3057,8 +3066,9 @@ void GeometryGUI::storeVisualParameters (int savePoint)
|
|||||||
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::IsosWidth )).toString().toStdString());
|
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::IsosWidth )).toString().toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( aAnnotationMgr ) {
|
if ( vType == SOCC_Viewer::Type() && aAnnotationMgr ) {
|
||||||
std::string anAnnotationInfo = GetAnnotationMgr()->getDisplayedIndicesInfo( o_it.key().toLatin1().data(), aView ).toStdString();
|
std::string anAnnotationInfo = GetAnnotationMgr()->getDisplayedIndicesInfo(
|
||||||
|
o_it.key().toLatin1().data(), dynamic_cast<SOCC_Viewer*>(aView) ).toStdString();
|
||||||
if (!anAnnotationInfo.empty()) {
|
if (!anAnnotationInfo.empty()) {
|
||||||
param = occParam + "ShapeAnnotationVisibleItems";
|
param = occParam + "ShapeAnnotationVisibleItems";
|
||||||
ip->setParameter(entry, param.toStdString(), anAnnotationInfo);
|
ip->setParameter(entry, param.toStdString(), anAnnotationInfo);
|
||||||
@ -3252,9 +3262,13 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
|
|||||||
SALOME_View* aView = dynamic_cast<SALOME_View*>(vmodel);
|
SALOME_View* aView = dynamic_cast<SALOME_View*>(vmodel);
|
||||||
displayer()->Display(entry, true, aView);
|
displayer()->Display(entry, true, aView);
|
||||||
|
|
||||||
PropMap& aProps = aListOfMap[index];
|
if ( vmodel->getType() == SOCC_Viewer::Type() ) {
|
||||||
if ( aProps.contains( "ShapeAnnotationVisibleItems" ) )
|
PropMap& aProps = aListOfMap[index];
|
||||||
GetAnnotationMgr()->setDisplayedIndicesInfo( entry, aView, aProps["ShapeAnnotationVisibleItems"].toString() );
|
if ( aProps.contains( "ShapeAnnotationVisibleItems" ) ) {
|
||||||
|
SOCC_Viewer* aSOCCView = dynamic_cast<SOCC_Viewer*>( aView );
|
||||||
|
GetAnnotationMgr()->setDisplayedIndicesInfo( entry, aSOCCView, aProps["ShapeAnnotationVisibleItems"].toString() );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // for entries iterator
|
} // for entries iterator
|
||||||
|
@ -326,6 +326,10 @@ void MeasureGUI_AnnotationDlg::Init()
|
|||||||
// connect controls
|
// connect controls
|
||||||
connect( myTextEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChange() ) );
|
connect( myTextEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChange() ) );
|
||||||
connect( myTypeCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onTypeChange() ) );
|
connect( myTypeCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onTypeChange() ) );
|
||||||
|
|
||||||
|
myGeomGUI->GetAnnotationMgr()->SetPreviewStyle( myEditAnnotationEntry, myEditAnnotationIndex, true );
|
||||||
|
|
||||||
|
redisplayPreview();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -673,33 +677,17 @@ void MeasureGUI_AnnotationDlg::onSubShapeTypeChange()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void MeasureGUI_AnnotationDlg::onDragged( Handle_GEOM_Annotation theAnnotation )
|
void MeasureGUI_AnnotationDlg::onDragged( Handle_GEOM_Annotation theAnnotation )
|
||||||
{
|
{
|
||||||
const PrsList& aPreview = getPreview();
|
TopoDS_Shape aShape;
|
||||||
PrsList::const_iterator anIt = aPreview.cbegin();
|
GEOMBase::GetShape( myShape.get(), aShape );
|
||||||
for ( ; anIt != aPreview.cend(); ++anIt ) {
|
gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() );
|
||||||
|
gp_Trsf aToShapeLCS;
|
||||||
|
aToShapeLCS.SetTransformation( gp_Ax3(), aShapeLCS );
|
||||||
|
|
||||||
AIS_ListOfInteractive aIObjects;
|
if ( !myAnnotationProperties.IsScreenFixed ) {
|
||||||
((SOCC_Prs*)(*anIt))->GetObjects( aIObjects );
|
myAnnotationProperties.Position = theAnnotation->GetPosition().Transformed( aToShapeLCS );
|
||||||
AIS_ListOfInteractive::Iterator aIOIt( aIObjects );
|
}
|
||||||
for ( ; aIOIt.More(); aIOIt.Next() ) {
|
else {
|
||||||
|
myAnnotationProperties.Position = theAnnotation->GetPosition();
|
||||||
if ( aIOIt.Value() == theAnnotation ) {
|
|
||||||
|
|
||||||
TopoDS_Shape aShape;
|
|
||||||
GEOMBase::GetShape( myShape.get(), aShape );
|
|
||||||
gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() );
|
|
||||||
gp_Trsf aToShapeLCS;
|
|
||||||
aToShapeLCS.SetTransformation( gp_Ax3(), aShapeLCS );
|
|
||||||
|
|
||||||
if ( !myAnnotationProperties.IsScreenFixed ) {
|
|
||||||
myAnnotationProperties.Position = theAnnotation->GetPosition().Transformed( aToShapeLCS );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
myAnnotationProperties.Position = theAnnotation->GetPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -785,14 +773,19 @@ bool MeasureGUI_AnnotationDlg::execute()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
SALOME_Prs* MeasureGUI_AnnotationDlg::buildPrs()
|
SALOME_Prs* MeasureGUI_AnnotationDlg::buildPrs()
|
||||||
{
|
{
|
||||||
SALOME_Prs* aPrs = myGeomGUI->GetAnnotationMgr()->CreatePresentation( myAnnotationProperties, myShape.get() );
|
QString aEntry = myIsCreation ?
|
||||||
|
myGeomGUI->GetAnnotationMgr()->makeAnnotationEntry( myShape->GetStudyEntry(), - 1 ) :
|
||||||
|
myGeomGUI->GetAnnotationMgr()->makeAnnotationEntry( myEditAnnotationEntry, myEditAnnotationIndex );
|
||||||
|
|
||||||
|
SALOME_Prs* aPrs = myGeomGUI->GetAnnotationMgr()->CreatePresentation(
|
||||||
|
myAnnotationProperties, myShape.get(), 0, aEntry );
|
||||||
|
|
||||||
// set preview style for the created presentation
|
// set preview style for the created presentation
|
||||||
AIS_ListOfInteractive aIObjects;
|
AIS_ListOfInteractive aIObjects;
|
||||||
((SOCC_Prs*)aPrs)->GetObjects( aIObjects );
|
((SOCC_Prs*)aPrs)->GetObjects( aIObjects );
|
||||||
AIS_ListOfInteractive::Iterator aIOIt( aIObjects );
|
AIS_ListOfInteractive::Iterator aIOIt( aIObjects );
|
||||||
for ( ; aIOIt.More(); aIOIt.Next() ) {
|
for ( ; aIOIt.More(); aIOIt.Next() ) {
|
||||||
|
|
||||||
Handle( GEOM_Annotation ) aPresentation = Handle( GEOM_Annotation )::DownCast( aIOIt.Value() );
|
Handle( GEOM_Annotation ) aPresentation = Handle( GEOM_Annotation )::DownCast( aIOIt.Value() );
|
||||||
aPresentation->SetTextColor( Quantity_NOC_VIOLET );
|
aPresentation->SetTextColor( Quantity_NOC_VIOLET );
|
||||||
aPresentation->SetLineColor( Quantity_NOC_VIOLET );
|
aPresentation->SetLineColor( Quantity_NOC_VIOLET );
|
||||||
@ -836,15 +829,25 @@ void MeasureGUI_AnnotationDlg::redisplayPreview()
|
|||||||
|
|
||||||
if ( SALOME_Prs* aPrs = buildPrs() )
|
if ( SALOME_Prs* aPrs = buildPrs() )
|
||||||
displayPreview( aPrs );
|
displayPreview( aPrs );
|
||||||
} catch ( const SALOME::SALOME_Exception& e ) {
|
} catch ( const SALOME::SALOME_Exception& e ) {
|
||||||
SalomeApp_Tools::QtCatchCorbaException( e );
|
SalomeApp_Tools::QtCatchCorbaException( e );
|
||||||
} catch ( ... ) {
|
} catch ( ... ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
myGeomGUI->GetAnnotationMgr()->Redisplay( myEditAnnotationEntry, myEditAnnotationIndex,
|
myGeomGUI->GetAnnotationMgr()->Redisplay( myEditAnnotationEntry, myEditAnnotationIndex,
|
||||||
myAnnotationProperties );
|
myAnnotationProperties );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString anEntry;
|
||||||
|
if ( myIsCreation && !myShape->_is_nil() ) {
|
||||||
|
anEntry = myGeomGUI->GetAnnotationMgr()->makeAnnotationEntry( myShape->GetStudyEntry(), -1 );
|
||||||
|
}
|
||||||
|
else if ( !myIsCreation ) {
|
||||||
|
anEntry = myGeomGUI->GetAnnotationMgr()->makeAnnotationEntry( myEditAnnotationEntry, myEditAnnotationIndex );
|
||||||
|
}
|
||||||
|
|
||||||
|
myInteractor->SetEditEntry( anEntry );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
|
@ -199,6 +199,11 @@ bool MeasureGUI_AnnotationInteractor::eventFilter( QObject* theObject, QEvent* t
|
|||||||
{
|
{
|
||||||
QMouseEvent* aMouseEv = dynamic_cast<QMouseEvent*>( theEvent );
|
QMouseEvent* aMouseEv = dynamic_cast<QMouseEvent*>( theEvent );
|
||||||
|
|
||||||
|
if ( myEditEntry.isEmpty() )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !( aMouseEv->buttons() & Qt::LeftButton ) )
|
if ( !( aMouseEv->buttons() & Qt::LeftButton ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -228,6 +233,14 @@ bool MeasureGUI_AnnotationInteractor::eventFilter( QObject* theObject, QEvent* t
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Handle(SALOME_InteractiveObject) anIO =
|
||||||
|
Handle(SALOME_InteractiveObject)::DownCast( aAnnotation->GetOwner() );
|
||||||
|
|
||||||
|
if ( anIO.IsNull() || anIO->getEntry() != myEditEntry )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
myStartPoint = aMouseEv->pos();
|
myStartPoint = aMouseEv->pos();
|
||||||
mySelection.Clear();
|
mySelection.Clear();
|
||||||
|
|
||||||
|
@ -70,6 +70,9 @@ public:
|
|||||||
//! Disables event processing and interaction handlers.
|
//! Disables event processing and interaction handlers.
|
||||||
void Disable();
|
void Disable();
|
||||||
|
|
||||||
|
//! Set entry of allowed annotation presentations.
|
||||||
|
void SetEditEntry( const QString& theEntry ) { myEditEntry = theEntry; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//! Connect interactor's event handler to the view window given.
|
//! Connect interactor's event handler to the view window given.
|
||||||
@ -113,6 +116,7 @@ private:
|
|||||||
Handle(GEOM_Annotation) myActiveIO;
|
Handle(GEOM_Annotation) myActiveIO;
|
||||||
SelectMgr_SequenceOfOwner mySelection;
|
SelectMgr_SequenceOfOwner mySelection;
|
||||||
QPoint myStartPoint;
|
QPoint myStartPoint;
|
||||||
|
QString myEditEntry;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,7 +63,7 @@ GEOM_Annotation::GEOM_Annotation() : AIS_InteractiveObject()
|
|||||||
SetIsScreenFixed( Standard_False );
|
SetIsScreenFixed( Standard_False );
|
||||||
SetAttachPoint( gp_Pnt( 0.0, 0.0, 0.0 ) );
|
SetAttachPoint( gp_Pnt( 0.0, 0.0, 0.0 ) );
|
||||||
SetDisplayMode( 0 );
|
SetDisplayMode( 0 );
|
||||||
SetZLayer( Graphic3d_ZLayerId_Default );
|
SetZLayer( Graphic3d_ZLayerId_Top );
|
||||||
SetAutoHide( Standard_True );
|
SetAutoHide( Standard_True );
|
||||||
SetHilightMode( HighlightAll );
|
SetHilightMode( HighlightAll );
|
||||||
SetMutable( Standard_True );
|
SetMutable( Standard_True );
|
||||||
@ -118,10 +118,12 @@ void GEOM_Annotation::SetPosition( const gp_Pnt& thePosition, const Standard_Boo
|
|||||||
{
|
{
|
||||||
myPosition = thePosition;
|
myPosition = thePosition;
|
||||||
|
|
||||||
Handle(Graphic3d_TransformPers) aPersistence;
|
|
||||||
if ( !myIsScreenFixed )
|
if ( !myIsScreenFixed )
|
||||||
{
|
{
|
||||||
AIS_InteractiveObject::SetTransformPersistence( Graphic3d_TMF_ZoomPers | Graphic3d_TMF_RotatePers, thePosition );
|
Handle(Graphic3d_TransformPers) aPersistence =
|
||||||
|
new Graphic3d_TransformPers( Graphic3d_TMF_ZoomRotatePers, thePosition );
|
||||||
|
|
||||||
|
AIS_InteractiveObject::SetTransformPersistence( aPersistence );
|
||||||
}
|
}
|
||||||
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
@ -140,16 +142,20 @@ void GEOM_Annotation::SetIsScreenFixed( const Standard_Boolean theIsFixed )
|
|||||||
{
|
{
|
||||||
myIsScreenFixed = theIsFixed;
|
myIsScreenFixed = theIsFixed;
|
||||||
|
|
||||||
|
Handle(Graphic3d_TransformPers) aPersistence;
|
||||||
|
|
||||||
if (!myIsScreenFixed)
|
if (!myIsScreenFixed)
|
||||||
{
|
{
|
||||||
AIS_InteractiveObject::SetTransformPersistence( Graphic3d_TMF_ZoomPers | Graphic3d_TMF_RotatePers, myPosition );
|
aPersistence = new Graphic3d_TransformPers( Graphic3d_TMF_ZoomRotatePers, myPosition );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AIS_InteractiveObject::SetTransformPersistence( Graphic3d_TMF_2d );
|
aPersistence = new Graphic3d_TransformPers( Graphic3d_TMF_2d, Aspect_TOTP_CENTER );
|
||||||
}
|
}
|
||||||
|
|
||||||
SetZLayer( myIsScreenFixed ? Graphic3d_ZLayerId_Topmost : Graphic3d_ZLayerId_Default );
|
AIS_InteractiveObject::SetTransformPersistence( aPersistence );
|
||||||
|
|
||||||
|
SetZLayer( myIsScreenFixed ? Graphic3d_ZLayerId_Topmost : Graphic3d_ZLayerId_Top );
|
||||||
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
|
|
||||||
@ -340,7 +346,7 @@ void GEOM_Annotation::SetDepthCulling( const Standard_Boolean theToEnable )
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void GEOM_Annotation::SetDefaultZLayer()
|
void GEOM_Annotation::SetDefaultZLayer()
|
||||||
{
|
{
|
||||||
SetZLayer( myIsScreenFixed ? Graphic3d_ZLayerId_Topmost : Graphic3d_ZLayerId_Default );
|
SetZLayer( myIsScreenFixed ? Graphic3d_ZLayerId_Topmost : Graphic3d_ZLayerId_Top );
|
||||||
|
|
||||||
SetToUpdate();
|
SetToUpdate();
|
||||||
}
|
}
|
||||||
@ -856,9 +862,9 @@ void GEOM_Annotation::OpenGl_Annotation::Render( const Handle(OpenGl_Workspace)&
|
|||||||
// function : HilightWithColor
|
// function : HilightWithColor
|
||||||
// purpose : Perform highlighting of the presentation.
|
// purpose : Perform highlighting of the presentation.
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
void GEOM_Annotation::GEOM_AnnotationOwner::HilightWithColor( const Handle(PrsMgr_PresentationManager3d)& thePresentationMgr,
|
void GEOM_Annotation::GEOM_AnnotationOwner::HilightWithColor( const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
const Quantity_NameOfColor theColor,
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Standard_Integer theMode )
|
const Standard_Integer theMode )
|
||||||
{
|
{
|
||||||
thePresentationMgr->Color( Selectable(), theColor, theMode, NULL, Selectable()->ZLayer() );
|
thePM->Color( Selectable(), theStyle, theMode, NULL, Selectable()->ZLayer() );
|
||||||
}
|
}
|
||||||
|
@ -261,10 +261,9 @@ private:
|
|||||||
virtual void ComputeSelection( const Handle(SelectMgr_Selection)& theSelection,
|
virtual void ComputeSelection( const Handle(SelectMgr_Selection)& theSelection,
|
||||||
const Standard_Integer theMode ) Standard_OVERRIDE;
|
const Standard_Integer theMode ) Standard_OVERRIDE;
|
||||||
|
|
||||||
virtual void SetLocalTransformation( const gp_Trsf& /*theTransformation*/ ) Standard_OVERRIDE {}
|
virtual void setLocalTransformation( const Handle(Geom_Transformation)& /*theTransformation*/ ) Standard_OVERRIDE {}
|
||||||
|
|
||||||
virtual void SetTransformPersistence( const Graphic3d_TransModeFlags& /*theFlag*/,
|
virtual void SetTransformPersistence( const Handle(Graphic3d_TransformPers)& /*theTrsfPers*/ ) Standard_OVERRIDE {}
|
||||||
const gp_Pnt& /*thePoint*/ ) Standard_OVERRIDE {}
|
|
||||||
|
|
||||||
Bnd_Box TextBoundingBox() const;
|
Bnd_Box TextBoundingBox() const;
|
||||||
|
|
||||||
@ -351,8 +350,8 @@ public:
|
|||||||
//! \param theColor [in] the highlighting color.
|
//! \param theColor [in] the highlighting color.
|
||||||
//! \param theMode [in] the display mode.
|
//! \param theMode [in] the display mode.
|
||||||
virtual void
|
virtual void
|
||||||
HilightWithColor( const Handle(PrsMgr_PresentationManager3d)& thePresentationMgr,
|
HilightWithColor( const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
const Quantity_NameOfColor theColor,
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Standard_Integer theMode = 0 ) Standard_OVERRIDE;
|
const Standard_Integer theMode = 0 ) Standard_OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user