1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0024133: Development of improvement of dimensions implementation; new length, radius,diameter and angle dimensions.

Some corrections; test cases were added; coding standards in MFC samples & presentations
Request stencil buffer for Linux.
correct test cases; correct compilation errors
compilation warnings (gcc/Linux)
This commit is contained in:
aba 2013-10-31 16:49:38 +04:00 committed by bugmaster
parent 7c633a3eab
commit a6eb515f9d
137 changed files with 7591 additions and 6616 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -303,6 +303,7 @@ BEGIN
BUTTON ID_OBJECT_DISPLAYALL
SEPARATOR
BUTTON ID_OBJECT_REMOVE
BUTTON ID_OBJECT_DIM
END
@ -371,10 +372,6 @@ BEGIN
BEGIN
MENUITEM "Background Color...", ID_Modify_ChangeBackground
END
POPUP "User cylinder"
BEGIN
MENUITEM "Change face color", ID_USERCYLINDER_CHANGEFACECOLOR
END
POPUP "Object(s)"
BEGIN
MENUITEM "Erase", ID_OBJECT_ERASE
@ -408,6 +405,10 @@ BEGIN
END
MENUITEM "Transparency...", ID_OBJECT_TRANSPARENCY
END
POPUP "User cylinder"
BEGIN
MENUITEM "Change face color", ID_USERCYLINDER_CHANGEFACECOLOR
END
END
@ -514,6 +515,12 @@ BEGIN
ID_TEXTURE_ON "Run texture example\nRun texture example"
END
STRINGTABLE
BEGIN
ID_OBJECT_DIMENSIONS "Add dimensions"
ID_LOCALCONTEXT_ADDDIMENSION "Add new dimension for selected objetcs"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////

View File

@ -77,6 +77,7 @@ END_MESSAGE_MAP()
// CViewer3dDoc construction/destruction
CViewer3dDoc::CViewer3dDoc()
:OCC_3dDoc()
{
myCylinder.Nullify();
mySphere.Nullify();
@ -86,21 +87,9 @@ CViewer3dDoc::CViewer3dDoc()
myOverlappedBox.Nullify();
myOffsetDlg = NULL;
myStaticTrihedronAxisIsDisplayed = FALSE;
myState = -1;
isTextureSampleStarted = FALSE;
/*
// TODO: add one-time construction code here
Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice =
((CViewer3dApp*)AfxGetApp())->GetGraphicDevice();
myViewer = new V3d_Viewer(theGraphicDevice,(short *) "Visu3D");
myViewer->SetDefaultLights();
myViewer->SetLightOn();
*/
// myViewer->SetDefaultBackgroundColor(Quantity_TOC_RGB, 0.,0.,0.);
myPresentation = OCCDemo_Presentation::Current;
myPresentation->SetDocument(this);
@ -702,39 +691,22 @@ void CViewer3dDoc::OnUpdateOptionsTrihedronStaticTrihedron(CCmdUI* pCmdUI)
}
void CViewer3dDoc::Popup( const Standard_Integer x,
const Standard_Integer y ,
const Handle(V3d_View)& aView )
void CViewer3dDoc::Popup (const Standard_Integer x,
const Standard_Integer y ,
const Handle(V3d_View)& aView)
{
Standard_Integer PopupMenuNumber=0;
myAISContext->InitCurrent();
if (myAISContext->MoreCurrent()) {
if (myAISContext->Current()->IsKind(STANDARD_TYPE(User_Cylinder)))
return;
else
PopupMenuNumber = 1;
}
CMenu menu;
VERIFY(menu.LoadMenu(IDR_Popup3D));
CMenu* pPopup = menu.GetSubMenu(PopupMenuNumber);
ASSERT(pPopup != NULL);
if (PopupMenuNumber == 1) // more than 1 object.
myPopupMenuNumber=0;
// Specified check for context menu number to call
myAISContext->InitCurrent();
if (myAISContext->MoreCurrent())
{
bool OneOrMoreInShading = false;
for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ())
if (myAISContext->IsDisplayed(myAISContext->Current(),1)) OneOrMoreInShading=true;
if(!OneOrMoreInShading)
pPopup->EnableMenuItem(5, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);
}
POINT winCoord = { x , y };
Handle(WNT_Window) aWNTWindow=
Handle(WNT_Window)::DownCast(aView->Window());
ClientToScreen ( (HWND)(aWNTWindow->HWindow()),&winCoord);
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON , winCoord.x, winCoord.y ,
AfxGetMainWnd());
if (myAISContext->Current()->IsKind(STANDARD_TYPE(User_Cylinder)))
{
myPopupMenuNumber = 2;
//return;
}
}
OCC_3dBaseDoc::Popup(x,y, aView);
}
//Set faces selection mode

View File

@ -0,0 +1,163 @@
// AngleParamsVerticesPage.cpp : implementation file
//
#include "stdafx.h"
#include "AngleParamsVerticesPage.h"
#include "DimensionDlg.h"
#include <AIS_InteractiveContext.hxx>
#include <AIS_LocalContext.hxx>
#include <AIS_LengthDimension.hxx>
#include <AIS_AngleDimension.hxx>
#include <BRep_Tool.hxx>
#include <GC_MakePlane.hxx>
#include <Prs3d_DimensionAspect.hxx>
// CAngleParamsVerticesPage dialog
IMPLEMENT_DYNAMIC(CAngleParamsVerticesPage, CDialog)
//=======================================================================
//function : CAngleParamsVerticesPage
//purpose :
//=======================================================================
CAngleParamsVerticesPage::CAngleParamsVerticesPage (Handle(AIS_InteractiveContext) theAISContext,
CWnd* pParent /*=NULL*/)
: CDialog(CAngleParamsVerticesPage::IDD, pParent)
{
myAISContext = theAISContext;
}
//=======================================================================
//function : ~CAngleParamsVerticesPage
//purpose :
//=======================================================================
CAngleParamsVerticesPage::~CAngleParamsVerticesPage()
{
}
//=======================================================================
//function : DoDataExchange
//purpose :
//=======================================================================
void CAngleParamsVerticesPage::DoDataExchange (CDataExchange* pDX)
{
CDialog::DoDataExchange (pDX);
}
BEGIN_MESSAGE_MAP(CAngleParamsVerticesPage, CDialog)
ON_BN_CLICKED(IDC_BUTTON1, &CAngleParamsVerticesPage::OnBnClickedVertex1Btn)
ON_BN_CLICKED(IDC_BUTTON3, &CAngleParamsVerticesPage::OnBnClickedVertex2Btn)
ON_BN_CLICKED(IDC_BUTTON4, &CAngleParamsVerticesPage::OnBnClickedVertex3Btn)
END_MESSAGE_MAP()
//=======================================================================
//function : OnBnClickedVertex1Btn
//purpose :
//=======================================================================
void CAngleParamsVerticesPage::OnBnClickedVertex1Btn()
{
// Open local context and choose the vertex for angle dimensions
if (!myAISContext->HasOpenedContext())
{
myAISContext->OpenLocalContext();
myAISContext->ActivateStandardMode(TopAbs_VERTEX);
AfxMessageBox (_T ("Local context was not opened. Choose the edge and press the button again"),
MB_ICONINFORMATION | MB_OK);
return;
}
// Now it's ok, local context is opened and edge selection mode is activated
// Check if some vertex is selected
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
{
AfxMessageBox (_T ("Choose the vertex and press the button again"),
MB_ICONINFORMATION | MB_OK);
return;
}
myFirstVertex = TopoDS::Vertex (myAISContext->LocalContext()->SelectedShape());
myAISContext->LocalContext()->ClearSelected();
}
//=======================================================================
//function : OnBnClickedVertex2Btn
//purpose :
//=======================================================================
void CAngleParamsVerticesPage::OnBnClickedVertex2Btn()
{
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
{
AfxMessageBox ( _T("Choose the vertex and press the button again"), MB_ICONINFORMATION | MB_OK);
return;
}
mySecondVertex = TopoDS::Vertex (myAISContext->LocalContext()->SelectedShape());
myAISContext->LocalContext()->ClearSelected();
}
//=======================================================================
//function : OnBnClickedVertex3Btn
//purpose :
//=======================================================================
void CAngleParamsVerticesPage::OnBnClickedVertex3Btn()
{
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
{
AfxMessageBox (_T ("Choose the vertex and press the button again"), MB_ICONINFORMATION | MB_OK);
return;
}
myThirdVertex = TopoDS::Vertex (myAISContext->LocalContext()->SelectedShape());
myAISContext->LocalContext()->ClearSelected();
//Build dimension here
TopoDS_Edge anEdge12 = BRepBuilderAPI_MakeEdge (myFirstVertex, mySecondVertex);
TopoDS_Edge anEdge23 = BRepBuilderAPI_MakeEdge (mySecondVertex, myThirdVertex);
CDimensionDlg *aDimDlg = (CDimensionDlg*)(GetParentOwner());
gp_Pnt aP1 = BRep_Tool::Pnt (myFirstVertex),
aP2 = BRep_Tool::Pnt (mySecondVertex),
aP3 = BRep_Tool::Pnt (myThirdVertex);
GC_MakePlane aPlaneBuilder (aP1,aP2,aP3);
Handle(Geom_Plane) aPlane = aPlaneBuilder.Value();
Handle(AIS_AngleDimension) anAngleDim = new AIS_AngleDimension (aP1,aP2,aP3);
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());
anAngleDim->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
if (anAngleDim->IsUnitsDisplayed())
{
anAngleDim->SetDisplayUnits (aDimDlg->GetUnits());
if ((anAngleDim->DisplayUnits().IsEqual (TCollection_AsciiString ("deg"))))
{
anAngleDim->MakeUnitsDisplayed (Standard_False);
}
else
{
anAngleDim->SetDisplaySpecialSymbol (AIS_DSS_No);
}
}
anAngleDim->SetDimensionAspect (anAspect);
myAISContext->CloseAllContexts();
myAISContext->Display (anAngleDim);
myAISContext->OpenLocalContext();
myAISContext->ActivateStandardMode (TopAbs_VERTEX);
}

View File

@ -0,0 +1,31 @@
#pragma once
#include "res\OCC_Resource.h"
// CAngleParamsVerticesPage dialog
class CAngleParamsVerticesPage : public CDialog
{
DECLARE_DYNAMIC(CAngleParamsVerticesPage)
private:
Handle(AIS_InteractiveContext) myAISContext;
TopoDS_Vertex myFirstVertex;
TopoDS_Vertex mySecondVertex;
TopoDS_Vertex myThirdVertex;
public:
CAngleParamsVerticesPage(Handle (AIS_InteractiveContext) theAISContext,
CWnd* pParent = NULL); // standard constructor
virtual ~CAngleParamsVerticesPage();
// Dialog Data
enum { IDD = IDD_AngleParamsVerticesPage };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedVertex1Btn();
afx_msg void OnBnClickedVertex2Btn();
afx_msg void OnBnClickedVertex3Btn();
};

View File

@ -0,0 +1,686 @@
// CDimensionDlg.cpp : implementation file
//
#include "stdafx.h"
#include "DimensionDlg.h"
#include "LengthParamsEdgePage.h"
#include "LengthParamsVerticesPage.h"
#include "LengthParamsEdgesPage.h"
#include "AngleParamsVerticesPage.h"
#include "RadiusParamsPage.h"
#include <Standard_Macro.hxx>
#include <AIS_InteractiveContext.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <AIS_LocalContext.hxx>
#include <Quantity_Color.hxx>
BEGIN_MESSAGE_MAP(CDimensionDlg, CDialog)
ON_BN_CLICKED(IDOK, &CDimensionDlg::OnBnClickedOk)
ON_BN_CLICKED(IDC_DimLength, &CDimensionDlg::OnBnClickedDimLength)
ON_BN_CLICKED(IDC_DimAngle, &CDimensionDlg::OnBnClickedDimAngle)
ON_BN_CLICKED(IDC_DimRadius, &CDimensionDlg::OnBnClickedDimRadius)
ON_NOTIFY(TCN_SELCHANGE, IDC_LengthTab, &CDimensionDlg::OnTcnSelChangeLengthTab)
ON_NOTIFY(TCN_SELCHANGING, IDC_LengthTab, &CDimensionDlg::OnTcnSelChangingLengthTab)
ON_WM_DESTROY()
ON_NOTIFY(TCN_SELCHANGE, IDC_AngleTab, &CDimensionDlg::OnTcnSelChangeAngleTab)
ON_NOTIFY(TCN_SELCHANGING, IDC_AngleTab, &CDimensionDlg::OnTcnSelChangingAngleTab)
ON_BN_CLICKED(IDC_DimDiameter, &CDimensionDlg::OnBnClickedDimDiameter)
ON_BN_CLICKED(IDC_2DText, &CDimensionDlg::OnBnClicked2dText)
ON_BN_CLICKED(IDC_3DText, &CDimensionDlg::OnBnClicked3dText)
ON_BN_CLICKED(IDC_DimensionColor, &CDimensionDlg::OnBnClickedDimensionColor)
END_MESSAGE_MAP()
//=======================================================================
//function : CDimensionDlg
//purpose :
//=======================================================================
CDimensionDlg::CDimensionDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDimensionDlg::IDD, pParent),
mySelectedDimType(0),
myFontSize (10),
myDimensionColor (Quantity_NOC_LAWNGREEN)
{
}
//=======================================================================
//function : CDimensionDlg
//purpose :
//=======================================================================
CDimensionDlg::CDimensionDlg (Handle(AIS_InteractiveContext) &theAISContext,
CWnd* pParent)
: CDialog(CDimensionDlg::IDD, pParent),
mySelectedDimType(0),
myFontSize (10),
myDimensionColor (Quantity_NOC_LAWNGREEN)
{
myAISContext = theAISContext;
}
//=======================================================================
//function : ~CDimensionDlg
//purpose :
//=======================================================================
CDimensionDlg::~CDimensionDlg()
{
}
//=======================================================================
//function : SetContext
//purpose :
//=======================================================================
void CDimensionDlg::SetContext (const Handle(AIS_InteractiveContext) theContext)
{
myAISContext = theContext;
}
//=======================================================================
//function : OnInitDialog
//purpose : Initialization of dialog fields and parameters
//=======================================================================
BOOL CDimensionDlg::OnInitDialog()
{
CDialog::OnInitDialog();
myLengthParams = (CTabCtrl*) GetDlgItem (IDC_LengthTab);
myAngleParams = (CTabCtrl*) GetDlgItem (IDC_AngleTab);
myRadiusParams = (CTabCtrl*) GetDlgItem (IDC_RadiusTab);
myDiameterParams = (CTabCtrl*) GetDlgItem (IDC_DiameterTab);
CreateLengthParamsTab();
CreateAngleParamsTab();
CreateRadiusParamsTab();
CreateDiameterParamsTab( );
myLengthParams->ShowWindow (SW_SHOW);
myAngleParams->ShowWindow (SW_HIDE);
myRadiusParams->ShowWindow (SW_HIDE);
myDiameterParams->ShowWindow (SW_HIDE);
// Setting default values
((CSliderCtrl*)GetDlgItem(IDC_Flyout))->SetRange (-30,30,true);
((CSliderCtrl*)GetDlgItem(IDC_Flyout))->SetPos (15);
UpdateUnitsListForLength ();
((CComboBox*)GetDlgItem (IDC_DisplayUnits))->SetCurSel (1);
CheckRadioButton (IDC_2DText, IDC_3DText, IDC_2DText);
SetTextModeControlsVisible (false);
CComboBox* aCombo =(CComboBox* )GetDlgItem (IDC_FontSize);
aCombo->SelectString (0,"10");
UpdateData (FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//=======================================================================
//function : DoDataExchange
//purpose : Updating of dialog data if it's needed
//=======================================================================
void CDimensionDlg::DoDataExchange (CDataExchange* pDX)
{
CDialog::DoDataExchange (pDX);
DDX_Radio (pDX, IDC_DimLength, mySelectedDimType);
}
//=======================================================================
//function : OnBnClickedOk
//purpose : Reset all local contexts and close the dimension dialog
//=======================================================================
void CDimensionDlg::OnBnClickedOk()
{
if (myAISContext->HasOpenedContext())
{
myAISContext->CloseAllContexts();
}
OnOK();
}
//=======================================================================
//function : GetFlyout
//purpose : Only for length dimensions! Gets flyout value
//=======================================================================
const Standard_Real CDimensionDlg::GetFlyout() const
{
return ((CSliderCtrl*)GetDlgItem(IDC_Flyout))->GetPos();
}
//=======================================================================
//function : CreateLengthParamsTab
//purpose : Fill tab control for length dimensions
//=======================================================================
void CDimensionDlg::CreateLengthParamsTab()
{
TC_ITEM aTabItem;
aTabItem.mask = TCIF_TEXT;
aTabItem.pszText = "Edge";
myLengthParams->InsertItem (0, &aTabItem);
aTabItem.pszText = "Vertices";
myLengthParams->InsertItem (1, &aTabItem);
aTabItem.pszText = "Parallel edges";
myLengthParams->InsertItem (2, &aTabItem);
CLengthParamsEdgePage *aPage1 = new CLengthParamsEdgePage (myAISContext);
aTabItem.mask = TCIF_PARAM;
aTabItem.lParam = (LPARAM)aPage1;
myLengthParams->SetItem (0, &aTabItem);
VERIFY (aPage1->Create (CLengthParamsEdgePage::IDD,myLengthParams));
aPage1->SetWindowPos (NULL,10,30,0,0,SWP_NOSIZE | SWP_NOZORDER);
aPage1->ShowWindow (SW_SHOW);
CLengthParamsVerticesPage *aPage2 = new CLengthParamsVerticesPage (myAISContext);
aTabItem.mask = TCIF_PARAM;
aTabItem.lParam = (LPARAM)aPage2;
myLengthParams->SetItem (1, &aTabItem);
VERIFY (aPage2->Create (CLengthParamsVerticesPage::IDD,myLengthParams));
aPage2->SetWindowPos (NULL,10,30,0,0,SWP_NOSIZE | SWP_NOZORDER);
CLengthParamsEdgesPage *aPage3 = new CLengthParamsEdgesPage (myAISContext);
aTabItem.mask = TCIF_PARAM;
aTabItem.lParam = (LPARAM)aPage3;
myLengthParams->SetItem (2, &aTabItem);
VERIFY (aPage3->Create (CLengthParamsEdgesPage::IDD,myLengthParams));
aPage3->SetWindowPos (NULL,10,30,0,0,SWP_NOSIZE | SWP_NOZORDER);
}
//=======================================================================
//function : CreateAngleParamsTab
//purpose : Fill tab control for angle dimensions
//=======================================================================
void CDimensionDlg::CreateAngleParamsTab()
{
TC_ITEM aTabItem;
aTabItem.mask = TCIF_TEXT;
aTabItem.pszText = "Two edges";
myAngleParams->InsertItem (0, &aTabItem);
aTabItem.pszText = "Three vertices";
myAngleParams->InsertItem (1, &aTabItem);
CLengthParamsEdgesPage *aPage1 = new CLengthParamsEdgesPage (myAISContext, true);
aTabItem.mask = TCIF_PARAM;
aTabItem.lParam = (LPARAM)aPage1;
myAngleParams->SetItem (0, &aTabItem);
VERIFY (aPage1->Create (CLengthParamsEdgesPage::IDD,myAngleParams));
aPage1->SetWindowPos (NULL,10,30,0,0,SWP_NOSIZE | SWP_NOZORDER);
aPage1->ShowWindow (SW_SHOW);
CAngleParamsVerticesPage *aPage2 = new CAngleParamsVerticesPage (myAISContext);
aTabItem.mask = TCIF_PARAM;
aTabItem.lParam = (LPARAM)aPage2;
myAngleParams->SetItem (1, &aTabItem);
VERIFY (aPage2->Create (CAngleParamsVerticesPage::IDD,myAngleParams));
aPage2->SetWindowPos (NULL,10,30,0,0,SWP_NOSIZE | SWP_NOZORDER);
}
//=======================================================================
//function : CreateRadiusParamsTab
//purpose : Fill tab control for radius dimensions
//=======================================================================
void CDimensionDlg::CreateRadiusParamsTab()
{
TC_ITEM aTabItem;
aTabItem.mask = TCIF_TEXT;
aTabItem.pszText = "Circle or arc";
myRadiusParams->InsertItem (0, &aTabItem);
CRadiusParamsPage *aPage1 = new CRadiusParamsPage (myAISContext);
aTabItem.mask = TCIF_PARAM;
aTabItem.lParam = (LPARAM)aPage1;
myRadiusParams->SetItem (0, &aTabItem);
VERIFY (aPage1->Create (CRadiusParamsPage::IDD,myRadiusParams));
aPage1->SetWindowPos (NULL,10,30,0,0,SWP_NOSIZE | SWP_NOZORDER);
aPage1->ShowWindow (SW_SHOW);
}
//=======================================================================
//function : CreateDiameterParamsTab
//purpose : Fill tab control for diameter dimensions
//=======================================================================
void CDimensionDlg::CreateDiameterParamsTab()
{
TC_ITEM aTabItem;
aTabItem.mask = TCIF_TEXT;
aTabItem.pszText = "Circle or arc";
myDiameterParams->InsertItem (0, &aTabItem);
CRadiusParamsPage *aPage1 = new CRadiusParamsPage (myAISContext,Standard_True);
aTabItem.mask = TCIF_PARAM;
aTabItem.lParam = (LPARAM)aPage1;
myRadiusParams->SetItem (0, &aTabItem);
VERIFY (aPage1->Create (CRadiusParamsPage::IDD,myDiameterParams));
aPage1->SetWindowPos (NULL,10,30,0,0,SWP_NOSIZE | SWP_NOZORDER);
aPage1->ShowWindow (SW_SHOW);
}
//=======================================================================
//function : UpdateStandardModeForAngle
//purpose :
//=======================================================================
void CDimensionDlg::UpdateStandardModeForAngle()
{
int aTabNum = ((CTabCtrl*) GetDlgItem (IDC_AngleTab))->GetCurSel();
myAISContext->CloseAllContexts();
myAISContext->OpenLocalContext();
myAISContext->ActivateStandardMode (aTabNum == 1 ? TopAbs_VERTEX : TopAbs_EDGE);
}
//=======================================================================
//function : UpdateStandardModeForLength
//purpose :
//=======================================================================
void CDimensionDlg::UpdateStandardModeForLength()
{
int aTabNum = ((CTabCtrl*) GetDlgItem (IDC_LengthTab))->GetCurSel();
myAISContext->CloseAllContexts();
myAISContext->OpenLocalContext();
myAISContext->ActivateStandardMode (aTabNum == 1 ? TopAbs_VERTEX : TopAbs_EDGE);
}
//=======================================================================
//function : UpdateStandardModeForLength
//purpose :
//=======================================================================
void CDimensionDlg::UpdateStandardMode()
{
int aCurIndex = GetCheckedRadioButton (IDC_DimLength, IDC_DimDiameter);
switch (aCurIndex)
{
case IDC_DimLength:
UpdateStandardModeForLength();
break;
case IDC_DimAngle:
UpdateStandardModeForAngle();
break;
case IDC_DimRadius:
case IDC_DimDiameter:
{
myAISContext->OpenLocalContext();
myAISContext->ActivateStandardMode (TopAbs_EDGE);
}
break;
}
}
//=======================================================================
//function : OnBnClickedDimLength
//purpose : it is called when <Length> radio button is chosen
//=======================================================================
void CDimensionDlg::OnBnClickedDimLength()
{
// Update parameters
UpdateStandardModeForLength ();
(CTabCtrl*) GetDlgItem (IDC_LengthTab)->ShowWindow (SW_SHOW);
(CTabCtrl*) GetDlgItem (IDC_AngleTab)->ShowWindow (SW_HIDE);
(CTabCtrl*) GetDlgItem (IDC_RadiusTab)->ShowWindow (SW_HIDE);
(CTabCtrl*) GetDlgItem (IDC_DiameterTab)->ShowWindow (SW_HIDE);
UpdateUnitsListForLength ();
((CSliderCtrl*)GetDlgItem(IDC_Flyout))->SetPos (15);
}
//=======================================================================
//function : OnBnClickedDimAngle
//purpose : it is called when <Angle> radio button is chosen
//=======================================================================
void CDimensionDlg::OnBnClickedDimAngle()
{
// Update parameters
UpdateStandardModeForAngle();
(CTabCtrl*) GetDlgItem (IDC_LengthTab)->ShowWindow (SW_HIDE);
(CTabCtrl*) GetDlgItem (IDC_AngleTab)->ShowWindow (SW_SHOW);
(CTabCtrl*) GetDlgItem (IDC_RadiusTab)->ShowWindow (SW_HIDE);
(CTabCtrl*) GetDlgItem (IDC_DiameterTab)->ShowWindow (SW_HIDE);
UpdateUnitsListForAngle();
((CSliderCtrl*)GetDlgItem(IDC_Flyout))->SetPos (15);
}
//=======================================================================
//function : OnBnClickedDimDiameter
//purpose : it is called when <Diameter> radio button is chosen
//=======================================================================
void CDimensionDlg::OnBnClickedDimDiameter()
{
// Update parameters
myAISContext->CloseAllContexts();
myAISContext->OpenLocalContext();
myAISContext->ActivateStandardMode (TopAbs_EDGE);
(CTabCtrl*) GetDlgItem (IDC_LengthTab)->ShowWindow (SW_HIDE);
(CTabCtrl*) GetDlgItem (IDC_AngleTab)->ShowWindow (SW_HIDE);
(CTabCtrl*) GetDlgItem (IDC_RadiusTab)->ShowWindow (SW_HIDE);
(CTabCtrl*) GetDlgItem (IDC_DiameterTab)->ShowWindow (SW_SHOW);
UpdateUnitsListForLength();
((CSliderCtrl*)GetDlgItem(IDC_Flyout))->SetPos (0);
}
//=======================================================================
//function : OnBnClickedDimRadius
//purpose : it is called when <Radius> radio button is chosen
//=======================================================================
void CDimensionDlg::OnBnClickedDimRadius()
{
// Update parameters
myAISContext->CloseAllContexts();
myAISContext->OpenLocalContext();
myAISContext->ActivateStandardMode (TopAbs_EDGE);
(CTabCtrl*) GetDlgItem (IDC_LengthTab)->ShowWindow (SW_HIDE);
(CTabCtrl*) GetDlgItem (IDC_AngleTab)->ShowWindow (SW_HIDE);
(CTabCtrl*) GetDlgItem (IDC_RadiusTab)->ShowWindow (SW_SHOW);
(CTabCtrl*) GetDlgItem (IDC_DiameterTab)->ShowWindow (SW_HIDE);
UpdateUnitsListForLength();
((CSliderCtrl*)GetDlgItem(IDC_Flyout))->SetPos (0);
}
//=======================================================================
//function : OnTcnSelChangeLengthTab
//purpose : it is called when in Length tab control current tab was changed
//=======================================================================
void CDimensionDlg::OnTcnSelChangeLengthTab (NMHDR *pNMHDR, LRESULT *pResult)
{
// Show this chosen tab page
int aTabNum = ((CTabCtrl*) GetDlgItem (IDC_LengthTab))->GetCurSel();
TC_ITEM anItem;
anItem.mask = TCIF_PARAM;
((CTabCtrl*) GetDlgItem (IDC_LengthTab))->GetItem (aTabNum, &anItem);
ASSERT(anItem.lParam);
CWnd *aWnd = (CWnd*)anItem.lParam;
aWnd->ShowWindow (SW_SHOW);
UpdateStandardModeForLength();
*pResult = 0;
}
//=======================================================================
//function : OnTcnSelChangingLengthTab
//purpose : it is called when in Length tab control current tab
// is changing
// It is used to hide the current tab here to prevent collisions.
//=======================================================================
void CDimensionDlg::OnTcnSelChangingLengthTab (NMHDR *pNMHDR, LRESULT *pResult)
{
// Hide current tab page
int aTabNum = ((CTabCtrl*) GetDlgItem (IDC_LengthTab))->GetCurSel();
TC_ITEM anItem;
anItem.mask = TCIF_PARAM;
((CTabCtrl*) GetDlgItem (IDC_LengthTab))->GetItem (aTabNum, &anItem);
ASSERT (anItem.lParam);
CWnd *aWnd = (CWnd*)anItem.lParam;
aWnd->ShowWindow (SW_HIDE);
*pResult = 0;
}
//=======================================================================
//function : OnTcnSelChangeAngleTab
//purpose : it is called when in Angle tab control current tab was changed
//=======================================================================
void CDimensionDlg::OnTcnSelChangeAngleTab (NMHDR *pNMHDR, LRESULT *pResult)
{
int aTabNum = ((CTabCtrl*) GetDlgItem (IDC_AngleTab))->GetCurSel();
TC_ITEM anItem;
anItem.mask = TCIF_PARAM;
((CTabCtrl*) GetDlgItem (IDC_AngleTab))->GetItem (aTabNum, &anItem);
ASSERT (anItem.lParam);
CWnd *aWnd = (CWnd*)anItem.lParam;
aWnd->ShowWindow (SW_SHOW);
UpdateStandardModeForAngle();
*pResult = 0;
}
//=======================================================================
//function : OnTcnSelChangingAngleTab
//purpose : it is called when in Angle tab control current tab
// is changing
// It is used to hide the current tab here to prevent collisions.
//=======================================================================
void CDimensionDlg::OnTcnSelChangingAngleTab (NMHDR *pNMHDR, LRESULT *pResult)
{
int aTabNum = ((CTabCtrl*) GetDlgItem (IDC_AngleTab))->GetCurSel();
TC_ITEM anItem;
anItem.mask = TCIF_PARAM;
((CTabCtrl*) GetDlgItem (IDC_AngleTab))->GetItem (aTabNum, &anItem);
ASSERT (anItem.lParam);
CWnd *aWnd = (CWnd*)anItem.lParam;
aWnd->ShowWindow (SW_HIDE);
*pResult = 0;
}
//=======================================================================
//function : DeactivateAllStandardModes
//purpose :
//=======================================================================
void CDimensionDlg::DeactivateAllStandardModes()
{
if (myAISContext->HasOpenedContext())
{
myAISContext->CloseAllContexts();
for (TColStd_ListIteratorOfListOfInteger anIt (myAISContext->LocalContext()->StandardModes());
anIt.More();
anIt.Next())
{
myAISContext->LocalContext()->DeactivateStandardMode ((TopAbs_ShapeEnum)anIt.Value());
}
}
}
//=======================================================================
//function : OnDestroy
//purpose :
//=======================================================================
void CDimensionDlg::OnDestroy()
{
if (myAISContext->HasOpenedContext())
{
myAISContext->CloseAllContexts();
}
// Destroy length tab
CWnd *aWnd;
TC_ITEM anItem;
anItem.mask = TCIF_PARAM;
for (int i = 2; i >= 0; --i)
{
((CTabCtrl*) GetDlgItem (IDC_LengthTab))->GetItem (i, &anItem);
ASSERT (anItem.lParam);
aWnd = (CWnd*) anItem.lParam;
aWnd->DestroyWindow();
delete aWnd;
}
// Destroy angle tab
for (int i = 1; i >= 0; --i)
{
((CTabCtrl*) GetDlgItem (IDC_AngleTab))->GetItem (i, &anItem);
ASSERT(anItem.lParam);
aWnd = (CWnd*) anItem.lParam;
aWnd->DestroyWindow();
delete aWnd;
}
CDialog::OnDestroy();
}
//=======================================================================
//function : GetTextType
//purpose : Returns true if 3d text is to be used
// and false in the case of 2d text.
//=======================================================================
const Standard_Boolean CDimensionDlg::GetTextType() const
{
CButton* a3DButton = (CButton*)GetDlgItem (IDC_3DText);
return a3DButton->GetCheck();
}
//=======================================================================
//function : GetFontHeight
//purpose : Returns font height
//=======================================================================
const Standard_Real CDimensionDlg::GetFontHeight() const
{
CComboBox *aComboBox = (CComboBox*)GetDlgItem (IDC_FontSize);
CString aStr;
aComboBox->GetWindowTextA (aStr);
return (Standard_Real)atof (aStr);
}
//=======================================================================
//function : IsText3dShaded
//purpose : Only for 3d text; returns true if shaded 3d text is to be used
//=======================================================================
const Standard_Boolean CDimensionDlg::IsText3dShaded() const
{
CComboBox *aComboBox = (CComboBox*)GetDlgItem (IDC_TextDisplayMode);
int aCurIndex = aComboBox->GetCurSel();
return aCurIndex == 0 ? Standard_False : Standard_True;
}
//=======================================================================
//function : SetTextModeControlsVisible
//purpose : for the dialog updating
//=======================================================================
void CDimensionDlg::SetTextModeControlsVisible (bool isVisible)
{
GetDlgItem (IDC_TextDisplayMode)->ShowWindow (isVisible ? SW_SHOW : SW_HIDE);
GetDlgItem (IDC_TextDisplayModeStatic)->ShowWindow (isVisible ? SW_SHOW : SW_HIDE);
}
//=======================================================================
//function : OnBnClicked2dText
//purpose : for the dialog updating when 2d text radio button was chosen
//=======================================================================
void CDimensionDlg::OnBnClicked2dText()
{
SetTextModeControlsVisible (false);
}
//=======================================================================
//function : OnBnClicked3dText
//purpose : for the dialog updating when 3d text radio button was chosen
//=======================================================================
void CDimensionDlg::OnBnClicked3dText()
{
SetTextModeControlsVisible (true);
}
//=======================================================================
//function : UpdateUnitsListForLength
//purpose : for the dialog updating when 3d text radio button was chosen
//=======================================================================
void CDimensionDlg::UpdateUnitsListForLength()
{
CComboBox *aCombo = (CComboBox*)GetDlgItem (IDC_DisplayUnits);
aCombo->ResetContent();
aCombo->AddString ("No");
aCombo->AddString ("m");
aCombo->AddString ("mm");
aCombo->AddString ("in");
aCombo->SetCurSel (1);
}
//=======================================================================
//function : UpdateUnitsListForAngle
//purpose : for the dialog updating when 3d text radio button was chosen
//=======================================================================
void CDimensionDlg::UpdateUnitsListForAngle()
{
CComboBox *aCombo = (CComboBox*)GetDlgItem (IDC_DisplayUnits);
aCombo->ResetContent();
aCombo->AddString ("No");
aCombo->AddString ("deg");
aCombo->AddString ("rad");
aCombo->SetCurSel (1);
}
//=======================================================================
//function : IsUnitsDisplayed
//purpose : returns true if the units is to be displayed
//=======================================================================
const Standard_Boolean CDimensionDlg::IsUnitsDisplayed() const
{
CString aStr;
GetDlgItem (IDC_DisplayUnits)->GetWindowTextA (aStr);
return !aStr.IsEmpty() && aStr != "No";
}
//=======================================================================
//function : GetUnits
//purpose : returns display quantity units for current dimension
//=======================================================================
const TCollection_AsciiString CDimensionDlg::GetUnits() const
{
if (!IsUnitsDisplayed())
return TCollection_AsciiString();
CString aStr;
GetDlgItem (IDC_DisplayUnits)->GetWindowTextA (aStr);
Standard_CString aChars = (LPCSTR)aStr;
return TCollection_AsciiString (aChars);
}
//=======================================================================
//function : OnBnClickedDimensionColor
//purpose : returns display quantity units for current dimension
//=======================================================================
void CDimensionDlg::OnBnClickedDimensionColor()
{
Standard_Real aR;
Standard_Real aG;
Standard_Real aB;
myDimensionColor.Values (aR,aG,aB, Quantity_TOC_RGB);
COLORREF aColor = RGB (aR*255, aG*255, aB*255);
CColorDialog aDlgColor (aColor);
if (aDlgColor.DoModal() == IDOK)
{
aColor = aDlgColor.GetColor();
aR = GetRValue(aColor) / 255.0;
aG = GetGValue(aColor) / 255.0;
aB = GetBValue(aColor) / 255.0;
myDimensionColor = Quantity_Color (aR, aG, aB, Quantity_TOC_RGB);
}
}
//=======================================================================
//function : GetDimensionColor
//purpose : returns current dimension color
//=======================================================================
const Quantity_Color CDimensionDlg::GetDimensionColor() const
{
return myDimensionColor;
}

View File

@ -0,0 +1,79 @@
#pragma once
// DimensionDlg dialog
#include <stdafx.h>
#include "res\OCC_Resource.h"
#include <Standard_Macro.hxx>
#include <AIS_InteractiveContext.hxx>
#include <TCollection_AsciiString.hxx>
#include <Quantity_Color.hxx>
class CDimensionDlg : public CDialog
{
public:
/// Construction & termination
CDimensionDlg (CWnd* pParent = NULL); // standard constructor
CDimensionDlg (Handle(AIS_InteractiveContext) &theAISContext,
CWnd* pParent = NULL);
virtual ~CDimensionDlg();
// Methods for data operation
void SetContext (const Handle(AIS_InteractiveContext) theContext);
void SetTextModeControlsVisible (bool isVisible);
void UpdateUnitsListForLength();
void UpdateUnitsListForAngle();
void Empty();
void DeactivateAllStandardModes();
void UpdateStandardModeForAngle ();
void UpdateStandardModeForLength ();
void UpdateStandardMode ();
const Standard_Real GetFlyout () const;
const Standard_Boolean GetTextType() const;
const Standard_Real GetFontHeight() const;
const Standard_Boolean IsText3dShaded() const;
const Standard_Boolean IsUnitsDisplayed() const;
const TCollection_AsciiString GetUnits() const;
const Quantity_Color GetDimensionColor() const;
// Dialog Data
enum { IDD = IDD_Dimension };
// Initialization of dialog
protected:
virtual BOOL OnInitDialog();
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
//Attributes
private:
Handle (AIS_InteractiveContext) myAISContext;
int mySelectedDimType;
int myFontSize;
Quantity_Color myDimensionColor;
CTabCtrl *myLengthParams;
CTabCtrl *myAngleParams;
CTabCtrl *myRadiusParams;
CTabCtrl *myDiameterParams;
void CreateLengthParamsTab();
void CreateAngleParamsTab();
void CreateRadiusParamsTab();
void CreateDiameterParamsTab();
public:
afx_msg void OnBnClickedOk();
afx_msg void OnBnClickedDimLength();
afx_msg void OnBnClickedDimAngle();
afx_msg void OnBnClickedDimRadius();
afx_msg void OnTcnSelChangeLengthTab(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnTcnSelChangingLengthTab(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnDestroy();
afx_msg void OnTcnSelChangeAngleTab(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnTcnSelChangingAngleTab(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnBnClickedDimDiameter();
afx_msg void OnBnClicked2dText();
afx_msg void OnBnClicked3dText();
afx_msg void OnBnClickedDimensionColor();
};

View File

@ -0,0 +1,112 @@
// LengthParamsEdgePage.cpp : implementation file
//
#include "stdafx.h"
#include "LengthParamsEdgePage.h"
#include "DimensionDlg.h"
#include <Standard_Macro.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_LocalContext.hxx>
#include <AIS_LengthDimension.hxx>
#include <GC_MakePlane.hxx>
#include <TopExp.hxx>
// CLengthParamsEdgePage dialog
IMPLEMENT_DYNAMIC(CLengthParamsEdgePage, CDialog)
//=======================================================================
//function : CLengthParamsEdgePage
//purpose :
//=======================================================================
CLengthParamsEdgePage::CLengthParamsEdgePage (Handle(AIS_InteractiveContext) theContext,CWnd* pParent /*=NULL*/)
: CDialog (CLengthParamsEdgePage::IDD, pParent)
{
myAISContext = theContext;
}
//=======================================================================
//function : ~CLengthParamsEdgePage
//purpose :
//=======================================================================
CLengthParamsEdgePage::~CLengthParamsEdgePage()
{
}
//=======================================================================
//function : DoDataExchange
//purpose :
//=======================================================================
void CLengthParamsEdgePage::DoDataExchange (CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP (CLengthParamsEdgePage, CDialog)
ON_BN_CLICKED (IDC_ChooseEdgeBtn, &CLengthParamsEdgePage::OnBnClickedChooseEdgeBtn)
END_MESSAGE_MAP()
//=======================================================================
//function : GetButton
//purpose :
//=======================================================================
CButton* CLengthParamsEdgePage::GetButton()
{
return (CButton*)GetDlgItem (IDC_ChooseEdgeBtn);
}
//=======================================================================
//function : OnBnClickedChooseEdgeBtn
//purpose :
//=======================================================================
void CLengthParamsEdgePage::OnBnClickedChooseEdgeBtn()
{
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
{
AfxMessageBox ( _T("Choose the vertex and press the button again"), MB_ICONINFORMATION | MB_OK);
return;
}
TopoDS_Edge anEdge = TopoDS::Edge(myAISContext->LocalContext()->SelectedShape());
myAISContext->LocalContext()->ClearSelected();
TopoDS_Vertex aFirstVertex, aSecondVertex;
TopExp::Vertices (anEdge, aFirstVertex, aSecondVertex);
gp_Pnt aP1=BRep_Tool::Pnt (aFirstVertex);
gp_Pnt aP2=BRep_Tool::Pnt (aSecondVertex);
gp_Pnt aP3(aP2.X()+10, aP2.Y()+10, aP2.Z()+10);
GC_MakePlane aMkPlane (aP1,aP2,aP3);
Handle(Geom_Plane) aPlane = aMkPlane.Value ();
CDimensionDlg *aDimDlg = (CDimensionDlg*)(GetParentOwner());
Handle(AIS_LengthDimension) aLenDim = new AIS_LengthDimension (anEdge, aPlane->Pln());
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());
aLenDim->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
if (aLenDim->IsUnitsDisplayed())
{
aLenDim->SetDisplayUnits (aDimDlg->GetUnits());
}
aLenDim->SetDimensionAspect (anAspect);
aLenDim->SetFlyout (aDimDlg->GetFlyout());
myAISContext->CloseAllContexts();
myAISContext->Display (aLenDim);
myAISContext->OpenLocalContext();
myAISContext->ActivateStandardMode(TopAbs_EDGE);
}

View File

@ -0,0 +1,29 @@
#pragma once
#include "res\OCC_Resource.h"
#include <Standard_Macro.hxx>
#include <AIS_InteractiveContext.hxx>
// CLengthParamsEdgePage dialog
class CLengthParamsEdgePage : public CDialog
{
DECLARE_DYNAMIC(CLengthParamsEdgePage)
public:
CLengthParamsEdgePage(Handle(AIS_InteractiveContext) theAISContext,CWnd* pParent = NULL); // standard constructor
virtual ~CLengthParamsEdgePage();
CButton* GetButton();
// Dialog Data
enum { IDD = IDD_LengthParamsEdgePage };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
private:
Handle(AIS_InteractiveContext) myAISContext;
public:
afx_msg void OnBnClickedChooseEdgeBtn();
};

View File

@ -0,0 +1,163 @@
// LenghtParamsEdgesPage.cpp : implementation file
//
#include "stdafx.h"
#include "LengthParamsEdgesPage.h"
#include "DimensionDlg.h"
#include <AIS_InteractiveContext.hxx>
#include <AIS_LocalContext.hxx>
#include <AIS_LengthDimension.hxx>
#include <AIS_AngleDimension.hxx>
#include <GC_MakePlane.hxx>
// CLengthParamsEdgesPage dialog
//=======================================================================
//function : CLengthParamsEdgesPage
//purpose :
//=======================================================================
CLengthParamsEdgesPage::CLengthParamsEdgesPage (Handle(AIS_InteractiveContext) theAISContext,
bool isAngleDimension /*= false*/,
CWnd* pParent /*=NULL*/)
: CDialog(CLengthParamsEdgesPage::IDD, pParent)
{
myAISContext = theAISContext;
myIsAngleDimension = isAngleDimension;
}
//=======================================================================
//function : ~CLengthParamsEdgesPage
//purpose :
//=======================================================================
CLengthParamsEdgesPage::~CLengthParamsEdgesPage()
{
}
//=======================================================================
//function : DoDataExchange
//purpose :
//=======================================================================
void CLengthParamsEdgesPage::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CLengthParamsEdgesPage, CDialog)
ON_BN_CLICKED(IDC_BUTTON1, &CLengthParamsEdgesPage::OnBnClickedEdge1Btn)
ON_BN_CLICKED(IDC_BUTTON3, &CLengthParamsEdgesPage::OnBnClickedEdge2Btn)
END_MESSAGE_MAP()
//=======================================================================
//function : OnBnClickedEdge1Btn
//purpose :
//=======================================================================
void CLengthParamsEdgesPage::OnBnClickedEdge1Btn()
{
// Open local context and choose the edge for length dimensions
if (!myAISContext->HasOpenedContext())
{
myAISContext->OpenLocalContext();
myAISContext->ActivateStandardMode (TopAbs_EDGE);
AfxMessageBox (_T("Local context was not opened. Choose the edge and press the button again"),
MB_ICONINFORMATION | MB_OK);
return;
}
// Now it's ok, local context is opened and edge selection mode is activated
// Check if some edge is selected
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
{
AfxMessageBox(_T("Choose the edge and press the button again"),
MB_ICONINFORMATION | MB_OK);
return;
}
myFirstEdge = TopoDS::Edge (myAISContext->LocalContext()->SelectedShape());
myAISContext->LocalContext()->ClearSelected();
}
//=======================================================================
//function : OnBnClickedEdge2Btn
//purpose :
//=======================================================================
void CLengthParamsEdgesPage::OnBnClickedEdge2Btn()
{
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
{
AfxMessageBox (_T("Choose the edge and press the button again"),
MB_ICONINFORMATION | MB_OK);
return;
}
mySecondEdge = TopoDS::Edge (myAISContext->LocalContext()->SelectedShape());
myAISContext->LocalContext()->ClearSelected();
// Build plane through three points
BRepAdaptor_Curve aCurve1 (myFirstEdge);
BRepAdaptor_Curve aCurve2 (mySecondEdge);
gp_Pnt aP1=aCurve1.Value (0.1);
gp_Pnt aP2=aCurve1.Value (0.9);
gp_Pnt aP3=aCurve2.Value (0.5);
GC_MakePlane aMkPlane (aP1,aP2,aP3);
Handle(Geom_Plane) aPlane = aMkPlane.Value();
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 (myFirstEdge, mySecondEdge);
anAngleDim->SetDimensionAspect (anAspect);
anAngleDim->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
if (anAngleDim->IsUnitsDisplayed())
{
anAngleDim->SetDisplayUnits (aDimDlg->GetUnits ());
if ((anAngleDim->DisplayUnits().IsEqual (TCollection_AsciiString ("deg"))))
{
anAngleDim->MakeUnitsDisplayed (Standard_False);
}
else
{
anAngleDim->SetDisplaySpecialSymbol (AIS_DSS_No);
}
}
anAngleDim->SetFlyout (aDimDlg->GetFlyout());
myAISContext->Display (anAngleDim);
}
else
{
Handle(AIS_LengthDimension) aLenDim = new AIS_LengthDimension (myFirstEdge, mySecondEdge, aPlane->Pln());
aLenDim->SetDimensionAspect (anAspect);
aLenDim->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
if (aLenDim->IsUnitsDisplayed())
{
aLenDim->SetFlyout (aDimDlg->GetFlyout());
aLenDim->SetDisplayUnits (aDimDlg->GetUnits());
}
myAISContext->Display (aLenDim);
}
myAISContext->OpenLocalContext();
myAISContext->ActivateStandardMode (TopAbs_EDGE);
}

View File

@ -0,0 +1,30 @@
#pragma once
#include "res\OCC_Resource.h"
// CLenghtParamsEdgesPage dialog
class CLengthParamsEdgesPage : public CDialog
{
private:
Handle(AIS_InteractiveContext) myAISContext;
bool myIsAngleDimension;
TopoDS_Edge myFirstEdge;
TopoDS_Edge mySecondEdge;
public:
CLengthParamsEdgesPage (Handle(AIS_InteractiveContext) theAISContext,
bool isAngleDimension = false,
CWnd* pParent = NULL); // standard constructor
virtual ~CLengthParamsEdgesPage();
// Dialog Data
enum { IDD = IDD_LengthParamsEdgesPage };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedEdge1Btn();
afx_msg void OnBnClickedEdge2Btn();
};

View File

@ -0,0 +1,153 @@
// LengthParamsVerticesPage.cpp : implementation file
//
#include "stdafx.h"
#include "LengthParamsVerticesPage.h"
#include "DimensionDlg.h"
#include <Standard_Macro.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_LocalContext.hxx>
#include <AIS_LengthDimension.hxx>
#include <GC_MakePlane.hxx>
// CLengthParamsVerticesPage dialog
IMPLEMENT_DYNAMIC(CLengthParamsVerticesPage, CDialog)
//=======================================================================
//function : CLengthParamsVerticesPage
//purpose :
//=======================================================================
CLengthParamsVerticesPage::CLengthParamsVerticesPage (Handle(AIS_InteractiveContext) theAISContext, CWnd* pParent /*=NULL*/)
: CDialog (CLengthParamsVerticesPage::IDD, pParent)
{
myAISContext = theAISContext;
}
//=======================================================================
//function : ~CLengthParamsVerticesPage
//purpose :
//=======================================================================
CLengthParamsVerticesPage::~CLengthParamsVerticesPage()
{
}
//=======================================================================
//function : DoDataExchange
//purpose :
//=======================================================================
void CLengthParamsVerticesPage::DoDataExchange (CDataExchange* pDX)
{
CDialog::DoDataExchange (pDX);
}
BEGIN_MESSAGE_MAP(CLengthParamsVerticesPage, CDialog)
ON_BN_CLICKED(IDC_BUTTON1, &CLengthParamsVerticesPage::OnBnClickedVertex1Btn)
ON_BN_CLICKED(IDC_BUTTON2, &CLengthParamsVerticesPage::OnBnClickedVertex2Btn)
END_MESSAGE_MAP()
//=======================================================================
//function : OnBnClickedVertex1Btn
//purpose :
//=======================================================================
void CLengthParamsVerticesPage::OnBnClickedVertex1Btn()
{
// Open local context and choose the edge for length dimensions
if (!myAISContext->HasOpenedContext())
{
myAISContext->OpenLocalContext();
myAISContext->ActivateStandardMode(TopAbs_VERTEX);
AfxMessageBox(_T("Local context was not opened. Choose the vertices and press the button again"),
MB_ICONINFORMATION | MB_OK);
return;
}
// Now it's ok, local context is opened and edge selection mode is activated
// Check if some edge is selected
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
{
AfxMessageBox (_T ("Choose the vertex and press the button again"), MB_ICONINFORMATION | MB_OK);
return;
}
myFirstVertex = TopoDS::Vertex (myAISContext->LocalContext()->SelectedShape());
myAISContext->LocalContext()->ClearSelected();
}
//=======================================================================
//function : OnBnClickedVertex2Btn
//purpose :
//=======================================================================
void CLengthParamsVerticesPage::OnBnClickedVertex2Btn()
{
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
{
AfxMessageBox (_T ("Choose the vertex and press the button again"), MB_ICONINFORMATION | MB_OK);
return;
}
mySecondVertex = TopoDS::Vertex (myAISContext->LocalContext()->SelectedShape());
myAISContext->LocalContext()->ClearSelected();
//Build dimension here
gp_Pnt aP1=BRep_Tool::Pnt (myFirstVertex);
gp_Pnt aP2=BRep_Tool::Pnt (mySecondVertex);
gp_Pnt aP3 (aP2.X() + 10, aP2.Y() + 10, aP2.Z() + 10);
GC_MakePlane aMkPlane (aP1,aP2,aP3);
Handle(Geom_Plane) aPlane = aMkPlane.Value();
CDimensionDlg *aDimDlg = (CDimensionDlg*)(this->GetParentOwner());
Handle(AIS_LengthDimension) aLenDim = new AIS_LengthDimension (aP1, aP2, aPlane->Pln());
Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect();
anAspect->MakeArrows3d (Standard_False);
anAspect->MakeText3d (aDimDlg->GetTextType());
anAspect->TextAspect()->SetHeight (aDimDlg->GetFontHeight());
anAspect->MakeTextShaded (aDimDlg->IsText3dShaded());
aLenDim->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
if (aLenDim->IsUnitsDisplayed ())
{
aLenDim->SetDisplayUnits (aDimDlg->GetUnits ());
}
aLenDim->SetDimensionAspect (anAspect);
aLenDim->SetFlyout (aDimDlg->GetFlyout());
myAISContext->CloseAllContexts();
myAISContext->Display (aLenDim);
myAISContext->OpenLocalContext();
myAISContext->ActivateStandardMode (TopAbs_VERTEX);
}
//=======================================================================
//function : getFirstVertex
//purpose :
//=======================================================================
const TopoDS_Vertex& CLengthParamsVerticesPage::getFirstVertex() const
{
return myFirstVertex;
}
//=======================================================================
//function : getSecondVertex
//purpose :
//=======================================================================
const TopoDS_Vertex& CLengthParamsVerticesPage::getSecondVertex() const
{
return mySecondVertex;
}

View File

@ -0,0 +1,29 @@
#pragma once
#include "res\OCC_Resource.h"
// CLengthParamsVerticesPage dialog
class CLengthParamsVerticesPage : public CDialog
{
DECLARE_DYNAMIC(CLengthParamsVerticesPage)
public:
CLengthParamsVerticesPage(Handle(AIS_InteractiveContext) theAISContext,CWnd* pParent = NULL); // standard constructor
virtual ~CLengthParamsVerticesPage();
const TopoDS_Vertex& getFirstVertex() const;
const TopoDS_Vertex& getSecondVertex() const;
// Dialog Data
enum { IDD = IDD_LengthParamsVerticesPage };
private:
Handle(AIS_InteractiveContext) myAISContext;
TopoDS_Vertex myFirstVertex;
TopoDS_Vertex mySecondVertex;
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedVertex1Btn();
afx_msg void OnBnClickedVertex2Btn();
};

View File

@ -11,8 +11,12 @@
#include <res\OCC_Resource.h>
#include "ImportExport/ImportExport.h"
#include "AISDialogs.h"
#include <AIS_LocalContext.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TopoDS_Shape.hxx>
BEGIN_MESSAGE_MAP(OCC_3dBaseDoc, OCC_BaseDoc)
//{{AFX_MSG_MAP(OCC_3dBaseDoc)
@ -34,6 +38,9 @@ BEGIN_MESSAGE_MAP(OCC_3dBaseDoc, OCC_BaseDoc)
ON_UPDATE_COMMAND_UI(ID_OBJECT_DISPLAYALL, OnUpdateObjectDisplayall)
ON_COMMAND(ID_OBJECT_REMOVE, OnObjectRemove)
ON_UPDATE_COMMAND_UI(ID_OBJECT_REMOVE, OnUpdateObjectRemove)
ON_COMMAND(ID_OBJECT_DIM, OnObjectAddDimensions)
ON_UPDATE_COMMAND_UI(ID_OBJECT_DIM, OnUpdateObjectAddDimensions)
//}}AFX_MSG_MAP
ON_COMMAND_EX_RANGE(ID_OBJECT_MATERIAL_BRASS,ID_OBJECT_MATERIAL_DEFAULT, OnObjectMaterialRange)
ON_UPDATE_COMMAND_UI_RANGE(ID_OBJECT_MATERIAL_BRASS,ID_OBJECT_MATERIAL_DEFAULT, OnUpdateObjectMaterialRange)
@ -45,6 +52,8 @@ END_MESSAGE_MAP()
//////////////////////////////////////////////////////////////////////
OCC_3dBaseDoc::OCC_3dBaseDoc()
:myPopupMenuNumber(0),
myDimensionDlg()
{
AfxInitRichEdit();
@ -55,6 +64,8 @@ OCC_3dBaseDoc::OCC_3dBaseDoc()
myViewer->SetDefaultLights();
myViewer->SetLightOn();
myAISContext = new AIS_InteractiveContext (myViewer);
myDimensionDlg.SetContext (myAISContext);
myDimensionDlg.Create(CDimensionDlg::IDD, NULL);
}
//-----------------------------------------------------------------------------------------
@ -167,17 +178,20 @@ void OCC_3dBaseDoc::Popup (const Standard_Integer theMouseX,
const Standard_Integer theMouseY,
const Handle(V3d_View)& theView)
{
Standard_Integer PopupMenuNumber=0;
myAISContext->InitCurrent();
if (myAISContext->MoreCurrent())
PopupMenuNumber=1;
// Base check which context menu to call
if (!myPopupMenuNumber)
{
myAISContext->InitCurrent();
if (myAISContext->MoreCurrent())
myPopupMenuNumber=1;
}
CMenu menu;
VERIFY(menu.LoadMenu(IDR_Popup3D));
CMenu* pPopup = menu.GetSubMenu(PopupMenuNumber);
CMenu* pPopup = menu.GetSubMenu(myPopupMenuNumber);
ASSERT(pPopup != NULL);
if (PopupMenuNumber == 1) // more than 1 object.
if (myPopupMenuNumber == 1) // more than 1 object.
{
bool OneOrMoreInShading = false;
for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ())
@ -190,8 +204,10 @@ void OCC_3dBaseDoc::Popup (const Standard_Integer theMouseX,
Handle(WNT_Window) aWNTWindow=
Handle(WNT_Window)::DownCast(theView->Window());
ClientToScreen ( (HWND)(aWNTWindow->HWindow()),&winCoord);
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON , winCoord.x, winCoord.y ,
AfxGetMainWnd());
pPopup->TrackPopupMenu (TPM_LEFTALIGN | TPM_RIGHTBUTTON,
winCoord.x,
winCoord.y,
AfxGetMainWnd());
}
void OCC_3dBaseDoc::Fit()
@ -392,7 +408,7 @@ void OCC_3dBaseDoc::OnUpdateObjectRemove(CCmdUI* pCmdUI)
bool OneOrMoreIsDisplayed = false;
for (myAISContext->InitCurrent();myAISContext->MoreCurrent ();myAISContext->NextCurrent ())
if (myAISContext->IsDisplayed(myAISContext->Current())) OneOrMoreIsDisplayed=true;
pCmdUI->Enable (OneOrMoreIsDisplayed);
pCmdUI->Enable (OneOrMoreIsDisplayed);
}
void OCC_3dBaseDoc::SetMaterial(Graphic3d_NameOfMaterial Material)
@ -401,3 +417,18 @@ void OCC_3dBaseDoc::SetMaterial(Graphic3d_NameOfMaterial Material)
myAISContext->SetMaterial (myAISContext->Current(),
(Graphic3d_NameOfMaterial)(Material));
}
void OCC_3dBaseDoc::OnObjectAddDimensions()
{
//Add dimentions dialog is opened here
myDimensionDlg.ShowWindow(SW_SHOW);
myDimensionDlg.UpdateStandardMode ();
}
void OCC_3dBaseDoc::OnUpdateObjectAddDimensions(CCmdUI* pCmdUI)
{
// Check if local context is opened
//pCmdUI->Enable (myAISContext->HasOpenedContext());
}

View File

@ -10,10 +10,14 @@
#endif // _MSC_VER > 1000
#include "OCC_BaseDoc.h"
#include "DimensionDlg.h"
#include <Standard_Macro.hxx>
class AFX_EXT_CLASS OCC_3dBaseDoc : public OCC_BaseDoc
{
protected:
CDimensionDlg myDimensionDlg;
int myPopupMenuNumber;
public:
OCC_3dBaseDoc();
@ -78,6 +82,9 @@ protected:
afx_msg void OnUpdateObjectDisplayall(CCmdUI* pCmdUI);
afx_msg void OnObjectRemove();
afx_msg void OnUpdateObjectRemove(CCmdUI* pCmdUI);
afx_msg void OnObjectAddDimensions();
afx_msg void OnUpdateObjectAddDimensions(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

View File

@ -0,0 +1,133 @@
#include "stdafx.h"
#include "RadiusParamsPage.h"
#include "DimensionDlg.h"
#include <AIS_InteractiveContext.hxx>
#include <AIS_LocalContext.hxx>
#include <AIS_RadiusDimension.hxx>
#include <AIS_DiameterDimension.hxx>
#include <ElCLib.hxx>
#include <TopoDS_Shape.hxx>
IMPLEMENT_DYNAMIC(CRadiusParamsPage, CDialog)
//=======================================================================
//function : CRadiusParamsPage
//purpose :
//=======================================================================
CRadiusParamsPage::CRadiusParamsPage (const Handle(AIS_InteractiveContext)& theAISContext,
const Standard_Boolean isDiameterDimension /* =Standard_False*/,
CWnd* pParent /*=NULL*/)
: CDialog (CRadiusParamsPage::IDD, pParent)
{
myAISContext = theAISContext;
myIsDiameterDimension = isDiameterDimension;
}
//=======================================================================
//function : ~CRadiusParamsPage
//purpose :
//=======================================================================
CRadiusParamsPage::~CRadiusParamsPage()
{
}
//=======================================================================
//function : DoDataExchange
//purpose :
//=======================================================================
void CRadiusParamsPage::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CRadiusParamsPage, CDialog)
ON_BN_CLICKED(IDC_BUTTON1, &CRadiusParamsPage::OnBnClickedObjectBtn)
END_MESSAGE_MAP()
//=======================================================================
//function : OnBnClickedObjectBtn
//purpose :
//=======================================================================
void CRadiusParamsPage::OnBnClickedObjectBtn()
{
//Build dimension here
myAISContext->LocalContext()->InitSelected();
if (!myAISContext->LocalContext()->MoreSelected())
{
AfxMessageBox (_T ("Choose the edge and press the button again"), MB_ICONINFORMATION | MB_OK);
return;
}
gp_Circ aCircle;
Standard_Boolean isAttachPoint = Standard_False;
Standard_Real aFirstPar = 0, aLastPar = 0;
TopoDS_Shape aSelShape = myAISContext->LocalContext()->SelectedShape();
if (aSelShape.ShapeType() != TopAbs_EDGE &&
aSelShape.ShapeType() != TopAbs_FACE &&
aSelShape.ShapeType() != TopAbs_WIRE)
return;
if (aSelShape.ShapeType() == TopAbs_EDGE)
{
BRepAdaptor_Curve aCurve (TopoDS::Edge (aSelShape));
if (aCurve.GetType() != GeomAbs_Circle)
{
return;
}
aCircle = aCurve.Circle();
if (aCurve.FirstParameter() != 0 && aCurve.LastParameter() != M_PI * 2)
{
isAttachPoint = Standard_True;
aFirstPar = aCurve.FirstParameter();
aLastPar = aCurve.LastParameter();
}
}
myAISContext->LocalContext()->ClearSelected();
CDimensionDlg *aDimDlg = (CDimensionDlg*)(this->GetParentOwner());
// Try to create dimension if it is possible
Handle(AIS_Dimension) aDim;
if (myIsDiameterDimension)
{
aDim = isAttachPoint ? new AIS_DiameterDimension (aCircle, ElCLib::Value ((aFirstPar + aLastPar) / 2.0, aCircle))
: 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);
Handle(AIS_RadiusDimension)::DownCast(aDim)->SetFlyout (aDimDlg->GetFlyout());
}
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());
aDim->MakeUnitsDisplayed (aDimDlg->IsUnitsDisplayed());
if (aDim->IsUnitsDisplayed())
{
aDim->SetDisplayUnits (aDimDlg->GetUnits());
}
aDim->SetDimensionAspect (anAspect);
// Display dimension in the neutral point
myAISContext->CloseAllContexts();
myAISContext->Display (aDim);
myAISContext->OpenLocalContext();
myAISContext->ActivateStandardMode (TopAbs_EDGE);
}

View File

@ -0,0 +1,27 @@
#pragma once
#include "res\OCC_Resource.h"
// CRadiusParamsPage dialog
class CRadiusParamsPage : public CDialog
{
DECLARE_DYNAMIC(CRadiusParamsPage)
private:
Handle(AIS_InteractiveContext) myAISContext;
Standard_Boolean myIsDiameterDimension;
public:
CRadiusParamsPage(const Handle(AIS_InteractiveContext)& theAISContext,
const Standard_Boolean isDiameterDimension = Standard_False,
CWnd* pParent = NULL); // standard constructor
virtual ~CRadiusParamsPage();
// Dialog Data
enum { IDD = IDD_RadiusParamsPage };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedObjectBtn();
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -3,7 +3,13 @@
// Used by OCC_Resource.rc
//
#define IDR_POPUP 116
#define IDD_Dimension 119
#define IDD_LengthParamsEdgePage 122
#define IDD_LengthParamsVerticesPage 123
#define IDD_LengthParamsEdgesPage 125
#define IDD_AngleParamsVerticesPage 126
#define IDR_MAINFRAME 128
#define IDD_RadiusParamsPage 128
#define IDR_2DTYPE 129
#define IDR_3DTYPE 131
#define ID_FILE_EXPORT_IMAGE 132
@ -20,8 +26,41 @@
#define IDD_COLORMESH 552
#define IDB_coloredmesh 554
#define IDC_RICHEDIT_ResultDialog 1001
#define IDC_EDIT1 1004
#define IDC_README 1005
#define IDC_ResultNameEdit 1003
#define IDC_README 1004
#define IDC_DimensionGroupbox 1005
#define IDD_DIMENSIONDLG 1006
#define IDC_TextParamGroupbox 1007
#define IDC_DimensionParametersGroupbox 1010
#define IDC_TAB1 1011
#define IDC_LengthTab 1014
#define IDC_AngleTab 1015
#define IDC_BUTTON1 1016
#define IDC_XPOS 1017
#define IDC_BUTTON2 1018
#define IDC_BUTTON3 1019
#define IDC_YPOS 1020
#define IDC_BUTTON4 1021
#define IDC_RadiusTab 1022
#define IDC_ZPOS 1023
#define IDC_ChooseEdgeBtn 1025
#define IDC_ChooseEdgeEdit 1026
#define IDC_Flyout 1028
#define IDC_DiameterTab 1031
#define IDC_DimLength 1032
#define IDC_DimAngle 1033
#define IDC_DimRadius 1034
#define IDC_DimDiameter 1035
#define IDC_2DText 1036
#define IDC_3DText 1037
#define IDC_FontSize 1038
#define IDC_FontSizeStatic 1039
#define IDC_FlyoutStatic 1044
#define IDC_DisplayUnits 1045
#define IDC_DisplayUnitsStatic 1046
#define IDC_TextDisplayMode 1047
#define IDC_TextDisplayModeStatic 1048
#define IDC_DimensionColor 1049
#define ID_WINDOW_NEW3D 1151
#define ID_OBJECT_DISPLAYALL 1201
#define ID_OBJECT_MATERIAL 1205
@ -93,6 +132,9 @@
#define ID_BUTTONTop 40016
#define ID_BUTTON40017 40017
#define ID_BUTTON40033 40033
#define ID_OBJECT_DIMENSIONS 40035
#define ID_OBJECT_DIM 40036
#define ID_LOCALCONTEXT_ADDDIMENSION 40037
#define ID_FILE_IMPORT_CSFDB 40100
#define ID_FILE_IMPORT_BREP 40101
#define ID_FILE_IMPORT_STEP 40102
@ -132,9 +174,9 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 119
#define _APS_NEXT_COMMAND_VALUE 40034
#define _APS_NEXT_CONTROL_VALUE 1006
#define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 40038
#define _APS_NEXT_CONTROL_VALUE 1052
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -73,6 +73,52 @@ IDB_coloredmesh BITMAP "coloredm.bmp"
// Dialog
//
IDD_RadiusParamsPage DIALOGEX 0, 0, 121, 46
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
PUSHBUTTON "Click to set up selected circle or arc",IDC_BUTTON1,26,10,70,25,BS_MULTILINE
END
IDD_AngleParamsVerticesPage DIALOGEX 0, 0, 126, 69
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
PUSHBUTTON "Set up selected vertex",IDC_BUTTON1,39,7,83,18,BS_MULTILINE
LTEXT "Vertex1",IDC_STATIC,10,12,26,8
PUSHBUTTON "Set up selected vertex",IDC_BUTTON3,39,26,83,17
LTEXT "Vertex2",IDC_STATIC,9,30,26,8
PUSHBUTTON "Set up selected vertex",IDC_BUTTON4,39,44,83,18
LTEXT "Vertex3",IDC_STATIC,9,47,26,8
END
IDD_LengthParamsEdgePage DIALOGEX 0, 0, 70, 35
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
PUSHBUTTON "Click to set up selected edge",IDC_ChooseEdgeBtn,1,1,66,30,BS_MULTILINE
END
IDD_LengthParamsVerticesPage DIALOGEX 0, 0, 135, 55
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "Vertex1",IDC_STATIC,7,11,26,8
LTEXT "Vertex2",IDC_STATIC,7,35,26,8
PUSHBUTTON "Click to set up selected vertex",IDC_BUTTON1,39,4,74,21,BS_MULTILINE
PUSHBUTTON "Click to set up selected vertex",IDC_BUTTON2,39,31,74,20,BS_MULTILINE
END
IDD_LengthParamsEdgesPage DIALOGEX 0, 0, 128, 60
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
PUSHBUTTON "Click to set up selected edge",IDC_BUTTON1,33,1,82,26,BS_MULTILINE
PUSHBUTTON "Click to set up selected edge",IDC_BUTTON3,34,30,81,26,BS_MULTILINE
LTEXT "Edge1",IDC_STATIC,6,12,21,8
LTEXT "Edge2",IDC_STATIC,6,33,21,8
END
IDD_OCC_ABOUTBOX DIALOGEX 34, 22, 284, 257
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About"
@ -90,7 +136,7 @@ IDD_ResultDialog DIALOG 0, 0, 212, 202
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "",IDC_RICHEDIT_ResultDialog,"RICHEDIT",TCS_HOTTRACK | TCS_VERTICAL | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,0,10,210,160
CONTROL "",IDC_RICHEDIT_ResultDialog,"RICHEDIT",TCS_HOTTRACK | TCS_VERTICAL | TCS_RAGGEDRIGHT | TCS_MULTISELECT | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,2,9,207,162
PUSHBUTTON "Copy selection to clipboard",IDC_CopySelectionToClipboard,5,176,100,15
PUSHBUTTON "Copy all to clipboard",IDC_CopyAllToClipboard,107,176,100,15
END
@ -204,6 +250,37 @@ BEGIN
GROUPBOX "",IDC_STATIC,115,86,8,73
END
IDD_Dimension DIALOGEX 0, 0, 236, 337
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Add dimension"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,97,311,50,14
GROUPBOX "Dimension",IDC_DimensionGroupbox,8,9,64,85
CONTROL "",IDC_LengthTab,"SysTabControl32",0x0,11,205,194,95
CONTROL "",IDC_AngleTab,"SysTabControl32",NOT WS_VISIBLE,10,205,193,94
CONTROL "",IDC_RadiusTab,"SysTabControl32",0x0,10,205,193,93
GROUPBOX "Dimension parameters",IDC_DimensionParametersGroupbox,9,103,209,84,WS_GROUP
CONTROL "",IDC_DiameterTab,"SysTabControl32",0x0,10,205,194,92
CONTROL "Length",IDC_DimLength,"Button",BS_AUTORADIOBUTTON | WS_GROUP,20,26,38,10
CONTROL "Angle",IDC_DimAngle,"Button",BS_AUTORADIOBUTTON,20,38,34,10
CONTROL "Radius",IDC_DimRadius,"Button",BS_AUTORADIOBUTTON,20,50,37,10
CONTROL "Diameter",IDC_DimDiameter,"Button",BS_AUTORADIOBUTTON,20,63,45,10
GROUPBOX "Text parameters",IDC_TextParamGroupbox,80,9,139,84
CONTROL "2D Text",IDC_2DText,"Button",BS_AUTORADIOBUTTON | WS_GROUP,162,20,41,10
CONTROL "3D Text",IDC_3DText,"Button",BS_AUTORADIOBUTTON,162,33,41,10
LTEXT "Text type:",IDC_STATIC,86,22,47,8
LTEXT "Font Size:",IDC_FontSizeStatic,87,51,33,8
COMBOBOX IDC_FontSize,157,51,48,57,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Flyout value",IDC_FlyoutStatic,25,117,40,8
LTEXT "Display units",IDC_DisplayUnitsStatic,25,138,41,8
COMBOBOX IDC_DisplayUnits,105,138,64,59,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
LTEXT "Text display mode:",IDC_TextDisplayModeStatic,86,74,62,8
COMBOBOX IDC_TextDisplayMode,157,71,48,58,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Change dimension color",IDC_DimensionColor,105,156,63,24,BS_MULTILINE
CONTROL "",IDC_Flyout,"msctls_trackbar32",TBS_TOP | TBS_TOOLTIPS | WS_TABSTOP,73,112,100,20
END
/////////////////////////////////////////////////////////////////////////////
//
@ -275,6 +352,7 @@ BEGIN
BUTTON ID_OBJECT_DISPLAYALL
SEPARATOR
BUTTON ID_OBJECT_REMOVE
BUTTON ID_OBJECT_DIM
END
@ -352,6 +430,29 @@ END
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_RadiusParamsPage, DIALOG
BEGIN
RIGHTMARGIN, 120
BOTTOMMARGIN, 45
END
IDD_AngleParamsVerticesPage, DIALOG
BEGIN
RIGHTMARGIN, 80
BOTTOMMARGIN, 66
END
IDD_LengthParamsVerticesPage, DIALOG
BEGIN
BOTTOMMARGIN, 51
END
IDD_LengthParamsEdgesPage, DIALOG
BEGIN
RIGHTMARGIN, 115
BOTTOMMARGIN, 58
END
IDD_OCC_ABOUTBOX, DIALOG
BEGIN
BOTTOMMARGIN, 256
@ -367,10 +468,48 @@ BEGIN
RIGHTMARGIN, 67
BOTTOMMARGIN, 219
END
IDD_Dimension, DIALOG
BEGIN
RIGHTMARGIN, 235
BOTTOMMARGIN, 336
HORZGUIDE, 336
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog Info
//
IDD_Dimension DLGINIT
BEGIN
IDC_FontSize, 0x403, 2, 0
0x0037,
IDC_FontSize, 0x403, 2, 0
0x0038,
IDC_FontSize, 0x403, 2, 0
0x0039,
IDC_FontSize, 0x403, 3, 0
0x3031, "\000"
IDC_FontSize, 0x403, 3, 0
0x3131, "\000"
IDC_FontSize, 0x403, 3, 0
0x3231, "\000"
IDC_FontSize, 0x403, 3, 0
0x3331, "\000"
IDC_FontSize, 0x403, 3, 0
0x3431, "\000"
IDC_TextDisplayMode, 0x403, 10, 0
0x6957, 0x6572, 0x7266, 0x6d61, 0x0065,
IDC_TextDisplayMode, 0x403, 9, 0
0x5320, 0x6168, 0x6964, 0x676e, "\000"
0
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
@ -494,6 +633,12 @@ BEGIN
ID_OBJECT_WIREFRAME "Put selection in wireframe\nWireframe"
END
STRINGTABLE
BEGIN
ID_OBJECT_DIMENSIONS "Add dimensions"
ID_LOCALCONTEXT_ADDDIMENSION "Add new dimension for selected objetcs"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////

View File

@ -274,6 +274,8 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\AngleParamsVerticesPage.cpp" />
<ClCompile Include="..\..\..\..\Common\DimensionDlg.cpp" />
<ClCompile Include="..\..\..\..\Common\ImportExport\ImportExport.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -290,6 +292,10 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\LengthParamsEdgePage.cpp" />
<ClCompile Include="..\..\..\..\Common\LengthParamsEdgesPage.cpp" />
<ClCompile Include="..\..\..\..\Common\LengthParamsVerticesPage.cpp" />
<ClCompile Include="..\..\..\..\Common\RadiusParamsPage.cpp" />
<ClCompile Include="..\..\..\src\mfcsample.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -714,7 +720,12 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\..\Common\AISDialogs.h" />
<ClInclude Include="..\..\..\..\Common\AngleParamsVerticesPage.h" />
<ClInclude Include="..\..\..\..\Common\DimensionDlg.h" />
<ClInclude Include="..\..\..\..\Common\ImportExport\ImportExport.h" />
<ClInclude Include="..\..\..\..\Common\LengthParamsEdgePage.h" />
<ClInclude Include="..\..\..\..\Common\LengthParamsEdgesPage.h" />
<ClInclude Include="..\..\..\..\Common\LengthParamsVerticesPage.h" />
<ClInclude Include="..\..\..\..\Common\OCC_2dChildFrame.h" />
<ClInclude Include="..\..\..\..\Common\OCC_2dDoc.h" />
<ClInclude Include="..\..\..\..\Common\OCC_2dView.h" />
@ -727,6 +738,7 @@
<ClInclude Include="..\..\..\..\Common\OCC_BaseDoc.h" />
<ClInclude Include="..\..\..\..\Common\OCC_BaseView.h" />
<ClInclude Include="..\..\..\..\Common\OCC_MainFrame.h" />
<ClInclude Include="..\..\..\..\Common\RadiusParamsPage.h" />
<ClInclude Include="..\..\..\..\Common\res\OCC_Resource.h" />
<ClInclude Include="..\..\..\..\Common\ResultDialog.h" />
<ClInclude Include="..\..\..\..\Common\ImportExport\SaveCSFDBDlg.h" />

View File

@ -120,6 +120,24 @@
<ClCompile Include="..\..\..\..\Common\ISession2D\ISession2D_Shape.cpp">
<Filter>Source Files\ISession2D-src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\DimensionDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\AngleParamsVerticesPage.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\LengthParamsEdgePage.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\LengthParamsEdgesPage.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\LengthParamsVerticesPage.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\RadiusParamsPage.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\..\..\Common\res\OCC_Resource.rc">
@ -211,6 +229,24 @@
<ClInclude Include="..\..\..\..\Common\ISession2D\ISession2D_Shape.h">
<Filter>Header Files\ISession2D-headers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\Common\DimensionDlg.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\Common\AngleParamsVerticesPage.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\Common\LengthParamsEdgePage.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\Common\LengthParamsEdgesPage.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\Common\LengthParamsVerticesPage.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\Common\RadiusParamsPage.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\..\Common\res\2dChildFrameTB.bmp">

View File

@ -278,6 +278,8 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\AngleParamsVerticesPage.cpp" />
<ClCompile Include="..\..\..\..\Common\DimensionDlg.cpp" />
<ClCompile Include="..\..\..\..\Common\ImportExport\ImportExport.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -294,6 +296,10 @@
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\LengthParamsEdgePage.cpp" />
<ClCompile Include="..\..\..\..\Common\LengthParamsEdgesPage.cpp" />
<ClCompile Include="..\..\..\..\Common\LengthParamsVerticesPage.cpp" />
<ClCompile Include="..\..\..\..\Common\RadiusParamsPage.cpp" />
<ClCompile Include="..\..\..\src\mfcsample.cpp">
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -718,7 +724,12 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\..\Common\AISDialogs.h" />
<ClInclude Include="..\..\..\..\Common\AngleParamsVerticesPage.h" />
<ClInclude Include="..\..\..\..\Common\DimensionDlg.h" />
<ClInclude Include="..\..\..\..\Common\ImportExport\ImportExport.h" />
<ClInclude Include="..\..\..\..\Common\LengthParamsEdgePage.h" />
<ClInclude Include="..\..\..\..\Common\LengthParamsEdgesPage.h" />
<ClInclude Include="..\..\..\..\Common\LengthParamsVerticesPage.h" />
<ClInclude Include="..\..\..\..\Common\OCC_2dChildFrame.h" />
<ClInclude Include="..\..\..\..\Common\OCC_2dDoc.h" />
<ClInclude Include="..\..\..\..\Common\OCC_2dView.h" />
@ -731,6 +742,7 @@
<ClInclude Include="..\..\..\..\Common\OCC_BaseDoc.h" />
<ClInclude Include="..\..\..\..\Common\OCC_BaseView.h" />
<ClInclude Include="..\..\..\..\Common\OCC_MainFrame.h" />
<ClInclude Include="..\..\..\..\Common\RadiusParamsPage.h" />
<ClInclude Include="..\..\..\..\Common\res\OCC_Resource.h" />
<ClInclude Include="..\..\..\..\Common\ResultDialog.h" />
<ClInclude Include="..\..\..\..\Common\ImportExport\SaveCSFDBDlg.h" />

View File

@ -120,6 +120,24 @@
<ClCompile Include="..\..\..\..\Common\ISession2D\ISession2D_Shape.cpp">
<Filter>Source Files\ISession2D-src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\DimensionDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\AngleParamsVerticesPage.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\LengthParamsEdgePage.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\LengthParamsEdgesPage.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\LengthParamsVerticesPage.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\Common\RadiusParamsPage.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\..\..\Common\res\OCC_Resource.rc">
@ -211,6 +229,24 @@
<ClInclude Include="..\..\..\..\Common\ISession2D\ISession2D_Shape.h">
<Filter>Header Files\ISession2D-headers</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\Common\DimensionDlg.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\Common\AngleParamsVerticesPage.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\Common\LengthParamsEdgePage.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\Common\LengthParamsEdgesPage.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\Common\LengthParamsVerticesPage.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\Common\RadiusParamsPage.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\..\Common\res\2dChildFrameTB.bmp">

View File

@ -464,6 +464,14 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\..\Common\AngleParamsVerticesPage.cpp"
>
</File>
<File
RelativePath="..\..\..\..\Common\DimensionDlg.cpp"
>
</File>
<File
RelativePath="..\..\..\..\Common\ImportExport\ImportExport.cpp"
>
@ -510,6 +518,18 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\..\Common\LengthParamsEdgePage.cpp"
>
</File>
<File
RelativePath="..\..\..\..\Common\LengthParamsEdgesPage.cpp"
>
</File>
<File
RelativePath="..\..\..\..\Common\LengthParamsVerticesPage.cpp"
>
</File>
<File
RelativePath="..\..\..\src\mfcsample.cpp"
>
@ -1148,6 +1168,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\..\Common\RadiusParamsPage.cpp"
>
</File>
<File
RelativePath="..\..\..\..\Common\ResultDialog.cpp"
>
@ -1735,10 +1759,30 @@
RelativePath="..\..\..\..\Common\AISDialogs.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\AngleParamsVerticesPage.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\DimensionDlg.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\ImportExport\ImportExport.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\LengthParamsEdgePage.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\LengthParamsEdgesPage.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\LengthParamsVerticesPage.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\OCC_2dChildFrame.h"
>
@ -1791,6 +1835,10 @@
RelativePath="..\..\..\..\Common\res\OCC_Resource.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\RadiusParamsPage.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\ResultDialog.h"
>

View File

@ -461,6 +461,14 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\..\Common\AngleParamsVerticesPage.cpp"
>
</File>
<File
RelativePath="..\..\..\..\Common\DimensionDlg.cpp"
>
</File>
<File
RelativePath="..\..\..\..\Common\ImportExport\ImportExport.cpp"
>
@ -507,6 +515,18 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\..\Common\LengthParamsEdgePage.cpp"
>
</File>
<File
RelativePath="..\..\..\..\Common\LengthParamsEdgesPage.cpp"
>
</File>
<File
RelativePath="..\..\..\..\Common\LengthParamsVerticesPage.cpp"
>
</File>
<File
RelativePath="..\..\..\src\mfcsample.cpp"
>
@ -1145,6 +1165,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\..\Common\RadiusParamsPage.cpp"
>
</File>
<File
RelativePath="..\..\..\..\Common\ResultDialog.cpp"
>
@ -1732,10 +1756,30 @@
RelativePath="..\..\..\..\Common\AISDialogs.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\AngleParamsVerticesPage.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\DimensionDlg.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\ImportExport\ImportExport.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\LengthParamsEdgePage.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\LengthParamsEdgesPage.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\LengthParamsVerticesPage.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\OCC_2dChildFrame.h"
>
@ -1788,6 +1832,10 @@
RelativePath="..\..\..\..\Common\res\OCC_Resource.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\RadiusParamsPage.h"
>
</File>
<File
RelativePath="..\..\..\..\Common\ResultDialog.h"
>

View File

@ -275,7 +275,7 @@ is
-- for example, are only created for the selection
-- process. By means of these enumerations, they can
-- be cleared from local context.
enumeration KindOfUnit is
TOU_LENGTH,
TOU_SURFACE,
@ -285,19 +285,19 @@ is
TOU_MASS,
TOU_FORCE,
TOU_TIME;
---Purpose: Declares the type of Interactive Object unit.
---Purpose: Declares the type of Interactive Object unit.
enumeration TypeOfAxis is TOAX_Unknown,TOAX_XAxis,TOAX_YAxis,TOAX_ZAxis;
---Purpose: Declares the type of axis.
---Purpose: Declares the type of axis.
enumeration TypeOfPlane is TOPL_Unknown,TOPL_XYPlane,TOPL_XZPlane,TOPL_YZPlane;
---Purpose: Declares the type of plane.
---Purpose: Declares the type of plane.
enumeration TypeOfDist is TOD_Unknown,TOD_Horizontal,TOD_Vertical;
---Purpose: To declare the type of distance.
---Purpose: To declare the type of distance.
enumeration TypeOfAttribute is
TOA_Line,
TOA_Angle,
TOA_Dimension,
TOA_Wire,
TOA_Plane,
TOA_Vector,
@ -311,16 +311,21 @@ is
TOA_FirstAxis,
TOA_SecondAxis,
TOA_ThirdAxis;
enumeration StandardDatum is SD_None,SD_Point,SD_Axis,SD_Trihedron,SD_PlaneTrihedron,SD_Line,SD_Circle,SD_Plane;
--- Purpose: Declares the type of standard datum of an Interactive Object.
-- New ------------------------------------------------
enumeration StandardDatum is SD_None,SD_Point,SD_Axis,SD_Trihedron,SD_PlaneTrihedron,SD_Line,SD_Circle,SD_Plane;
--- Purpose: Declares the type of standard datum of an Interactive Object.
enumeration KindOfSurface is KOS_Plane, KOS_Cylinder, KOS_Cone, KOS_Sphere, KOS_Torus,
KOS_Revolution, KOS_Extrusion, KOS_OtherSurface;
-------------------------------------------------------
KOS_Revolution, KOS_Extrusion, KOS_OtherSurface;
-- Enumerations for dimensions management --
enumeration DisplaySpecialSymbol is DSS_No, DSS_Before, DSS_After;
---Purpose: Specifies dimension special symbol display options
enumeration DimensionDisplayMode is DDM_All, DDM_Line, DDM_Text;
---Purpose: Specifies dimension display modes for advanced highlighting and selection.
class Triangulation;
class TexturedShape;
@ -374,10 +379,10 @@ is
deferred class EllipseRadiusDimension;
class MaxRadiusDimension;
class MinRadiusDimension;
class LengthDimension;
class AngleDimension;
class RadiusDimension;
class DiameterDimension;
imported LengthDimension;
imported AngleDimension;
imported RadiusDimension;
imported DiameterDimension;
class Chamf2dDimension;
class Chamf3dDimension;
class OffsetDimension;

View File

@ -384,10 +384,10 @@ Standard_Boolean AIS::ComputeGeometry(const TopoDS_Edge& anEdge1,
//=======================================================================
//function : ComputeGeometry
//purpose : Computes the geometry of the 2 edges in the current wp
// and the 'rigth' geometry of the edges if one doesn't
// belong to the currentworkingplane.
// and the 'right' geometry of the edges if one doesn't
// belong to the current working plane.
// There may be only one curve that can't belong to the
// current workingplane ( attachement constraint)
// current working plane ( attachement constraint)
// if the 2 edges belong to the current WP, <WhatProj> = 0
//
// indexExt = 0 2 edges are in the current wp
@ -397,19 +397,19 @@ Standard_Boolean AIS::ComputeGeometry(const TopoDS_Edge& anEdge1,
// it returns Standard_False
//=======================================================================
Standard_Boolean AIS::ComputeGeometry(const TopoDS_Edge& anEdge1,
const TopoDS_Edge& anEdge2,
Standard_Integer& indexExt,
Handle(Geom_Curve)& aCurve1,
Handle(Geom_Curve)& aCurve2,
gp_Pnt& FirstPnt1,
gp_Pnt& LastPnt1,
gp_Pnt& FirstPnt2,
gp_Pnt& LastPnt2,
Handle(Geom_Curve)& extCurve,
Standard_Boolean& isInfinite1,
Standard_Boolean& isInfinite2,
const Handle(Geom_Plane)& aPlane)
Standard_Boolean AIS::ComputeGeometry (const TopoDS_Edge& anEdge1,
const TopoDS_Edge& anEdge2,
Standard_Integer& indexExt,
Handle(Geom_Curve)& aCurve1,
Handle(Geom_Curve)& aCurve2,
gp_Pnt& FirstPnt1,
gp_Pnt& LastPnt1,
gp_Pnt& FirstPnt2,
gp_Pnt& LastPnt2,
Handle(Geom_Curve)& extCurve,
Standard_Boolean& isInfinite1,
Standard_Boolean& isInfinite2,
const Handle(Geom_Plane)& aPlane)
{
if (aPlane.IsNull()) return Standard_False;
extCurve.Nullify();

View File

@ -1,287 +0,0 @@
-- Created on: 1996-12-03
-- Created by: Arnaud BOUZY/Odile Olivier
-- Copyright (c) 1996-1999 Matra Datavision
-- Copyright (c) 1999-2012 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.
class AngleDimension from AIS inherits Relation from AIS
---Purpose: A framework to define display of angles.
-- These displays are particularly useful in viewing draft prisms.
-- The angle displayed may define an intersection
-- can be between two edges or two faces of a shape
-- or a plane. The display consists of arrows and text.
uses Shape from TopoDS,
Presentation from Prs3d,
PresentationManager3d from PrsMgr,
Selection from SelectMgr,
Pnt from gp,
Dir from gp,
Circ from gp,
Line from Geom,
Ax1 from gp,
Projector from Prs3d,
Transformation from Geom,
Plane from Geom,
Surface from Geom,
ExtendedString from TCollection,
ArrowSide from DsgPrs,
KindOfDimension from AIS,
Edge from TopoDS,
Face from TopoDS
is
Create (aFirstEdge : Edge from TopoDS;
aSecondEdge : Edge from TopoDS;
aPlane : Plane from Geom;
aVal : Real from Standard;
aText : ExtendedString from TCollection)
---Purpose: Constructs the angle display object defined by the
-- shapes aFShape, aSShape, the plane aPlane, the
-- value aVal and the text aText.
-- aFShape and aSShape are edges.
returns mutable AngleDimension from AIS;
Create (aFirstEdge : Edge from TopoDS;
aSecondEdge : Edge from TopoDS;
aPlane : Plane from Geom;
aVal : Real from Standard;
aText : ExtendedString from TCollection;
aPosition : Pnt from gp;
aSymbolPrs : ArrowSide from DsgPrs;
anArrowSize : Real from Standard = 0.0)
---Purpose: Constructs the angle display object defined by the
-- shapes aFShape, aSShape, the plane aPlane, the
-- value aVal, the text aText, the point aPosition, the
-- type of arrow aSymbolPrs, and the arrow length anArrowSize.
-- aFShape and aSShape are edges.
returns mutable AngleDimension from AIS;
Create (aCone : Face from TopoDS;
aVal : Real from Standard;
aText : ExtendedString from TCollection)
---Purpose: Angle of cone
returns mutable AngleDimension from AIS;
Create (aCone : Face from TopoDS;
aVal : Real from Standard;
aText : ExtendedString from TCollection;
aPosition : Pnt from gp;
aSymbolPrs : ArrowSide from DsgPrs;
anArrowSize : Real from Standard = 0.01 )
---Purpose: Angle of cone
returns mutable AngleDimension from AIS;
--===================================================================
Create (aFirstFace : Face from TopoDS;
aSecondFace : Face from TopoDS;
anAxis : Ax1 from gp;
aVal : Real from Standard;
aText : ExtendedString from TCollection)
---Purpose: TwoPlanarFaceAngle dimension
returns mutable AngleDimension from AIS;
Create (aFirstFace : Face from TopoDS;
aSecondFace : Face from TopoDS;
anAxis : Ax1 from gp;
aVal : Real from Standard;
aText : ExtendedString from TCollection;
aPosition : Pnt from gp;
aSymbolPrs : ArrowSide from DsgPrs;
anArrowSize : Real from Standard = 0.0)
---Purpose: TwoPlanarFacesAngle dimension with position
-- and text Face can be Plane or Extrusion of line
-- or Offset of those
returns mutable AngleDimension from AIS;
Create (aFFace : Face from TopoDS;
aSFace : Face from TopoDS;
aVal : Real from Standard;
aText : ExtendedString from TCollection)
---Purpose: Angle dimension between two curvilinear faces
-- Warning:
-- Requaired 0 <= aVal < PI,
-- aVal must be defined exactly.
returns mutable AngleDimension from AIS;
Create (aFFace : Face from TopoDS;
aSFace : Face from TopoDS;
aVal : Real from Standard;
aText : ExtendedString from TCollection;
aPosition : Pnt from gp;
aSymbolPrs : ArrowSide from DsgPrs;
anArrowSize : Real from Standard = 0.001)
---Purpose: Angle dimension between two curvilinear faces
-- with position and text. Face can be Cone, Cylinder
-- Offset of Cone, Offset of Cylinder
returns mutable AngleDimension from AIS;
Axis (me)
---Purpose:
-- Returns the axis set by the SetAxis method, which
-- serves to locate the angle between two faces.
---C++: return const &
---C++: inline
returns Ax1 from gp
is static;
SetAxis(me: mutable;anAxis : Ax1 from gp)
---C++: inline
---Purpose:
-- Sets the axis, anAxis, which serves to locate the
-- angle between two faces.
is static;
SetConeFace( me: mutable; aConeFace : Face from TopoDS )
is static;
SetFirstShape( me: mutable; aFShape : Shape from TopoDS )
is redefined static;
SetSecondShape( me: mutable; aSShape : Shape from TopoDS )
is redefined static;
KindOfDimension(me)
---Purpose: Returns PLANEANGLE as the kind of dimension.
---C++: inline
returns KindOfDimension from AIS
is redefined;
IsMovable(me) returns Boolean from Standard
---C++: inline
---Purpose: Returns true if the angle dimension is movable.
is redefined;
-- Methods from PresentableObject
Compute(me : mutable;
aPresentationManager: PresentationManager3d from PrsMgr;
aPresentation : mutable Presentation from Prs3d;
aMode : Integer from Standard= 0)
is redefined static private;
Compute(me:mutable;
aProjector: Projector from Prs3d;
aPresentation: mutable Presentation from Prs3d)
is redefined static private;
Compute(me : mutable;
aProjector : Projector from Prs3d;
aTrsf : Transformation from Geom;
aPresentation : mutable Presentation from Prs3d)
is redefined;
---Purpose: Computes the presentation according to a point of view
-- given by <aProjector>.
-- This method should be used when the associated degenerated Presentations
-- have been transformed by <aTrsf> which is not a Pure
-- Translation. The HLR Prs can't be deducted automatically
-- WARNING :<aTrsf> must be applied
-- to the object to display before computation !!!
-- Methods from SelectableObject
ComputeSelection(me : mutable;
aSelection : mutable Selection from SelectMgr;
aMode : Integer from Standard)
is redefined private;
--
-- Computation private methods
--
ComputeConeAngle(me: mutable;
aPresentation : mutable Presentation from Prs3d)
is private;
ComputeTwoFacesAngle(me: mutable;
aPresentation : mutable Presentation from Prs3d)
is private;
ComputeTwoPlanarFacesAngle(me: mutable;
aPresentation : mutable Presentation from Prs3d)
is private;
ComputeTwoCurvilinearFacesAngle(me: mutable;
aPresentation : mutable Presentation from Prs3d)
is private;
ComputeTwoEdgesAngle(me: mutable;
aPresentation : mutable Presentation from Prs3d)
is private;
ComputeTwoEdgesNullAngle(me: mutable;
aPresentation : mutable Presentation from Prs3d;
l1 : Line from Geom;
l2 : Line from Geom;
ptat11 : Pnt from gp;
ptat12 : Pnt from gp;
ptat21 : Pnt from gp;
ptat22 : Pnt from gp;
isInf1 : Boolean from Standard;
isInf2 : Boolean from Standard )
is private;
ComputeTwoEdgesNotNullAngle(me: mutable;
aPresentation : mutable Presentation from Prs3d;
l1 : Line from Geom;
l2 : Line from Geom;
ptat11 : Pnt from gp;
ptat12 : Pnt from gp;
ptat21 : Pnt from gp;
ptat22 : Pnt from gp;
isInf1 : Boolean from Standard;
isInf2 : Boolean from Standard )
is private;
Compute3DSelection(me : mutable;
aSelection : mutable Selection from SelectMgr)
is private;
Compute2DSelection(me : mutable;
aSelection : mutable Selection from SelectMgr)
is private;
ComputeNull2DSelection(me : mutable;
aSelection : mutable Selection from SelectMgr;
distFS : Real from Standard)
is private;
ComputeConeAngleSelection(me : mutable;
aSelection : mutable Selection from SelectMgr)
is private;
fields
myNbShape : Integer from Standard;
myCenter : Pnt from gp;
myFAttach : Pnt from gp;
mySAttach : Pnt from gp;
myFDir : Dir from gp;
mySDir : Dir from gp;
myAxis : Ax1 from gp;
myCone : Face from TopoDS;
end AngleDimension;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,177 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-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.
//! 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
#include <AIS_Dimension.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Line.hxx>
#include <Geom_Transformation.hxx>
#include <gp.hxx>
#include <gp_Ax1.hxx>
#include <gp_Dir.hxx>
#include <gp_Pnt.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Projector.hxx>
#include <Prs3d_Presentation.hxx>
#include <Standard.hxx>
#include <Standard_Macro.hxx>
#include <Standard_DefineHandle.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
DEFINE_STANDARD_HANDLE (AIS_AngleDimension, AIS_Dimension)
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 the angle display object defined by the <br>
//! two edges and custom working plane and dimension aspect.
Standard_EXPORT AIS_AngleDimension (const TopoDS_Edge& theFirstEdge,
const TopoDS_Edge& theSecondEdge,
const gp_Pln& thePlane,
const Handle(Prs3d_DimensionAspect)& theDimensionAspect,
const Standard_Real theExtensionSize = 1.0);
//! 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);
//! Constructs the angle display object defined by three points
//! and dimension aspect that defines line, arrow and text aspect.
Standard_EXPORT AIS_AngleDimension (const gp_Pnt& theFirstPoint,
const gp_Pnt& theSecondPoint,
const gp_Pnt& theThirdPoint,
const Handle(Prs3d_DimensionAspect)& theDimensionAspect,
const Standard_Real theExtensionSize = 1.0);
//! Angle of cone
Standard_EXPORT AIS_AngleDimension (const TopoDS_Face& theCone);
//! TwoPlanarFaceAngle dimension
Standard_EXPORT AIS_AngleDimension (const TopoDS_Face& theFirstFace,
const TopoDS_Face& theSecondFace,
const gp_Ax1& theAxis);
//! Sets the flyout.
Standard_EXPORT void SetFlyout (const Standard_Real theFlyout);
//! Returns flyout value. If value > 0 the dimension is to be displayed inside the angle.
//! Otherwise it is displayed outside one.
Standard_EXPORT Standard_Real GetFlyout() const;
//! Sets first shape
Standard_EXPORT void SetFirstShape (const TopoDS_Shape& theShape,
const Standard_Boolean isSingleShape = Standard_False);
DEFINE_STANDARD_RTTI(AIS_AngleDimension)
protected:
//! Computes dimension value in display units
Standard_EXPORT virtual void computeValue();
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 AIS_DimensionDisplayMode theMode);
Standard_EXPORT void drawArcWithText (const Handle(Prs3d_Presentation)& thePresentation,
const gp_Pnt& theFirstAttach,
const gp_Pnt& theSecondAttach,
const TCollection_ExtendedString& theText,
const AIS_DimensionDisplayMode theMode);
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);
//! Auxiliary method to arrange text and arrows
Standard_EXPORT Standard_Boolean canTextBeInCenter (const gp_Pnt& theFirstAttach,
const gp_Pnt& theSecondAttach,
const Quantity_Length& theTextLength,
const Quantity_Length& theArrowLength);
//! Fills default plane object if it is possible to count plane automatically.
Standard_EXPORT virtual void countDefaultPlane ();
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;
//! The center of dimension arc
gp_Pnt myCenter;
//! Defines flyout lines and direction
//! Flyout direction in the working plane (stored in the base AIS_Dimension).
//! 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 (radius of angle).
Standard_Real myFlyout;
};
#endif

View File

@ -1,55 +0,0 @@
// Created on: 1997-02-28
// Created by: Jean-Pierre COMBE
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2012 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.
//=======================================================================
//function : KindOfDimension
//purpose :
//=======================================================================
inline AIS_KindOfDimension AIS_AngleDimension::KindOfDimension() const
{
return AIS_KOD_PLANEANGLE;
}
//=======================================================================
//function : IsMovable
//purpose :
//=======================================================================
inline Standard_Boolean AIS_AngleDimension::IsMovable() const
{
return Standard_True;
}
//=======================================================================
//function : Axis
//purpose :
//=======================================================================
inline const gp_Ax1& AIS_AngleDimension::Axis() const
{
return myAxis;
}
//=======================================================================
//function : SetAxis
//purpose :
//=======================================================================
inline void AIS_AngleDimension::SetAxis(const gp_Ax1& anAxis)
{
myAxis = anAxis;
}

View File

@ -29,7 +29,7 @@
#include <DsgPrs_Chamf2dPresentation.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Drawer.hxx>
#include <SelectMgr_EntityOwner.hxx>
@ -194,8 +194,8 @@ void AIS_Chamf2dDimension::Compute(const Handle(PrsMgr_PresentationManager3d)& ,
myPosition = curpos;
}
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
//-------------------------------------------------
//Calcul de la boite englobante du component pour

View File

@ -29,7 +29,7 @@
#include <DsgPrs_Chamf2dPresentation.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Drawer.hxx>
#include <SelectMgr_EntityOwner.hxx>
@ -170,8 +170,8 @@ void AIS_Chamf3dDimension::Compute(const Handle(PrsMgr_PresentationManager3d)& ,
myPosition = curpos;
}
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
//-------------------------------------------------
//Calcul de la boite englobante du component pour

View File

@ -1,192 +0,0 @@
-- Created on: 1996-12-05
-- Created by: Jacques MINOT/Odile Olivier/Serguei ZARITCHNY
-- Copyright (c) 1996-1999 Matra Datavision
-- Copyright (c) 1999-2012 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.
-- Modified Mon 12-january-98
-- <odl@sacadox.paris1.matra-dtv.fr>,
class DiameterDimension from AIS inherits Relation from AIS
---Purpose: A framework to display diameter dimensions.
-- A diameter is displayed with arrows and text. The
-- text gives the length of the diameter.
-- The algorithm takes a length along a face and
-- analyzes it as an arc. It then reconstructs the circle
-- corresponding to the arc and calculates the
-- diameter of this circle. This diameter serves as a
-- relational reference in 3d presentations of the surface.
uses
Shape from TopoDS,
Circ from gp,
Pnt from gp,
Pln from gp,
Plane from Geom,
Surface from Geom,
Presentation from Prs3d,
PresentationManager3d from PrsMgr,
Selection from SelectMgr,
Projector from Prs3d,
Transformation from Geom,
ExtendedString from TCollection,
ArrowSide from DsgPrs,
KindOfSurface from AIS,
KindOfDimension from AIS
raises ConstructionError from Standard
is
Create (aShape : Shape from TopoDS;
aVal : Real from Standard;
aText : ExtendedString from TCollection)
---Purpose: Constructs a diameter display object defined by the
-- shape aFShape, the dimension aVal and the text aText.
returns mutable DiameterDimension from AIS;
Create (aShape : Shape from TopoDS;
aVal : Real from Standard;
aText : ExtendedString from TCollection;
aPosition : Pnt from gp;
aSymbolPrs : ArrowSide from DsgPrs;
aDiamSymbol : Boolean from Standard;
anArrowSize : Real from Standard = 0.0)
---Purpose: Constructs a diameter display object defined by the
-- shape aFShape, the dimension aVal and the text
-- aText, the point of origin of the diameter aPosition,
-- and the type of arrow aSymbolPrs with the size anArrowSize.
-- If the Boolean aDiamSymbol is true.
returns mutable DiameterDimension from AIS;
KindOfDimension(me) returns KindOfDimension from AIS
---C++: inline
---Purpose:
-- Indicates that we are concerned with a length.
is redefined;
IsMovable(me) returns Boolean from Standard
---C++: inline
---Purpose:
-- Returns true if the diameter dimension is movable
is redefined;
DiamSymbol(me: mutable) returns Boolean from Standard
---C++: inline
---Purpose:
-- Returns the symbol for diameter dimension. This will
-- be either arrow, text, or a combination of both.
is static;
SetDiamSymbol(me: mutable;aDiamSymbol: Boolean from Standard)
---C++: inline
---Purpose:
-- Sets the symbol for diameter dimension aDiamSymbol.
-- This can be an arrow, a text or both.
is static;
-- SetPlane(me: mutable; aPlane : Plane from Geom)
-- is static;
-- ---C++: inline
-- Plane(me) returns any Plane from Geom
-- is static;
-- ---C++: inline
-- ---C++: return const &
-- Methods from PresentableObject
Compute(me : mutable;
aPresentationManager: PresentationManager3d from PrsMgr;
aPresentation : mutable Presentation from Prs3d;
aMode : Integer from Standard= 0)
is redefined private;
Compute(me:mutable;
aProjector: Projector from Prs3d;
aPresentation: mutable Presentation from Prs3d)
is redefined static private;
Compute(me : mutable;
aProjector : Projector from Prs3d;
aTrsf : Transformation from Geom;
aPresentation : mutable Presentation from Prs3d)
is redefined;
---Purpose: computes the presentation according to a point of view
-- given by <aProjector>.
-- To be Used when the associated degenerated Presentations
-- have been transformed by <aTrsf> which is not a Pure
-- Translation. The HLR Prs can't be deducted automatically
-- WARNING :<aTrsf> must be applied
-- to the object to display before computation !!!
-- Methods from SelectableObject
ComputeSelection(me : mutable;
aSelection : mutable Selection from SelectMgr;
aMode : Integer from Standard)
is redefined private;
--
-- Computation private methods
--
ComputeOneFaceDiameter(me: mutable;
aPresentation : mutable Presentation from Prs3d)
is private;
ComputeOneCylFaceDiameter(me: mutable;
aPresentation : mutable Presentation from Prs3d;
aSurfType : KindOfSurface from AIS;
aSurf : Surface from Geom )
is private;
ComputeOnePlanarFaceDiameter(me: mutable;
aPresentation : mutable Presentation from Prs3d )
is private;
ComputeOneEdgeDiameter(me: mutable;
aPresentation : mutable Presentation from Prs3d)
is private;
ComputeCircleDiameter(me: mutable;
aPresentation : mutable Presentation from Prs3d)
is private;
ComputeArcDiameter(me: mutable;
aPresentation : mutable Presentation from Prs3d;
ptFirst : Pnt from gp;
ptend : Pnt from gp)
is private;
ComputeArcSelection(me : mutable;
aSelection : mutable Selection from SelectMgr)
is private;
fields
myCircle : Circ from gp;
myIsAnArc : Boolean from Standard;
myDiamSymbol : Boolean from Standard;
myFirstPar : Real from Standard;
myLastPar : Real from Standard;
end DiameterDimension;

View File

@ -24,78 +24,63 @@
#define BUC60915 //GG 05/06/01 Enable to compute the requested arrow size
// if any in all dimensions.
#include <AIS_DiameterDimension.hxx>
#include <Standard_NotImplemented.hxx>
#include <AIS_DiameterDimension.ixx>
#include <Adaptor3d_HCurve.hxx>
#include <AIS.hxx>
#include <AIS_Drawer.hxx>
#include <AIS_DimensionOwner.hxx>
#include <DsgPrs_DiameterPresentation.hxx>
#include <DsgPrs_RadiusPresentation.hxx>
#include <TCollection_ExtendedString.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Prs3d_Text.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <Select3D_SensitiveBox.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <ElCLib.hxx>
#include <ElSLib.hxx>
#include <TopoDS.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <Adaptor3d_HCurve.hxx>
#include <Geom_Circle.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <GC_MakeCircle.hxx>
#include <gce_MakeDir.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Surface.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_SurfaceOfRevolution.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_SurfaceOfLinearExtrusion.hxx>
#include <gp_Pln.hxx>
#include <gp_Pnt.hxx>
#include <gp_Lin.hxx>
#include <gp_Ax1.hxx>
#include <gp_Dir.hxx>
#include <gp_Vec.hxx>
#include <AIS.hxx>
#include <AIS_Drawer.hxx>
#include <GC_MakeCircle.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_Group.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Prs3d_Text.hxx>
#include <Prs3d_Root.hxx>
#include <Precision.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <Select3D_SensitiveBox.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <Standard_Macro.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TopExp_Explorer.hxx>
IMPLEMENT_STANDARD_HANDLE(AIS_DiameterDimension, AIS_Dimension)
IMPLEMENT_STANDARD_RTTIEXT(AIS_DiameterDimension, AIS_Dimension)
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
AIS_DiameterDimension::AIS_DiameterDimension(const TopoDS_Shape& aShape,
const Standard_Real aVal,
const TCollection_ExtendedString& aText)
:AIS_Relation(),
myDiamSymbol(Standard_True)
AIS_DiameterDimension::AIS_DiameterDimension(const gp_Circ& theCircle)
: AIS_Dimension(),
myFlyout (0.0),
myCircle (theCircle)
{
myPosition = gp_Pnt(0.,0.,0.);
myFShape = aShape;
myVal = aVal;
myText = aText;
mySymbolPrs = DsgPrs_AS_LASTAR;
myAutomaticPosition = Standard_True;
myArrowSize = myVal / 100.;
SetKindOfDimension(AIS_KOD_DIAMETER);
myIsInitialized = Standard_True;
SetSpecialSymbol (0x00D8);
SetDisplaySpecialSymbol (AIS_DSS_Before);
// Count attach points
myFirstPoint = ElCLib::Value (0, myCircle);
mySecondPoint = myFirstPoint.Translated (gp_Vec(myFirstPoint, theCircle.Location())*2);
}
//=======================================================================
@ -103,27 +88,61 @@ AIS_DiameterDimension::AIS_DiameterDimension(const TopoDS_Shape& aShape,
//purpose :
//=======================================================================
AIS_DiameterDimension::AIS_DiameterDimension(const TopoDS_Shape& aShape,
const Standard_Real aVal,
const TCollection_ExtendedString& aText,
const gp_Pnt& aPosition,
const DsgPrs_ArrowSide aSymbolPrs,
const Standard_Boolean aDiamSymbol,
const Standard_Real anArrowSize)
:AIS_Relation(),
myDiamSymbol(aDiamSymbol)
AIS_DiameterDimension::AIS_DiameterDimension(const gp_Circ& theCircle, const gp_Pnt& theAttachPoint)
: AIS_Dimension(),
myFlyout (0.0),
myCircle (theCircle)
{
myFShape = aShape;
myVal = aVal;
myText = aText;
mySymbolPrs = aSymbolPrs;
myPosition = aPosition;
myAutomaticPosition = Standard_False;
#ifdef BUC60915
SetArrowSize( anArrowSize );
#else
myArrowSize = anArrowSize;
#endif
SetKindOfDimension(AIS_KOD_DIAMETER);
SetSpecialSymbol (0x00D8);
SetDisplaySpecialSymbol (AIS_DSS_Before);
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 :
//=======================================================================
AIS_DiameterDimension::AIS_DiameterDimension (const gp_Circ& theCircle,
const Handle(Prs3d_DimensionAspect)& theDimensionStyle,
const Standard_Real theExtensionSize /*= 1.0*/)
: AIS_Dimension (theExtensionSize),
myFlyout (0.0),
myCircle (theCircle)
{
SetKindOfDimension(AIS_KOD_DIAMETER);
SetSpecialSymbol (0x00D8);
SetDisplaySpecialSymbol(AIS_DSS_Before);
myDrawer->SetDimensionAspect(theDimensionStyle);
myIsInitialized = Standard_True;
}
//=======================================================================
//function : Constructor
//purpose : Universal constructor for diameter dimension of shape
//=======================================================================
AIS_DiameterDimension::AIS_DiameterDimension (const TopoDS_Shape& theShape)
: AIS_Dimension (),
myFlyout (0.)
{
SetKindOfDimension(AIS_KOD_DIAMETER);
SetSpecialSymbol (0x00D8);
SetDisplaySpecialSymbol(AIS_DSS_Before);
myFirstShape = theShape;
myIsInitialized = Standard_False;
}
//=======================================================================
@ -131,590 +150,100 @@ AIS_DiameterDimension::AIS_DiameterDimension(const TopoDS_Shape& aShape,
//purpose :
//=======================================================================
void AIS_DiameterDimension::Compute(
const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer /*aMode*/)
void AIS_DiameterDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePM*/,
const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode)
{
aPresentation->Clear();
thePresentation->Clear();
switch (myFShape.ShapeType()) {
case TopAbs_FACE :
{
// compute one face case
ComputeOneFaceDiameter (aPresentation);
break;
}
case TopAbs_EDGE:
{
ComputeOneEdgeDiameter (aPresentation);
break;
}
default:
break;
}
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
}
//=======================================================================
//function : Compute
//purpose : to avoid warning
//=======================================================================
void AIS_DiameterDimension::Compute(const Handle(Prs3d_Projector)& aProjector,
const Handle(Prs3d_Presentation)& aPresentation)
{
// Standard_NotImplemented::Raise("AIS_DiameterDimension::Compute(const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation)");
PrsMgr_PresentableObject::Compute( aProjector , aPresentation ) ;
}
void AIS_DiameterDimension::Compute(const Handle_Prs3d_Projector& aProjector, const Handle_Geom_Transformation& aTransformation, const Handle_Prs3d_Presentation& aPresentation)
{
// Standard_NotImplemented::Raise("AIS_DiameterDimension::Compute(const Handle_Prs3d_Projector&, const Handle_Geom_Transformation&, const Handle_Prs3d_Presentation&)");
PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation ) ;
}
//=======================================================================
//function : ComputeSelection
//purpose :
//=======================================================================
void AIS_DiameterDimension::ComputeSelection(
const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer /*aMode*/)
{
Handle(AIS_DimensionOwner) own = new AIS_DimensionOwner(this,7);
own->SetShape(myFShape);
if (!myIsAnArc) {
gp_Pnt AttachmentPoint = myPosition;
Standard_Real parat = ElCLib::Parameter(myCircle,AttachmentPoint);
gp_Pnt ptoncirc = ElCLib::Value (parat,myCircle);
// ligne de cote
gp_Pnt center = myCircle.Location();
gp_Vec vecrap (ptoncirc,center);
Standard_Real dist = center.Distance(AttachmentPoint);
Standard_Real aRadius = myCircle.Radius();
Standard_Real inside = Standard_False;
gp_Pnt pt1 = AttachmentPoint;
if (dist < aRadius) {
pt1 = ptoncirc;
dist = aRadius;
inside = Standard_True;
}
vecrap.Normalize();
vecrap *= (dist+aRadius);
gp_Pnt OppositePoint = pt1.Translated(vecrap);
if ( pt1.Distance(OppositePoint)>=Precision::Confusion()) {
Handle(Select3D_SensitiveSegment)
seg = new Select3D_SensitiveSegment(own,pt1 ,OppositePoint);
aSelection->Add(seg);
}
}
else
ComputeArcSelection(aSelection);
// Text
Standard_Real size(Min(myVal/100.+1.e-6,myArrowSize+1.e-6));
Handle( Select3D_SensitiveBox ) box = new Select3D_SensitiveBox( own,
myPosition.X(),
myPosition.Y(),
myPosition.Z(),
myPosition.X() + size,
myPosition.Y() + size,
myPosition.Z() + size);
aSelection->Add(box);
}
//==========================================================================
// function : ComputeArcSelection
// purpose :
//
//==========================================================================
void AIS_DiameterDimension::ComputeArcSelection(const Handle(SelectMgr_Selection)& aSelection)
{
Standard_Real fpara;
Standard_Real lpara;
fpara = myFirstPar;
lpara = myLastPar;
Handle(SelectMgr_EntityOwner) own = new SelectMgr_EntityOwner(this,7);
gp_Pnt theCenter = myCircle.Location();
while (lpara > 2*M_PI) {
fpara -= 2*M_PI;
lpara -= 2*M_PI;
}
Standard_Real parat = ElCLib::Parameter(myCircle,myPosition);
Standard_Boolean otherside(Standard_False);
gp_Pnt attpoint = myPosition;
if (!AIS::InDomain(fpara,lpara,parat)) {
Standard_Real otherpar = parat + M_PI;
if (otherpar > 2*M_PI) otherpar -= 2*M_PI;
if (AIS::InDomain(fpara,lpara,otherpar)) {
parat = otherpar;
otherside = Standard_True;
}
else {
Standard_Real ecartpar = Min(Abs(fpara-parat),
Abs(lpara-parat));
Standard_Real ecartoth = Min(Abs(fpara-otherpar),
Abs(lpara-otherpar));
if (ecartpar <= ecartoth) {
if (parat < fpara) parat = fpara;
else parat = lpara;
}
else {
otherside = Standard_True;
if (otherpar < fpara) parat = fpara;
else parat = lpara;
}
gp_Pnt ptdir = ElCLib::Value(parat,myCircle);
gp_Lin lsup(theCenter,
gp_Dir(ptdir.XYZ()-theCenter.XYZ()));
Standard_Real parpos = ElCLib::Parameter(lsup,myPosition);
attpoint = ElCLib::Value(parpos,lsup);
}
}
gp_Pnt ptoncirc = ElCLib::Value(parat,myCircle);
gp_Lin L (theCenter,gp_Dir(attpoint.XYZ()-theCenter.XYZ()));
gp_Pnt firstpoint = attpoint;
gp_Pnt drawtopoint = ptoncirc;
if (!otherside) {
Standard_Real uatt = ElCLib::Parameter(L,attpoint);
Standard_Real uptc = ElCLib::Parameter(L,ptoncirc);
if (Abs(uatt) > Abs(uptc)) {
drawtopoint = theCenter;
}
else {
firstpoint = theCenter;
}
}
Handle(Select3D_SensitiveSegment) seg = new Select3D_SensitiveSegment(own,firstpoint,drawtopoint);
aSelection->Add(seg);
}
//=======================================================================
//function : ComputeOneFaceDiameter
//purpose :
//=======================================================================
void AIS_DiameterDimension::ComputeOneFaceDiameter(
const Handle(Prs3d_Presentation)& aPresentation)
{
//cout<<"AIS_DiameterDimension::ComputeOneFaceDiameter"<<endl;
gp_Pln aPln;
Handle( Geom_Surface ) aBasisSurf;
AIS_KindOfSurface aSurfType = AIS_KOS_OtherSurface;
Standard_Real Offset;
if( myAutomaticPosition )
AIS::GetPlaneFromFace( TopoDS::Face( myFShape),
aPln,
aBasisSurf,
aSurfType,
Offset ) ;
if ( aSurfType == AIS_KOS_Plane )
ComputeOnePlanarFaceDiameter( aPresentation );
else
ComputeOneCylFaceDiameter( aPresentation, aSurfType, aBasisSurf );
}
//=======================================================================
//function : ComputeOneCylFaceDiameter
//purpose :
//=======================================================================
void AIS_DiameterDimension::ComputeOneCylFaceDiameter
(const Handle(Prs3d_Presentation)& aPresentation,
const AIS_KindOfSurface aSurfType,
const Handle( Geom_Surface )& aBasisSurf )
{
gp_Pnt curPos;
if( myAutomaticPosition )
{
BRepAdaptor_Surface surf1(TopoDS::Face(myFShape));
Standard_Real uFirst, uLast, vFirst, vLast;
uFirst = surf1.FirstUParameter();
uLast = surf1.LastUParameter();
vFirst = surf1.FirstVParameter();
vLast = surf1.LastVParameter();
Standard_Real uMid = (uFirst + uLast)*0.5;
Standard_Real vMid = (vFirst + vLast)*0.5;
surf1.D0(uMid, vMid, curPos);
Handle( Adaptor3d_HCurve ) BasisCurve;
//Standard_Real Param;
Standard_Boolean ExpectedType = Standard_False;
if (aSurfType == AIS_KOS_Cylinder)
{
ExpectedType = Standard_True;
}
else
if (aSurfType == AIS_KOS_Revolution)
{
BasisCurve = surf1.BasisCurve();
if (BasisCurve->GetType() == GeomAbs_Line)
ExpectedType = Standard_True;
}
else if (aSurfType == AIS_KOS_Extrusion)
{
BasisCurve = surf1.BasisCurve();
if ( BasisCurve->GetType() == GeomAbs_Circle )
ExpectedType = Standard_True;
}
if(!ExpectedType) {
Standard_ConstructionError::Raise("AIS:: Not expected type of surface") ;
return;
}
//
Handle(Geom_Curve) aCurve;
aCurve = aBasisSurf->VIso(vMid);
if (aCurve->DynamicType() == STANDARD_TYPE(Geom_Circle))
{
myCircle = Handle(Geom_Circle)::DownCast(aCurve)->Circ();//gp_Circ
}
else if (aCurve->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) {
Handle(Geom_TrimmedCurve) tCurve = Handle(Geom_TrimmedCurve)::DownCast(aCurve);
aCurve = tCurve->BasisCurve();
uFirst = tCurve->FirstParameter();
uLast = tCurve->LastParameter();
if (aCurve->DynamicType() == STANDARD_TYPE(Geom_Circle))
myCircle = Handle(Geom_Circle)::DownCast(aCurve)->Circ();//gp_Circ
}
else {
// compute a circle from 3 points on "aCurve"
gp_Pnt P1, P2;
surf1.D0(uFirst, vMid, P1);
surf1.D0(uLast, vMid, P2);
GC_MakeCircle mkCirc(P1, curPos, P2);
myCircle = mkCirc.Value()->Circ();
}
myCircle.SetRadius(myVal/2.);
myPlane = new Geom_Plane(gp_Pln(gp_Ax3(myCircle.Position())));//gp_Circ
gp_Vec v1(myCircle.Location(), curPos);
v1.Normalize();
v1 = v1 * myVal*1.2;
myPosition = myCircle.Location().Translated(v1);
// IsArc ?
gp_Pnt p1, p2;
p1 = ElCLib::Value (uFirst, myCircle);
p2 = ElCLib::Value (uLast, myCircle);
if ( p1.IsEqual(p2, Precision::Confusion()) )
myIsAnArc = Standard_False;
else myIsAnArc = Standard_True;
myFirstPar = uFirst;
myLastPar = uLast;
// myPosition = curPos;
myAutomaticPosition = Standard_True;
if ( myIsSetBndBox )
myPosition = AIS::TranslatePointToBound( myPosition, gp_Dir( gp_Vec( myCircle.Location(),
myPosition ) ), myBndBox );
}
else { // !AutomaticPosition
curPos = myPosition;
curPos = AIS::ProjectPointOnPlane( curPos, myPlane->Pln() );
myPosition = curPos;
}
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
// size
#ifdef BUC60915
if( !myArrowSizeIsDefined ) {
myArrowSize = Min(myArrowSize,myCircle.Radius()/5.);
}
arr->SetLength(myArrowSize);
#else
if (myCircle.Radius()/5. > myArrowSize) {
arr->SetLength(myArrowSize);
}
else {
arr->SetLength(myCircle.Radius()/5.);
}
#endif
//cout<<"AIS_DiameterDimension:: add Prs"<<endl;
if( myIsAnArc )
DsgPrs_DiameterPresentation::Add(aPresentation, myDrawer, myText, myPosition,
myCircle, myFirstPar, myLastPar, mySymbolPrs, myDiamSymbol);
else
DsgPrs_DiameterPresentation::Add(aPresentation, myDrawer, myText, myPosition,
myCircle, DsgPrs_AS_BOTHAR, myDiamSymbol);
}
//=======================================================================
//function : ComputeCircleDiameter
//purpose :
//=======================================================================
void AIS_DiameterDimension::ComputeCircleDiameter(const Handle(Prs3d_Presentation)& aPresentation)
{
gp_Pnt center = myCircle.Location();
Standard_Real rad = myCircle.Radius();
gp_Pnt curpos;
if (myAutomaticPosition) {
// we compute 1 point on the circle
myPlane = new Geom_Plane(gp_Pln(gp_Ax3(myCircle.Position())));//gp_Circ
gp_Dir xdir = myCircle.XAxis().Direction();
Standard_Real deport = rad *1.2;
curpos = center.Translated( gp_Vec(xdir)*deport );
SetPosition (curpos);// myPosition = curpos
myAutomaticPosition = Standard_True;
if (myIsSetBndBox)
myPosition = AIS::TranslatePointToBound( myPosition, gp_Dir( gp_Vec( myCircle.Location(),
myPosition ) ), myBndBox );
}
else {
curpos = myPosition;
// VRO (2007-05-17) inserted this IF.
if (myPlane.IsNull())
myPlane = new Geom_Plane(gp_Pln(gp_Ax3(myCircle.Position())));
myPosition = AIS::ProjectPointOnPlane( curpos, myPlane->Pln() );
}
// size
Handle(Prs3d_LengthAspect) LA = myDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = LA->Arrow1Aspect();
#ifdef BUC60915
if( !myArrowSizeIsDefined ) {
myArrowSize = Min(myArrowSize,myCircle.Radius()/5.);
}
arr->SetLength(myArrowSize);
#else
if (myCircle.Radius()/5. > myArrowSize) {
arr->SetLength(myArrowSize);
}
else {
arr->SetLength(myCircle.Radius()/5.);
}
#endif
DsgPrs_DiameterPresentation::Add(aPresentation, myDrawer, myText, myPosition, myCircle,
DsgPrs_AS_BOTHAR, myDiamSymbol );
}
//==========================================================================
// function : ComputeArcDiameter
// purpose :
//
//==========================================================================
void AIS_DiameterDimension::ComputeArcDiameter(
const Handle(Prs3d_Presentation)& aPresentation,
const gp_Pnt& pfirst,
const gp_Pnt& pend)
{
gp_Pnt center = myCircle.Location();
Standard_Real rad = myCircle.Radius();
gp_Pnt curpos;
Standard_Real parfirst, parend;
parfirst = ElCLib::Parameter(myCircle, pfirst);
parend = ElCLib::Parameter(myCircle, pend);
myFirstPar = parfirst;
myLastPar = parend;
if ( parfirst > parend) {
parfirst -= 2*M_PI;
}
if (myAutomaticPosition) {
Standard_Real pcurpos = (parfirst + parend)/2.;
curpos = ElCLib::Value(pcurpos, myCircle);
myPlane = new Geom_Plane(gp_Pln(gp_Ax3(myCircle.Position())));//gp_Circ
gp_Dir vdir(gp_Vec(myCircle.Location(),curpos));
Standard_Real deport = rad * 1.2;
curpos = center.Translated( gp_Vec(vdir)*deport );
SetPosition (curpos);
myAutomaticPosition = Standard_True;
if ( myIsSetBndBox )
myPosition = AIS::TranslatePointToBound( myPosition, gp_Dir( gp_Vec( myCircle.Location(),
myPosition ) ), myBndBox );
}
else {
curpos = myPosition;
myPosition = AIS::ProjectPointOnPlane( curpos, myPlane->Pln() );
}
// size
Handle(Prs3d_LengthAspect) LA = myDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = LA->Arrow1Aspect();
#ifdef BUC60915
if( !myArrowSizeIsDefined ) {
myArrowSize = Min(myArrowSize,myCircle.Radius()/5.);
}
arr->SetLength(myArrowSize);
#else
if (myCircle.Radius()/5. > myArrowSize) {
arr->SetLength(myArrowSize);
}
else {
arr->SetLength(myCircle.Radius()/5.);
}
#endif
// Display
DsgPrs_DiameterPresentation::Add (aPresentation, myDrawer, myText, myPosition, myCircle,
parfirst, parend, mySymbolPrs, myDiamSymbol);
}
//==========================================================================
// function : ComputeOneEdgeDiameter
// purpose :
//
//==========================================================================
void AIS_DiameterDimension::ComputeOneEdgeDiameter(const Handle(Prs3d_Presentation)& aPresentation)
{
gp_Pnt ptfirst,ptend;
Handle(Geom_Curve) curv;
if (!AIS::ComputeGeometry(TopoDS::Edge(myFShape),curv,ptfirst,ptend)) return;
Handle(Geom_Circle) circ = Handle(Geom_Circle)::DownCast(curv);
if ( circ.IsNull()) return;
myCircle = circ->Circ();
myCircle.SetRadius(myVal/2.);
if ( ptfirst.IsEqual(ptend, Precision::Confusion()) ) {
myIsAnArc = Standard_False;
ComputeCircleDiameter(aPresentation);
}
else {
myIsAnArc = Standard_True;
ComputeArcDiameter(aPresentation,ptfirst,ptend );
}
}
//===================================================================
//function : CircleFromPlanarFace
//purpose : if possible computes circle from planar face
//=======================================================================
static Standard_Boolean CircleFromPlanarFace(const TopoDS_Face& aFace,
Handle(Geom_Curve)& aCurve,
gp_Pnt & ptfirst, gp_Pnt & ptend)
{
TopExp_Explorer ExploEd( aFace, TopAbs_EDGE );
for ( ; ExploEd.More(); ExploEd.Next())
{
TopoDS_Edge curedge = TopoDS::Edge( ExploEd.Current() );
if (AIS::ComputeGeometry(curedge, aCurve, ptfirst, ptend))
if(aCurve->IsInstance(STANDARD_TYPE(Geom_Circle)) &&
!Handle(Geom_Circle)::DownCast(aCurve).IsNull())
return Standard_True;
}
return Standard_False;
}
//=======================================================================
//function : ComputeOnePlanarFaceDiameter
//purpose :
//=======================================================================
void AIS_DiameterDimension::ComputeOnePlanarFaceDiameter(const Handle(Prs3d_Presentation)& aPresentation)
{
gp_Pnt curPos ;
Standard_Real parfirst =0., parend =0.;
if (myAutomaticPosition) {
Handle(Geom_Curve) curv;
gp_Pnt ptfirst,ptend;
if( !CircleFromPlanarFace( TopoDS::Face( myFShape ), curv, ptfirst, ptend) ) {
Standard_ConstructionError::Raise("AIS:: Curve is not a circle or is Null") ;
return;
}
myCircle = Handle(Geom_Circle)::DownCast(curv)->Circ();
if ( ptfirst.IsEqual(ptend, Precision::Confusion()) )
myIsAnArc = Standard_False;
if (!myIsInitialized)
{
if (!initCircularDimension (myFirstShape, myCircle,
myFirstPoint, mySecondPoint))
return;
else
myIsAnArc = Standard_True;
myCircle.SetRadius(myVal/2.);//
BRepAdaptor_Surface surfAlgo (TopoDS::Face(myFShape));
myPlane = new Geom_Plane(gp_Pln(gp_Ax3(myCircle.Position())));//gp_Circ
gp_Pnt center = myCircle.Location();
Standard_Real rad = myCircle.Radius();
Standard_Real deport = rad * 1.2;
if(! myIsAnArc ) { // Circle
gp_Dir xdir = myCircle.XAxis().Direction();
curPos = center.Translated( gp_Vec(xdir)*deport );
}
else { // Arc
parfirst = ElCLib::Parameter(myCircle, ptfirst);
parend = ElCLib::Parameter(myCircle, ptend);
if ( parfirst > parend) {
parfirst -= 2*M_PI;
}
Standard_Real parcurPos = (parfirst + parend) * 0.5;
curPos = ElCLib::Value(parcurPos, myCircle);
gp_Vec v1( center, curPos );
v1.Normalize();
curPos = center.Translated( v1 * deport );
}
myFirstPar = parfirst;
myLastPar = parend;
myPosition = curPos;
myAutomaticPosition = Standard_True;
if ( myIsSetBndBox )
myPosition = AIS::TranslatePointToBound( myPosition, gp_Dir( gp_Vec( myCircle.Location(),
myPosition ) ), myBndBox );
} else
{
// !myAutomaticPosition
// Project point on the plane of face
curPos = myPosition;
curPos = AIS::ProjectPointOnPlane( curPos, myPlane->Pln() );
myPosition = curPos;
}
myIsInitialized = Standard_True;
}
if (!myIsWorkingPlaneCustom)
countDefaultPlane();
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
//Count flyout direction
gp_Ax1 aWorkingPlaneNormal = GetWorkingPlane().Axis();
gp_Dir aTargetPointsVector = gce_MakeDir (myFirstPoint, mySecondPoint);
// Count a flyout direction vector.
gp_Dir aFlyoutVector = aWorkingPlaneNormal.Direction()^aTargetPointsVector;
gp_Ax3 aLocalSystem (myFirstPoint, aTargetPointsVector, aFlyoutVector);
// size
#ifdef BUC60915
if( !myArrowSizeIsDefined ) {
myArrowSize = Min(myArrowSize,myCircle.Radius()/5.);
// Create lines for layouts
gp_Lin aLine1 (myFirstPoint, aFlyoutVector);
gp_Lin aLine2 (mySecondPoint, aFlyoutVector);
// Get flyout end points
gp_Pnt aFlyoutEnd1 = ElCLib::Value (ElCLib::Parameter (aLine1, myFirstPoint) + GetFlyout(), aLine1);
gp_Pnt aFlyoutEnd2 = ElCLib::Value (ElCLib::Parameter (aLine2, mySecondPoint) + GetFlyout(), aLine2);
// Add layout lines to graphic group
// Common to all type of dimension placement.
if (theMode == 0)
{
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments(4);
aPrimSegments->AddVertex (myFirstPoint);
aPrimSegments->AddVertex (aFlyoutEnd1);
aPrimSegments->AddVertex (mySecondPoint);
aPrimSegments->AddVertex (aFlyoutEnd2);
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
}
arr->SetLength(myArrowSize);
#else
if (myCircle.Radius()/5. > myArrowSize) {
arr->SetLength(myArrowSize);
}
else {
arr->SetLength(myCircle.Radius()/5.);
}
#endif
if(! myIsAnArc )
DsgPrs_DiameterPresentation::Add(aPresentation, myDrawer, myText, myPosition,
myCircle, DsgPrs_AS_BOTHAR, myDiamSymbol);
else
DsgPrs_DiameterPresentation::Add(aPresentation, myDrawer, myText, myPosition,
myCircle, myFirstPar, myLastPar, mySymbolPrs, myDiamSymbol );
drawLinearDimension (thePresentation, aFlyoutEnd1, aFlyoutEnd2, (AIS_DimensionDisplayMode)theMode);
}
//=======================================================================
//function : computeValue
//purpose :
//=======================================================================
void AIS_DiameterDimension::computeValue ()
{
myValue = myFirstPoint.Distance (mySecondPoint);
AIS_Dimension::computeValue();
}
//=======================================================================
//function : countDefaultPlane
//purpose :
//=======================================================================
void AIS_DiameterDimension::countDefaultPlane ()
{
// 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 ();
}
//=======================================================================
//function : SetFlyout
//purpose :
//=======================================================================
void AIS_DiameterDimension::SetFlyout (const Standard_Real theFlyout)
{
myFlyout = theFlyout;
}
//=======================================================================
//function : GetFlyout
//purpose :
//=======================================================================
Standard_Real AIS_DiameterDimension::GetFlyout () const
{
return myFlyout;
}

View File

@ -0,0 +1,85 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 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 _AIS_DiameterDimension_HeaderFile
#define _AIS_DiameterDimension_HeaderFile
#include <AIS.hxx>
#include <AIS_Dimension.hxx>
#include <gp_Pnt.hxx>
#include <gp_Circ.hxx>
#include <Standard.hxx>
#include <Standard_Macro.hxx>
#include <Standard_DefineHandle.hxx>
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>
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);
//! Consctructor 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);
Standard_EXPORT AIS_DiameterDimension (const gp_Circ& theCircle,
const Handle(Prs3d_DimensionAspect)& theDimensionStyle,
const Standard_Real theExtensionSize = 1.0);
Standard_EXPORT AIS_DiameterDimension (const TopoDS_Shape& theShape);
Standard_EXPORT void SetFlyout(const Standard_Real theFlyout);
Standard_EXPORT Standard_Real GetFlyout () const;
DEFINE_STANDARD_RTTI(AIS_DiameterDimension)
protected:
Standard_EXPORT virtual void computeValue ();
//! Fills default plane object if it is possible to count plane automatically.
Standard_EXPORT virtual void countDefaultPlane ();
private:
virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode = 0);
// Fields
//! Defines flyout lines and direction
//! Flyout direction in the working plane (stored in the base AIS_Dimension).
//! 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_Circ myCircle;
};
#endif

View File

@ -1,61 +0,0 @@
// Created on: 1997-02-28
// Created by: Jean-Pierre COMBE, Serguei ZARITCHNY
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2012 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.
// Modified Mon 12-january-98
// <jpr> <szy>
//=======================================================================
//function : KindOfDimension
//purpose :
//=======================================================================
inline AIS_KindOfDimension AIS_DiameterDimension::KindOfDimension() const
{
return AIS_KOD_DIAMETER;
}
//=======================================================================
//function : IsMovable
//purpose :
//=======================================================================
inline Standard_Boolean AIS_DiameterDimension::IsMovable() const
{
return Standard_True;
}
//=======================================================================
//function : DiamSymbol
//purpose :
//=======================================================================
inline Standard_Boolean AIS_DiameterDimension::DiamSymbol()
{
return myDiamSymbol;
}
//=======================================================================
//function : SetDiamSymbol
//purpose :
//=======================================================================
inline void AIS_DiameterDimension::SetDiamSymbol(const Standard_Boolean aDiamSymbol)
{
myDiamSymbol = aDiamSymbol;
}

1344
src/AIS/AIS_Dimension.cxx Normal file

File diff suppressed because it is too large Load Diff

317
src/AIS/AIS_Dimension.hxx Normal file
View File

@ -0,0 +1,317 @@
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-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 _AIS_Dimension_Headerfile
#define _AIS_Dimension_Headerfile
#include <AIS_DimensionDisplayMode.hxx>
#include <AIS_DisplaySpecialSymbol.hxx>
#include <AIS_InteractiveObject.hxx>
#include <AIS_KindOfInteractive.hxx>
#include <AIS_KindOfDimension.hxx>
#include <AIS_KindOfSurface.hxx>
#include <Bnd_Box.hxx>
#include <Geom_Curve.hxx>
#include <gp_Pln.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Prs3d_VerticalTextAlignment.hxx>
#include <Select3D_ListOfSensitive.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <Standard.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TColgp_HArray1OfPnt.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
DEFINE_STANDARD_HANDLE(AIS_Dimension, AIS_InteractiveObject)
class AIS_Dimension : public AIS_InteractiveObject
{
public:
//! Constructor with default parameters values
Standard_EXPORT AIS_Dimension (const Standard_Real theExtensionSize = 1.0);
//! Constructor to set aspect of dimension
Standard_EXPORT AIS_Dimension (const Handle(Prs3d_DimensionAspect)& theAspect,
const Standard_Real theExtensionSize = 1.0);
//! Gets dimension value
Standard_EXPORT Standard_Real GetValue () const;
//! 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);
//! Gets working plane.
Standard_EXPORT const gp_Pln& GetWorkingPlane() const;
//! Sets working plane.
Standard_EXPORT void SetWorkingPlane (const gp_Pln& thePlane);
//! Sets extension size.
Standard_EXPORT void SetExtensionSize (const Standard_Real theExtensionSize);
//! Gets extension size.
Standard_EXPORT Standard_Real GetExtensionSize() const;
Standard_EXPORT void SetFirstPoint (const gp_Pnt& thePoint);
Standard_EXPORT void SetSecondPoint (const gp_Pnt& thePoint);
Standard_EXPORT void SetFirstShape (const TopoDS_Shape& theFirstShape);
Standard_EXPORT void SetSecondShape (const TopoDS_Shape& theSecondShape);
//! 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;
//! Sets new length aspect in the interactive object drawer.
Standard_EXPORT void SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theDimensionAspect);
//! Returns the kind of dimension
Standard_EXPORT AIS_KindOfDimension KindOfDimension() const;
//! 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);
//! 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;
// Selection computing if it is needed here
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode);
//! Reset working plane to default.
Standard_EXPORT void ResetWorkingPlane();
//! specifies dimension special symbol display options
Standard_EXPORT void SetDisplaySpecialSymbol (const AIS_DisplaySpecialSymbol theDisplaySpecSymbol);
//! shows dimension special symbol display options
Standard_EXPORT AIS_DisplaySpecialSymbol DisplaySpecialSymbol() const;
//! specifies special symbol
Standard_EXPORT void SetSpecialSymbol (const Standard_ExtCharacter theSpecialSymbol);
//! returns special symbol
Standard_EXPORT Standard_ExtCharacter SpecialSymbol() const;
//! shows if Units are to be displayed along with dimension value
Standard_EXPORT Standard_Boolean IsUnitsDisplayed() const;
//! sets to display units along with the dimansion value or no
Standard_EXPORT void MakeUnitsDisplayed (const Standard_Boolean toDisplayUnits);
//! returns the current type of units
Standard_EXPORT TCollection_AsciiString UnitsQuantity() const;
//! sets the current type of units
Standard_EXPORT void SetUnitsQuantity (const TCollection_AsciiString& theUnitsQuantity);
//! 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);
//! sets the text offset: distance from attach point to the text on the extension
//! in case if text isn't in center of the dimension line
Standard_EXPORT void SetTextOffset (const Standard_Real theOffset);
//! returns the text offset: distance from attach point to the text on the extension
//! in case if text isn't in center of the dimension line
Standard_EXPORT Standard_Real TextOffset() const;
//! 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);
//! 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);
//! 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;
DEFINE_STANDARD_RTTI(AIS_Dimension)
protected:
Standard_EXPORT void getTextWidthAndString (Quantity_Length& theWidth,
TCollection_ExtendedString& theString) 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();
//! Performs drawing of 2d or 3d arrows on the working plane
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
//! @return text width relative to the dimension working plane. For 2d text this value will be zero.
Standard_EXPORT Standard_Real drawText (const Handle(Prs3d_Presentation)& thePresentation,
const gp_Dir& theTextDir,
const TCollection_ExtendedString theText,
const AIS_DimensionDisplayMode theMode);
//! Performs computing of dimension linear extension with text
Standard_EXPORT virtual void drawExtensionWithText (const Handle(Prs3d_Presentation)& thePresentation,
const gp_Pnt& theStartPoint,
const gp_Lin& theDimensionLine,
const TCollection_ExtendedString& theValueString,
const AIS_DimensionDisplayMode theMode);
//! Performs computing of linear dimension (for length, diameter, radius and so on)
Standard_EXPORT void drawLinearDimension (const Handle(Prs3d_Presentation)& thePresentation,
const gp_Pnt& theFirstAttach,
const gp_Pnt& theSecondAttach,
const AIS_DimensionDisplayMode theMode,
const Standard_Boolean isOneSideDimension = Standard_False);
//! If it's possible computes circle from planar face
Standard_EXPORT Standard_Boolean circleFromPlanarFace (const TopoDS_Face& theFace,
Handle(Geom_Curve)& theCurve,
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;
Standard_EXPORT void setComputed (Standard_Boolean isComputed);
Standard_EXPORT gp_Pnt textPosition() const;
Standard_EXPORT void setTextPosition (const gp_Pnt thePosition);
Standard_EXPORT void resetGeom();
// Fields
protected:
/// WORKING PLANE PROPERTIES
//! Dimension default plane
gp_Pln myDefaultPlane;
//! Shows if working plane is set custom
Standard_Boolean myIsWorkingPlaneCustom;
/// 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;
/// 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;
/// GEOMETRY PROPERTIES
//! Geometry of dimensions, needs for advanced selection
//! Geometry is computed in Compute() method and is used
//! in ComputeSelection() method.
//! If it is computed successfully, myIsComputed = Standard_True.
//! to check computing result use IsComputed() method
struct DimensionGeom
{
//! Text position
gp_Pnt myTextPosition;
//! Text bounding box, stored for advanced selection
Bnd_Box myTextBndBox;
//! Sensitive point tolerance for 2d text selection
Standard_Real mySelToleranceForText2d;
//! For advanced dimension line selection
Select3D_ListOfSensitive mySensitiveSegments;
//! Shows if attachment points were computed
Standard_Boolean myIsComputed;
public:
DimensionGeom ()
: myIsComputed (Standard_False)
{ }
};
//! Shows if text is inverted
Standard_Boolean myIsTextReversed;
//! Determines distance from attach point to the text on the extension
//! in case if text isn't in center of the dimension line
Standard_Real myTextOffset;
//! Points that are base for dimension.
//! My first point of dimension attach (belongs to shape for which dimension is computed)
gp_Pnt myFirstPoint;
//! My second point of dimension attach (belongs to shape for which dimension is computed)
gp_Pnt mySecondPoint;
//! Shows if attach points are initialized correctly
Standard_Boolean myIsInitialized;
//! First shape (can be vertex, edge or face)
TopoDS_Shape myFirstShape;
//! Second shape (can be vertex, edge or face)
TopoDS_Shape mySecondShape;
//! Number of shapes
Standard_Integer myShapesNumber;
//! Geometry of dimensions, needs for advanced selection
//! Geometry is computed in Compute() method and is used
//! in ComputeSelection() method.
//! If it is computed successfully, myIsComputed = Standard_True.
//! to check computing result use IsComputed() method
DimensionGeom myGeom;
private:
//! Type of dimension
AIS_KindOfDimension myKindOfDimension;
//! Dimension working plane, is equal to <myDefaultPlane> if it can be computed automatically.
gp_Pln myWorkingPlane;
//! Extension size in model measure units.
//! No inclined or curved extension line is now supported.
Standard_Real myExtensionSize;
};
#endif

View File

@ -21,49 +21,64 @@
class DimensionOwner from AIS inherits EntityOwner from SelectMgr
---Purpose: The owner is the entity which makes it possible to link
-- the sensitive primitives and the reference shapes that
-- you want to detect. It stocks the various pieces of
-- information which make it possible to find objects. An
-- owner has a priority which you can modulate, so as to
-- make one entity more selectable than another. You
-- might want to make edges more selectable than
-- faces, for example. In that case, you could attribute sa
-- higher priority to the one compared to the other. An
-- edge, could have priority 5, for example, and a face,
-- priority 4. The default priority is 5.
---Purpose: The owner is the entity which makes it possible to link
-- the sensitive primitives and the reference shapes that
-- you want to detect. It stocks the various pieces of
-- information which make it possible to find objects. An
-- owner has a priority which you can modulate, so as to
-- make one entity more selectable than another. You
-- might want to make edges more selectable than
-- faces, for example. In that case, you could attribute sa
-- higher priority to the one compared to the other. An
-- edge, could have priority 5, for example, and a face,
-- priority 4. The default priority is 5.
uses
SelectableObject from SelectMgr,
Shape from TopoDS
SelectableObject from SelectMgr,
PresentationManager from PrsMgr,
PresentationManager3d from PrsMgr,
NameOfColor from Quantity,
DimensionDisplayMode from AIS
is
Create ( aSO : SelectableObject;
aPriority : Integer from Standard =0)
Create (theSelObject : SelectableObject;
theDisplayMode : DimensionDisplayMode from AIS;
thePriority : Integer from Standard = 0)
returns mutable DimensionOwner from AIS;
---Purpose:
-- Initializes the dimension owner, aSO, and attributes it
-- the priority, aPriority.
SetShape(me : mutable; aShape : Shape from TopoDS);
---C++: inline
---Purpose:
-- Constructs the reference shape owner aShape for
-- presentation primitives.
FixedShape(me)
---C++: return const &
---C++: inline
---Purpose:
-- Returns the owner shape whose primitives we are concerned with.
returns Shape from TopoDS;
---Purpose:
-- Initializes the dimension owner, theSO, and attributes it
-- the priority, thePriority.
SetDisplayMode (me : mutable; theMode : DimensionDisplayMode from AIS);
DisplayMode (me)
returns DimensionDisplayMode from AIS;
HilightWithColor (me : mutable;
thePM : PresentationManager3d from PrsMgr;
theColor : NameOfColor from Quantity;
theMode : Integer from Standard = 0)
is redefined virtual;
IsHilighted (me;
thePM : PresentationManager from PrsMgr;
theMode : Integer from Standard =0)
returns Boolean from Standard is redefined virtual;
---Purpose: Returns true if an object with the selection mode
-- aMode is highlighted in the presentation manager aPM.
Hilight(me : mutable;
thePM : PresentationManager from PrsMgr;
theMode : Integer from Standard =0) is redefined virtual;
Unhilight(me : mutable;
thePM : PresentationManager from PrsMgr;
theMode : Integer from Standard =0) is redefined virtual;
---Purpose: Removes highlighting from the selected part of dimension.
fields
myFixedShape : Shape from TopoDS;
myDisplayMode : DimensionDisplayMode from AIS;
end DimensionOwner;

View File

@ -21,15 +21,105 @@
#include <AIS_DimensionOwner.ixx>
#include <AIS_DimensionDisplayMode.hxx>
#include <StdSelect_Shape.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
//-----------------------------------------------------------------------
// function : create
// purpose :
//-----------------------------------------------------------------------
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
AIS_DimensionOwner::AIS_DimensionOwner(const Handle(SelectMgr_SelectableObject)& aSO,
const Standard_Integer aPriority)
:SelectMgr_EntityOwner(aSO,aPriority)
AIS_DimensionOwner::AIS_DimensionOwner (const Handle(SelectMgr_SelectableObject)& theSelObject,
const AIS_DimensionDisplayMode theMode,
const Standard_Integer thePriority)
: SelectMgr_EntityOwner(theSelObject, thePriority),
myDisplayMode (theMode)
{
}
//=======================================================================
//function : SetDisplayMode
//purpose :
//=======================================================================
void AIS_DimensionOwner::SetDisplayMode (const AIS_DimensionDisplayMode theMode)
{
myDisplayMode = theMode;
}
//=======================================================================
//function : DisplayMode
//purpose :
//=======================================================================
AIS_DimensionDisplayMode AIS_DimensionOwner::DisplayMode () const
{
return myDisplayMode;
}
//=======================================================================
//function : IsHilighted
//purpose :
//=======================================================================
Standard_Boolean AIS_DimensionOwner::IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM,
const Standard_Integer theMode) const
{
if (HasSelectable())
{
Standard_Integer aMode = myDisplayMode != 0 ? myDisplayMode : theMode;
return thePM->IsHighlighted(Selectable (), aMode);
}
return Standard_False;
}
//=======================================================================
//function : Hilight
//purpose :
//=======================================================================
void AIS_DimensionOwner::Hilight (const Handle(PrsMgr_PresentationManager)& thePM,
const Standard_Integer theMode)
{
if (HasSelectable())
{
Standard_Integer aMode = myDisplayMode != 0 ? myDisplayMode : theMode;
thePM->Highlight (Selectable(),aMode);
}
}
//=======================================================================
//function : Unhilight
//purpose :
//=======================================================================
void AIS_DimensionOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePM,
const Standard_Integer theMode)
{
if (HasSelectable())
{
Standard_Integer aMode = myDisplayMode != 0 ? myDisplayMode : theMode;
thePM->Unhighlight(Selectable(),aMode);
}
}
//=======================================================================
//function : HilightWithColor
//purpose :
//=======================================================================
void AIS_DimensionOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
const Quantity_NameOfColor theColor,
const Standard_Integer theMode)
{
// Highlight selectable part of dimension with color
if (myDisplayMode != 0)
{
thePM->Color (Selectable(), theColor, myDisplayMode);
}
else
thePM->Color (Selectable(), theColor, theMode);
}

View File

@ -57,10 +57,8 @@ uses
PointAspect from Prs3d,
ShadingAspect from Prs3d,
IsoAspect from Prs3d,
LengthAspect from Prs3d,
AngleAspect from Prs3d,
DimensionAspect from Prs3d,
PlaneAspect from Prs3d,
RadiusAspect from Prs3d,
ArrowAspect from Prs3d,
TypeOfDeflection from Aspect,
NameOfColor from Quantity,
@ -541,43 +539,19 @@ is
is redefined static;
--
-- Attributes for the presentation of a Length.
-- Attributes for the presentation of a dimensions.
--
LengthAspect(me:mutable) returns mutable LengthAspect from Prs3d
---Purpose: Returns a link with Prs3d_Drawer_LengthAspect,
-- which provides settings for the appearance of lengths.
DimensionAspect(me:mutable) returns mutable DimensionAspect from Prs3d
---Purpose: Returns a link with Prs3d_Drawer_DimensionAspect,
-- which provides settings for the appearance of dimensions.
is redefined static;
HasLengthAspect (me) returns Boolean from Standard
HasDimensionAspect (me) returns Boolean from Standard
---C++: inline
---Purpose: Returns true if the Drawer has a length aspect setting active.
---Purpose: Returns true if the Drawer has a dimension aspect setting active.
is static;
--
-- Attributes for the presentation of a Angle.
--
AngleAspect(me:mutable) returns mutable AngleAspect from Prs3d
---Purpose: Returns a link with Prs3d_Drawer_AngleAspect,
-- which provides settings for lines used to display angles.
is redefined static;
HasAngleAspect (me) returns Boolean from Standard
---C++: inline
---Purpose: Returns true if the Drawer has an angle aspect
-- setting active.
is static;
--
-- Attributes for the presentation of a Radius.
--
RadiusAspect(me) returns mutable RadiusAspect from Prs3d
---Purpose: Returns a link with Prs3d_Drawer_RadiusAspect,
-- which provides settings for lines which serve to display radii.
is redefined static;
-- Attributes for the sections
SectionAspect (me:mutable) returns mutable LineAspect from Prs3d

View File

@ -216,17 +216,8 @@ Handle (Prs3d_DatumAspect) AIS_Drawer::DatumAspect ()
Handle (Prs3d_PlaneAspect) AIS_Drawer::PlaneAspect ()
{return myPlaneAspect.IsNull() ? myLink->PlaneAspect (): myPlaneAspect;}
Handle (Prs3d_LengthAspect) AIS_Drawer::LengthAspect ()
{return myLengthAspect.IsNull()? myLink->LengthAspect () : myLengthAspect ;}
Handle (Prs3d_AngleAspect) AIS_Drawer::AngleAspect ()
{return myAngleAspect.IsNull()? myLink->AngleAspect () :myAngleAspect ;}
Handle (Prs3d_RadiusAspect) AIS_Drawer::RadiusAspect () const
{return myRadiusAspect.IsNull()? myLink->RadiusAspect():myRadiusAspect; }
Handle (Prs3d_DimensionAspect) AIS_Drawer::DimensionAspect ()
{return myDimensionAspect.IsNull()? myLink->DimensionAspect () : myDimensionAspect ;}
Handle (Prs3d_LineAspect) AIS_Drawer::SectionAspect ()
{return mySectionAspect.IsNull()? myLink->SectionAspect (): mySectionAspect;}
@ -258,9 +249,7 @@ void AIS_Drawer::ClearLocalAttributes()
if(!mySeenLineAspect.IsNull()) mySeenLineAspect.Nullify();
if(!myVectorAspect.IsNull()) myVectorAspect .Nullify();
if(!myDatumAspect.IsNull()) myDatumAspect.Nullify();
if(!myLengthAspect.IsNull()) myLengthAspect.Nullify();
if(!myAngleAspect.IsNull()) myAngleAspect.Nullify();
if(!myRadiusAspect.IsNull()) myRadiusAspect.Nullify();
if(!myDimensionAspect.IsNull()) myDimensionAspect.Nullify();
if(!mySectionAspect.IsNull()) mySectionAspect.Nullify();
if( myhasOwnHLRDeviationCoefficient ) myhasOwnHLRDeviationCoefficient = Standard_False;
if(myhasOwnHLRDeviationAngle ) myhasOwnHLRDeviationAngle = Standard_False;

View File

@ -82,18 +82,12 @@ inline Standard_Boolean AIS_Drawer::HasShadingAspect () const
inline Standard_Boolean AIS_Drawer::HasPointAspect () const
{ return !myPointAspect.IsNull();}
inline Standard_Boolean AIS_Drawer::HasAngleAspect () const
{ return !myAngleAspect.IsNull();}
inline Standard_Boolean AIS_Drawer::HasDatumAspect () const
{ return !myDatumAspect.IsNull();}
inline Standard_Boolean AIS_Drawer::HasPlaneAspect () const
{ return !myPlaneAspect.IsNull();}
inline Standard_Boolean AIS_Drawer::HasLengthAspect () const
{ return !myLengthAspect.IsNull();}
inline Standard_Boolean AIS_Drawer::IsOwnFaceBoundaryDraw () const
{ return myHasOwnFaceBoundaryDraw; }
@ -109,3 +103,6 @@ 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();}

View File

@ -41,7 +41,7 @@
#include <BRep_Tool.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Geom_Line.hxx>
#include <Geom_Circle.hxx>
@ -84,8 +84,8 @@ void AIS_EqualDistanceRelation::Compute( const Handle( PrsMgr_PresentationManage
gp_Pnt Position12 = myPosition, Position34 = myPosition;
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
arr->SetLength(myArrowSize);
// -- ota -- begin
if (!myAutomaticPosition ){
@ -477,10 +477,10 @@ void AIS_EqualDistanceRelation::ComputeTwoEdgesLength( const Handle( Prs3d_Prese
if (arrsize < confusion) arrsize = Val*0.1;
if (Abs(Val) <= confusion) {arrsize = 0.;}
Handle(Prs3d_LengthAspect) la = aDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
Handle(Prs3d_DimensionAspect) la = aDrawer->DimensionAspect();
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
arr->SetLength(arrsize);
arr = la->Arrow2Aspect();
arr = la->ArrowAspect();
arr->SetLength(arrsize);
if (AutomaticPos && IsSetBndBox)
@ -659,10 +659,10 @@ void AIS_EqualDistanceRelation::ComputeTwoVerticesLength( const Handle( Prs3d_Pr
}
Handle(Prs3d_LengthAspect) la = aDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
Handle(Prs3d_DimensionAspect) la = aDrawer->DimensionAspect();
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
arr->SetLength(ArrowSize);
arr = la->Arrow2Aspect();
arr = la->ArrowAspect();
arr->SetLength(ArrowSize);
if (AutomaticPos && IsSetBndBox)
@ -768,10 +768,10 @@ void AIS_EqualDistanceRelation::ComputeOneEdgeOneVertexLength( const Handle( Prs
SecondAttach = ElCLib::Value(ElCLib::Parameter(l,Position),l);
}
Handle(Prs3d_LengthAspect) la = aDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
Handle(Prs3d_DimensionAspect) la = aDrawer->DimensionAspect();
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
arr->SetLength(arrsize);
arr = la->Arrow2Aspect();
arr = la->ArrowAspect();
arr->SetLength(arrsize);
if (AutomaticPos && IsSetBndBox)

View File

@ -38,7 +38,7 @@
#include <Select3D_SensitiveBox.hxx>
#include <Precision.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <AIS_Drawer.hxx>
@ -142,8 +142,8 @@ void AIS_EqualRadiusRelation::Compute( const Handle( PrsMgr_PresentationManager3
myArrowSize = (Min(myFirstCenter.Distance(myFirstPoint),
mySecondCenter.Distance(mySecondPoint)))*0.05;
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
arr->SetLength(myArrowSize);
//ota -- end --

View File

@ -30,7 +30,7 @@
#include <Prs3d_LineAspect.hxx>
#include <Aspect_AspectLine.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Prs3d_AngleAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_PlaneAspect.hxx>
#include <Prs3d_DatumAspect.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
@ -46,8 +46,8 @@ static Handle(Prs3d_LineAspect) GetLineAspect(const Handle(Prs3d_Drawer)& Dr,
case AIS_TOA_Line:
return Dr->LineAspect();
break;
case AIS_TOA_Angle:
return Dr->AngleAspect()->LineAspect();
case AIS_TOA_Dimension:
return Dr->DimensionAspect()->LineAspect();
break;
case AIS_TOA_Wire:
return Dr->WireAspect();

View File

@ -1,274 +0,0 @@
-- Created on: 1996-12-03
-- Created by: Arnaud BOUZY/Odile Olivier
-- Copyright (c) 1996-1999 Matra Datavision
-- Copyright (c) 1999-2012 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.
class LengthDimension from AIS inherits Relation from AIS
---Purpose: A framework to display lengths.
-- These can be lengths along a face or edge, or
-- between two faces or two edges.
-- The value of the length is given in a text figuring in this display.
uses Shape from TopoDS,
Face from TopoDS,
Presentation from Prs3d,
PresentationManager3d from PrsMgr,
Selection from SelectMgr,
Dir from gp,
Pnt from gp,
Projector from Prs3d,
Transformation from Geom,
ExtendedString from TCollection,
Plane from Geom,
TypeOfDist from AIS,
ArrowSide from DsgPrs,
KindOfDimension from AIS,
Drawer from Prs3d,
Edge from TopoDS,
Box from Bnd,
Drawer from AIS,
Vertex from TopoDS
is
Create (aFirstFace : Face from TopoDS;
aSecondFace : Face from TopoDS;
aVal : Real from Standard; -- is defined while first compute, may be any Real
aText : ExtendedString from TCollection)
---Purpose: Constructs a length display object defined by the first
-- face aFShape, the second face aSShape, the dimension aVal, and the text aText.
returns mutable LengthDimension from AIS;
Create (aFirstFace : Face from TopoDS;
aSecondFace : Face from TopoDS;
aVal : Real from Standard; -- is defined while first compute, may be any Real
aText : ExtendedString from TCollection;
aPosition : Pnt from gp;
aSymbolPrs : ArrowSide from DsgPrs;
anArrowSize : Real from Standard = 0.0)
---Purpose: Constructs a length display object defined by the first
-- face aFShape, the second face aSShape, the
-- dimension aVal, the position aPosition, the arrow
-- aSymbolPrs with the size anArrowSize and the text aText.
returns mutable LengthDimension from AIS;
Create (Face : Face from TopoDS;
Edge : Edge from TopoDS;
Val : Real from Standard;
Text : ExtendedString from TCollection)
---Purpose: Constructs a length display object defined by the first
-- edge or vertex aFShape, the second edge or vertex
-- aSShape, the dimension aVal,and the plane aPlane.
returns mutable LengthDimension from AIS;
Create (aFShape : Shape from TopoDS;
aSShape : Shape from TopoDS;
aPlane : Plane from Geom;
aVal : Real from Standard;
aText : ExtendedString from TCollection)
---Purpose: -- Constructs a length display object defined by the first
-- edge or vertex aFShape, the second edge or vertex
-- aSShape, the dimension aVal,and the plane aPlane.
returns mutable LengthDimension from AIS;
Create (aFShape : Shape from TopoDS;
aSShape : Shape from TopoDS;
aPlane : Plane from Geom;
aVal : Real from Standard;
aText : ExtendedString from TCollection;
aPosition : Pnt from gp;
aSymbolPrs : ArrowSide from DsgPrs;
aTypeDist : TypeOfDist from AIS;
anArrowSize : Real from Standard = 0.0)
---Purpose: Constructs a length display object defined by the first
-- edge or vertex aFShape, the second edge or vertex
-- aSShape, the dimension aVal, the position aPosition,
-- the type of distance aTypeDist, the type of arrow
-- aSymbolPrs with the size anArrowSize, and the plane aPlane.
returns mutable LengthDimension from AIS;
SetFirstShape( me: mutable; aFShape : Shape from TopoDS )
is redefined static;
SetSecondShape( me: mutable; aSShape : Shape from TopoDS )
is redefined static;
KindOfDimension(me)
returns KindOfDimension from AIS
is redefined;
---Purpose: Indicates that we are concerned with a length.
IsMovable(me) returns Boolean from Standard
is redefined;
---Purpose: Returns true if the length dimension is movable.
TypeOfDist (me)
---C++: inline
--- Purpose:
-- Returns the type of distance of the length primitive.
returns TypeOfDist from AIS
is static;
SetTypeOfDist(me: mutable;aTypeDist: TypeOfDist from AIS)
---C++: inline
--- Purpose:
-- Returns true if the length dimension is movable.
is static;
-- Methods from PresentableObject
Compute(me : mutable;
aPresentationManager : PresentationManager3d from PrsMgr;
aPresentation : mutable Presentation from Prs3d;
aMode : Integer from Standard= 0)
is redefined private;
Compute(me : mutable;
aProjector : Projector from Prs3d;
aPresentation : mutable Presentation from Prs3d)
is redefined static private;
Compute(me : mutable;
aProjector : Projector from Prs3d;
aTrsf : Transformation from Geom;
aPresentation : mutable Presentation from Prs3d)
is redefined;
---Purpose: computes the presentation according to a point of view
-- given by <aProjector>.
-- To be Used when the associated degenerated Presentations
-- have been transformed by <aTrsf> which is not a Pure
-- Translation. The HLR Prs can't be deducted automatically
-- WARNING :<aTrsf> must be applied
-- to the object to display before computation !!!
-- Methods from SelectableObject
ComputeSelection(me : mutable;
aSelection : mutable Selection from SelectMgr;
aMode : Integer from Standard)
is redefined private;
-- Computation private methods
ComputeOneFaceLength(me : mutable;
aPresentation : mutable Presentation from Prs3d)
is private;
ComputeOneEdgeLength(me : mutable;
aPresentation : mutable Presentation from Prs3d)
is private;
ComputeTwoFacesLength(me: mutable;
aPresentation : mutable Presentation from Prs3d)
is private;
ComputeEdgeFaceLength (me: mutable;
aPresentation : mutable Presentation from Prs3d)
is private;
ComputeTwoEdgesLength (myclass;
aPresentation : mutable Presentation from Prs3d;
aDrawer : Drawer from AIS;
aText : ExtendedString from TCollection;
ArrowSize : Real from Standard;
FirstEdge : Edge from TopoDS;
SecondEdge : Edge from TopoDS;
Plane : Plane from Geom;
AutomaticPos : Boolean from Standard;
IsSetBndBox : Boolean from Standard;
BndBox : Box from Bnd;
ExtShape : out Integer from Standard;
Val : out Real from Standard;
DirAttach : out Dir from gp;
Position : out Pnt from gp;
FirstAttach : out Pnt from gp;
SecondAttach : out Pnt from gp;
SymbolPrs : out ArrowSide from DsgPrs );
ComputeOneEdgeOneVertexLength(myclass;
aPresentation : mutable Presentation from Prs3d;
aDrawer : Drawer from AIS;
aText : ExtendedString from TCollection;
ArrowSize : Real from Standard;
FirstShape : Shape from TopoDS;
SecondShape : Shape from TopoDS;
Plane : Plane from Geom;
AutomaticPos : Boolean from Standard;
IsSetBndBox : Boolean from Standard;
BndBox : Box from Bnd;
ExtShape : out Integer from Standard;
Val : out Real from Standard;
DirAttach : out Dir from gp;
Position : out Pnt from gp;
FirstAttach : out Pnt from gp;
SecondAttach : out Pnt from gp;
SymbolPrs : out ArrowSide from DsgPrs );
ComputeTwoVerticesLength(myclass;
aPresentation : mutable Presentation from Prs3d;
aDrawer : Drawer from AIS;
aText : ExtendedString from TCollection;
ArrowSize : Real from Standard;
FirstVertex : Vertex from TopoDS;
SecondVertex : Vertex from TopoDS;
Plane : Plane from Geom;
AutomaticPos : Boolean from Standard;
IsSetBndBox : Boolean from Standard;
BndBox : Box from Bnd;
TypeDist : TypeOfDist from AIS;
ExtShape : out Integer from Standard;
Val : out Real from Standard;
DirAttach : out Dir from gp;
Position : out Pnt from gp;
FirstAttach : out Pnt from gp;
SecondAttach : out Pnt from gp;
SymbolPrs : out ArrowSide from DsgPrs );
--
-- Computation Selection private methods
--
ComputeFaceSelection(me : mutable;
aSelection : mutable Selection from SelectMgr)
is private;
ComputeEdgeVertexSelection( me : mutable;
aSelection : mutable Selection from SelectMgr)
is private;
fields
myNbShape : Integer from Standard;
myFAttach : Pnt from gp;
mySAttach : Pnt from gp;
myDirAttach: Dir from gp;
myTypeDist : TypeOfDist from AIS;
end LengthDimension;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,139 @@
// Copyright (c) 1999-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 _AIS_LengthDimension_HeaderFile
#define _AIS_LengthDimension_HeaderFile
#include <AIS.hxx>
#include <AIS_Dimension.hxx>
#include <AIS_Drawer.hxx>
#include <AIS_KindOfDimension.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Transformation.hxx>
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_Projector.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
#include <SelectMgr_Selection.hxx>
#include <Standard.hxx>
#include <Standard_Macro.hxx>
#include <Standard_DefineHandle.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
#include <TCollection_ExtendedString.hxx>
class TopoDS_Face;
class TCollection_ExtendedString;
class gp_Pnt;
class TopoDS_Edge;
class TopoDS_Shape;
class Geom_Plane;
class PrsMgr_PresentationManager3d;
class Prs3d_Presentation;
class Prs3d_Projector;
class Geom_Transformation;
class SelectMgr_Selection;
class AIS_Drawer;
class Bnd_Box;
class gp_Dir;
class TopoDS_Vertex;
class Standard_Transient;
class Handle(Standard_Type);
class Handle(AIS_Relation);
class AIS_LengthDimension;
DEFINE_STANDARD_HANDLE(AIS_LengthDimension,AIS_Dimension)
//! A dimention to display lengths. <br>
//! These can be lengths along a face or edge, or <br>
//! between two faces or two edges.
class AIS_LengthDimension : public AIS_Dimension
{
public:
//! Constructor with full parameter list.
//! Construct dimension between two vertices.
//! Style of line, arrow and text can be set by default.
Standard_EXPORT AIS_LengthDimension (const gp_Pnt& theFirstPoint,
const gp_Pnt& theSecondPoint,
const gp_Pln& theDimensionPlane,
const Handle(Prs3d_DimensionAspect)& theDimensionAspect,
const Standard_Real theExtensionSize = 1.0);
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);
Standard_EXPORT AIS_LengthDimension (const TopoDS_Face& theFace,
const TopoDS_Edge& theEdge);
Standard_EXPORT void SetFlyout (const Standard_Real theFlyout);
Standard_EXPORT Standard_Real GetFlyout () const;
DEFINE_STANDARD_RTTI(AIS_LengthDimension)
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) ;
// Fields
//! Defines flyout lines and direction
//! Flyout direction in the working plane (stored in the base AIS_Dimension).
//! 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;
};
#endif

View File

@ -1,43 +0,0 @@
// Created on: 1997-02-28
// Created by: Jean-Pierre COMBE
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2012 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 <AIS.hxx>
#include <TopoDS.hxx>
//=======================================================================
//function : TypeOfDist
//purpose :
//=======================================================================
inline AIS_TypeOfDist AIS_LengthDimension::TypeOfDist() const
{
return myTypeDist;
}
//=======================================================================
//function : SetTypeOfDist
//purpose :
//=======================================================================
inline void AIS_LengthDimension::SetTypeOfDist(const AIS_TypeOfDist aTypeDist)
{
myTypeDist = aTypeDist;
}

View File

@ -28,7 +28,7 @@
#include <AIS_EllipseRadiusDimension.hxx>
#include <TCollection_ExtendedString.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_TextAspect.hxx>
@ -168,8 +168,8 @@ void AIS_MaxRadiusDimension::Compute(const Handle_Prs3d_Projector& aProjector,
void AIS_MaxRadiusDimension::ComputeEllipse(const Handle(Prs3d_Presentation)& aPresentation)
{
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
// size
#ifdef BUC60915
@ -226,8 +226,8 @@ void AIS_MaxRadiusDimension::ComputeEllipse(const Handle(Prs3d_Presentation)& aP
void AIS_MaxRadiusDimension::ComputeArcOfEllipse(const Handle(Prs3d_Presentation)& aPresentation)
{
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
// size
#ifdef BUC60915

View File

@ -55,7 +55,7 @@
#include <Prs3d_Drawer.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <DsgPrs_MidPointPresentation.hxx>
#include <TopoDS_Vertex.hxx>

View File

@ -29,7 +29,7 @@
#include <AIS_EllipseRadiusDimension.hxx>
#include <TCollection_ExtendedString.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_TextAspect.hxx>
@ -169,8 +169,8 @@ void AIS_MinRadiusDimension::Compute(const Handle_Prs3d_Projector& aProjector,
void AIS_MinRadiusDimension::ComputeEllipse(const Handle(Prs3d_Presentation)& aPresentation)
{
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
// size
#ifdef BUC60915
@ -228,8 +228,8 @@ void AIS_MinRadiusDimension::ComputeEllipse(const Handle(Prs3d_Presentation)& aP
void AIS_MinRadiusDimension::ComputeArcOfEllipse(const Handle(Prs3d_Presentation)& aPresentation)
{
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
// size
#ifdef BUC60915

View File

@ -37,7 +37,7 @@
#include <Precision.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Select3D_SensitiveBox.hxx>
#include <Select3D_SensitiveSegment.hxx>
@ -327,11 +327,11 @@ void AIS_OffsetDimension::ComputeTwoAxesOffset(const Handle(Prs3d_Presentation)&
mySAttach = P2LastProj;
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
//cout<<"AIS_OffsetDimension::AIS_OffsetDimension " << myArrowSize << " myArrowSize"<<endl;
arr->SetLength(myArrowSize);
arr = la->Arrow2Aspect();
arr = la->ArrowAspect();
arr->SetLength(myArrowSize);
gp_Pnt myTFAttach = myFAttach.Transformed (aTrsf);
@ -433,11 +433,11 @@ void AIS_OffsetDimension::ComputeTwoFacesOffset(const Handle(Prs3d_Presentation)
myDirAttach2.SetCoord (avec.X(),avec.Y(),avec.Z());
}
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
//cout<<"AIS_OffsetDimension::AIS_OffsetDimension " << myArrowSize << " myArrowSize"<<endl;
arr->SetLength(myArrowSize);
arr = la->Arrow2Aspect();
arr = la->ArrowAspect();
arr->SetLength(myArrowSize);
gp_Pnt myTFAttach = myFAttach.Transformed (aTrsf);

View File

@ -36,7 +36,7 @@
#include <Prs3d_Drawer.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <AIS.hxx>
#include <AIS_Drawer.hxx>
@ -379,10 +379,10 @@ void AIS_ParallelRelation::ComputeTwoEdgesParallel(const Handle(Prs3d_Presentati
{
myArrowSize = 0.;
}
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
arr->SetLength(myArrowSize);
arr = la->Arrow2Aspect();
arr = la->ArrowAspect();
arr->SetLength(myArrowSize);
if ( myExtShape == 1)
mySymbolPrs = DsgPrs_AS_FIRSTPT_LASTAR;

View File

@ -1,158 +0,0 @@
-- Created on: 1996-12-03
-- Created by: Jean-Pierre COMBE/Odile Olivier
-- Copyright (c) 1996-1999 Matra Datavision
-- Copyright (c) 1999-2012 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.
-- modified by <SZY> feb-20-98
class RadiusDimension from AIS inherits Relation from AIS
---Purpose: A framework to define display of radii.
-- These displays serve as relational references in 3D
-- presentations of surfaces, and are particularly useful
-- in viewing fillets. The display consists of arrows and
-- text giving the length of a radius. This display is
-- recalculated if the applicative owner shape changes
-- in dimension, and the text gives the modified length.
-- The algorithm analyzes a length along a face as an
-- arc. It then reconstructs the circle corresponding to
-- the arc and calculates the radius of this circle.
uses Shape from TopoDS,
Presentation from Prs3d,
PresentationManager3d from PrsMgr,
Selection from SelectMgr,
Pnt from gp,
Lin from gp,
Circ from gp,
Projector from Prs3d,
Transformation from Geom,
ExtendedString from TCollection,
ArrowSide from DsgPrs,
KindOfDimension from AIS
is
Create (aShape : Shape from TopoDS;
aVal : Real from Standard;
aText : ExtendedString from TCollection)
---Purpose: Constructs the radius display object defined by the
-- shape aShape, the dimension aVal, and the text aText.
returns mutable RadiusDimension from AIS;
Create (aShape : Shape from TopoDS;
aVal : Real from Standard;
aText : ExtendedString from TCollection;
aPosition : Pnt from gp;
aSymbolPrs : ArrowSide from DsgPrs;
anArrowSize : Real from Standard = 0.0)
---Purpose: Constructs radius display object defined by the shape
-- aShape, the dimension aVal, the position aPosition,
-- the type of arrow aSymbolPrs, the arrow length
-- anArrowSize and the text aText.
returns mutable RadiusDimension from AIS;
SetFirstShape( me: mutable; aFShape : Shape from TopoDS )
is redefined static;
KindOfDimension(me)
---Purpose: Indicates that the dimension selected is a radius.
---C++: inline
returns KindOfDimension from AIS
is redefined;
IsMovable(me) returns Boolean from Standard
---C++: inline
---Purpose: Returns true if the radius selected is movable.
is redefined;
DrawFromCenter(me) returns Boolean from Standard
---Purpose:
-- Draws an arrowhead pointing towards the center of
-- the shape aShape defined at construction time if
-- false, and away from the center if true.
---C++: inline
is static;
SetDrawFromCenter(me: mutable;
drawfromcenter : Boolean from Standard)
---C++: inline
---Purpose:
-- Sets the Boolean drawfromcenter to true or false.
-- If drawfromcenter is false, the arrowhead will point
-- towards the center of the shape aShape defined at
-- construction time.
is static;
-- Methods from PresentableObject
Compute(me : mutable;
aPresentationManager: PresentationManager3d from PrsMgr;
aPresentation : mutable Presentation from Prs3d;
aMode : Integer from Standard= 0)
is redefined private;
Compute(me:mutable;
aProjector: Projector from Prs3d;
aPresentation: mutable Presentation from Prs3d)
is redefined static private;
Compute(me : mutable;
aProjector : Projector from Prs3d;
aTrsf : Transformation from Geom;
aPresentation : mutable Presentation from Prs3d)
is redefined;
---Purpose: computes the presentation according to a point of view
-- given by <aProjector>.
-- To be Used when the associated degenerated Presentations
-- have been transformed by <aTrsf> which is not a Pure
-- Translation. The HLR Prs can't be deducted automatically
-- WARNING :<aTrsf> must be applied
-- to the object to display before computation !!!
-- Methods from SelectableObject
ComputeSelection(me : mutable;
aSelection : mutable Selection from SelectMgr;
aMode : Integer from Standard)
is redefined private;
--
-- Computation private methods
--
ComputeRadius( me: mutable; aPresentation : mutable Presentation from Prs3d )
is private;
InitFirstShape( me: mutable)
is static private;
fields
myCircle : Circ from gp;
myFirstPar : Real from Standard;
myLastPar : Real from Standard;
myCenter : Pnt from gp;
myEndOfArrow : Pnt from gp;
myFirstLine : Lin from gp;
myLastLine : Lin from gp;
mydrawFromCenter : Boolean from Standard;
end RadiusDimension;

View File

@ -18,20 +18,23 @@
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
// modified <SZY> 20-feb-98
// <VBU> myFShape could be a wire.
#define BUC60915 //GG 05/06/01 Enable to compute the requested arrow size
// if any in all dimensions.
#include <Standard_NotImplemented.hxx>
#include <AIS_RadiusDimension.ixx>
#include <AIS_RadiusDimension.hxx>
#include <AIS_DimensionOwner.hxx>
#include <DsgPrs_RadiusPresentation.hxx>
#include <AIS.hxx>
#include <AIS_Drawer.hxx>
#include <AIS_KindOfDimension.hxx>
#include <Adaptor3d_HCurve.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <DsgPrs.hxx>
#include <ElCLib.hxx>
#include <GC_MakeCircle.hxx>
#include <gce_MakeCirc.hxx>
#include <gce_MakeDir.hxx>
#include <gce_MakeLin.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Circle.hxx>
@ -40,381 +43,222 @@
#include <Geom_ToroidalSurface.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_SurfaceOfLinearExtrusion.hxx>
#include <gp_Circ.hxx>
#include <gp_Pnt.hxx>
#include <gp_Trsf.hxx>
#include <ElCLib.hxx>
#include <GC_MakeCircle.hxx>
#include <gce_MakeLin.hxx>
#include <gce_MakeCirc.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <Select3D_SensitiveSegment.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_Group.hxx>
#include <Precision.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_Root.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TopExp_Explorer.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopLoc_Location.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <Adaptor3d_HCurve.hxx>
#include <Prs3d_AngleAspect.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_Drawer.hxx>
IMPLEMENT_STANDARD_HANDLE(AIS_RadiusDimension, AIS_Dimension)
IMPLEMENT_STANDARD_RTTIEXT(AIS_RadiusDimension, AIS_Dimension)
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <AIS.hxx>
#include <AIS_Drawer.hxx>
#include <gce_MakeDir.hxx>
#include <Select3D_SensitiveBox.hxx>
//======================================================================
//function : CircleFromPlanarFace
//purpose : if possible gets circle from planar face
//=======================================================================
static Standard_Boolean CircleFromPlanarFace (const TopoDS_Shape& aFace,
Handle(Geom_Curve)& aCurve,
gp_Pnt & ptfirst,
gp_Pnt & ptend)
//function : Constructor
//purpose :
//=======================================================================
AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle)
: AIS_Dimension(),
myFlyout (0.0),
myCircle (theCircle)
{
TopExp_Explorer ExploEd (aFace, TopAbs_EDGE);
for ( ; ExploEd.More(); ExploEd.Next())
myFirstPoint = ElCLib::Value(0, myCircle);
mySecondPoint = theCircle.Location();
myIsInitialized = Standard_True;
SetSpecialSymbol ('R');
SetDisplaySpecialSymbol (AIS_DSS_Before);
SetKindOfDimension(AIS_KOD_RADIUS);
}
AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle,
const gp_Pnt& theAttachPoint)
: AIS_Dimension(),
myFlyout (0.0),
myCircle (theCircle)
{
myFirstPoint = theAttachPoint;
mySecondPoint = theCircle.Location();
myIsInitialized = Standard_True;
SetSpecialSymbol ('R');
SetDisplaySpecialSymbol (AIS_DSS_Before);
SetKindOfDimension (AIS_KOD_RADIUS);
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
AIS_RadiusDimension::AIS_RadiusDimension (const TopoDS_Shape& theShape)
: AIS_Dimension (),
myFlyout (0.0)
{
myFirstShape = theShape;
myIsInitialized = Standard_False;
SetSpecialSymbol ('R');
SetDisplaySpecialSymbol (AIS_DSS_Before);
SetKindOfDimension (AIS_KOD_RADIUS);
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle,
const Handle(Prs3d_DimensionAspect)& theDimensionAspect,
const Standard_Real theExtensionSize/* = 1.0*/)
: AIS_Dimension (theDimensionAspect,theExtensionSize),
myFlyout (0.0),
myCircle (theCircle)
{
myFirstPoint = ElCLib::Value(0, myCircle);
mySecondPoint = theCircle.Location();
SetSpecialSymbol ('R');
SetDisplaySpecialSymbol (AIS_DSS_Before);
SetKindOfDimension (AIS_KOD_RADIUS);
}
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle,
const gp_Pnt& theAttachPoint,
const Handle(Prs3d_DimensionAspect)& theDimensionAspect,
const Standard_Real theExtensionSize/* = 1.0*/)
: AIS_Dimension (theDimensionAspect,theExtensionSize),
myFlyout (0.0),
myCircle (theCircle)
{
myFirstPoint = theAttachPoint;
mySecondPoint = theCircle.Location();
SetSpecialSymbol ('R');
SetDisplaySpecialSymbol (AIS_DSS_Before);
SetKindOfDimension (AIS_KOD_RADIUS);
}
//=======================================================================
//function : Compute
//purpose :
//=======================================================================
void AIS_RadiusDimension::Compute(const Handle(PrsMgr_PresentationManager3d)& /*thePM*/,
const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode)
{
thePresentation->Clear();
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
if (!myIsInitialized)
{
gp_Pnt aLastPoint;
if (!initCircularDimension (myFirstShape, myCircle,
myFirstPoint, aLastPoint))
return;
else
{
TopoDS_Edge curedge = TopoDS::Edge (ExploEd.Current());
if (AIS::ComputeGeometry (curedge, aCurve, ptfirst, ptend))
if (aCurve->IsInstance (STANDARD_TYPE(Geom_Circle)) &&
!Handle(Geom_Circle)::DownCast(aCurve).IsNull())
return Standard_True;
mySecondPoint = myCircle.Location();
myIsInitialized = Standard_True;
}
return Standard_False;
}
}
if (!myIsWorkingPlaneCustom)
countDefaultPlane();
//Count flyout direction
gp_Ax1 aWorkingPlaneNormal = GetWorkingPlane().Axis();
gp_Dir aTargetPointsVector = gce_MakeDir (myFirstPoint, mySecondPoint);
// Count a flyout direction vector.
gp_Dir aFlyoutVector = aWorkingPlaneNormal.Direction()^aTargetPointsVector;
gp_Ax3 aLocalSystem (myFirstPoint, aTargetPointsVector, aFlyoutVector);
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
AIS_RadiusDimension::AIS_RadiusDimension(const TopoDS_Shape& aShape,
const Standard_Real aVal,
const TCollection_ExtendedString& aText)
:mydrawFromCenter(Standard_True)
{
myFShape = aShape;
myVal = aVal;
myText = aText;
mySymbolPrs = DsgPrs_AS_FIRSTPT_LASTAR;
myAutomaticPosition = Standard_True;
// Create lines for layouts
gp_Lin aLine1 (myFirstPoint, aFlyoutVector);
gp_Lin aLine2 (mySecondPoint, aFlyoutVector);
myArrowSize = myVal / 100.;
InitFirstShape();
// Get flyout end points
gp_Pnt aFlyoutEnd1 = ElCLib::Value (ElCLib::Parameter (aLine1, myFirstPoint) + GetFlyout(), aLine1);
gp_Pnt aFlyoutEnd2 = ElCLib::Value (ElCLib::Parameter (aLine2, mySecondPoint) + GetFlyout(), aLine2);
// Add layout lines to graphic group
// Common to all type of dimension placement.
if (theMode == 0)
{
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments(4);
aPrimSegments->AddVertex (myFirstPoint);
aPrimSegments->AddVertex (aFlyoutEnd1);
aPrimSegments->AddVertex (mySecondPoint);
aPrimSegments->AddVertex (aFlyoutEnd2);
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
}
drawLinearDimension (thePresentation, aFlyoutEnd1, aFlyoutEnd2, (AIS_DimensionDisplayMode)theMode, Standard_True);
}
//=======================================================================
//function : Constructor
//purpose :(avec position et texte)
//=======================================================================
AIS_RadiusDimension::AIS_RadiusDimension( const TopoDS_Shape& aShape,
const Standard_Real aVal,
const TCollection_ExtendedString& aText,
const gp_Pnt& aPosition,
const DsgPrs_ArrowSide aSymbolPrs,
const Standard_Real anArrowSize )
:mydrawFromCenter(Standard_True)
{
myFShape = aShape;
myVal = aVal;
myText = aText;
myPosition = aPosition;
mySymbolPrs = aSymbolPrs;
#ifdef BUC60915
SetArrowSize( anArrowSize );
#else
myArrowSize = anArrowSize;
#endif
myAutomaticPosition = Standard_False;
InitFirstShape();
}
//=======================================================================
//function : InitFirstShape
//purpose :
//=======================================================================
void AIS_RadiusDimension::InitFirstShape()
{
if (myFShape.ShapeType() == TopAbs_FACE)
{
BRepAdaptor_Surface surfAlgo( TopoDS::Face( myFShape ) );
Standard_Real uFirst, uLast, vFirst, vLast;
uFirst = surfAlgo.FirstUParameter();
uLast = surfAlgo.LastUParameter();
vFirst = surfAlgo.FirstVParameter();
vLast = surfAlgo.LastVParameter();
Standard_Real uMoy = (uFirst + uLast)/2;
Standard_Real vMoy = (vFirst + vLast)/2;
Handle( Geom_Surface ) surf = surfAlgo.Surface().Surface();
surf = Handle( Geom_Surface )::DownCast( surf->Transformed( surfAlgo.Trsf() ) );
Handle( Geom_Curve ) aCurve;
if (surf->DynamicType() == STANDARD_TYPE(Geom_ToroidalSurface))
{
aCurve = surf->UIso( uMoy );
uFirst = vFirst;
uLast = vLast;
}
else if (surf->DynamicType() == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))
{
Handle( Adaptor3d_HCurve ) BasisCurve = surfAlgo.BasisCurve();
if ( BasisCurve->GetType() == GeomAbs_Circle )
aCurve = surf->VIso( vMoy );
else return;
}
else if (surf->DynamicType() == STANDARD_TYPE(Geom_Plane))
{
gp_Pnt FirstPnt, LastPnt;
if (CircleFromPlanarFace (TopoDS::Face(myFShape), aCurve, FirstPnt, LastPnt))
// if (CircleFromPlanarFace (myFShape, aCurve, FirstPnt, LastPnt))
{
uFirst = ElCLib::Parameter ((Handle(Geom_Circle)::DownCast( aCurve ))->Circ(), FirstPnt);
uLast = ElCLib::Parameter ((Handle(Geom_Circle)::DownCast( aCurve ))->Circ(), LastPnt);
}
else return;
}
else
aCurve = surf->VIso( vMoy );
if (aCurve->DynamicType() == STANDARD_TYPE(Geom_Circle))
myCircle = (Handle( Geom_Circle )::DownCast( aCurve ))->Circ();
else if (aCurve->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) {
Handle(Geom_TrimmedCurve) tCurve = Handle(Geom_TrimmedCurve)::DownCast(aCurve);
aCurve = tCurve->BasisCurve();
uFirst = tCurve->FirstParameter();
uLast = tCurve->LastParameter();
if (aCurve->DynamicType() == STANDARD_TYPE(Geom_Circle))
myCircle = Handle(Geom_Circle)::DownCast(aCurve)->Circ();//gp_Circ
else return;
}
else if (aCurve->DynamicType() == STANDARD_TYPE(Geom_BSplineCurve)) {
gp_Pnt P1,P2,P3;
aCurve->D0(uFirst,P1);
aCurve->D0((uFirst+uLast)/2,P2);
aCurve->D0(uLast,P3);
gce_MakeCirc MakeCirc = gce_MakeCirc(P1,P2,P3);
myCircle = MakeCirc.Value();
uFirst = ElCLib::Parameter(myCircle,P1);
uLast = ElCLib::Parameter(myCircle,P2);
}
myFirstPar = uFirst;
myLastPar = uLast;
} // TopAbs_FACE
else // it is edge or a wire
{
TopoDS_Edge anEdge;
if (myFShape.ShapeType() == TopAbs_WIRE) {
TopExp_Explorer exp (myFShape,TopAbs_EDGE);
if (exp.More()) anEdge = TopoDS::Edge (exp.Current());
}
else {
if ( myFShape.ShapeType() == TopAbs_EDGE) {
anEdge = TopoDS::Edge (myFShape);
BRepAdaptor_Curve AdaptedCurve (anEdge);
if (!AdaptedCurve.GetType() == GeomAbs_Circle) return;
myCircle = AdaptedCurve.Circle();
myFirstPar = AdaptedCurve.FirstParameter();
myLastPar = AdaptedCurve.LastParameter();
}
#ifdef DEB
else {
cout << "AIS_RadiusDimension::InitFirstShape ==> myFShape.ShapeType() == " << myFShape.ShapeType() << endl;
}
#endif
}
}
myCenter = myCircle.Location();
myCircle.SetRadius(myVal);
while (myFirstPar > 2*M_PI) myFirstPar -= 2*M_PI;
while (myFirstPar < 0.0 ) myFirstPar += 2*M_PI;
while (myLastPar > 2*M_PI) myLastPar -= 2*M_PI;
while (myLastPar < 0.0 ) myLastPar += 2*M_PI;
myPlane = new Geom_Plane(gp_Pln(gp_Ax3(myCircle.Position())));
myFirstLine = gce_MakeLin( myCenter, ElCLib::Value( myFirstPar, myCircle ) );
myLastLine = gce_MakeLin( myCenter, ElCLib::Value( myLastPar, myCircle ) );
}
//=======================================================================
//function : SetFirstShape
//purpose :
//=======================================================================
void AIS_RadiusDimension::SetFirstShape( const TopoDS_Shape& aFShape )
{
myFShape = aFShape;
InitFirstShape();
}
//=======================================================================
//function : Compute
//purpose :
//=======================================================================
void AIS_RadiusDimension::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer /*aMode*/)
{
aPresentation->Clear();
ComputeRadius( aPresentation );
}
//=======================================================================
//function : Compute
//purpose : to avoid warning
//=======================================================================
void AIS_RadiusDimension::Compute(const Handle(Prs3d_Projector)& aProjector,
const Handle(Prs3d_Presentation)& aPresentation)
{
// Standard_NotImplemented::Raise("AIS_RadiusDimension::Compute(const Handle(Prs3d_Projector)& aProjector,const Handle(Prs3d_Presentation)& aPresentation)");
PrsMgr_PresentableObject::Compute( aProjector , aPresentation ) ;
}
//=======================================================================
//function : Compute
//function : computeValue
//purpose :
//=======================================================================
void AIS_RadiusDimension::Compute(const Handle_Prs3d_Projector& aProjector,
const Handle_Geom_Transformation& aTransformation,
const Handle_Prs3d_Presentation& aPresentation)
void AIS_RadiusDimension::computeValue ()
{
// Standard_NotImplemented::Raise("AIS_RadiusDimension::Compute(const Handle_Prs3d_Projector&, const Handle_Geom_Transformation&, const Handle_Prs3d_Presentation&)");
PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation ) ;
myValue = myFirstPoint.Distance (mySecondPoint);
AIS_Dimension::computeValue ();
}
//=======================================================================
//function : ComputeSelection
//function : countDefaultPlane
//purpose :
//=======================================================================
void AIS_RadiusDimension::ComputeSelection( const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer )
{
gp_Pnt LineOrigin, LineEnd;
DsgPrs::ComputeRadiusLine( myCenter, myEndOfArrow, myPosition, mydrawFromCenter,
LineOrigin,LineEnd);
Handle(AIS_DimensionOwner) own = new AIS_DimensionOwner(this,7);
own->SetShape(myFShape);
Handle( Select3D_SensitiveSegment ) seg = new Select3D_SensitiveSegment( own, LineOrigin, LineEnd );
aSelection->Add( seg );
// Text
Standard_Real size(Min(myVal/100.+1.e-6,myArrowSize+1.e-6));
Handle( Select3D_SensitiveBox ) box = new Select3D_SensitiveBox( own,
myPosition.X(),
myPosition.Y(),
myPosition.Z(),
myPosition.X() + size,
myPosition.Y() + size,
myPosition.Z() + size );
aSelection->Add(box);
void AIS_RadiusDimension::countDefaultPlane ()
{
// 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 ();
}
//=======================================================================
//function : ComputeRadius
//function : SetFlyout
//purpose :
//=======================================================================
void AIS_RadiusDimension::ComputeRadius( const Handle( Prs3d_Presentation )& aPresentation )
void AIS_RadiusDimension::SetFlyout (const Standard_Real theFlyout)
{
if (myAutomaticPosition)
{
InitFirstShape();
myEndOfArrow = ElCLib::Value( (myFirstPar + myLastPar)/2, myCircle );
if(mydrawFromCenter) {
myPosition = myCenter;
}
else
{
gp_Vec v1(myCenter, myEndOfArrow);
myPosition = myCenter.Translated(v1 * 1.2);
}
myAutomaticPosition = Standard_True;
if (myIsSetBndBox)
myPosition = AIS::TranslatePointToBound(myPosition, gce_MakeDir( myCenter, myEndOfArrow ),
myBndBox );
}
else
{
//!Automaticposition
myPosition = AIS::ProjectPointOnPlane( myPosition, myPlane->Pln() );
Standard_Real PosPar = ElCLib::Parameter( myCircle, myPosition );
if (!AIS::InDomain(myFirstPar, myLastPar, PosPar))
{ // not in domain
Standard_Real otherpar = PosPar + M_PI;
if (otherpar > 2*M_PI) otherpar -= 2*M_PI;
if (AIS::InDomain(myFirstPar, myLastPar, otherpar)){
PosPar = otherpar;// parameter on circle
myEndOfArrow = ElCLib::Value( PosPar, myCircle );
}
else {
Standard_Real Teta1 = Abs( PosPar - myFirstPar ), Teta2 = Abs( PosPar - myLastPar );
if (Teta1 > M_PI)
Teta1 = 2.0*M_PI - Teta1;
if (Teta2 > M_PI)
Teta2 = 2.0*M_PI - Teta2;
if (Teta1 < Teta2)
{
if(myFirstLine.Contains(myPosition,Precision::Confusion()))
PosPar = myFirstPar;
else
PosPar = myLastPar;
}
else
{
if(myLastLine.Contains(myPosition,Precision::Confusion()))
PosPar = myLastPar;
else
PosPar = myFirstPar;
}
myEndOfArrow = ElCLib::Value( PosPar, myCircle );
gp_Lin RadiusLine = gce_MakeLin( myCenter, myEndOfArrow );
// project on radius line
myPosition = ElCLib::Value( ElCLib::Parameter( RadiusLine, myPosition ), RadiusLine );
}
}
else
myEndOfArrow = ElCLib::Value( PosPar, myCircle );
}
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
// size
#ifdef BUC60915
if( !myArrowSizeIsDefined ) {
myArrowSize = Min(myArrowSize,myVal/5.);
}
arr->SetLength(myArrowSize);
#else
if (myVal/5. > myArrowSize)
arr->SetLength(myArrowSize);
else
arr->SetLength(myVal/5.);
#endif
DsgPrs_RadiusPresentation::Add( aPresentation, myDrawer, myText, myPosition,
myCenter, myEndOfArrow, mySymbolPrs, mydrawFromCenter );
}
myFlyout = theFlyout;
}
//=======================================================================
//function : GetFlyout
//purpose :
//=======================================================================
Standard_Real AIS_RadiusDimension::GetFlyout () const
{
return myFlyout;
}

View File

@ -0,0 +1,91 @@
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2012 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.
//! 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 <Standard.hxx>
#include <Standard_Macro.hxx>
#include <TopoDS_Shape.hxx>
DEFINE_STANDARD_HANDLE(AIS_RadiusDimension,AIS_Dimension)
class AIS_RadiusDimension : public AIS_Dimension
{
public:
Standard_EXPORT AIS_RadiusDimension (const gp_Circ& theCircle);
Standard_EXPORT AIS_RadiusDimension (const gp_Circ& theCircle,
const gp_Pnt& theAttachPoint);
Standard_EXPORT AIS_RadiusDimension (const gp_Circ& theCircle,
const Handle(Prs3d_DimensionAspect)& theDimensionAspect,
const Standard_Real theExtensionSize = 1.0);
Standard_EXPORT AIS_RadiusDimension (const gp_Circ& theCircle,
const gp_Pnt& theAttachPoint,
const Handle(Prs3d_DimensionAspect)& theDimensionAspect,
const Standard_Real theExtensionSize = 1.0);
//! 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);
Standard_EXPORT void SetFlyout (const Standard_Real theFlyoutSize);
Standard_EXPORT Standard_Real GetFlyout () const;
DEFINE_STANDARD_RTTI(AIS_RadiusDimension)
protected:
//! Computes dimension value in display units
Standard_EXPORT virtual void computeValue ();
//! Fills default plane object if it is possible to count plane automatically.
Standard_EXPORT virtual void countDefaultPlane ();
private:
virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode = 0);
// Fields
//! Defines flyout lines and direction
//! Flyout direction in the working plane (stored in the base AIS_Dimension).
//! 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_Circ myCircle;
};
#endif

View File

@ -1,52 +0,0 @@
// Created on: 1997-02-28
// Created by: Jean-Pierre COMBE
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2012 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.
//=======================================================================
//function : KindOfDimension
//purpose :
//=======================================================================
inline AIS_KindOfDimension AIS_RadiusDimension::KindOfDimension() const
{
return AIS_KOD_RADIUS;
}
//=======================================================================
//function : IsMovable
//purpose :
//=======================================================================
inline Standard_Boolean AIS_RadiusDimension::IsMovable() const
{
return Standard_True;
}
//=======================================================================
//function : DrawFromCenter
//purpose :
//=======================================================================
inline Standard_Boolean AIS_RadiusDimension::DrawFromCenter() const
{
return mydrawFromCenter;
}
inline void AIS_RadiusDimension::SetDrawFromCenter(const Standard_Boolean drawfromcenter)
{
mydrawFromCenter = drawfromcenter;
}

View File

@ -48,7 +48,7 @@ uses
Presentation from Prs3d,
Curve from Geom,
NameOfColor from Quantity,
Color from Quantity,
Color from Quantity,
TypeOfLine from Aspect,
TypeOfMarker from Aspect,
KindOfInteractive from AIS,

View File

@ -38,9 +38,8 @@
#include <Geom_CartesianPoint.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_AngleAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_PointAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_TextAspect.hxx>
#include <StdPrs_WFDeflectionShape.hxx>
@ -237,22 +236,17 @@ void AIS_Relation::SetColor(const Quantity_Color &aCol)
if (!myDrawer->HasLineAspect()) {
myDrawer->SetLineAspect(new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
}
if (!myDrawer->HasLengthAspect()) {
myDrawer->SetLengthAspect(new Prs3d_LengthAspect);
}
if (!myDrawer->HasAngleAspect()) {
myDrawer->SetAngleAspect(new Prs3d_AngleAspect);
if (!myDrawer->HasDimensionAspect()) {
myDrawer->SetDimensionAspect(new Prs3d_DimensionAspect);
}
myDrawer->LineAspect()->SetColor(aCol);
const Handle(Prs3d_LengthAspect)& LENGTH = myDrawer->LengthAspect();
const Handle(Prs3d_AngleAspect)& ANGLE = myDrawer->AngleAspect();
const Handle(Prs3d_DimensionAspect)& DIMENSION = myDrawer->DimensionAspect();
const Handle(Prs3d_LineAspect)& LINE = myDrawer->LineAspect();
const Handle(Prs3d_TextAspect)& TEXT = myDrawer->TextAspect();
LENGTH->SetLineAspect(LINE);
LENGTH->SetTextAspect(TEXT);
ANGLE->SetLineAspect(LINE);
ANGLE->SetTextAspect(TEXT);
DIMENSION->SetLineAspect(LINE);
DIMENSION->SetTextAspect(TEXT);
}
//=======================================================================
@ -267,8 +261,7 @@ void AIS_Relation::UnsetColor()
Quantity_Color CC;
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
LA->SetColor(CC);
myDrawer->AngleAspect()->SetLineAspect(LA);
myDrawer->LengthAspect()->SetLineAspect(LA);
myDrawer->DimensionAspect()->SetLineAspect(LA);
myDrawer->SetTextAspect(myDrawer->Link()->TextAspect());
}

View File

@ -54,7 +54,7 @@
#include <Precision.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <DsgPrs_SymmetricPresentation.hxx>
@ -541,10 +541,10 @@ void AIS_SymmetricRelation::ComputeTwoEdgesSymmetric(const Handle(Prs3d_Presenta
gp_Pnt Pj1 = ElCLib::Value(ElCLib::Parameter(laxis,myFAttach),laxis);
gp_Pnt Pj2 = ElCLib::Value(ElCLib::Parameter(laxis,mySAttach),laxis);
if ((myFAttach.SquareDistance(Pj1)+mySAttach.SquareDistance(Pj2)) <= Precision::Confusion()) myArrowSize = 0.;
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
arr->SetLength(myArrowSize);
arr = la->Arrow2Aspect();
arr = la->ArrowAspect();
arr->SetLength(myArrowSize);
if(cu1.GetType() == GeomAbs_Line)
DsgPrs_SymmetricPresentation::Add(aprs,
@ -632,10 +632,10 @@ void AIS_SymmetricRelation::ComputeTwoVerticesSymmetric(const Handle(Prs3d_Prese
myPosition = curpos;
}
if (2*(myFAttach.Distance(mySAttach)) <= Precision::Confusion()) myArrowSize = 0.;
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
arr->SetLength(myArrowSize);
arr = la->Arrow2Aspect();
arr = la->ArrowAspect();
arr->SetLength(myArrowSize);
DsgPrs_SymmetricPresentation::Add(aprs,
myDrawer,

View File

@ -7,3 +7,13 @@ AIS_NListIteratorOfListTransient.hxx
AIS_NDataMapOfTransientIteratorOfListTransient.hxx
AIS_Triangulation.cdl
AIS_Triangulation.cxx
AIS_Dimension.hxx
AIS_Dimension.cxx
AIS_LengthDimension.hxx
AIS_LengthDimension.cxx
AIS_AngleDimension.hxx
AIS_AngleDimension.cxx
AIS_DiameterDimension.hxx
AIS_DiameterDimension.cxx
AIS_RadiusDimension.hxx
AIS_RadiusDimension.cxx

View File

@ -538,7 +538,8 @@ is
enumeration TypeOfDisplayText is TODT_NORMAL,
TODT_SUBTITLE,
TODT_DEKALE,
TODT_BLEND
TODT_BLEND,
TODT_DIMENSION
end TypeOfDisplayText;
---Purpose: Define the display type of the text.
--
@ -546,6 +547,7 @@ is
-- TODT_SUBTITLE There is a subtitle under the text.
-- TODT_DEKALE The text is displayed with a 3D style.
-- TODT_BLEND The text is displayed in XOR.
-- TODT_DIMENSION Dimension line under text will be invisible.
---Category: Enumerations
enumeration TypeOfMarker is TOM_POINT,

View File

@ -86,15 +86,7 @@ AS_FIRSTAR_LASTPT,AS_FIRSTPT_LASTAR;
imported DatumPrs;
ComputeSymbol(aPresentation: Presentation from Prs3d;
anAspect: AngleAspect from Prs3d;
pt1,pt2:Pnt from gp;
dir1,dir2: Dir from gp;
ArrowSide: ArrowSide from DsgPrs);
---Purpose: draws symbols ((one or two) arrows,(one or two)points
-- at thebeginning and at the end of the dimension
ComputeSymbol(aPresentation: Presentation from Prs3d;
anAspect: LengthAspect from Prs3d;
anAspect: DimensionAspect from Prs3d;
pt1,pt2:Pnt from gp;
dir1,dir2: Dir from gp;
ArrowSide: ArrowSide from DsgPrs;

View File

@ -47,14 +47,14 @@
#include <gce_MakeLin.hxx>
void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
const Handle(Prs3d_AngleAspect)& LA,
const Handle(Prs3d_DimensionAspect)& LA,
const gp_Pnt& pt1,
const gp_Pnt& pt2,
const gp_Dir& dir1,
const gp_Dir& dir2,
const DsgPrs_ArrowSide ArrowSide)
const DsgPrs_ArrowSide ArrowSide,
const Standard_Boolean drawFromCenter)
{
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
@ -64,6 +64,7 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
LA->LineAspect()->Aspect()->Values (aColor, aType, aWidth);
Handle(Graphic3d_AspectMarker3d) aMarkerAsp = new Graphic3d_AspectMarker3d (Aspect_TOM_O, aColor, 1.0);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect (aMarkerAsp);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
switch(ArrowSide) {
case DsgPrs_AS_NONE:
@ -109,9 +110,12 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
case DsgPrs_AS_FIRSTPT:
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
if(drawFromCenter)
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
}
break;
}
@ -126,12 +130,18 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
case DsgPrs_AS_BOTHPT:
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints1 = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints1->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints1);
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints2 = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints2->AddVertex (pt2.X(), pt2.Y(), pt2.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints2);
if(drawFromCenter)
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints1 = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints1->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints1);
}
if(drawFromCenter)
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints2 = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints2->AddVertex (pt2.X(), pt2.Y(), pt2.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints2);
}
break;
}
@ -153,10 +163,12 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
case DsgPrs_AS_FIRSTPT_LASTAR:
{
// a Round
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
if(drawFromCenter)
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
}
// an Arrow
Prs3d_Arrow::Draw(aPresentation,
pt2,
@ -168,134 +180,6 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
}
}
void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
const Handle(Prs3d_LengthAspect)& LA,
const gp_Pnt& pt1,
const gp_Pnt& pt2,
const gp_Dir& dir1,
const gp_Dir& dir2,
const DsgPrs_ArrowSide ArrowSide,
const Standard_Boolean drawFromCenter)
{
Quantity_Color aColor;
Aspect_TypeOfLine aType;
Standard_Real aWidth;
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
LA->LineAspect()->Aspect()->Values(aColor, aType, aWidth);
Handle(Graphic3d_AspectMarker3d) aMarkerAsp = new Graphic3d_AspectMarker3d (Aspect_TOM_O, aColor, 1.0);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect (aMarkerAsp);
switch(ArrowSide) {
case DsgPrs_AS_NONE:
{
break;
}
case DsgPrs_AS_FIRSTAR:
{
Prs3d_Arrow::Draw(aPresentation,
pt1,
dir1,
LA->Arrow1Aspect()->Angle(),
LA->Arrow1Aspect()->Length());
break;
}
case DsgPrs_AS_LASTAR:
{
Prs3d_Arrow::Draw(aPresentation,
pt2,
dir2,
LA->Arrow1Aspect()->Angle(),
LA->Arrow1Aspect()->Length());
break;
}
case DsgPrs_AS_BOTHAR:
{
Prs3d_Arrow::Draw(aPresentation,
pt1,
dir1,
LA->Arrow1Aspect()->Angle(),
LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,
pt2,
dir2,
LA->Arrow1Aspect()->Angle(),
LA->Arrow1Aspect()->Length());
break;
}
case DsgPrs_AS_FIRSTPT:
{
if (drawFromCenter)
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
}
break;
}
case DsgPrs_AS_LASTPT:
{
// On dessine un rond
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt2.X(), pt2.Y(), pt2.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
break;
}
case DsgPrs_AS_BOTHPT:
{
if (drawFromCenter)
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints1 = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints1->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints1);
}
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints2 = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints2->AddVertex (pt2.X(), pt2.Y(), pt2.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints2);
break;
}
case DsgPrs_AS_FIRSTAR_LASTPT:
{
// an Arrow
Prs3d_Arrow::Draw (aPresentation,
pt1,
dir1,
LA->Arrow1Aspect()->Angle(),
LA->Arrow1Aspect()->Length());
// a Round
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt2.X(), pt2.Y(), pt2.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
break;
}
case DsgPrs_AS_FIRSTPT_LASTAR:
{
// a Round
if (drawFromCenter)
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
}
// an Arrow
Prs3d_Arrow::Draw (aPresentation,
pt2,
dir2,
LA->Arrow1Aspect()->Angle(),
LA->Arrow1Aspect()->Length());
break;
}
}
}
//=======================================================================
//function : ComputePlanarFacesLengthPresentation

View File

@ -24,11 +24,10 @@
#include <Graphic3d_Group.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_AngleAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_Text.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
@ -87,14 +86,13 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
const gp_Circ& VmaxCircle,
const Standard_Real aArrowSize)
{
Handle(Prs3d_AngleAspect) anAngleAspect = aDrawer->AngleAspect();
Handle(Prs3d_LengthAspect) aLengthAspect = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) aDimensionAspect = aDrawer->DimensionAspect();
TCollection_ExtendedString txt(aText);
const Standard_Real myArrowSize = ( aArrowSize == 0.0 )? (0.1 * aCircle.Radius()) : aArrowSize;
anAngleAspect->ArrowAspect()->SetLength(myArrowSize);
aDimensionAspect->ArrowAspect()->SetLength(myArrowSize);
aDrawer->ArrowAspect()->SetLength(myArrowSize);
Standard_Boolean IsConeTrimmed = Standard_False;
@ -175,15 +173,15 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
aPrims->AddVertex(ElCLib::Value(param + angle/11 * i, aCircle2));
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
DsgPrs::ComputeSymbol(aPresentation, anAngleAspect, AttachmentPnt,
DsgPrs::ComputeSymbol(aPresentation, aDimensionAspect, AttachmentPnt,
AttachmentPnt, aDir, aDir, DsgPrs_AS_LASTAR);
DsgPrs::ComputeSymbol(aPresentation, anAngleAspect, OppositePnt,
DsgPrs::ComputeSymbol(aPresentation, aDimensionAspect, OppositePnt,
OppositePnt, aDir2, aDir2, DsgPrs_AS_LASTAR);
param = ElCLib::Parameter(aCircle2, tmpPnt);
tmpPnt = ElCLib::Value(param, aCircle2);
tmpPnt = tmpPnt.Translated(gp_Vec(0, 0, -2));
Prs3d_Text::Draw(aPresentation, aLengthAspect->TextAspect(), txt, tmpPnt); //add the TCollection_ExtendedString
Prs3d_Text::Draw(aPresentation, aDimensionAspect->TextAspect(), txt, tmpPnt); //add the TCollection_ExtendedString
angle = 2. * M_PI - param ;
if( param > OppParam )
@ -241,7 +239,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
char valcar[80];
sprintf(valcar,"%5.2f",theval);
Handle(Prs3d_AngleAspect) LA = aDrawer->AngleAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Ax2 ax(CenterPoint,axisdir,dir1);
@ -353,7 +351,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
char valcar[80];
sprintf(valcar,"%5.2f",theval);
Handle( Prs3d_AngleAspect ) LA = aDrawer->AngleAspect();
Handle( Prs3d_DimensionAspect ) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup( aPresentation )->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
gp_Circ AngleCirc, AttachCirc;
@ -467,7 +465,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
char valcar[80];
sprintf(valcar,"%5.2f",theval);
Handle(Prs3d_AngleAspect) LA = aDrawer->AngleAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Dir Norm;
@ -586,7 +584,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
char valcar[80];
sprintf(valcar,"%5.2f",theval);
Handle(Prs3d_AngleAspect) LA = aDrawer->AngleAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Dir Norm = dir1.Crossed(dir2);
@ -702,7 +700,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
TCollection_AsciiString valas(valcar);
TCollection_ExtendedString aText(valas);
Handle(Prs3d_AngleAspect) LA = aDrawer->AngleAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Dir Norm = dir1.Crossed(dir2);
@ -801,7 +799,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
const gp_Ax1& theAxe,
const DsgPrs_ArrowSide ArrowSide)
{
Handle(Prs3d_AngleAspect) LA = aDrawer->AngleAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Dir dir1(gp_Vec(CenterPoint, AttachmentPoint1));

View File

@ -27,7 +27,7 @@
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Text.hxx>
#include <gp_Dir.hxx>
@ -42,7 +42,7 @@ void DsgPrs_Chamf2dPresentation::Add(
const gp_Pnt& aPntEnd,
const TCollection_ExtendedString& aText)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
@ -52,7 +52,7 @@ void DsgPrs_Chamf2dPresentation::Add(
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
gp_Dir ArrowDir(aPntAttach.XYZ()-aPntEnd.XYZ());
Prs3d_Arrow::Draw(aPresentation,aPntAttach,ArrowDir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,aPntAttach,ArrowDir,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,aPntEnd);
}
@ -71,7 +71,7 @@ void DsgPrs_Chamf2dPresentation::Add(
const TCollection_ExtendedString& aText,
const DsgPrs_ArrowSide ArrowPrs)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());

View File

@ -24,7 +24,7 @@
#include <Graphic3d_Group.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_LineAspect.hxx>
@ -43,7 +43,7 @@ void DsgPrs_ConcentricPresentation::Add(
const gp_Dir& aNorm,
const gp_Pnt& aPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
//Creation et discretisation du plus gros cercle
gp_Circ Circ(gp_Ax2(aCenter,aNorm), aRadius);

View File

@ -25,7 +25,7 @@
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_Text.hxx>
#include <Prs3d_ArrowAspect.hxx>
@ -60,7 +60,7 @@ void DsgPrs_DiameterPresentation::Add (const Handle(Prs3d_Presentation)& aPresen
const DsgPrs_ArrowSide ArrowPrs,
const Standard_Boolean IsDiamSymbol )
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Standard_Real parat = ElCLib::Parameter(aCircle, AttachmentPoint);
@ -156,7 +156,7 @@ void DsgPrs_DiameterPresentation::Add (const Handle(Prs3d_Presentation)& aPresen
lpara -= 2.*M_PI;
}
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Standard_Real parEndOfArrow = ElCLib::Parameter(aCircle,AttachmentPoint);
gp_Pnt EndOfArrow;

View File

@ -27,7 +27,7 @@
#include <Graphic3d_Group.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
@ -66,7 +66,7 @@ void DsgPrs_EllipseRadiusPresentation::Add (const Handle(Prs3d_Presentation)& aP
const Standard_Boolean IsMaxRadius,
const DsgPrs_ArrowSide ArrowPrs)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
const Standard_Real dist = aCenter.Distance( aPosition );
@ -108,7 +108,7 @@ void DsgPrs_EllipseRadiusPresentation::Add (const Handle(Prs3d_Presentation)& aP
const Standard_Boolean IsMaxRadius,
const DsgPrs_ArrowSide ArrowPrs)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
if(!IsInDomain)
@ -150,7 +150,7 @@ void DsgPrs_EllipseRadiusPresentation::Add (const Handle(Prs3d_Presentation)& aP
const Standard_Boolean IsMaxRadius,
const DsgPrs_ArrowSide ArrowPrs)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
if(!IsInDomain)

View File

@ -22,7 +22,7 @@
#include <DsgPrs.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
@ -48,7 +48,7 @@ void DsgPrs_EqualDistancePresentation::Add( const Handle( Prs3d_Presentation )&
const gp_Pnt& Point4,
const Handle( Geom_Plane )& Plane )
{
Handle( Prs3d_LengthAspect ) LA = aDrawer->LengthAspect();
Handle( Prs3d_DimensionAspect ) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup( aPresentation )->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
// Line between two middles
@ -132,7 +132,7 @@ void DsgPrs_EqualDistancePresentation::Add( const Handle( Prs3d_Presentation )&
gp_Pnt& aProj1,
gp_Pnt& aProj2)
{
const Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
const Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Lin L1 (aPoint1,aDirection);
@ -170,7 +170,7 @@ void DsgPrs_EqualDistancePresentation::Add( const Handle( Prs3d_Presentation )&
const gp_Pnt& aPoint4,
const DsgPrs_ArrowSide anArrowSide)
{
const Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
const Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Standard_Real aPar11, aPar12, aPar21, aPar22;

View File

@ -22,7 +22,7 @@
#include <DsgPrs.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_Root.hxx>
@ -42,7 +42,7 @@ void DsgPrs_EqualRadiusPresentation::Add( const Handle( Prs3d_Presentation )& aP
const gp_Pnt& SecondPoint,
const Handle( Geom_Plane )& Plane )
{
Handle( Prs3d_LengthAspect ) LA = aDrawer->LengthAspect();
Handle( Prs3d_DimensionAspect ) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup( aPresentation )->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(4);

View File

@ -26,7 +26,7 @@
#include <Graphic3d_Group.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
@ -84,10 +84,10 @@ void DsgPrs_FilletRadiusPresentation::Add (const Handle(Prs3d_Presentation)& aPr
gp_Dir DirOfArrow;
gp_Circ FilletCirc;
// gp_Pnt NewPosition, EndOfArrow;
Handle( Prs3d_LengthAspect ) LA = aDrawer->LengthAspect();
Handle( Prs3d_DimensionAspect ) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup( aPresentation )->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
Standard_Real ArrowLength = LA->Arrow1Aspect()->Length();
Standard_Real ArrowLength = LA->ArrowAspect()->Length();
DsgPrs::ComputeFilletRadiusPresentation( ArrowLength,
theval,
aPosition,

View File

@ -27,7 +27,7 @@
#include <Graphic3d_ArrayOfPoints.hxx>
#include <Graphic3d_Vertex.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Root.hxx>
@ -56,7 +56,7 @@ void DsgPrs_FixPresentation::Add(
const gp_Dir& aNormPln,
const Standard_Real symbsize)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(10);

View File

@ -30,7 +30,7 @@
#include <Graphic3d_ArrayOfPoints.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Text.hxx>
#include <TCollection_AsciiString.hxx>
@ -49,7 +49,7 @@ void DsgPrs_IdenticPresentation::Add( const Handle(Prs3d_Presentation)& aPresent
const gp_Pnt& aPntAttach,
const gp_Pnt& aPntOffset)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
@ -82,7 +82,7 @@ void DsgPrs_IdenticPresentation::Add( const Handle(Prs3d_Presentation)& aPresent
const gp_Pnt& aSAttach,
const gp_Pnt& aPntOffset)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(4);
@ -120,7 +120,7 @@ void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresenta
const gp_Pnt& aSAttach,
const gp_Pnt& aPntOffset)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Ax2 ax = theAxe;
@ -169,7 +169,7 @@ void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresenta
const gp_Pnt& aPntOffset,
const gp_Pnt& aPntOnCirc)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Ax2 ax = theAxe;
@ -218,7 +218,7 @@ void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresenta
const gp_Pnt& aPntOffset,
const gp_Pnt& aPntOnElli)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Standard_Real pFAttach = ElCLib::Parameter(anEllipse, aFAttach);

View File

@ -28,7 +28,7 @@
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <TCollection_AsciiString.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Prs3d_Text.hxx>
@ -52,7 +52,7 @@ void DsgPrs_LengthPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
const gp_Dir& aDirection,
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Lin L1 (AttachmentPoint1,aDirection);
@ -88,7 +88,7 @@ void DsgPrs_LengthPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
aPrims->AddVertex(PointMin);
aPrims->AddVertex(PointMax);
if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length()))
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length()))
outside = Standard_True;
gp_Dir arrdir = L3.Direction().Reversed();
@ -96,13 +96,13 @@ void DsgPrs_LengthPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
arrdir.Reverse();
// arrow 1 : 2nd group
Prs3d_Arrow::Draw(aPresentation,Proj1,arrdir, LA->Arrow1Aspect()->Angle(), LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,Proj1,arrdir, LA->ArrowAspect()->Angle(), LA->ArrowAspect()->Length());
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
// arrow 2 : 3rd group
Prs3d_Arrow::Draw(aPresentation,Proj2,arrdir.Reversed(), LA->Arrow2Aspect()->Angle(), LA->Arrow2Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,Proj2,arrdir.Reversed(), LA->ArrowAspect()->Angle(), LA->ArrowAspect()->Length());
Prs3d_Root::NewGroup(aPresentation);
@ -137,14 +137,14 @@ void DsgPrs_LengthPresentation::Add( const Handle(Prs3d_Presentation)& aPresenta
const gp_Pnt& OffsetPoint,
const DsgPrs_ArrowSide ArrowPrs )
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Pnt EndOfArrow1, EndOfArrow2;
gp_Dir DirOfArrow1;
DsgPrs::ComputePlanarFacesLengthPresentation( LA->Arrow1Aspect()->Length(),
LA->Arrow2Aspect()->Length(),
DsgPrs::ComputePlanarFacesLengthPresentation( LA->ArrowAspect()->Length(),
LA->ArrowAspect()->Length(),
AttachmentPoint1,
AttachmentPoint2,
aDirection,
@ -208,7 +208,7 @@ void DsgPrs_LengthPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
const gp_Pnt& OffsetPoint,
const DsgPrs_ArrowSide ArrowPrs)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Lin L1 (AttachmentPoint1,aDirection);
@ -245,7 +245,7 @@ void DsgPrs_LengthPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
aPrims->AddVertex(PointMin);
aPrims->AddVertex(PointMax);
if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length()))
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length()))
outside = Standard_True;
gp_Dir arrdir = L3.Direction().Reversed();
@ -285,7 +285,7 @@ void DsgPrs_LengthPresentation::Add( const Handle(Prs3d_Presentation)& aPresenta
const gp_Pnt& OffsetPoint,
const DsgPrs_ArrowSide ArrowPrs )
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Pnt EndOfArrow2;
@ -293,8 +293,8 @@ void DsgPrs_LengthPresentation::Add( const Handle(Prs3d_Presentation)& aPresenta
Handle( Geom_Curve ) VCurve, UCurve;
Standard_Real FirstU, deltaU = 0.0e0, FirstV, deltaV = 0.0e0;
DsgPrs::ComputeCurvilinearFacesLengthPresentation( LA->Arrow1Aspect()->Length(),
LA->Arrow2Aspect()->Length(),
DsgPrs::ComputeCurvilinearFacesLengthPresentation( LA->ArrowAspect()->Length(),
LA->ArrowAspect()->Length(),
SecondSurf,
AttachmentPoint1,
AttachmentPoint2,
@ -381,22 +381,22 @@ void DsgPrs_LengthPresentation::Add (const Handle(Prs3d_Presentation)& aPrs,
{
case DsgPrs_AS_LASTAR:
Prs3d_Arrow::Draw(aPrs,Pt2,gp_Dir(gp_Vec(Pt1,Pt2)),
aDrawer->LengthAspect()->Arrow1Aspect()->Angle(),
aDrawer->LengthAspect()->Arrow1Aspect()->Length());
aDrawer->DimensionAspect()->ArrowAspect()->Angle(),
aDrawer->DimensionAspect()->ArrowAspect()->Length());
break;
case DsgPrs_AS_FIRSTAR:
Prs3d_Arrow::Draw(aPrs,Pt1,gp_Dir(gp_Vec(Pt2,Pt1)),
aDrawer->LengthAspect()->Arrow1Aspect()->Angle(),
aDrawer->LengthAspect()->Arrow1Aspect()->Length());
aDrawer->DimensionAspect()->ArrowAspect()->Angle(),
aDrawer->DimensionAspect()->ArrowAspect()->Length());
break;
case DsgPrs_AS_BOTHAR:
V = gp_Vec(Pt1,Pt2);
Prs3d_Arrow::Draw(aPrs,Pt2,gp_Dir(V),
aDrawer->LengthAspect()->Arrow1Aspect()->Angle(),
aDrawer->LengthAspect()->Arrow1Aspect()->Length());
aDrawer->DimensionAspect()->ArrowAspect()->Angle(),
aDrawer->DimensionAspect()->ArrowAspect()->Length());
Prs3d_Arrow::Draw(aPrs,Pt1,gp_Dir(V.Reversed()),
aDrawer->LengthAspect()->Arrow1Aspect()->Angle(),
aDrawer->LengthAspect()->Arrow1Aspect()->Length());
aDrawer->DimensionAspect()->ArrowAspect()->Angle(),
aDrawer->DimensionAspect()->ArrowAspect()->Length());
break;
default:
break;

View File

@ -40,7 +40,7 @@
#include <Prs3d_Root.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Text.hxx>
//===================================================================
@ -57,7 +57,7 @@ void DsgPrs_MidPointPresentation::Add (const Handle(Prs3d_Presentation)& aPresen
{
Standard_Real rad = AttachPoint.Distance(MidPoint)/20.0;
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
gp_Ax2 ax = theAxe;
ax.SetLocation(MidPoint);
@ -123,7 +123,7 @@ void DsgPrs_MidPointPresentation::Add (const Handle(Prs3d_Presentation)& aPresen
Standard_Real rad = AttachPoint.Distance(MidPoint)/20.0;
if ( rad <= Precision::Confusion() ) rad = Point1.Distance(Point2)/20.0;
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
gp_Ax2 ax = theAxe;
ax.SetLocation(MidPoint);
@ -189,7 +189,7 @@ void DsgPrs_MidPointPresentation::Add (const Handle(Prs3d_Presentation)& aPresen
Standard_Real rad = AttachPoint.Distance(MidPoint)/20.0;
if ( rad <= Precision::Confusion() ) rad = Point1.Distance(Point2)/20.0;
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
gp_Ax2 ax = aCircle.Position();
ax.SetLocation(MidPoint);
@ -263,7 +263,7 @@ void DsgPrs_MidPointPresentation::Add (const Handle(Prs3d_Presentation)& aPresen
Standard_Real rad = AttachPoint.Distance(MidPoint)/20.0;
if ( rad <= Precision::Confusion() ) rad = Point1.Distance(Point2)/20.0;
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
gp_Pnt Ptmp,ptcur;

View File

@ -34,7 +34,7 @@
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <TCollection_AsciiString.hxx>
@ -61,7 +61,7 @@ void DsgPrs_OffsetPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
const gp_Dir& aDirection2,
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Lin L1 (AttachmentPoint1,aDirection);
@ -114,19 +114,19 @@ void DsgPrs_OffsetPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
if (DimNulle)
{
Prs3d_Arrow::Draw(aPresentation,offp,L4.Direction(),LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,offp,L4.Direction().Reversed(),LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,offp,L4.Direction(),LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
Prs3d_Arrow::Draw(aPresentation,offp,L4.Direction().Reversed(),LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
}
else
{
if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length()))
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length()))
outside = Standard_True;
gp_Dir arrdir = L3.Direction().Reversed();
if (outside)
arrdir.Reverse();
// fleche 1 : 2eme groupe
Prs3d_Arrow::Draw(aPresentation,Proj1,arrdir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,Proj1,arrdir,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
@ -177,7 +177,7 @@ void DsgPrs_OffsetPresentation::AddAxes (const Handle(Prs3d_Presentation)& aPres
gp_Lin L2 (AttachmentPoint2,aDirection);
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L2,OffsetPoint),L2);
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Quantity_Color acolor;
Aspect_TypeOfLine atype;
Standard_Real awidth;

View File

@ -28,7 +28,7 @@
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <TCollection_AsciiString.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Prs3d_Text.hxx>
@ -42,7 +42,7 @@ void DsgPrs_ParalPresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
const gp_Dir& aDirection,
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Lin L1 (AttachmentPoint1,aDirection);
gp_Lin L2 (AttachmentPoint2,aDirection);
@ -80,20 +80,20 @@ void DsgPrs_ParalPresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length()))
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length()))
outside = Standard_True;
gp_Dir arrdir = L3.Direction().Reversed();
if (outside)
arrdir.Reverse();
// arrow 1 : 2nd group
Prs3d_Arrow::Draw(aPresentation,Proj1,arrdir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,Proj1,arrdir,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
// arrow 2 : 3rd group
Prs3d_Arrow::Draw(aPresentation,Proj2,arrdir.Reversed(),LA->Arrow2Aspect()->Angle(),LA->Arrow2Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,Proj2,arrdir.Reversed(),LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
Prs3d_Root::NewGroup(aPresentation);
@ -127,7 +127,7 @@ void DsgPrs_ParalPresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
const gp_Pnt& OffsetPoint,
const DsgPrs_ArrowSide ArrowPrs)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Lin L1 (AttachmentPoint1,aDirection);
@ -163,7 +163,7 @@ void DsgPrs_ParalPresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
aPrims->AddVertex(PointMin);
aPrims->AddVertex(PointMax);
if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length()))
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length()))
outside = Standard_True;
gp_Dir arrdir = L3.Direction().Reversed();
if (outside)

View File

@ -35,7 +35,7 @@
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Prs3d_PointAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <TCollection_AsciiString.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
@ -53,7 +53,7 @@ void DsgPrs_PerpenPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
const Standard_Boolean intOut1,
const Standard_Boolean intOut2)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
LA->LineAspect()->SetTypeOfLine(Aspect_TOL_SOLID); // ou DOT ou DOTDASH
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());

View File

@ -31,7 +31,7 @@
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Text.hxx>
#include <Graphic3d_Vertex.hxx>
@ -79,7 +79,7 @@ void DsgPrs_RadiusPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
fpara -= 2.*M_PI;
lpara -= 2.*M_PI;
}
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Standard_Real parat = ElCLib::Parameter(aCircle,AttachmentPoint);
@ -131,7 +131,7 @@ void DsgPrs_RadiusPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
arrdir.Reverse();
// fleche
Prs3d_Arrow::Draw(aPresentation,ptoncirc,arrdir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,ptoncirc,arrdir,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
// texte
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,attpoint);
@ -153,7 +153,7 @@ void DsgPrs_RadiusPresentation::Add( const Handle(Prs3d_Presentation)& aPresenta
const Standard_Boolean drawFromCenter,
const Standard_Boolean reverseArrow)
{
Handle( Prs3d_LengthAspect ) LA = aDrawer->LengthAspect();
Handle( Prs3d_DimensionAspect ) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup( aPresentation )->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
gp_Pnt LineOrigin, LineEnd;

View File

@ -23,7 +23,7 @@
#include <DsgPrs_SymbPresentation.ixx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Prs3d_PointAspect.hxx>
#include <Geom_CartesianPoint.hxx>
@ -37,7 +37,7 @@ void DsgPrs_SymbPresentation::Add (const Handle(Prs3d_Presentation)& aPresentati
const TCollection_ExtendedString& aText,
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Handle(Prs3d_TextAspect) TA = LA->TextAspect();
TA->SetColor(Quantity_NOC_GREEN);
Prs3d_Text::Draw(aPresentation,TA,aText, OffsetPoint);

View File

@ -50,7 +50,7 @@
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <TCollection_AsciiString.hxx>
@ -73,7 +73,7 @@ void DsgPrs_SymmetricPresentation::Add (const Handle(Prs3d_Presentation)& aPrese
const gp_Lin& aAxis,
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Pnt ProjOffsetPoint = ElCLib::Value(ElCLib::Parameter(aAxis,OffsetPoint),aAxis);
@ -344,14 +344,14 @@ void DsgPrs_SymmetricPresentation::Add (const Handle(Prs3d_Presentation)& aPrese
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length())) outside = Standard_True;
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length())) outside = Standard_True;
gp_Dir arrdir = L3.Direction().Reversed();
if (outside) arrdir.Reverse();
// arrow 1 ----
Prs3d_Arrow::Draw(aPresentation,P1,arrdir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,P1,arrdir,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
// arrow 2 ----
Prs3d_Arrow::Draw(aPresentation,P2,arrdir.Reversed(),LA->Arrow2Aspect()->Angle(),LA->Arrow2Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,P2,arrdir.Reversed(),LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
//-------------------------------------------------------------------------------------
//| SYMBOL OF SYMMETRY |
@ -456,7 +456,7 @@ void DsgPrs_SymmetricPresentation::Add (const Handle(Prs3d_Presentation)& aPrese
const gp_Lin& aAxis,
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Pnt OffsetPnt(OffsetPoint.X(),OffsetPoint.Y(),OffsetPoint.Z());
@ -591,14 +591,14 @@ void DsgPrs_SymmetricPresentation::Add (const Handle(Prs3d_Presentation)& aPrese
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length())) outside = Standard_True;
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length())) outside = Standard_True;
gp_Dir arrdir = L3.Direction().Reversed();
if (outside) arrdir.Reverse();
// arrow 1 ----
Prs3d_Arrow::Draw(aPresentation,P1,arrdir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,P1,arrdir,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
// arrow 2 ----
Prs3d_Arrow::Draw(aPresentation,P2,arrdir.Reversed(),LA->Arrow2Aspect()->Angle(),LA->Arrow2Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,P2,arrdir.Reversed(),LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
//-------------------------------------------------------------------------------------
//| SYMBOL OF SYMMETRY |
@ -694,7 +694,7 @@ void DsgPrs_SymmetricPresentation::Add (const Handle(Prs3d_Presentation)& aPrese
const gp_Lin& aAxis,
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
if (AttachmentPoint1.IsEqual(AttachmentPoint2,Precision::Confusion()))
@ -810,14 +810,14 @@ void DsgPrs_SymmetricPresentation::Add (const Handle(Prs3d_Presentation)& aPrese
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
//==== ARROWS ================
if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length())) outside = Standard_True;
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length())) outside = Standard_True;
gp_Dir arrdir = L3.Direction().Reversed();
if (outside) arrdir.Reverse();
// arrow 1 ----
Prs3d_Arrow::Draw(aPresentation,P1,arrdir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,P1,arrdir,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
// arrow 2 ----
Prs3d_Arrow::Draw(aPresentation,P2,arrdir.Reversed(),LA->Arrow2Aspect()->Angle(),LA->Arrow2Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,P2,arrdir.Reversed(),LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
//==== POINTS ================
//Marker of localization of attachment points:

View File

@ -25,7 +25,7 @@
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Prs3d_PointAspect.hxx>
#include <Geom_CartesianPoint.hxx>
@ -46,10 +46,10 @@ void DsgPrs_TangentPresentation::Add (const Handle(Prs3d_Presentation)& aPresent
gp_Pnt p2 = OffsetPoint.Translated(vec2);
// Aspect
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
LA->LineAspect()->SetTypeOfLine(Aspect_TOL_SOLID);
Handle(Prs3d_ArrowAspect) ARR1 = LA->Arrow1Aspect();
Handle(Prs3d_ArrowAspect) ARR2 = LA->Arrow2Aspect();
Handle(Prs3d_ArrowAspect) ARR1 = LA->ArrowAspect();
Handle(Prs3d_ArrowAspect) ARR2 = LA->ArrowAspect();
ARR1->SetLength(length/5);
ARR2->SetLength(length/5);
@ -64,10 +64,10 @@ void DsgPrs_TangentPresentation::Add (const Handle(Prs3d_Presentation)& aPresent
// fleche 1 :
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Prs3d_Arrow::Draw(aPresentation,p1,aDirection,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,p1,aDirection,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
// fleche 2
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Prs3d_Arrow::Draw(aPresentation,p2,aDirection.Reversed(),LA->Arrow2Aspect()->Angle(),LA->Arrow2Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,p2,aDirection.Reversed(),LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
}

View File

@ -138,6 +138,7 @@ is
-- TODT_SUBTITLE There is a subtitle under the text.
-- TODT_DEKALE The text is displayed with a 3D style.
-- TODT_BLEND The text is displayed in XOR.
-- TODT_DIMENSION Dimension line under text will be invisible.
---Category: Methods to modify the class definition
SetColorSubTitle ( me : mutable;

View File

@ -451,6 +451,12 @@ is
is deferred;
---Purpose:
SetStencilTestOptions ( me : mutable;
theCGroup : CGroup from Graphic3d;
theIsEnabled: Boolean from Standard)
is deferred;
---Purpose: sets the stencil test to theIsEnabled state;
----------------------------------------
-- Category: Methods to create Text
-- for Purpose : see Graphic3d_Group.cdl

View File

@ -369,6 +369,10 @@ class Group from Graphic3d inherits TShared
-- Warning: Raises GroupDefinitionError if ...
raises GroupDefinitionError from Graphic3d is static;
SetStencilTestOptions (me : mutable;
theIsEnabled: Boolean from Standard);
---Purpose: sets the stencil test to theIsEnabled state;
----------------------------
-- Category: Inquire methods
----------------------------

View File

@ -82,3 +82,8 @@ void Graphic3d_Group :: UserDraw ( const Standard_Address AnObject,
Update ();
}
void Graphic3d_Group::SetStencilTestOptions (const Standard_Boolean theIsEnabled)
{
MyGraphicDriver->SetStencilTestOptions (MyCGroup, theIsEnabled);
}

View File

@ -122,6 +122,8 @@ OpenGl_CappingPlaneResource.hxx
OpenGl_CappingPlaneResource.cxx
OpenGl_Clipping.hxx
OpenGl_Clipping.cxx
OpenGl_StencilTest.hxx
OpenGl_StencilTest.cxx
OpenGl_ShaderObject.hxx
OpenGl_ShaderObject.cxx
OpenGl_ShaderProgram.hxx
@ -140,4 +142,4 @@ OpenGl_SceneGeometry.hxx
OpenGl_SceneGeometry.cxx
OpenGl_RaytraceTypes.hxx
OpenGl_RaytraceSource.cxx
OpenGl_Workspace_Raytrace.cxx
OpenGl_Workspace_Raytrace.cxx

View File

@ -29,6 +29,7 @@
#include <OpenGl_Group.hxx>
#include <OpenGl_CView.hxx>
#include <OpenGl_View.hxx>
#include <OpenGl_StencilTest.hxx>
#include <OpenGl_Text.hxx>
#include <OpenGl_Trihedron.hxx>
#include <OpenGl_Workspace.hxx>
@ -330,6 +331,14 @@ Standard_Boolean OpenGl_GraphicDriver::Print (const Graphic3d_CView& theCView,
return isPrinted;
}
void OpenGl_GraphicDriver::SetStencilTestOptions (const Graphic3d_CGroup& theCGroup,
const Standard_Boolean theIsEnabled)
{
OpenGl_StencilTest* aStencilTest = new OpenGl_StencilTest();
aStencilTest->SetOptions (theIsEnabled);
((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (TelNil, aStencilTest);
}
// =======================================================================
// function : Text
// purpose :

View File

@ -158,6 +158,7 @@ public:
Standard_EXPORT void ViewMapping (const Graphic3d_CView& ACView, const Standard_Boolean AWait);
Standard_EXPORT void ViewOrientation (const Graphic3d_CView& ACView,const Standard_Boolean AWait);
Standard_EXPORT void Environment (const Graphic3d_CView& ACView);
Standard_EXPORT void SetStencilTestOptions (const Graphic3d_CGroup& theCGroup, const Standard_Boolean theIsEnabled);
Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Quantity_PlaneAngle AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True);
Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean EvalMinMax = Standard_True);
Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const TCollection_ExtendedString& AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Quantity_PlaneAngle AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True);

View File

@ -0,0 +1,70 @@
// Created on: 2013-09-26
// Created by: Dmitry BOBYLEV
// 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 <OpenGl_GlCore11.hxx>
#include <OpenGl_StencilTest.hxx>
OpenGl_StencilTest::OpenGl_StencilTest()
{
//
}
// =======================================================================
// function : Render
// purpose :
// =======================================================================
void OpenGl_StencilTest::Render (const Handle(OpenGl_Workspace)&) const
{
if (myIsEnabled)
{
glEnable (GL_STENCIL_TEST);
glStencilFunc (GL_NOTEQUAL, 1, 0xFF);
}
else
{
glDisable (GL_STENCIL_TEST);
}
}
// =======================================================================
// function : Release
// purpose :
// =======================================================================
void OpenGl_StencilTest::Release (const Handle(OpenGl_Context)&)
{
//
}
// =======================================================================
// function : SetStencilTestState
// purpose :
// =======================================================================
void OpenGl_StencilTest::SetOptions (const Standard_Boolean theIsEnabled)
{
myIsEnabled = theIsEnabled;
}
// =======================================================================
// function : ~OpenGl_StencilTest
// purpose :
// =======================================================================
OpenGl_StencilTest::~OpenGl_StencilTest()
{
//
}

View File

@ -1,7 +1,6 @@
// Created on: 1997-03-03
// Created by: Jean-Pierre COMBE
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
// Created on: 2013-09-26
// Created by: Dmitry BOBYLEV
// 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
@ -18,21 +17,36 @@
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef OpenGl_StencilTest_Header
#define OpenGl_StencilTest_Header
//=======================================================================
//function : SetShape
//purpose :
//=======================================================================
inline void AIS_DimensionOwner::SetShape(const TopoDS_Shape& aShape)
#include <OpenGl_Element.hxx>
class OpenGl_StencilTest : public OpenGl_Element
{
myFixedShape = aShape;
}
//=======================================================================
//function : FixedShape
//purpose :
//=======================================================================
inline const TopoDS_Shape& AIS_DimensionOwner::FixedShape() const
{
return myFixedShape;
}
public:
//! Default constructor
OpenGl_StencilTest ();
//! Render primitives to the window
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
virtual void Release (const Handle(OpenGl_Context)& theContext);
void SetOptions (const Standard_Boolean theIsEnabled);
protected:
//! Destructor
virtual ~OpenGl_StencilTest();
private:
Standard_Boolean myIsEnabled;
public:
DEFINE_STANDARD_ALLOC
};
#endif //OpenGl_StencilOptions_Header

View File

@ -783,6 +783,35 @@ void OpenGl_Text::render (const Handle(OpenGl_PrinterContext)& thePrintCtx,
drawText (thePrintCtx, theCtx, theTextAspect);
break;
}
case Aspect_TODT_DIMENSION:
{
setupMatrix (thePrintCtx, theCtx, theTextAspect, OpenGl_Vec3 (0.0f, 0.0f, 0.00001f));
glDisable (GL_DEPTH_TEST);
glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glClear (GL_STENCIL_BUFFER_BIT);
glEnable (GL_STENCIL_TEST);
glStencilFunc (GL_ALWAYS, 1, 0x00);
glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE);
glBegin (GL_QUADS);
glVertex2f (myBndBox.Left, myBndBox.Top);
glVertex2f (myBndBox.Right, myBndBox.Top);
glVertex2f (myBndBox.Right, myBndBox.Bottom);
glVertex2f (myBndBox.Left, myBndBox.Bottom);
glEnd();
glStencilFunc (GL_ALWAYS, 0, 0xFF);
glDisable (GL_STENCIL_TEST);
if (!myIs2d)
{
glEnable (GL_DEPTH_TEST);
}
glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
break;
}
case Aspect_TODT_NORMAL:
{
break;

View File

@ -416,7 +416,7 @@ OpenGl_Window::OpenGl_Window (const Handle(OpenGl_Display)& theDisplay,
if (glXGetConfig (aDisp, aVis, GLX_STENCIL_SIZE, &aStencilSize) != 0)
aStencilSize = 0;
if (!isGl || !aDepthSize || !isRGBA || (isDoubleBuffer ? 1 : 0) != (myDisplay->DBuffer()? 1 : 0))
if (!isGl || !aDepthSize || !aStencilSize || !isRGBA || (isDoubleBuffer ? 1 : 0) != (myDisplay->DBuffer()? 1 : 0))
{
XFree (aVis);
aVis = NULL;

Some files were not shown because too many files have changed in this diff Show More