-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <SalomeApp_Application.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
+#include "utilities.h"
#include <DlgRef.h>
#include <QKeyEvent>
+#include <QButtonGroup>
#include <BRep_Tool.hxx>
#include <TopExp.hxx>
bool modal, Qt::WindowFlags fl,
const double lineWidth )
: QDialog( parent, fl ),
+ GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) ),
myIsAllAdded( false ),
myIsApply( false ),
- GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) ),
myGeometryGUI( GUI ),
myLineWidth( lineWidth )
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
setModal( modal );
setAttribute( Qt::WA_DeleteOnClose );
-
+
// Disable rectangular selection
// SUIT_ViewWindow* theViewWindow = getDesktop()->activeWindow();
// ((OCCViewer_ViewWindow*)theViewWindow)->setEnabledDrawMode( false );
// OCCViewer_ViewSketcher* aViewSketcher = ((OCCViewer_ViewWindow*)theViewWindow)->getSketcher( OCCViewer_ViewWindow::Rect );
// aViewSketcher->deactivate()
// aViewSketcher->setVisible(false);
-
+
// this->setMouseTracking(false);
-
+
myGeometryGUI->SetActiveDialogBox(this);
MainWidget = new EntityGUI_Skeleton( this );
planeButton = new QPushButton (GroupBox1);
planeButton->setText( tr( "GEOM_SKETCHER_RESTORE" ) );
planeLayout->addWidget(planeButton,0,2);
-
+
selButton = new QPushButton (GroupBox1);
selButton->setIcon(image5);
planeLayout->addWidget(selButton,1,0);
-
+
WPlaneLineEdit = new QLineEdit (GroupBox1);
WPlaneLineEdit->setReadOnly(true);
planeLayout->addWidget(WPlaneLineEdit,1,1,1,2);
-
+
planeLayout->setColumnStretch(1,1);
-
+
topLayout->addWidget(GroupBox1);
topLayout->addWidget( MainWidget );
topLayout->setStretch( 1, 1);
GroupPt2 = new EntityGUI_Point( MainWidget->DestCnt );
- GroupPt2->GroupPoint->setTitle( tr( "GEOM_SKETCHER_ADD_PARAMS" ) );
+ GroupPt2->GroupPoint->setTitle( tr( "GEOM_SKETCHER_ADD_PARAMS" ) );
GroupPt2->RB_Point1->setText( tr( "GEOM_SKETCHER_NONE" ) );
GroupPt2->RB_Point2->setText( tr( "GEOM_SKETCHER_RADIUS" ) );
- GroupPt2->RB_Point3->setText( tr( "GEOM_SKETCHER_CENTER" ) );
+ GroupPt2->RB_Point3->setText( tr( "GEOM_SKETCHER_CENTER" ) );
GroupD1 = new EntityGUI_Dir1( MainWidget->DestCnt );
Group4Spin->checkBox->setText( tr( "GEOM_REVERSE" ) );
Group4Spin->buttonUndo->setIcon( image1 );
Group4Spin->buttonRedo->setIcon( image2 );
-
+
GroupRect = new DlgRef_4Spin( MainWidget->SkeletonCnt );
GroupRect->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
GroupRect->TextLabel1->setText("X1:");
GroupRect->TextLabel3->setText("X2:");
GroupRect->TextLabel4->setText("Y2:");
- // Defines a palette for the error message on Group4Spin and Group2Sel
+ // Defines a palette for the error message on Group4Spin and Group2Sel
QPalette palette;
QColor color("red");
palette.setColor(Group4Spin->label->foregroundRole(), color);
connect( myGeometryGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
connect( myGeometryGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) );
-
+
// install event filter on spin-boxes to provide Apply action on Return pressed
Group1Spin->SpinBox_DX->installEventFilter(this);
Group1Sel1Spin->SpinBox_DX->installEventFilter(this);
EntityGUI_SketcherDlg::~EntityGUI_SketcherDlg()
{
// SUIT_ViewWindow* theViewWindow = getDesktop()->activeWindow();
-
+
myGeometryGUI->SetActiveDialogBox( 0 );
// ((OCCViewer_ViewWindow*)theViewWindow)->setSketcherStyle(false);
}
{
/* init variables */
autoApply = false;
-
+
myEditCurrentArgument = WPlaneLineEdit; // Initiate the parameters selection with the first WPlaneLineEdit
-
+
myCommand.append( "Sketcher" );
myUndoCommand.append( "Sketcher" );
myLastY2 = 0.0;
myHelpFileName = "create_sketcher_page.html";
-
- GEOM::GEOM_IBasicOperations_var aBasicOp = getGeomEngine()->GetIBasicOperations( getStudyId() );
+
+ GEOM::GEOM_IBasicOperations_var aBasicOp = getGeomEngine()->GetIBasicOperations();
myGlobalCS = aBasicOp->MakeMarker( 0,0,0,
1,0,0,
- 0,1,0 );
+ 0,1,0 );
myWPlane = myGlobalCS;
myLCSList.push_back( WPlaneToLCS(myGlobalCS) );
initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, 0.1, "length_precision" );
initSpinBox( Group4Spin->SpinBox_DY, COORD_MIN, COORD_MAX, 0.1, "length_precision" );
initSpinBox( Group4Spin->SpinBox_DS, COORD_MIN, COORD_MAX, 5., "length_precision" );
-
- initSpinBox( GroupRect->SpinBox_DX1, COORD_MIN, COORD_MAX, step, "length_precision" );
+
+ initSpinBox( GroupRect->SpinBox_DX1, COORD_MIN, COORD_MAX, step, "length_precision" );
initSpinBox( GroupRect->SpinBox_DY1, COORD_MIN, COORD_MAX, step, "length_precision" );
initSpinBox( GroupRect->SpinBox_DX2, COORD_MIN, COORD_MAX, step, "length_precision" );
initSpinBox( GroupRect->SpinBox_DY2, COORD_MIN, COORD_MAX, step, "length_precision" );
-
+
/* displays Dialog */
// MainWidget->RadioButton1->setEnabled( false );
TypeClicked( 0 );
// If a face has already been selected use it. Placed after FindLocalCS to avoid clearing the combobox
// that should be filled with the possibly selected face
-
+
OnFirstPoint();
-
- SelectionIntoArgument();
-
+
+ SelectionIntoArgument();
+
resize(100,100);
-
+
setPrefix(tr("GEOM_SKETCH"));
ActivateLocalCS();
-
+
setIsWaitCursorEnabled( false );
GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
}
Group4Spin->hide();
GroupRect->hide();
globalSelection(); // close local selection to clear it
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
}
myConstructorId = constructorId;
MainWidget->buttonEnd->setText(tr("GEOM_BUT_CLOSE"));
MainWidget->buttonClose->setEnabled(true);
-
+
if ( myConstructorId == 0 ) { // SEGMENT
GroupPt2->RB_Point1->setChecked( true );
GroupPt ->setEnabled( true );
GroupD2->setEnabled( true );
MainWidget->RB_Dest1->setEnabled( true );
MainWidget->RB_Dest1->setChecked( true );
-
+
MainWidget->GroupDest ->setEnabled( true );
MainWidget->GroupDest1->setEnabled( true );
MainWidget->GroupDest ->show();
GroupD2->RB_Dir21->setChecked( true );
GroupD1->setEnabled( true );
GroupD2->setEnabled( false );
- MainWidget->RB_Dest1->setEnabled( true );
+ MainWidget->RB_Dest1->setEnabled( true );
MainWidget->RB_Dest1->setChecked( true );
-
+
MainWidget->GroupDest ->setEnabled( true );
MainWidget->GroupDest1->setEnabled( true );
MainWidget->GroupDest ->show();
GroupD2 ->hide();
MainWidget->GroupDest ->hide();
MainWidget->GroupDest1->hide();
-
+
MainWidget->buttonEnd->setText(tr("Apply and Close"));
MainWidget->buttonClose->setEnabled(false);
-
+
GroupRect->setEnabled( true );
MainWidget->RadioButton1->setEnabled( true );
MainWidget->RadioButton2->setEnabled( true );
-
+
RectClicked();
}
}
void EntityGUI_SketcherDlg::RectClicked()
{
InitClick();
-
- // Connect the selction manager (disconnected in InitClick())
+
+ // Connect the selection manager (disconnected in InitClick())
connect( myGeometryGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
-
+
GroupRect->show();
-
+
myX1=0;
- myX2=10;
+ GroupRect->SpinBox_DX1->setValue(myX1);
myY1=0;
- myY2=10;
-
- GroupRect->SpinBox_DX1->setValue(myX1);
GroupRect->SpinBox_DY1->setValue(myY1);
+ myX2=10;
GroupRect->SpinBox_DX2->setValue(myX2);
+ myY2=10;
GroupRect->SpinBox_DY2->setValue(myY2);
-
+
resize( minimumSizeHint() );
-
+
GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
}
void EntityGUI_SketcherDlg::PointClicked( int constructorId )
{
MESSAGE("PointClicked")
- myConstructorPntId = constructorId;
+ myConstructorPntId = constructorId;
GroupPt->RB_Point3->setEnabled( true );
int buttonId = GroupPt2->ButtonGroup->checkedId();
if (buttonId >= 0){ // = If a button is checked
Point2Clicked(buttonId);
}
- else{
+ else{
GroupPt2->RB_Point1->setChecked( true );
- Point2Clicked( 1 );
+ Point2Clicked( 1 );
}
}
}
else if ( constructorId == 0 ){ // Point + radius
mySketchType = PT_ABS_RADIUS;
- initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
+ initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step/10.0, "length_precision" );
Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) );
Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) );
- Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_RADIUS2" ) );
+ Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_RADIUS2" ) );
myX = 0.0;
Group3Spin->SpinBox_DX->setValue( myX );
myY = 0.0;
Group3Spin->SpinBox_DY->setValue( myY );
myRadius=0.0;
- Group3Spin->SpinBox_DZ->setValue( myRadius );
+ Group3Spin->SpinBox_DZ->setValue( myRadius );
Group3Spin->show();
Group3Spin->buttonApply->setFocus();
}
else if ( constructorId == 2 ){ // Point + center
mySketchType = PT_ABS_CENTER;
- initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
+ initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
initSpinBox( Group4Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
initSpinBox( Group4Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
initSpinBox( Group4Spin->SpinBox_DS, COORD_MIN, COORD_MAX, step, "length_precision" );
Group4Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_X2" ) );
Group4Spin->TextLabel4->setText( tr( "GEOM_SKETCHER_Y2" ) );
Group4Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_CENTER_X" ) );
- Group4Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_CENTER_Y" ) );
+ Group4Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_CENTER_Y" ) );
myXc = 0.0;
Group4Spin->SpinBox_DX->setValue( myXc );
myYc = 0.0;
Group4Spin->SpinBox_DY->setValue( myYc );
myX = 0.0;
- Group4Spin->SpinBox_DZ->setValue( myX );
+ Group4Spin->SpinBox_DZ->setValue( myX );
myY = 0.0;
Group4Spin->SpinBox_DS->setValue( myY );
Group4Spin->show();
GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
}
- else if ( constructorId == 0 ){ // Point + radius
+ else if ( constructorId == 0 ){ // Point + radius
mySketchType = PT_REL_RADIUS;
- initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
+ initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step/10.0, "length_precision" );
Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) );
Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) );
- Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_RADIUS2" ) );
+ Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_RADIUS2" ) );
myDX = 10.0;
Group3Spin->SpinBox_DX->setValue( myDX );
myDY = 0.0;
}
else if ( constructorId == 2 ){ // Point + center
mySketchType = PT_REL_CENTER;
- initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
+ initSpinBox( Group4Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
initSpinBox( Group4Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
initSpinBox( Group4Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
initSpinBox( Group4Spin->SpinBox_DS, COORD_MIN, COORD_MAX, step, "length_precision" );
Group4Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_DX2" ) );
Group4Spin->TextLabel4->setText( tr( "GEOM_SKETCHER_DY2" ) );
Group4Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_CENTER_DX" ) );
- Group4Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_CENTER_DY" ) );
+ Group4Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_CENTER_DY" ) );
myDXc = 0.0;
Group4Spin->SpinBox_DX->setValue( myDXc );
myDYc = 0.0;
Group4Spin->SpinBox_DY->setValue( myDYc );
myDX = 0.0;
- Group4Spin->SpinBox_DZ->setValue( myDX );
+ Group4Spin->SpinBox_DZ->setValue( myDX );
myDY = 0.0;
Group4Spin->SpinBox_DS->setValue( myDY );
Group4Spin->show();
if ( constructorId == 1 ){ // No additional parameter
mySketchType = PT_SEL;
myEditCurrentArgument = Group1Sel->LineEdit1;
- Group1Sel->TextLabel1->setText( tr( "GEOM_SKETCHER_END_POINT2" ) );
+ Group1Sel->TextLabel1->setText( tr( "GEOM_SKETCHER_END_POINT2" ) );
Group1Sel->show();
Group1Sel->buttonApply->setFocus();
SelectionIntoArgument();
}
- else if ( constructorId == 0 ){ // Point + radius
+ else if ( constructorId == 0 ){ // Point + radius
mySketchType = PT_SEL_RADIUS;
myEditCurrentArgument = Group1Sel1Spin->LineEdit1;
initSpinBox( Group1Sel1Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step/10.0, "length_precision" );
- Group1Sel1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_END_POINT2" ) );
- Group1Sel1Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_RADIUS2" ) );
+ Group1Sel1Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_END_POINT2" ) );
+ Group1Sel1Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_RADIUS2" ) );
myRadius=0.0;
Group1Sel1Spin->SpinBox_DX->setValue( myRadius );
Group1Sel1Spin->buttonApply->setFocus();
SelectionIntoArgument();
}
- else if ( constructorId == 2 ){ // Point + center
+ else if ( constructorId == 2 ){ // Point + center
mySketchType = PT_SEL_CENTER;
myEditCurrentArgument = Group2Sel->LineEdit1;
- Group2Sel->TextLabel2->setText( tr( "GEOM_SKETCHER_END_POINT2" ) );
+ Group2Sel->TextLabel2->setText( tr( "GEOM_SKETCHER_END_POINT2" ) );
Group2Sel->TextLabel1->setText( tr( "GEOM_SKETCHER_CENTER2" ) );
Group2Sel->LineEdit1->setEnabled(true);
Group2Sel->PushButton1->setDown(true);
resize( minimumSizeHint() );
connect( myGeometryGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
-
+
}
if (dirButtonId >= 0){ // = If a button is checked
Dir2Clicked(dirButtonId);
}
- else{
+ else{
GroupD2->RB_Dir21->setChecked( true );
- Dir2Clicked( 2 );
+ Dir2Clicked( 2 );
}
}
{
InitClick();
Group3Spin->SpinBox_DX->blockSignals(true); // Block signals in order not to modify
- Group3Spin->SpinBox_DY->blockSignals(true); // defaut values
+ Group3Spin->SpinBox_DY->blockSignals(true); // default values
Group3Spin->SpinBox_DZ->blockSignals(true);
-
+
Group2Spin->SpinBox_DX->blockSignals(true);
Group2Spin->SpinBox_DY->blockSignals(true);
-
- Group4Spin->SpinBox_DX->blockSignals(true);
+
+ Group4Spin->SpinBox_DX->blockSignals(true);
Group4Spin->SpinBox_DY->blockSignals(true);
Group4Spin->SpinBox_DZ->blockSignals(true);
- Group4Spin->SpinBox_DS->blockSignals(true);
-
+ Group4Spin->SpinBox_DS->blockSignals(true);
+
// Get setting of step value from file configuration
double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 );
}
else if ( constructorId == 1 ) { // Y
mySketchType = DIR_ANGLE_Y;
- initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "angle_precision" );
+ initSpinBox( Group2Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, "angle_precision" );
Group2Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) );
Group2Spin->SpinBox_DY->setValue( myY );
}
}
}
Group3Spin->SpinBox_DX->blockSignals(false); // Restore signals
- Group3Spin->SpinBox_DY->blockSignals(false);
+ Group3Spin->SpinBox_DY->blockSignals(false);
Group3Spin->SpinBox_DZ->blockSignals(false);
-
+
Group2Spin->SpinBox_DX->blockSignals(false);
Group2Spin->SpinBox_DY->blockSignals(false);
-
- Group4Spin->SpinBox_DX->blockSignals(false);
+
+ Group4Spin->SpinBox_DX->blockSignals(false);
Group4Spin->SpinBox_DY->blockSignals(false);
Group4Spin->SpinBox_DZ->blockSignals(false);
- Group4Spin->SpinBox_DS->blockSignals(false);
-
+ Group4Spin->SpinBox_DS->blockSignals(false);
+
resize( minimumSizeHint() );
GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
}
}
QString Command = myCommand.join( "" );
- Sketcher_Profile aProfile = Sketcher_Profile( Command.toAscii() );
+ Sketcher_Profile aProfile = Sketcher_Profile( Command.toLatin1() );
bool isDone = false;
TopoDS_Shape myShape = aProfile.GetShape( &isDone );
if ( isDone ) {
( Group4Spin->buttonApply->isEnabled() && Group4Spin->isVisible() ) ||
( Group1Sel->buttonApply->isEnabled() && Group1Sel->isVisible() ) ||
( Group2Sel->buttonApply->isEnabled() && Group2Sel->isVisible() ) ||
- ( Group1Sel1Spin->buttonApply->isEnabled() && Group1Sel1Spin->isVisible() ) ) {
+ ( Group1Sel1Spin->buttonApply->isEnabled() && Group1Sel1Spin->isVisible() ) ) {
ClickOnApply();
}*/
// ClickOnApply(); // TEST remove then
(Group4Spin->SpinBox_DX)->setFocus();
(Group4Spin->SpinBox_DX)->selectAll();
}
-
+
return true;
}
myUndoParameters.pop_back();
mySketchState = NEXT_POINT;
-
+
OnNextPoint();
-
+
setEnabledUndo( true );
if ( myUndoCommand.count() == 1 )
LightApp_SelectionMgr* aSelMgr = myGeometryGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
-
+
this->activateWindow();
-
+
if (aSelList.Extent() == 0)
{
selButton->setDown(false);
WPlaneLineEdit->setText(tr("GEOM_SKETCHER_WPLANE"));
return;
}
- else if (aSelList.Extent() != 1)
+ else if (aSelList.Extent() != 1)
return;
-
+
double tmpX = myX;
double tmpY = myY;
myX = myLastX1;
myY = myLastY1;
-
+
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
if (myEditCurrentArgument == WPlaneLineEdit)
aNeedType = TopAbs_FACE;
-
-
+
+
GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
TopoDS_Shape aShape;
-
- if(aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape)
+
+ if(aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape)
&& !aShape.IsNull())
- {
- QString aName = GEOMBase::GetName( aSelectedObject.get() );
- if (myEditCurrentArgument==WPlaneLineEdit)
- {
+ {
+ QString aName = GEOMBase::GetName( aSelectedObject.get() );
+ if (myEditCurrentArgument==WPlaneLineEdit)
+ {
// Check if the face is planar
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aShape));
GeomLib_IsPlanarSurface aPlanarCheck(aSurf, Precision::Confusion());
-
+
if (aPlanarCheck.IsPlanar())
{
myEditCurrentArgument->setText(aName);
{
myEditCurrentArgument->setText(tr("GEOM_SKETCHER_WPLANE"));
// The following leads to crash TODO : find a way to return a warning
-// Standard_Failure::Raise(tr("GEOM_SKETCHER_NOT_PLANAR").toStdString().c_str());
+// Standard_Failure::Raise(tr("GEOM_SKETCHER_NOT_PLANAR").toStdString().c_str());
}
- }
+ }
else
{
gp_Trsf aTrans;
aShape = aTransformation.Shape();
gp_Pnt aPnt;
- if ( GEOMBase::VertexToPoint( aShape, aPnt ) )
+ if ( GEOMBase::VertexToPoint( aShape, aPnt ) )
{
myEditCurrentArgument->setText(aName);
myX = aPnt.X();
- myY = aPnt.Y();
+ myY = aPnt.Y();
double Xcoord = myX;
double Ycoord = myY;
-
+
switch (mySketchType)
{
case PT_ABS:
disconnect( Group2Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
disconnect( Group2Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
-
+
Group2Spin->SpinBox_DX->setValue(Xcoord);
Group2Spin->SpinBox_DY->setValue(Ycoord);
-
+
connect( Group2Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect( Group2Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
break;
-
+
case PT_RELATIVE:
if (myLastX1 && myLastY1)
{
{
Xcoord = myX - tmpX;
Ycoord = myY - tmpY;
- }
+ }
Group2Spin->SpinBox_DX->setValue(Xcoord);
- Group2Spin->SpinBox_DY->setValue(Ycoord);
- break;
-
+ Group2Spin->SpinBox_DY->setValue(Ycoord);
+ break;
+
case PT_ABS_RADIUS:
disconnect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
disconnect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
-
+
Group3Spin->SpinBox_DX->setValue(Xcoord);
Group3Spin->SpinBox_DY->setValue(Ycoord);
-
+
connect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
break;
-
+
case PT_REL_RADIUS:
if (myLastX1 && myLastY1)
{
{
Xcoord = myX - tmpX;
Ycoord = myY - tmpY;
- }
+ }
Group3Spin->SpinBox_DX->setValue(Xcoord);
Group3Spin->SpinBox_DY->setValue(Ycoord);
- break;
-
+ break;
+
case PT_ABS_CENTER:
disconnect( Group4Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
disconnect( Group4Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
-
+
Group4Spin->SpinBox_DX->setValue(Xcoord);
Group4Spin->SpinBox_DY->setValue(Ycoord);
-
+
connect( Group4Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- connect( Group4Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+ connect( Group4Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
break;
-
+
case PT_REL_CENTER:
if (myLastX1 && myLastY1)
{
{
Xcoord = myXc - tmpX;
Ycoord = myYc - tmpY;
- }
+ }
else
{
Xcoord = myXc;
Ycoord = myYc;
}
-
+
Group4Spin->SpinBox_DX->setValue(Xcoord);
- Group4Spin->SpinBox_DY->setValue(Ycoord);
- break;
-
+ Group4Spin->SpinBox_DY->setValue(Ycoord);
+ break;
+
}
}
}
if(!autoApply){
GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
}
- else {
+ else {
ClickOnApply();
autoApply = false;
}
-
+
}
selButton->setDown(true);
}
globalSelection(); // close local selection to clear it
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ localSelection( myNeedType );
}
//=================================================================================
void EntityGUI_SketcherDlg::LineEditReturnPressed()
{
- if ( sender() == Group1Sel->LineEdit1 )
+ if ( sender() == Group1Sel->LineEdit1 )
myEditCurrentArgument = Group1Sel->LineEdit1;
- else if ( sender() == Group1Sel1Spin->LineEdit1 )
+ else if ( sender() == Group1Sel1Spin->LineEdit1 )
myEditCurrentArgument = Group1Sel1Spin->LineEdit1;
- else if ( sender() == Group2Sel->LineEdit1 )
+ else if ( sender() == Group2Sel->LineEdit1 )
myEditCurrentArgument = Group2Sel->LineEdit1;
else if ( sender() == Group2Sel->LineEdit2 )
myEditCurrentArgument = Group2Sel->LineEdit2;
/* User name of object input management */
- /* If successfull the selection is changed and signal emitted... */
+ /* If successful the selection is changed and signal emitted... */
/* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text();
QWidget* thisWidget = (QWidget*)this;
//myGeometryGUI->SetState( 0 );
// globalSelection( GEOM_POINT );
-
+
myEditCurrentArgument = WPlaneLineEdit;
myEditCurrentArgument->setFocus();
-
+
if ( sender() == Group1Sel->LineEdit1 ) {
myEditCurrentArgument = Group1Sel->LineEdit1;
myEditCurrentArgument->setFocus();
myEditCurrentArgument = Group2Sel->LineEdit2;
myEditCurrentArgument->setFocus();
}
-
+
GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
}
void EntityGUI_SketcherDlg::OnPointSelected(Qt::KeyboardModifiers modifiers, const gp_Pnt& thePnt,
bool isStart )
{
- // NOTE Basing the autoapply functionnality on the background picture has no sense anymore
- // The import picture functionnality is now used for drawing on top of a picture
-
+ // NOTE Basing the autoapply functionality on the background picture has no sense anymore
+ // The import picture functionality is now used for drawing on top of a picture
+
// SUIT_ViewWindow* theViewWindow = getDesktop()->activeWindow();
// OCCViewer_ViewPort3d* vp = ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort();
-//
+//
// QString theImgFileName;
// vp->background().texture( theImgFileName ); ////////////// VSR: temporarily
-
+
double x, y;
x = y = 0;
-
+
BRepBuilderAPI_MakeVertex mkVertex (thePnt);
TopoDS_Shape aShape = mkVertex.Shape();
-
+
// Taking into account LocalCS
gp_Ax3 aWPlane = GetActiveLocalCS();
gp_Trsf aTrans;
aTrans.SetTransformation(aWPlane);
BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False);
aShape = aTransformation.Shape();
-
- gp_Pnt aTrsfPnt;
+
+ gp_Pnt aTrsfPnt;
GEOMBase::VertexToPoint( aShape, aTrsfPnt );
-
+
// NOTE autoapply disabled : doesn't seem useful anymore
// autoApply = ( (getPnt2ConstructorId() == 1) && (!theImgFileName.isEmpty()) ); // If no additional argument needed after selection and there is a backgroundimage
- // -> apply automatically
-
+ // -> apply automatically
+
if ( getPnt1ConstructorId() == 0 ){ // Relative selection mode
x = aTrsfPnt.X() - myLastX1;
y = aTrsfPnt.Y() - myLastY1;
case 1:
Group2Spin->SpinBox_DX->setValue( x );
Group2Spin->SpinBox_DY->setValue( y );
- Group2Spin->buttonApply->setFocus(); // Previous setFocus (during preview) may have been inoperative if it was disabled
+ Group2Spin->buttonApply->setFocus(); // Previous setFocus (during preview) may have been inoperative if it was disabled
break;
case 0:
Group3Spin->SpinBox_DX->setValue( x );
Group3Spin->SpinBox_DY->setValue( y );
- Group3Spin->buttonApply->setFocus();
+ Group3Spin->buttonApply->setFocus();
break;
case 2:
if (modifiers == Qt::MetaModifier){ // Select center with Meta key
Group4Spin->SpinBox_DZ->setValue( x );
Group4Spin->SpinBox_DS->setValue( y );
}
- Group4Spin->buttonApply->setFocus();
+ Group4Spin->buttonApply->setFocus();
break;
}
if ( myConstructorId == 2 ) //RECTANGLE
vx = newValue; vxStr = newValueStr;
vy = Group3Spin->SpinBox_DY->value(); vyStr = Group3Spin->SpinBox_DY->text();
vz = Group3Spin->SpinBox_DZ->value();
- if ( (mySketchType == PT_REL_RADIUS || mySketchType == PT_ABS_RADIUS) && (vx != 0 || vy != 0) ) {
+ if ( (mySketchType == PT_REL_RADIUS || mySketchType == PT_ABS_RADIUS) && (vx != 0 || vy != 0) ) {
if (mySketchType == PT_ABS_RADIUS){
dx = vx - myLastX1;
dy = vy - myLastY1;
dy = vy;
}
minRad = 0.5 * Sqrt(dx * dx + dy * dy); //Computation of the minimum acceptable radius for the arc calculation
- if (aPrecision >= 0) // 'f' format in the QString
+ if (aPrecision >= 0) // 'f' format in the QString
LastDecimal = aPrecision;
else // 'g' format in the Qstring
- LastDecimal = qAbs( aPrecision ) - ceil( log10(minRad) );
+ LastDecimal = qAbs( aPrecision ) - ceil( log10(minRad) );
minRad = ceil(pow(10,LastDecimal) * minRad) / pow(10,LastDecimal); // Rounded up at the last allowed decimal place
if ( Abs(vz) < minRad){
if (vz < 0.0)
Group3Spin->SpinBox_DZ->setValue( - minRad );
- else
+ else
Group3Spin->SpinBox_DZ->setValue( minRad );
}
}
else{
dx = vx;
dy = vy;
- }
+ }
minRad = 0.5 * Sqrt(dx * dx + dy * dy); //Computation of the minimum acceptable radius for the arc calculation
- if (aPrecision >= 0) // 'f' format in the QString
+ if (aPrecision >= 0) // 'f' format in the QString
LastDecimal = aPrecision;
- else // 'g' format in the QString
- LastDecimal = qAbs( aPrecision ) - ceil( log10(minRad) );
- minRad = ceil(pow(10,LastDecimal) * minRad) / pow(10,LastDecimal); // Rounded up at the last allowed decimal place
+ else // 'g' format in the QString
+ LastDecimal = qAbs( aPrecision ) - ceil( log10(minRad) );
+ minRad = ceil(pow(10,LastDecimal) * minRad) / pow(10,LastDecimal); // Rounded up at the last allowed decimal place
if ( Abs(vz) < minRad){
if (vz < 0.0)
Group3Spin->SpinBox_DZ->setValue( - minRad );
- else
+ else
Group3Spin->SpinBox_DZ->setValue( minRad );
}
}
}
}
else if ( myConstructorId == 1 ) { // ARC
- if ( mySketchType == PT_ABS ) {
+ if ( mySketchType == PT_ABS ) {
myX = vx;
myY = vy;
myXStr = vxStr;
myDXStr = vxStr;
myDYStr = vyStr;
}
- if ( mySketchType == PT_ABS_RADIUS ) {
+ if ( mySketchType == PT_ABS_RADIUS ) {
myX = vx;
myY = vy;
myRadius=vz;
myRadius = vx;
myRadiusStr = vxStr;
}
- if ( mySketchType == PT_ABS_CENTER ) {
+ if ( mySketchType == PT_ABS_CENTER ) {
myXc = vx;
myYc = vy;
myX = vz;
myY2 = GroupRect->SpinBox_DY2->value(); myY2Str = GroupRect->SpinBox_DY2->text();
}
-
- if (!autoApply)
+
+ if (!autoApply)
GEOMBase_Helper::displayPreview( true, false, true, true, myLineWidth );
-
+
double x, y, xc, yc;
x = y = xc = yc = 0.0;
if ( mySketchType == PT_ABS_CENTER || mySketchType == PT_REL_CENTER )
QString myNewCommand = ":";
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
- int DigNum = qAbs(aPrecision); // options for the format of numbers in myNewCommand
+ int DigNum = qAbs(aPrecision); // options for the format of numbers in myNewCommand
char Format = 'f';
if ( aPrecision < 0 ) // f --> DigNum is the number of digits after the decimal point
- Format = 'g'; // g --> DigNum is the maximum number of significant digits
+ Format = 'g'; // g --> DigNum is the maximum number of significant digits
if ( mySketchState == FIRST_POINT ) {
if ( mySketchType == PT_ABS || mySketchType == PT_SEL ) {
}
if ( mySketchType == PT_ABS_RADIUS || mySketchType == PT_SEL_RADIUS ) {
myNewCommand = myNewCommand + "UU " + QString::number( myX, Format, DigNum) + " " + QString::number( myY, Format, DigNum ) + " " + QString::number( myRadius , Format, DigNum)+ " " + QString::number( myCheckFlag );
- theParameters = myXStr + ":" + myYStr + ":" + myRadiusStr;
+ theParameters = myXStr + ":" + myYStr + ":" + myRadiusStr;
}
if ( mySketchType == PT_REL_RADIUS) {
myNewCommand = myNewCommand + "U " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum ) + " " + QString::number( myRadius, Format, DigNum )+ " " + QString::number( myCheckFlag );
- theParameters = myDXStr + ":" + myDYStr + ":" + myRadiusStr;
+ theParameters = myDXStr + ":" + myDYStr + ":" + myRadiusStr;
}
if ( mySketchType == PT_ABS_CENTER || mySketchType == PT_SEL_CENTER ) {
myNewCommand = myNewCommand + "EE " + QString::number( myX, Format, DigNum) + " " + QString::number( myY, Format, DigNum ) + " " + QString::number( myXc , Format, DigNum) + " " + QString::number( myYc , Format, DigNum)+ " " + QString::number( myCheckFlag ) + " " + QString::number( 0 );
- theParameters = myXStr + ":" + myYStr + ":" + myXcStr+ ":" + myYcStr;
+ theParameters = myXStr + ":" + myYStr + ":" + myXcStr+ ":" + myYcStr;
}
if ( mySketchType == PT_REL_CENTER) {
myNewCommand = myNewCommand + "E " + QString::number( myDX, Format, DigNum ) + " " + QString::number( myDY, Format, DigNum ) + " " + QString::number( myDXc, Format, DigNum )+ " " + QString::number( myDYc, Format, DigNum )+ " " + QString::number( myCheckFlag )+ " " + QString::number( 0 );
- theParameters = myDXStr + ":" + myDYStr + ":" + myDXcStr + ":" + myDYcStr ;
+ theParameters = myDXStr + ":" + myDYStr + ":" + myDXcStr + ":" + myDYcStr ;
}
if ( mySketchType == DIR_ANGLE_LENGTH ) {
myNewCommand = myNewCommand + "R " + QString::number( myAngle );
+ ":TT " + QString::number( myX2, Format, DigNum) + " " + QString::number( myY2, Format, DigNum)
+ ":TT " + QString::number( myX2, Format, DigNum) + " " + QString::number( myY1, Format, DigNum)
+ ":WW";
-
+
theParameters = myX1Str + ":" + myY1Str + ":" + myX1Str + ":" + myY2Str + ":" + myX2Str + ":" + myY2Str + ":" + myX2Str + ":" + myY1Str;
}
return myNewCommand;
//=================================================================================
GEOM::GEOM_IOperations_ptr EntityGUI_SketcherDlg::createOperation()
{
- return getGeomEngine()->GetICurvesOperations( getStudyId() );
+ return getGeomEngine()->GetICurvesOperations();
}
//=================================================================================
MESSAGE("EntityGUI_SketcherDlg::execute")
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
- int DigNum = qAbs(aPrecision); // options for the format of numbers in myNewCommand
+ int DigNum = qAbs(aPrecision); // options for the format of numbers in myNewCommand
char Format = 'f';
if ( aPrecision < 0 ) // f --> DigNum is the number of digits after the decimal point
- Format = 'g'; // g --> DigNum is the maximum number of significant digits
-
+ Format = 'g'; // g --> DigNum is the maximum number of significant digits
+
QString aParameters;
-
+
if ( mySketchState == FIRST_POINT ) {
myLastX2 = myX;
myLastY2 = myY;
//Last Shape
QString Command1 = myCommand.join( "" );
- Sketcher_Profile aProfile1( Command1.toAscii() );
+ Sketcher_Profile aProfile1( Command1.toLatin1() );
myShape1 = aProfile1.GetShape();
//Current Shape
QString Command2 = Command1 + GetNewCommand( aParameters );
- Sketcher_Profile aProfile2( Command2.toAscii() );
+ Sketcher_Profile aProfile2( Command2.toLatin1() );
myShape2 = aProfile2.GetShape( &isDone, &error );
//Error Message
}
else{
Group4Spin->label->hide();
- }
+ }
}
- else
+ else
Group4Spin->label->hide();
if ( mySketchType == PT_SEL_CENTER ){
if (error > Precision::Confusion()){
}
else{
Group2Sel->label->hide();
- }
+ }
}
- else
+ else
Group2Sel->label->hide();
if ( myShape2.IsNull() ) {
GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow(getOperation());
GEOM::GEOM_Object_var anObj = NULL;
-
+
int index = ComboBox1->currentIndex();
if(index != -1 && !myWPlane->_is_nil()) // The combobox is not empty
{
if( !IsPreview() ) {
QStringList aCurrentParameters = myParameters;
aCurrentParameters << aParameters;
- anObj->SetParameters(aCurrentParameters.join(":").toLatin1().constData());
+ anObj->SetParameters(aCurrentParameters.join(":").toUtf8().constData());
}
objects.push_back( anObj._retn() );
const bool activate,
const bool update,
const double lineWidth,
- const int displayMode,
- const int color )
-{
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
-
+ const int /*displayMode*/,
+ const int /*color*/ )
+{
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+
QColor aColor = resMgr->colorValue("Geometry","line_color",QColor(255,0,0));
Quantity_NameOfColor line_color = SalomeApp_Tools::color( aColor ).Name();
-
+
// set width of displayed shape
int lw = lineWidth;
- if(lw == -1) {
+ if(lw == -1) {
lw = resMgr->integerValue("Geometry", "preview_edge_width", -1);
}
getDisplayer()->SetWidth( lw );
getDisplayer()->SetColor( line_color );
else
getDisplayer()->SetColor( Quantity_NOC_VIOLET );
-
+
SALOME_Prs* aPrs = getDisplayer()->BuildPrs( anApplyedWire );
if ( aPrs != 0 && !aPrs->IsNull() )
GEOMBase_Helper::displayPreview( aPrs, append, update );
- getDisplayer()->SetColor( Quantity_NOC_VIOLET );
+ getDisplayer()->SetColor( Quantity_NOC_VIOLET );
aPrs = getDisplayer()->BuildPrs( aLastSegment );
-
+
if ( aPrs != 0 && !aPrs->IsNull() )
GEOMBase_Helper::displayPreview( aPrs, append, update );
getDisplayer()->SetColor( line_color );
-
+
getDisplayer()->UnsetName();
// Enable activation of displayed objects
// Get globalCS and working plane
gp_Ax3 globalCS = WPlaneToLCS( myGlobalCS );
gp_Ax3 aWPlane = GetActiveLocalCS();
-
+
// Build point in localCS
gp_Pnt aPnt = gp_Pnt(x,y,0.0);
-
+
// Get transfomation from local to global CS
gp_Trsf aTrans;
aTrans.SetTransformation(aWPlane, globalCS);
-
+
BRepBuilderAPI_MakeVertex mkVertex (aPnt);
TopoDS_Shape aLocalVertex = mkVertex.Shape();
-
+
// Perform transformation
BRepBuilderAPI_Transform aTransformation (aLocalVertex, aTrans, Standard_False);
TopoDS_Shape aGlobalVertex = aTransformation.Shape();
-
+
// Build prs with vertex in globalCS
SALOME_Prs* aPrs = getDisplayer()->BuildPrs( aGlobalVertex );
if ( aPrs != 0 && !aPrs->IsNull() )
GEOMBase_Helper::displayPreview( aPrs, append, update );
-
+
}
//================================================================
// function : acceptMouseEvent()
// purpose :
//=================================================================================
-bool EntityGUI_SketcherDlg::acceptMouseEvent() const
+bool EntityGUI_SketcherDlg::acceptMouseEvent() const
{
- return ( (getPnt1ConstructorId() == 1
+ return ( (getPnt1ConstructorId() == 1
|| getPnt1ConstructorId() == 0
- || myConstructorId == 2) //accept mouse event only on absolute and relative selection mode
+ || myConstructorId == 2) //accept mouse event only on absolute and relative selection mode
&& !WPlaneLineEdit->isEnabled()); //or when the constructor is rectangle
- //called by EntityGUI::OnMousePress()
-}
+ //called by EntityGUI::OnMousePress()
+}
//=================================================================================
// function : keyPressEvent()
// Obtain precision from preferences
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
int aPrecision = resMgr->integerValue( "Geometry", quantity, 6 );
-
+
spinBox->setPrecision( aPrecision );
spinBox->setDecimals( qAbs( aPrecision ) ); // it's necessary to set decimals before the range setting,
// by default Qt rounds boundaries to 2 decimals at setRange
spinBox->setRange( min, max );
spinBox->setSingleStep( step );
-
+
// Add a hint for the user saying how to tune precision
QString userPropName = QObject::tr( QString( "GEOM_PREF_%1" ).arg( quantity ).toLatin1().constData() );
- spinBox->setProperty( "validity_tune_hint",
+ spinBox->setProperty( "validity_tune_hint",
QVariant( QObject::tr( "GEOM_PRECISION_HINT" ).arg( userPropName ) ) );
}
void EntityGUI_SketcherDlg::AddLocalCS(GEOM::GEOM_Object_var aSelectedObject)
{
QString aName = GEOMBase::GetName( aSelectedObject );
-
+
int index = ComboBox1->findText(aName, Qt::MatchExactly);
-
+
if (index==-1) // If the working plane hasn't been added yet
- {
+ {
myWPlaneList.push_back(aSelectedObject);
myWPlane = aSelectedObject;
addSubshapesToStudy();
myLCSList.push_back(WPlaneToLCS(aSelectedObject));
- ComboBox1->addItem(aName);
+ ComboBox1->addItem(aName);
index = ComboBox1->count();
- ComboBox1->setCurrentIndex(index-1);
+ ComboBox1->setCurrentIndex(index-1);
}
else
{
ComboBox1->setCurrentIndex(index);
}
- ActivateLocalCS();
+ ActivateLocalCS();
}
//=================================================================================
return;
_PTR(SComponent) fc = obj->GetFatherComponent();
QString geomComp = fc->GetID().c_str();
- _PTR(SObject) comp = aStudy->FindObjectID( geomComp.toLatin1().data() );
+ _PTR(SObject) comp = aStudy->FindObjectID( geomComp.toUtf8().data() );
if ( !comp )
return;
// browse through all GEOM data tree
_PTR(ChildIterator) it ( aStudy->NewChildIterator( comp ) );
- for ( it->InitEx( true ); it->More(); it->Next() )
+ for ( it->InitEx( true ); it->More(); it->Next() )
{
_PTR(SObject) child( it->Value() );
CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( child );
GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
- if( CORBA::is_nil( geomObj ) )
+ if( CORBA::is_nil( geomObj ) )
continue;
- if (geomObj->GetType() == GEOM_MARKER)
+ if (geomObj->GetType() == GEOM_MARKER)
{
myWPlaneList.push_back(geomObj);
myLCSList.push_back(WPlaneToLCS(geomObj));
//=================================================================================
// function : WPlaneToLCS ( aWPlane )
-// purpose :
+// purpose :
//=================================================================================
gp_Ax3 EntityGUI_SketcherDlg::WPlaneToLCS( GEOM::GEOM_Object_var geomObj )
{
TopoDS_Shape aShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), geomObj);
-
+
gp_Ax3 aLCS;
if (CORBA::is_nil( geomObj ) || aShape.IsNull())
{
MESSAGE("CORBA::is_nil( geomObj ) || aShape.IsNull()")
}
aLCS.Transform(aShape.Location().Transformation());
- if (aShape.ShapeType() == TopAbs_FACE)
+ if (aShape.ShapeType() == TopAbs_FACE)
{
GEOM::GEOM_IMeasureOperations_ptr aMeasureOp =
- myGeometryGUI->GetGeomGen()->GetIMeasureOperations( getStudyId() );
+ myGeometryGUI->GetGeomGen()->GetIMeasureOperations();
double Ox, Oy, Oz, Zx, Zy, Zz, Xx, Xy, Xz;
aMeasureOp->GetPosition( geomObj, Ox, Oy, Oz, Zx, Zy, Zz, Xx, Xy, Xz);
if ( aMeasureOp->IsDone() )
- {
+ {
gp_Pnt aPnt ( Ox, Oy, Oz );
gp_Dir aDirN ( Zx, Zy, Zz );
gp_Dir aDirX ( Xx, Xy, Xz );
// purpose :
//=================================================================================
int EntityGUI_SketcherDlg::getPnt1ConstructorId() const
-{
- int buttonId = GroupPt->ButtonGroup->checkedId();
+{
+ int buttonId = GroupPt->ButtonGroup->checkedId();
// MESSAGE("buttonId = "<<buttonId)
return buttonId;
}
// purpose :
//=================================================================================
int EntityGUI_SketcherDlg::getPnt2ConstructorId() const
-{
- int buttonId = GroupPt2->ButtonGroup->checkedId();
+{
+ int buttonId = GroupPt2->ButtonGroup->checkedId();
// MESSAGE("buttonId = "<<buttonId)
return buttonId;
}
int ind = ComboBox1->currentIndex();
if (ind == -1)
return myGeometryGUI->GetWorkingPlane();
-
+
gp_Ax3 aLCS = myLCSList.at(ind);
myWPlane = myWPlaneList.at(ind);