mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0024425: Improve usage ergonomics of new dimension presentations
- Added format for value string. - Construction and validness. - Revise modification of properties and update of presentations. - Units moved to Drawer; code revisions. - Length and angle initialization was changed. Type of geometry filed was added to AIS_Dimension. - Method for test case bugs/vis/buc60915 was corrected. Description of the dimension classes was corrected. - Fixed initialization of angle and length.
This commit is contained in:
parent
e04db19958
commit
60bf98ae02
@ -142,13 +142,13 @@ void CAngleParamsVerticesPage::OnBnClickedVertex3Btn()
|
||||
anAspect->TextAspect()->SetHeight (aDimDlg->GetFontHeight());
|
||||
anAspect->MakeTextShaded (aDimDlg->IsText3dShaded());
|
||||
anAspect->SetCommonColor (aDimDlg->GetDimensionColor());
|
||||
anAngleDim->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
|
||||
if (anAngleDim->IsUnitsDisplayed())
|
||||
anAngleDim->DimensionAspect()->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
|
||||
if (aDimDlg->IsUnitsDisplayed())
|
||||
{
|
||||
anAngleDim->SetDisplayUnits (aDimDlg->GetUnits());
|
||||
if ((anAngleDim->DisplayUnits().IsEqual (TCollection_AsciiString ("deg"))))
|
||||
if ((anAngleDim->GetDisplayUnits().IsEqual (TCollection_AsciiString ("deg"))))
|
||||
{
|
||||
anAngleDim->MakeUnitsDisplayed (Standard_False);
|
||||
anAngleDim->DimensionAspect()->MakeUnitsDisplayed (Standard_False);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "LengthParamsEdgesPage.h"
|
||||
#include "AngleParamsVerticesPage.h"
|
||||
#include "RadiusParamsPage.h"
|
||||
#include "ParamsFacesPage.h"
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
@ -30,6 +31,7 @@ BEGIN_MESSAGE_MAP(CDimensionDlg, CDialog)
|
||||
ON_BN_CLICKED(IDC_2DText, &CDimensionDlg::OnBnClicked2dText)
|
||||
ON_BN_CLICKED(IDC_3DText, &CDimensionDlg::OnBnClicked3dText)
|
||||
ON_BN_CLICKED(IDC_DimensionColor, &CDimensionDlg::OnBnClickedDimensionColor)
|
||||
ON_WM_CLOSE()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
//=======================================================================
|
||||
@ -171,6 +173,8 @@ void CDimensionDlg::CreateLengthParamsTab()
|
||||
myLengthParams->InsertItem (1, &aTabItem);
|
||||
aTabItem.pszText = "Parallel edges";
|
||||
myLengthParams->InsertItem (2, &aTabItem);
|
||||
aTabItem.pszText = "Parallel faces";
|
||||
myLengthParams->InsertItem (3, &aTabItem);
|
||||
|
||||
CLengthParamsEdgePage *aPage1 = new CLengthParamsEdgePage (myAISContext);
|
||||
aTabItem.mask = TCIF_PARAM;
|
||||
@ -186,6 +190,7 @@ void CDimensionDlg::CreateLengthParamsTab()
|
||||
myLengthParams->SetItem (1, &aTabItem);
|
||||
VERIFY (aPage2->Create (CLengthParamsVerticesPage::IDD,myLengthParams));
|
||||
aPage2->SetWindowPos (NULL,10,30,0,0,SWP_NOSIZE | SWP_NOZORDER);
|
||||
aPage2->ShowWindow (SW_HIDE);
|
||||
|
||||
CLengthParamsEdgesPage *aPage3 = new CLengthParamsEdgesPage (myAISContext);
|
||||
aTabItem.mask = TCIF_PARAM;
|
||||
@ -193,6 +198,15 @@ void CDimensionDlg::CreateLengthParamsTab()
|
||||
myLengthParams->SetItem (2, &aTabItem);
|
||||
VERIFY (aPage3->Create (CLengthParamsEdgesPage::IDD,myLengthParams));
|
||||
aPage3->SetWindowPos (NULL,10,30,0,0,SWP_NOSIZE | SWP_NOZORDER);
|
||||
aPage3->ShowWindow (SW_HIDE);
|
||||
|
||||
CParamsFacesPage *aPage4 = new CParamsFacesPage (myAISContext);
|
||||
aTabItem.mask = TCIF_PARAM;
|
||||
aTabItem.lParam = (LPARAM)aPage4;
|
||||
myLengthParams->SetItem (3, &aTabItem);
|
||||
VERIFY (aPage4->Create (CParamsFacesPage::IDD,myLengthParams));
|
||||
aPage4->SetWindowPos (NULL,10,30,0,0,SWP_NOSIZE | SWP_NOZORDER);
|
||||
aPage4->ShowWindow (SW_HIDE);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -208,6 +222,8 @@ void CDimensionDlg::CreateAngleParamsTab()
|
||||
myAngleParams->InsertItem (0, &aTabItem);
|
||||
aTabItem.pszText = "Three vertices";
|
||||
myAngleParams->InsertItem (1, &aTabItem);
|
||||
aTabItem.pszText = "Two faces";
|
||||
myAngleParams->InsertItem (2, &aTabItem);
|
||||
|
||||
CLengthParamsEdgesPage *aPage1 = new CLengthParamsEdgesPage (myAISContext, true);
|
||||
aTabItem.mask = TCIF_PARAM;
|
||||
@ -223,6 +239,15 @@ void CDimensionDlg::CreateAngleParamsTab()
|
||||
myAngleParams->SetItem (1, &aTabItem);
|
||||
VERIFY (aPage2->Create (CAngleParamsVerticesPage::IDD,myAngleParams));
|
||||
aPage2->SetWindowPos (NULL,10,30,0,0,SWP_NOSIZE | SWP_NOZORDER);
|
||||
aPage2->ShowWindow (SW_HIDE);
|
||||
|
||||
CParamsFacesPage *aPage3 = new CParamsFacesPage (myAISContext, true);
|
||||
aTabItem.mask = TCIF_PARAM;
|
||||
aTabItem.lParam = (LPARAM)aPage3;
|
||||
myAngleParams->SetItem (2, &aTabItem);
|
||||
VERIFY (aPage3->Create (CParamsFacesPage::IDD,myAngleParams));
|
||||
aPage3->SetWindowPos (NULL,10,30,0,0,SWP_NOSIZE | SWP_NOZORDER);
|
||||
aPage3->ShowWindow (SW_HIDE);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -275,7 +300,22 @@ void CDimensionDlg::UpdateStandardModeForAngle()
|
||||
int aTabNum = ((CTabCtrl*) GetDlgItem (IDC_AngleTab))->GetCurSel();
|
||||
myAISContext->CloseAllContexts();
|
||||
myAISContext->OpenLocalContext();
|
||||
myAISContext->ActivateStandardMode (aTabNum == 1 ? TopAbs_VERTEX : TopAbs_EDGE);
|
||||
TopAbs_ShapeEnum aMode;
|
||||
|
||||
if (aTabNum == 1)
|
||||
{
|
||||
aMode = TopAbs_VERTEX;
|
||||
}
|
||||
else if (aTabNum == 2)
|
||||
{
|
||||
aMode = TopAbs_FACE;
|
||||
}
|
||||
else
|
||||
{
|
||||
aMode = TopAbs_EDGE;
|
||||
}
|
||||
|
||||
myAISContext->ActivateStandardMode (aMode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -288,7 +328,21 @@ void CDimensionDlg::UpdateStandardModeForLength()
|
||||
int aTabNum = ((CTabCtrl*) GetDlgItem (IDC_LengthTab))->GetCurSel();
|
||||
myAISContext->CloseAllContexts();
|
||||
myAISContext->OpenLocalContext();
|
||||
myAISContext->ActivateStandardMode (aTabNum == 1 ? TopAbs_VERTEX : TopAbs_EDGE);
|
||||
TopAbs_ShapeEnum aMode;
|
||||
|
||||
if (aTabNum == 1)
|
||||
{
|
||||
aMode = TopAbs_VERTEX;
|
||||
}
|
||||
else if (aTabNum == 3)
|
||||
{
|
||||
aMode = TopAbs_FACE;
|
||||
}
|
||||
else
|
||||
{
|
||||
aMode = TopAbs_EDGE;
|
||||
}
|
||||
myAISContext->ActivateStandardMode (aMode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -500,11 +554,12 @@ void CDimensionDlg::OnDestroy()
|
||||
{
|
||||
myAISContext->CloseAllContexts();
|
||||
}
|
||||
// Destroy length tab
|
||||
CWnd *aWnd;
|
||||
TC_ITEM anItem;
|
||||
anItem.mask = TCIF_PARAM;
|
||||
for (int i = 2; i >= 0; --i)
|
||||
|
||||
// Destroy length tab
|
||||
for (int i = 3; i >= 0; --i)
|
||||
{
|
||||
((CTabCtrl*) GetDlgItem (IDC_LengthTab))->GetItem (i, &anItem);
|
||||
ASSERT (anItem.lParam);
|
||||
@ -513,7 +568,7 @@ void CDimensionDlg::OnDestroy()
|
||||
delete aWnd;
|
||||
}
|
||||
// Destroy angle tab
|
||||
for (int i = 1; i >= 0; --i)
|
||||
for (int i = 2; i >= 0; --i)
|
||||
{
|
||||
((CTabCtrl*) GetDlgItem (IDC_AngleTab))->GetItem (i, &anItem);
|
||||
ASSERT(anItem.lParam);
|
||||
@ -522,6 +577,20 @@ void CDimensionDlg::OnDestroy()
|
||||
delete aWnd;
|
||||
}
|
||||
|
||||
// Destroy radius tab
|
||||
((CTabCtrl*) GetDlgItem (IDC_RadiusTab))->GetItem (0, &anItem);
|
||||
ASSERT(anItem.lParam);
|
||||
aWnd = (CWnd*) anItem.lParam;
|
||||
aWnd->DestroyWindow();
|
||||
delete aWnd;
|
||||
|
||||
// Destroy diameter tab
|
||||
((CTabCtrl*) GetDlgItem (IDC_DiameterTab))->GetItem (0, &anItem);
|
||||
ASSERT(anItem.lParam);
|
||||
aWnd = (CWnd*) anItem.lParam;
|
||||
aWnd->DestroyWindow();
|
||||
delete aWnd;
|
||||
|
||||
CDialog::OnDestroy();
|
||||
}
|
||||
|
||||
@ -684,3 +753,12 @@ const Quantity_Color CDimensionDlg::GetDimensionColor() const
|
||||
{
|
||||
return myDimensionColor;
|
||||
}
|
||||
|
||||
void CDimensionDlg::OnClose()
|
||||
{
|
||||
if (myAISContext->HasOpenedContext())
|
||||
{
|
||||
myAISContext->CloseAllContexts();
|
||||
}
|
||||
CDialog::OnClose();
|
||||
}
|
||||
|
@ -76,4 +76,5 @@ public:
|
||||
afx_msg void OnBnClicked2dText();
|
||||
afx_msg void OnBnClicked3dText();
|
||||
afx_msg void OnBnClickedDimensionColor();
|
||||
afx_msg void OnClose();
|
||||
};
|
||||
|
@ -96,8 +96,8 @@ void CLengthParamsEdgePage::OnBnClickedChooseEdgeBtn()
|
||||
anAspect->TextAspect()->SetHeight (aDimDlg->GetFontHeight());
|
||||
anAspect->MakeTextShaded (aDimDlg->IsText3dShaded());
|
||||
anAspect->SetCommonColor (aDimDlg->GetDimensionColor());
|
||||
aLenDim->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
|
||||
if (aLenDim->IsUnitsDisplayed())
|
||||
aLenDim->DimensionAspect()->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
|
||||
if (aDimDlg->IsUnitsDisplayed())
|
||||
{
|
||||
aLenDim->SetDisplayUnits (aDimDlg->GetUnits());
|
||||
}
|
||||
|
@ -127,13 +127,13 @@ void CLengthParamsEdgesPage::OnBnClickedEdge2Btn()
|
||||
// Build an angle dimension between two non-parallel edges
|
||||
Handle(AIS_AngleDimension) anAngleDim = new AIS_AngleDimension (myFirstEdge, mySecondEdge);
|
||||
anAngleDim->SetDimensionAspect (anAspect);
|
||||
anAngleDim->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
|
||||
if (anAngleDim->IsUnitsDisplayed())
|
||||
anAngleDim->DimensionAspect()->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
|
||||
if (aDimDlg->IsUnitsDisplayed())
|
||||
{
|
||||
anAngleDim->SetDisplayUnits (aDimDlg->GetUnits ());
|
||||
if ((anAngleDim->DisplayUnits().IsEqual (TCollection_AsciiString ("deg"))))
|
||||
if ((anAngleDim->GetDisplayUnits().IsEqual (TCollection_AsciiString ("deg"))))
|
||||
{
|
||||
anAngleDim->MakeUnitsDisplayed (Standard_False);
|
||||
anAngleDim->DimensionAspect()->MakeUnitsDisplayed (Standard_False);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -148,8 +148,8 @@ void CLengthParamsEdgesPage::OnBnClickedEdge2Btn()
|
||||
{
|
||||
Handle(AIS_LengthDimension) aLenDim = new AIS_LengthDimension (myFirstEdge, mySecondEdge, aPlane->Pln());
|
||||
aLenDim->SetDimensionAspect (anAspect);
|
||||
aLenDim->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
|
||||
if (aLenDim->IsUnitsDisplayed())
|
||||
aLenDim->DimensionAspect()->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
|
||||
if (aDimDlg->IsUnitsDisplayed())
|
||||
{
|
||||
aLenDim->SetFlyout (aDimDlg->GetFlyout());
|
||||
aLenDim->SetDisplayUnits (aDimDlg->GetUnits());
|
||||
|
@ -117,8 +117,8 @@ void CLengthParamsVerticesPage::OnBnClickedVertex2Btn()
|
||||
anAspect->MakeText3d (aDimDlg->GetTextType());
|
||||
anAspect->TextAspect()->SetHeight (aDimDlg->GetFontHeight());
|
||||
anAspect->MakeTextShaded (aDimDlg->IsText3dShaded());
|
||||
aLenDim->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
|
||||
if (aLenDim->IsUnitsDisplayed ())
|
||||
aLenDim->DimensionAspect()->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
|
||||
if (aDimDlg->IsUnitsDisplayed())
|
||||
{
|
||||
aLenDim->SetDisplayUnits (aDimDlg->GetUnits ());
|
||||
}
|
||||
|
120
samples/mfc/standard/Common/ParamsFacesPage.cpp
Normal file
120
samples/mfc/standard/Common/ParamsFacesPage.cpp
Normal file
@ -0,0 +1,120 @@
|
||||
// ParamsFacesPage.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ParamsFacesPage.h"
|
||||
#include "DimensionDlg.h"
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <AIS_LocalContext.hxx>
|
||||
#include <AIS_LengthDimension.hxx>
|
||||
#include <AIS_AngleDimension.hxx>
|
||||
|
||||
// CParamsFacesPage dialog
|
||||
|
||||
IMPLEMENT_DYNAMIC(CParamsFacesPage, CDialog)
|
||||
|
||||
CParamsFacesPage::CParamsFacesPage (Handle(AIS_InteractiveContext) theAISContext,
|
||||
bool isAngleDimension /*= false*/,
|
||||
CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CParamsFacesPage::IDD, pParent),
|
||||
myAISContext (theAISContext),
|
||||
myIsAngleDimension (isAngleDimension)
|
||||
{
|
||||
}
|
||||
|
||||
CParamsFacesPage::~CParamsFacesPage()
|
||||
{
|
||||
}
|
||||
|
||||
void CParamsFacesPage::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CParamsFacesPage, CDialog)
|
||||
ON_BN_CLICKED(IDC_FacesBtn1, &CParamsFacesPage::OnBnClickedFacesbtn1)
|
||||
ON_BN_CLICKED(IDC_FacesBtn2, &CParamsFacesPage::OnBnClickedFacesbtn2)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CParamsFacesPage message handlers
|
||||
|
||||
void CParamsFacesPage::OnBnClickedFacesbtn1()
|
||||
{
|
||||
// Check if face is selected
|
||||
myAISContext->LocalContext()->InitSelected();
|
||||
if (!myAISContext->LocalContext()->MoreSelected())
|
||||
{
|
||||
AfxMessageBox(_T("Choose the face and press the button again"),
|
||||
MB_ICONINFORMATION | MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
myFirstFace = TopoDS::Face (myAISContext->LocalContext()->SelectedShape());
|
||||
myAISContext->LocalContext()->ClearSelected();
|
||||
}
|
||||
|
||||
void CParamsFacesPage::OnBnClickedFacesbtn2()
|
||||
{
|
||||
// Check if face is selected
|
||||
myAISContext->LocalContext()->InitSelected();
|
||||
if (!myAISContext->LocalContext()->MoreSelected())
|
||||
{
|
||||
AfxMessageBox(_T("Choose the face and press the button again"),
|
||||
MB_ICONINFORMATION | MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
mySecondFace = TopoDS::Face (myAISContext->LocalContext()->SelectedShape());
|
||||
myAISContext->LocalContext()->ClearSelected();
|
||||
|
||||
CDimensionDlg *aDimDlg = (CDimensionDlg*)(GetParentOwner());
|
||||
|
||||
myAISContext->CloseAllContexts();
|
||||
|
||||
Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect();
|
||||
anAspect->MakeArrows3d (Standard_False);
|
||||
anAspect->MakeText3d (aDimDlg->GetTextType());
|
||||
anAspect->TextAspect()->SetHeight (aDimDlg->GetFontHeight());
|
||||
anAspect->MakeTextShaded (aDimDlg->IsText3dShaded());
|
||||
anAspect->SetCommonColor (aDimDlg->GetDimensionColor());
|
||||
if (myIsAngleDimension)
|
||||
{
|
||||
// Build an angle dimension between two non-parallel edges
|
||||
Handle(AIS_AngleDimension) anAngleDim = new AIS_AngleDimension (myFirstFace, mySecondFace);
|
||||
anAngleDim->SetDimensionAspect (anAspect);
|
||||
anAngleDim->DimensionAspect()->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
|
||||
if (aDimDlg->IsUnitsDisplayed())
|
||||
{
|
||||
anAngleDim->SetDisplayUnits (aDimDlg->GetUnits ());
|
||||
if ((anAngleDim->GetDisplayUnits().IsEqual (TCollection_AsciiString ("deg"))))
|
||||
{
|
||||
anAngleDim->DimensionAspect()->MakeUnitsDisplayed (Standard_False);
|
||||
}
|
||||
else
|
||||
{
|
||||
anAngleDim->SetDisplaySpecialSymbol (AIS_DSS_No);
|
||||
}
|
||||
}
|
||||
|
||||
anAngleDim->SetFlyout (aDimDlg->GetFlyout());
|
||||
myAISContext->Display (anAngleDim);
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(AIS_LengthDimension) aLenDim = new AIS_LengthDimension (myFirstFace, mySecondFace);
|
||||
aLenDim->SetDimensionAspect (anAspect);
|
||||
aLenDim->DimensionAspect()->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
|
||||
if (aLenDim->DimensionAspect()->IsUnitsDisplayed())
|
||||
{
|
||||
aLenDim->SetFlyout (aDimDlg->GetFlyout());
|
||||
aLenDim->SetDisplayUnits (aDimDlg->GetUnits());
|
||||
}
|
||||
|
||||
myAISContext->Display (aLenDim);
|
||||
}
|
||||
|
||||
myAISContext->OpenLocalContext();
|
||||
myAISContext->ActivateStandardMode (TopAbs_FACE);
|
||||
}
|
31
samples/mfc/standard/Common/ParamsFacesPage.h
Normal file
31
samples/mfc/standard/Common/ParamsFacesPage.h
Normal file
@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "res\OCC_Resource.h"
|
||||
// CParamsFacesPage dialog
|
||||
|
||||
class CParamsFacesPage : public CDialog
|
||||
{
|
||||
DECLARE_DYNAMIC(CParamsFacesPage)
|
||||
private:
|
||||
Handle(AIS_InteractiveContext) myAISContext;
|
||||
bool myIsAngleDimension;
|
||||
TopoDS_Face myFirstFace;
|
||||
TopoDS_Face mySecondFace;
|
||||
public:
|
||||
CParamsFacesPage (Handle(AIS_InteractiveContext) theAISContext,
|
||||
bool isAngleDimension = false,
|
||||
CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
virtual ~CParamsFacesPage();
|
||||
|
||||
// Dialog Data
|
||||
enum { IDD = IDD_ParamsFacesPage };
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
afx_msg void OnBnClickedFacesbtn1();
|
||||
afx_msg void OnBnClickedFacesbtn2();
|
||||
};
|
@ -98,14 +98,12 @@ void CRadiusParamsPage::OnBnClickedObjectBtn()
|
||||
Handle(AIS_Dimension) aDim;
|
||||
if (myIsDiameterDimension)
|
||||
{
|
||||
aDim = isAttachPoint ? new AIS_DiameterDimension (aCircle, ElCLib::Value ((aFirstPar + aLastPar) / 2.0, aCircle))
|
||||
: new AIS_DiameterDimension (aCircle);
|
||||
aDim = new AIS_DiameterDimension (aCircle);
|
||||
Handle(AIS_DiameterDimension)::DownCast(aDim)->SetFlyout (aDimDlg->GetFlyout());
|
||||
}
|
||||
else
|
||||
{
|
||||
aDim = isAttachPoint ? new AIS_RadiusDimension (aCircle, ElCLib::Value ((aFirstPar + aLastPar) / 2.0, aCircle))
|
||||
: new AIS_RadiusDimension (aCircle);
|
||||
aDim = new AIS_RadiusDimension (aCircle);
|
||||
Handle(AIS_RadiusDimension)::DownCast(aDim)->SetFlyout (aDimDlg->GetFlyout());
|
||||
}
|
||||
|
||||
@ -115,8 +113,8 @@ void CRadiusParamsPage::OnBnClickedObjectBtn()
|
||||
anAspect->TextAspect()->SetHeight (aDimDlg->GetFontHeight());
|
||||
anAspect->MakeTextShaded (aDimDlg->IsText3dShaded());
|
||||
anAspect->SetCommonColor (aDimDlg->GetDimensionColor());
|
||||
aDim->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
|
||||
if (aDim->IsUnitsDisplayed())
|
||||
aDim->DimensionAspect()->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
|
||||
if (aDimDlg->IsUnitsDisplayed())
|
||||
{
|
||||
aDim->SetDisplayUnits (aDimDlg->GetUnits());
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by OCC_Resource.rc
|
||||
//
|
||||
#define IDD_ParamsFacesPage 101
|
||||
#define IDR_POPUP 116
|
||||
#define IDD_Dimension 119
|
||||
#define IDD_LengthParamsEdgePage 122
|
||||
@ -61,6 +62,10 @@
|
||||
#define IDC_TextDisplayMode 1047
|
||||
#define IDC_TextDisplayModeStatic 1048
|
||||
#define IDC_DimensionColor 1049
|
||||
#define IDC_FacesSt1 1052
|
||||
#define IDC_FacesSt2 1053
|
||||
#define IDC_FacesBtn1 1054
|
||||
#define IDC_FacesBtn2 1055
|
||||
#define ID_WINDOW_NEW3D 1151
|
||||
#define ID_OBJECT_DISPLAYALL 1201
|
||||
#define ID_OBJECT_MATERIAL 1205
|
||||
@ -176,7 +181,7 @@
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 131
|
||||
#define _APS_NEXT_COMMAND_VALUE 40038
|
||||
#define _APS_NEXT_CONTROL_VALUE 1052
|
||||
#define _APS_NEXT_CONTROL_VALUE 1055
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
@ -281,6 +281,16 @@ BEGIN
|
||||
CONTROL "",IDC_Flyout,"msctls_trackbar32",TBS_TOP | TBS_TOOLTIPS | WS_TABSTOP,73,112,100,20
|
||||
END
|
||||
|
||||
IDD_ParamsFacesPage DIALOGEX 0, 0, 134, 73
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Face1",IDC_FacesSt1,18,14,20,8
|
||||
LTEXT "Face2",IDC_FacesSt2,18,35,20,8
|
||||
PUSHBUTTON "Click to set up selected face",IDC_FacesBtn1,63,7,52,24,BS_MULTILINE
|
||||
PUSHBUTTON "Click to set up selected face",IDC_FacesBtn2,64,39,51,24,BS_MULTILINE
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -475,6 +485,14 @@ BEGIN
|
||||
BOTTOMMARGIN, 336
|
||||
HORZGUIDE, 336
|
||||
END
|
||||
|
||||
IDD_ParamsFacesPage, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 127
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 66
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
@ -296,6 +296,7 @@
|
||||
<ClCompile Include="..\..\..\..\Common\LengthParamsEdgesPage.cpp" />
|
||||
<ClCompile Include="..\..\..\..\Common\LengthParamsVerticesPage.cpp" />
|
||||
<ClCompile Include="..\..\..\..\Common\RadiusParamsPage.cpp" />
|
||||
<ClCompile Include="..\..\..\..\Common\ParamsFacesPage.cpp" />
|
||||
<ClCompile Include="..\..\..\src\mfcsample.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
@ -739,6 +740,7 @@
|
||||
<ClInclude Include="..\..\..\..\Common\OCC_BaseView.h" />
|
||||
<ClInclude Include="..\..\..\..\Common\OCC_MainFrame.h" />
|
||||
<ClInclude Include="..\..\..\..\Common\RadiusParamsPage.h" />
|
||||
<ClInclude Include="..\..\..\..\Common\ParamsFacesPage.h" />
|
||||
<ClInclude Include="..\..\..\..\Common\res\OCC_Resource.h" />
|
||||
<ClInclude Include="..\..\..\..\Common\ResultDialog.h" />
|
||||
<ClInclude Include="..\..\..\..\Common\ImportExport\SaveCSFDBDlg.h" />
|
||||
|
@ -138,6 +138,9 @@
|
||||
<ClCompile Include="..\..\..\..\Common\RadiusParamsPage.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Common\ParamsFacesPage.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\..\..\Common\res\OCC_Resource.rc">
|
||||
@ -247,6 +250,9 @@
|
||||
<ClInclude Include="..\..\..\..\Common\RadiusParamsPage.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Common\ParamsFacesPage.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\..\Common\res\2dChildFrameTB.bmp">
|
||||
|
@ -300,6 +300,7 @@
|
||||
<ClCompile Include="..\..\..\..\Common\LengthParamsEdgesPage.cpp" />
|
||||
<ClCompile Include="..\..\..\..\Common\LengthParamsVerticesPage.cpp" />
|
||||
<ClCompile Include="..\..\..\..\Common\RadiusParamsPage.cpp" />
|
||||
<ClCompile Include="..\..\..\..\Common\ParamsFacesPage.cpp" />
|
||||
<ClCompile Include="..\..\..\src\mfcsample.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
@ -743,6 +744,7 @@
|
||||
<ClInclude Include="..\..\..\..\Common\OCC_BaseView.h" />
|
||||
<ClInclude Include="..\..\..\..\Common\OCC_MainFrame.h" />
|
||||
<ClInclude Include="..\..\..\..\Common\RadiusParamsPage.h" />
|
||||
<ClInclude Include="..\..\..\..\Common\ParamsFacesPage.h" />
|
||||
<ClInclude Include="..\..\..\..\Common\res\OCC_Resource.h" />
|
||||
<ClInclude Include="..\..\..\..\Common\ResultDialog.h" />
|
||||
<ClInclude Include="..\..\..\..\Common\ImportExport\SaveCSFDBDlg.h" />
|
||||
|
@ -138,6 +138,9 @@
|
||||
<ClCompile Include="..\..\..\..\Common\RadiusParamsPage.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\Common\ParamsFacesPage.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\..\..\Common\res\OCC_Resource.rc">
|
||||
@ -247,6 +250,9 @@
|
||||
<ClInclude Include="..\..\..\..\Common\RadiusParamsPage.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\..\Common\ParamsFacesPage.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\..\Common\res\2dChildFrameTB.bmp">
|
||||
|
@ -1172,6 +1172,10 @@
|
||||
RelativePath="..\..\..\..\Common\RadiusParamsPage.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\Common\ParamsFacesPage.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\Common\ResultDialog.cpp"
|
||||
>
|
||||
@ -1839,6 +1843,10 @@
|
||||
RelativePath="..\..\..\..\Common\RadiusParamsPage.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\Common\ParamsFacesPage.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\Common\ResultDialog.h"
|
||||
>
|
||||
|
@ -465,6 +465,10 @@
|
||||
RelativePath="..\..\..\..\Common\AngleParamsVerticesPage.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\Common\ParamsFacesPage.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\Common\DimensionDlg.cpp"
|
||||
>
|
||||
@ -1772,6 +1776,10 @@
|
||||
RelativePath="..\..\..\..\Common\LengthParamsEdgePage.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\Common\ParamsFacesPage.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\Common\LengthParamsEdgesPage.h"
|
||||
>
|
||||
|
261
src/AIS/AIS.cdl
261
src/AIS/AIS.cdl
@ -464,29 +464,56 @@ is
|
||||
---Purpose:
|
||||
-- Returns the nearest point in a shape. This is used by
|
||||
-- several classes in calculation of dimensions.
|
||||
|
||||
|
||||
Nearest (theLine : Lin from gp;
|
||||
thePoint : Pnt from gp)
|
||||
returns Pnt from gp;
|
||||
---Purpose:
|
||||
-- @return the nearest point on the line.
|
||||
|
||||
Nearest (theCurve : Curve from Geom;
|
||||
thePoint : Pnt from gp;
|
||||
theFirstPoint : Pnt from gp;
|
||||
theLastPoint : Pnt from gp;
|
||||
theNearestPoint : out Pnt from gp)
|
||||
returns Boolean from Standard;
|
||||
---Purpose:
|
||||
-- For the given point finds nearest point on the curve,
|
||||
-- @return TRUE if found point is belongs to the curve
|
||||
-- and FALSE otherwise.
|
||||
|
||||
Farest( aShape : Shape from TopoDS;
|
||||
aPoint : Pnt from gp )
|
||||
returns Pnt from gp;
|
||||
|
||||
ComputeGeometry(anEdge : Edge from TopoDS;
|
||||
aCurve : out Curve from Geom;
|
||||
FirstPnt : out Pnt from gp;
|
||||
LastPnt : out Pnt from gp)
|
||||
ComputeGeometry (theEdge : Edge from TopoDS;
|
||||
theCurve : out Curve from Geom;
|
||||
theFirstPnt : out Pnt from gp;
|
||||
theLastPnt : out Pnt from gp)
|
||||
---Purpose: Used by 2d Relation only
|
||||
-- Computes the 3d geometry of <anEdge> in the current WorkingPlane
|
||||
-- and the extremities if any
|
||||
-- Return TRUE if ok
|
||||
-- Return TRUE if ok.
|
||||
returns Boolean from Standard;
|
||||
|
||||
ComputeGeometry(anEdge : Edge from TopoDS;
|
||||
aCurve : out Curve from Geom;
|
||||
FirstPnt : out Pnt from gp;
|
||||
LastPnt : out Pnt from gp;
|
||||
extCurve : out Curve from Geom;
|
||||
isinfinite: out Boolean from Standard;
|
||||
isOnPlane : out Boolean from Standard;
|
||||
aPlane : Plane from Geom)
|
||||
|
||||
ComputeGeometry (theEdge : Edge from TopoDS;
|
||||
theCurve : out Curve from Geom;
|
||||
theFirstPnt : out Pnt from gp;
|
||||
theLastPnt : out Pnt from gp;
|
||||
theIsInfinite : out Boolean from Standard)
|
||||
---Purpose: Used by dimensions only.
|
||||
-- Computes the 3d geometry of <anEdge>.
|
||||
-- Return TRUE if ok.
|
||||
returns Boolean from Standard;
|
||||
|
||||
ComputeGeometry (theEdge : Edge from TopoDS;
|
||||
theCurve : out Curve from Geom;
|
||||
theFirstPnt : out Pnt from gp;
|
||||
theLastPnt : out Pnt from gp;
|
||||
theExtCurve : out Curve from Geom;
|
||||
theIsInfinite : out Boolean from Standard;
|
||||
theIsOnPlane : out Boolean from Standard;
|
||||
thePlane : Plane from Geom)
|
||||
---Purpose: Used by 2d Relation only
|
||||
-- Computes the 3d geometry of <anEdge> in the current WorkingPlane
|
||||
-- and the extremities if any.
|
||||
@ -494,39 +521,51 @@ is
|
||||
-- the not projected curve associated to <anEdge>.
|
||||
-- If <anEdge> is infinite, <isinfinite> = true and the 2
|
||||
-- parameters <FirstPnt> and <LastPnt> have no signification.
|
||||
-- Return TRUE if ok
|
||||
-- Return TRUE if ok.
|
||||
returns Boolean from Standard;
|
||||
|
||||
ComputeGeometry (anEdge1 : Edge from TopoDS;
|
||||
anEdge2 : Edge from TopoDS;
|
||||
aCurve1 : out Curve from Geom;
|
||||
aCurve2 : out Curve from Geom;
|
||||
FirstPnt1 : out Pnt from gp;
|
||||
LastPnt1 : out Pnt from gp;
|
||||
FirstPnt2 : out Pnt from gp;
|
||||
LastPnt2 : out Pnt from gp;
|
||||
aPlane : Plane from Geom)
|
||||
|
||||
ComputeGeometry (theFirstEdge : Edge from TopoDS;
|
||||
theSecondEdge : Edge from TopoDS;
|
||||
theFirstCurve : out Curve from Geom;
|
||||
theSecondCurve : out Curve from Geom;
|
||||
theFirstPnt1 : out Pnt from gp;
|
||||
theLastPnt1 : out Pnt from gp;
|
||||
theFirstPnt2 : out Pnt from gp;
|
||||
theLastPnt2 : out Pnt from gp;
|
||||
thePlane : Plane from Geom)
|
||||
---Purpose: Used by 2d Relation only
|
||||
-- Computes the 3d geometry of <anEdge> in the current WorkingPlane
|
||||
-- and the extremities if any
|
||||
-- Return TRUE if ok
|
||||
-- Return TRUE if ok.
|
||||
returns Boolean from Standard;
|
||||
|
||||
ComputeGeometry (theFirstEdge : Edge from TopoDS;
|
||||
theSecondEdge : Edge from TopoDS;
|
||||
theFirstCurve : out Curve from Geom;
|
||||
theSecondCurve : out Curve from Geom;
|
||||
theFirstPnt1 : out Pnt from gp;
|
||||
theLastPnt1 : out Pnt from gp;
|
||||
theFirstPnt2 : out Pnt from gp;
|
||||
theLastPnt2 : out Pnt from gp;
|
||||
theIsinfinite1 : out Boolean from Standard;
|
||||
theIsinfinite2 : out Boolean from Standard)
|
||||
---Purpose: Used by dimensions only.Computes the 3d geometry
|
||||
-- of<anEdge1> and <anEdge2> and checks if they are infinite.
|
||||
returns Boolean from Standard;
|
||||
|
||||
ComputeGeometry (anEdge1 : Edge from TopoDS;
|
||||
anEdge2 : Edge from TopoDS;
|
||||
indexExt : out Integer from Standard;
|
||||
aCurve1 : out Curve from Geom;
|
||||
aCurve2 : out Curve from Geom;
|
||||
FirstPnt1 : out Pnt from gp;
|
||||
LastPnt1 : out Pnt from gp;
|
||||
FirstPnt2 : out Pnt from gp;
|
||||
LastPnt2 : out Pnt from gp;
|
||||
ExtCurve : out Curve from Geom;
|
||||
isinfinite1 : out Boolean from Standard;
|
||||
isinfinite2 : out Boolean from Standard;
|
||||
aPlane : Plane from Geom)
|
||||
|
||||
ComputeGeometry (theFirstEdge : Edge from TopoDS;
|
||||
theSecondEdge : Edge from TopoDS;
|
||||
theExtIndex : out Integer from Standard;
|
||||
theFirstCurve : out Curve from Geom;
|
||||
theSecondCurve : out Curve from Geom;
|
||||
theFirstPnt1 : out Pnt from gp;
|
||||
theLastPnt1 : out Pnt from gp;
|
||||
theFirstPnt2 : out Pnt from gp;
|
||||
theLastPnt2 : out Pnt from gp;
|
||||
theExtCurve : out Curve from Geom;
|
||||
theIsinfinite1 : out Boolean from Standard;
|
||||
theIsinfinite2 : out Boolean from Standard;
|
||||
thePlane : Plane from Geom)
|
||||
---Purpose: Used by 2d Relation only Computes the 3d geometry
|
||||
-- of<anEdge1> and <anEdge2> in the current Plane and the
|
||||
-- extremities if any. Return in ExtCurve the 3d curve
|
||||
@ -538,102 +577,78 @@ is
|
||||
-- significant. Return TRUE if ok
|
||||
returns Boolean from Standard;
|
||||
|
||||
ComputeGeomCurve (aCurve : in out Curve from Geom;
|
||||
first1 : Real from Standard;
|
||||
last1 : Real from Standard;
|
||||
FirstPnt1 : out Pnt from gp;
|
||||
LastPnt1 : out Pnt from gp;
|
||||
aPlane : Plane from Geom;
|
||||
isOnPlane: out Boolean from Standard)
|
||||
|
||||
ComputeGeomCurve (aCurve : in out Curve from Geom;
|
||||
first1 : Real from Standard;
|
||||
last1 : Real from Standard;
|
||||
FirstPnt1 : out Pnt from gp;
|
||||
LastPnt1 : out Pnt from gp;
|
||||
aPlane : Plane from Geom;
|
||||
isOnPlane: out Boolean from Standard)
|
||||
---Purpose: Checks if aCurve belongs to aPlane; if not, projects aCurve in aPlane
|
||||
-- and returns aCurve;
|
||||
-- Return TRUE if ok
|
||||
returns Boolean from Standard;
|
||||
|
||||
ComputeGeometry(aVertex : Vertex from TopoDS;
|
||||
point : out Pnt from gp;
|
||||
aPlane : Plane from Geom;
|
||||
isOnPlane: out Boolean from Standard)
|
||||
ComputeGeometry (aVertex : Vertex from TopoDS;
|
||||
point : out Pnt from gp;
|
||||
aPlane : Plane from Geom;
|
||||
isOnPlane: out Boolean from Standard)
|
||||
returns Boolean from Standard;
|
||||
|
||||
|
||||
GetPlaneFromFace( aFace : Face from TopoDS;
|
||||
aPlane : out Pln from gp;
|
||||
aSurf : out Surface from Geom;
|
||||
aSurfType : out KindOfSurface from AIS;
|
||||
Offset : out Real from Standard )
|
||||
GetPlaneFromFace (aFace : Face from TopoDS;
|
||||
aPlane : out Pln from gp;
|
||||
aSurf : out Surface from Geom;
|
||||
aSurfType : out KindOfSurface from AIS;
|
||||
Offset : out Real from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: Tryes to get Plane from Face. Returns Surface of Face
|
||||
-- in aSurf. Returns Standard_True and Plane of Face in
|
||||
-- aPlane in following cases:
|
||||
-- Face is Plane, Offset of Plane,
|
||||
-- Extrusion of Line and Offset of Extrusion of Line
|
||||
-- Returns pure type of Surface which can be:
|
||||
-- Plane, Cylinder, Cone, Sphere, Torus,
|
||||
-- SurfaceOfRevolution, SurfaceOfExtrusion
|
||||
-- Returns pure type of Surface which can be:
|
||||
-- Plane, Cylinder, Cone, Sphere, Torus,
|
||||
-- SurfaceOfRevolution, SurfaceOfExtrusion
|
||||
|
||||
InitFaceLength( aFace : Face from TopoDS;
|
||||
aPlane : out Pln from gp;
|
||||
aSurface : out Surface from Geom;
|
||||
aSurfaceType : out KindOfSurface from AIS;
|
||||
anOffset : out Real from Standard );
|
||||
|
||||
ComputeLengthBetweenPlanarFaces( FirstFace : Face from TopoDS;
|
||||
SecondFace : Face from TopoDS;
|
||||
Plane1 : Pln from gp;
|
||||
Plane2 : Pln from gp;
|
||||
Value : out Real from Standard;
|
||||
FirstAttach : out Pnt from gp ;
|
||||
SecondAttach : out Pnt from gp ;
|
||||
DirAttach : out Dir from gp ;
|
||||
AutomaticPos : Boolean from Standard;
|
||||
Position : in out Pnt from gp);
|
||||
|
||||
ComputeLengthBetweenCurvilinearFaces( FirstFace : Face from TopoDS;
|
||||
SecondFace : Face from TopoDS;
|
||||
FirstSurf : in out Surface from Geom;
|
||||
SecondSurf : in out Surface from Geom;
|
||||
AutomaticPos : Boolean from Standard;
|
||||
Value : out Real from Standard;
|
||||
Position : out Pnt from gp;
|
||||
FirstAttach : out Pnt from gp;
|
||||
SecondAttach : out Pnt from gp;
|
||||
DirAttach : out Dir from gp );
|
||||
|
||||
ComputeAngleBetweenPlanarFaces( FirstFace : Face from TopoDS;
|
||||
SecondFace : Face from TopoDS;
|
||||
Surf2 : Surface from Geom;
|
||||
Axis : Ax1 from gp;
|
||||
Value : Real from Standard;
|
||||
AutomaticPos : Boolean from Standard;
|
||||
Position : out Pnt from gp;
|
||||
Center : out Pnt from gp;
|
||||
FirstAttach : out Pnt from gp;
|
||||
SecondAttach : out Pnt from gp;
|
||||
FirstDir : out Dir from gp;
|
||||
SecondDir : out Dir from gp);
|
||||
---Purpose: Computes geometric parameters for planar faces for
|
||||
-- Angular dimensions
|
||||
|
||||
ComputeAngleBetweenCurvilinearFaces( FirstFace : Face from TopoDS;
|
||||
SecondFace : Face from TopoDS;
|
||||
FirstSurf : Surface from Geom;
|
||||
SecondSurf : Surface from Geom;
|
||||
FirstSurfType : KindOfSurface from AIS;
|
||||
SecondSurfType : KindOfSurface from AIS;
|
||||
Axis : Ax1 from gp;
|
||||
Value : Real from Standard;
|
||||
AutomaticPos : Boolean from Standard;
|
||||
Position : out Pnt from gp;
|
||||
Center : out Pnt from gp;
|
||||
FirstAttach : out Pnt from gp;
|
||||
SecondAttach : out Pnt from gp;
|
||||
FirstDir : out Dir from gp;
|
||||
SecondDir : out Dir from gp;
|
||||
Plane : out Plane from Geom );
|
||||
---Purpose: Computes geometric parameters for curvilinear faces for
|
||||
-- Angular dimensions
|
||||
InitFaceLength (aFace : Face from TopoDS;
|
||||
aPlane : out Pln from gp;
|
||||
aSurface : out Surface from Geom;
|
||||
aSurfaceType : out KindOfSurface from AIS;
|
||||
anOffset : out Real from Standard );
|
||||
|
||||
InitLengthBetweenCurvilinearFaces (theFirstFace : Face from TopoDS;
|
||||
theSecondFace : Face from TopoDS;
|
||||
theFirstSurf : in out Surface from Geom;
|
||||
theSecondSurf : in out Surface from Geom;
|
||||
theFirstAttach : out Pnt from gp;
|
||||
theSecondAttach : out Pnt from gp;
|
||||
theDirOnPlane : out Dir from gp);
|
||||
---Purpose: Finds attachment points on two curvilinear faces for length dimension.
|
||||
-- @param thePlaneDir [in] the direction on the dimension plane to
|
||||
-- compute the plane automatically. It will not be taken into account if
|
||||
-- plane is defined by user.
|
||||
|
||||
InitAngleBetweenPlanarFaces (theFirstFace : Face from TopoDS;
|
||||
theSecondFace : Face from TopoDS;
|
||||
theCenter : out Pnt from gp;
|
||||
theFirstAttach : out Pnt from gp;
|
||||
theSecondAttach : out Pnt from gp;
|
||||
theIsFirstPointSet : Boolean from Standard = Standard_False)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: Finds three points for the angle dimension between
|
||||
-- two planes.
|
||||
|
||||
InitAngleBetweenCurvilinearFaces (theFirstFace : Face from TopoDS;
|
||||
theSecondFace : Face from TopoDS;
|
||||
theFirstSurfType : KindOfSurface from AIS;
|
||||
theSecondSurfType : KindOfSurface from AIS;
|
||||
theCenter : out Pnt from gp;
|
||||
theFirstAttach : out Pnt from gp;
|
||||
theSecondAttach : out Pnt from gp;
|
||||
theIsFirstPointSet : Boolean from Standard = Standard_False)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: Finds three points for the angle dimension between
|
||||
-- two curvilinear surfaces.
|
||||
|
||||
ProjectPointOnPlane( aPoint : Pnt from gp; aPlane : Pln from gp )
|
||||
returns Pnt from gp;
|
||||
|
1702
src/AIS/AIS.cxx
1702
src/AIS/AIS.cxx
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -16,12 +16,6 @@
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
//! A framework to define display of angles. <br>
|
||||
//! These displays are particularly useful in viewing draft prisms. <br>
|
||||
//! The angle displayed may define an intersection <br>
|
||||
//! can be between two edges or two faces of a shape <br>
|
||||
//! or a plane. The display consists of arrows and text. <br>
|
||||
|
||||
#ifndef _AIS_AngleDimension_HeaderFile
|
||||
#define _AIS_AngleDimension_HeaderFile
|
||||
|
||||
@ -42,45 +36,170 @@
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
DEFINE_STANDARD_HANDLE (AIS_AngleDimension, AIS_Dimension)
|
||||
|
||||
//! Angle dimension. Can be constructed:
|
||||
//! - on two intersected edges.
|
||||
//! - on three points or vertices.
|
||||
//! - on conical face.
|
||||
//! - between two intersected faces.
|
||||
//!
|
||||
//! In case of three points or two intersected edges the dimension plane
|
||||
//! (on which dimension presentation is built) can be computed uniquely
|
||||
//! as through three defined points can be built only one plane.
|
||||
//! Therefore, if user-defined plane differs from this one, the dimension can't be built.
|
||||
//!
|
||||
//! In cases of two planes automatical plane by default is built on point of the
|
||||
//! origin of parametrical space of the first face (the basis surface) so, that
|
||||
//! the working plane and two faces intersection forms minimal angle between the faces.
|
||||
//! User can define the other point which the dimension plane should pass through
|
||||
//! using the appropriate constructor. This point can lay on the one of the faces or not.
|
||||
//! Also user can define his own plane but it should pass through the three points
|
||||
//! computed on the geometry initialization step (when the constructor or SetMeasuredGeometry() method
|
||||
//! is called).
|
||||
//!
|
||||
//! In case of the conical face the center point of the angle is the apex of the conical surface.
|
||||
//! The attachment points are points of the first and the last parameter of the basis circle of the cone.
|
||||
//!
|
||||
class AIS_AngleDimension : public AIS_Dimension
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructs angle dimension between two edges
|
||||
//! with automatic working plane computing
|
||||
//! if it is possible. In case of PI angle please
|
||||
//! set custom working plane or use constructor with 3 parameters.
|
||||
Standard_EXPORT AIS_AngleDimension (const TopoDS_Edge& theFirstEdge,
|
||||
const TopoDS_Edge& theSecondEdge);
|
||||
//! Constructs the angle display object defined by the <br>
|
||||
//! two edges and custom working plane.
|
||||
//! ATTENTION :In case if the working plane is custom and one edge is out of the
|
||||
//! working plane it tries to project this edge line on the plane.
|
||||
//! To avoid this case you can reset the working plane
|
||||
//! using <ResetWorkingPlane ()> method.
|
||||
Standard_EXPORT AIS_AngleDimension (const TopoDS_Edge& theFirstEdge,
|
||||
const TopoDS_Edge& theSecondEdge,
|
||||
const gp_Pln& thePlane);
|
||||
//! Constructs minimum angle dimension between two linear edges (where possible).
|
||||
//! These two edges should be intersected by each other. Otherwise the geometry is not valid.
|
||||
//! @param theFirstEdge [in] the first edge.
|
||||
//! @param theSecondEdge [in] the second edge.
|
||||
Standard_EXPORT AIS_AngleDimension (const TopoDS_Edge& theFirstEdge,
|
||||
const TopoDS_Edge& theSecondEdge);
|
||||
|
||||
//! Constructs the angle display object defined by three points.
|
||||
Standard_EXPORT AIS_AngleDimension (const gp_Pnt& theFirstPoint,
|
||||
const gp_Pnt& theSecondPoint,
|
||||
const gp_Pnt& theThirdPoint);
|
||||
//! @param theFirstPoint [in] the first point (point on first angle flyout).
|
||||
//! @param theSecondPoint [in] the center point of angle dimension.
|
||||
//! @param theThirdPoint [in] the second point (point on second angle flyout).
|
||||
Standard_EXPORT AIS_AngleDimension (const gp_Pnt& theFirstPoint,
|
||||
const gp_Pnt& theSecondPoint,
|
||||
const gp_Pnt& theThirdPoint);
|
||||
|
||||
//! Angle of cone
|
||||
Standard_EXPORT AIS_AngleDimension (const TopoDS_Face& theCone);
|
||||
//! Constructs the angle display object defined by three vertices.
|
||||
//! @param theFirstVertex [in] the first vertex (vertex for first angle flyout).
|
||||
//! @param theSecondVertex [in] the center vertex of angle dimension.
|
||||
//! @param theThirdPoint [in] the second vertex (vertex for second angle flyout).
|
||||
Standard_EXPORT AIS_AngleDimension (const TopoDS_Vertex& theFirstVertex,
|
||||
const TopoDS_Vertex& theSecondVertex,
|
||||
const TopoDS_Vertex& theThirdVertex);
|
||||
|
||||
//! TwoPlanarFaceAngle dimension
|
||||
Standard_EXPORT AIS_AngleDimension (const TopoDS_Face& theFirstFace,
|
||||
const TopoDS_Face& theSecondFace,
|
||||
const gp_Ax1& theAxis);
|
||||
//! Constructs angle dimension for the cone face.
|
||||
//! @param theCone [in] the conical face.
|
||||
Standard_EXPORT AIS_AngleDimension (const TopoDS_Face& theCone);
|
||||
|
||||
//! Sets first shape
|
||||
Standard_EXPORT void SetFirstShape (const TopoDS_Shape& theShape,
|
||||
const Standard_Boolean isSingleShape = Standard_False);
|
||||
//! Constructs angle dimension between two planar faces.
|
||||
//! @param theFirstFace [in] the first face.
|
||||
//! @param theSecondFace [in] the second face.
|
||||
Standard_EXPORT AIS_AngleDimension (const TopoDS_Face& theFirstFace,
|
||||
const TopoDS_Face& theSecondFace);
|
||||
|
||||
//! Constructs angle dimension between two planar faces.
|
||||
//! @param theFirstFace [in] the first face.
|
||||
//! @param theSecondFace [in] the second face.
|
||||
//! @param thePoint [in] the point which the dimension plane should pass through.
|
||||
//! This point can lay on the one of the faces or not.
|
||||
Standard_EXPORT AIS_AngleDimension (const TopoDS_Face& theFirstFace,
|
||||
const TopoDS_Face& theSecondFace,
|
||||
const gp_Pnt& thePoint);
|
||||
|
||||
public:
|
||||
|
||||
//! @return first point forming the angle.
|
||||
const gp_Pnt& FirstPoint() const
|
||||
{
|
||||
return myFirstPoint;
|
||||
}
|
||||
|
||||
//! @return second point forming the angle.
|
||||
const gp_Pnt& SecondPoint() const
|
||||
{
|
||||
return mySecondPoint;
|
||||
}
|
||||
|
||||
//! @return center point forming the angle.
|
||||
const gp_Pnt& CenterPoint() const
|
||||
{
|
||||
return myCenterPoint;
|
||||
}
|
||||
|
||||
//! @return first argument shape.
|
||||
const TopoDS_Shape& FirstShape() const
|
||||
{
|
||||
return myFirstShape;
|
||||
}
|
||||
|
||||
//! @return second argument shape.
|
||||
const TopoDS_Shape& SecondShape() const
|
||||
{
|
||||
return mySecondShape;
|
||||
}
|
||||
|
||||
//! @return third argument shape.
|
||||
const TopoDS_Shape& ThirdShape() const
|
||||
{
|
||||
return myThirdShape;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Measures minimum angle dimension between two linear edges.
|
||||
//! These two edges should be intersected by each other. Otherwise the geometry is not valid.
|
||||
//! @param theFirstEdge [in] the first edge.
|
||||
//! @param theSecondEdge [in] the second edge.
|
||||
Standard_EXPORT void SetMeasuredGeometry (const TopoDS_Edge& theFirstEdge,
|
||||
const TopoDS_Edge& theSecondEdge);
|
||||
|
||||
//! Measures angle defined by three points.
|
||||
//! @param theFirstPoint [in] the first point (point on first angle flyout).
|
||||
//! @param theSecondPoint [in] the center point of angle dimension.
|
||||
//! @param theThirdPoint [in] the second point (point on second angle flyout).
|
||||
Standard_EXPORT void SetMeasuredGeometry (const gp_Pnt& theFirstPoint,
|
||||
const gp_Pnt& theSecondPoint,
|
||||
const gp_Pnt& theThridPoint);
|
||||
|
||||
//! Measures angle defined by three vertices.
|
||||
//! @param theFirstVertex [in] the first vertex (vertex for first angle flyout).
|
||||
//! @param theSecondVertex [in] the center vertex of angle dimension.
|
||||
//! @param theThirdPoint [in] the second vertex (vertex for second angle flyout).
|
||||
Standard_EXPORT void SetMeasuredGeometry (const TopoDS_Vertex& theFirstVertex,
|
||||
const TopoDS_Vertex& theSecondVertex,
|
||||
const TopoDS_Vertex& theThirdVertex);
|
||||
|
||||
//! Measures angle of conical face.
|
||||
//! @param theCone [in] the shape to measure.
|
||||
Standard_EXPORT void SetMeasuredGeometry (const TopoDS_Face& theCone);
|
||||
|
||||
//! Measures angle between two planar faces.
|
||||
//! @param theFirstFace [in] the first face.
|
||||
//! @param theSecondFace [in] the second face..
|
||||
Standard_EXPORT void SetMeasuredGeometry (const TopoDS_Face& theFirstFace,
|
||||
const TopoDS_Face& theSecondFace);
|
||||
|
||||
//! Measures angle between two planar faces.
|
||||
//! @param theFirstFace [in] the first face.
|
||||
//! @param theSecondFace [in] the second face.
|
||||
//! @param thePoint [in] the point which the dimension plane should pass through.
|
||||
//! This point can lay on the one of the faces or not.
|
||||
Standard_EXPORT void SetMeasuredGeometry (const TopoDS_Face& theFirstFace,
|
||||
const TopoDS_Face& theSecondFace,
|
||||
const gp_Pnt& thePoint);
|
||||
|
||||
//! @return the display units string.
|
||||
Standard_EXPORT virtual const TCollection_AsciiString& GetDisplayUnits () const;
|
||||
|
||||
//! @return the model units string.
|
||||
Standard_EXPORT virtual const TCollection_AsciiString& GetModelUnits () const;
|
||||
|
||||
Standard_EXPORT virtual void SetDisplayUnits (const TCollection_AsciiString& theUnits);
|
||||
|
||||
Standard_EXPORT virtual void SetModelUnits (const TCollection_AsciiString& theUnits);
|
||||
|
||||
public:
|
||||
|
||||
@ -88,63 +207,111 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
//! Computes dimension value in display units
|
||||
Standard_EXPORT virtual void computeValue();
|
||||
//! Initialization of fields that is common to all constructors.
|
||||
Standard_EXPORT void Init();
|
||||
|
||||
Standard_EXPORT void init();
|
||||
|
||||
Standard_EXPORT gp_Pnt getCenterOnArc (const gp_Pnt& theFirstAttach,
|
||||
const gp_Pnt& theSecondAttach);
|
||||
|
||||
Standard_EXPORT void drawArc (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const gp_Pnt& theFirstAttach,
|
||||
const gp_Pnt& theSecondAttach,
|
||||
const gp_Pnt& theCenter,
|
||||
const Standard_Real theRadius,
|
||||
const Standard_Integer theMode);
|
||||
|
||||
Standard_EXPORT void drawArcWithText (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const gp_Pnt& theFirstAttach,
|
||||
//! @param theFirstAttach [in] the first attachment point.
|
||||
//! @param theSecondAttach [in] the second attachment point.
|
||||
//! @param theCenter [in] the center point (center point of the angle).
|
||||
//! @return the center of the dimension arc (the main dimension line in case of angle).
|
||||
Standard_EXPORT gp_Pnt GetCenterOnArc (const gp_Pnt& theFirstAttach,
|
||||
const gp_Pnt& theSecondAttach,
|
||||
const TCollection_ExtendedString& theText,
|
||||
const Standard_Real theTextWidth,
|
||||
const Standard_Integer theMode,
|
||||
const Standard_Integer theLabelPosition);
|
||||
const gp_Pnt& theCenter);
|
||||
|
||||
//! Draws main dimension line (arc).
|
||||
//! @param thePresentation [in] the dimension presentation.
|
||||
//! @param theFirstAttach [in] the first attachment point.
|
||||
//! @param theSecondAttach [in] the second attachment point.
|
||||
//! @param theCenter [in] the center point (center point of the angle).
|
||||
//! @param theRadius [in] the radius of the dimension arc.
|
||||
//! @param theMode [in] the display mode.
|
||||
Standard_EXPORT void DrawArc (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const gp_Pnt& theFirstAttach,
|
||||
const gp_Pnt& theSecondAttach,
|
||||
const gp_Pnt& theCenter,
|
||||
const Standard_Real theRadius,
|
||||
const Standard_Integer theMode);
|
||||
|
||||
//! Draws main dimension line (arc) with text.
|
||||
//! @param thePresentation [in] the dimension presentation.
|
||||
//! @param theFirstAttach [in] the first attachment point.
|
||||
//! @param theSecondAttach [in] the second attachment point.
|
||||
//! @param theCenter [in] the center point (center point of the angle).
|
||||
//! @param theText [in] the text label string.
|
||||
//! @param theTextWidth [in] the text label width.
|
||||
//! @param theMode [in] the display mode.
|
||||
//! @param theLabelPosition [in] the text label vertical and horizontal positioning option
|
||||
//! respectively to the main dimension line.
|
||||
Standard_EXPORT void DrawArcWithText (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const gp_Pnt& theFirstAttach,
|
||||
const gp_Pnt& theSecondAttach,
|
||||
const gp_Pnt& theCenter,
|
||||
const TCollection_ExtendedString& theText,
|
||||
const Standard_Real theTextWidth,
|
||||
const Standard_Integer theMode,
|
||||
const Standard_Integer theLabelPosition);
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT virtual void ComputePlane();
|
||||
|
||||
//! Checks if the plane includes three angle points to build dimension.
|
||||
Standard_EXPORT virtual Standard_Boolean CheckPlane (const gp_Pln& thePlane) const;
|
||||
|
||||
Standard_EXPORT virtual Standard_Real ComputeValue() const;
|
||||
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode = 0);
|
||||
|
||||
Standard_EXPORT Standard_Boolean initConeAngle (const TopoDS_Face& theCone);
|
||||
|
||||
Standard_EXPORT Standard_Boolean initTwoFacesAngle();
|
||||
|
||||
Standard_EXPORT Standard_Boolean initTwoEdgesAngle();
|
||||
|
||||
//! Auxiliary method to get position of the angle dimension
|
||||
//! if the cone is trimmed
|
||||
//! Returns 1 if <theC> center is above of <theCMin> center;
|
||||
//! 0 if <theC> center is between <theCMin> and <theCMax> centers;
|
||||
//! -1 if <theC> center is below <theCMax> center.
|
||||
Standard_EXPORT Standard_Integer aboveInBelowCone (const gp_Circ &theCMax,
|
||||
const gp_Circ &theCMin,
|
||||
const gp_Circ &theC);
|
||||
|
||||
//! Fills default plane object if it is possible to count plane automatically.
|
||||
Standard_EXPORT virtual void countDefaultPlane ();
|
||||
|
||||
//! Fills sensitive entity for flyouts and adds it to the selection
|
||||
Standard_EXPORT virtual void computeFlyoutSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner);
|
||||
Standard_EXPORT virtual void ComputeFlyoutSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner);
|
||||
|
||||
protected:
|
||||
|
||||
//! Shows if there is necessarily to draw extensions on angle dimension
|
||||
//! It is set to the true value if the attachment point are out of the edges.
|
||||
Standard_Boolean myIsFlyoutLines;
|
||||
//! Init angular dimension to measure angle between two linear edges.
|
||||
//! @return TRUE if the angular dimension can be constructured
|
||||
//! for the passed edges.
|
||||
Standard_EXPORT Standard_Boolean InitTwoEdgesAngle (gp_Pln& theComputedPlane);
|
||||
|
||||
//! The center of dimension arc
|
||||
gp_Pnt myCenter;
|
||||
//! Init angular dimension to measure angle between two planar faces.
|
||||
//! there is no user-defined poisitoning. So attach points are set
|
||||
//! according to faces geometry (in origin of the first face basis surface).
|
||||
//! @return TRUE if the angular dimension can be constructed
|
||||
//! for the passed faces.
|
||||
Standard_EXPORT Standard_Boolean InitTwoFacesAngle();
|
||||
|
||||
//! Init angular dimension to measure angle between two planar faces.
|
||||
//! @param thePointOnFirstFace [in] the point which the dimension plane should pass through.
|
||||
//! This point can lay on the one of the faces or not.
|
||||
//! It will be projected on the first face and this point will be set
|
||||
//! as the first point attach point.
|
||||
//! It defines some kind of dimension positioning over the faces.
|
||||
//! @return TRUE if the angular dimension can be constructed
|
||||
//! for the passed faces.
|
||||
Standard_EXPORT Standard_Boolean InitTwoFacesAngle (const gp_Pnt thePointOnFirstFace);
|
||||
|
||||
//! Init angular dimension to measure cone face.
|
||||
//! @return TRUE if the angular dimension can be constructed
|
||||
//! for the passed cone.
|
||||
Standard_EXPORT Standard_Boolean InitConeAngle();
|
||||
|
||||
//! Check that the points forming angle are valid.
|
||||
//! @return TRUE if the points met the following requirements:
|
||||
//! The (P1, Center), (P2, Center) can be built.
|
||||
//! The angle between the vectors > Precision::Angular().
|
||||
Standard_EXPORT Standard_Boolean IsValidPoints (const gp_Pnt& theFirstPoint,
|
||||
const gp_Pnt& theCenterPoint,
|
||||
const gp_Pnt& theSecondPoint) const;
|
||||
|
||||
private:
|
||||
|
||||
gp_Pnt myFirstPoint;
|
||||
gp_Pnt mySecondPoint;
|
||||
gp_Pnt myCenterPoint;
|
||||
TopoDS_Shape myFirstShape;
|
||||
TopoDS_Shape mySecondShape;
|
||||
TopoDS_Shape myThirdShape;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // _AIS_AngleDimension_HeaderFile
|
||||
|
@ -19,17 +19,18 @@
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
#include <AIS_DiameterDimension.hxx>
|
||||
#include <AIS.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <gce_MakeDir.hxx>
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Prs3d_Root.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE(AIS_DiameterDimension, AIS_Dimension)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_DiameterDimension, AIS_Dimension)
|
||||
#include <AIS.hxx>
|
||||
#include <BRepLib_MakeEdge.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <GeomAPI_IntCS.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <gce_MakeDir.hxx>
|
||||
#include <Standard_ProgramError.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE (AIS_DiameterDimension, AIS_Dimension)
|
||||
IMPLEMENT_STANDARD_RTTIEXT (AIS_DiameterDimension, AIS_Dimension)
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -40,69 +41,251 @@ namespace
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_DiameterDimension::AIS_DiameterDimension(const gp_Circ& theCircle)
|
||||
: AIS_Dimension(),
|
||||
myCircle (theCircle)
|
||||
AIS_DiameterDimension::AIS_DiameterDimension (const gp_Circ& theCircle)
|
||||
: AIS_Dimension (AIS_KOD_DIAMETER)
|
||||
{
|
||||
SetKindOfDimension(AIS_KOD_DIAMETER);
|
||||
myIsInitialized = Standard_True;
|
||||
SetMeasuredGeometry (theCircle);
|
||||
SetSpecialSymbol (THE_DIAMETER_SYMBOL);
|
||||
SetDisplaySpecialSymbol (AIS_DSS_Before);
|
||||
SetFlyout (0.0);
|
||||
// Count attach points
|
||||
myFirstPoint = ElCLib::Value (0, myCircle);
|
||||
mySecondPoint = myFirstPoint.Translated (gp_Vec(myFirstPoint, theCircle.Location())*2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_DiameterDimension::AIS_DiameterDimension(const gp_Circ& theCircle, const gp_Pnt& theAttachPoint)
|
||||
: AIS_Dimension(),
|
||||
myCircle (theCircle)
|
||||
AIS_DiameterDimension::AIS_DiameterDimension (const gp_Circ& theCircle,
|
||||
const gp_Pln& thePlane)
|
||||
: AIS_Dimension (AIS_KOD_DIAMETER)
|
||||
{
|
||||
SetKindOfDimension (AIS_KOD_DIAMETER);
|
||||
SetCustomPlane (thePlane);
|
||||
SetMeasuredGeometry (theCircle);
|
||||
SetSpecialSymbol (THE_DIAMETER_SYMBOL);
|
||||
SetDisplaySpecialSymbol (AIS_DSS_Before);
|
||||
SetFlyout (0.0);
|
||||
myFirstPoint = theAttachPoint;
|
||||
// Count the second point
|
||||
if (Abs(myFirstPoint.Distance (theCircle.Location()) - theCircle.Radius()) < Precision::Confusion())
|
||||
{
|
||||
mySecondPoint = myFirstPoint.Translated(gp_Vec(myFirstPoint, theCircle.Location())*2);
|
||||
}
|
||||
else
|
||||
{
|
||||
myFirstPoint = ElCLib::Value(0, myCircle);
|
||||
mySecondPoint = myFirstPoint.Translated(gp_Vec(myFirstPoint, theCircle.Location())*2);
|
||||
}
|
||||
myIsInitialized = Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose : Universal constructor for diameter dimension of shape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_DiameterDimension::AIS_DiameterDimension (const TopoDS_Shape& theShape)
|
||||
: AIS_Dimension ()
|
||||
: AIS_Dimension (AIS_KOD_DIAMETER)
|
||||
{
|
||||
SetKindOfDimension (AIS_KOD_DIAMETER);
|
||||
SetMeasuredGeometry (theShape);
|
||||
SetSpecialSymbol (THE_DIAMETER_SYMBOL);
|
||||
SetDisplaySpecialSymbol (AIS_DSS_Before);
|
||||
SetFlyout (0.0);
|
||||
myFirstShape = theShape;
|
||||
myIsInitialized = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_DiameterDimension::AIS_DiameterDimension (const TopoDS_Shape& theShape,
|
||||
const gp_Pln& thePlane)
|
||||
: AIS_Dimension (AIS_KOD_DIAMETER)
|
||||
{
|
||||
SetCustomPlane (thePlane);
|
||||
SetMeasuredGeometry (theShape);
|
||||
SetSpecialSymbol (THE_DIAMETER_SYMBOL);
|
||||
SetDisplaySpecialSymbol (AIS_DSS_Before);
|
||||
SetFlyout (0.0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AnchorPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
gp_Pnt AIS_DiameterDimension::AnchorPoint()
|
||||
{
|
||||
if (!IsValid())
|
||||
{
|
||||
return gp::Origin();
|
||||
}
|
||||
|
||||
return myAnchorPoint;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMeasuredGeometry
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_DiameterDimension::SetMeasuredGeometry (const gp_Circ& theCircle)
|
||||
{
|
||||
myCircle = theCircle;
|
||||
myGeometryType = GeometryType_Edge;
|
||||
myShape = BRepLib_MakeEdge (theCircle);
|
||||
myAnchorPoint = gp::Origin();
|
||||
myIsValid = IsValidCircle (myCircle);
|
||||
|
||||
if (myIsValid && myIsPlaneCustom)
|
||||
{
|
||||
ComputeAnchorPoint();
|
||||
}
|
||||
else if (!myIsPlaneCustom)
|
||||
{
|
||||
ComputePlane();
|
||||
myAnchorPoint = ElCLib::Value (0.0, myCircle);
|
||||
}
|
||||
|
||||
myIsValid &= CheckPlane (myPlane);
|
||||
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMeasuredGeometry
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_DiameterDimension::SetMeasuredGeometry (const TopoDS_Shape& theShape)
|
||||
{
|
||||
gp_Pnt aDummyPnt (gp::Origin());
|
||||
Standard_Boolean isClosed = Standard_False;
|
||||
|
||||
myGeometryType = GeometryType_UndefShapes;
|
||||
myShape = theShape;
|
||||
myAnchorPoint = gp::Origin();
|
||||
myIsValid = InitCircularDimension (theShape, myCircle, aDummyPnt, isClosed)
|
||||
&& IsValidCircle (myCircle)
|
||||
&& isClosed;
|
||||
|
||||
if (myIsValid && myIsPlaneCustom)
|
||||
{
|
||||
ComputeAnchorPoint();
|
||||
}
|
||||
else if (!myIsPlaneCustom)
|
||||
{
|
||||
ComputePlane();
|
||||
myAnchorPoint = ElCLib::Value (0.0, myCircle);
|
||||
}
|
||||
|
||||
myIsValid &= CheckPlane (myPlane);
|
||||
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckPlane
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_DiameterDimension::CheckPlane (const gp_Pln& thePlane) const
|
||||
{
|
||||
// Check if the circle center point belongs to plane.
|
||||
if (!thePlane.Contains (myCircle.Location(), Precision::Confusion()))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputePlane
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_DiameterDimension::ComputePlane()
|
||||
{
|
||||
if (!IsValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myPlane = gp_Pln (gp_Ax3 (myCircle.Position()));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeAnchorPoint
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_DiameterDimension::ComputeAnchorPoint()
|
||||
{
|
||||
// Anchor point is an intersection of dimension plane and circle.
|
||||
Handle(Geom_Circle) aCircle = new Geom_Circle (myCircle);
|
||||
Handle(Geom_Plane) aPlane = new Geom_Plane (myPlane);
|
||||
GeomAPI_IntCS anIntersector (aCircle, aPlane);
|
||||
if (!anIntersector.IsDone())
|
||||
{
|
||||
myIsValid = Standard_False;
|
||||
return;
|
||||
}
|
||||
|
||||
// The circle lays on the plane.
|
||||
if (anIntersector.NbPoints() != 2)
|
||||
{
|
||||
myAnchorPoint = ElCLib::Value (0.0, myCircle);
|
||||
myIsValid = Standard_True;
|
||||
return;
|
||||
}
|
||||
|
||||
gp_Pnt aFirstPoint = anIntersector.Point (1);
|
||||
gp_Pnt aSecondPoint = anIntersector.Point (2);
|
||||
|
||||
// Choose one of two intersection points that stands with
|
||||
// positive direction of flyout.
|
||||
// An anchor point is supposed to be the left attachment point.
|
||||
gp_Dir aFirstDir = gce_MakeDir (aFirstPoint, myCircle.Location());
|
||||
gp_Dir aDir = myPlane.Axis().Direction() ^ aFirstDir;
|
||||
myAnchorPoint = (gp_Vec (aDir) * gp_Vec(myCircle.Position().Direction()) > 0.0)
|
||||
? aFirstPoint
|
||||
: aSecondPoint;
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetModelUnits
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TCollection_AsciiString& AIS_DiameterDimension::GetModelUnits() const
|
||||
{
|
||||
return myDrawer->DimLengthModelUnits();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetDisplayUnits
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TCollection_AsciiString& AIS_DiameterDimension::GetDisplayUnits() const
|
||||
{
|
||||
return myDrawer->DimLengthDisplayUnits();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetModelUnits
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_DiameterDimension::SetModelUnits (const TCollection_AsciiString& theUnits)
|
||||
{
|
||||
myDrawer->SetDimLengthModelUnits (theUnits);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDisplayUnits
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_DiameterDimension::SetDisplayUnits (const TCollection_AsciiString& theUnits)
|
||||
{
|
||||
myDrawer->SetDimLengthDisplayUnits (theUnits);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real AIS_DiameterDimension::ComputeValue() const
|
||||
{
|
||||
if (!IsValid())
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return myCircle.Radius() * 2.0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DiameterDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePM*/,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode)
|
||||
@ -110,48 +293,72 @@ void AIS_DiameterDimension::Compute (const Handle(PrsMgr_PresentationManager3d)&
|
||||
thePresentation->Clear();
|
||||
mySelectionGeom.Clear (theMode);
|
||||
|
||||
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
|
||||
if (!myIsInitialized)
|
||||
if (!IsValid())
|
||||
{
|
||||
if (!initCircularDimension (myFirstShape, myCircle,
|
||||
myFirstPoint, mySecondPoint))
|
||||
return;
|
||||
else
|
||||
myIsInitialized = Standard_True;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!myIsWorkingPlaneCustom)
|
||||
gp_Pnt aFirstPnt (gp::Origin());
|
||||
gp_Pnt aSecondPnt (gp::Origin());
|
||||
ComputeSidePoints (myCircle, GetPlane(), aFirstPnt, aSecondPnt);
|
||||
|
||||
DrawLinearDimension (thePresentation, theMode, aFirstPnt, aSecondPnt);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeFlyoutSelection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_DiameterDimension::ComputeFlyoutSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Handle(SelectMgr_EntityOwner)& theEntityOwner)
|
||||
{
|
||||
if (!IsValid())
|
||||
{
|
||||
countDefaultPlane();
|
||||
return;
|
||||
}
|
||||
|
||||
drawLinearDimension (thePresentation, theMode);
|
||||
gp_Pnt aFirstPnt (gp::Origin());
|
||||
gp_Pnt aSecondPnt (gp::Origin());
|
||||
ComputeSidePoints (myCircle, GetPlane(), aFirstPnt, aSecondPnt);
|
||||
|
||||
ComputeLinearFlyouts (theSelection, theEntityOwner, aFirstPnt, aSecondPnt);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : computeValue
|
||||
//function : ComputeSidePoints
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DiameterDimension::computeValue ()
|
||||
void AIS_DiameterDimension::ComputeSidePoints (const gp_Circ& /*theCircle*/,
|
||||
const gp_Pln& /*thePlane*/,
|
||||
gp_Pnt& theFirstPnt,
|
||||
gp_Pnt& theSecondPnt)
|
||||
{
|
||||
myValue = myFirstPoint.Distance (mySecondPoint);
|
||||
AIS_Dimension::computeValue();
|
||||
theFirstPnt = AnchorPoint();
|
||||
|
||||
gp_Vec aRadiusVector (myCircle.Location(), theFirstPnt);
|
||||
theSecondPnt = myCircle.Location().Translated (-aRadiusVector);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : countDefaultPlane
|
||||
//function : IsValidCircle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DiameterDimension::countDefaultPlane ()
|
||||
Standard_Boolean AIS_DiameterDimension::IsValidCircle (const gp_Circ& theCircle) const
|
||||
{
|
||||
// Compute normal of the default plane.
|
||||
//gp_Vec aVec1(mySecondPoint, myFirstPoint),
|
||||
// aVec2(mySecondPoint, ElCLib::Value(M_PI_2, myCircle));
|
||||
myDefaultPlane = gp_Pln(gp_Ax3(myCircle.Position()));
|
||||
// Set computed value to <myWorkingPlane>
|
||||
ResetWorkingPlane ();
|
||||
return (theCircle.Radius() * 2.0) > Precision::Confusion();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsValidAnchor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_DiameterDimension::IsValidAnchor (const gp_Circ& theCircle,
|
||||
const gp_Pnt& theAnchor) const
|
||||
{
|
||||
gp_Pln aCirclePlane (theCircle.Location(), theCircle.Axis().Direction());
|
||||
Standard_Real anAnchorDist = theAnchor.Distance (theCircle.Location());
|
||||
Standard_Real aRadius = myCircle.Radius();
|
||||
|
||||
return Abs (anAnchorDist - aRadius) > Precision::Confusion()
|
||||
&& aCirclePlane.Contains (theAnchor, Precision::Confusion());
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
#ifndef _AIS_DiameterDimension_HeaderFile
|
||||
#define _AIS_DiameterDimension_HeaderFile
|
||||
|
||||
@ -26,48 +27,159 @@
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_DiameterDimension,AIS_Dimension)
|
||||
DEFINE_STANDARD_HANDLE (AIS_DiameterDimension, AIS_Dimension)
|
||||
|
||||
//! A framework to display diameter dimensions. <br>
|
||||
//! A diameter is displayed with arrows and text. The <br>
|
||||
//! text gives the length of the diameter. <br>
|
||||
//! The algorithm takes a length along a face and <br>
|
||||
//! analyzes it as an arc. It then reconstructs the circle <br>
|
||||
//! corresponding to the arc and calculates the <br>
|
||||
//! diameter of this circle. This diameter serves as a <br>
|
||||
//! relational reference in 3d presentations of the surface. <br>
|
||||
//! Diameter dimension. Can be constructued:
|
||||
//! - On generic circle.
|
||||
//! - On generic circle with user-defined anchor point on that circle
|
||||
//! (dimension plane is oriented to follow the anchor point).
|
||||
//! - On generic circle in the specified plane.
|
||||
//! - On generic shape containing geometry that can be measured
|
||||
//! by diameter dimension: circle wire, circular face, etc.
|
||||
//! The anchor point is the location of the left attachement point of
|
||||
//! dimension on the circle.
|
||||
//! The anchor point computation is processed after dimension plane setting
|
||||
//! so that positive flyout direction stands with normal of the circle and
|
||||
//! the normal of the plane.
|
||||
//! If the plane is user-defined the anchor point was computed as intersection
|
||||
//! of the plane and the basis circle. Among two intersection points
|
||||
//! the one is selected so that positive flyout direction vector and
|
||||
//! the circle normal on the one side form the circle plane.
|
||||
//! (corner between positive flyout directio nand the circle normal is acute.)
|
||||
//! If the plane is computed automatically (by default it is the circle plane),
|
||||
//! the anchor point is the zero parameter point of the circle.
|
||||
//!
|
||||
//! The dimension is considered as invalid if the user-defined plane
|
||||
//! does not include th enachor point and th ecircle center,
|
||||
//! if the diameter of the circle is less than Precision::Confusion().
|
||||
//! In case if the dimension is built on the arbitrary shape, it can be considered
|
||||
//! as invalid if the shape does not contain circle geometry.
|
||||
//!
|
||||
class AIS_DiameterDimension : public AIS_Dimension
|
||||
{
|
||||
public:
|
||||
//! Constructs a diameter display object defined by the <br>
|
||||
//! circle <theCircle>
|
||||
Standard_EXPORT AIS_DiameterDimension(const gp_Circ& theCircle);
|
||||
|
||||
//! Constructor that allows to set a attach point <br>
|
||||
//! on the circle <theCircle> where to attach dimension
|
||||
Standard_EXPORT AIS_DiameterDimension (const gp_Circ& theCircle,
|
||||
const gp_Pnt& theAttachPoint);
|
||||
//! Construct diameter dimension for the circle.
|
||||
//! @param theCircle [in] the circle to measure.
|
||||
Standard_EXPORT AIS_DiameterDimension (const gp_Circ& theCircle);
|
||||
|
||||
Standard_EXPORT AIS_DiameterDimension (const TopoDS_Shape& theShape);
|
||||
//! Construct diameter dimension for the circle and orient it correspondingly
|
||||
//! to the passed plane.
|
||||
//! @param theCircle [in] the circle to measure.
|
||||
//! @param thePlane [in] the plane defining preferred orientation
|
||||
//! for dimension.
|
||||
Standard_EXPORT AIS_DiameterDimension (const gp_Circ& theCircle,
|
||||
const gp_Pln& thePlane);
|
||||
|
||||
//! Construct diameter on the passed shape, if applicable.
|
||||
//! @param theShape [in] the shape to measure.
|
||||
Standard_EXPORT AIS_DiameterDimension (const TopoDS_Shape& theShape);
|
||||
|
||||
//! Construct diameter on the passed shape, if applicable - and
|
||||
//! define the preferred plane to orient the dimension.
|
||||
//! @param theShape [in] the shape to measure.
|
||||
//! @param thePlane [in] the plane defining preferred orientation
|
||||
//! for dimension.
|
||||
Standard_EXPORT AIS_DiameterDimension (const TopoDS_Shape& theShape,
|
||||
const gp_Pln& thePlane);
|
||||
|
||||
public:
|
||||
|
||||
//! @return measured geometry circle.
|
||||
const gp_Circ& Circle() const
|
||||
{
|
||||
return myCircle;
|
||||
}
|
||||
|
||||
//! @return anchor point on circle for diameter dimension.
|
||||
Standard_EXPORT gp_Pnt AnchorPoint();
|
||||
|
||||
//! @return the measured shape.
|
||||
const TopoDS_Shape& Shape() const
|
||||
{
|
||||
return myShape;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Measure diameter of the circle.
|
||||
//! The actual dimension plane is used for determining anchor points
|
||||
//! on the circle to attach the dimension lines to.
|
||||
//! The dimension will become invalid if the diameter of the circle
|
||||
//! is less than Precision::Confusion().
|
||||
//! @param theCircle [in] the circle to measure.
|
||||
Standard_EXPORT void SetMeasuredGeometry (const gp_Circ& theCircle);
|
||||
|
||||
//! Measure diameter on the passed shape, if applicable.
|
||||
//! The dimension will become invalid if the passed shape is not
|
||||
//! measurable or if measured diameter value is less than Precision::Confusion().
|
||||
//! @param theShape [in] the shape to measure.
|
||||
Standard_EXPORT void SetMeasuredGeometry (const TopoDS_Shape& theShape);
|
||||
|
||||
//! @return the display units string.
|
||||
Standard_EXPORT virtual const TCollection_AsciiString& GetDisplayUnits () const;
|
||||
|
||||
//! @return the model units string.
|
||||
Standard_EXPORT virtual const TCollection_AsciiString& GetModelUnits () const;
|
||||
|
||||
Standard_EXPORT virtual void SetDisplayUnits (const TCollection_AsciiString& theUnits);
|
||||
|
||||
Standard_EXPORT virtual void SetModelUnits (const TCollection_AsciiString& theUnits);
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI(AIS_DiameterDimension)
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT virtual void computeValue();
|
||||
//! Override this method to change logic of anchor point computation.
|
||||
//! Computes anchor point. Its computation is based on the current
|
||||
//! dimension plane. Therfore, anchor point is an intersection of plane
|
||||
//! and circle.
|
||||
//! ATTENTION!
|
||||
//! 1) The plane should be set or computed before.
|
||||
//! 2) The plane should inclide th ecircle center to be valid.
|
||||
Standard_EXPORT virtual void ComputeAnchorPoint();
|
||||
|
||||
//! Fills default plane object if it is possible to count plane automatically.
|
||||
Standard_EXPORT virtual void countDefaultPlane();
|
||||
Standard_EXPORT virtual void ComputePlane();
|
||||
|
||||
private:
|
||||
//! Checks if the center of the circle is on the plane.
|
||||
Standard_EXPORT virtual Standard_Boolean CheckPlane (const gp_Pln& thePlane) const;
|
||||
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode = 0);
|
||||
Standard_EXPORT virtual Standard_Real ComputeValue() const;
|
||||
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode = 0);
|
||||
|
||||
Standard_EXPORT virtual void ComputeFlyoutSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Handle(SelectMgr_EntityOwner)& theEntityOwner);
|
||||
|
||||
protected:
|
||||
|
||||
//! Compute points on the circle sides for the specified dimension plane.
|
||||
//! Program error exception is raised if the dimension plane "x" direction
|
||||
//! is orthogonal to plane (the "impossible" case). The passed dimension plane
|
||||
//! is the one specially computed to locate dimension presentation in circle.
|
||||
//! @param theCircle [in] the circle.
|
||||
//! @param thePlane [in] the dimension presentation plane computed.
|
||||
//! @param theFirstPnt [out] the first point.
|
||||
//! @param theSecondPnt [out] the second point.
|
||||
Standard_EXPORT void ComputeSidePoints (const gp_Circ& theCircle,
|
||||
const gp_Pln& thePlane,
|
||||
gp_Pnt& theFirstPnt,
|
||||
gp_Pnt& theSecondPnt);
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsValidCircle (const gp_Circ& theCircle) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsValidAnchor (const gp_Circ& theCircle,
|
||||
const gp_Pnt& thePnt) const;
|
||||
|
||||
// Fields
|
||||
private:
|
||||
|
||||
gp_Circ myCircle;
|
||||
gp_Circ myCircle;
|
||||
gp_Pnt myAnchorPoint;
|
||||
TopoDS_Shape myShape;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // _AIS_DiameterDimension_HeaderFile
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,6 @@
|
||||
// Copyright (c) 1998-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2013 OPEN CASCADE SAS
|
||||
// Created on: 2013-11-11
|
||||
// Created by: Anastasia BORISOVA
|
||||
// Copyright (c) 2013 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
@ -16,8 +17,8 @@
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
#ifndef _AIS_Dimension_Headerfile
|
||||
#define _AIS_Dimension_Headerfile
|
||||
#ifndef _AIS_Dimension_HeaderFile
|
||||
#define _AIS_Dimension_HeaderFile
|
||||
|
||||
#include <AIS_DimensionSelectionMode.hxx>
|
||||
#include <AIS_DimensionOwner.hxx>
|
||||
@ -26,11 +27,12 @@
|
||||
#include <AIS_KindOfInteractive.hxx>
|
||||
#include <AIS_KindOfDimension.hxx>
|
||||
#include <AIS_KindOfSurface.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
#include <Prs3d_DimensionUnits.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
@ -46,12 +48,121 @@
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_Dimension, AIS_InteractiveObject)
|
||||
|
||||
//! AIS_Dimension is a base class for 2D presentations of linear (length, diameter, radius)
|
||||
//! and angular dimensions.
|
||||
//!
|
||||
//! The dimensions provide measurement of quantities, such as lengths or plane angles.
|
||||
//! The measurement of dimension "value" is done in model space "as is".
|
||||
//! These "value" are said to be represented in "model units", which can be specified by user.
|
||||
//! During the display the measured value converted from "model units" to "display units".
|
||||
//! The display and model units are stored in common Prs3d_Drawer (drawer of the context)
|
||||
//! to share it between all dimensions.
|
||||
//! The specified by user units are stored in the dimension's drawer.
|
||||
//!
|
||||
//! As a drawing, the dimension is composed from the following components:
|
||||
//! - Attachement (binding) points. The points where the dimension lines attaches to, for
|
||||
//! length dimensions the distances are measured between these points.
|
||||
//! - Main dimension line. The which extends from the attachement points in "up" direction,
|
||||
//! and which contains text label on it with value string.
|
||||
//! - Flyouts. The lines connecting the attachement points with main dimension line.
|
||||
//! - Extension. The lines used to extend the main dimension line in the cases when text
|
||||
//! or arrows do not fit into the main dimension line due to their size.
|
||||
//! - Arrows.
|
||||
//!
|
||||
//! <pre>
|
||||
//! Linear dimensions:
|
||||
//!
|
||||
//! extension
|
||||
//! line arrow
|
||||
//! -->|------- main dimension line -------|<--
|
||||
//! | |
|
||||
//! |flyout flyout|
|
||||
//! | |
|
||||
//! +-----------------------------------+
|
||||
//! attachement attachement
|
||||
//! point point
|
||||
//!
|
||||
//! Angular dimensions:
|
||||
//!
|
||||
//! extension
|
||||
//! line
|
||||
//! -->|+++++
|
||||
//! arrow | +++
|
||||
//! | 90(deg) - main dimension line
|
||||
//! flyout | +++
|
||||
//! | +
|
||||
//! o---flyout---
|
||||
//! center ^
|
||||
//! point | extension
|
||||
//! line
|
||||
//! </pre>
|
||||
//!
|
||||
//! Being a 2D drawings, the dimensions are created on imaginary plane, called "dimension plane",
|
||||
//! which can be thought of as reference system of axes (X,Y,N) for constructing the presentation.
|
||||
//!
|
||||
//! The role of axes of the dimension plane is to guide you through the encapsualted automations
|
||||
//! of presentation building to help you understand how is the presentation will look and how it
|
||||
//! will be oriented in model space during construction.
|
||||
//!
|
||||
//! Orientation of dimension line in model space relatively to the base shapes is defined
|
||||
//! with the flyouts. Flyouts specify length of flyout lines and their orientation relatively
|
||||
//! to the attachment points on the working plane.
|
||||
//! For linear dimensions:
|
||||
//! Direction of flyouts is specified with direction of main dimension line
|
||||
//! (vector from the first attachment to the second attachment) and the normal of the dimension plane.
|
||||
//! Positive direction of flyouts is defined by vector multiplication: AttachVector * PlaneNormal.
|
||||
//! For angular dimensions:
|
||||
//! Flyouts are defined by vectors from the center point to the attachment points.
|
||||
//! These vectors directions are supposed to be the positive directions of flyouts.
|
||||
//! Negative flyouts directions means that these vectors should be reversed
|
||||
//! (and dimension will be built out of the angle constructed with center and two attach points).
|
||||
//!
|
||||
//! The dimension plane can be constructed automatically by application (where possible,
|
||||
//! it depends on the measured geometry).
|
||||
//! It can be also set by user. However, if the user-defined plane does not fit the
|
||||
//! geometry of the dimension (attach points do not belong to it), the dimension could not
|
||||
//! be built.
|
||||
//! If it is not possible to compute automatic plane (for example, in case of length between
|
||||
//! two points) the user is supposed to specify the custom plane.
|
||||
//!
|
||||
//! Since the dimensions feature automated construction procedures from an arbitrary shapes,
|
||||
//! the interfaces to check the validness are also implemented. Once the measured geometry is
|
||||
//! specified, the one can inquire the validness status by calling "IsValid()" method. If the result
|
||||
//! is TRUE, then all of public parameters should be pre-computed and ready. The presentation
|
||||
//! should be also computable. Otherwise, the parameters may return invalid values. In this case,
|
||||
//! the presentation will not be computed and displayed.
|
||||
//!
|
||||
//! The dimension support two local selection modes: main dimension line selection and text label
|
||||
//! selection. These modes can be used to develop interactive modification of dimension presentations.
|
||||
//! The component hilighting in these selection modes is provided by AIS_DimensionOwner class.
|
||||
//! Please note that selection is unavailable until the presentation is computed.
|
||||
//!
|
||||
//! The specific drawing attributes are controlled through Prs3d_DimensionAspect. The one can change
|
||||
//! color, arrows, text and arrow style and specify positioning of value label by setting corresponding
|
||||
//! values to the aspect.
|
||||
//!
|
||||
class AIS_Dimension : public AIS_InteractiveObject
|
||||
{
|
||||
protected:
|
||||
|
||||
// Specifies supported at base level horizontal and vertical
|
||||
// label positions for drawing extension lines and centered text.
|
||||
//! Geometry type defines type of shapes on which the dimension is to be built.
|
||||
//! Some type of geometry allows automatical plane computing and
|
||||
//! can be built without user-defined plane
|
||||
//! Another types can't be built without user-defined plane.
|
||||
enum GeometryType
|
||||
{
|
||||
GeometryType_UndefShapes,
|
||||
GeometryType_Edge,
|
||||
GeometryType_Face,
|
||||
GeometryType_Points,
|
||||
GeometryType_Edges,
|
||||
GeometryType_Faces,
|
||||
GeometryType_EdgeFace,
|
||||
GeometryType_EdgeVertex
|
||||
};
|
||||
|
||||
//! Specifies supported at base level horizontal and vertical
|
||||
//! label positions for drawing extension lines and centered text.
|
||||
enum LabelPosition
|
||||
{
|
||||
LabelPosition_None = 0x00,
|
||||
@ -59,12 +170,12 @@ protected:
|
||||
LabelPosition_Left = 0x01,
|
||||
LabelPosition_Right = 0x02,
|
||||
LabelPosition_HCenter = 0x04,
|
||||
LabelPosition_HMask = LabelPosition_Left | LabelPosition_Right | LabelPosition_HCenter,
|
||||
LabelPosition_HMask = LabelPosition_Left | LabelPosition_Right | LabelPosition_HCenter,
|
||||
|
||||
LabelPosition_Above = 0x10,
|
||||
LabelPosition_Below = 0x20,
|
||||
LabelPosition_VCenter = 0x40,
|
||||
LabelPosition_VMask = LabelPosition_Above | LabelPosition_Below | LabelPosition_VCenter
|
||||
LabelPosition_VMask = LabelPosition_Above | LabelPosition_Below | LabelPosition_VCenter
|
||||
};
|
||||
|
||||
public:
|
||||
@ -81,158 +192,174 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor with default parameters values
|
||||
Standard_EXPORT AIS_Dimension();
|
||||
//! Constructor with default parameters values.
|
||||
//! @param theType [in] the type of dimension.
|
||||
Standard_EXPORT AIS_Dimension (const AIS_KindOfDimension theType);
|
||||
|
||||
//! Gets dimension value
|
||||
Standard_EXPORT Standard_Real GetValue() const;
|
||||
//! Gets dimension measurement value. If the value to display is not
|
||||
//! specified by user, then the dimension object is responsible to
|
||||
//! compute it on its own in model space coordinates.
|
||||
//! @return the dimension value (in model units) which is used
|
||||
//! during display of the presentation.
|
||||
Standard_Real GetValue() const
|
||||
{
|
||||
return myIsValueCustom ? myCustomValue : ComputeValue();
|
||||
}
|
||||
|
||||
//! Sets dimension value
|
||||
//! Attention! This method is used ONLY to set custom value.
|
||||
//! To set value internally, use <myValue>.
|
||||
Standard_EXPORT void SetCustomValue (const Standard_Real theValue);
|
||||
//! Sets user-defined dimension value.
|
||||
//! The user-defined dimension value is specified in model space,
|
||||
//! and affect by unit conversion during the display.
|
||||
//! @param theValue [in] the user-defined value to display.
|
||||
Standard_EXPORT void SetCustomValue (const Standard_Real theValue);
|
||||
|
||||
//! Gets working plane.
|
||||
Standard_EXPORT const gp_Pln& GetWorkingPlane() const;
|
||||
//! Get the dimension plane in which the 2D dimension presentation is computed.
|
||||
//! By default, if plane is not defined by user, it is computed automatically
|
||||
//! after dimension geometry is computed.
|
||||
//! If computed dimension geometry (points) can't be placed on the user-defined
|
||||
//! plane, dimension geometry was set as unvalid (validity flag is set to false)
|
||||
//! and dimension presentation wil not be computed.
|
||||
//! If user-defined plane allow geometry placement on it, it will be used for
|
||||
//! computing of the dimension presentation.
|
||||
//! @return dimension plane used for presentation computing.
|
||||
Standard_EXPORT const gp_Pln& GetPlane() const;
|
||||
|
||||
//! Sets working plane.
|
||||
Standard_EXPORT void SetWorkingPlane (const gp_Pln& thePlane);
|
||||
//! Geometry type defines type of shapes on which the dimension is to be built.
|
||||
//! @return type of geometry on which the dimension will be built.
|
||||
Standard_EXPORT const Standard_Integer GetGeometryType () const;
|
||||
|
||||
Standard_EXPORT void SetFirstPoint (const gp_Pnt& thePoint);
|
||||
//! Sets user-defined plane where the 2D dimension presentation will be placed.
|
||||
//! Checks validity of this plane if geometry has been set already.
|
||||
//! Validity of the plane is checked according to the geometry set
|
||||
//! and has different criteria for different kinds of dimensions.
|
||||
Standard_EXPORT virtual void SetCustomPlane (const gp_Pln& thePlane);
|
||||
|
||||
Standard_EXPORT void SetSecondPoint (const gp_Pnt& thePoint);
|
||||
//! Unsets user-defined plane. Therefore the plane for dimension will be
|
||||
//! computed automatically.
|
||||
Standard_EXPORT void UnsetCustomPlane() { myIsPlaneCustom = Standard_False; }
|
||||
|
||||
Standard_EXPORT void SetFirstShape (const TopoDS_Shape& theFirstShape);
|
||||
|
||||
Standard_EXPORT void SetSecondShape (const TopoDS_Shape& theSecondShape);
|
||||
public:
|
||||
|
||||
//! Gets the dimension aspect from AIS object drawer.
|
||||
//! Dimension aspect contains aspects of line, text and arrows for dimension presentation.
|
||||
Standard_EXPORT Handle(Prs3d_DimensionAspect) DimensionAspect() const;
|
||||
Handle(Prs3d_DimensionAspect) DimensionAspect() const
|
||||
{
|
||||
return myDrawer->DimensionAspect();
|
||||
}
|
||||
|
||||
//! Sets new length aspect in the interactive object drawer.
|
||||
Standard_EXPORT void SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theDimensionAspect);
|
||||
//! Sets new dimension aspect for the interactive object drawer.
|
||||
//! The dimension aspect provides dynamic properties which are generally
|
||||
//! used during computation of dimension presentations.
|
||||
Standard_EXPORT void SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theDimensionAspect);
|
||||
|
||||
//! Returns the kind of dimension
|
||||
Standard_EXPORT AIS_KindOfDimension KindOfDimension() const;
|
||||
//! @return the kind of dimension.
|
||||
AIS_KindOfDimension KindOfDimension() const
|
||||
{
|
||||
return myKindOfDimension;
|
||||
}
|
||||
|
||||
//! Returns the kind of interactive
|
||||
Standard_EXPORT virtual AIS_KindOfInteractive Type() const;
|
||||
|
||||
//! Sets the kind of dimension
|
||||
Standard_EXPORT virtual void SetKindOfDimension (const AIS_KindOfDimension theKindOfDimension);
|
||||
//! @return the kind of interactive.
|
||||
virtual AIS_KindOfInteractive Type() const
|
||||
{
|
||||
return AIS_KOI_Relation;
|
||||
}
|
||||
|
||||
//! Returns true if the class of objects accepts the display mode theMode.
|
||||
//! The interactive context can have a default mode of
|
||||
//! representation for the set of Interactive Objects. This
|
||||
//! mode may not be accepted by object
|
||||
Standard_EXPORT virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const;
|
||||
//! The interactive context can have a default mode of representation for
|
||||
//! the set of Interactive Objects. This mode may not be accepted by object.
|
||||
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const
|
||||
{
|
||||
return theMode == ComputeMode_All;
|
||||
}
|
||||
|
||||
// Selection computing if it is needed here
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode);
|
||||
public:
|
||||
|
||||
//! Reset working plane to default.
|
||||
Standard_EXPORT void ResetWorkingPlane();
|
||||
//! @return dimension special symbol display options.
|
||||
AIS_DisplaySpecialSymbol DisplaySpecialSymbol() const
|
||||
{
|
||||
return myDisplaySpecialSymbol;
|
||||
}
|
||||
|
||||
//! specifies dimension special symbol display options
|
||||
Standard_EXPORT void SetDisplaySpecialSymbol (const AIS_DisplaySpecialSymbol theDisplaySpecSymbol);
|
||||
//! Specifies whether to display special symbol or not.
|
||||
Standard_EXPORT void SetDisplaySpecialSymbol (const AIS_DisplaySpecialSymbol theDisplaySpecSymbol);
|
||||
|
||||
//! shows dimension special symbol display options
|
||||
Standard_EXPORT AIS_DisplaySpecialSymbol DisplaySpecialSymbol() const;
|
||||
//! @return special symbol.
|
||||
Standard_ExtCharacter SpecialSymbol() const
|
||||
{
|
||||
return mySpecialSymbol;
|
||||
}
|
||||
|
||||
//! specifies special symbol
|
||||
Standard_EXPORT void SetSpecialSymbol (const Standard_ExtCharacter theSpecialSymbol);
|
||||
//! Specifies special symbol.
|
||||
Standard_EXPORT void SetSpecialSymbol (const Standard_ExtCharacter theSpecialSymbol);
|
||||
|
||||
//! returns special symbol
|
||||
Standard_EXPORT Standard_ExtCharacter SpecialSymbol() const;
|
||||
Standard_EXPORT virtual const TCollection_AsciiString& GetDisplayUnits() const;
|
||||
|
||||
//! shows if Units are to be displayed along with dimension value
|
||||
Standard_EXPORT Standard_Boolean IsUnitsDisplayed() const;
|
||||
Standard_EXPORT virtual const TCollection_AsciiString& GetModelUnits() const;
|
||||
|
||||
//! sets to display units along with the dimension value or no
|
||||
Standard_EXPORT void MakeUnitsDisplayed (const Standard_Boolean toDisplayUnits);
|
||||
Standard_EXPORT virtual void SetDisplayUnits (const TCollection_AsciiString& /*theUnits*/) { }
|
||||
|
||||
//! returns the current type of units
|
||||
Standard_EXPORT TCollection_AsciiString UnitsQuantity() const;
|
||||
Standard_EXPORT virtual void SetModelUnits (const TCollection_AsciiString& /*theUnits*/) { }
|
||||
|
||||
//! sets the current type of units
|
||||
Standard_EXPORT void SetUnitsQuantity (const TCollection_AsciiString& theUnitsQuantity);
|
||||
public:
|
||||
|
||||
//! returns the current model units
|
||||
Standard_EXPORT TCollection_AsciiString ModelUnits() const;
|
||||
|
||||
//! sets the current model units
|
||||
Standard_EXPORT void SetModelUnits (const TCollection_AsciiString& theUnits);
|
||||
|
||||
//! returns the current display units
|
||||
Standard_EXPORT TCollection_AsciiString DisplayUnits() const;
|
||||
|
||||
//! sets the current display units
|
||||
Standard_EXPORT void SetDisplayUnits (const TCollection_AsciiString& theUnits);
|
||||
|
||||
//! Important! Only for 3d text </br>
|
||||
//! 3d text is oriented relative to the attachment points order </br>
|
||||
//! By default, text direction vector is oriented from the first attachment point </br>
|
||||
//! to the second one. This method checks if text direction is to be default or </br>
|
||||
//! should be reversed.
|
||||
Standard_EXPORT Standard_Boolean IsTextReversed() const;
|
||||
|
||||
//! Important! Only for 3d text
|
||||
//! 3d text is oriented relative to the attachment points order </br>
|
||||
//! By default, text direction vector is oriented from the first attachment point </br>
|
||||
//! to the second one. This method sets value that shows if text direction </br>
|
||||
//! should be reversed or not.
|
||||
Standard_EXPORT void MakeTextReversed (const Standard_Boolean isTextReversed);
|
||||
//! Returns selection tolerance for text2d:
|
||||
//! For 2d text selection detection sensitive point with tolerance is used
|
||||
//! Important! Only for 2d text.
|
||||
Standard_Real SelToleranceForText2d() const
|
||||
{
|
||||
return mySelToleranceForText2d;
|
||||
}
|
||||
|
||||
//! Sets selection tolerance for text2d:
|
||||
//! For 2d text selection detection sensitive point with tolerance is used
|
||||
//! to change this tolerance use this method
|
||||
//! Important! Only for 2d text
|
||||
Standard_EXPORT void SetSelToleranceForText2d (const Standard_Real theTol);
|
||||
//! Important! Only for 2d text.
|
||||
Standard_EXPORT void SetSelToleranceForText2d (const Standard_Real theTol);
|
||||
|
||||
//! Returns selection tolerance for text2d:
|
||||
//! For 2d text selection detection sensitive point with tolerance is used
|
||||
//! Important! Only for 2d text
|
||||
Standard_EXPORT Standard_Real SelToleranceForText2d() const;
|
||||
|
||||
//! Sets flyout size for dimension.
|
||||
Standard_EXPORT void SetFlyout (const Standard_Real theFlyout);
|
||||
|
||||
//! @return flyout size for dimension.
|
||||
//! @return flyout value for dimension.
|
||||
Standard_Real GetFlyout() const
|
||||
{
|
||||
return myFlyout;
|
||||
}
|
||||
|
||||
//! Sets flyout value for dimension.
|
||||
Standard_EXPORT void SetFlyout (const Standard_Real theFlyout);
|
||||
|
||||
//! Check that the input geometry for dimension is valid and the
|
||||
//! presentation can be succesfully computed.
|
||||
//! @return TRUE if dimension geometry is ok.
|
||||
Standard_Boolean IsValid() const
|
||||
{
|
||||
return myIsValid;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI(AIS_Dimension)
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT void getTextWidthAndString (Quantity_Length& theWidth,
|
||||
TCollection_ExtendedString& theString) const;
|
||||
Standard_EXPORT Standard_Real ValueToDisplayUnits() const;
|
||||
|
||||
Standard_EXPORT Standard_Real valueToDisplayUnits();
|
||||
|
||||
//! Reset working plane to default.
|
||||
Standard_EXPORT void resetWorkingPlane (const gp_Pln& theNewDefaultPlane);
|
||||
|
||||
//! Count default plane
|
||||
Standard_EXPORT virtual void countDefaultPlane();
|
||||
|
||||
//! Computes dimension value in display units
|
||||
Standard_EXPORT virtual void computeValue();
|
||||
//! Get formatted value string and its model space width.
|
||||
//! @param theWidth [out] the model space with of the string.
|
||||
//! @return formatted dimension value string.
|
||||
Standard_EXPORT TCollection_ExtendedString GetValueString (Standard_Real& theWidth) const;
|
||||
|
||||
//! Performs drawing of 2d or 3d arrows on the working plane
|
||||
Standard_EXPORT void drawArrow (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
//! @param theLocation [in] the location of the arrow tip.
|
||||
//! @param theDirection [in] the direction from the tip to the bottom of the arrow.
|
||||
Standard_EXPORT void DrawArrow (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const gp_Pnt& theLocation,
|
||||
const gp_Dir& theDirection);
|
||||
|
||||
//! Performs drawing of 2d or 3d text on the working plane
|
||||
//! @param theTextPos [in] the position of the text label.
|
||||
//! @param theTestDir [in] the direction of the text label.
|
||||
//! @param theText [in] the text label string.
|
||||
//! @param theLabelPosition [in] the text label vertical and horizontal positioning option
|
||||
//! respectively to the main dimension line.
|
||||
//! @return text width relative to the dimension working plane. For 2d text this value will be zero.
|
||||
Standard_EXPORT void drawText (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
Standard_EXPORT void DrawText (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const gp_Pnt& theTextPos,
|
||||
const gp_Dir& theTextDir,
|
||||
const TCollection_ExtendedString& theText,
|
||||
@ -247,7 +374,7 @@ protected:
|
||||
//! @param theLabelWidth [in] the geometrical width computed for value string.
|
||||
//! @param theMode [in] the display mode.
|
||||
//! @param theLabelPosition [in] position flags for the text label.
|
||||
Standard_EXPORT void drawExtension (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
Standard_EXPORT void DrawExtension (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Real theExtensionSize,
|
||||
const gp_Pnt& theExtensionStart,
|
||||
const gp_Dir& theExtensionDir,
|
||||
@ -256,32 +383,81 @@ protected:
|
||||
const Standard_Integer theMode,
|
||||
const Standard_Integer theLabelPosition);
|
||||
|
||||
//! Performs computing of linear dimension (for length, diameter, radius and so on)
|
||||
Standard_EXPORT void drawLinearDimension (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
//! Performs computing of linear dimension (for length, diameter, radius and so on).
|
||||
//! Please note that this method uses base dimension properties, like working plane
|
||||
//! flyout length, drawer attributes.
|
||||
//! @param thePresentation [in] the presentation to fill with primitives.
|
||||
//! @param theMode [in] the presentation compute mode.
|
||||
//! @param theFirstPoint [in] the first attach point of linear dimension.
|
||||
//! @param theSecondPoint [in] the second attach point of linear dimension.
|
||||
//! @param theIsOneSide [in] specifies whether the dimension has only one flyout line.
|
||||
Standard_EXPORT void DrawLinearDimension (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode,
|
||||
const Standard_Boolean isOneSideDimension = Standard_False);
|
||||
const gp_Pnt& theFirstPoint,
|
||||
const gp_Pnt& theSecondPoint,
|
||||
const Standard_Boolean theIsOneSide = Standard_False);
|
||||
|
||||
//! If it's possible computes circle from planar face
|
||||
Standard_EXPORT Standard_Boolean circleFromPlanarFace (const TopoDS_Face& theFace,
|
||||
//! Compute selection sensitives for linear dimension flyout lines (length, diameter, radius).
|
||||
//! Please note that this method uses base dimension properties: working plane and flyout length.
|
||||
//! @param theSelection [in] the selection structure to fill with selection primitives.
|
||||
//! @param theOwner [in] the selection entity owner.
|
||||
//! @param theFirstPoint [in] the first attach point of linear dimension.
|
||||
//! @param theSecondPoint [in] the second attach point of linear dimension.
|
||||
Standard_EXPORT void ComputeLinearFlyouts (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner,
|
||||
const gp_Pnt& theFirstPoint,
|
||||
const gp_Pnt& theSecondPoint);
|
||||
|
||||
//! If it is possible extracts circle from planar face.
|
||||
//! @param theFace [in] the planar face.
|
||||
//! @param theCurve [out] the circular curve.
|
||||
//! @param theFirstPoint [out] the point of the first parameter of the circlular curve.
|
||||
//! @param theSecondPoint [out] the point of the last parameter of the circlular curve.
|
||||
//! @return TRUE in case of successful circle extraction.
|
||||
Standard_EXPORT Standard_Boolean CircleFromPlanarFace (const TopoDS_Face& theFace,
|
||||
Handle(Geom_Curve)& theCurve,
|
||||
gp_Pnt & theFirstPoint,
|
||||
gp_Pnt & theLastPoint);
|
||||
gp_Pnt& theFirstPoint,
|
||||
gp_Pnt& theLastPoint);
|
||||
|
||||
//! Performs initialization of circle and points from given shape
|
||||
//! (for radius, diameter and so on)
|
||||
Standard_EXPORT Standard_Boolean initCircularDimension (const TopoDS_Shape& theShape,
|
||||
gp_Circ& theCircle,
|
||||
gp_Pnt& theMiddleArcPoint,
|
||||
gp_Pnt& theOppositeDiameterPoint);
|
||||
Standard_EXPORT Standard_Boolean isComputed() const;
|
||||
//! Performs initialization of circle and middle arc point from the passed
|
||||
//! shape which is assumed to contain circular geometry.
|
||||
//! @param theShape [in] the shape to explore.
|
||||
//! @param theCircle [out] the circle geometry.
|
||||
//! @param theMiddleArcPoint [out] the middle point of the arc.
|
||||
//! @param theIsClosed [out] returns TRUE if the geometry is closed circle.
|
||||
//! @return TRUE if the the circle is successfully got from the input shape.
|
||||
Standard_EXPORT Standard_Boolean InitCircularDimension (const TopoDS_Shape& theShape,
|
||||
gp_Circ& theCircle,
|
||||
gp_Pnt& theMiddleArcPoint,
|
||||
Standard_Boolean& theIsClosed);
|
||||
|
||||
Standard_EXPORT void setComputed (Standard_Boolean isComputed);
|
||||
protected: //! @name Behavior to implement
|
||||
|
||||
Standard_EXPORT void resetGeom();
|
||||
//! Override this method to compute automatically dimension plane
|
||||
//! in which the dimension presentation is built.
|
||||
virtual void ComputePlane() { }
|
||||
|
||||
//! Fills sensitive entity for flyouts and adds it to the selection.
|
||||
Standard_EXPORT virtual void computeFlyoutSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Handle(SelectMgr_EntityOwner)& theOwner);
|
||||
//! Override this method to check if user-defined plane
|
||||
//! is valid for the dimension geometry.
|
||||
//! @param thePlane [in] the working plane for positioning every
|
||||
//! dimension in the application.
|
||||
//! @return true is the plane is suitable for building dimension
|
||||
//! with computed dimension geometry.
|
||||
virtual Standard_Boolean CheckPlane (const gp_Pln& /*thePlane*/) const { return Standard_True; }
|
||||
|
||||
//! Override this method to computed value of dimension.
|
||||
//! @return value from the measured geometry.
|
||||
virtual Standard_Real ComputeValue() const
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
//! Override this method to compute selection primitives for
|
||||
//! flyout lines (if the dimension provides it).
|
||||
//! This callback is a only a part of base selection
|
||||
//! computation routine.
|
||||
virtual void ComputeFlyoutSelection (const Handle(SelectMgr_Selection)&,
|
||||
const Handle(SelectMgr_EntityOwner)&) {}
|
||||
|
||||
//! Produce points for triangular arrow face.
|
||||
//! @param thePeakPnt [in] the arrow peak position.
|
||||
@ -300,41 +476,11 @@ protected:
|
||||
gp_Pnt& theSidePnt1,
|
||||
gp_Pnt& theSidePnt2);
|
||||
|
||||
protected: //! @name Working plane properties
|
||||
|
||||
//! Dimension default plane
|
||||
gp_Pln myDefaultPlane;
|
||||
|
||||
//! Shows if working plane is set custom
|
||||
Standard_Boolean myIsWorkingPlaneCustom;
|
||||
|
||||
protected: //! @name Value properties
|
||||
|
||||
//! Dimension value which is displayed with dimension lines
|
||||
Standard_Real myValue;
|
||||
|
||||
//! Shows if the value is set by user and is no need to count it automatically
|
||||
Standard_Boolean myIsValueCustom;
|
||||
|
||||
protected: // !@name Units properties
|
||||
|
||||
//! The quantity of units for the value computation
|
||||
TCollection_AsciiString myUnitsQuantity;
|
||||
|
||||
//! Units of the model
|
||||
TCollection_AsciiString myModelUnits;
|
||||
|
||||
//! Units in which the displayed value will be converted
|
||||
TCollection_AsciiString myDisplayUnits;
|
||||
|
||||
//! Determines if units is to be displayed along with the value
|
||||
Standard_Boolean myToDisplayUnits;
|
||||
|
||||
//! Special symbol for some kind of dimensions (for diameter, radius and so on)
|
||||
Standard_ExtCharacter mySpecialSymbol;
|
||||
|
||||
//! Special symbol display options
|
||||
AIS_DisplaySpecialSymbol myDisplaySpecialSymbol;
|
||||
//! Base procedure of computing selection (based on selection geometry data).
|
||||
//! @param theSelection [in] the selection structure to will with primitives.
|
||||
//! @param theMode [in] the selection mode.
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode);
|
||||
|
||||
protected: //! @name Selection geometry
|
||||
|
||||
@ -403,43 +549,28 @@ protected: //! @name Selection geometry
|
||||
Standard_Real mySelToleranceForText2d; //!< Sensitive point tolerance for 2d text selection.
|
||||
Standard_Boolean myIsComputed; //!< Shows if the presentation and selection was computed.
|
||||
|
||||
protected:
|
||||
protected: //! @name Value properties
|
||||
|
||||
//! Shows if text is inverted
|
||||
Standard_Boolean myIsTextReversed;
|
||||
Standard_Real myCustomValue; //!< Value of the dimension (computed or user-defined).
|
||||
Standard_Boolean myIsValueCustom; //!< Is user-defined value.
|
||||
|
||||
//! Points that are base for dimension.
|
||||
//! My first point of dimension attach (belongs to shape for which dimension is computed)
|
||||
gp_Pnt myFirstPoint;
|
||||
protected: //! @name Units properties
|
||||
|
||||
//! My second point of dimension attach (belongs to shape for which dimension is computed)
|
||||
gp_Pnt mySecondPoint;
|
||||
Standard_ExtCharacter mySpecialSymbol; //!< Special symbol.
|
||||
AIS_DisplaySpecialSymbol myDisplaySpecialSymbol; //!< Special symbol display options.
|
||||
|
||||
//! Shows if attach points are initialized correctly
|
||||
Standard_Boolean myIsInitialized;
|
||||
protected: //! @name Geometrical properties
|
||||
|
||||
//! First shape (can be vertex, edge or face)
|
||||
TopoDS_Shape myFirstShape;
|
||||
GeometryType myGeometryType; //!< defines type of shapes on which the dimension is to be built.
|
||||
|
||||
//! Second shape (can be vertex, edge or face)
|
||||
TopoDS_Shape mySecondShape;
|
||||
|
||||
//! Number of shapes
|
||||
Standard_Integer myShapesNumber;
|
||||
|
||||
//! Defines flyout lines and direction
|
||||
//! Flyout direction in the working plane.
|
||||
//! Can be negative, or positive and is defined by the sign of myFlyout value.
|
||||
//! The direction vector is counting using the working plane.
|
||||
//! myFlyout value defined the size of flyout.
|
||||
Standard_Real myFlyout;
|
||||
gp_Pln myPlane; //!< Plane where dimension will be built (computed or user defined).
|
||||
Standard_Boolean myIsPlaneCustom; //!< Is plane defined by user (otherwise it will be computed automatically).
|
||||
Standard_Real myFlyout; //!< Flyout distance.
|
||||
Standard_Boolean myIsValid; //!< Is dimension geometry properly defined.
|
||||
|
||||
private:
|
||||
|
||||
//! Type of dimension
|
||||
AIS_KindOfDimension myKindOfDimension;
|
||||
|
||||
//! Dimension working plane, is equal to <myDefaultPlane> if it can be computed automatically.
|
||||
gp_Pln myWorkingPlane;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // _AIS_Dimension_HeaderFile
|
||||
|
@ -64,7 +64,10 @@ uses
|
||||
NameOfColor from Quantity,
|
||||
PlaneAngle from Quantity,
|
||||
Length from Quantity,
|
||||
TypeOfHLR from Prs3d
|
||||
DimensionUnits from Prs3d,
|
||||
AsciiString from TCollection,
|
||||
TypeOfHLR from Prs3d,
|
||||
Ax2 from gp
|
||||
|
||||
is
|
||||
Create returns mutable Drawer from AIS;
|
||||
@ -542,16 +545,42 @@ is
|
||||
-- Attributes for the presentation of a dimensions.
|
||||
--
|
||||
|
||||
DimensionAspect(me:mutable) returns mutable DimensionAspect from Prs3d
|
||||
DimensionAspect (me : mutable) returns mutable DimensionAspect from Prs3d is redefined static;
|
||||
---Purpose: Returns a link with Prs3d_Drawer_DimensionAspect,
|
||||
-- which provides settings for the appearance of dimensions.
|
||||
is redefined static;
|
||||
-- which provides settings for the appearance of dimensions.
|
||||
|
||||
HasDimensionAspect (me) returns Boolean from Standard is static;
|
||||
---C++: inline
|
||||
-- Purpose: Returns true if the Drawer has a dimension aspect setting active.
|
||||
|
||||
SetDimLengthModelUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static;
|
||||
---Purpose: Sets dimension length model units for computing of dimension presentation.
|
||||
|
||||
SetDimAngleModelUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static;
|
||||
---Purpose: Sets dimension angle model units for computing of dimension presentation.
|
||||
|
||||
DimAngleModelUnits (me) returns AsciiString from TCollection is redefined static;
|
||||
---Purpose: Returns angle model units for the dimension presentation.
|
||||
---C++: return const &
|
||||
|
||||
DimLengthModelUnits (me) returns AsciiString from TCollection is redefined static;
|
||||
---Purpose: Returns length model units for the dimension presentation.
|
||||
---C++: return const &
|
||||
|
||||
SetDimLengthDisplayUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static;
|
||||
---Purpose: Sets length units in which value for dimension presentation is displayed.
|
||||
|
||||
SetDimAngleDisplayUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static;
|
||||
---Purpose: Sets angle units in which value for dimension presentation is displayed.
|
||||
|
||||
DimLengthDisplayUnits (me) returns AsciiString from TCollection is redefined static;
|
||||
---Purpose: Returns length units in which dimension presentation is displayed.
|
||||
---C++: return const &
|
||||
|
||||
DimAngleDisplayUnits (me) returns AsciiString from TCollection is redefined static;
|
||||
---Purpose: Returns angle units in which dimension presentation is displayed.
|
||||
---C++: return const &
|
||||
|
||||
HasDimensionAspect (me) returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: Returns true if the Drawer has a dimension aspect setting active.
|
||||
is static;
|
||||
|
||||
-- Attributes for the sections
|
||||
|
||||
SectionAspect (me:mutable) returns mutable LineAspect from Prs3d
|
||||
@ -593,25 +622,32 @@ is
|
||||
-- for Interactive Objects.
|
||||
|
||||
fields
|
||||
|
||||
myLink : Drawer from Prs3d;
|
||||
hasLocalAttributes : Boolean from Standard;
|
||||
|
||||
|
||||
myhasOwnDeviationCoefficient : Boolean from Standard;
|
||||
myOwnDeviationCoefficient : Real from Standard;
|
||||
myPreviousDeviationCoefficient : Real from Standard;
|
||||
|
||||
|
||||
myhasOwnHLRDeviationCoefficient : Boolean from Standard;
|
||||
myOwnHLRDeviationCoefficient : Real from Standard;
|
||||
myPreviousHLRDeviationCoefficient: Real from Standard;
|
||||
|
||||
|
||||
myhasOwnDeviationAngle : Boolean from Standard;
|
||||
myOwnDeviationAngle : Real from Standard;
|
||||
myPreviousDeviationAngle : Real from Standard;
|
||||
|
||||
|
||||
myhasOwnHLRDeviationAngle : Boolean from Standard;
|
||||
myOwnHLRDeviationAngle : Real from Standard;
|
||||
myPreviousHLRDeviationAngle : Real from Standard;
|
||||
myHasOwnFaceBoundaryDraw : Boolean from Standard;
|
||||
|
||||
myHasOwnDimLengthModelUnits : Boolean from Standard;
|
||||
myHasOwnDimLengthDisplayUnits : Boolean from Standard;
|
||||
myHasOwnDimAngleModelUnits : Boolean from Standard;
|
||||
myHasOwnDimAngleDisplayUnits : Boolean from Standard;
|
||||
|
||||
end Drawer;
|
||||
|
||||
|
||||
|
@ -19,21 +19,24 @@
|
||||
#include <AIS_Drawer.ixx>
|
||||
#include <Standard_ProgramError.hxx>
|
||||
|
||||
AIS_Drawer::AIS_Drawer():
|
||||
myLink(new Prs3d_Drawer()),
|
||||
hasLocalAttributes(Standard_False),
|
||||
myhasOwnDeviationCoefficient(Standard_False),
|
||||
myPreviousDeviationCoefficient(0.1),
|
||||
myhasOwnHLRDeviationCoefficient (Standard_False),
|
||||
myhasOwnDeviationAngle (Standard_False),
|
||||
myhasOwnHLRDeviationAngle (Standard_False),
|
||||
myHasOwnFaceBoundaryDraw (Standard_False)
|
||||
// =======================================================================
|
||||
// function : AIS_Drawer
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
AIS_Drawer::AIS_Drawer()
|
||||
: myLink (new Prs3d_Drawer()),
|
||||
hasLocalAttributes (Standard_False),
|
||||
myhasOwnDeviationCoefficient (Standard_False),
|
||||
myPreviousDeviationCoefficient (0.1),
|
||||
myhasOwnHLRDeviationCoefficient (Standard_False),
|
||||
myhasOwnDeviationAngle (Standard_False),
|
||||
myhasOwnHLRDeviationAngle (Standard_False),
|
||||
myHasOwnFaceBoundaryDraw (Standard_False)
|
||||
{
|
||||
SetMaximalParameterValue(500000.);
|
||||
myLink->SetMaximalParameterValue(500000.);
|
||||
SetMaximalParameterValue (500000.0);
|
||||
myLink->SetMaximalParameterValue (500000.0);
|
||||
SetTypeOfHLR (Prs3d_TOH_NotSet);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Aspect_TypeOfDeflection AIS_Drawer::TypeOfDeflection () const
|
||||
{
|
||||
@ -216,8 +219,97 @@ Handle (Prs3d_DatumAspect) AIS_Drawer::DatumAspect ()
|
||||
Handle (Prs3d_PlaneAspect) AIS_Drawer::PlaneAspect ()
|
||||
{return myPlaneAspect.IsNull() ? myLink->PlaneAspect (): myPlaneAspect;}
|
||||
|
||||
Handle (Prs3d_DimensionAspect) AIS_Drawer::DimensionAspect ()
|
||||
{return myDimensionAspect.IsNull()? myLink->DimensionAspect () : myDimensionAspect ;}
|
||||
// =======================================================================
|
||||
// function : DimensionAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle (Prs3d_DimensionAspect) AIS_Drawer::DimensionAspect()
|
||||
{
|
||||
return myDimensionAspect.IsNull()? myLink->DimensionAspect () : myDimensionAspect;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DimAngleModelUnits
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const TCollection_AsciiString& AIS_Drawer::DimAngleModelUnits() const
|
||||
{
|
||||
return myHasOwnDimAngleModelUnits
|
||||
? Prs3d_Drawer::DimAngleModelUnits()
|
||||
: myLink->DimAngleModelUnits();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DimensionModelUnits
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const TCollection_AsciiString& AIS_Drawer::DimLengthModelUnits() const
|
||||
{
|
||||
return myHasOwnDimLengthModelUnits
|
||||
? Prs3d_Drawer::DimLengthModelUnits()
|
||||
: myLink->DimLengthModelUnits();
|
||||
}
|
||||
// =======================================================================
|
||||
// function : SetDimLengthModelUnits
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void AIS_Drawer::SetDimLengthModelUnits (const TCollection_AsciiString& theUnits)
|
||||
{
|
||||
myHasOwnDimLengthModelUnits = Standard_True;
|
||||
Prs3d_Drawer::SetDimLengthDisplayUnits (theUnits);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetDimAngleModelUnits
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void AIS_Drawer::SetDimAngleModelUnits (const TCollection_AsciiString& theUnits)
|
||||
{
|
||||
myHasOwnDimAngleModelUnits = Standard_True;
|
||||
Prs3d_Drawer::SetDimAngleDisplayUnits (theUnits);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DimAngleDisplayUnits
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const TCollection_AsciiString& AIS_Drawer::DimAngleDisplayUnits() const
|
||||
{
|
||||
return myHasOwnDimAngleDisplayUnits
|
||||
? Prs3d_Drawer::DimAngleDisplayUnits()
|
||||
: myLink->DimAngleDisplayUnits();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DimLengthDisplayUnits
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const TCollection_AsciiString& AIS_Drawer::DimLengthDisplayUnits() const
|
||||
{
|
||||
return myHasOwnDimLengthDisplayUnits
|
||||
? Prs3d_Drawer::DimLengthDisplayUnits()
|
||||
: myLink->DimLengthDisplayUnits();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetDimLengthDisplayUnits
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void AIS_Drawer::SetDimLengthDisplayUnits (const TCollection_AsciiString& theUnits)
|
||||
{
|
||||
myHasOwnDimLengthDisplayUnits = Standard_True;
|
||||
Prs3d_Drawer::SetDimLengthDisplayUnits (theUnits);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetDimAngleDisplayUnits
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void AIS_Drawer::SetDimAngleDisplayUnits (const TCollection_AsciiString& theUnits)
|
||||
{
|
||||
myHasOwnDimAngleDisplayUnits = Standard_True;
|
||||
Prs3d_Drawer::SetDimAngleDisplayUnits (theUnits);
|
||||
}
|
||||
|
||||
Handle (Prs3d_LineAspect) AIS_Drawer::SectionAspect ()
|
||||
{return mySectionAspect.IsNull()? myLink->SectionAspect (): mySectionAspect;}
|
||||
@ -256,6 +348,10 @@ void AIS_Drawer::ClearLocalAttributes()
|
||||
if (!myFaceBoundaryAspect.IsNull()) myFaceBoundaryAspect.Nullify();
|
||||
|
||||
myHasOwnFaceBoundaryDraw = Standard_False;
|
||||
myHasOwnDimLengthModelUnits = Standard_False;
|
||||
myHasOwnDimLengthDisplayUnits = Standard_False;
|
||||
myHasOwnDimAngleModelUnits = Standard_False;
|
||||
myHasOwnDimAngleDisplayUnits = Standard_False;
|
||||
|
||||
hasLocalAttributes = Standard_False;
|
||||
|
||||
|
@ -104,5 +104,7 @@ inline Prs3d_TypeOfHLR AIS_Drawer::TypeOfHLR ( ) const
|
||||
return (myTypeOfHLR == Prs3d_TOH_NotSet) ? myLink->TypeOfHLR() : myTypeOfHLR;
|
||||
}
|
||||
|
||||
inline Standard_Boolean AIS_Drawer::HasDimensionAspect () const
|
||||
{ return !myDimensionAspect.IsNull();}
|
||||
inline Standard_Boolean AIS_Drawer::HasDimensionAspect() const
|
||||
{
|
||||
return !myDimensionAspect.IsNull();
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -58,69 +58,217 @@ class Handle(Standard_Type);
|
||||
class Handle(AIS_Relation);
|
||||
class AIS_LengthDimension;
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_LengthDimension,AIS_Dimension)
|
||||
DEFINE_STANDARD_HANDLE (AIS_LengthDimension, AIS_Dimension)
|
||||
|
||||
//! A dimension to display lengths. <br>
|
||||
//! These can be lengths along a face or edge, or <br>
|
||||
//! between two faces or two edges.
|
||||
//! Length dimension. Can be constructued:
|
||||
//! - Between two generic points.
|
||||
//! - Between two vertices.
|
||||
//! - Between two faces.
|
||||
//! - Between two parallel edges.
|
||||
//! - Between face and edge.
|
||||
//!
|
||||
//! In case of two points (vertices) or one linear edge the user-defined plane
|
||||
//! that includes this geometry is necessary to be set.
|
||||
//!
|
||||
//! In case of face-edge, edge-vertex or face-face lengthes the automatic plane
|
||||
//! computing is allowed. For this plane the third point is found on the
|
||||
//! edge or on the face.
|
||||
//!
|
||||
//! Please note that if the inappropriate geometry is defined
|
||||
//! or the distance between measured points is less than
|
||||
//! Precision::Confusion(), the dimension is invalid and its
|
||||
//! presentation can not be computed.
|
||||
class AIS_LengthDimension : public AIS_Dimension
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT AIS_LengthDimension (const gp_Pnt& theFirstPoint,
|
||||
const gp_Pnt& theSecondPoint,
|
||||
const gp_Pln& theDimensionPlane);
|
||||
|
||||
//! Constructs a length dimension between two shapes(vertices, edges, shapes) with custom working plane
|
||||
Standard_EXPORT AIS_LengthDimension (const TopoDS_Shape& theFirstShape,
|
||||
const TopoDS_Shape& theSecondShape,
|
||||
const gp_Pln& theWorkingPlane);
|
||||
|
||||
Standard_EXPORT AIS_LengthDimension (const TopoDS_Edge& theEdge,
|
||||
const gp_Pln& theWorkingPlane);
|
||||
|
||||
Standard_EXPORT AIS_LengthDimension (const TopoDS_Face& theFirstFace,
|
||||
const TopoDS_Face& theSecondFace);
|
||||
|
||||
//! Construct length dimension between face and edge.
|
||||
//! Here dimension can be built without user-defined plane.
|
||||
//! @param theFace [in] the face (first shape).
|
||||
//! @param theEdge [in] the edge (second shape).
|
||||
Standard_EXPORT AIS_LengthDimension (const TopoDS_Face& theFace,
|
||||
const TopoDS_Edge& theEdge);
|
||||
|
||||
public:
|
||||
|
||||
//! Construct length dimension between two faces.
|
||||
//! @param theFirstFace [in] the first face (first shape).
|
||||
//! @param theSecondFace [in] the second face (second shape).
|
||||
Standard_EXPORT AIS_LengthDimension (const TopoDS_Face& theFirstFace,
|
||||
const TopoDS_Face& theSecondFace);
|
||||
|
||||
//! Construct length dimension between two points in
|
||||
//! the specified plane.
|
||||
//! @param theFirstPoint [in] the first point.
|
||||
//! @param theSecondPoint [in] the second point.
|
||||
//! @param thePlane [in] the plane to orient dimension.
|
||||
Standard_EXPORT AIS_LengthDimension (const gp_Pnt& theFirstPoint,
|
||||
const gp_Pnt& theSecondPoint,
|
||||
const gp_Pln& thePlane);
|
||||
|
||||
//! Construct length dimension between two arbitrary shapes in
|
||||
//! the specified plane.
|
||||
//! @param theFirstShape [in] the first shape.
|
||||
//! @param theSecondShape [in] the second shape.
|
||||
//! @param thePlane [in] the plane to orient dimension.
|
||||
Standard_EXPORT AIS_LengthDimension (const TopoDS_Shape& theFirstShape,
|
||||
const TopoDS_Shape& theSecondShape,
|
||||
const gp_Pln& thePlane);
|
||||
|
||||
//! Construct length dimension of linear edge.
|
||||
//! @param theEdge [in] the edge to measure.
|
||||
//! @param thePlane [in] the plane to orient dimension.
|
||||
Standard_EXPORT AIS_LengthDimension (const TopoDS_Edge& theEdge,
|
||||
const gp_Pln& thePlane);
|
||||
|
||||
public:
|
||||
|
||||
//! @return first attachement point.
|
||||
const gp_Pnt& FirstPoint() const
|
||||
{
|
||||
return myFirstPoint;
|
||||
}
|
||||
|
||||
//! @return second attachement point.
|
||||
const gp_Pnt& SecondPoint() const
|
||||
{
|
||||
return mySecondPoint;
|
||||
}
|
||||
|
||||
//! @return first attachement shape.
|
||||
const TopoDS_Shape& FirstShape() const
|
||||
{
|
||||
return myFirstShape;
|
||||
}
|
||||
|
||||
//! @return second attachement shape.
|
||||
const TopoDS_Shape& SecondShape() const
|
||||
{
|
||||
return mySecondShape;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Measure distance between two points.
|
||||
//! The dimension will become invalid if the new distance between
|
||||
//! attachement points is less than Precision::Confusion().
|
||||
//! @param theFirstPoint [in] the first point.
|
||||
//! @param theSecondPoint [in] the second point.
|
||||
//! @param thePlane [in] the user-defined plane
|
||||
Standard_EXPORT void SetMeasuredGeometry (const gp_Pnt& theFirstPoint,
|
||||
const gp_Pnt& theSecondPoint,
|
||||
const gp_Pln& thePlane);
|
||||
|
||||
//! Measure length of edge.
|
||||
//! The dimension will become invalid if the new length of edge
|
||||
//! is less than Precision::Confusion().
|
||||
//! @param theEdge [in] the edge to measure.
|
||||
//! @param thePlane [in] the user-defined plane
|
||||
Standard_EXPORT void SetMeasuredGeometry (const TopoDS_Edge& theEdge,
|
||||
const gp_Pln& thePlane);
|
||||
|
||||
//! Measure distance between two faces.
|
||||
//! The dimension will become invalid if the distance can not
|
||||
//! be measured or it is less than Precision::Confusion().
|
||||
//! @param theFirstFace [in] the first face (first shape).
|
||||
//! @param theSecondFace [in] the second face (second shape).
|
||||
Standard_EXPORT void SetMeasuredGeometry (const TopoDS_Face& theFirstFace,
|
||||
const TopoDS_Face& theSecondFace);
|
||||
|
||||
//! Measure distance between face and edge.
|
||||
//! The dimension will become invalid if the distance can not
|
||||
//! be measured or it is less than Precision::Confusion().
|
||||
//! @param theFace [in] the face (first shape).
|
||||
//! @param theEdge [in] the edge (second shape).
|
||||
Standard_EXPORT void SetMeasuredGeometry (const TopoDS_Face& theFace,
|
||||
const TopoDS_Edge& theEdge);
|
||||
|
||||
//! Measure distance between generic pair of shapes (edges, vertices, length),
|
||||
//! where measuring is applicable.
|
||||
//! @param theFirstShape [in] the first shape.
|
||||
//! @param theSecondShape [in] the second shape.
|
||||
Standard_EXPORT void SetMeasuredShapes (const TopoDS_Shape& theFirstShape,
|
||||
const TopoDS_Shape& theSecondShape);
|
||||
|
||||
//! @return the display units string.
|
||||
Standard_EXPORT virtual const TCollection_AsciiString& GetDisplayUnits () const;
|
||||
|
||||
//! @return the model units string.
|
||||
Standard_EXPORT virtual const TCollection_AsciiString& GetModelUnits () const;
|
||||
|
||||
Standard_EXPORT virtual void SetDisplayUnits (const TCollection_AsciiString& theUnits);
|
||||
|
||||
Standard_EXPORT virtual void SetModelUnits (const TCollection_AsciiString& theUnits);
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI(AIS_LengthDimension)
|
||||
|
||||
protected:
|
||||
|
||||
//! Checks if the plane includes first and second points to build dimension.
|
||||
Standard_EXPORT virtual Standard_Boolean CheckPlane (const gp_Pln& thePlane) const;
|
||||
|
||||
Standard_EXPORT virtual gp_Pln ComputePlane(const gp_Dir& theAttachDir) const;
|
||||
|
||||
Standard_EXPORT Standard_Real ComputeValue() const;
|
||||
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode = 0);
|
||||
|
||||
Standard_EXPORT virtual void ComputeFlyoutSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Handle(SelectMgr_EntityOwner)& theEntityOwner);
|
||||
|
||||
protected:
|
||||
|
||||
//! Checks that distance between two points is valid.
|
||||
//! @param theFirstPoint [in] the first point.
|
||||
//! @param theSecondPoint [in] the second point.
|
||||
Standard_EXPORT Standard_Boolean IsValidPoints (const gp_Pnt& theFirstPoint,
|
||||
const gp_Pnt& theSecondPoint) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean InitTwoEdgesLength (const TopoDS_Edge & theFirstEdge,
|
||||
const TopoDS_Edge& theSecondEdge,
|
||||
gp_Dir& theEdgeDir);
|
||||
|
||||
//! Auxiliary method for InitTwoShapesPoints()
|
||||
//! in case of the distance between edge and vertex.
|
||||
//! Finds the point on the edge that is the closest one to <theVertex>.
|
||||
//! @param theEdgeDir [out] is the direction on the edge to build
|
||||
//! automatical plane.
|
||||
Standard_EXPORT Standard_Boolean InitEdgeVertexLength (const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Vertex& theVertex,
|
||||
gp_Dir& theEdgeDir,
|
||||
Standard_Boolean isInfinite);
|
||||
|
||||
//! Auxiliary method for InitTwoShapesPoints()
|
||||
//! in case of the distance between face and edge.
|
||||
//! The first attachment point is first parameter point from <theEdge>.
|
||||
//! Find the second attachment point which belongs to <theFace>
|
||||
//! Iterate over the edges of the face and find the closest point according
|
||||
//! to finded point on edge.
|
||||
//! @param theEdgeDir [out] is the direction on the edge to build
|
||||
//! automatical plane.
|
||||
Standard_EXPORT Standard_Boolean InitEdgeFaceLength (const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
gp_Dir& theEdgeDir);
|
||||
|
||||
//! Initialization of two attach points in case of two owner shapes.
|
||||
Standard_EXPORT Standard_Boolean InitTwoShapesPoints (const TopoDS_Shape& theFirstShape,
|
||||
const TopoDS_Shape& theSecondShape,
|
||||
gp_Pln& theComputedPlane,
|
||||
Standard_Boolean& theIsPlaneComputed);
|
||||
|
||||
//! Initialization of two attach points in case of one owner shape.
|
||||
Standard_EXPORT Standard_Boolean InitOneShapePoints (const TopoDS_Shape& theShape);
|
||||
|
||||
private:
|
||||
|
||||
Standard_Boolean initTwoEdgesLength (const TopoDS_Edge & theFirstEdge,
|
||||
const TopoDS_Edge& theSecondEdge,
|
||||
gp_Dir& theDirAttach);
|
||||
|
||||
//! Auxiliary method for <InitTwoShapesPoints()>
|
||||
//! in case of the distance between edge and vertex
|
||||
Standard_Boolean initEdgeVertexLength (const TopoDS_Edge & theEdge,
|
||||
const TopoDS_Vertex & theVertex,
|
||||
gp_Dir & theDirAttach,
|
||||
Standard_Boolean isInfinite);
|
||||
|
||||
//! Auxiliary method for <InitTwoShapesPoints()>
|
||||
//! in case of the distance between face and edge
|
||||
Standard_Boolean initEdgeFaceLength (const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
gp_Dir& theDirAttach);
|
||||
|
||||
//! Initialization of two attach points in case of two owner shapes
|
||||
Standard_Boolean initTwoShapesPoints (const TopoDS_Shape& theFirstShape,
|
||||
const TopoDS_Shape& theSecondShape);
|
||||
|
||||
//! Initialization of two attach points in case of one owner shape
|
||||
Standard_Boolean initOneShapePoints (const TopoDS_Shape& theShape);
|
||||
|
||||
//! Compute length in display units.
|
||||
virtual void computeValue();
|
||||
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode = 0) ;
|
||||
gp_Pnt myFirstPoint;
|
||||
gp_Pnt mySecondPoint;
|
||||
TopoDS_Shape myFirstShape;
|
||||
TopoDS_Shape mySecondShape;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // _AIS_LengthDimension_HeaderFile
|
||||
|
@ -21,32 +21,28 @@
|
||||
#include <AIS_RadiusDimension.hxx>
|
||||
|
||||
#include <AIS.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
#include <BRepLib_MakeEdge.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <gce_MakeDir.hxx>
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Prs3d_Root.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_HANDLE(AIS_RadiusDimension, AIS_Dimension)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_RadiusDimension, AIS_Dimension)
|
||||
IMPLEMENT_STANDARD_HANDLE (AIS_RadiusDimension, AIS_Dimension)
|
||||
IMPLEMENT_STANDARD_RTTIEXT (AIS_RadiusDimension, AIS_Dimension)
|
||||
|
||||
namespace
|
||||
{
|
||||
static const Standard_ExtCharacter THE_RADIUS_SYMBOL ('R');
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle)
|
||||
: AIS_Dimension(),
|
||||
myCircle (theCircle)
|
||||
: AIS_Dimension (AIS_KOD_RADIUS)
|
||||
{
|
||||
myFirstPoint = ElCLib::Value(0, myCircle);
|
||||
mySecondPoint = theCircle.Location();
|
||||
myIsInitialized = Standard_True;
|
||||
SetSpecialSymbol ('R');
|
||||
SetMeasuredGeometry (theCircle);
|
||||
SetSpecialSymbol (THE_RADIUS_SYMBOL);
|
||||
SetDisplaySpecialSymbol (AIS_DSS_Before);
|
||||
SetKindOfDimension (AIS_KOD_RADIUS);
|
||||
SetFlyout (0.0);
|
||||
}
|
||||
|
||||
@ -54,18 +50,13 @@ AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle)
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle,
|
||||
const gp_Pnt& theAttachPoint)
|
||||
: AIS_Dimension(),
|
||||
myCircle (theCircle)
|
||||
: AIS_Dimension (AIS_KOD_RADIUS)
|
||||
{
|
||||
myFirstPoint = theAttachPoint;
|
||||
mySecondPoint = theCircle.Location();
|
||||
myIsInitialized = Standard_True;
|
||||
SetSpecialSymbol ('R');
|
||||
SetMeasuredGeometry (theCircle, theAttachPoint);
|
||||
SetSpecialSymbol (THE_RADIUS_SYMBOL);
|
||||
SetDisplaySpecialSymbol (AIS_DSS_Before);
|
||||
SetKindOfDimension (AIS_KOD_RADIUS);
|
||||
SetFlyout (0.0);
|
||||
}
|
||||
|
||||
@ -73,23 +64,170 @@ AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle,
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_RadiusDimension::AIS_RadiusDimension (const TopoDS_Shape& theShape)
|
||||
: AIS_Dimension ()
|
||||
: AIS_Dimension (AIS_KOD_RADIUS)
|
||||
{
|
||||
myFirstShape = theShape;
|
||||
myIsInitialized = Standard_False;
|
||||
SetSpecialSymbol ('R');
|
||||
SetMeasuredGeometry (theShape);
|
||||
SetSpecialSymbol (THE_RADIUS_SYMBOL);
|
||||
SetDisplaySpecialSymbol (AIS_DSS_Before);
|
||||
SetKindOfDimension (AIS_KOD_RADIUS);
|
||||
SetFlyout (0.0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMeasuredGeometry
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_RadiusDimension::SetMeasuredGeometry (const gp_Circ& theCircle)
|
||||
{
|
||||
myCircle = theCircle;
|
||||
myGeometryType = GeometryType_Edge;
|
||||
myShape = BRepLib_MakeEdge (theCircle);
|
||||
myAnchorPoint = ElCLib::Value (0, myCircle);
|
||||
myIsValid = IsValidCircle (myCircle);
|
||||
|
||||
if (myIsValid)
|
||||
{
|
||||
ComputePlane();
|
||||
}
|
||||
|
||||
myIsValid &= CheckPlane (myPlane);
|
||||
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMeasuredGeometry
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_RadiusDimension::SetMeasuredGeometry (const gp_Circ& theCircle,
|
||||
const gp_Pnt& theAnchorPoint)
|
||||
{
|
||||
myCircle = theCircle;
|
||||
myGeometryType = GeometryType_Edge;
|
||||
myShape = BRepLib_MakeEdge (theCircle);
|
||||
myAnchorPoint = theAnchorPoint;
|
||||
myIsValid = IsValidCircle (myCircle) && IsValidAnchor (myCircle, theAnchorPoint);
|
||||
|
||||
if (myIsValid)
|
||||
{
|
||||
ComputePlane();
|
||||
}
|
||||
|
||||
myIsValid &= CheckPlane (myPlane);
|
||||
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMeasuredGeometry
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_RadiusDimension::SetMeasuredGeometry (const TopoDS_Shape& theShape)
|
||||
{
|
||||
Standard_Boolean isClosed = Standard_False;
|
||||
myShape = theShape;
|
||||
myGeometryType = GeometryType_UndefShapes;
|
||||
myIsValid = InitCircularDimension (theShape, myCircle, myAnchorPoint, isClosed)
|
||||
&& IsValidCircle (myCircle);
|
||||
|
||||
if (myIsValid)
|
||||
{
|
||||
ComputePlane();
|
||||
}
|
||||
|
||||
myIsValid &= CheckPlane (myPlane);
|
||||
|
||||
SetToUpdate();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckPlane
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean AIS_RadiusDimension::CheckPlane (const gp_Pln& thePlane) const
|
||||
{
|
||||
// Check if anchor point and circle center point belong to plane.
|
||||
if (!thePlane.Contains (myAnchorPoint, Precision::Confusion()) &&
|
||||
!thePlane.Contains (myCircle.Location(), Precision::Confusion()))
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputePlane
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_RadiusDimension::ComputePlane()
|
||||
{
|
||||
if (!IsValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gp_Dir aDimensionX = gce_MakeDir (myAnchorPoint, myCircle.Location());
|
||||
|
||||
myPlane = gp_Pln (gp_Ax3 (myCircle.Location(),
|
||||
myCircle.Axis().Direction(),
|
||||
aDimensionX));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetModelUnits
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TCollection_AsciiString& AIS_RadiusDimension::GetModelUnits() const
|
||||
{
|
||||
return myDrawer->DimLengthModelUnits();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetDisplayUnits
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TCollection_AsciiString& AIS_RadiusDimension::GetDisplayUnits() const
|
||||
{
|
||||
return myDrawer->DimLengthDisplayUnits();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetModelUnits
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_RadiusDimension::SetModelUnits (const TCollection_AsciiString& theUnits)
|
||||
{
|
||||
myDrawer->SetDimLengthModelUnits (theUnits);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDisplayUnits
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_RadiusDimension::SetDisplayUnits (const TCollection_AsciiString& theUnits)
|
||||
{
|
||||
myDrawer->SetDimLengthDisplayUnits(theUnits);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real AIS_RadiusDimension::ComputeValue() const
|
||||
{
|
||||
if (!IsValid())
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return myCircle.Radius();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_RadiusDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePM*/,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode)
|
||||
@ -97,52 +235,34 @@ void AIS_RadiusDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /
|
||||
thePresentation->Clear();
|
||||
mySelectionGeom.Clear (theMode);
|
||||
|
||||
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
|
||||
if (!myIsInitialized)
|
||||
if (!IsValid())
|
||||
{
|
||||
gp_Pnt aLastPoint;
|
||||
if (!initCircularDimension (myFirstShape, myCircle,
|
||||
myFirstPoint, aLastPoint))
|
||||
return;
|
||||
else
|
||||
{
|
||||
mySecondPoint = myCircle.Location();
|
||||
myIsInitialized = Standard_True;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!myIsWorkingPlaneCustom)
|
||||
{
|
||||
countDefaultPlane();
|
||||
}
|
||||
|
||||
drawLinearDimension (thePresentation, theMode, Standard_True);
|
||||
DrawLinearDimension (thePresentation, theMode, myAnchorPoint, myCircle.Location(), Standard_True);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : computeValue
|
||||
//function : IsValidCircle
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_RadiusDimension::computeValue ()
|
||||
Standard_Boolean AIS_RadiusDimension::IsValidCircle (const gp_Circ& theCircle) const
|
||||
{
|
||||
myValue = myFirstPoint.Distance (mySecondPoint);
|
||||
AIS_Dimension::computeValue ();
|
||||
return theCircle.Radius() > Precision::Confusion();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : countDefaultPlane
|
||||
//function : IsValidAnchor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_RadiusDimension::countDefaultPlane ()
|
||||
Standard_Boolean AIS_RadiusDimension::IsValidAnchor (const gp_Circ& theCircle,
|
||||
const gp_Pnt& theAnchor) const
|
||||
{
|
||||
// Compute normal of the default plane.
|
||||
gp_Vec aVec1(mySecondPoint, myFirstPoint),
|
||||
aVec2(mySecondPoint, ElCLib::Value(M_PI_2, myCircle));
|
||||
myDefaultPlane = gp_Pln(myCircle.Location(), aVec1^aVec2);
|
||||
// Set computed value to <myWorkingPlane>
|
||||
ResetWorkingPlane ();
|
||||
gp_Pln aCirclePlane (theCircle.Location(), theCircle.Axis().Direction());
|
||||
Standard_Real anAnchorDist = theAnchor.Distance (theCircle.Location());
|
||||
Standard_Real aRadius = myCircle.Radius();
|
||||
|
||||
return Abs (anAnchorDist - aRadius) > Precision::Confusion()
|
||||
&& aCirclePlane.Contains (theAnchor, Precision::Confusion());
|
||||
}
|
||||
|
@ -16,63 +16,134 @@
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
//! A framework to define display of radii. <br>
|
||||
//! These displays serve as relational references in 3D <br>
|
||||
//! presentations of surfaces, and are particularly useful <br>
|
||||
//! in viewing fillets. The display consists of arrows and <br>
|
||||
//! text giving the length of a radius. This display is <br>
|
||||
//! recalculated if the applicative owner shape changes <br>
|
||||
//! in dimension, and the text gives the modified length. <br>
|
||||
//! The algorithm analyzes a length along a face as an <br>
|
||||
//! arc. It then reconstructs the circle corresponding to <br>
|
||||
//! the arc and calculates the radius of this circle. <br>
|
||||
|
||||
#ifndef _AIS_RadiusDimension_HeaderFile
|
||||
#define _AIS_RadiusDimension_HeaderFile
|
||||
|
||||
#include <AIS.hxx>
|
||||
#include <AIS_Dimension.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_RadiusDimension,AIS_Dimension)
|
||||
DEFINE_STANDARD_HANDLE (AIS_RadiusDimension,AIS_Dimension)
|
||||
|
||||
//! Radius dimension. Can be constructued:
|
||||
//! - On generic circle.
|
||||
//! - On generic circle with user-defined anchor point on that circle.
|
||||
//! - On generic shape containing geometry that can be measured
|
||||
//! by diameter dimension: circle wire, arc, circular face, etc.
|
||||
//! The anchor point is the location of left attachement point of
|
||||
//! dimension on the circle. It can be user-specified, or computed as
|
||||
//! middle point on the arc. The radius dimension always lies in the
|
||||
//! plane of the measured circle. The dimension is considered as
|
||||
//! invalid if the user-specified anchor point is not lying on the circle,
|
||||
//! if the radius of the circle is less than Precision::Confusion().
|
||||
//! In case if the dimension is built on the arbitrary shape,
|
||||
//! it can be considered as invalid if the shape does not contain
|
||||
//! circle geometry.
|
||||
class AIS_RadiusDimension : public AIS_Dimension
|
||||
{
|
||||
public:
|
||||
|
||||
Standard_EXPORT AIS_RadiusDimension (const gp_Circ& theCircle);
|
||||
//! Create radius dimension for the circle geometry.
|
||||
//! @param theCircle [in] the circle to measure.
|
||||
Standard_EXPORT AIS_RadiusDimension (const gp_Circ& theCircle);
|
||||
|
||||
Standard_EXPORT AIS_RadiusDimension (const gp_Circ& theCircle,
|
||||
const gp_Pnt& theAttachPoint);
|
||||
//! Create radius dimension for the circle geometry and define its
|
||||
//! orientation by location of the first point on that circle.
|
||||
//! @param theCircle [in] the circle to measure.
|
||||
//! @param theAnchorPoint [in] the point to define the position
|
||||
//! of the dimension attachement on the circle.
|
||||
Standard_EXPORT AIS_RadiusDimension (const gp_Circ& theCircle,
|
||||
const gp_Pnt& theAnchorPoint);
|
||||
|
||||
//! Constructs the radius display object defined by the <br>
|
||||
//! shape aShape, the dimension aVal, and the text aText.
|
||||
Standard_EXPORT AIS_RadiusDimension (const TopoDS_Shape& aShape);
|
||||
//! Create radius dimension for the arbitrary shape (if possible).
|
||||
//! @param theShape [in] the shape to measure.
|
||||
Standard_EXPORT AIS_RadiusDimension (const TopoDS_Shape& theShape);
|
||||
|
||||
DEFINE_STANDARD_RTTI(AIS_RadiusDimension)
|
||||
public:
|
||||
|
||||
//! @return measured geometry circle.
|
||||
const gp_Circ& Circle() const
|
||||
{
|
||||
return myCircle;
|
||||
}
|
||||
|
||||
//! @return anchor point on circle for radius dimension.
|
||||
const gp_Pnt& AnchorPoint() const
|
||||
{
|
||||
return myAnchorPoint;
|
||||
}
|
||||
|
||||
//! @return the measured shape.
|
||||
const TopoDS_Shape& Shape() const
|
||||
{
|
||||
return myShape;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
//! Measure radius of the circle.
|
||||
//! The dimension will become invalid if the radius of the circle
|
||||
//! is less than Precision::Confusion().
|
||||
//! @param theCircle [in] the circle to measure.
|
||||
Standard_EXPORT void SetMeasuredGeometry (const gp_Circ& theCircle);
|
||||
|
||||
//! Measure radius of the circle and orient the dimension so
|
||||
//! the dimension lines attaches to anchor point on the circle.
|
||||
//! The dimension will become invalid if the radiuss of the circle
|
||||
//! is less than Precision::Confusion().
|
||||
//! @param theCircle [in] the circle to measure.
|
||||
//! @param theAnchorPoint [in] the point to attach the dimension lines.
|
||||
Standard_EXPORT void SetMeasuredGeometry (const gp_Circ& theCircle,
|
||||
const gp_Pnt& theAnchorPoint);
|
||||
|
||||
//! Measure radius on the passed shape, if applicable.
|
||||
//! The dimension will become invalid if the passed shape is not
|
||||
//! measurable or if measured diameter value is less than Precision::Confusion().
|
||||
//! @param theShape [in] the shape to measure.
|
||||
Standard_EXPORT void SetMeasuredGeometry (const TopoDS_Shape& theShape);
|
||||
|
||||
//! @return the display units string.
|
||||
Standard_EXPORT virtual const TCollection_AsciiString& GetDisplayUnits () const;
|
||||
|
||||
//! @return the model units string.
|
||||
Standard_EXPORT virtual const TCollection_AsciiString& GetModelUnits () const;
|
||||
|
||||
Standard_EXPORT virtual void SetDisplayUnits (const TCollection_AsciiString& theUnits);
|
||||
|
||||
Standard_EXPORT virtual void SetModelUnits (const TCollection_AsciiString& theUnits);
|
||||
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_RTTI (AIS_RadiusDimension)
|
||||
|
||||
protected:
|
||||
|
||||
//! Computes dimension value in display units
|
||||
Standard_EXPORT virtual void computeValue ();
|
||||
Standard_EXPORT virtual void ComputePlane();
|
||||
|
||||
//! Fills default plane object if it is possible to count plane automatically.
|
||||
Standard_EXPORT virtual void countDefaultPlane ();
|
||||
//! Checks if anchor point and the center of the circle are on the plane.
|
||||
Standard_EXPORT virtual Standard_Boolean CheckPlane (const gp_Pln& thePlane) const;
|
||||
|
||||
Standard_EXPORT virtual Standard_Real ComputeValue() const;
|
||||
|
||||
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode = 0);
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsValidCircle (const gp_Circ& theCircle) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsValidAnchor (const gp_Circ& theCircle,
|
||||
const gp_Pnt& thePnt) const;
|
||||
|
||||
private:
|
||||
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode = 0);
|
||||
|
||||
// Fields
|
||||
private:
|
||||
|
||||
gp_Circ myCircle;
|
||||
gp_Circ myCircle;
|
||||
gp_Pnt myAnchorPoint;
|
||||
TopoDS_Shape myShape;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // _AIS_RadiusDimension_HeaderFile
|
||||
|
@ -3,3 +3,5 @@ Prs3d_NListOfSequenceOfPnt.hxx
|
||||
Prs3d_Point.hxx
|
||||
Prs3d_WFShape.hxx
|
||||
Prs3d_WFShape.cxx
|
||||
Prs3d_DimensionUnits.hxx
|
||||
Prs3d_DimensionUnits.cxx
|
||||
|
@ -119,6 +119,7 @@ is
|
||||
class PlaneAspect;
|
||||
class DimensionAspect;
|
||||
class DatumAspect;
|
||||
imported DimensionUnits;
|
||||
|
||||
class Drawer;
|
||||
---Purpose: qualifies how the presentation algorithms compute
|
||||
|
@ -18,8 +18,9 @@
|
||||
|
||||
class DimensionAspect from Prs3d inherits BasicAspect from Prs3d
|
||||
|
||||
---Purpose: defines the attributes when drawing a Length Presentation.
|
||||
uses
|
||||
---Purpose: defines the attributes when drawing a Length Presentation.
|
||||
|
||||
uses
|
||||
DimensionTextHorizontalPosition from Prs3d,
|
||||
DimensionTextVerticalPosition from Prs3d,
|
||||
DimensionArrowOrientation from Prs3d,
|
||||
@ -31,7 +32,8 @@ uses
|
||||
Color from Quantity,
|
||||
TypeOfLine from Aspect,
|
||||
PlaneAngle from Quantity,
|
||||
TypeOfLine from Aspect
|
||||
TypeOfLine from Aspect,
|
||||
AsciiString from TCollection
|
||||
is
|
||||
|
||||
Create returns mutable DimensionAspect from Prs3d;
|
||||
@ -64,8 +66,15 @@ is
|
||||
IsArrows3d(me) returns Boolean from Standard;
|
||||
--- Purpose: Gets type of arrows.
|
||||
|
||||
MakeArrows3d (me:mutable; isArrows3d: Boolean from Standard);
|
||||
---Purpose: Sets type of arrows.
|
||||
MakeArrows3d (me : mutable; isArrows3d: Boolean from Standard);
|
||||
---Purpose: Sets type of arrows.
|
||||
|
||||
IsUnitsDisplayed (me) returns Boolean from Standard;
|
||||
---Purpose: Shows if Units are to be displayed along with dimension value.
|
||||
|
||||
MakeUnitsDisplayed (me : mutable; theIsDisplayed : Boolean from Standard);
|
||||
---Purpose: Specifies whether the units string should be displayed
|
||||
-- along with value label or not.
|
||||
|
||||
SetArrowOrientation(me: mutable; theArrowOrient: DimensionArrowOrientation from Prs3d);
|
||||
--- Purpose: Sets orientation of arrows (external or internal).
|
||||
@ -95,15 +104,21 @@ is
|
||||
SetCommonColor(me:mutable; theColor: Color from Quantity) is static;
|
||||
---Purpose: Sets the same color for all parts of dimension: lines, arrows and text.
|
||||
|
||||
SetExtensionSize (me : mutable; theSize : Real from Standard) is static;
|
||||
SetExtensionSize (me : mutable; theSize : Real from Standard);
|
||||
---Purpose: Sets extension size.
|
||||
|
||||
ExtensionSize (me) returns Real from Standard;
|
||||
---Purpose: Returns extension size.
|
||||
|
||||
SetValueStringFormat (me : mutable; theFormat : AsciiString from TCollection);
|
||||
---Purpose: Sets "sprintf"-syntax format for formatting dimension value labels.
|
||||
|
||||
ValueStringFormat (me) returns AsciiString from TCollection;
|
||||
---Purpose: Returns format.
|
||||
|
||||
fields
|
||||
|
||||
myLineAspect: LineAspect from Prs3d;
|
||||
myLineAspect : LineAspect from Prs3d;
|
||||
---Purpose: Text style. The size for 3d (or 2d) text is also inside here.
|
||||
|
||||
myTextAspect: TextAspect from Prs3d;
|
||||
@ -129,4 +144,12 @@ fields
|
||||
---Purpose: Size of arrow extensions.
|
||||
-- The length of arrow tails if arrows are located outside dimension line.
|
||||
|
||||
myValueStringFormat : AsciiString from TCollection;
|
||||
---Purpose: "sprintf"-syntax format for formatting dimension value labels.
|
||||
-- Default is "%g".
|
||||
|
||||
myToDisplayUnits : Boolean from Standard;
|
||||
---Purpose: Defines if the units need to be displayed.
|
||||
-- Default is FALSE.
|
||||
|
||||
end DimensionAspect from Prs3d;
|
||||
|
@ -50,7 +50,9 @@ Prs3d_DimensionAspect::Prs3d_DimensionAspect()
|
||||
myArrowAspect->SetColor (Quantity_NOC_LAWNGREEN);
|
||||
myArrowAspect->SetAngle (M_PI * 20.0 / 180.0);
|
||||
myArrowAspect->SetLength (6.0);
|
||||
myExtensionSize = 6.0;
|
||||
myExtensionSize = 6.0;
|
||||
myValueStringFormat = "%g";
|
||||
myToDisplayUnits = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -58,7 +60,6 @@ Prs3d_DimensionAspect::Prs3d_DimensionAspect()
|
||||
//purpose : Sets the same color for all parts of dimension:
|
||||
// lines, arrows and text.
|
||||
//=======================================================================
|
||||
|
||||
void Prs3d_DimensionAspect::SetCommonColor (const Quantity_Color& theColor)
|
||||
{
|
||||
myLineAspect->SetColor (theColor);
|
||||
@ -70,7 +71,6 @@ void Prs3d_DimensionAspect::SetCommonColor (const Quantity_Color& theColor)
|
||||
//function : LineAspect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Prs3d_LineAspect) Prs3d_DimensionAspect::LineAspect () const
|
||||
{
|
||||
return myLineAspect;
|
||||
@ -80,7 +80,6 @@ Handle(Prs3d_LineAspect) Prs3d_DimensionAspect::LineAspect () const
|
||||
//function : SetLineAspect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Prs3d_DimensionAspect::SetLineAspect(const Handle(Prs3d_LineAspect)& theAspect)
|
||||
{
|
||||
myLineAspect = theAspect;
|
||||
@ -90,7 +89,6 @@ void Prs3d_DimensionAspect::SetLineAspect(const Handle(Prs3d_LineAspect)& theAsp
|
||||
//function : TextAspect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Prs3d_TextAspect) Prs3d_DimensionAspect::TextAspect () const
|
||||
{
|
||||
return myTextAspect;
|
||||
@ -100,7 +98,6 @@ Handle(Prs3d_TextAspect) Prs3d_DimensionAspect::TextAspect () const
|
||||
//function : SetTextAspect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Prs3d_DimensionAspect::SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect)
|
||||
{
|
||||
myTextAspect = theAspect;
|
||||
@ -110,12 +107,11 @@ void Prs3d_DimensionAspect::SetTextAspect (const Handle(Prs3d_TextAspect)& theAs
|
||||
//function : MakeArrows3D
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Prs3d_DimensionAspect::MakeArrows3d (const Standard_Boolean isArrows3d)
|
||||
{
|
||||
myIsArrows3d = isArrows3d;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsArrows3D
|
||||
//purpose :
|
||||
@ -129,12 +125,11 @@ Standard_Boolean Prs3d_DimensionAspect::IsArrows3d () const
|
||||
//function : MakeText3D
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Prs3d_DimensionAspect::MakeText3d (const Standard_Boolean isText3d)
|
||||
{
|
||||
myIsText3d = isText3d;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsText3D
|
||||
//purpose :
|
||||
@ -144,6 +139,24 @@ Standard_Boolean Prs3d_DimensionAspect::IsText3d () const
|
||||
return myIsText3d;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsUnitsDisplayed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean Prs3d_DimensionAspect::IsUnitsDisplayed () const
|
||||
{
|
||||
return myToDisplayUnits;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeUnitsDisplayed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Prs3d_DimensionAspect::MakeUnitsDisplayed (const Standard_Boolean theIsDisplayed)
|
||||
{
|
||||
myToDisplayUnits = theIsDisplayed;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsTextShaded
|
||||
//purpose :
|
||||
@ -157,7 +170,6 @@ Standard_Boolean Prs3d_DimensionAspect::IsTextShaded () const
|
||||
//function : MakeTextShaded
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Prs3d_DimensionAspect::MakeTextShaded (const Standard_Boolean isTextShaded)
|
||||
{
|
||||
myIsTextShaded = isTextShaded;
|
||||
@ -167,7 +179,6 @@ void Prs3d_DimensionAspect::MakeTextShaded (const Standard_Boolean isTextShaded)
|
||||
//function : SetArrowOrientation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Prs3d_DimensionAspect::SetArrowOrientation (const Prs3d_DimensionArrowOrientation theArrowOrient)
|
||||
{
|
||||
myArrowOrientation = theArrowOrient;
|
||||
@ -177,7 +188,6 @@ void Prs3d_DimensionAspect::SetArrowOrientation (const Prs3d_DimensionArrowOrien
|
||||
//function : GetArrowOrientation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Prs3d_DimensionArrowOrientation Prs3d_DimensionAspect::ArrowOrientation() const
|
||||
{
|
||||
return myArrowOrientation;
|
||||
@ -187,7 +197,6 @@ Prs3d_DimensionArrowOrientation Prs3d_DimensionAspect::ArrowOrientation() const
|
||||
//function : SetTextVerticalPosition
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Prs3d_DimensionAspect::SetTextVerticalPosition (const Prs3d_DimensionTextVerticalPosition thePosition)
|
||||
{
|
||||
myTextVPosition = thePosition;
|
||||
@ -197,7 +206,6 @@ void Prs3d_DimensionAspect::SetTextVerticalPosition (const Prs3d_DimensionTextVe
|
||||
//function : TextVerticalPosition
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Prs3d_DimensionTextVerticalPosition Prs3d_DimensionAspect::TextVerticalPosition() const
|
||||
{
|
||||
return myTextVPosition;
|
||||
@ -207,7 +215,6 @@ Prs3d_DimensionTextVerticalPosition Prs3d_DimensionAspect::TextVerticalPosition(
|
||||
//function : SetTextHorizontalPosition
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Prs3d_DimensionAspect::SetTextHorizontalPosition (const Prs3d_DimensionTextHorizontalPosition thePosition)
|
||||
{
|
||||
myTextHPosition = thePosition;
|
||||
@ -217,7 +224,6 @@ void Prs3d_DimensionAspect::SetTextHorizontalPosition (const Prs3d_DimensionText
|
||||
//function : TextHorizontalPosition
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Prs3d_DimensionTextHorizontalPosition Prs3d_DimensionAspect::TextHorizontalPosition() const
|
||||
{
|
||||
return myTextHPosition;
|
||||
@ -227,7 +233,6 @@ Prs3d_DimensionTextHorizontalPosition Prs3d_DimensionAspect::TextHorizontalPosit
|
||||
//function : ArrowAspect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Prs3d_ArrowAspect) Prs3d_DimensionAspect::ArrowAspect () const
|
||||
{
|
||||
return myArrowAspect;
|
||||
@ -237,7 +242,6 @@ Handle(Prs3d_ArrowAspect) Prs3d_DimensionAspect::ArrowAspect () const
|
||||
//function : SetArrowAspect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Prs3d_DimensionAspect::SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect)
|
||||
{
|
||||
myArrowAspect = theAspect;
|
||||
@ -247,7 +251,6 @@ void Prs3d_DimensionAspect::SetArrowAspect (const Handle(Prs3d_ArrowAspect)& the
|
||||
//function : SetExtensioSize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void Prs3d_DimensionAspect::SetExtensionSize (const Standard_Real theSize)
|
||||
{
|
||||
myExtensionSize = theSize;
|
||||
@ -257,8 +260,25 @@ void Prs3d_DimensionAspect::SetExtensionSize (const Standard_Real theSize)
|
||||
//function : ExtensionSize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real Prs3d_DimensionAspect::ExtensionSize() const
|
||||
{
|
||||
return myExtensionSize;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetValueStringFormat
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Prs3d_DimensionAspect::SetValueStringFormat (const TCollection_AsciiString& theFormat)
|
||||
{
|
||||
myValueStringFormat = theFormat;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ValueStringFormat
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TCollection_AsciiString Prs3d_DimensionAspect::ValueStringFormat() const
|
||||
{
|
||||
return myValueStringFormat;
|
||||
}
|
||||
|
38
src/Prs3d/Prs3d_DimensionUnits.cxx
Normal file
38
src/Prs3d/Prs3d_DimensionUnits.cxx
Normal file
@ -0,0 +1,38 @@
|
||||
// Created on: 2013-11-11
|
||||
// Created by: Anastasia BORISOVA
|
||||
// Copyright (c) 2013 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
#include <Prs3d_DimensionUnits.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : SetLengthUnits
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Prs3d_DimensionUnits::SetLengthUnits (const TCollection_AsciiString& theUnits)
|
||||
{
|
||||
myLengthUnits = theUnits;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetAngleUnits
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Prs3d_DimensionUnits::SetAngleUnits (const TCollection_AsciiString& theUnits)
|
||||
{
|
||||
myAngleUnits = theUnits;
|
||||
}
|
61
src/Prs3d/Prs3d_DimensionUnits.hxx
Normal file
61
src/Prs3d/Prs3d_DimensionUnits.hxx
Normal file
@ -0,0 +1,61 @@
|
||||
// Created on: 2013-11-11
|
||||
// Created by: Anastasia BORISOVA
|
||||
// Copyright (c) 2013 OPEN CASCADE SAS
|
||||
//
|
||||
// The content of this file is subject to the Open CASCADE Technology Public
|
||||
// License Version 6.5 (the "License"). You may not use the content of this file
|
||||
// except in compliance with the License. Please obtain a copy of the License
|
||||
// at http://www.opencascade.org and read it completely before using this file.
|
||||
//
|
||||
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
|
||||
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
|
||||
//
|
||||
// The Original Code and all software distributed under the License is
|
||||
// distributed on an "AS IS" basis, without warranty of any kind, and the
|
||||
// Initial Developer hereby disclaims all such warranties, including without
|
||||
// limitation, any warranties of merchantability, fitness for a particular
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
#ifndef _Prs3d_DimensionUnits_Header
|
||||
#define _Prs3d_DimensionUnits_Header
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
//! This class provides units for two dimension groups:
|
||||
//! - lengthes (length, radius, diameter)
|
||||
//! - angles
|
||||
class Prs3d_DimensionUnits
|
||||
{
|
||||
public:
|
||||
|
||||
//! Default constructor. Sets meters as default length units
|
||||
//! and radians as default angle units.
|
||||
Prs3d_DimensionUnits()
|
||||
: myLengthUnits ("m"),
|
||||
myAngleUnits ("rad")
|
||||
{}
|
||||
|
||||
Prs3d_DimensionUnits (const Prs3d_DimensionUnits& theUnits)
|
||||
: myLengthUnits (theUnits.GetLengthUnits()),
|
||||
myAngleUnits (theUnits.GetAngleUnits())
|
||||
{}
|
||||
|
||||
//! Sets angle units
|
||||
Standard_EXPORT void SetAngleUnits (const TCollection_AsciiString& theUnits);
|
||||
|
||||
//! @return angle units
|
||||
const TCollection_AsciiString& GetAngleUnits() const { return myAngleUnits; }
|
||||
|
||||
//! Sets length units
|
||||
Standard_EXPORT void SetLengthUnits (const TCollection_AsciiString& theUnits);
|
||||
|
||||
//! @return length units
|
||||
const TCollection_AsciiString& GetLengthUnits() const { return myLengthUnits; }
|
||||
|
||||
private:
|
||||
|
||||
TCollection_AsciiString myLengthUnits;
|
||||
TCollection_AsciiString myAngleUnits;
|
||||
};
|
||||
#endif
|
@ -46,7 +46,10 @@ uses
|
||||
NameOfColor from Quantity,
|
||||
PlaneAngle from Quantity,
|
||||
Length from Quantity,
|
||||
TypeOfHLR from Prs3d
|
||||
TypeOfHLR from Prs3d,
|
||||
DimensionUnits from Prs3d,
|
||||
AsciiString from TCollection,
|
||||
Ax2 from gp
|
||||
|
||||
is
|
||||
Create returns mutable Drawer from Prs3d;
|
||||
@ -472,27 +475,51 @@ is
|
||||
is virtual;
|
||||
---Purpose: Sets the modality anAspect for the display of datums.
|
||||
|
||||
DimensionAspect(me:mutable) returns mutable DimensionAspect from Prs3d
|
||||
---Purpose: Returns settings for the appearance of dimensions.
|
||||
is virtual;
|
||||
DimensionAspect(me:mutable) returns mutable DimensionAspect from Prs3d is virtual;
|
||||
---Purpose: Returns settings for the appearance of dimensions.
|
||||
|
||||
SetDimensionAspect(me:mutable; theAspect: DimensionAspect from Prs3d)
|
||||
is virtual;
|
||||
---Purpose: Sets the modality anAspect for display of dimensions.
|
||||
SetDimensionAspect(me:mutable; theAspect: DimensionAspect from Prs3d) is virtual;
|
||||
---Purpose: Sets the settings for the appearance of dimensions.
|
||||
|
||||
SectionAspect (me:mutable) returns mutable LineAspect from Prs3d
|
||||
---Purpose: The LineAspect for the wire can be edited.
|
||||
-- The default values are:
|
||||
-- Color: Quantity_NOC_ORANGE
|
||||
-- Type of line: Aspect_TOL_SOLID
|
||||
-- Width: 1.
|
||||
-- These attributes are used by the algorithm Prs3d_WFShape
|
||||
is virtual;
|
||||
SetDimLengthModelUnits (me: mutable; theUnits : AsciiString from TCollection) is virtual;
|
||||
---Purpose: Sets dimension length model units for computing of dimension presentation.
|
||||
|
||||
SetDimAngleModelUnits (me: mutable; theUnits : AsciiString from TCollection) is virtual;
|
||||
---Purpose: Sets dimension angle model units for computing of dimension presentation.
|
||||
|
||||
DimLengthModelUnits (me) returns AsciiString from TCollection is virtual;
|
||||
---Purpose: Returns length model units for the dimension presentation.
|
||||
---C++: return const &
|
||||
|
||||
DimAngleModelUnits (me) returns AsciiString from TCollection is virtual;
|
||||
---Purpose: Returns angle model units for the dimension presentation.
|
||||
---C++: return const &
|
||||
|
||||
SetDimLengthDisplayUnits (me: mutable; theUnits : AsciiString from TCollection) is virtual;
|
||||
---Purpose: Sets length units in which value for dimension presentation is displayed.
|
||||
|
||||
SetDimAngleDisplayUnits (me: mutable; theUnits : AsciiString from TCollection) is virtual;
|
||||
---Purpose: Sets angle units in which value for dimension presentation is displayed.
|
||||
|
||||
DimLengthDisplayUnits (me) returns AsciiString from TCollection is virtual;
|
||||
---Purpose: Returns length units in which dimension presentation is displayed.
|
||||
---C++: return const &
|
||||
|
||||
DimAngleDisplayUnits (me) returns AsciiString from TCollection is virtual;
|
||||
---Purpose: Returns angle units in which dimension presentation is displayed.
|
||||
---C++: return const &
|
||||
|
||||
SectionAspect (me : mutable) returns mutable LineAspect from Prs3d is virtual;
|
||||
---Purpose: The LineAspect for the wire can be edited.
|
||||
-- The default values are:
|
||||
-- Color: Quantity_NOC_ORANGE
|
||||
-- Type of line: Aspect_TOL_SOLID
|
||||
-- Width: 1.
|
||||
-- These attributes are used by the algorithm Prs3d_WFShape.
|
||||
|
||||
SetSectionAspect (me : mutable; theAspect: LineAspect from Prs3d) is virtual;
|
||||
---Purpose: Sets the parameter theAspect for display attributes of sections.
|
||||
|
||||
SetSectionAspect(me:mutable;anAspect: LineAspect from Prs3d)
|
||||
is virtual;
|
||||
---Purpose: Sets the parameter anAspect for display attributes of sections.
|
||||
|
||||
SetFaceBoundaryDraw (me : mutable;
|
||||
theIsEnabled : Boolean from Standard)
|
||||
is virtual;
|
||||
@ -515,43 +542,49 @@ is
|
||||
---Purpose: Returns line aspect of face boundaries.
|
||||
|
||||
fields
|
||||
myUIsoAspect: IsoAspect from Prs3d is protected;
|
||||
myVIsoAspect: IsoAspect from Prs3d is protected;
|
||||
myNbPoints : Integer from Standard is protected;
|
||||
myIsoOnPlane: Boolean from Standard is protected;
|
||||
myFreeBoundaryAspect: LineAspect from Prs3d is protected;
|
||||
myFreeBoundaryDraw: Boolean from Standard is protected;
|
||||
myUnFreeBoundaryAspect: LineAspect from Prs3d is protected;
|
||||
myUnFreeBoundaryDraw: Boolean from Standard is protected;
|
||||
myWireAspect: LineAspect from Prs3d is protected;
|
||||
myWireDraw: Boolean from Standard is protected;
|
||||
myLineAspect: LineAspect from Prs3d is protected;
|
||||
myTextAspect: TextAspect from Prs3d is protected;
|
||||
myShadingAspect: ShadingAspect from Prs3d is protected;
|
||||
myShadingAspectGlobal: Boolean from Standard is protected;
|
||||
myChordialDeviation: Length from Quantity is protected;
|
||||
myTypeOfDeflection: TypeOfDeflection from Aspect is protected;
|
||||
myMaximalParameterValue: Real from Standard is protected;
|
||||
|
||||
myDeviationCoefficient: Real from Standard is protected;
|
||||
myHLRDeviationCoefficient: Real from Standard is protected;
|
||||
|
||||
myDeviationAngle: Real from Standard is protected;
|
||||
myHLRAngle: Real from Standard is protected;
|
||||
|
||||
myPointAspect: PointAspect from Prs3d is protected;
|
||||
myPlaneAspect: PlaneAspect from Prs3d is protected;
|
||||
myArrowAspect: ArrowAspect from Prs3d is protected;
|
||||
myLineDrawArrow: Boolean from Standard is protected;
|
||||
myDrawHiddenLine: Boolean from Standard is protected;
|
||||
myHiddenLineAspect: LineAspect from Prs3d is protected;
|
||||
mySeenLineAspect: LineAspect from Prs3d is protected;
|
||||
myVectorAspect: LineAspect from Prs3d is protected;
|
||||
myDatumAspect: DatumAspect from Prs3d is protected;
|
||||
myDatumScale: Real from Standard is protected;
|
||||
myDimensionAspect: DimensionAspect from Prs3d is protected;
|
||||
mySectionAspect: LineAspect from Prs3d is protected;
|
||||
myFaceBoundaryDraw : Boolean from Standard is protected;
|
||||
myFaceBoundaryAspect : LineAspect from Prs3d is protected;
|
||||
myTypeOfHLR : TypeOfHLR from Prs3d is protected;
|
||||
myUIsoAspect: IsoAspect from Prs3d is protected;
|
||||
myVIsoAspect: IsoAspect from Prs3d is protected;
|
||||
myNbPoints : Integer from Standard is protected;
|
||||
myIsoOnPlane: Boolean from Standard is protected;
|
||||
myFreeBoundaryAspect: LineAspect from Prs3d is protected;
|
||||
myFreeBoundaryDraw: Boolean from Standard is protected;
|
||||
myUnFreeBoundaryAspect: LineAspect from Prs3d is protected;
|
||||
myUnFreeBoundaryDraw: Boolean from Standard is protected;
|
||||
myWireAspect: LineAspect from Prs3d is protected;
|
||||
myWireDraw: Boolean from Standard is protected;
|
||||
myLineAspect: LineAspect from Prs3d is protected;
|
||||
myTextAspect: TextAspect from Prs3d is protected;
|
||||
myShadingAspect: ShadingAspect from Prs3d is protected;
|
||||
myShadingAspectGlobal: Boolean from Standard is protected;
|
||||
myChordialDeviation: Length from Quantity is protected;
|
||||
myTypeOfDeflection: TypeOfDeflection from Aspect is protected;
|
||||
myMaximalParameterValue: Real from Standard is protected;
|
||||
|
||||
myDeviationCoefficient: Real from Standard is protected;
|
||||
myHLRDeviationCoefficient: Real from Standard is protected;
|
||||
|
||||
myDeviationAngle: Real from Standard is protected;
|
||||
myHLRAngle: Real from Standard is protected;
|
||||
|
||||
myPointAspect: PointAspect from Prs3d is protected;
|
||||
myPlaneAspect: PlaneAspect from Prs3d is protected;
|
||||
myArrowAspect: ArrowAspect from Prs3d is protected;
|
||||
myLineDrawArrow: Boolean from Standard is protected;
|
||||
myDrawHiddenLine: Boolean from Standard is protected;
|
||||
myHiddenLineAspect: LineAspect from Prs3d is protected;
|
||||
mySeenLineAspect: LineAspect from Prs3d is protected;
|
||||
myVectorAspect: LineAspect from Prs3d is protected;
|
||||
myDatumAspect: DatumAspect from Prs3d is protected;
|
||||
myDatumScale: Real from Standard is protected;
|
||||
|
||||
myDimensionAspect : DimensionAspect from Prs3d is protected;
|
||||
myDimensionModelUnits : DimensionUnits from Prs3d is protected;
|
||||
myDimensionDisplayUnits : DimensionUnits from Prs3d is protected;
|
||||
|
||||
mySectionAspect : LineAspect from Prs3d is protected;
|
||||
myFaceBoundaryDraw : Boolean from Standard is protected;
|
||||
myFaceBoundaryAspect : LineAspect from Prs3d is protected;
|
||||
myTypeOfHLR : TypeOfHLR from Prs3d is protected;
|
||||
|
||||
end Drawer;
|
||||
|
@ -16,31 +16,37 @@
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
#define BUC60488 //GG_10/10/99 Set correctly all fields
|
||||
|
||||
#include <Prs3d_Drawer.ixx>
|
||||
|
||||
Prs3d_Drawer::Prs3d_Drawer(): myNbPoints(30),myIsoOnPlane(Standard_False),
|
||||
myFreeBoundaryDraw(Standard_True),
|
||||
myUnFreeBoundaryDraw(Standard_True),
|
||||
myWireDraw(Standard_True),
|
||||
#ifdef BUC60488
|
||||
myShadingAspect( new Prs3d_ShadingAspect()),
|
||||
#endif
|
||||
myShadingAspectGlobal(Standard_True),
|
||||
myChordialDeviation(0.0001),
|
||||
myTypeOfDeflection(Aspect_TOD_RELATIVE),
|
||||
myMaximalParameterValue(500000.),
|
||||
myDeviationCoefficient(0.001),
|
||||
myHLRDeviationCoefficient(0.02),
|
||||
myDeviationAngle(12*M_PI/180),
|
||||
myHLRAngle(20*M_PI/180),
|
||||
myLineDrawArrow(Standard_False),
|
||||
myDrawHiddenLine(Standard_False),
|
||||
myFaceBoundaryDraw(Standard_False),
|
||||
myTypeOfHLR(Prs3d_TOH_PolyAlgo)
|
||||
// =======================================================================
|
||||
// function : Prs3d_Drawer
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Prs3d_Drawer::Prs3d_Drawer()
|
||||
: myNbPoints (30),
|
||||
myIsoOnPlane (Standard_False),
|
||||
myFreeBoundaryDraw (Standard_True),
|
||||
myUnFreeBoundaryDraw (Standard_True),
|
||||
myWireDraw (Standard_True),
|
||||
myShadingAspect (new Prs3d_ShadingAspect()),
|
||||
myShadingAspectGlobal (Standard_True),
|
||||
myChordialDeviation (0.0001),
|
||||
myTypeOfDeflection (Aspect_TOD_RELATIVE),
|
||||
myMaximalParameterValue (500000.),
|
||||
myDeviationCoefficient (0.001),
|
||||
myHLRDeviationCoefficient (0.02),
|
||||
myDeviationAngle (12.0 * M_PI / 180.0),
|
||||
myHLRAngle (20.0 * M_PI / 180.0),
|
||||
myLineDrawArrow (Standard_False),
|
||||
myDrawHiddenLine (Standard_False),
|
||||
myFaceBoundaryDraw (Standard_False),
|
||||
myTypeOfHLR (Prs3d_TOH_PolyAlgo)
|
||||
{
|
||||
}
|
||||
myDimensionModelUnits.SetLengthUnits ("m");
|
||||
myDimensionModelUnits.SetAngleUnits ("rad");
|
||||
myDimensionDisplayUnits.SetLengthUnits ("m");
|
||||
myDimensionDisplayUnits.SetAngleUnits ("deg");
|
||||
}
|
||||
|
||||
void Prs3d_Drawer::SetTypeOfDeflection(const Aspect_TypeOfDeflection aTypeOfDeflection){
|
||||
|
||||
@ -397,30 +403,122 @@ void Prs3d_Drawer::SetPlaneAspect ( const Handle(Prs3d_PlaneAspect)& anAspect) {
|
||||
myPlaneAspect = anAspect;
|
||||
}
|
||||
|
||||
Handle (Prs3d_DimensionAspect) Prs3d_Drawer::DimensionAspect ()
|
||||
// =======================================================================
|
||||
// function : DimensionAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle(Prs3d_DimensionAspect) Prs3d_Drawer::DimensionAspect()
|
||||
{
|
||||
if (myDimensionAspect.IsNull())
|
||||
{
|
||||
myDimensionAspect = new Prs3d_DimensionAspect;
|
||||
}
|
||||
|
||||
return myDimensionAspect;
|
||||
}
|
||||
|
||||
void Prs3d_Drawer::SetDimensionAspect ( const Handle(Prs3d_DimensionAspect)& theAspect)
|
||||
// =======================================================================
|
||||
// function : SetDimensionAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_Drawer::SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theAspect)
|
||||
{
|
||||
myDimensionAspect = theAspect;
|
||||
myDimensionAspect = theAspect;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetDimLengthModelUnits
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_Drawer::SetDimLengthModelUnits (const TCollection_AsciiString& theUnits)
|
||||
{
|
||||
myDimensionModelUnits.SetLengthUnits (theUnits);
|
||||
}
|
||||
|
||||
Handle (Prs3d_LineAspect) Prs3d_Drawer::SectionAspect () {
|
||||
// =======================================================================
|
||||
// function : SetDimAngleModelUnits
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_Drawer::SetDimAngleModelUnits (const TCollection_AsciiString& theUnits)
|
||||
{
|
||||
myDimensionModelUnits.SetAngleUnits (theUnits);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DimLengthModelUnits
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const TCollection_AsciiString& Prs3d_Drawer::DimLengthModelUnits() const
|
||||
{
|
||||
return myDimensionModelUnits.GetLengthUnits();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DimAngleModelUnits
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const TCollection_AsciiString& Prs3d_Drawer::DimAngleModelUnits() const
|
||||
{
|
||||
return myDimensionModelUnits.GetAngleUnits();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetDimLengthDisplayUnits
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_Drawer::SetDimLengthDisplayUnits (const TCollection_AsciiString& theUnits)
|
||||
{
|
||||
myDimensionDisplayUnits.SetLengthUnits (theUnits);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetDimAngleDisplayUnits
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_Drawer::SetDimAngleDisplayUnits (const TCollection_AsciiString& theUnits)
|
||||
{
|
||||
myDimensionDisplayUnits.SetAngleUnits (theUnits);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DimLengthDisplayUnits
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const TCollection_AsciiString& Prs3d_Drawer::DimLengthDisplayUnits() const
|
||||
{
|
||||
return myDimensionDisplayUnits.GetLengthUnits();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : DimAngleDisplayUnits
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
const TCollection_AsciiString& Prs3d_Drawer::DimAngleDisplayUnits() const
|
||||
{
|
||||
return myDimensionDisplayUnits.GetAngleUnits();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SectionAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Handle (Prs3d_LineAspect) Prs3d_Drawer::SectionAspect()
|
||||
{
|
||||
if (mySectionAspect.IsNull())
|
||||
mySectionAspect = new Prs3d_LineAspect
|
||||
(Quantity_NOC_ORANGE,Aspect_TOL_SOLID,1.);
|
||||
{
|
||||
mySectionAspect = new Prs3d_LineAspect (Quantity_NOC_ORANGE, Aspect_TOL_SOLID, 1.0);
|
||||
}
|
||||
|
||||
return mySectionAspect;
|
||||
}
|
||||
|
||||
void Prs3d_Drawer::SetSectionAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
|
||||
mySectionAspect = anAspect;
|
||||
// =======================================================================
|
||||
// function : SetSectionAspect
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Prs3d_Drawer::SetSectionAspect (const Handle(Prs3d_LineAspect)& theAspect)
|
||||
{
|
||||
mySectionAspect = theAspect;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@ -469,7 +567,6 @@ Handle_Prs3d_LineAspect Prs3d_Drawer::FaceBoundaryAspect ()
|
||||
// function : SetTypeOfHLR
|
||||
// purpose : set type of HLR algorithm
|
||||
// =======================================================================
|
||||
|
||||
void Prs3d_Drawer::SetTypeOfHLR ( const Prs3d_TypeOfHLR theTypeOfHLR)
|
||||
{
|
||||
myTypeOfHLR = theTypeOfHLR;
|
||||
@ -479,7 +576,6 @@ void Prs3d_Drawer::SetTypeOfHLR ( const Prs3d_TypeOfHLR theTypeOfHLR)
|
||||
// function : TypeOfHLR
|
||||
// purpose : gets type of HLR algorithm
|
||||
// =======================================================================
|
||||
|
||||
Prs3d_TypeOfHLR Prs3d_Drawer::TypeOfHLR ( ) const
|
||||
{
|
||||
return myTypeOfHLR;
|
||||
|
@ -254,7 +254,7 @@ static Standard_Integer BUC60972 (Draw_Interpretor& di, Standard_Integer argc, c
|
||||
//di << ExtString_aText << " " << Draw::Atof(argv[4]) << "\n";
|
||||
di << argv[5] << " " << Draw::Atof(argv[4]) << "\n";
|
||||
|
||||
Handle(AIS_AngleDimension) aDim = new AIS_AngleDimension(aFirst, aSecond, aPlane->Pln());
|
||||
Handle(AIS_AngleDimension) aDim = new AIS_AngleDimension(aFirst, aSecond);
|
||||
aContext->Display(aDim);
|
||||
|
||||
return 0;
|
||||
|
@ -292,15 +292,20 @@ static Standard_Integer BUC60818(Draw_Interpretor& di, Standard_Integer argc, c
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer BUC60915_1(Draw_Interpretor& di, Standard_Integer argc, const char ** /*argv*/)
|
||||
static Standard_Integer BUC60915_1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
|
||||
{
|
||||
if (argc > 1) {
|
||||
di<<"Function don't has parameters"<<"\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Handle(AIS_InteractiveContext) context= ViewerTest_Tool::MakeContext ("buc60915");
|
||||
ViewerTest_Tool::InitViewerTest (context);
|
||||
if(ViewerTest::GetAISContext().IsNull())
|
||||
{
|
||||
di << "View was not created. Use 'vinit' command before "
|
||||
<< argv[0] << "\n";
|
||||
return 1;
|
||||
}
|
||||
Handle(AIS_InteractiveContext) context = ViewerTest::GetAISContext();
|
||||
|
||||
//The following dimesion code has problems regarding arrow_size. The desired effect is not produced.
|
||||
/***************************************/
|
||||
@ -325,20 +330,29 @@ static Standard_Integer BUC60915_1(Draw_Interpretor& di, Standard_Integer argc,
|
||||
gp_Pnt plnpt(0, 0, 0);
|
||||
gp_Dir plndir(0, 0, 1);
|
||||
Handle(Geom_Plane) pln = new Geom_Plane(plnpt,plndir);
|
||||
Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect();
|
||||
anAspect->MakeArrows3d (Standard_True);
|
||||
anAspect->ArrowAspect()->SetAngle (M_PI/180.0 * 10.0);
|
||||
/***************************************/
|
||||
//dimension "L 502.51"
|
||||
/***************************************/
|
||||
Handle(AIS_LengthDimension) len = new AIS_LengthDimension(V2, V3, pln->Pln());
|
||||
anAspect->ArrowAspect()->SetLength (30.0);
|
||||
len->SetDimensionAspect (anAspect);
|
||||
context->Display(len);
|
||||
/***************************************/
|
||||
//dimension "L 90"
|
||||
/***************************************/
|
||||
Handle(AIS_LengthDimension) len1 = new AIS_LengthDimension(V4, V7, pln->Pln());
|
||||
Handle(AIS_LengthDimension) len1 = new AIS_LengthDimension(V7, V4, pln->Pln());
|
||||
len1->SetDimensionAspect (anAspect);
|
||||
len1->SetFlyout (30.0);
|
||||
anAspect->ArrowAspect()->SetLength (100.0);
|
||||
context->Display(len1);
|
||||
/***************************************/
|
||||
//dimension "L 150"
|
||||
/***************************************/
|
||||
Handle(AIS_LengthDimension) len2 = new AIS_LengthDimension(V1, V2, pln->Pln());
|
||||
len2->SetDimensionAspect (anAspect);
|
||||
context->Display(len2);
|
||||
/***************************************/
|
||||
//dimension "R 88.58"
|
||||
@ -346,6 +360,7 @@ static Standard_Integer BUC60915_1(Draw_Interpretor& di, Standard_Integer argc,
|
||||
gp_Circ cir = gp_Circ(gp_Ax2(gp_Pnt(191.09, -88.58, 0), gp_Dir(0, 0, 1)), 88.58);
|
||||
TopoDS_Edge E1 = BRepBuilderAPI_MakeEdge(cir,gp_Pnt(191.09,0,0.),gp_Pnt(191.09,-177.16,0.) );
|
||||
Handle(AIS_RadiusDimension) dim1 = new AIS_RadiusDimension(E1);
|
||||
dim1->SetDimensionAspect (anAspect);
|
||||
context->Display(dim1);
|
||||
/***************************************/
|
||||
//dimension "R 43.80"
|
||||
@ -353,6 +368,8 @@ static Standard_Integer BUC60915_1(Draw_Interpretor& di, Standard_Integer argc,
|
||||
gp_Circ cir1 = gp_Circ(gp_Ax2(gp_Pnt(191.09, -88.58, 0), gp_Dir(0, 0, 1)), 43.80);
|
||||
TopoDS_Edge E_cir1 = BRepBuilderAPI_MakeEdge(cir1);
|
||||
dim1 = new AIS_RadiusDimension(E_cir1);
|
||||
anAspect->ArrowAspect()->SetLength (60.0);
|
||||
dim1->SetDimensionAspect (anAspect);
|
||||
context->Display(dim1);
|
||||
/***************************************/
|
||||
//dimension "R 17.86"
|
||||
@ -360,6 +377,8 @@ static Standard_Integer BUC60915_1(Draw_Interpretor& di, Standard_Integer argc,
|
||||
gp_Circ cir2 = gp_Circ(gp_Ax2(gp_Pnt(566.11, -88.58, 0), gp_Dir(0, 0, -1)), 17.86);
|
||||
TopoDS_Edge E_cir2 = BRepBuilderAPI_MakeEdge(cir2);
|
||||
dim1 = new AIS_RadiusDimension(E_cir2);
|
||||
anAspect->ArrowAspect()->SetLength (40.0);
|
||||
dim1->SetDimensionAspect (anAspect);
|
||||
context->Display(dim1);
|
||||
|
||||
return 0;
|
||||
|
@ -385,20 +385,20 @@ void TPrsStd_ConstraintTools::ComputeDistance (const Handle(TDataXtd_Constraint)
|
||||
if( SaveDrw ) ais->SetAttributes(aDrawer);
|
||||
}
|
||||
else {
|
||||
if (isface) {
|
||||
ais->SetFirstShape (GetFace(shape1));
|
||||
ais->SetSecondShape (GetFace(shape2));
|
||||
if (isface)
|
||||
{
|
||||
ais->SetMeasuredGeometry (GetFace(shape1), GetFace(shape2));
|
||||
}
|
||||
else {
|
||||
ais->SetFirstShape (shape1);
|
||||
ais->SetSecondShape (shape2);
|
||||
else
|
||||
{
|
||||
ais->SetMeasuredShapes (shape1, shape2);
|
||||
}
|
||||
if (is2vertices) { //addition 3
|
||||
gp_Pnt P1 = BRep_Tool::Pnt( TopoDS::Vertex(shape1) );
|
||||
gp_Pnt P2 = BRep_Tool::Pnt( TopoDS::Vertex(shape2) );
|
||||
gp_Pnt P3(P1.Y()-1., P2.X()+1., 0.);
|
||||
GC_MakePlane mkPlane(P1, P2, P3);
|
||||
ais->SetWorkingPlane( mkPlane.Value()->Pln() );
|
||||
ais->SetCustomPlane( mkPlane.Value()->Pln() );
|
||||
}
|
||||
|
||||
ais->SetCustomValue (val1);
|
||||
@ -406,7 +406,7 @@ void TPrsStd_ConstraintTools::ComputeDistance (const Handle(TDataXtd_Constraint)
|
||||
|
||||
if (is_planar)
|
||||
{
|
||||
ais->SetWorkingPlane (aplane->Pln());
|
||||
ais->SetCustomPlane (aplane->Pln());
|
||||
}
|
||||
anAIS = ais;
|
||||
}
|
||||
@ -772,7 +772,7 @@ void TPrsStd_ConstraintTools::ComputeAngleForOneFace (const Handle(TDataXtd_Cons
|
||||
ais = new AIS_AngleDimension (face);
|
||||
}
|
||||
else {
|
||||
ais->SetFirstShape(TopoDS::Face( shape ), Standard_True);
|
||||
ais->SetMeasuredGeometry(TopoDS::Face( shape ));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -1001,20 +1001,17 @@ void TPrsStd_ConstraintTools::ComputeAngle (const Handle(TDataXtd_Constraint)& a
|
||||
GetGoodShape(shape1);
|
||||
GetGoodShape(shape2);
|
||||
ais = new AIS_AngleDimension (TopoDS::Edge(shape1),
|
||||
TopoDS::Edge(shape2),
|
||||
((Handle(Geom_Plane)&) ageom3)->Pln());
|
||||
TopoDS::Edge(shape2));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isCurvilinear) {
|
||||
ais = new AIS_AngleDimension (TopoDS::Face(shape1),
|
||||
TopoDS::Face(shape2),
|
||||
((Handle(Geom_Line)&) ageom3)->Position());
|
||||
TopoDS::Face(shape2));
|
||||
}
|
||||
else if (isface) {
|
||||
ais = new AIS_AngleDimension (TopoDS::Face(shape1),
|
||||
TopoDS::Face(shape2),
|
||||
((Handle(Geom_Line)&) ageom3)->Position());
|
||||
TopoDS::Face(shape2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1024,15 +1021,14 @@ void TPrsStd_ConstraintTools::ComputeAngle (const Handle(TDataXtd_Constraint)& a
|
||||
GetGoodShape(shape1);
|
||||
GetGoodShape(shape2);
|
||||
}
|
||||
ais->SetFirstShape(shape1);
|
||||
ais->SetSecondShape(shape2);
|
||||
ais->SetMeasuredGeometry (TopoDS::Face (shape1), TopoDS::Face (shape2));
|
||||
if (isplan)
|
||||
ais->SetWorkingPlane (((Handle(Geom_Plane)&) ageom3)->Pln());
|
||||
ais->SetCustomPlane (((Handle(Geom_Plane)&) ageom3)->Pln());
|
||||
else if (!isCurvilinear)
|
||||
{
|
||||
gp_Pln aPlane;
|
||||
aPlane.SetAxis (((Handle(Geom_Line)&) ageom3)->Position());
|
||||
ais->SetWorkingPlane (aPlane);
|
||||
ais->SetCustomPlane (aPlane);
|
||||
}
|
||||
}
|
||||
anAIS = ais;
|
||||
@ -1165,7 +1161,7 @@ void TPrsStd_ConstraintTools::ComputeRadius (const Handle(TDataXtd_Constraint)&
|
||||
ais = new AIS_RadiusDimension (shape1);
|
||||
}
|
||||
else {
|
||||
ais->SetFirstShape(shape1);
|
||||
ais->SetMeasuredGeometry(shape1);
|
||||
}
|
||||
}
|
||||
else ais = new AIS_RadiusDimension (shape1);
|
||||
@ -1181,7 +1177,7 @@ void TPrsStd_ConstraintTools::ComputeRadius (const Handle(TDataXtd_Constraint)&
|
||||
NullifyAIS(anAIS);
|
||||
return;
|
||||
}
|
||||
ais->SetWorkingPlane(aplane->Pln());
|
||||
ais->SetCustomPlane(aplane->Pln());
|
||||
}
|
||||
anAIS = ais;
|
||||
}
|
||||
@ -1626,7 +1622,7 @@ void TPrsStd_ConstraintTools::ComputeDiameter(const Handle(TDataXtd_Constraint)&
|
||||
ais = new AIS_DiameterDimension (shape1);
|
||||
}
|
||||
else {
|
||||
ais->SetFirstShape(shape1);
|
||||
ais->SetMeasuredGeometry(shape1);
|
||||
}
|
||||
}
|
||||
else ais = new AIS_DiameterDimension (shape1);
|
||||
@ -1642,7 +1638,7 @@ void TPrsStd_ConstraintTools::ComputeDiameter(const Handle(TDataXtd_Constraint)&
|
||||
NullifyAIS(anAIS);
|
||||
return;
|
||||
}
|
||||
//ais->SetWorkingPlane(aplane);
|
||||
//ais->SetCustomPlane(aplane);
|
||||
}
|
||||
anAIS = ais;
|
||||
}
|
||||
@ -1780,13 +1776,12 @@ void TPrsStd_ConstraintTools::ComputeOffset (const Handle(TDataXtd_Constraint)&
|
||||
}
|
||||
else
|
||||
{
|
||||
ais->SetFirstShape(S1);
|
||||
ais->SetSecondShape(S2);
|
||||
ais->SetMeasuredShapes (S1, S2);
|
||||
ais->SetCustomValue(val1);
|
||||
}
|
||||
|
||||
if (is_planar)
|
||||
ais->SetWorkingPlane (aplane->Pln());
|
||||
ais->SetCustomPlane (aplane->Pln());
|
||||
anAIS = ais;
|
||||
return;
|
||||
}
|
||||
@ -1818,11 +1813,10 @@ void TPrsStd_ConstraintTools::ComputeOffset (const Handle(TDataXtd_Constraint)&
|
||||
ais = new AIS_LengthDimension (S1,S2,aplane->Pln());
|
||||
}
|
||||
else {
|
||||
ais->SetFirstShape(S1);
|
||||
ais->SetSecondShape(S2);
|
||||
ais->SetMeasuredShapes (S1, S2);
|
||||
ais->SetCustomValue(val1);
|
||||
|
||||
ais->SetWorkingPlane (aplane->Pln());
|
||||
ais->SetCustomPlane (aplane->Pln());
|
||||
}
|
||||
anAIS = ais;
|
||||
return;
|
||||
@ -1891,10 +1885,9 @@ void TPrsStd_ConstraintTools::ComputeOffset (const Handle(TDataXtd_Constraint)&
|
||||
ais = new AIS_LengthDimension (S1,S2,aplane->Pln());
|
||||
}
|
||||
else {
|
||||
ais->SetFirstShape (S1);
|
||||
ais->SetSecondShape (S2);
|
||||
ais->SetMeasuredShapes (S1, S2);
|
||||
ais->SetCustomValue (val1);
|
||||
ais->SetWorkingPlane (aplane->Pln ());
|
||||
ais->SetCustomPlane (aplane->Pln ());
|
||||
}
|
||||
anAIS = ais;
|
||||
return;
|
||||
@ -2150,7 +2143,7 @@ void TPrsStd_ConstraintTools::ComputeRound(const Handle(TDataXtd_Constraint)& aC
|
||||
ais = new AIS_RadiusDimension(shape1);
|
||||
}
|
||||
else {
|
||||
ais->SetFirstShape(shape1);
|
||||
ais->SetMeasuredGeometry(shape1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -616,7 +616,7 @@ static int VAngleDimBuilder(Draw_Interpretor& di, Standard_Integer argc, const c
|
||||
TheAISContext()->CloseLocalContext(myCurrentIndex);
|
||||
|
||||
// Construction de l'AIS dimension
|
||||
Handle (AIS_AngleDimension) myAISDim= new AIS_AngleDimension (TopoDS::Edge(ShapeA) ,TopoDS::Edge(ShapeB) ,theGeomPlane->Pln());
|
||||
Handle (AIS_AngleDimension) myAISDim= new AIS_AngleDimension (TopoDS::Edge(ShapeA) ,TopoDS::Edge(ShapeB));
|
||||
GetMapOfAIS().Bind (myAISDim,argv[1]);
|
||||
TheAISContext()->Display(myAISDim );
|
||||
|
||||
@ -1534,10 +1534,10 @@ static int VLenghtDimension(Draw_Interpretor& di, Standard_Integer argc, const c
|
||||
TopoDS_Vertex Va,Vc;
|
||||
TopExp::Vertices(EdFromA,Va,Vc);
|
||||
gp_Pnt A=BRep_Tool::Pnt(Va);
|
||||
|
||||
#ifdef DEB
|
||||
gp_Pnt C=
|
||||
gp_Pnt C = BRep_Tool::Pnt(Vc);
|
||||
#endif
|
||||
BRep_Tool::Pnt(Vc);
|
||||
|
||||
// On projette le point B sur la Face car il
|
||||
// n'existe pas de constructeurs AIS_LD PointFace
|
||||
|
Loading…
x
Reference in New Issue
Block a user