1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-16 10:08:36 +03:00

0026145: Geometry Sample crashes

Unacceptable usage of quantity coefficient was removed.
This commit is contained in:
ski 2015-05-05 19:42:21 +03:00 committed by bugmaster
parent 95db72f1f6
commit 2f697f2f74
2 changed files with 34 additions and 17 deletions

View File

@ -54,9 +54,11 @@ void GeomSources::PreProcess(CGeometryDoc* aDoc,DisplayType aDisplayType)
} }
void GeomSources::PostProcess (CGeometryDoc* aDoc, UINT anID, DisplayType aDisplayType, void GeomSources::PostProcess (CGeometryDoc* aDoc, UINT anID, DisplayType aDisplayType,
const TCollection_AsciiString& theString, Quantity_Coefficient Coef) const TCollection_AsciiString& theString, Standard_Boolean UpdateViewer, Quantity_Coefficient Coef)
{ {
Standard_CString aString = theString.ToCString(); Standard_CString aString = theString.ToCString();
if (UpdateViewer)
{
if (aDisplayType == No2D3D || aDisplayType == a2D3D) if (aDisplayType == No2D3D || aDisplayType == a2D3D)
{ {
aDoc->Fit3DViews(Coef); aDoc->Fit3DViews(Coef);
@ -66,6 +68,7 @@ void GeomSources::PostProcess (CGeometryDoc* aDoc, UINT anID, DisplayType aDispl
{ {
aDoc->Fit2DViews(); aDoc->Fit2DViews();
} }
}
TCollection_AsciiString Message("Results are "); TCollection_AsciiString Message("Results are ");
@ -196,6 +199,13 @@ void GeomSources::DisplaySurface(CGeometryDoc* aDoc,
aDoc->GetAISContext()->Display(aGraphicalSurface,UpdateViewer); aDoc->GetAISContext()->Display(aGraphicalSurface,UpdateViewer);
} }
void GeomSources::ResetView(CGeometryDoc* aDoc)
{
aDoc->GetAISContext()->CurrentViewer()->InitActiveViews();
Handle(V3d_View) aView = aDoc->GetAISContext()->CurrentViewer()->ActiveView();
aView->Reset();
}
// Function name : GeomSources::gpTest1 // Function name : GeomSources::gpTest1
// Description : // Description :
// Return type : void // Return type : void
@ -253,8 +263,9 @@ gp_Pnt P1(1,2,3); \n\
\n"); \n");
AddSeparator(aDoc,Message); AddSeparator(aDoc,Message);
//-------------------------------------------------------------- //--------------------------------------------------------------
DisplayPoint(aDoc,P1,"P1 (1,2,3)",false,0.5); DisplayPoint(aDoc,P1,"P1 (1,2,3)",false,30);
PostProcess(aDoc,ID_BUTTON_Test_2,TheDisplayType,Message,1.0); PostProcess(aDoc,ID_BUTTON_Test_2,TheDisplayType,Message,Standard_False);
ResetView(aDoc);
} }
@ -279,8 +290,9 @@ gp_Pnt P2(A); \n\
\n"); \n");
AddSeparator(aDoc,Message); AddSeparator(aDoc,Message);
//-------------------------------------------------------------- //--------------------------------------------------------------
DisplayPoint(aDoc,P2,"P2 (1,2,3)",false,0.5); DisplayPoint(aDoc,P2,"P2 (1,2,3)",false,30);
PostProcess(aDoc,ID_BUTTON_Test_3,TheDisplayType,Message,1.0 /*0.02*/); PostProcess(aDoc,ID_BUTTON_Test_3,TheDisplayType,Message,Standard_False);
ResetView(aDoc);
} }
@ -310,7 +322,7 @@ Standard_Real TheZ = P3.Z(); \n\
\n"); \n");
AddSeparator(aDoc,Message); AddSeparator(aDoc,Message);
//-------------------------------------------------------------- //--------------------------------------------------------------
DisplayPoint(aDoc,P3,"P3 = gp::Origin()",false,0.5); DisplayPoint(aDoc,P3,"P3 = gp::Origin()",false,30);
TCollection_AsciiString Message2 (TheX); TCollection_AsciiString Message2 (TheX);
TCollection_AsciiString Message3 (TheY); TCollection_AsciiString Message3 (TheY);
@ -324,7 +336,8 @@ Standard_Real TheZ = P3.Z(); \n\
Message4 = TheZ; Message4 = TheZ;
Message += Message4; Message += Message4;
PostProcess(aDoc,ID_BUTTON_Test_4,TheDisplayType,Message,1.0 /*0.02*/); PostProcess(aDoc,ID_BUTTON_Test_4,TheDisplayType,Message,Standard_False);
ResetView(aDoc);
} }

View File

@ -77,8 +77,12 @@ private:
a2DNo3D , // 0 1 0 a2DNo3D , // 0 1 0
a2D3D }; // 1 1 1 a2D3D }; // 1 1 1
static void PreProcess (CGeometryDoc* aDoc,DisplayType aDisplayType); static void PreProcess (CGeometryDoc* aDoc,DisplayType aDisplayType);
static void PostProcess(CGeometryDoc* aDoc,UINT anID,DisplayType aDisplayType, static void PostProcess(CGeometryDoc* aDoc,
const TCollection_AsciiString& aString,Quantity_Coefficient Coef = -1); UINT anID,
DisplayType aDisplayType,
const TCollection_AsciiString& aString,
Standard_Boolean UpdateViewer = Standard_True,
Quantity_Coefficient Coef = -1);
static void DisplayPoint(CGeometryDoc* aDoc, static void DisplayPoint(CGeometryDoc* aDoc,
const gp_Pnt2d& aPoint, const gp_Pnt2d& aPoint,
const char* aText, const char* aText,
@ -122,7 +126,7 @@ private:
Handle(Geom_Surface) aSurface, Handle(Geom_Surface) aSurface,
Standard_Boolean UpdateViewer = false); Standard_Boolean UpdateViewer = false);
static void ResetView(CGeometryDoc* aDoc);
static void AddSeparator(CGeometryDoc* aDoc,TCollection_AsciiString& aMessage); static void AddSeparator(CGeometryDoc* aDoc,TCollection_AsciiString& aMessage);