rnc: EDF 1618 GEOM: changed the wrning message when building an arc from endpoint and center. The message show now the value of the error too

This commit is contained in:
gdd 2011-04-29 14:54:11 +00:00
parent cfda715c5c
commit b8e5dd32fc
7 changed files with 122 additions and 87 deletions

View File

@ -134,7 +134,7 @@
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DS"/>
</item>
<item row="4" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0">
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
@ -149,6 +149,19 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>

View File

@ -6,10 +6,16 @@
<rect>
<x>0</x>
<y>0</y>
<width>380</width>
<width>390</width>
<height>236</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
@ -62,7 +68,7 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<width>35</width>
<height>0</height>
</size>
</property>

View File

@ -1964,6 +1964,13 @@ bool EntityGUI_SketcherDlg::isValid( QString& msg )
//=================================================================================
bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
{
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
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
QString aParameters;
if ( mySketchState == FIRST_POINT ) {
@ -1988,16 +1995,25 @@ bool EntityGUI_SketcherDlg::execute( ObjectList& objects )
Sketcher_Profile aProfile2( Command2.toAscii() );
//Error Message
if ( mySketchType == PT_ABS_CENTER ||
mySketchType == PT_REL_CENTER ){
if ( mySketchType == PT_ABS_CENTER || mySketchType == PT_REL_CENTER ){
if (aProfile2.Error() > Precision::Confusion()){
Group4Spin->label->show();
Group4Spin->label->setText( tr( aProfile2.ErrMsg().c_str() ) );
Group4Spin->label->setText( tr("GEOM_SKETCHER_WARNING") + QString::number( aProfile2.Error(), Format, DigNum));
}
else{
Group4Spin->label->hide();
}
}
else
Group4Spin->label->hide();
if ( mySketchType == PT_SEL_CENTER ){
if (aProfile2.Error() > Precision::Confusion()){
Group2Sel->label->show();
Group2Sel->label->setText( tr( aProfile2.ErrMsg().c_str() ) );
Group2Sel->label->setText( tr("GEOM_SKETCHER_WARNING") + QString::number( aProfile2.Error(), Format, DigNum));
}
else{
Group2Sel->label->hide();
}
}
else
Group2Sel->label->hide();

View File

@ -1563,7 +1563,7 @@ Please, select face, shell or solid and try again</translation>
</message>
<message>
<source>GEOM_SKETCHER_WARNING</source>
<translation>Warning : The specified End Point is not on the Arc</translation>
<translation>Warning: End point not on the arc, distance = </translation>
</message>
<message>
<source>GEOM_SKETCHER_CENTER_X</source>

View File

@ -235,7 +235,7 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
</message>
<message>
<source>GEOM_BUT_CLOSE_SKETCH</source>
<translation>Fermer le contour et valider</translation>
<translation>Fermer le contour</translation>
</message>
<message>
<source>GEOM_BUT_END_SKETCH</source>
@ -1543,7 +1543,7 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
</message>
<message>
<source>GEOM_SKETCHER_WARNING</source>
<translation>Attention : Le point final choisi n'est pas sur l'arc</translation>
<translation>Attention : Point final distant de l'arc de : </translation>
</message>
<message>
<source>GEOM_SKETCHER_CENTER_X</source>

View File

@ -67,7 +67,6 @@ Sketcher_Profile::Sketcher_Profile()
//=======================================================================
Sketcher_Profile::Sketcher_Profile(const char* aCmd)
{
myErrMsg = "";
enum {line, circle, point, none} move;
Standard_Integer i = 1;
@ -91,6 +90,7 @@ Sketcher_Profile::Sketcher_Profile(const char* aCmd)
Handle(Geom_Surface) Surface;
myOK = Standard_False;
myError = 0;
//TCollection_AsciiString aCommand(CORBA::string_dup(aCmd));
TCollection_AsciiString aCommand ((char*)aCmd);
@ -306,7 +306,6 @@ Sketcher_Profile::Sketcher_Profile(const char* aCmd)
}
case 'E': // Arc by end point and cEnter
{
myErrMsg = "";
if (n1 != 7) goto badargs;
Standard_Real vx = a(1).RealValue();
Standard_Real vy = a(2).RealValue();
@ -327,13 +326,12 @@ Sketcher_Profile::Sketcher_Profile(const char* aCmd)
Standard_Real length2 = Sqrt((vx-vxc) * (vx-vxc) + (vy-vyc) * (vy-vyc));
Standard_Real length3 = Sqrt(vxc * vxc + vyc * vyc);
Standard_Real error = Abs(length2 - radius);
myError = error;
if ( error > Precision::Confusion() ){
MESSAGE("Warning : The specified end point is not on the Arc, distance = "<<error);
myErrMsg = "GEOM_SKETCHER_WARNING";//"Warning : The specified End Point is not on the Arc";
}
if ( error > Precision::Confusion() && // Don't create the arc if the end point
control_Tolerance == 1) // is too far from it
move = none;
if ( error > Precision::Confusion() && control_Tolerance == 1) // Don't create the arc if the end point
move = none; // is too far from it
else if ( (length > Precision::Confusion()) &&
(length2 > Precision::Confusion()) &&
(length3 > Precision::Confusion()) ) {

View File

@ -45,6 +45,7 @@ private:
TopoDS_Shape myShape;
bool myOK;
std::string myErrMsg;
double myError;
public:
Standard_EXPORT gp_Pnt GetLastPoint(){return myLastPoint;};
@ -53,5 +54,6 @@ public:
Standard_EXPORT const TopoDS_Shape& GetShape(){return myShape;};
Standard_EXPORT bool IsDone(){return myOK;};
Standard_EXPORT std::string ErrMsg(){return myErrMsg;};
Standard_EXPORT double Error(){return myError;};
};