mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-29 23:30:33 +05:00
Hilight selected shape. Delete operation.
This commit is contained in:
parent
ebc5a972c7
commit
fa65931a8c
@ -101,9 +101,9 @@
|
|||||||
<parameter name="dimensions_use_text3d" value="0" />
|
<parameter name="dimensions_use_text3d" value="0" />
|
||||||
|
|
||||||
<!-- Shape annotation presentation properties -->
|
<!-- Shape annotation presentation properties -->
|
||||||
<parameter name="shape_annotation_font_color" value="#ffffff" />
|
<parameter name="shape_annotation_font_color" value="#00007f" />
|
||||||
<parameter name="shape_annotation_font" value="Courier 10 Pitch,24" />
|
<parameter name="shape_annotation_font" value="Courier 10 Pitch,24" />
|
||||||
<parameter name="shape_annotation_line_color" value="#ffffff" />
|
<parameter name="shape_annotation_line_color" value="#00007f" />
|
||||||
<parameter name="shape_annotation_line_width" value="1.0" />
|
<parameter name="shape_annotation_line_width" value="1.0" />
|
||||||
<parameter name="shape_annotation_line_style" value="0" />
|
<parameter name="shape_annotation_line_style" value="0" />
|
||||||
<parameter name="shape_annotation_autohide" value="false" />
|
<parameter name="shape_annotation_autohide" value="false" />
|
||||||
|
@ -43,7 +43,9 @@
|
|||||||
#include <Quantity_Color.hxx>
|
#include <Quantity_Color.hxx>
|
||||||
#include <TCollection_AsciiString.hxx>
|
#include <TCollection_AsciiString.hxx>
|
||||||
|
|
||||||
|
#include <TopExp.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
#include <gp_Ax3.hxx>
|
#include <gp_Ax3.hxx>
|
||||||
#include <AIS_ListIteratorOfListOfInteractive.hxx>
|
#include <AIS_ListIteratorOfListOfInteractive.hxx>
|
||||||
|
|
||||||
@ -88,8 +90,26 @@ SALOME_Prs* GEOMGUI_AnnotationMgr::CreatePresentation( const GEOMGUI_AnnotationA
|
|||||||
setDisplayProperties( aPresentation, aView, 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() );
|
if ( !aShape.IsNull() ) {
|
||||||
GEOMGUI_AnnotationAttrs::SetupPresentation( aPresentation, theProperty, aShapeLCS );
|
|
||||||
|
gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() );
|
||||||
|
|
||||||
|
GEOMGUI_AnnotationAttrs::SetupPresentation( aPresentation, theProperty, aShapeLCS );
|
||||||
|
|
||||||
|
if ( theProperty.ShapeType == TopAbs_SHAPE ) {
|
||||||
|
|
||||||
|
aPresentation->SetHilightShape( aShape );
|
||||||
|
}
|
||||||
|
else if ( theProperty.ShapeIndex > 0 ) {
|
||||||
|
|
||||||
|
TopTools_IndexedMapOfShape aSubShapeMap;
|
||||||
|
TopExp::MapShapes( aShape, static_cast<TopAbs_ShapeEnum>( theProperty.ShapeType ), aSubShapeMap );
|
||||||
|
if ( theProperty.ShapeIndex <= aSubShapeMap.Extent() ) {
|
||||||
|
|
||||||
|
aPresentation->SetHilightShape( aSubShapeMap( theProperty.ShapeIndex ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// add Prs to preview
|
// add Prs to preview
|
||||||
SUIT_ViewWindow* vw = getApplication()->desktop()->activeWindow();
|
SUIT_ViewWindow* vw = getApplication()->desktop()->activeWindow();
|
||||||
@ -318,6 +338,43 @@ void GEOMGUI_AnnotationMgr::EraseVisibleAnnotations( const QString& theEntry, SO
|
|||||||
myVisualized[aView] = anEntryToAnnotation;
|
myVisualized[aView] = anEntryToAnnotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : GEOMGUI_AnnotationMgr::EraseRemovedAnnotation
|
||||||
|
// purpose : Method to update internal maps after removing an
|
||||||
|
// annotation from the object.
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMGUI_AnnotationMgr::EraseRemovedAnnotation( const QString& theEntry, const int theIndex )
|
||||||
|
{
|
||||||
|
QMap<SOCC_Viewer*, EntryToAnnotations>::iterator aEntryMapIt = myVisualized.begin();
|
||||||
|
for ( ; aEntryMapIt != myVisualized.end(); ++aEntryMapIt ) {
|
||||||
|
SOCC_Viewer* aView = aEntryMapIt.key();
|
||||||
|
EntryToAnnotations& anEntryToAnnotation = aEntryMapIt.value();
|
||||||
|
if ( !anEntryToAnnotation.contains( theEntry ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
AnnotationToPrs aUpdatedToPrs;
|
||||||
|
AnnotationToPrs& anAnnotationToPrs = anEntryToAnnotation[theEntry];
|
||||||
|
AnnotationToPrs::iterator anAnnotationIt = anAnnotationToPrs.begin();
|
||||||
|
for ( ; anAnnotationIt != anAnnotationToPrs.end(); ++anAnnotationIt ) {
|
||||||
|
|
||||||
|
const int aIndex = anAnnotationIt.key();
|
||||||
|
SALOME_Prs* aPrs = anAnnotationIt.value();
|
||||||
|
if ( aIndex > theIndex ) {
|
||||||
|
aUpdatedToPrs[aIndex - 1] = aPrs;
|
||||||
|
}
|
||||||
|
else if ( aIndex != theIndex ) {
|
||||||
|
aUpdatedToPrs[aIndex] = aPrs;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
((SALOME_View*)aView)->Erase( getDisplayer(), aPrs );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
anAnnotationToPrs = aUpdatedToPrs;
|
||||||
|
}
|
||||||
|
getDisplayer()->UpdateViewer();
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : GEOMGUI_AnnotationMgr::UpdateVisibleAnnotations
|
// function : GEOMGUI_AnnotationMgr::UpdateVisibleAnnotations
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -532,6 +589,18 @@ QString GEOMGUI_AnnotationMgr::makeAnnotationEntry( const QString& theEntry, con
|
|||||||
return QString("%1%2%3").arg(theEntry).arg(GetEntrySeparator()).arg(theIndex);
|
return QString("%1%2%3").arg(theEntry).arg(GetEntrySeparator()).arg(theIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GEOMGUI_AnnotationMgr::getIndexFromEntry( const QString& theEntry, QString& theObjEntry, int& theIndex )
|
||||||
|
{
|
||||||
|
QStringList aSplit = theEntry.split( GetEntrySeparator() );
|
||||||
|
if ( aSplit.size() < 2 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool isOk = true;
|
||||||
|
theObjEntry = aSplit.at( 0 );
|
||||||
|
theIndex = aSplit.at( 1 ).toInt( &isOk );
|
||||||
|
return isOk;
|
||||||
|
}
|
||||||
|
|
||||||
void GEOMGUI_AnnotationMgr::getObject( const QString& theEntry, const int theIndex,
|
void GEOMGUI_AnnotationMgr::getObject( const QString& theEntry, const int theIndex,
|
||||||
GEOM::GEOM_Object_ptr& theObject,
|
GEOM::GEOM_Object_ptr& theObject,
|
||||||
GEOMGUI_AnnotationAttrs::Properties& theProperty )
|
GEOMGUI_AnnotationAttrs::Properties& theProperty )
|
||||||
@ -671,8 +740,8 @@ void GEOMGUI_AnnotationMgr::setDisplayProperties( const Handle(GEOM_Annotation)&
|
|||||||
{
|
{
|
||||||
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
|
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
|
||||||
const QFont aFont = aResMgr->fontValue( "Geometry", "shape_annotation_font", QFont( "Y14.5M-2009", 24 ) );
|
const QFont aFont = aResMgr->fontValue( "Geometry", "shape_annotation_font", QFont( "Y14.5M-2009", 24 ) );
|
||||||
const QColor aFontColor = aResMgr->colorValue( "Geometry", "shape_annotation_font_color", QColor( 255, 255, 255 ) );
|
const QColor aFontColor = aResMgr->colorValue( "Geometry", "shape_annotation_font_color", QColor( 0, 0, 127 ) );
|
||||||
const QColor aLineColor = aResMgr->colorValue( "Geometry", "shape_annotation_line_color", QColor( 255, 255, 255 ) );
|
const QColor aLineColor = aResMgr->colorValue( "Geometry", "shape_annotation_line_color", QColor( 0, 0, 127 ) );
|
||||||
const double aLineWidth = aResMgr->doubleValue( "Geometry", "shape_annotation_line_width", 1.0 );
|
const double aLineWidth = aResMgr->doubleValue( "Geometry", "shape_annotation_line_width", 1.0 );
|
||||||
const int aLineStyle = aResMgr->integerValue( "Geometry", "shape_annotation_line_style", 0 );
|
const int aLineStyle = aResMgr->integerValue( "Geometry", "shape_annotation_line_style", 0 );
|
||||||
const bool isAutoHide = aResMgr->booleanValue( "Geometry", "shape_annotation_autohide", false );
|
const bool isAutoHide = aResMgr->booleanValue( "Geometry", "shape_annotation_autohide", false );
|
||||||
|
@ -61,6 +61,7 @@ public:
|
|||||||
bool IsDisplayed( const QString& theEntry, const int theIndex, SOCC_Viewer* theView = 0 ) const;
|
bool IsDisplayed( const QString& theEntry, const int theIndex, SOCC_Viewer* theView = 0 ) const;
|
||||||
void Display( const QString& theEntry, const int theIndex, SOCC_Viewer* theView = 0 );
|
void Display( const QString& theEntry, const int theIndex, SOCC_Viewer* theView = 0 );
|
||||||
void Erase( const QString& theEntry, const int theIndex, SOCC_Viewer* theView = 0 );
|
void Erase( const QString& theEntry, const int theIndex, SOCC_Viewer* theView = 0 );
|
||||||
|
void EraseRemovedAnnotation( const QString& theEntry, const int theIndex );
|
||||||
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,
|
||||||
@ -87,6 +88,10 @@ public:
|
|||||||
|
|
||||||
void storeFixedPosition( const QString& theEntry, SOCC_Viewer* theView );
|
void storeFixedPosition( const QString& theEntry, SOCC_Viewer* theView );
|
||||||
|
|
||||||
|
bool getIndexFromEntry( const QString& theEntry, QString& theObjEntry, int& theIndex );
|
||||||
|
|
||||||
|
bool isAnnotationEntry( const QString& theEntry ) { return theEntry.indexOf( GetEntrySeparator() ) != -1; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
SalomeApp_Application* getApplication() const { return myApplication; }
|
SalomeApp_Application* getApplication() const { return myApplication; }
|
||||||
|
@ -97,7 +97,9 @@ namespace
|
|||||||
myEntry = theEntry.c_str();
|
myEntry = theEntry.c_str();
|
||||||
myStudy = theStudy;
|
myStudy = theStudy;
|
||||||
_PTR(SObject) aSObj = theStudy->studyDS()->FindObjectID( theEntry );
|
_PTR(SObject) aSObj = theStudy->studyDS()->FindObjectID( theEntry );
|
||||||
myAttr = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
|
if ( aSObj ) {
|
||||||
|
myAttr = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
virtual int GetNumber() Standard_OVERRIDE {
|
virtual int GetNumber() Standard_OVERRIDE {
|
||||||
return !myAttr.IsNull() ? myAttr->GetNbAnnotation() : 0;
|
return !myAttr.IsNull() ? myAttr->GetNbAnnotation() : 0;
|
||||||
@ -542,6 +544,9 @@ void GEOMGUI_TextTreeWdg::showContextMenu( const QPoint& pos )
|
|||||||
QAction* anEditAction = aModule->action(GEOMOp::OpEditAnnotation);
|
QAction* anEditAction = aModule->action(GEOMOp::OpEditAnnotation);
|
||||||
if ( anEditAction )
|
if ( anEditAction )
|
||||||
aMenu.addAction( anEditAction );
|
aMenu.addAction( anEditAction );
|
||||||
|
QAction* aDeleteAction = aModule->action(GEOMOp::OpDeleteAnnotation);
|
||||||
|
if ( aDeleteAction )
|
||||||
|
aMenu.addAction( aDeleteAction );
|
||||||
// Show/Hide actions
|
// Show/Hide actions
|
||||||
if ( aProp->GetIsVisible( idFromItem( anItem ) ) )
|
if ( aProp->GetIsVisible( idFromItem( anItem ) ) )
|
||||||
aMenu.addAction( myActions[GEOMOp::OpHide] );
|
aMenu.addAction( myActions[GEOMOp::OpHide] );
|
||||||
|
@ -5028,6 +5028,18 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<source>STB_EDIT_ANNOTATION</source>
|
<source>STB_EDIT_ANNOTATION</source>
|
||||||
<translation>Edit Annotation</translation>
|
<translation>Edit Annotation</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>TOP_DELETE_ANNOTATION</source>
|
||||||
|
<translation>Delete Annotation</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>MEN_DELETE_ANNOTATION</source>
|
||||||
|
<translation>Delete</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>STB_DELETE_ANNOTATION</source>
|
||||||
|
<translation>Delete Annotation</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>MEN_POP_SHOW_DEPENDENCY_TREE</source>
|
<source>MEN_POP_SHOW_DEPENDENCY_TREE</source>
|
||||||
<translation>Show dependency tree</translation>
|
<translation>Show dependency tree</translation>
|
||||||
|
@ -686,6 +686,7 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
|
|||||||
case GEOMOp::OpManageDimensions: // MENU MEASURE - MANAGE DIMENSIONS
|
case GEOMOp::OpManageDimensions: // MENU MEASURE - MANAGE DIMENSIONS
|
||||||
case GEOMOp::OpAnnotation: // MENU MEASURE - ANNOTATION
|
case GEOMOp::OpAnnotation: // MENU MEASURE - ANNOTATION
|
||||||
case GEOMOp::OpEditAnnotation: // POPUP MENU - EDIT ANNOTATION
|
case GEOMOp::OpEditAnnotation: // POPUP MENU - EDIT ANNOTATION
|
||||||
|
case GEOMOp::OpDeleteAnnotation: // POPUP MENU - DELETE ANNOTATION
|
||||||
#ifndef DISABLE_PLOT2DVIEWER
|
#ifndef DISABLE_PLOT2DVIEWER
|
||||||
case GEOMOp::OpShapeStatistics: // MENU MEASURE - SHAPE STATISTICS
|
case GEOMOp::OpShapeStatistics: // MENU MEASURE - SHAPE STATISTICS
|
||||||
#endif
|
#endif
|
||||||
@ -1071,6 +1072,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
|||||||
createGeomAction( GEOMOp::OpManageDimensions, "MANAGE_DIMENSIONS" );
|
createGeomAction( GEOMOp::OpManageDimensions, "MANAGE_DIMENSIONS" );
|
||||||
createGeomAction( GEOMOp::OpAnnotation, "ANNOTATION" );
|
createGeomAction( GEOMOp::OpAnnotation, "ANNOTATION" );
|
||||||
createGeomAction( GEOMOp::OpEditAnnotation, "EDIT_ANNOTATION" );
|
createGeomAction( GEOMOp::OpEditAnnotation, "EDIT_ANNOTATION" );
|
||||||
|
createGeomAction( GEOMOp::OpDeleteAnnotation, "DELETE_ANNOTATION" );
|
||||||
|
|
||||||
createGeomAction( GEOMOp::OpTolerance, "TOLERANCE" );
|
createGeomAction( GEOMOp::OpTolerance, "TOLERANCE" );
|
||||||
createGeomAction( GEOMOp::OpWhatIs, "WHAT_IS" );
|
createGeomAction( GEOMOp::OpWhatIs, "WHAT_IS" );
|
||||||
@ -1622,6 +1624,8 @@ void GeometryGUI::initialize( CAM_Application* app )
|
|||||||
|
|
||||||
mgr->insert( action( GEOMOp::OpEditAnnotation ), -1, -1 ); // edit annotation
|
mgr->insert( action( GEOMOp::OpEditAnnotation ), -1, -1 ); // edit annotation
|
||||||
mgr->setRule( action( GEOMOp::OpEditAnnotation ), QString("($component={'GEOM'}) and type='Shape' and selcount=1"), QtxPopupMgr::VisibleRule );
|
mgr->setRule( action( GEOMOp::OpEditAnnotation ), QString("($component={'GEOM'}) and type='Shape' and selcount=1"), QtxPopupMgr::VisibleRule );
|
||||||
|
mgr->insert( action( GEOMOp::OpDeleteAnnotation ), -1, -1 ); // delete annotation
|
||||||
|
mgr->setRule( action( GEOMOp::OpDeleteAnnotation ), QString("($component={'GEOM'}) and type='Shape' and selcount=1"), QtxPopupMgr::VisibleRule );
|
||||||
mgr->insert( separator(), -1, -1 ); // -----------
|
mgr->insert( separator(), -1, -1 ); // -----------
|
||||||
|
|
||||||
QString canDisplay = "($component={'GEOM'}) and (selcount>0) and ({true} in $canBeDisplayed) ",
|
QString canDisplay = "($component={'GEOM'}) and (selcount>0) and ({true} in $canBeDisplayed) ",
|
||||||
@ -2847,13 +2851,21 @@ 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 );
|
|
||||||
|
|
||||||
GEOMGUI_AnnotationMgr* aAnnotationMgr = GetAnnotationMgr();
|
GEOMGUI_AnnotationMgr* anAnnotationMgr = GetAnnotationMgr();
|
||||||
SALOME_ListIteratorOfListIO Iter( aVisible );
|
if ( anAnnotationMgr ) {
|
||||||
for ( ; Iter.More(); Iter.Next() ) {
|
SALOME_ListIteratorOfListIO anIter( aVisible );
|
||||||
aAnnotationMgr->DisplayVisibleAnnotations( QString(Iter.Value()->getEntry()), aViewer );
|
while ( anIter.More() ) {
|
||||||
|
if ( anAnnotationMgr->isAnnotationEntry( anIter.Value()->getEntry() ) ) {
|
||||||
|
aVisible.Remove( anIter );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
anIter.Next();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aDisplayer.Redisplay( aVisible, false, aViewer );
|
||||||
}
|
}
|
||||||
if ( param == QString( "label_color" ) ) {
|
if ( param == QString( "label_color" ) ) {
|
||||||
ViewManagerList aVMsVTK;
|
ViewManagerList aVMsVTK;
|
||||||
|
1
src/GEOMGUI/GeometryGUI_Operations.h
Normal file → Executable file
1
src/GEOMGUI/GeometryGUI_Operations.h
Normal file → Executable file
@ -211,6 +211,7 @@ namespace GEOMOp {
|
|||||||
OpEditAnnotation = 5021, // POPUP MENU - EDIT ANNOTATION
|
OpEditAnnotation = 5021, // POPUP MENU - EDIT ANNOTATION
|
||||||
OpShowAllAnnotations = 5022, // POPUP MENU - SHOW ALL ANNOTATIONS
|
OpShowAllAnnotations = 5022, // POPUP MENU - SHOW ALL ANNOTATIONS
|
||||||
OpHideAllAnnotations = 5023, // POPUP MENU - HIDE ALL ANNOTATIONS
|
OpHideAllAnnotations = 5023, // POPUP MENU - HIDE ALL ANNOTATIONS
|
||||||
|
OpDeleteAnnotation = 5024, // POPUP MENU - DELETE ANNOTATION
|
||||||
// GroupGUI --------------------//--------------------------------
|
// GroupGUI --------------------//--------------------------------
|
||||||
OpGroupCreate = 6000, // MENU GROUP - CREATE
|
OpGroupCreate = 6000, // MENU GROUP - CREATE
|
||||||
OpGroupEdit = 6001, // MENU GROUP - EDIT
|
OpGroupEdit = 6001, // MENU GROUP - EDIT
|
||||||
|
@ -169,6 +169,9 @@ bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
|
|||||||
case GEOMOp::OpHideAllAnnotations:
|
case GEOMOp::OpHideAllAnnotations:
|
||||||
ChangeAnnotationsVisibility( false );
|
ChangeAnnotationsVisibility( false );
|
||||||
break; // HIDE ALL ANNOTATIONS
|
break; // HIDE ALL ANNOTATIONS
|
||||||
|
case GEOMOp::OpDeleteAnnotation:
|
||||||
|
DeleteAnnotation();
|
||||||
|
break; // DELETE ANNOTATIOn
|
||||||
default:
|
default:
|
||||||
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
|
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
|
||||||
break;
|
break;
|
||||||
@ -232,16 +235,16 @@ void MeasureGUI::ChangeAnnotationsVisibility( const bool theIsVisible )
|
|||||||
|| !anIObject->hasEntry() )
|
|| !anIObject->hasEntry() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QString aEntry = anIObject->getEntry(),c_str();
|
const QString aEntry = anIObject->getEntry();
|
||||||
|
|
||||||
_PTR(SObject) aSObj = anActiveStudy->studyDS()->FindObjectID( aEntry.toStdString() );
|
_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();
|
||||||
|
|
||||||
@ -258,6 +261,52 @@ void MeasureGUI::ChangeAnnotationsVisibility( const bool theIsVisible )
|
|||||||
getGeometryGUI()->GetAnnotationMgr()->Display( aEntry , anI );
|
getGeometryGUI()->GetAnnotationMgr()->Display( aEntry , anI );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getGeometryGUI()->emitAnnotationsUpdated( aEntry );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : DeleteAnnotation
|
||||||
|
// purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void MeasureGUI::DeleteAnnotation()
|
||||||
|
{
|
||||||
|
SalomeApp_Application* anApp = getGeometryGUI()->getApp();
|
||||||
|
if ( !anApp )
|
||||||
|
return;
|
||||||
|
|
||||||
|
SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() );
|
||||||
|
if ( !anActiveStudy )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Handle(SALOME_InteractiveObject) anIObject = getSingleSelectedIO();
|
||||||
|
if ( anIObject.IsNull()
|
||||||
|
|| !anIObject->hasEntry() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
const QString aEntry = anIObject->getEntry();
|
||||||
|
|
||||||
|
QString aObjEntry;
|
||||||
|
|
||||||
|
int aIndex = 0;
|
||||||
|
|
||||||
|
if ( getGeometryGUI()->GetAnnotationMgr()->getIndexFromEntry( aEntry, aObjEntry, aIndex ) )
|
||||||
|
{
|
||||||
|
_PTR(SObject) aSObj = anActiveStudy->studyDS()->FindObjectID( aObjEntry.toStdString() );
|
||||||
|
|
||||||
|
const Handle(GEOMGUI_AnnotationAttrs)
|
||||||
|
aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
|
||||||
|
|
||||||
|
if ( aShapeAnnotations.IsNull() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
aShapeAnnotations->Remove( aIndex );
|
||||||
|
|
||||||
|
getGeometryGUI()->GetAnnotationMgr()->EraseRemovedAnnotation( aObjEntry, aIndex );
|
||||||
|
|
||||||
|
getGeometryGUI()->emitAnnotationsUpdated( aObjEntry );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
src/MeasureGUI/MeasureGUI.h
Normal file → Executable file
3
src/MeasureGUI/MeasureGUI.h
Normal file → Executable file
@ -60,6 +60,9 @@ public:
|
|||||||
// Show/hide all shape annotations created for GEOM object
|
// Show/hide all shape annotations created for GEOM object
|
||||||
void ChangeAnnotationsVisibility( const bool theIsVisible );
|
void ChangeAnnotationsVisibility( const bool theIsVisible );
|
||||||
|
|
||||||
|
// Deletes the selected annotation
|
||||||
|
void DeleteAnnotation();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Returns selected interactive object for single selection
|
// Returns selected interactive object for single selection
|
||||||
Handle(SALOME_InteractiveObject) getSingleSelectedIO();
|
Handle(SALOME_InteractiveObject) getSingleSelectedIO();
|
||||||
|
@ -326,6 +326,14 @@ void MeasureGUI_AnnotationDlg::Init()
|
|||||||
|
|
||||||
myGeomGUI->GetAnnotationMgr()->SetPreviewStyle( myEditAnnotationEntry, myEditAnnotationIndex, true );
|
myGeomGUI->GetAnnotationMgr()->SetPreviewStyle( myEditAnnotationEntry, myEditAnnotationIndex, true );
|
||||||
|
|
||||||
|
SalomeApp_Application* anApp = myGeomGUI->getApp();
|
||||||
|
if ( anApp )
|
||||||
|
{
|
||||||
|
OCCViewer_ViewManager* aVM = (OCCViewer_ViewManager*)anApp->getViewManager( OCCViewer_Viewer::Type(), false );
|
||||||
|
OCCViewer_Viewer* aViewer = (OCCViewer_Viewer*)aVM->getViewModel();
|
||||||
|
aViewer->unHighlightAll( true, true );
|
||||||
|
}
|
||||||
|
|
||||||
redisplayPreview();
|
redisplayPreview();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -759,6 +767,8 @@ bool MeasureGUI_AnnotationDlg::execute()
|
|||||||
|
|
||||||
erasePreview( true );
|
erasePreview( true );
|
||||||
|
|
||||||
|
globalSelection( myGeomGUI->getLocalSelectionMode() , true );
|
||||||
|
|
||||||
myGeomGUI->GetAnnotationMgr()->Display( myShape->GetStudyEntry(), aShapeAnnotations->GetNbAnnotation()-1 );
|
myGeomGUI->GetAnnotationMgr()->Display( myShape->GetStudyEntry(), aShapeAnnotations->GetNbAnnotation()-1 );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -249,13 +249,8 @@ bool MeasureGUI_AnnotationInteractor::eventFilter( QObject* theObject, QEvent* t
|
|||||||
mySelection.Append( anAISContext->SelectedOwner() );
|
mySelection.Append( anAISContext->SelectedOwner() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( anAISContext->IsHilighted( myActiveIO ) )
|
|
||||||
{
|
|
||||||
anAISContext->Unhilight( myActiveIO, Standard_False );
|
|
||||||
}
|
|
||||||
|
|
||||||
anAISContext->ClearSelected( Standard_False );
|
anAISContext->ClearSelected( Standard_False );
|
||||||
anAISContext->AddOrRemoveSelected( aDetected );
|
anAISContext->Unhilight( myActiveIO, Standard_True );
|
||||||
|
|
||||||
myActiveViewPort = aViewPort;
|
myActiveViewPort = aViewPort;
|
||||||
myActiveViewPort->grabMouse();
|
myActiveViewPort->grabMouse();
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include <Prs3d_PointAspect.hxx>
|
#include <Prs3d_PointAspect.hxx>
|
||||||
#include <Prs3d_Root.hxx>
|
#include <Prs3d_Root.hxx>
|
||||||
#include <Prs3d_Text.hxx>
|
#include <Prs3d_Text.hxx>
|
||||||
|
#include <Prs3d_IsoAspect.hxx>
|
||||||
#include <Select3D_SensitiveBox.hxx>
|
#include <Select3D_SensitiveBox.hxx>
|
||||||
#include <SelectMgr_EntityOwner.hxx>
|
#include <SelectMgr_EntityOwner.hxx>
|
||||||
#include <V3d_Viewer.hxx>
|
#include <V3d_Viewer.hxx>
|
||||||
@ -207,6 +208,22 @@ void GEOM_Annotation::SetAttachPoint( const gp_Pnt& thePoint )
|
|||||||
myAttach = thePoint;
|
myAttach = thePoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// function : SetHilightShape
|
||||||
|
// purpose : Sets shape (annotated shape) that will be used for hilighting.
|
||||||
|
// =======================================================================
|
||||||
|
void GEOM_Annotation::SetHilightShape( const TopoDS_Shape& theShape )
|
||||||
|
{
|
||||||
|
if ( myShape.IsEqual( theShape ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
myShape = theShape;
|
||||||
|
SetToUpdate();
|
||||||
|
UpdateSelection();
|
||||||
|
}
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : SetColor
|
// function : SetColor
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -505,7 +522,7 @@ void GEOM_Annotation::ComputeSelection( const Handle(SelectMgr_Selection)& theSe
|
|||||||
aBox = aBox.Transformed( aOffset2d );
|
aBox = aBox.Transformed( aOffset2d );
|
||||||
}
|
}
|
||||||
|
|
||||||
const Handle(GEOM_AnnotationOwner) anEntityOwner = new GEOM_AnnotationOwner( this, 10 );
|
const Handle(GEOM_AnnotationOwner) anEntityOwner = new GEOM_AnnotationOwner( myShape, this, 10 );
|
||||||
const Handle(GEOM_AnnotationSensEntity) aSensitive =
|
const Handle(GEOM_AnnotationSensEntity) aSensitive =
|
||||||
new GEOM_AnnotationSensEntity( anEntityOwner, aBox, myIsDepthCulling );
|
new GEOM_AnnotationSensEntity( anEntityOwner, aBox, myIsDepthCulling );
|
||||||
|
|
||||||
@ -866,5 +883,60 @@ void GEOM_Annotation::GEOM_AnnotationOwner::HilightWithColor( const Handle(PrsMg
|
|||||||
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Standard_Integer theMode )
|
const Standard_Integer theMode )
|
||||||
{
|
{
|
||||||
|
if ( myPrsSh.IsNull() )
|
||||||
|
{
|
||||||
|
Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer;
|
||||||
|
aDrawer->Link( Selectable()->HilightAttributes() );
|
||||||
|
|
||||||
|
Handle(Prs3d_IsoAspect) aUIsoAspect = new Prs3d_IsoAspect(
|
||||||
|
aDrawer->UIsoAspect()->Aspect()->Color(),
|
||||||
|
aDrawer->UIsoAspect()->Aspect()->Type(),
|
||||||
|
aDrawer->UIsoAspect()->Aspect()->Width(), 0 );
|
||||||
|
|
||||||
|
Handle(Prs3d_IsoAspect) aVIsoAspect = new Prs3d_IsoAspect(
|
||||||
|
aDrawer->UIsoAspect()->Aspect()->Color(),
|
||||||
|
aDrawer->UIsoAspect()->Aspect()->Type(),
|
||||||
|
aDrawer->UIsoAspect()->Aspect()->Width(), 0 );
|
||||||
|
|
||||||
|
aDrawer->SetIsoOnPlane( Standard_False );
|
||||||
|
aDrawer->SetUIsoAspect( aUIsoAspect );
|
||||||
|
aDrawer->SetVIsoAspect( aVIsoAspect );
|
||||||
|
myPrsSh = new StdSelect_Shape( myShape, aDrawer );
|
||||||
|
}
|
||||||
|
|
||||||
|
myPrsSh->SetZLayer ( Selectable()->ZLayer() );
|
||||||
|
|
||||||
thePM->Color( Selectable(), theStyle, theMode, NULL, Selectable()->ZLayer() );
|
thePM->Color( Selectable(), theStyle, theMode, NULL, Selectable()->ZLayer() );
|
||||||
|
thePM->Color( myPrsSh, theStyle, theMode, Selectable(), Graphic3d_ZLayerId_Topmost );
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// subclass : GEOM_AnnotationOwner
|
||||||
|
// function : Unhilight
|
||||||
|
// purpose : Removes highlighting from the type of shape.
|
||||||
|
// =======================================================================
|
||||||
|
void GEOM_Annotation::GEOM_AnnotationOwner::Unhilight ( const Handle(PrsMgr_PresentationManager)& thePM,
|
||||||
|
const Standard_Integer theMode )
|
||||||
|
{
|
||||||
|
SelectMgr_EntityOwner::Unhilight( thePM, theMode );
|
||||||
|
|
||||||
|
thePM->Unhighlight( myPrsSh, theMode );
|
||||||
|
}
|
||||||
|
|
||||||
|
// =======================================================================
|
||||||
|
// subclass : GEOM_AnnotationOwner
|
||||||
|
// function : Clear
|
||||||
|
// purpose : Clears the presentation manager object aPM of all shapes
|
||||||
|
// with the given selection mode.
|
||||||
|
// =======================================================================
|
||||||
|
void GEOM_Annotation::GEOM_AnnotationOwner::Clear ( const Handle(PrsMgr_PresentationManager)& thePM,
|
||||||
|
const Standard_Integer theMode )
|
||||||
|
{
|
||||||
|
SelectMgr_EntityOwner::Clear( thePM, theMode );
|
||||||
|
|
||||||
|
if ( !myPrsSh.IsNull() ) {
|
||||||
|
thePM->Clear( myPrsSh, theMode );
|
||||||
|
}
|
||||||
|
|
||||||
|
myPrsSh.Nullify();
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include <PrsMgr_PresentationManager3d.hxx>
|
#include <PrsMgr_PresentationManager3d.hxx>
|
||||||
#include <Select3D_SensitiveBox.hxx>
|
#include <Select3D_SensitiveBox.hxx>
|
||||||
#include <SelectMgr_EntityOwner.hxx>
|
#include <SelectMgr_EntityOwner.hxx>
|
||||||
|
#include <StdSelect_Shape.hxx>
|
||||||
#include <TCollection_ExtendedString.hxx>
|
#include <TCollection_ExtendedString.hxx>
|
||||||
|
|
||||||
class OpenGl_GraphicDriver;
|
class OpenGl_GraphicDriver;
|
||||||
@ -121,6 +122,12 @@ public:
|
|||||||
//! Returns attachment point of extension line.
|
//! Returns attachment point of extension line.
|
||||||
const gp_Pnt& GetAttachPoint() const { return myAttach; }
|
const gp_Pnt& GetAttachPoint() const { return myAttach; }
|
||||||
|
|
||||||
|
//! Sets shape (annotated shape) that will be used for hilighting.
|
||||||
|
Standard_EXPORT void SetHilightShape( const TopoDS_Shape& theShape );
|
||||||
|
|
||||||
|
//! Returns the hilighting shape.
|
||||||
|
const TopoDS_Shape HilightShape() const { return myShape; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Sets color for the presentation.
|
//! Sets color for the presentation.
|
||||||
@ -279,6 +286,7 @@ private:
|
|||||||
Standard_Boolean myIsDepthCulling; //!< Flag indiciating whether the "depth culling" is turned on.
|
Standard_Boolean myIsDepthCulling; //!< Flag indiciating whether the "depth culling" is turned on.
|
||||||
HighlightMode myHilightMode; //!< Highlight mode for presentation.
|
HighlightMode myHilightMode; //!< Highlight mode for presentation.
|
||||||
TCollection_ExtendedString myText; //!< Text string of the label presentation.
|
TCollection_ExtendedString myText; //!< Text string of the label presentation.
|
||||||
|
TopoDS_Shape myShape; //!< Hilighting shape.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -341,9 +349,11 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
GEOM_AnnotationOwner( const Handle(SelectMgr_SelectableObject)& theSelectable,
|
GEOM_AnnotationOwner( const TopoDS_Shape& theShape,
|
||||||
const Standard_Integer thePriority = 0 )
|
const Handle(SelectMgr_SelectableObject)& theSelectable,
|
||||||
: SelectMgr_EntityOwner( theSelectable, thePriority ) {}
|
const Standard_Integer thePriority )
|
||||||
|
: SelectMgr_EntityOwner( theSelectable, thePriority ),
|
||||||
|
myShape( theShape ) {}
|
||||||
|
|
||||||
//! Perform highlighting of the presentation.
|
//! Perform highlighting of the presentation.
|
||||||
//! \param thePresentationMgr [in] the presentation manager.
|
//! \param thePresentationMgr [in] the presentation manager.
|
||||||
@ -353,6 +363,22 @@ public:
|
|||||||
HilightWithColor( const Handle(PrsMgr_PresentationManager3d)& thePM,
|
HilightWithColor( const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||||
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
const Handle(Graphic3d_HighlightStyle)& theStyle,
|
||||||
const Standard_Integer theMode = 0 ) Standard_OVERRIDE;
|
const Standard_Integer theMode = 0 ) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Removes highlighting from the type of shape.
|
||||||
|
virtual void
|
||||||
|
Unhilight ( const Handle(PrsMgr_PresentationManager)& thePM,
|
||||||
|
const Standard_Integer theMode = 0 ) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
//! Clears the presentation manager object aPM of all shapes
|
||||||
|
//! with the given selection mode.
|
||||||
|
virtual void
|
||||||
|
Clear ( const Handle(PrsMgr_PresentationManager)& thePM,
|
||||||
|
const Standard_Integer theMode = 0 ) Standard_OVERRIDE;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
TopoDS_Shape myShape;
|
||||||
|
Handle(StdSelect_Shape) myPrsSh;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Custom sensitive entity with implementing option to support selection
|
//! Custom sensitive entity with implementing option to support selection
|
||||||
|
Loading…
Reference in New Issue
Block a user