Porting SALOME Geometry module to the new OCCT 6.7.0 beta version.

This commit is contained in:
rnv 2013-11-07 08:59:47 +00:00
parent 843e3d4aa0
commit 92a33041ad
3 changed files with 68 additions and 56 deletions

View File

@ -65,9 +65,8 @@
#include <Geom_Plane.hxx>
#include <SelectMgr_Selection.hxx>
#include <gce_MakePln.hxx>
#include <Prs3d_AngleAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#if OCC_VERSION_LARGE > 0x06050300
#include <Prs3d_TextAspect.hxx>
#include <Prs3d_Presentation.hxx>
@ -1652,9 +1651,6 @@ Handle(AIS_LengthDimension) EntityGUI_3DSketcherDlg::createAISLengthDimension(do
gp_Pnt P2,
gp_Dir theNormal)
{
// Convert length to string
std::string aLength_str = doubleToString(theLength);
// Plane construction
gce_MakePln gce_MP(P1, theNormal);
Handle(Geom_Plane) aPlane = new Geom_Plane(gce_MP.Value());
@ -1662,20 +1658,21 @@ Handle(AIS_LengthDimension) EntityGUI_3DSketcherDlg::createAISLengthDimension(do
TopoDS_Vertex aVert1 = BRepBuilderAPI_MakeVertex(P1);
TopoDS_Vertex aVert2 = BRepBuilderAPI_MakeVertex(P2);
Handle(AIS_LengthDimension) anIO =
new AIS_LengthDimension(aVert1,
aVert2,
aPlane,
theLength,
TCollection_ExtendedString(aLength_str.c_str()));
anIO->SetArrowSize(theLength/20);
Handle(AIS_LengthDimension) anIO = new AIS_LengthDimension( aVert1, aVert2, aPlane->Pln() );
anIO->SetCustomValue( theLength );
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
int w = resMgr->integerValue("Geometry", "measures_line_width", 1);
Handle(Prs3d_LengthAspect) asp = new Prs3d_LengthAspect();
asp->LineAspect()->SetWidth(w);
anIO->Attributes()->SetLengthAspect(asp);
int w = resMgr->integerValue( "Geometry", "measures_line_width", 1 );
Handle(Prs3d_DimensionAspect) aDimensionStyle = new Prs3d_DimensionAspect;
aDimensionStyle->ArrowAspect()->SetLength( theLength / 20.0 );
aDimensionStyle->LineAspect()->SetWidth( w );
aDimensionStyle->SetHorizontalTextAlignment( Prs3d_HTA_Center );
anIO->SetFlyout( 0.0 );
anIO->SetDimensionAspect( aDimensionStyle );
return anIO;
}
@ -1711,18 +1708,34 @@ Handle(AIS_AngleDimension) EntityGUI_3DSketcherDlg::createAISAngleDimension(doub
TopoDS_Edge anEdge1 = BRepBuilderAPI_MakeEdge(V0, V1);
TopoDS_Edge anEdge2 = BRepBuilderAPI_MakeEdge(V0, V2);
Handle(AIS_AngleDimension) anIO =
new AIS_AngleDimension(anEdge1, anEdge2, aPlane, theAngle * M_PI / 180.,
TCollection_ExtendedString(Angle_str.c_str()));
anIO->SetArrowSize((theAngle * M_PI / 180) * (aLength/20));
//Handle(AIS_AngleDimension) anIO =
// new AIS_AngleDimension(anEdge1, anEdge2, aPlane, theAngle * M_PI / 180.,
// TCollection_ExtendedString(Angle_str.c_str()));
//
//anIO->SetArrowSize((theAngle * M_PI / 180) * (aLength/20));
//
//SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
//int w = resMgr->integerValue("Geometry", "measures_line_width", 1);
//Handle(Prs3d_AngleAspect) asp = new Prs3d_AngleAspect();
//asp->LineAspect()->SetWidth(w);
//anIO->Attributes()->SetAngleAspect(asp);
// todo : port
Handle(AIS_AngleDimension) anIO = new AIS_AngleDimension( anEdge1, anEdge2, aPlane->Pln() );
anIO->SetCustomValue( theAngle );
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
int w = resMgr->integerValue("Geometry", "measures_line_width", 1);
Handle(Prs3d_AngleAspect) asp = new Prs3d_AngleAspect();
asp->LineAspect()->SetWidth(w);
anIO->Attributes()->SetAngleAspect(asp);
int w = resMgr->integerValue( "Geometry", "measures_line_width", 1 );
Handle(Prs3d_DimensionAspect) aDimensionStyle = new Prs3d_DimensionAspect;
aDimensionStyle->ArrowAspect()->SetLength( (theAngle * M_PI / 180.0) * (aLength / 20.0) );
aDimensionStyle->LineAspect()->SetWidth( w );
anIO->SetDimensionAspect( aDimensionStyle );
return anIO;
}

View File

@ -56,8 +56,7 @@
#include <Precision.hxx>
#include <AIS.hxx>
#include <AIS_Drawer.hxx>
#include <Prs3d_AngleAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LineAspect.hxx>
// QT Includes
#include <qlineedit.h>
@ -348,13 +347,10 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs()
gce_MakePln gce_MP(aP11, aP12, aP3);
Handle(Geom_Plane) aPlane = new Geom_Plane(gce_MP.Value());
// Build the angle dimension presentation
QString aLabel;
aLabel.sprintf("%.1f", anAngle);
Handle(AIS_AngleDimension) anIO = new AIS_AngleDimension( anEdge1, anEdge2, aPlane->Pln() );
Handle(Prs3d_DimensionAspect) aDimensionStyle = new Prs3d_DimensionAspect;
Handle(AIS_AngleDimension) anIO = new AIS_AngleDimension
(anEdge1, anEdge2, aPlane, anAngle * M_PI / 180.,
TCollection_ExtendedString((Standard_CString)aLabel.toLatin1().data()));
Handle(Geom_Line) geom_lin1,geom_lin2;
gp_Pnt ptat11,ptat12,ptat21,ptat22;
Standard_Boolean isInfinite1,isInfinite2;
@ -373,19 +369,20 @@ SALOME_Prs* MeasureGUI_AngleDlg::buildPrs()
isInfinite1,
isInfinite2,
aPlane)) {
Standard_Real arrSize1 = anIO->ArrowSize();
Standard_Real arrSize2 = anIO->ArrowSize();
Standard_Real arrSize1 = aDimensionStyle->ArrowAspect()->Length();
Standard_Real arrSize2 = aDimensionStyle->ArrowAspect()->Length();
if (!isInfinite1) arrSize1 = ptat11.Distance(ptat12)/10.;
if (!isInfinite2) arrSize2 = ptat21.Distance(ptat22)/10.;
Standard_Real arrowSize = Max(arrSize1,arrSize2);
anIO->SetArrowSize(arrowSize);
aDimensionStyle->ArrowAspect()->SetLength( Max(arrSize1, arrSize2) );
}
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
int w = resMgr->integerValue("Geometry", "measures_line_width", 1);
Handle(Prs3d_AngleAspect) asp = new Prs3d_AngleAspect();
asp->LineAspect()->SetWidth(w);
anIO->Attributes()->SetAngleAspect(asp);
int w = resMgr->integerValue( "Geometry", "measures_line_width", 1 );
aDimensionStyle->LineAspect()->SetWidth( w );
aDimensionStyle->SetHorizontalTextAlignment( Prs3d_HTA_Center );
anIO->SetDimensionAspect( aDimensionStyle );
SOCC_Prs* aPrs =
dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));

View File

@ -48,7 +48,6 @@
#include <Geom_Plane.hxx>
#include <AIS_LengthDimension.hxx>
#include <AIS_Drawer.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
@ -362,8 +361,8 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs()
TopoDS_Vertex aVert1 = BRepBuilderAPI_MakeVertex(aPnt1);
TopoDS_Vertex aVert2 = BRepBuilderAPI_MakeVertex(aPnt2);
QString aLabel;
aLabel.sprintf("%.1f", aDist);
//QString aLabel;
//aLabel.sprintf("%.1f", aDist);
gp_Pnt aPnt3 ((aPnt1.X() + aPnt2.X()) / 2,
(aPnt1.Y() + aPnt2.Y()) / 2,
@ -380,16 +379,19 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs()
gce_MakePln gce_MP (aPnt1, aPnt2, aPnt3);
Handle(Geom_Plane) P = new Geom_Plane (gce_MP.Value());
Handle(AIS_LengthDimension) anIO = new AIS_LengthDimension
(aVert1, aVert2, P, aDist,
TCollection_ExtendedString((Standard_CString)aLabel.toLatin1().constData()));
anIO->SetArrowSize(aDist/20);
Handle(AIS_LengthDimension) anIO = new AIS_LengthDimension( aVert1, aVert2, P->Pln() );
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
int w = resMgr->integerValue("Geometry", "measures_line_width", 1);
Handle(Prs3d_LengthAspect) asp = new Prs3d_LengthAspect();
asp->LineAspect()->SetWidth(w);
anIO->Attributes()->SetLengthAspect(asp);
int w = resMgr->integerValue( "Geometry", "measures_line_width", 1 );
Handle(Prs3d_DimensionAspect) aDimensionStyle = new Prs3d_DimensionAspect;
aDimensionStyle->ArrowAspect()->SetLength( aDist / 20.0 );
aDimensionStyle->LineAspect()->SetWidth( w );
aDimensionStyle->SetHorizontalTextAlignment( Prs3d_HTA_Center );
anIO->SetFlyout( 0.0 );
anIO->SetDimensionAspect( aDimensionStyle );
SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));