mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-15 04:00:40 +05:00
Dialog usability fixes
This commit is contained in:
parent
8935becb09
commit
bc38a38ac1
@ -149,8 +149,8 @@ MeasureGUI_AnnotationDlg::MeasureGUI_AnnotationDlg( GeometryGUI* theGeometryGUI,
|
|||||||
// data type
|
// data type
|
||||||
QLabel* typeLabel = new QLabel( tr( "ANNOTATION_TYPE" ), propGroup );
|
QLabel* typeLabel = new QLabel( tr( "ANNOTATION_TYPE" ), propGroup );
|
||||||
myTypeCombo = new QComboBox( propGroup );
|
myTypeCombo = new QComboBox( propGroup );
|
||||||
myTypeCombo->insertItem( 0, tr( "3D" ) );
|
myTypeCombo->addItem( tr( "3D" ), 0 );
|
||||||
myTypeCombo->insertItem( 1, tr( "2D" ) );
|
myTypeCombo->addItem( tr( "2D" ), 1 );
|
||||||
myTypeCombo->setCurrentIndex( 0 ); // 3D, not fixed
|
myTypeCombo->setCurrentIndex( 0 ); // 3D, not fixed
|
||||||
|
|
||||||
propLayout->addWidget( shapeLabel, 1, 0 );
|
propLayout->addWidget( shapeLabel, 1, 0 );
|
||||||
@ -211,7 +211,6 @@ MeasureGUI_AnnotationDlg::MeasureGUI_AnnotationDlg( GeometryGUI* theGeometryGUI,
|
|||||||
myInteractor->Enable();
|
myInteractor->Enable();
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
//updateState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -246,7 +245,7 @@ void MeasureGUI_AnnotationDlg::Init()
|
|||||||
activateSelectionArgument( myShapeSelBtn );
|
activateSelectionArgument( myShapeSelBtn );
|
||||||
myTextEdit->setText( myAnnotationProperties.Text );
|
myTextEdit->setText( myAnnotationProperties.Text );
|
||||||
myShapeNameModified = false;
|
myShapeNameModified = false;
|
||||||
myTypeCombo->setCurrentIndex( !myAnnotationProperties.IsScreenFixed );
|
myTypeCombo->setCurrentIndex( 0 );
|
||||||
|
|
||||||
int aSubShapeTypeIndex = -1;
|
int aSubShapeTypeIndex = -1;
|
||||||
int aTypesCount = aTypesCount = mySubShapeTypeCombo->count();
|
int aTypesCount = aTypesCount = mySubShapeTypeCombo->count();
|
||||||
@ -285,10 +284,10 @@ void MeasureGUI_AnnotationDlg::Init()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void MeasureGUI_AnnotationDlg::activateSelection()
|
void MeasureGUI_AnnotationDlg::activateSelection()
|
||||||
{
|
{
|
||||||
//globalSelection( GEOM_ALLSHAPES );
|
globalSelection( GEOM_ALLOBJECTS );
|
||||||
//if ( !myShape->_is_nil() && mySelectionMode != TopAbs_SHAPE ) {
|
if ( !myShape->_is_nil() && mySelectionMode != TopAbs_SHAPE ) {
|
||||||
// localSelection( myShape.get(), mySelectionMode );
|
localSelection( myShape.get(), mySelectionMode );
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -424,7 +423,7 @@ void MeasureGUI_AnnotationDlg::SelectionIntoArgument()
|
|||||||
myEditCurrentArgument->setText( aName );
|
myEditCurrentArgument->setText( aName );
|
||||||
if ( !myShapeNameModified ) {
|
if ( !myShapeNameModified ) {
|
||||||
myTextEdit->setText( aName );
|
myTextEdit->setText( aName );
|
||||||
myShapeNameModified = false;
|
onTextChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -434,7 +433,7 @@ void MeasureGUI_AnnotationDlg::SelectionIntoArgument()
|
|||||||
|
|
||||||
activateSelection();
|
activateSelection();
|
||||||
|
|
||||||
if ( !myShape->_is_nil() ) {
|
if ( !aNullShape ) {
|
||||||
if ( !getPickedPoint( anAttachPoint ) )
|
if ( !getPickedPoint( anAttachPoint ) )
|
||||||
{
|
{
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
@ -444,34 +443,36 @@ void MeasureGUI_AnnotationDlg::SelectionIntoArgument()
|
|||||||
}
|
}
|
||||||
} else if ( myEditCurrentArgument == mySubShapeName ) {
|
} else if ( myEditCurrentArgument == mySubShapeName ) {
|
||||||
if ( !myShape->_is_nil() ) {
|
if ( !myShape->_is_nil() ) {
|
||||||
QString aName = GEOMBase::GetName( anObj.get() );
|
|
||||||
myEditCurrentArgument->setText( aName );
|
|
||||||
|
|
||||||
TopTools_IndexedMapOfShape aMainMap;
|
if ( anObj->_is_nil() ) {
|
||||||
TopoDS_Shape aMainShape;
|
myEditCurrentArgument->setText( QString() );
|
||||||
GEOMBase::GetShape( myShape.get(), aMainShape );
|
}
|
||||||
TopExp::MapShapes( aMainShape, aMainMap );
|
else {
|
||||||
|
|
||||||
TopExp_Explorer anExp( aMainShape, getShapeType() );
|
QString aName = GEOMBase::GetName( anObj.get() );
|
||||||
bool isShowWarning = true;
|
myEditCurrentArgument->setText( aName );
|
||||||
|
|
||||||
TopoDS_Shape aSubShape;
|
TopTools_IndexedMapOfShape aMainMap;
|
||||||
for ( ; anExp.More() && aSubShapeIndex < 0; anExp.Next() ) {
|
TopoDS_Shape aMainShape;
|
||||||
TopoDS_Shape aCurrentSubShape = anExp.Current();
|
TopoDS_Shape aSubShape;
|
||||||
int anIndex = aMainMap.FindIndex( aCurrentSubShape );
|
GEOMBase::GetShape( myShape.get(), aMainShape );
|
||||||
if ( anIndex >= 0 ) {
|
GEOMBase::GetShape( anObj.get(), aSubShape );
|
||||||
aSubShapeIndex = anIndex;
|
TopExp::MapShapes( aMainShape, getShapeType(), aMainMap );
|
||||||
aSubShape = aCurrentSubShape;
|
|
||||||
|
if ( aMainMap.Contains( aSubShape ) ) {
|
||||||
|
aSubShapeIndex = aMainMap.FindIndex( aSubShape );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !aSubShape.IsNull() )
|
||||||
|
{
|
||||||
|
if ( !getPickedPoint( anAttachPoint ) )
|
||||||
|
{
|
||||||
|
anAttachPoint = getAttachPoint( aSubShape );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !getPickedPoint( anAttachPoint ) )
|
|
||||||
{
|
|
||||||
anAttachPoint = getAttachPoint( aSubShape );
|
|
||||||
}
|
|
||||||
|
|
||||||
myAnnotationProperties.ShapeIndex = aSubShapeIndex;
|
|
||||||
}
|
}
|
||||||
|
myAnnotationProperties.ShapeIndex = aSubShapeIndex;
|
||||||
}
|
}
|
||||||
myAnnotationProperties.Attach = anAttachPoint;
|
myAnnotationProperties.Attach = anAttachPoint;
|
||||||
}
|
}
|
||||||
@ -507,10 +508,12 @@ void MeasureGUI_AnnotationDlg::onTypeChange()
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void MeasureGUI_AnnotationDlg::onSubShapeTypeChange()
|
void MeasureGUI_AnnotationDlg::onSubShapeTypeChange()
|
||||||
{
|
{
|
||||||
activateSelectionArgument( mySubShapeSelBtn );
|
const TopAbs_ShapeEnum aShapeType = getShapeType();
|
||||||
|
|
||||||
|
activateSelectionArgument( aShapeType == TopAbs_SHAPE ? myShapeSelBtn : mySubShapeSelBtn );
|
||||||
|
|
||||||
TopAbs_ShapeEnum aShapeType = getShapeType();
|
|
||||||
myAnnotationProperties.ShapeType = aShapeType;
|
myAnnotationProperties.ShapeType = aShapeType;
|
||||||
|
|
||||||
if ( aShapeType != mySelectionMode ) {
|
if ( aShapeType != mySelectionMode ) {
|
||||||
mySubShapeName->setText( "" );
|
mySubShapeName->setText( "" );
|
||||||
myAnnotationProperties.ShapeIndex = -1;
|
myAnnotationProperties.ShapeIndex = -1;
|
||||||
@ -636,7 +639,8 @@ SALOME_Prs* MeasureGUI_AnnotationDlg::buildPrs()
|
|||||||
aPresentation->SetLineWidth( aLineWidth );
|
aPresentation->SetLineWidth( aLineWidth );
|
||||||
aPresentation->SetLineStyle( static_cast<Aspect_TypeOfLine>( aLineStyle ) );
|
aPresentation->SetLineStyle( static_cast<Aspect_TypeOfLine>( aLineStyle ) );
|
||||||
aPresentation->SetAutoHide( isAutoHide ? Standard_True : Standard_False );
|
aPresentation->SetAutoHide( isAutoHide ? Standard_True : Standard_False );
|
||||||
|
aPresentation->SetScreenFixed( myAnnotationProperties.IsScreenFixed );
|
||||||
|
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
GEOMBase::GetShape( myShape.get(), aShape );
|
GEOMBase::GetShape( myShape.get(), aShape );
|
||||||
gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() );
|
gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() );
|
||||||
@ -682,9 +686,8 @@ void MeasureGUI_AnnotationDlg::redisplayPreview()
|
|||||||
erasePreview( false );
|
erasePreview( false );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//SUIT_OverrideCursor wc;
|
SUIT_OverrideCursor wc;
|
||||||
//getDisplayer()->SetColor( Quantity_NOC_VIOLET );
|
getDisplayer()->SetToActivate( true );
|
||||||
//getDisplayer()->SetToActivate( false );
|
|
||||||
|
|
||||||
if ( SALOME_Prs* aPrs = buildPrs() )
|
if ( SALOME_Prs* aPrs = buildPrs() )
|
||||||
displayPreview( aPrs );
|
displayPreview( aPrs );
|
||||||
@ -705,7 +708,7 @@ bool MeasureGUI_AnnotationDlg::getPickedPoint( gp_Pnt& thePnt )
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
const OCCViewer_ViewWindow* anOccView = qobject_cast<const OCCViewer_ViewWindow*>( anActiveView );
|
const OCCViewer_ViewWindow* anOccView = qobject_cast<const OCCViewer_ViewWindow*>( anActiveView );
|
||||||
if ( !anOccView )
|
if ( !anOccView || !anOccView->underMouse() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
OCCViewer_ViewManager* aVM = ( OCCViewer_ViewManager* )anOccView->getViewManager();
|
OCCViewer_ViewManager* aVM = ( OCCViewer_ViewManager* )anOccView->getViewManager();
|
||||||
|
Loading…
Reference in New Issue
Block a user