1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
nds
77242088bc 0031494: Mesh - Dump improvement for BRepMesh classes 2020-04-11 11:28:46 +03:00
925 changed files with 13965 additions and 16340 deletions

View File

@@ -3,7 +3,6 @@ StdResource
SHMessage
Textures
Shaders
XRResources
XSMessage
XSTEPResource
XmlOcafResource

View File

@@ -222,7 +222,6 @@ n Xw
n Cocoa
r Textures
r Shaders
r XRResources
t TKMeshVS
t TKOpenGl
t TKD3DHost

View File

@@ -187,9 +187,6 @@ proc wokdep:gui:UpdateList {} {
if { "$::HAVE_FFMPEG" == "true" } {
wokdep:SearchFFmpeg anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
}
if { "$::HAVE_OPENVR" == "true" } {
wokdep:SearchOpenVR anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
}
if { "$::HAVE_TBB" == "true" } {
wokdep:SearchTBB anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
}
@@ -475,8 +472,6 @@ checkbutton .myFrame.myChecks.myFImageCheck -offvalue "false" -onvalue "true
ttk::label .myFrame.myChecks.myFImageLbl -text "Use FreeImage"
checkbutton .myFrame.myChecks.myTbbCheck -offvalue "false" -onvalue "true" -variable HAVE_TBB -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myTbbLbl -text "Use Intel TBB"
checkbutton .myFrame.myChecks.myOpenVrCheck -offvalue "false" -onvalue "true" -variable HAVE_OPENVR -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myOpenVrLbl -text "Use OpenVR"
if { "$::tcl_platform(os)" != "Darwin" } {
checkbutton .myFrame.myChecks.myGlesCheck -offvalue "false" -onvalue "true" -variable HAVE_GLES2 -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myGlesLbl -text "Use OpenGL ES"
@@ -640,8 +635,6 @@ grid .myFrame.myChecks.myJDKLbl -row $aCheckRowIter -column 13 -sticky w
incr aCheckRowIter
grid .myFrame.myChecks.myRapidJsonCheck -row $aCheckRowIter -column 0 -sticky e
grid .myFrame.myChecks.myRapidJsonLbl -row $aCheckRowIter -column 1 -sticky w
grid .myFrame.myChecks.myOpenVrCheck -row $aCheckRowIter -column 4 -sticky e
grid .myFrame.myChecks.myOpenVrLbl -row $aCheckRowIter -column 5 -sticky w
grid .myFrame.myChecks.myE57Check -row $aCheckRowIter -column 6 -sticky e
grid .myFrame.myChecks.myE57Lbl -row $aCheckRowIter -column 7 -sticky w

View File

@@ -68,7 +68,7 @@ if { [info exists ::env(SHORTCUT_HEADERS)] } {
}
# fetch environment variables (e.g. set by custom.sh or custom.bat) and set them as tcl variables with the same name
set THE_ENV_VARIABLES {HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_ZLIB HAVE_LIBLZMA HAVE_E57 HAVE_RAPIDJSON HAVE_OPENVR HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo BUILD_Inspector}
set THE_ENV_VARIABLES {HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_ZLIB HAVE_LIBLZMA HAVE_E57 HAVE_RAPIDJSON HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo BUILD_Inspector}
foreach anEnvIter $THE_ENV_VARIABLES {
set ${anEnvIter} "false"
if { [info exists ::env(${anEnvIter})] } {
@@ -625,59 +625,6 @@ proc wokdep:SearchFFmpeg {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBi
return "$isFound"
}
# Search OpenVR SDK placement
proc wokdep:SearchOpenVR {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
upvar $theErrInc anErrInc
upvar $theErrLib32 anErrLib32
upvar $theErrLib64 anErrLib64
upvar $theErrBin32 anErrBin32
upvar $theErrBin64 anErrBin64
set isFound "true"
set anOpenVrHPath [wokdep:SearchHeader "openvr.h"]
if { "$anOpenVrHPath" == "" } {
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{openvr}*] "$::VCVER" "$::ARCH" ]
if { "$aPath" != "" && [file exists "$aPath/include/openvr.h"] } {
lappend ::CSF_OPT_INC "$aPath/include"
} elseif { "$aPath" != "" && [file exists "$aPath/headers/openvr.h"] } {
lappend ::CSF_OPT_INC "$aPath/headers"
} else {
lappend anErrInc "Error: 'openvr.h' not found (OpenVR)"
set isFound "false"
}
}
set aPlatform "unknown"
if { "$::tcl_platform(platform)" == "windows" } {
set aPlatform "win"
} elseif { "$::tcl_platform(os)" == "Darwin" } {
set aPlatform "osx"
} elseif { "$::tcl_platform(os)" == "Linux" } {
set aPlatform "linux"
}
foreach anArchIter {64 32} {
set anOpenVrLibPath [wokdep:SearchLib "openvr_api" "$anArchIter"]
if { "$anOpenVrLibPath" == "" } {
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{openvr}*] "$::VCVER" "$anArchIter" ]
set anOpenVrLibPath [wokdep:SearchLib "openvr_api" "$anArchIter" "$aPath/lib/${aPlatform}${anArchIter}"]
set anOpenVrLibPath2 [wokdep:SearchLib "openvr_api" "$anArchIter" "$aPath/lib"]
if { "$anOpenVrLibPath" != "" } {
lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/${aPlatform}${anArchIter}"
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/${aPlatform}${anArchIter}"
} elseif { "$anOpenVrLibPath2" != "" } {
lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
} else {
lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}openvr_api.${::SYS_LIB_SUFFIX}' not found (OpenVR)"
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
}
}
}
return "$isFound"
}
# Search TBB library placement
proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
upvar $theErrInc anErrInc

View File

@@ -1440,9 +1440,6 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
if { "$::HAVE_LIBLZMA" == "true" } {
set aLibsMap(CSF_LIBLZMA) "liblzma"
}
if { "$::HAVE_OPENVR" == "true" } {
set aLibsMap(CSF_OpenVR) "openvr_api"
}
if { "$::HAVE_E57" == "true" && "$theOS" != "wnt" } {
# exclude wnt, as there are different pragma lib depending on debug/release
set aLibsMap(CSF_E57) "E57RefImpl"

View File

@@ -25,7 +25,6 @@ set "HAVE_D3D=false"
set "HAVE_ZLIB=false"
set "HAVE_LIBLZMA=false"
set "HAVE_RAPIDJSON=false"
set "HAVE_OPENVR=false"
set "HAVE_E57=false"
set "CSF_OPT_INC="
set "CSF_OPT_LIB32="
@@ -190,7 +189,6 @@ if ["%HAVE_D3D%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DH
if ["%HAVE_ZLIB%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_ZLIB" & set "CSF_DEFINES=HAVE_ZLIB;%CSF_DEFINES%"
if ["%HAVE_LIBLZMA%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_LIBLZMA" & set "CSF_DEFINES=HAVE_LIBLZMA;%CSF_DEFINES%"
if ["%HAVE_RAPIDJSON%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_RAPIDJSON" & set "CSF_DEFINES=HAVE_RAPIDJSON;%CSF_DEFINES%"
if ["%HAVE_OPENVR%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_OPENVR" & set "CSF_DEFINES=HAVE_OPENVR;%CSF_DEFINES%"
if ["%HAVE_E57%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_E57" & set "CSF_DEFINES=HAVE_E57;%CSF_DEFINES%"
rem Eliminate VS warning

View File

@@ -16,7 +16,6 @@ export HAVE_GLES2="false";
export HAVE_ZLIB="false";
export HAVE_LIBLZMA="false";
export HAVE_RAPIDJSON="false";
export HAVE_OPENVR="false";
export HAVE_E57="false";
export MACOSX_USE_GLX="false";
export CSF_OPT_INC=""
@@ -107,7 +106,6 @@ if [ "$HAVE_VTK" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -D
if [ "$HAVE_ZLIB" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_ZLIB"; fi
if [ "$HAVE_LIBLZMA" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_LIBLZMA"; fi
if [ "$HAVE_RAPIDJSON" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_RAPIDJSON"; fi
if [ "$HAVE_OPENVR" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_OPENVR"; fi
if [ "$HAVE_E57" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_E57"; fi
# Option to compile OCCT with X11 libs on Mac OS X
if [ "$MACOSX_USE_GLX" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DMACOSX_USE_GLX"; fi

View File

@@ -1934,48 +1934,3 @@ void BOPTools_AlgoTools::TreatCompound (const TopoDS_Shape& theS,
Offset direction, which used in class Adaptor2d_OffsetCurve for evaluating values and derivatives of offset curve is unified for offset direction used in class Geom2d_OffsetCurve: now offset direction points to outer ("right") side of base curve instead of the previously used inner ("left") side. Old usage of class in any application should be changed something like that:
Adaptor2d_OffsetCurve aOC(BaseCurve, Offset) --> Adaptor2d_OffsetCurve aOC(BaseCurve, -Offset)
@subsection upgrade_750_message_messenger Message_Messenger interface change
Operators << with left argument *Handle(Message_Messenger)*, used to output messages with
a stream-like interface, have been removed.
This functionality is provided now by separate class *Message_Messenger::StreamBuffer*.
That class contains a stringstream buffer which can be filled using standard stream
operators. The string is sent to a messenger on destruction of the buffer object,
call of its method Flush(), or using operator << with one of ostream manipulators
(*std::endl, std::flush, std::ends*). Manipulator *Message_EndLine* has been removed,
*std::endl* should be used instead.
New methods *SendFail(), SendAlarm(), SendWarning(), SendInfo()*, and *SendTrace()* are
provided in both *Message_Messenger* class and as static functions in *Message* package
(short-cuts to default messenger), returning buffer object for the output of
corresponding type of the message.
The code that used operator << for messenger, should be ported as follows.
Before the change:
~~~~~
Handle(Message_Messenger) theMessenger = ...;
theMessenger << "Value = " << anInteger << Message_EndLine;
~~~~~
After the change, single-line variant:
~~~~~
Handle(Message_Messenger) theMessenger = ...;
theMessenger->SendInfo() << "Value = " << anInteger << std::endl;
~~~~~
After the change, extended variant:
~~~~~
Handle(Message_Messenger) theMessenger = ...;
Message_Messenger::StreamBuffer aSender = theMessenger->SendInfo();
aSender << "Array: [ ";
for (int i = 0; i < aNb; ++i) { aSender << anArray[i] << " "; }
aSender << "]" << std::endl; // aSender can be used further for other messages
~~~~~
@subsection upgrade_750_message_printer Message_Printer interface change
Previously, sub-classes of *Message_Printer* have to provide a triplet of *Message_Printer::Send()* methods accepting different string representations: TCollection_AsciiString, TCollection_ExtendedString and Standard_CString.
*Message_Printer* interface has been changed, so that sub-classes now have to implement only single method *Message_Printer::send()* accepting TCollection_AsciiString argument and having no Endl flag, which has been removed.
Old three Message_Printer::Send() methods remain defined virtual with unused last argument and redirecting to new send() method by default.

View File

@@ -48,11 +48,27 @@ OcctJni_MsgPrinter::~OcctJni_MsgPrinter()
}
// =======================================================================
// function : send
// function : Send
// purpose :
// =======================================================================
void OcctJni_MsgPrinter::send (const TCollection_AsciiString& theString,
const Message_Gravity theGravity) const
void OcctJni_MsgPrinter::Send (const TCollection_ExtendedString& theString,
const Message_Gravity theGravity,
const Standard_Boolean theToPutEndl) const
{
if (theGravity >= myTraceLevel)
{
const TCollection_AsciiString aStr (theString);
OcctJni_MsgPrinter::Send (aStr, theGravity, theToPutEndl);
}
}
// =======================================================================
// function : Send
// purpose :
// =======================================================================
void OcctJni_MsgPrinter::Send (const TCollection_AsciiString& theString,
const Message_Gravity theGravity,
const Standard_Boolean theToPutEndl) const
{
if (theGravity < myTraceLevel)
{
@@ -69,3 +85,17 @@ void OcctJni_MsgPrinter::send (const TCollection_AsciiString& theString,
myJEnv->CallObjectMethod (myJObj, myJMet, aJStr);
myJEnv->DeleteLocalRef (aJStr);
}
// =======================================================================
// function : Send
// purpose :
// =======================================================================
void OcctJni_MsgPrinter::Send (const Standard_CString& theString,
const Message_Gravity theGravity,
const Standard_Boolean theToPutEndl) const
{
if (theGravity >= myTraceLevel)
{
OcctJni_MsgPrinter::Send (TCollection_AsciiString (theString), theGravity, theToPutEndl);
}
}

View File

@@ -30,11 +30,20 @@ public:
//! Destructor.
~OcctJni_MsgPrinter();
protected:
//! Redirection to TCollection_AsciiString method
virtual void Send (const TCollection_ExtendedString& theString,
const Message_Gravity theGravity,
const Standard_Boolean theToPutEndl) const;
//! Redirection to TCollection_AsciiString method
virtual void Send (const Standard_CString& theString,
const Message_Gravity theGravity,
const Standard_Boolean theToPutEndl) const;
//! Main printing method
virtual void send (const TCollection_AsciiString& theString,
const Message_Gravity theGravity) const;
virtual void Send (const TCollection_AsciiString& theString,
const Message_Gravity theGravity,
const Standard_Boolean theToPutEndl) const;
private:

View File

@@ -11,9 +11,17 @@
/////////////////////////////////////////////////////////////////////////////
// CNSGView
IMPLEMENT_DYNCREATE(CGeometryView2D, OCC_2dView)
IMPLEMENT_DYNCREATE(CGeometryView2D, CView)
BEGIN_MESSAGE_MAP(CGeometryView2D, OCC_2dView)
//{{AFX_MSG_MAP(CGeometryView2D)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MBUTTONDOWN()
ON_WM_MBUTTONUP()
ON_WM_RBUTTONDOWN()
ON_WM_RBUTTONUP()
ON_WM_MOUSEMOVE()
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -28,9 +36,15 @@ CGeometryView2D::~CGeometryView2D()
{
}
const Handle(AIS_InteractiveContext)& CGeometryView2D::GetAISContext() const
// CNSGView drawing
void CGeometryView2D::OnDraw(CDC* /*pDC*/)
{
return ((CGeometryDoc*)m_pDocument)->GetISessionContext();
CGeometryDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!myV2dView.IsNull())
myV2dView->Update();
}
/////////////////////////////////////////////////////////////////////////////
@@ -57,9 +71,239 @@ CGeometryDoc* CGeometryView2D::GetDocument() // non-debug version is inline
/////////////////////////////////////////////////////////////////////////////
// CNSGView message handlers
//=================================================================
void CGeometryView2D::OnLButtonDown(UINT nFlags, CPoint point)
{
// save the current mouse coordinate in min
myXmin=point.x; myYmin=point.y;
myXmax=point.x; myYmax=point.y;
if ( nFlags & MK_CONTROL )
{
// Button MB1 down Control :start zomming
// SetCursor(AfxGetApp()->LoadStandardCursor());
}
else // if ( Ctrl )
{
switch (myCurrentMode)
{
case CurAction2d_Nothing : // start a drag
GetDocument()->DragEvent2D(point.x,point.y,-1,myV2dView);
break;
case CurAction2d_DynamicZooming : // noting
break;
case CurAction2d_WindowZooming :
break;
case CurAction2d_DynamicPanning :// noting
break;
case CurAction2d_GlobalPanning :// noting
break;
default :
throw Standard_Failure(" incompatible Current Mode ");
break;
}
}
}
void CGeometryView2D::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if ( nFlags & MK_CONTROL )
{
return;
}
else // if ( Ctrl )
{
const Handle(AIS_InteractiveContext)& aContext = GetDocument()->GetISessionContext();
switch (myCurrentMode)
{
case CurAction2d_Nothing :
if (point.x == myXmin && point.y == myYmin)
{ // no offset between down and up --> selectEvent
myXmax=point.x;
myYmax=point.y;
if (nFlags & MK_SHIFT )
GetDocument()->ShiftInputEvent2D(point.x,point.y,myV2dView);
else
GetDocument()->InputEvent2D (point.x,point.y,myV2dView);
} else
{
drawRectangle (myXmin,myYmin,myXmax,myYmax,aContext,Standard_False);
myXmax=point.x;
myYmax=point.y;
if (nFlags & MK_SHIFT)
GetDocument()->ShiftDragEvent2D(point.x,point.y,1,myV2dView);
else
GetDocument()->DragEvent2D(point.x,point.y,1,myV2dView);
}
break;
case CurAction2d_DynamicZooming :
// SetCursor(AfxGetApp()->LoadStandardCursor());
myCurrentMode = CurAction2d_Nothing;
break;
case CurAction2d_WindowZooming :
myXmax=point.x; myYmax=point.y;
drawRectangle (myXmin,myYmin,myXmax,myYmax,aContext,Standard_False);
if ((abs(myXmin-myXmax)>ValZWMin) || (abs(myYmin-myYmax)>ValZWMin))
// Test if the zoom window is greater than a minimale window.
{
// Do the zoom window between Pmin and Pmax
myV2dView->WindowFit(myXmin,myYmin,myXmax,myYmax);
}
myCurrentMode = CurAction2d_Nothing;
break;
case CurAction2d_DynamicPanning :
myCurrentMode = CurAction2d_Nothing;
break;
case CurAction2d_GlobalPanning :
myV2dView->Place(point.x,point.y,myCurZoom);
myCurrentMode = CurAction2d_Nothing;
break;
default :
throw Standard_Failure(" incompatible Current Mode ");
break;
} //switch (myCurrentMode)
} // else // if ( Ctrl )
}
void CGeometryView2D::OnMButtonDown(UINT nFlags, CPoint /*point*/)
{
if ( nFlags & MK_CONTROL )
{
// Button MB2 down Control : panning init
// SetCursor(AfxGetApp()->LoadStandardCursor());
}
}
void CGeometryView2D::OnMButtonUp(UINT nFlags, CPoint /*point*/)
{
if ( nFlags & MK_CONTROL )
{
// Button MB2 up Control : panning stop
// SetCursor(AfxGetApp()->LoadStandardCursor());
}
}
void CGeometryView2D::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if ( nFlags & MK_CONTROL )
{
// SetCursor(AfxGetApp()->LoadStandardCursor());
}
else // if ( Ctrl )
{
GetDocument()->Popup2D(point.x,point.y,myV2dView);
}
}
void CGeometryView2D::OnRButtonUp(UINT /*nFlags*/, CPoint point)
{
OCC_2dView::Popup2D(point.x,point.y);
}
void CGeometryView2D::OnMouseMove(UINT nFlags, CPoint point)
{
// ============================ LEFT BUTTON =======================
if ( nFlags & MK_LBUTTON)
{
if ( nFlags & MK_CONTROL )
{
// move with MB1 and Control : on the dynamic zooming
// Do the zoom in function of mouse's coordinates
myV2dView->Zoom(myXmax,myYmax,point.x,point.y);
// save the current mouse coordinate in min
myXmax = point.x;
myYmax = point.y;
}
else // if ( Ctrl )
{
const Handle(AIS_InteractiveContext)& aContext = GetDocument()->GetISessionContext();
switch (myCurrentMode)
{
case CurAction2d_Nothing :
myXmax = point.x;
myYmax = point.y;
GetDocument()->DragEvent2D(myXmax,myYmax,0,myV2dView);
drawRectangle (myXmin,myYmin,myXmax,myYmax, aContext);
break;
case CurAction2d_DynamicZooming :
myV2dView->Zoom(myXmax,myYmax,point.x,point.y);
// save the current mouse coordinate in min \n";
myXmax=point.x; myYmax=point.y;
break;
case CurAction2d_WindowZooming :
myXmax = point.x; myYmax = point.y;
drawRectangle (myXmin,myYmin,myXmax,myYmax, aContext);
break;
case CurAction2d_DynamicPanning :
myV2dView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning
myXmax = point.x; myYmax = point.y;
break;
case CurAction2d_GlobalPanning : // nothing
break;
default :
throw Standard_Failure(" incompatible Current Mode ");
break;
}// switch (myCurrentMode)
}// if ( nFlags & MK_CONTROL ) else
} else // if ( nFlags & MK_LBUTTON)
// ============================ MIDDLE BUTTON =======================
if ( nFlags & MK_MBUTTON)
{
if ( nFlags & MK_CONTROL )
{
myV2dView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning
myXmax = point.x; myYmax = point.y;
}
} else // if ( nFlags & MK_MBUTTON)
// ============================ RIGHT BUTTON =======================
if ( nFlags & MK_RBUTTON)
{
}else //if ( nFlags & MK_RBUTTON)
// ============================ NO BUTTON =======================
{ // No buttons
myXmax = point.x; myYmax = point.y;
if (nFlags & MK_SHIFT)
GetDocument()->ShiftMoveEvent2D(point.x,point.y,myV2dView);
else
GetDocument()->MoveEvent2D(point.x,point.y,myV2dView);
}
}
void CGeometryView2D::OnSize(UINT nType, int cx, int cy)
{
OCC_2dView::OnSize (nType, cx, cy);
if (!myV2dView.IsNull())
{
myV2dView->MustBeResized(); // added sro
}
}
void CGeometryView2D::OnInitialUpdate()
{
OCC_2dView::OnInitialUpdate();
myView->SetBackgroundColor (Quantity_NOC_BLACK);
Handle(WNT_Window) aWNTWindow;
aWNTWindow = new WNT_Window(GetSafeHwnd());
myV2dView = GetDocument()->GetViewer2D()->CreateView();
myV2dView->SetWindow(aWNTWindow);
myV2dView->SetBackgroundColor(Quantity_NOC_BLACK);
// initialyse the grids dialogs
TheRectangularGridDialog.Create(CRectangularGrid::IDD, NULL);
TheCircularGridDialog.Create(CCircularGrid::IDD, NULL);
TheRectangularGridDialog.SetViewer (GetDocument()->GetViewer2D());
TheCircularGridDialog.SetViewer (GetDocument()->GetViewer2D());
Standard_Integer w=100 , h=100 ; /* Debug Matrox */
aWNTWindow->Size (w,h) ; /* Keeps me unsatisfied (rlb)..... */
/* Resize is not supposed to be done on */
/* Matrox */
/* I suspect another problem elsewhere */
::PostMessage ( GetSafeHwnd () , WM_SIZE , SIZE_RESTORED , w + h*65536 ) ;
}

View File

@@ -28,6 +28,7 @@ public:
// Overrides
// ClassWizard generated virtual function overrides
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual void OnInitialUpdate(); // called first time after construct
// Implementation
@@ -38,12 +39,17 @@ public:
virtual void Dump(CDumpContext& dc) const;
#endif
//! Return interactive context for 2d presentations.
virtual const Handle(AIS_InteractiveContext)& GetAISContext() const Standard_OVERRIDE;
// Generated message map functions
protected:
//{{AFX_MSG(CGeometryView2D)
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnSize(UINT nType, int cx, int cy);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

View File

@@ -128,7 +128,7 @@ void CHLRDoc::FitAll2DViews(Standard_Boolean UpdateViewer)
if(pCurrentView->IsKindOf(RUNTIME_CLASS(OCC_2dView)) )
{
ASSERT_VALID(pCurrentView);
((OCC_2dView*)pCurrentView)->FitAll();
((OCC_2dView*)pCurrentView)->GetV2dView()->FitAll();
}
}
}

View File

@@ -8,12 +8,23 @@
#include "resource2d\RectangularGrid.h"
#include "resource2d\CircularGrid.h"
#define ValZWMin 1
#ifdef _DEBUG
//#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// the key for multi selection :
#define MULTISELECTIONKEY MK_SHIFT
// the key for shortcut ( use to activate dynamic rotation, panning )
#define CASCADESHORTCUTKEY MK_CONTROL
// define in witch case you want to display the popup
#define POPUPONBUTTONDOWN
/////////////////////////////////////////////////////////////////////////////
// CHLRView2D
@@ -21,6 +32,7 @@ IMPLEMENT_DYNCREATE(CHLRView2D, OCC_2dView)
BEGIN_MESSAGE_MAP(CHLRView2D, OCC_2dView)
//{{AFX_MSG_MAP(CHLRView2D)
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -29,26 +41,170 @@ END_MESSAGE_MAP()
CHLRView2D::CHLRView2D()
{
/// TODO
/// Override MouseMove event to exclude rectangle selection emulation as
/// no selection is supported in DragEvent2D for this view.
}
CHLRView2D::~CHLRView2D()
{
}
const Handle(AIS_InteractiveContext)& CHLRView2D::GetAISContext() const
{
return ((CHLRDoc*)m_pDocument)->GetInteractiveContext2D();
}
CHLRDoc* CHLRView2D::GetDocument() // non-debug version is inline
{
//ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(OCC_2dDoc)));
return (CHLRDoc*)m_pDocument;
}
void CHLRView2D::OnInitialUpdate()
{
Handle(WNT_Window) aWNTWindow;
aWNTWindow = new WNT_Window(GetSafeHwnd(),Quantity_NOC_GRAY);
myV2dView = GetDocument()->GetViewer2D()->CreateView();
myV2dView->SetWindow(aWNTWindow);
// initialyse the grids dialogs
TheRectangularGridDialog.Create(CRectangularGrid::IDD, NULL);
TheCircularGridDialog.Create(CCircularGrid::IDD, NULL);
TheRectangularGridDialog.SetViewer (GetDocument()->GetViewer2D());
TheCircularGridDialog.SetViewer (GetDocument()->GetViewer2D());
Standard_Integer w=100 , h=100 ; /* Debug Matrox */
aWNTWindow->Size (w,h) ; /* Keeps me unsatisfied (rlb)..... */
/* Resize is not supposed to be done on */
/* Matrox */
/* I suspect another problem elsewhere */
::PostMessage ( GetSafeHwnd () , WM_SIZE , SIZE_RESTORED , w + h*65536 ) ;
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void CHLRView2D::DragEvent2D(const Standard_Integer /*x*/,
const Standard_Integer /*y*/,
const Standard_Integer /*TheState*/)
{
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void CHLRView2D::InputEvent2D(const Standard_Integer /*x*/,
const Standard_Integer /*y*/)
{
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void CHLRView2D::MoveEvent2D(const Standard_Integer /*x*/,
const Standard_Integer /*y*/)
{
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void CHLRView2D::MultiMoveEvent2D(const Standard_Integer /*x*/,
const Standard_Integer /*y*/)
{
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void CHLRView2D::MultiDragEvent2D(const Standard_Integer /*x*/,
const Standard_Integer /*y*/,
const Standard_Integer /*TheState*/)
{
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void CHLRView2D::MultiInputEvent2D(const Standard_Integer /*x*/,
const Standard_Integer /*y*/)
{
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void CHLRView2D::OnMouseMove(UINT nFlags, CPoint point)
{
if ( (nFlags & MK_LBUTTON) &! (nFlags & MK_RBUTTON) ) // Left + Right is specific
{
if ( nFlags & CASCADESHORTCUTKEY )
{
// move with MB1 and CASCADESHORTCUTKEY : on the dynamic zooming
// Do the zoom in function of mouse's coordinates
myV2dView->Zoom(myXmax,myYmax,point.x,point.y);
myXmax = point.x;
myYmax = point.y;
}
else // if ( CASCADESHORTCUTKEY )
{
switch (myCurrentMode)
{
case CurAction2d_Nothing :
myXmax = point.x;
myYmax = point.y;
DragEvent2D(myXmax,myYmax,0);
break;
case CurAction2d_DynamicZooming :
myV2dView->Zoom(myXmax,myYmax,point.x,point.y);
myXmax=point.x;
myYmax=point.y;
break;
case CurAction2d_WindowZooming :
myXmax = point.x;
myYmax = point.y;
break;
case CurAction2d_DynamicPanning :
myV2dView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning
myXmax = point.x;
myYmax = point.y;
break;
case CurAction2d_GlobalPanning :
break;
default :
throw Standard_Failure(" incompatible Current Mode ");
break;
}
}
} else if ( nFlags & MK_MBUTTON)
{
if ( nFlags & CASCADESHORTCUTKEY )
{
myV2dView->Pan (point.x-myXmax,myYmax-point.y);
myXmax = point.x;
myYmax = point.y;
}
} else if ( (nFlags & MK_RBUTTON) &! (nFlags & MK_LBUTTON) )
{
}
else if ( (nFlags & MK_RBUTTON) && (nFlags & MK_LBUTTON) )
{
if ( nFlags & CASCADESHORTCUTKEY )
{
myV2dView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning
myXmax = point.x; myYmax = point.y;
}
}
else
{ // No buttons
myXmax = point.x;
myYmax = point.y;
if (nFlags & MULTISELECTIONKEY)
{
MultiMoveEvent2D(point.x,point.y);
}
else
{
MoveEvent2D(point.x,point.y);
}
}
}
#ifdef _DEBUG
void CHLRView2D::AssertValid() const
{

View File

@@ -20,15 +20,37 @@ class CHLRView2D : public OCC_2dView
protected: // create from serialization only
CHLRView2D();
DECLARE_DYNCREATE(CHLRView2D)
// Override MouseMove event to exclude rectangle selection emulation as
// no selection is supported in DragEvent2D for this view.
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
DECLARE_MESSAGE_MAP()
//! Return interactive context for HLR presentations.
virtual const Handle(AIS_InteractiveContext)& GetAISContext() const Standard_OVERRIDE;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CHLRView2D)
protected:
virtual void OnInitialUpdate(); // called first time after construct
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CHLRView2D();
CHLRDoc* GetDocument();
virtual void DragEvent2D (const Standard_Integer x,
const Standard_Integer y,
const Standard_Integer TheState);
virtual void InputEvent2D (const Standard_Integer x,
const Standard_Integer y);
virtual void MoveEvent2D (const Standard_Integer x,
const Standard_Integer y );
virtual void MultiMoveEvent2D (const Standard_Integer x,
const Standard_Integer y );
virtual void MultiDragEvent2D (const Standard_Integer x,
const Standard_Integer y ,
const Standard_Integer TheState);
virtual void MultiInputEvent2D (const Standard_Integer x,
const Standard_Integer y );
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;

View File

@@ -18,7 +18,8 @@ IMPLEMENT_DYNCREATE(OCC_2dDoc, CDocument)
OCC_2dDoc::OCC_2dDoc() : OCC_BaseDoc()
{
// Get the Graphic Driver from the application
Handle(Graphic3d_GraphicDriver) aGraphicDriver = ((OCC_App*)AfxGetApp())->GetGraphicDriver();
Handle(Graphic3d_GraphicDriver) aGraphicDriver =
((OCC_App*)AfxGetApp())->GetGraphicDriver();
// create the Viewer
myViewer = new V3d_Viewer (aGraphicDriver);
@@ -51,23 +52,20 @@ void OCC_2dDoc::FitAll2DViews(Standard_Boolean theUpdateViewer)
{
OCC_2dView* aCurrentView = (OCC_2dView*)GetNextView (aPosition);
ASSERT_VALID (aCurrentView);
aCurrentView->GetView()->FitAll();
aCurrentView->GetV2dView()->FitAll();
}
}
void OCC_2dDoc::Popup (const Standard_Integer theMouseX,
const Standard_Integer theMouseY,
const Handle(V3d_View)& theView)
void OCC_2dDoc::MoveEvent(const Standard_Integer theMouseX,
const Standard_Integer theMouseY,
const Handle(V3d_View)& theView)
{
// load the 'normal' popup
CMenu aMenu;
VERIFY(aMenu.LoadMenu(IDR_Popup2D));
// activate the sub menu '0'
CMenu* aPopup = aMenu.GetSubMenu(0);
ASSERT(aPopup != NULL);
// display the popup
POINT aWinCoord = { theMouseX, theMouseY };
ClientToScreen ((HWND )theView->Window()->NativeHandle(), &aWinCoord);
aPopup->TrackPopupMenu (TPM_LEFTALIGN | TPM_RIGHTBUTTON, aWinCoord.x, aWinCoord.y, AfxGetMainWnd());
myAISContext->MoveTo (theMouseX, theMouseY, theView, Standard_True);
}
void OCC_2dDoc::ShiftMoveEvent(const Standard_Integer theMouseX,
const Standard_Integer theMouseY,
const Handle(V3d_View)& theView)
{
myAISContext->MoveTo (theMouseX, theMouseY, theView, Standard_True);
}

View File

@@ -28,11 +28,23 @@ public: // New operations
void FitAll2DViews(Standard_Boolean theUpdateViewer = Standard_False);
public: // getters
Handle(V3d_Viewer) GetViewer2D () { return myViewer; };
Handle(AIS_InteractiveContext)& GetInteractiveContext() { return myAISContext; };
public: // Operations to override
virtual void Popup (const Standard_Integer theMouseX,
const Standard_Integer theMouseY,
const Handle(V3d_View)& theView) Standard_OVERRIDE;
// Mouse move event tracking for 2D view : no rotation is supported in 2D view.
virtual void MoveEvent(const Standard_Integer theMouseX,
const Standard_Integer theMouseY,
const Handle(V3d_View)& theView);
// Shift move event tracking for 2D view : no rotation is supported in 2D view.
virtual void ShiftMoveEvent(const Standard_Integer theMouseX,
const Standard_Integer theMouseY,
const Handle(V3d_View)& theViewView);
};
#endif // !defined(AFX_OCC_2dDOC_H__2E048CC7_38F9_11D7_8611_0060B0EE281E__INCLUDED_)

View File

@@ -13,35 +13,53 @@
#include "Quantity_Color.hxx"
#include "Quantity_NameOfColor.hxx"
#define ValZWMin 1
// the key for multi selection :
#define MULTISELECTIONKEY MK_SHIFT
// the key for shortcut ( use to activate dynamic rotation, panning )
#define CASCADESHORTCUTKEY MK_CONTROL
// define in witch case you want to display the popup
#define POPUPONBUTTONDOWN
/////////////////////////////////////////////////////////////////////////////
// OCC_2dView
IMPLEMENT_DYNCREATE(OCC_2dView, OCC_BaseView)
IMPLEMENT_DYNCREATE(OCC_2dView, CView)
BEGIN_MESSAGE_MAP(OCC_2dView, OCC_BaseView)
BEGIN_MESSAGE_MAP(OCC_2dView, CView)
//{{AFX_MSG_MAP(OCC_2dView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
ON_COMMAND(ID_FILE_EXPORT_IMAGE, OnFileExportImage)
ON_COMMAND(ID_BUTTON2DGridRectLines, OnBUTTONGridRectLines)
ON_COMMAND(ID_BUTTON2DGridRectPoints, OnBUTTONGridRectPoints)
ON_COMMAND(ID_BUTTON2DGridCircLines, OnBUTTONGridCircLines)
ON_COMMAND(ID_BUTTON2DGridCircPoints, OnBUTTONGridCircPoints)
ON_COMMAND(ID_BUTTON2DGridValues, OnBUTTONGridValues)
ON_UPDATE_COMMAND_UI(ID_BUTTON2DGridValues, OnUpdateBUTTONGridValues)
ON_COMMAND(ID_BUTTON2DGridCancel, OnBUTTONGridCancel)
ON_UPDATE_COMMAND_UI(ID_BUTTON2DGridCancel, OnUpdateBUTTONGridCancel)
ON_WM_SIZE()
ON_COMMAND(ID_BUTTON2DFitAll, OnBUTTONFitAll)
ON_COMMAND(ID_BUTTON2DGlobPanning, OnBUTTONGlobPanning)
ON_COMMAND(ID_BUTTON2DPanning, OnBUTTONPanning)
ON_COMMAND(ID_BUTTON2DZoomProg, OnBUTTONZoomProg)
ON_COMMAND(ID_BUTTON2DZoomWin, OnBUTTONZoomWin)
ON_UPDATE_COMMAND_UI(ID_BUTTON2DGlobPanning, OnUpdateBUTTON2DGlobPanning)
ON_UPDATE_COMMAND_UI(ID_BUTTON2DPanning, OnUpdateBUTTON2DPanning)
ON_UPDATE_COMMAND_UI(ID_BUTTON2DZoomProg, OnUpdateBUTTON2DZoomProg)
ON_UPDATE_COMMAND_UI(ID_BUTTON2DZoomWin, OnUpdateBUTTON2DZoomWin)
ON_COMMAND(ID_Modify_ChangeBackground ,OnChangeBackground)
ON_COMMAND(ID_FILE_EXPORT_IMAGE, OnFileExportImage)
ON_COMMAND(ID_BUTTON2DGridRectLines, OnBUTTONGridRectLines)
ON_COMMAND(ID_BUTTON2DGridRectPoints, OnBUTTONGridRectPoints)
ON_COMMAND(ID_BUTTON2DGridCircLines, OnBUTTONGridCircLines)
ON_COMMAND(ID_BUTTON2DGridCircPoints, OnBUTTONGridCircPoints)
ON_COMMAND(ID_BUTTON2DGridValues, OnBUTTONGridValues)
ON_UPDATE_COMMAND_UI(ID_BUTTON2DGridValues, OnUpdateBUTTONGridValues)
ON_COMMAND(ID_BUTTON2DGridCancel, OnBUTTONGridCancel)
ON_UPDATE_COMMAND_UI(ID_BUTTON2DGridCancel, OnUpdateBUTTONGridCancel)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MBUTTONDOWN()
ON_WM_MBUTTONUP()
ON_WM_RBUTTONDOWN()
ON_WM_RBUTTONUP()
ON_WM_MOUSEMOVE()
ON_WM_SIZE()
ON_COMMAND(ID_BUTTON2DFitAll, OnBUTTONFitAll)
ON_COMMAND(ID_BUTTON2DGlobPanning, OnBUTTONGlobPanning)
ON_COMMAND(ID_BUTTON2DPanning, OnBUTTONPanning)
ON_COMMAND(ID_BUTTON2DZoomProg, OnBUTTONZoomProg)
ON_COMMAND(ID_BUTTON2DZoomWin, OnBUTTONZoomWin)
ON_UPDATE_COMMAND_UI(ID_BUTTON2DGlobPanning, OnUpdateBUTTON2DGlobPanning)
ON_UPDATE_COMMAND_UI(ID_BUTTON2DPanning, OnUpdateBUTTON2DPanning)
ON_UPDATE_COMMAND_UI(ID_BUTTON2DZoomProg, OnUpdateBUTTON2DZoomProg)
ON_UPDATE_COMMAND_UI(ID_BUTTON2DZoomWin, OnUpdateBUTTON2DZoomWin)
ON_COMMAND(ID_Modify_ChangeBackground ,OnChangeBackground)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -49,34 +67,57 @@ END_MESSAGE_MAP()
// OCC_2dView construction/destruction
OCC_2dView::OCC_2dView()
: myCurrentMode (CurAction2d_Nothing)
{
myToAllowRotation = false;
myDefaultGestures.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_SelectRectangle);
myMouseGestureMap = myDefaultGestures;
}
OCC_2dView::~OCC_2dView()
{
//
myV2dView->Remove();
}
BOOL OCC_2dView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.lpszClass = ::AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC, ::LoadCursor(NULL, IDC_ARROW), NULL, NULL);
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// OCC_2dView drawing
void OCC_2dView::OnDraw(CDC* /*pDC*/)
{
if (!myV2dView.IsNull())
myV2dView->Update();
}
void OCC_2dView::OnInitialUpdate()
{
OCC_BaseView::OnInitialUpdate();
CView::OnInitialUpdate();
Handle(WNT_Window) aWNTWindow = new WNT_Window(GetSafeHwnd(),Quantity_NOC_MATRAGRAY);
myV2dView =((OCC_2dDoc*)GetDocument())->GetViewer2D()->CreateView();
myV2dView->SetWindow(aWNTWindow);
// initialize the grids dialogs
TheRectangularGridDialog.Create(CRectangularGrid::IDD, NULL);
TheCircularGridDialog.Create(CCircularGrid::IDD, NULL);
TheRectangularGridDialog.SetViewer (myView->Viewer());
TheCircularGridDialog.SetViewer (myView->Viewer());
TheRectangularGridDialog.SetViewer (((OCC_2dDoc*)GetDocument())->GetViewer2D());
TheCircularGridDialog.SetViewer (((OCC_2dDoc*)GetDocument())->GetViewer2D());
Standard_Integer w=100 , h=100 ; /* Debug Matrox */
aWNTWindow->Size (w,h) ; /* Keeps me unsatisfied (rlb)..... */
/* Resize is not supposed to be done on */
/* Matrox */
/* I suspect another problem elsewhere */
::PostMessage ( GetSafeHwnd () , WM_SIZE , SIZE_RESTORED , w + h*65536 ) ;
}
void OCC_2dView::OnFileExportImage()
{
GetDocument()->ExportView (myView);
GetDocument()->ExportView (myV2dView);
}
/////////////////////////////////////////////////////////////////////////////
@@ -101,11 +142,11 @@ OCC_2dDoc* OCC_2dView::GetDocument() // non-debug version is inline
#endif //_DEBUG
void OCC_2dView::OnBUTTONGridRectLines()
{
Handle(V3d_Viewer) aViewer = myView->Viewer();
Handle(V3d_Viewer) aViewer = myV2dView->Viewer();
Handle(Graphic3d_AspectMarker3d) aGridAspect = new Graphic3d_AspectMarker3d(Aspect_TOM_RING1,Quantity_NOC_WHITE,2);
aViewer->SetGridEcho(aGridAspect);
Standard_Integer aWidth=0, aHeight=0, anOffset=0;
myView->Window()->Size(aWidth,aHeight);
myV2dView->Window()->Size(aWidth,aHeight);
aViewer->SetRectangularGridGraphicValues(aWidth,aHeight,anOffset);
aViewer->ActivateGrid(Aspect_GT_Rectangular, Aspect_GDM_Lines);
FitAll();
@@ -120,11 +161,11 @@ void OCC_2dView::OnBUTTONGridRectLines()
void OCC_2dView::OnBUTTONGridRectPoints()
{
Handle(V3d_Viewer) aViewer = myView->Viewer();
Handle(V3d_Viewer) aViewer = myV2dView->Viewer();
Handle(Graphic3d_AspectMarker3d) aGridAspect = new Graphic3d_AspectMarker3d(Aspect_TOM_RING1,Quantity_NOC_WHITE,2);
aViewer->SetGridEcho(aGridAspect);
Standard_Integer aWidth=0, aHeight=0, anOffset=0;
myView->Window()->Size(aWidth,aHeight);
myV2dView->Window()->Size(aWidth,aHeight);
aViewer->SetRectangularGridGraphicValues(aWidth,aHeight,anOffset);
aViewer->ActivateGrid(Aspect_GT_Rectangular, Aspect_GDM_Points);
FitAll();
@@ -139,11 +180,11 @@ void OCC_2dView::OnBUTTONGridRectPoints()
void OCC_2dView::OnBUTTONGridCircLines()
{
Handle(V3d_Viewer) aViewer = myView->Viewer();
Handle(V3d_Viewer) aViewer = myV2dView->Viewer();
Handle(Graphic3d_AspectMarker3d) aGridAspect = new Graphic3d_AspectMarker3d(Aspect_TOM_RING1,Quantity_NOC_WHITE,2);
aViewer->SetGridEcho(aGridAspect);
Standard_Integer aWidth=0, aHeight=0, anOffset=0;
myView->Window()->Size(aWidth,aHeight);
myV2dView->Window()->Size(aWidth,aHeight);
aViewer->SetCircularGridGraphicValues(aWidth>aHeight?aWidth:aHeight,anOffset);
aViewer->ActivateGrid(Aspect_GT_Circular, Aspect_GDM_Lines);
FitAll();
@@ -159,11 +200,11 @@ void OCC_2dView::OnBUTTONGridCircLines()
void OCC_2dView::OnBUTTONGridCircPoints()
{
Handle(V3d_Viewer) aViewer = myView->Viewer();
Handle(V3d_Viewer) aViewer = myV2dView->Viewer();
Handle(Graphic3d_AspectMarker3d) aGridAspect = new Graphic3d_AspectMarker3d(Aspect_TOM_RING1,Quantity_NOC_WHITE,2);
aViewer->SetGridEcho(aGridAspect);
Standard_Integer aWidth=0, aHeight=0, anOffset=0;
myView->Window()->Size(aWidth,aHeight);
myV2dView->Window()->Size(aWidth,aHeight);
aViewer->SetCircularGridGraphicValues(aWidth>aHeight?aWidth:aHeight,anOffset);
aViewer->ActivateGrid(Aspect_GT_Circular, Aspect_GDM_Points);
FitAll();
@@ -177,7 +218,7 @@ void OCC_2dView::OnBUTTONGridCircPoints()
void OCC_2dView::OnBUTTONGridValues()
{
Handle(V3d_Viewer) aViewer = myView->Viewer();
Handle(V3d_Viewer) aViewer = myV2dView->Viewer();
Aspect_GridType TheGridtype = aViewer->GridType();
switch( TheGridtype )
@@ -196,13 +237,13 @@ void OCC_2dView::OnBUTTONGridValues()
}
void OCC_2dView::OnUpdateBUTTONGridValues(CCmdUI* pCmdUI)
{
Handle(V3d_Viewer) aViewer = myView->Viewer();
Handle(V3d_Viewer) aViewer = myV2dView->Viewer();
pCmdUI-> Enable( aViewer->IsActive() );
}
void OCC_2dView::OnBUTTONGridCancel()
{
Handle(V3d_Viewer) aViewer = myView->Viewer();
Handle(V3d_Viewer) aViewer = myV2dView->Viewer();
aViewer->DeactivateGrid();
TheRectangularGridDialog.ShowWindow(SW_HIDE);
TheCircularGridDialog.ShowWindow(SW_HIDE);
@@ -210,50 +251,266 @@ void OCC_2dView::OnBUTTONGridCancel()
}
void OCC_2dView::OnUpdateBUTTONGridCancel(CCmdUI* pCmdUI)
{
Handle(V3d_Viewer) aViewer = myView->Viewer();
Handle(V3d_Viewer) aViewer = myV2dView->Viewer();
pCmdUI-> Enable( aViewer->IsActive() );
}
void OCC_2dView::OnLButtonDown(UINT nFlags, CPoint point)
{
// save the current mouse coordinate in min
myXmin=point.x; myYmin=point.y;
myXmax=point.x; myYmax=point.y;
if ( nFlags & CASCADESHORTCUTKEY )
{
// Button MB1 down Control :start zomming
//
}
else // if ( MULTISELECTIONKEY )
{
switch (myCurrentMode)
{
case CurAction2d_Nothing : // start a drag
DragEvent2D(point.x,point.y,-1);
break;
case CurAction2d_DynamicZooming : // nothing
break;
case CurAction2d_WindowZooming : // nothing
break;
case CurAction2d_DynamicPanning :// nothing
break;
case CurAction2d_GlobalPanning :// nothing
break;
default :
throw Standard_Failure(" incompatible Current Mode ");
break;
}
}
}
void OCC_2dView::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if ( nFlags & CASCADESHORTCUTKEY )
{
return;
}
else // if ( Ctrl )
{
const Handle(AIS_InteractiveContext)& aContext = GetDocument()->GetAISContext();
switch (myCurrentMode)
{
case CurAction2d_Nothing :
if (point.x == myXmin && point.y == myYmin)
{ // no offset between down and up --> selectEvent
myXmax=point.x;
myYmax=point.y;
if (nFlags & MULTISELECTIONKEY )
MultiInputEvent2D(point.x,point.y);
else
InputEvent2D (point.x,point.y);
} else
{
drawRectangle (myXmin, myYmin, myXmax, myYmax, aContext, Standard_False);
myXmax=point.x;
myYmax=point.y;
if (nFlags & MULTISELECTIONKEY)
MultiDragEvent2D(point.x,point.y,1);
else
DragEvent2D(point.x,point.y,1);
}
break;
case CurAction2d_DynamicZooming :
//
myCurrentMode = CurAction2d_Nothing;
break;
case CurAction2d_WindowZooming :
myXmax=point.x; myYmax=point.y;
drawRectangle (myXmin, myYmin, myXmax, myYmax, aContext, Standard_False);
if ((abs(myXmin-myXmax)>ValZWMin) || (abs(myYmin-myYmax)>ValZWMin))
// Test if the zoom window is greater than a minimale window.
{
// Do the zoom window between Pmin and Pmax
myV2dView->WindowFit(myXmin,myYmin,myXmax,myYmax);
}
myCurrentMode = CurAction2d_Nothing;
break;
case CurAction2d_DynamicPanning :
myCurrentMode = CurAction2d_Nothing;
break;
case CurAction2d_GlobalPanning :
myV2dView->Place(point.x,point.y,myCurZoom);
myCurrentMode = CurAction2d_Nothing;
break;
default :
throw Standard_Failure(" incompatible Current Mode ");
break;
} //switch (myCurrentMode)
} // else // if ( CASCADESHORTCUTKEY )
}
void OCC_2dView::OnMButtonDown(UINT nFlags, CPoint /*point*/)
{
if ( nFlags & CASCADESHORTCUTKEY )
{
// Button MB2 down + CASCADESHORTCUTKEY : panning init
//
}
}
void OCC_2dView::OnMButtonUp(UINT nFlags, CPoint /*point*/)
{
if ( nFlags & CASCADESHORTCUTKEY )
{
// Button MB2 up + CASCADESHORTCUTKEY : panning stop
}
}
void OCC_2dView::OnRButtonDown(UINT nFlags, CPoint point)
{
#ifdef POPUPONBUTTONDOWN
if ( !(nFlags & CASCADESHORTCUTKEY) )
Popup2D(point.x,point.y);
#endif
}
void OCC_2dView::OnRButtonUp(UINT
#ifndef POPUPONBUTTONDOWN
nFlags
#endif
, CPoint
#ifndef POPUPONBUTTONDOWN
point
#endif
)
{
#ifndef POPUPONBUTTONDOWN
if ( !(nFlags & CASCADESHORTCUTKEY) )
Popup2D(point.x,point.y);
#endif
}
void OCC_2dView::OnMouseMove(UINT nFlags, CPoint point)
{
// ============================ LEFT BUTTON =======================
if ( (nFlags & MK_LBUTTON) &! (nFlags & MK_RBUTTON) ) // Left + Right is specific
{
if ( nFlags & CASCADESHORTCUTKEY )
{
// move with MB1 and CASCADESHORTCUTKEY : on the dynamic zooming
// Do the zoom in function of mouse's coordinates
myV2dView->Zoom(myXmax,myYmax,point.x,point.y);
// save the current mouse coordinate in min
myXmax = point.x;
myYmax = point.y;
}
else // if ( CASCADESHORTCUTKEY )
{
const Handle(AIS_InteractiveContext)& aContext = GetDocument()->GetAISContext();
switch (myCurrentMode)
{
case CurAction2d_Nothing :
myXmax = point.x; myYmax = point.y;
DragEvent2D(myXmax,myYmax,0);
drawRectangle (myXmin, myYmin, myXmax, myYmax, aContext);
break;
case CurAction2d_DynamicZooming :
myV2dView->Zoom(myXmax,myYmax,point.x,point.y);
// save the current mouse coordinate in min \n";
myXmax=point.x; myYmax=point.y;
break;
case CurAction2d_WindowZooming :
myXmax = point.x;
myYmax = point.y;
drawRectangle (myXmin, myYmin, myXmax, myYmax, aContext);
break;
case CurAction2d_DynamicPanning :
myV2dView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning
myXmax = point.x; myYmax = point.y;
break;
case CurAction2d_GlobalPanning : // nothing
break;
default :
throw Standard_Failure(" incompatible Current Mode ");
break;
}// switch (myCurrentMode)
}// if ( nFlags & CASCADESHORTCUTKEY ) else
} else // if ( nFlags & MK_LBUTTON)
// ============================ MIDDLE BUTTON =======================
if ( nFlags & MK_MBUTTON)
{
if ( nFlags & CASCADESHORTCUTKEY )
{
myV2dView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning
myXmax = point.x; myYmax = point.y;
}
} else // if ( nFlags & MK_MBUTTON)
// ============================ RIGHT BUTTON =======================
if ( (nFlags & MK_RBUTTON) &! (nFlags & MK_LBUTTON) ) // Left + Right is specific
{
}else //if ( nFlags & MK_RBUTTON)
if ( (nFlags & MK_RBUTTON) && (nFlags & MK_LBUTTON) )
{
// in case of Left + Right : same as Middle
if ( nFlags & CASCADESHORTCUTKEY )
{
myV2dView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning
myXmax = point.x; myYmax = point.y;
}
}else //if ( nFlags & MK_RBUTTON)&& (nFlags & MK_LBUTTON)
// ============================ NO BUTTON =======================
{ // No buttons
myXmax = point.x; myYmax = point.y;
if (nFlags & MULTISELECTIONKEY)
MultiMoveEvent2D(point.x,point.y);
else
MoveEvent2D(point.x,point.y);
}
}
void OCC_2dView::OnSize(UINT nType, int cx, int cy)
{
OCC_BaseView::OnSize (nType, cx, cy);
// Take care : This fonction is call before OnInitialUpdate
if (!myView.IsNull())
myView->MustBeResized();
if (!myV2dView.IsNull())
myV2dView->MustBeResized();
}
void OCC_2dView::OnBUTTONFitAll()
{
myView->FitAll();
myV2dView->FitAll();
}
void OCC_2dView::OnBUTTONGlobPanning()
{
//save the current zoom value
myCurZoom = myView->Scale();
myCurZoom = myV2dView->Scale();
// Do a Global Zoom
myView->FitAll();
myV2dView->FitAll();
// Set the mode
setCurrentAction (CurAction3d_GlobalPanning);
myCurrentMode = CurAction2d_GlobalPanning;
}
void OCC_2dView::OnBUTTONPanning()
{
setCurrentAction (CurAction3d_DynamicPanning);
myCurrentMode = CurAction2d_DynamicPanning;
}
void OCC_2dView::OnBUTTONZoomProg()
{
setCurrentAction (CurAction3d_DynamicZooming);
myCurrentMode = CurAction2d_DynamicZooming;
}
void OCC_2dView::OnBUTTONZoomWin()
{
setCurrentAction (CurAction3d_WindowZooming);
myCurrentMode = CurAction2d_WindowZooming;
}
void OCC_2dView::OnChangeBackground()
{
Standard_Real R1, G1, B1;
Handle(Aspect_Window) aWindow = myView->Window();
Handle(Aspect_Window) aWindow = myV2dView->Window();
Aspect_Background ABack = aWindow->Background();
Quantity_Color aColor = ABack.Color();
aColor.Values(R1,G1,B1,Quantity_TOC_RGB);
@@ -268,32 +525,166 @@ void OCC_2dView::OnChangeBackground()
G1 = GetGValue(m_clr)/255.;
B1 = GetBValue(m_clr)/255.;
aColor.SetValues(R1,G1,B1,Quantity_TOC_RGB);
myView->SetBackgroundColor(aColor);
myView->Update();
myV2dView->SetBackgroundColor(aColor);
myV2dView->Update();
}
}
void OCC_2dView::OnUpdateBUTTON2DGlobPanning(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (getCurrentAction() == CurAction3d_GlobalPanning);
pCmdUI->Enable (getCurrentAction() != CurAction3d_GlobalPanning);
pCmdUI->SetCheck (myCurrentMode == CurAction2d_GlobalPanning);
pCmdUI->Enable (myCurrentMode != CurAction2d_GlobalPanning);
}
void OCC_2dView::OnUpdateBUTTON2DPanning(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (getCurrentAction() == CurAction3d_DynamicPanning);
pCmdUI->Enable (getCurrentAction() != CurAction3d_DynamicPanning);
pCmdUI->SetCheck (myCurrentMode == CurAction2d_DynamicPanning);
pCmdUI->Enable (myCurrentMode != CurAction2d_DynamicPanning);
}
void OCC_2dView::OnUpdateBUTTON2DZoomProg(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (getCurrentAction() == CurAction3d_DynamicZooming);
pCmdUI->Enable (getCurrentAction() != CurAction3d_DynamicZooming);
pCmdUI->SetCheck (myCurrentMode == CurAction2d_DynamicZooming);
pCmdUI->Enable (myCurrentMode != CurAction2d_DynamicZooming);
}
void OCC_2dView::OnUpdateBUTTON2DZoomWin(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (getCurrentAction() == CurAction3d_WindowZooming);
pCmdUI->Enable (getCurrentAction() != CurAction3d_WindowZooming);
pCmdUI->SetCheck (myCurrentMode == CurAction2d_WindowZooming);
pCmdUI->Enable (myCurrentMode != CurAction2d_WindowZooming);
}
// =====================================================================
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void OCC_2dView::DragEvent2D(const Standard_Integer x,
const Standard_Integer y,
const Standard_Integer TheState)
{
// TheState == -1 button down
// TheState == 0 move
// TheState == 1 button up
static Standard_Integer theButtonDownX=0;
static Standard_Integer theButtonDownY=0;
if (TheState == -1)
{
theButtonDownX=x;
theButtonDownY=y;
}
if (TheState == 0)
{
((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->MoveTo (x, y, myV2dView, Standard_False);
((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->Select (theButtonDownX, theButtonDownY, x, y, myV2dView, Standard_True);
}
if (TheState == 1)
{
((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->Select(true);
}
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void OCC_2dView::InputEvent2D(const Standard_Integer /*x*/,
const Standard_Integer /*y*/)
{
((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->Select(true);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void OCC_2dView::MoveEvent2D(const Standard_Integer x,
const Standard_Integer y)
{
if(myV2dView->Viewer()->Grid()->IsActive())
{
Standard_Real aGridX=0,aGridY=0,aGridZ=0;
myV2dView->ConvertToGrid(x,y,aGridX,aGridY,aGridZ);
//View is not updated automatically in ConvertToGrid
myV2dView->Update();
}
((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->MoveTo (x, y, myV2dView, Standard_True);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void OCC_2dView::MultiMoveEvent2D(const Standard_Integer x,
const Standard_Integer y)
{
// MultiMoveEvent2D means we move the mouse in a multi selection mode
((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->MoveTo (x, y, myV2dView, Standard_True);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void OCC_2dView::MultiDragEvent2D(const Standard_Integer x ,
const Standard_Integer y ,
const Standard_Integer TheState)
{
static Standard_Integer theButtonDownX=0;
static Standard_Integer theButtonDownY=0;
if (TheState == -1)
{
theButtonDownX=x;
theButtonDownY=y;
}
if (TheState == 0)
{
((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->MoveTo (x, y, myV2dView, Standard_False);
((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->ShiftSelect (theButtonDownX, theButtonDownY, x, y, myV2dView, Standard_True);
}
if (TheState == 1)
{
((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->ShiftSelect(true);
}
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void OCC_2dView::MultiInputEvent2D(const Standard_Integer /*x*/,
const Standard_Integer /*y*/)
{
((OCC_2dDoc*)GetDocument())->GetInteractiveContext()->ShiftSelect(true);
}
//-----------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------
void OCC_2dView::Popup2D(const Standard_Integer x,
const Standard_Integer y )
{
CMenu menu;
CMenu* pPopup ;
// load the 'normal' popup
VERIFY(menu.LoadMenu(IDR_Popup2D));
// activate the sub menu '0'
pPopup= menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
// display the popup
POINT winCoord = { x , y };
ClientToScreen ( &winCoord);
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON , winCoord.x, winCoord.y , AfxGetMainWnd());
}
void OCC_2dView::FitAll()
{
myV2dView->FitAll();
}

View File

@@ -14,6 +14,15 @@
#include "Resource2d/RectangularGrid.h"
#include "Resource2d/CircularGrid.h"
enum CurrentAction2d
{
CurAction2d_Nothing,
CurAction2d_DynamicZooming,
CurAction2d_WindowZooming,
CurAction2d_DynamicPanning,
CurAction2d_GlobalPanning,
};
class Standard_EXPORT OCC_2dView : public OCC_BaseView
{
DECLARE_DYNCREATE(OCC_2dView)
@@ -26,10 +35,17 @@ public:
OCC_2dDoc* GetDocument();
Handle(V3d_View)& GetV2dView() { return myV2dView; }
void FitAll();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(OCC_2dView)
protected:
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void OnInitialUpdate(); // called first time after construct
//}}AFX_VIRTUAL
@@ -54,6 +70,13 @@ protected:
afx_msg void OnUpdateBUTTONGridValues(CCmdUI* pCmdUI);
afx_msg void OnBUTTONGridCancel();
afx_msg void OnUpdateBUTTONGridCancel(CCmdUI* pCmdUI);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnBUTTONFitAll();
afx_msg void OnBUTTONGlobPanning();
@@ -69,6 +92,34 @@ protected:
DECLARE_MESSAGE_MAP()
protected:
virtual void DragEvent2D (const Standard_Integer x,
const Standard_Integer y,
const Standard_Integer TheState);
virtual void InputEvent2D (const Standard_Integer x,
const Standard_Integer y);
virtual void MoveEvent2D (const Standard_Integer x,
const Standard_Integer y);
virtual void MultiMoveEvent2D (const Standard_Integer x,
const Standard_Integer y);
virtual void MultiDragEvent2D (const Standard_Integer x,
const Standard_Integer y,
const Standard_Integer TheState);
virtual void MultiInputEvent2D (const Standard_Integer x,
const Standard_Integer y);
virtual void Popup2D (const Standard_Integer x,
const Standard_Integer y);
protected:
Handle(V3d_View) myV2dView;
CurrentAction2d myCurrentMode;
CRectangularGrid TheRectangularGridDialog;
CCircularGrid TheCircularGridDialog;
};

View File

@@ -221,7 +221,9 @@ void OCC_3dBaseDoc::Popup (const Standard_Integer theMouseX,
}
POINT winCoord = { theMouseX , theMouseY };
ClientToScreen ((HWND )theView->Window()->NativeHandle(), &winCoord);
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,

View File

@@ -51,7 +51,7 @@ public:
virtual void Popup (const Standard_Integer theMouseX,
const Standard_Integer theMouseY,
const Handle(V3d_View)& theView) Standard_OVERRIDE;
const Handle(V3d_View)& theView);
static void Fit();

View File

@@ -12,9 +12,11 @@
#include <OpenGl_GraphicDriver.hxx>
IMPLEMENT_DYNCREATE(OCC_3dView, OCC_BaseView)
#define ValZWMin 1
BEGIN_MESSAGE_MAP(OCC_3dView, OCC_BaseView)
IMPLEMENT_DYNCREATE(OCC_3dView, CView)
BEGIN_MESSAGE_MAP(OCC_3dView, CView)
//{{AFX_MSG_MAP(OCC_3dView)
ON_COMMAND(ID_BUTTONAxo, OnBUTTONAxo)
ON_COMMAND(ID_BUTTONBack, OnBUTTONBack)
@@ -35,6 +37,13 @@ BEGIN_MESSAGE_MAP(OCC_3dView, OCC_BaseView)
ON_COMMAND(ID_FILE_EXPORT_IMAGE, OnFileExportImage)
ON_COMMAND(ID_BUTTONZoomProg, OnBUTTONZoomProg)
ON_COMMAND(ID_BUTTONZoomWin, OnBUTTONZoomWin)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MBUTTONDOWN()
ON_WM_MBUTTONUP()
ON_WM_MOUSEMOVE()
ON_WM_RBUTTONDOWN()
ON_WM_RBUTTONUP()
ON_UPDATE_COMMAND_UI(ID_BUTTONHlrOff, OnUpdateBUTTONHlrOff)
ON_UPDATE_COMMAND_UI(ID_BUTTONHlrOn, OnUpdateBUTTONHlrOn)
ON_UPDATE_COMMAND_UI(ID_BUTTONPanGlo, OnUpdateBUTTONPanGlo)
@@ -51,25 +60,79 @@ END_MESSAGE_MAP()
// OCC_3dView construction/destruction
OCC_3dView::OCC_3dView()
: myCurrentMode (CurAction3d_Nothing),
myWidth (0),
myHeight (0),
myHlrModeIsOn (Standard_False)
{
// TODO: add construction code here
}
OCC_3dView::~OCC_3dView()
{
if (myView.IsNull())
{
myView->Remove();
}
delete m_pStereoDlg;
}
BOOL OCC_3dView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.lpszClass = ::AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC, ::LoadCursor(NULL, IDC_ARROW), NULL, NULL);
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// OCC_3dView drawing
void OCC_3dView::OnInitialUpdate()
{
OCC_BaseView::OnInitialUpdate();
CView::OnInitialUpdate();
myView = GetDocument()->GetViewer()->CreateView();
// store for restore state after rotation (which is in Degenerated mode)
myHlrModeIsOn = Standard_False;
myView->SetComputedMode (myHlrModeIsOn);
Handle(OpenGl_GraphicDriver) aDriver =
Handle(OpenGl_GraphicDriver)::DownCast (((OCC_App*)AfxGetApp())->GetGraphicDriver());
Handle(WNT_Window) aWNTWindow = new WNT_Window(GetSafeHwnd());
myView->SetWindow(aWNTWindow);
myView->Camera()->SetProjectionType (aDriver->Options().contextStereo
? Graphic3d_Camera::Projection_Stereo
: Graphic3d_Camera::Projection_Orthographic);
if (!aWNTWindow->IsMapped())
{
aWNTWindow->Map();
}
// store the mode ( nothing , dynamic zooming, dynamic ... )
myCurrentMode = CurAction3d_Nothing;
m_pStereoDlg = new OCC_StereoConfigDlg (this);
m_pStereoDlg->SetView (myView);
m_pStereoDlg->Create (IDD_DIALOG_STEREO, this);
}
void OCC_3dView::OnDraw(CDC* /*pDC*/)
{
CRect aRect;
GetWindowRect(aRect);
if(myWidth != aRect.Width() || myHeight != aRect.Height()) {
myWidth = aRect.Width();
myHeight = aRect.Height();
::PostMessage ( GetSafeHwnd() , WM_SIZE , SW_SHOW , myWidth + myHeight*65536 );
}
myView->Redraw();
}
/////////////////////////////////////////////////////////////////////////////
// OCC_3dView diagnostics
@@ -99,72 +162,74 @@ void OCC_3dView::OnFileExportImage()
GetDocument()->ExportView (myView);
}
void OCC_3dView::OnSize(UINT nType, int cx, int cy)
{
OCC_BaseView::OnSize (nType, cx, cy);
if (!myView.IsNull())
myView->MustBeResized();
}
// See the back View
void OCC_3dView::OnBUTTONBack()
{
myView->SetProj(V3d_Ypos);
myView->Redraw();
}
// See the front View
void OCC_3dView::OnBUTTONFront()
{
myView->SetProj(V3d_Yneg);
myView->Redraw();
}
// See the bottom View
void OCC_3dView::OnBUTTONBottom()
{
myView->SetProj(V3d_Zneg);
myView->Redraw();
}
// See the top View
void OCC_3dView::OnBUTTONTop()
{
myView->SetProj(V3d_Zpos);
myView->Redraw();
}
// See the left View
void OCC_3dView::OnBUTTONLeft()
{
myView->SetProj(V3d_Xneg);
myView->Redraw();
}
// See the right View
void OCC_3dView::OnBUTTONRight()
{
myView->SetProj(V3d_Xpos);
myView->Redraw();
}
// See the axonometric View
void OCC_3dView::OnBUTTONAxo()
{
myView->SetProj(V3d_XposYnegZpos);
myView->Redraw();
}
void OCC_3dView::OnBUTTONHlrOff()
{
myView->SetComputedMode (Standard_False);
myHlrModeIsOn = Standard_False;
myView->SetComputedMode (myHlrModeIsOn);
myView->Redraw();
}
void OCC_3dView::OnBUTTONHlrOn()
{
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
myView->SetComputedMode (Standard_True);
myHlrModeIsOn = Standard_True;
myView->SetComputedMode (myHlrModeIsOn);
myView->Redraw();
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
}
void OCC_3dView::OnBUTTONPan()
{
setCurrentAction (CurAction3d_DynamicPanning);
myCurrentMode = CurAction3d_DynamicPanning;
}
void OCC_3dView::OnBUTTONPanGlo()
@@ -172,9 +237,9 @@ void OCC_3dView::OnBUTTONPanGlo()
// save the current zoom value
myCurZoom = myView->Scale();
// Do a Global Zoom
myView->FitAll();
//myView->FitAll();
// Set the mode
setCurrentAction (CurAction3d_GlobalPanning);
myCurrentMode = CurAction3d_GlobalPanning;
}
void OCC_3dView::OnBUTTONReset()
@@ -184,7 +249,7 @@ void OCC_3dView::OnBUTTONReset()
void OCC_3dView::OnBUTTONRot()
{
setCurrentAction (CurAction3d_DynamicRotation);
myCurrentMode = CurAction3d_DynamicRotation;
}
void OCC_3dView::OnBUTTONZoomAll()
@@ -194,55 +259,298 @@ void OCC_3dView::OnBUTTONZoomAll()
}
void OCC_3dView::OnBUTTONZoomProg()
{
setCurrentAction (CurAction3d_DynamicZooming);
}
{ myCurrentMode = CurAction3d_DynamicZooming; }
void OCC_3dView::OnBUTTONZoomWin()
{ myCurrentMode = CurAction3d_WindowZooming; }
void OCC_3dView::OnLButtonDown(UINT nFlags, CPoint point)
{
setCurrentAction (CurAction3d_WindowZooming);
// save the current mouse coordinate in min
myXmin=point.x; myYmin=point.y;
myXmax=point.x; myYmax=point.y;
if ( nFlags & MK_CONTROL )
{
// Button MB1 down Control :start zomming
// SetCursor(AfxGetApp()->LoadStandardCursor());
}
else // if ( Ctrl )
{
switch (myCurrentMode)
{
case CurAction3d_Nothing : // start a drag
if (nFlags & MK_SHIFT)
GetDocument()->ShiftDragEvent(myXmax,myYmax,-1,myView);
else
GetDocument()->DragEvent(myXmax,myYmax,-1,myView);
break;
break;
case CurAction3d_DynamicZooming : // noting
break;
case CurAction3d_WindowZooming : // noting
break;
case CurAction3d_DynamicPanning :// noting
break;
case CurAction3d_GlobalPanning :// noting
break;
case CurAction3d_DynamicRotation :
if (myHlrModeIsOn)
{
myView->SetComputedMode (Standard_False);
}
myView->StartRotation(point.x,point.y);
break;
default :
throw Standard_Failure(" incompatible Current Mode ");
break;
}
}
}
void OCC_3dView::OnLButtonUp(UINT nFlags, CPoint point)
{
if ( nFlags & MK_CONTROL )
{
return;
}
else // if ( Ctrl )
{
const Handle(AIS_InteractiveContext)& aContext = GetDocument()->GetAISContext();
switch (myCurrentMode)
{
case CurAction3d_Nothing :
if (point.x == myXmin && point.y == myYmin)
{ // no offset between down and up --> selectEvent
myXmax=point.x;
myYmax=point.y;
if (nFlags & MK_SHIFT )
GetDocument()->ShiftInputEvent(point.x,point.y,myView);
else
GetDocument()->InputEvent (point.x,point.y,myView);
} else
{
myXmax=point.x; myYmax=point.y;
drawRectangle (myXmin, myYmin, myXmax, myYmax, aContext, Standard_False);
if (nFlags & MK_SHIFT)
GetDocument()->ShiftDragEvent(point.x,point.y,1,myView);
else
GetDocument()->DragEvent(point.x,point.y,1,myView);
}
break;
case CurAction3d_DynamicZooming :
myCurrentMode = CurAction3d_Nothing;
break;
case CurAction3d_WindowZooming :
myXmax=point.x; myYmax=point.y;
drawRectangle (myXmin, myYmin, myXmax, myYmax, aContext, Standard_False);
if ((abs(myXmin-myXmax)>ValZWMin) || (abs(myYmin-myYmax)>ValZWMin))
// Test if the zoom window is greater than a minimale window.
{
// Do the zoom window between Pmin and Pmax
myView->WindowFitAll(myXmin,myYmin,myXmax,myYmax);
}
myCurrentMode = CurAction3d_Nothing;
break;
case CurAction3d_DynamicPanning :
myCurrentMode = CurAction3d_Nothing;
break;
case CurAction3d_GlobalPanning :
myView->Place(point.x,point.y,myCurZoom);
myCurrentMode = CurAction3d_Nothing;
break;
case CurAction3d_DynamicRotation :
myCurrentMode = CurAction3d_Nothing;
if (myHlrModeIsOn)
{
CWaitCursor aWaitCursor;
myView->SetComputedMode (myHlrModeIsOn);
myView->Redraw();
}
else
{
myView->SetComputedMode (myHlrModeIsOn);
}
break;
default :
throw Standard_Failure(" incompatible Current Mode ");
break;
} //switch (myCurrentMode)
} // else // if ( Ctrl )
}
void OCC_3dView::OnMButtonDown(UINT nFlags, CPoint /*point*/)
{
if ( nFlags & MK_CONTROL )
{
// Button MB2 down Control : panning init
// SetCursor(AfxGetApp()->LoadStandardCursor());
}
}
void OCC_3dView::OnMButtonUp(UINT nFlags, CPoint /*point*/)
{
if ( nFlags & MK_CONTROL )
{
// Button MB2 down Control : panning init
// SetCursor(AfxGetApp()->LoadStandardCursor());
}
}
void OCC_3dView::OnRButtonDown(UINT nFlags, CPoint point)
{
if ( nFlags & MK_CONTROL )
{
if (myHlrModeIsOn)
{
myView->SetComputedMode (Standard_False);
}
myView->StartRotation(point.x,point.y);
}
else // if ( Ctrl )
{
GetDocument()->Popup(point.x,point.y,myView);
}
}
void OCC_3dView::OnRButtonUp(UINT /*nFlags*/, CPoint /*point*/)
{
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
if (myHlrModeIsOn)
{
myView->SetComputedMode (myHlrModeIsOn);
myView->Redraw();
}
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
}
void OCC_3dView::OnMouseMove(UINT nFlags, CPoint point)
{
// ============================ LEFT BUTTON =======================
if ( nFlags & MK_LBUTTON)
{
if ( nFlags & MK_CONTROL )
{
// move with MB1 and Control : on the dynamic zooming
// Do the zoom in function of mouse's coordinates
myView->Zoom (myXmax,myYmax,point.x,point.y);
// save the current mouse coordinate in min
myXmax = point.x;
myYmax = point.y;
}
else // if ( Ctrl )
{
const Handle(AIS_InteractiveContext)& aContext = GetDocument()->GetAISContext();
switch (myCurrentMode)
{
case CurAction3d_Nothing :
myXmax = point.x;
myYmax = point.y;
if (nFlags & MK_SHIFT)
GetDocument()->ShiftDragEvent(myXmax,myYmax,0,myView);
else
GetDocument()->DragEvent(myXmax,myYmax,0,myView);
drawRectangle (myXmin, myYmin, myXmax, myYmax, aContext);
break;
case CurAction3d_DynamicZooming :
myView->Zoom(myXmax,myYmax,point.x,point.y);
// save the current mouse coordinate in min \n";
myXmax = point.x;
myYmax = point.y;
break;
case CurAction3d_WindowZooming :
myXmax = point.x;
myYmax = point.y;
drawRectangle (myXmin, myYmin, myXmax, myYmax, aContext);
break;
case CurAction3d_DynamicPanning :
myView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning
myXmax = point.x; myYmax = point.y;
break;
case CurAction3d_GlobalPanning : // nothing
break;
case CurAction3d_DynamicRotation :
myView->Rotation(point.x,point.y);
myView->Redraw();
break;
default :
throw Standard_Failure(" incompatible Current Mode ");
break;
}// switch (myCurrentMode)
}// if ( nFlags & MK_CONTROL ) else
}
else if ( nFlags & MK_MBUTTON)
{
if ( nFlags & MK_CONTROL )
{
myView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning
myXmax = point.x;
myYmax = point.y;
}
}
else if ( nFlags & MK_RBUTTON)
{
if ( nFlags & MK_CONTROL )
{
myView->Rotation(point.x,point.y);
}
}
else
{ // No buttons
myXmax = point.x;
myYmax = point.y;
if (nFlags & MK_SHIFT)
GetDocument()->ShiftMoveEvent(point.x,point.y,myView);
else
GetDocument()->MoveEvent(point.x,point.y,myView);
}
}
void OCC_3dView::OnUpdateBUTTONHlrOff(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (!myView->ComputedMode());
pCmdUI->Enable (myView->ComputedMode());
pCmdUI->SetCheck (!myHlrModeIsOn);
pCmdUI->Enable (myHlrModeIsOn);
}
void OCC_3dView::OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (myView->ComputedMode());
pCmdUI->Enable (!myView->ComputedMode());
pCmdUI->SetCheck (myHlrModeIsOn);
pCmdUI->Enable (!myHlrModeIsOn);
}
void OCC_3dView::OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (getCurrentAction() == CurAction3d_GlobalPanning);
pCmdUI->Enable (getCurrentAction() != CurAction3d_GlobalPanning);
pCmdUI->SetCheck (myCurrentMode == CurAction3d_GlobalPanning);
pCmdUI->Enable (myCurrentMode != CurAction3d_GlobalPanning);
}
void OCC_3dView::OnUpdateBUTTONPan(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (getCurrentAction() == CurAction3d_DynamicPanning);
pCmdUI->Enable (getCurrentAction() != CurAction3d_DynamicPanning );
pCmdUI->SetCheck (myCurrentMode == CurAction3d_DynamicPanning);
pCmdUI->Enable (myCurrentMode != CurAction3d_DynamicPanning );
}
void OCC_3dView::OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (getCurrentAction() == CurAction3d_DynamicZooming );
pCmdUI->Enable (getCurrentAction() != CurAction3d_DynamicZooming);
pCmdUI->SetCheck (myCurrentMode == CurAction3d_DynamicZooming );
pCmdUI->Enable (myCurrentMode != CurAction3d_DynamicZooming);
}
void OCC_3dView::OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (getCurrentAction() == CurAction3d_WindowZooming);
pCmdUI->Enable (getCurrentAction() != CurAction3d_WindowZooming);
pCmdUI->SetCheck (myCurrentMode == CurAction3d_WindowZooming);
pCmdUI->Enable (myCurrentMode != CurAction3d_WindowZooming);
}
void OCC_3dView::OnUpdateBUTTONRot(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (getCurrentAction() == CurAction3d_DynamicRotation);
pCmdUI->Enable (getCurrentAction() != CurAction3d_DynamicRotation);
pCmdUI->SetCheck (myCurrentMode == CurAction3d_DynamicRotation);
pCmdUI->Enable (myCurrentMode != CurAction3d_DynamicRotation);
}
void OCC_3dView::OnModifyChangeBackground()

View File

@@ -14,6 +14,15 @@
#include "OCC_StereoConfigDlg.h"
#include <Standard_Macro.hxx>
enum CurAction3d {
CurAction3d_Nothing,
CurAction3d_DynamicZooming,
CurAction3d_WindowZooming,
CurAction3d_DynamicPanning,
CurAction3d_GlobalPanning,
CurAction3d_DynamicRotation
};
class Standard_EXPORT OCC_3dView : public OCC_BaseView
{
DECLARE_DYNCREATE(OCC_3dView)
@@ -22,42 +31,57 @@ public:
virtual ~OCC_3dView();
OCC_3dDoc* GetDocument();
void FitAll() { if ( !myView.IsNull() ) myView->FitAll(); myView->ZFitAll(); };
void Redraw() { if ( !myView.IsNull() ) myView->Redraw(); };
void SetZoom ( const Standard_Real& Coef ) { myView->SetZoom ( Coef ); };
Handle(V3d_View)& GetView() { return myView; }
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(OCC_3dView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual void OnInitialUpdate();
//}}AFX_VIRTUAL
// Generated message map functions
protected:
//{{AFX_MSG(OCC_3dView)
afx_msg void OnBUTTONAxo();
afx_msg void OnBUTTONBack();
afx_msg void OnBUTTONBottom();
afx_msg void OnBUTTONFront();
afx_msg void OnBUTTONHlrOff();
afx_msg void OnBUTTONHlrOn();
afx_msg void OnBUTTONLeft();
afx_msg void OnBUTTONPan();
afx_msg void OnBUTTONPanGlo();
afx_msg void OnBUTTONReset();
afx_msg void OnBUTTONRight();
afx_msg void OnBUTTONRot();
afx_msg void OnBUTTONTop();
afx_msg void OnBUTTONZoomAll();
afx_msg void OnFileExportImage();
afx_msg void OnBUTTONZoomProg();
afx_msg void OnBUTTONZoomWin();
afx_msg void OnUpdateBUTTONHlrOff(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONPan(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONRot(CCmdUI* pCmdUI);
afx_msg void OnModifyChangeBackground();
afx_msg void OnBUTTONAxo();
afx_msg void OnBUTTONBack();
afx_msg void OnBUTTONBottom();
afx_msg void OnBUTTONFront();
afx_msg void OnBUTTONHlrOff();
afx_msg void OnBUTTONHlrOn();
afx_msg void OnBUTTONLeft();
afx_msg void OnBUTTONPan();
afx_msg void OnBUTTONPanGlo();
afx_msg void OnBUTTONReset();
afx_msg void OnBUTTONRight();
afx_msg void OnBUTTONRot();
afx_msg void OnBUTTONTop();
afx_msg void OnBUTTONZoomAll();
afx_msg void OnFileExportImage();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnBUTTONZoomProg();
afx_msg void OnBUTTONZoomWin();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnUpdateBUTTONHlrOff(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONPan(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONRot(CCmdUI* pCmdUI);
afx_msg void OnModifyChangeBackground();
afx_msg void OnStereoConfigButton();
afx_msg void OnUpdateStereoConfigButton (CCmdUI* theCmdUI);
//}}AFX_MSG
@@ -68,6 +92,14 @@ protected:
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
Handle(V3d_View) myView;
CurAction3d myCurrentMode;
Standard_Integer myWidth;
Standard_Integer myHeight;
Standard_Boolean myHlrModeIsOn;
private:
//! Persistent non blocking stereo configuration dialog

View File

@@ -78,4 +78,7 @@ void OCC_BaseDoc::ResetDocumentViews (CDocTemplate* theTemplate)
// init frame
theTemplate->InitialUpdateFrame(aNewFrame, this);
}

View File

@@ -28,10 +28,9 @@ public:
virtual ~OCC_BaseDoc();
const Handle(AIS_InteractiveContext)& GetAISContext() const { return myAISContext; }
const Handle(AIS_InteractiveContext)& GetInteractiveContext() const { return myAISContext; };
Handle(AIS_InteractiveContext)& GetAISContext() { return myAISContext; }
const Handle(V3d_Viewer)& GetViewer() const { return myViewer; }
Handle(V3d_Viewer) GetViewer() { return myViewer; }
// Returns string with supported export pixel and vector images formats.
const CString SupportedImageFormats() const;
@@ -70,10 +69,6 @@ public:
const Standard_Integer /*theMouseY*/,
const Handle(V3d_View)& /*theView*/) {}
//! Callback called by handleMoveTo() on Selection in 3D Viewer.
virtual void OnSelectionChanged (const Handle(AIS_InteractiveContext)& ,
const Handle(V3d_View)& ) {}
void ResetDocumentViews (CDocTemplate* theTemplate);
protected:

View File

@@ -5,30 +5,24 @@
#include <stdafx.h>
#include "OCC_BaseView.h"
BEGIN_MESSAGE_MAP(OCC_BaseView, CView)
ON_WM_SIZE()
ON_WM_MOUSEMOVE()
ON_WM_MOUSEWHEEL()
ON_WM_MOUSELEAVE()
ON_WM_NCMOUSEMOVE()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MBUTTONDOWN()
ON_WM_MBUTTONUP()
ON_WM_RBUTTONDOWN()
ON_WM_RBUTTONUP()
END_MESSAGE_MAP()
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
OCC_BaseView::OCC_BaseView()
: myUpdateRequests (0),
myCurZoom (0.0),
myCurrentMode (CurAction3d_Nothing)
: myXmin (0),
myYmin (0),
myXmax (0),
myYmax (0),
myCurZoom (0.0),
myRect (new AIS_RubberBand (Quantity_Color(Quantity_NOC_WHITE), Aspect_TOL_SOLID, 1.0) )
{
myDefaultGestures = myMouseGestureMap;
myRect->SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER));
if (myRect->ZLayer() != Graphic3d_ZLayerId_TopOSD)
{
myRect->SetZLayer (Graphic3d_ZLayerId_TopOSD);
}
}
//=======================================================================
@@ -37,7 +31,7 @@ OCC_BaseView::OCC_BaseView()
//=======================================================================
OCC_BaseView::~OCC_BaseView()
{
//
}
//=======================================================================
@@ -49,330 +43,37 @@ OCC_BaseDoc* OCC_BaseView::GetDocument() // non-debug version is inline
return (OCC_BaseDoc*)m_pDocument;
}
// =======================================================================
// function : PostNcDestroy
// purpose :
// =======================================================================
void OCC_BaseView::PostNcDestroy()
//=======================================================================
//function : drawRectangle
//purpose :
//=======================================================================
void OCC_BaseView::drawRectangle (const Standard_Integer theMinX,
const Standard_Integer theMinY,
const Standard_Integer theMaxX,
const Standard_Integer theMaxY,
const Handle(AIS_InteractiveContext)& theContext,
const Standard_Boolean toDraw)
{
if (!myView.IsNull())
if (toDraw)
{
myView->Remove();
myView.Nullify();
}
CView::PostNcDestroy();
}
CRect aRect;
GetWindowRect(aRect);
myRect->SetRectangle (theMinX, aRect.Height() - theMinY, theMaxX, aRect.Height() - theMaxY);
// =======================================================================
// function : PreCreateWindow
// purpose :
// =======================================================================
BOOL OCC_BaseView::PreCreateWindow (CREATESTRUCT& cs)
{
cs.lpszClass = ::AfxRegisterWndClass (CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC, ::LoadCursor(NULL, IDC_ARROW), NULL, NULL);
return CView::PreCreateWindow (cs);
}
// =======================================================================
// function : OnInitialUpdate
// purpose :
// =======================================================================
void OCC_BaseView::OnInitialUpdate()
{
myCurrentMode = CurAction3d_Nothing;
CView::OnInitialUpdate();
if (!myView.IsNull())
{
return;
}
myView = GetAISContext()->CurrentViewer()->CreateView();
myView->SetImmediateUpdate (false);
myView->SetComputedMode (Standard_False);
Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast (myView->Viewer()->Driver());
myView->Camera()->SetProjectionType (aDriver->Options().contextStereo
? Graphic3d_Camera::Projection_Stereo
: Graphic3d_Camera::Projection_Orthographic);
Handle(WNT_Window) aWNTWindow = new WNT_Window (GetSafeHwnd());
myView->SetWindow (aWNTWindow);
if (!aWNTWindow->IsMapped()) aWNTWindow->Map();
myView->Redraw();
myView->Invalidate();
}
// ================================================================
// Function : GetAISContext
// Purpose :
// ================================================================
const Handle(AIS_InteractiveContext)& OCC_BaseView::GetAISContext() const
{
return ((OCC_BaseDoc*)m_pDocument)->GetInteractiveContext();
}
// ================================================================
// Function : update3dView
// Purpose :
// ================================================================
void OCC_BaseView::update3dView()
{
if (!myView.IsNull())
{
if (++myUpdateRequests == 1)
if (!theContext->IsDisplayed (myRect))
{
Invalidate (FALSE);
UpdateWindow();
theContext->Display (myRect, Standard_False);
}
else
{
theContext->Redisplay (myRect, Standard_False);
}
}
}
// ================================================================
// Function : redraw3dView
// Purpose :
// ================================================================
void OCC_BaseView::redraw3dView()
{
if (!myView.IsNull())
else
{
FlushViewEvents (GetAISContext(), myView, true);
theContext->Remove (myRect, Standard_False);
}
theContext->CurrentViewer()->RedrawImmediate();
}
// ================================================================
// Function : handleViewRedraw
// Purpose :
// ================================================================
void OCC_BaseView::handleViewRedraw (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView)
{
myUpdateRequests = 0;
AIS_ViewController::handleViewRedraw (theCtx, theView);
}
// ================================================================
// Function : OnSelectionChanged
// Purpose :
// ================================================================
void OCC_BaseView::OnSelectionChanged (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView)
{
AIS_ViewController::OnSelectionChanged (theCtx, theView);
GetDocument()->OnSelectionChanged (theCtx, theView);
}
// =======================================================================
// function : OnDraw
// purpose :
// =======================================================================
void OCC_BaseView::OnDraw (CDC* )
{
// always redraw immediate layer (dynamic highlighting) on Paint event,
// and redraw entire view content only when it is explicitly invalidated (V3d_View::Invalidate())
myView->InvalidateImmediate();
FlushViewEvents (GetAISContext(), myView, true);
}
// =======================================================================
// function : defineMouseGestures
// purpose :
// =======================================================================
void OCC_BaseView::defineMouseGestures()
{
myMouseGestureMap.Clear();
AIS_MouseGesture aRot = AIS_MouseGesture_RotateOrbit;
switch (myCurrentMode)
{
case CurAction3d_Nothing:
{
myMouseGestureMap = myDefaultGestures;
break;
}
case CurAction3d_DynamicZooming:
{
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Zoom);
break;
}
case CurAction3d_GlobalPanning:
{
break;
}
case CurAction3d_WindowZooming:
{
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_ZoomWindow);
break;
}
case CurAction3d_DynamicPanning:
{
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Pan);
break;
}
case CurAction3d_DynamicRotation:
{
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton, aRot);
break;
}
}
}
// =======================================================================
// function : OnMouseMove
// purpose :
// =======================================================================
void OCC_BaseView::OnMouseMove (UINT theFlags, CPoint thePoint)
{
TRACKMOUSEEVENT aMouseEvent; // for WM_MOUSELEAVE
aMouseEvent.cbSize = sizeof(aMouseEvent);
aMouseEvent.dwFlags = TME_LEAVE;
aMouseEvent.hwndTrack = m_hWnd;
aMouseEvent.dwHoverTime = HOVER_DEFAULT;
if (!::_TrackMouseEvent (&aMouseEvent)) { TRACE("Track ERROR!\n"); }
const Aspect_VKeyFlags aFlags = WNT_Window::MouseKeyFlagsFromEvent (theFlags);
if (UpdateMousePosition (Graphic3d_Vec2i (thePoint.x, thePoint.y), PressedMouseButtons(), aFlags, false))
{
update3dView();
}
}
// =======================================================================
// function : OnLButtonDown
// purpose :
// =======================================================================
void OCC_BaseView::OnLButtonDown (UINT theFlags, CPoint thePoint)
{
const Aspect_VKeyFlags aFlags = WNT_Window::MouseKeyFlagsFromEvent (theFlags);
PressMouseButton (Graphic3d_Vec2i (thePoint.x, thePoint.y), Aspect_VKeyMouse_LeftButton, aFlags, false);
update3dView();
}
// =======================================================================
// function : OnLButtonUp
// purpose :
// =======================================================================
void OCC_BaseView::OnLButtonUp (UINT theFlags, CPoint thePoint)
{
const Aspect_VKeyFlags aFlags = WNT_Window::MouseKeyFlagsFromEvent (theFlags);
ReleaseMouseButton (Graphic3d_Vec2i (thePoint.x, thePoint.y), Aspect_VKeyMouse_LeftButton, aFlags, false);
if (myCurrentMode == CurAction3d_GlobalPanning)
{
myView->Place (thePoint.x, thePoint.y, myCurZoom);
myView->Invalidate();
}
if (myCurrentMode != CurAction3d_Nothing)
{
setCurrentAction (CurAction3d_Nothing);
}
update3dView();
}
// =======================================================================
// function : OnMButtonDown
// purpose :
// =======================================================================
void OCC_BaseView::OnMButtonDown (UINT theFlags, CPoint thePoint)
{
const Aspect_VKeyFlags aFlags = WNT_Window::MouseKeyFlagsFromEvent (theFlags);
PressMouseButton (Graphic3d_Vec2i (thePoint.x, thePoint.y), Aspect_VKeyMouse_MiddleButton, aFlags, false);
update3dView();
}
// =======================================================================
// function : OnMButtonUp
// purpose :
// =======================================================================
void OCC_BaseView::OnMButtonUp (UINT theFlags, CPoint thePoint)
{
const Aspect_VKeyFlags aFlags = WNT_Window::MouseKeyFlagsFromEvent (theFlags);
ReleaseMouseButton (Graphic3d_Vec2i (thePoint.x, thePoint.y), Aspect_VKeyMouse_MiddleButton, aFlags, false);
update3dView();
if (myCurrentMode != CurAction3d_Nothing)
{
setCurrentAction (CurAction3d_Nothing);
}
}
// =======================================================================
// function : OnRButtonDown
// purpose :
// =======================================================================
void OCC_BaseView::OnRButtonDown (UINT theFlags, CPoint thePoint)
{
const Aspect_VKeyFlags aFlags = WNT_Window::MouseKeyFlagsFromEvent (theFlags);
PressMouseButton (Graphic3d_Vec2i (thePoint.x, thePoint.y), Aspect_VKeyMouse_RightButton, aFlags, false);
update3dView();
myClickPos.SetValues (thePoint.x, thePoint.y);
}
// =======================================================================
// function : OnRButtonUp
// purpose :
// =======================================================================
void OCC_BaseView::OnRButtonUp (UINT theFlags, CPoint thePoint)
{
const Aspect_VKeyFlags aFlags = WNT_Window::MouseKeyFlagsFromEvent (theFlags);
ReleaseMouseButton (Graphic3d_Vec2i (thePoint.x, thePoint.y), Aspect_VKeyMouse_RightButton, aFlags, false);
update3dView();
if (myCurrentMode != CurAction3d_Nothing)
{
setCurrentAction (CurAction3d_Nothing);
}
if (aFlags == Aspect_VKeyFlags_NONE
&& (myClickPos - Graphic3d_Vec2i (thePoint.x, thePoint.y)).cwiseAbs().maxComp() <= 4)
{
GetDocument()->Popup (thePoint.x, thePoint.y, myView);
}
}
// =======================================================================
// function : OnMouseWheel
// purpose :
// =======================================================================
BOOL OCC_BaseView::OnMouseWheel (UINT theFlags, short theDelta, CPoint thePoint)
{
const Standard_Real aDeltaF = Standard_Real(theDelta) / Standard_Real(WHEEL_DELTA);
CPoint aCursorPnt = thePoint;
ScreenToClient (&aCursorPnt);
const Graphic3d_Vec2i aPos (aCursorPnt.x, aCursorPnt.y);
const Aspect_VKeyFlags aFlags = WNT_Window::MouseKeyFlagsFromEvent (theFlags);
if (UpdateMouseScroll (Aspect_ScrollDelta (aPos, aDeltaF, aFlags)))
{
update3dView();
}
return true;
}
// =======================================================================
// function : OnSize
// purpose :
// =======================================================================
void OCC_BaseView::OnSize (UINT nType, int cx, int cy)
{
CView::OnSize (nType, cx, cy);
if (cx != 0
&& cy != 0
&& !myView.IsNull())
{
myView->Window()->DoResize();
myView->MustBeResized();
myView->Invalidate();
update3dView();
}
}
// =======================================================================
// function : OnMouseLeave
// purpose :
// =======================================================================
void OCC_BaseView::OnMouseLeave()
{
CPoint aCursorPos;
if (GetCursorPos (&aCursorPos))
{
ReleaseMouseButton (Graphic3d_Vec2i (aCursorPos.x, aCursorPos.y),
PressedMouseButtons(),
Aspect_VKeyMouse_NONE,
false);
}
}

View File

@@ -12,104 +12,37 @@
#include <stdafx.h>
#include "OCC_BaseDoc.h"
#include "AIS_ViewController.hxx"
#include "AIS_RubberBand.hxx"
enum CurAction3d
{
CurAction3d_Nothing,
CurAction3d_DynamicZooming,
CurAction3d_WindowZooming,
CurAction3d_DynamicPanning,
CurAction3d_GlobalPanning,
CurAction3d_DynamicRotation
};
class Standard_EXPORT OCC_BaseView : public CView, public AIS_ViewController
class Standard_EXPORT OCC_BaseView : public CView
{
public:
OCC_BaseView();
virtual ~OCC_BaseView();
//! Return the view.
const Handle(V3d_View)& GetView() const { return myView; }
void FitAll() { if ( !myView.IsNull() ) myView->FitAll(); myView->ZFitAll(); };
void Redraw() { if ( !myView.IsNull() ) myView->Redraw(); };
void SetZoom ( const Standard_Real& Coef ) { myView->SetZoom ( Coef ); };
//! Return the document.
OCC_BaseDoc* GetDocument();
//! Request view redrawing.
void update3dView();
protected:
virtual void drawRectangle (const Standard_Integer theMinX,
const Standard_Integer theMinY,
const Standard_Integer theMaxX,
const Standard_Integer theMaxY,
const Handle(AIS_InteractiveContext)& theContext,
const Standard_Boolean toDraw = Standard_True);
//! Flush events and redraw view.
void redraw3dView();
protected:
//! Handle view redraw.
virtual void handleViewRedraw (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView) Standard_OVERRIDE;
Standard_Real myCurZoom;
Standard_Integer myXmin;
Standard_Integer myYmin;
Standard_Integer myXmax;
Standard_Integer myYmax;
//! Callback called by handleMoveTo() on Selection in 3D Viewer.
virtual void OnSelectionChanged (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView) Standard_OVERRIDE;
//! Return interactive context.
virtual const Handle(AIS_InteractiveContext)& GetAISContext() const;
protected:
//! Setup mouse gestures.
void defineMouseGestures();
//! Get current action.
CurAction3d getCurrentAction() const { return myCurrentMode; }
//! Set current action.
void setCurrentAction (CurAction3d theAction)
{
myCurrentMode = theAction;
defineMouseGestures();
}
public:
virtual BOOL PreCreateWindow (CREATESTRUCT& cs) Standard_OVERRIDE;
virtual void PostNcDestroy() Standard_OVERRIDE;
protected:
Handle(V3d_View) myView;
AIS_MouseGestureMap myDefaultGestures;
Graphic3d_Vec2i myClickPos;
Standard_Real myCurZoom;
unsigned int myUpdateRequests; //!< counter for unhandled update requests
private:
CurAction3d myCurrentMode;
// message map functions
protected:
DECLARE_MESSAGE_MAP()
public:
virtual void OnInitialUpdate() Standard_OVERRIDE;
virtual void OnDraw (CDC* /*pDC*/) Standard_OVERRIDE;
afx_msg void OnSize (UINT nType, int cx, int cy);
afx_msg BOOL OnMouseWheel (UINT theFlags, short theDelta, CPoint thePoint);
afx_msg void OnMouseMove (UINT theFlags, CPoint thePoint);
afx_msg void OnMouseLeave();
afx_msg void OnLButtonDown (UINT theFlags, CPoint thePoint);
afx_msg void OnLButtonUp (UINT theFlags, CPoint thePoint);
afx_msg void OnMButtonDown (UINT theFlags, CPoint thePoint);
afx_msg void OnMButtonUp (UINT theFlags, CPoint thePoint);
afx_msg void OnRButtonDown (UINT theFlags, CPoint thePoint);
afx_msg void OnRButtonUp (UINT theFlags, CPoint thePoint);
Handle(AIS_RubberBand) myRect; //!< Rubber rectangle for selection
};
#endif // !defined(AFX_OCC_BASEVIEW_H__2E048CCA_38F9_11D7_8611_0060B0EE281E__INCLUDED_)

View File

@@ -29,46 +29,14 @@
#include <OcctWindow.h>
#include <Aspect_DisplayConnection.hxx>
namespace
{
//! Map Qt buttons bitmask to virtual keys.
Aspect_VKeyMouse qtMouseButtons2VKeys (Qt::MouseButtons theButtons)
{
Aspect_VKeyMouse aButtons = Aspect_VKeyMouse_NONE;
if ((theButtons & Qt::LeftButton) != 0)
{
aButtons |= Aspect_VKeyMouse_LeftButton;
}
if ((theButtons & Qt::MiddleButton) != 0)
{
aButtons |= Aspect_VKeyMouse_MiddleButton;
}
if ((theButtons & Qt::RightButton) != 0)
{
aButtons |= Aspect_VKeyMouse_RightButton;
}
return aButtons;
}
// the key for multi selection :
#define MULTISELECTIONKEY Qt::ShiftModifier
//! Map Qt mouse modifiers bitmask to virtual keys.
Aspect_VKeyFlags qtMouseModifiers2VKeys (Qt::KeyboardModifiers theModifiers)
{
Aspect_VKeyFlags aFlags = Aspect_VKeyFlags_NONE;
if ((theModifiers & Qt::ShiftModifier) != 0)
{
aFlags |= Aspect_VKeyFlags_SHIFT;
}
if ((theModifiers & Qt::ControlModifier) != 0)
{
aFlags |= Aspect_VKeyFlags_CTRL;
}
if ((theModifiers & Qt::AltModifier) != 0)
{
aFlags |= Aspect_VKeyFlags_ALT;
}
return aFlags;
}
}
// the key for shortcut ( use to activate dynamic rotation, panning )
#define CASCADESHORTCUTKEY Qt::ControlModifier
// for elastic bean selection
#define ValZWMin 1
static QCursor* defCursor = NULL;
static QCursor* handCursor = NULL;
@@ -92,12 +60,18 @@ View::View( Handle(AIS_InteractiveContext) theContext, QWidget* parent )
#endif
myContext = theContext;
myXmin = 0;
myYmin = 0;
myXmax = 0;
myYmax = 0;
myCurZoom = 0;
myRectBand = 0;
setAttribute(Qt::WA_PaintOnScreen);
setAttribute(Qt::WA_NoSystemBackground);
myDefaultGestures = myMouseGestureMap;
myCurrentMode = CurAction3d_Nothing;
myHlrModeIsOn = Standard_False;
setMouseTracking( true );
initViewActions();
@@ -137,8 +111,7 @@ void View::init()
void View::paintEvent( QPaintEvent * )
{
// QApplication::syncX();
myView->InvalidateImmediate();
FlushViewEvents (myContext, myView, true);
myView->Redraw();
}
void View::resizeEvent( QResizeEvent * )
@@ -150,12 +123,6 @@ void View::resizeEvent( QResizeEvent * )
}
}
void View::OnSelectionChanged (const Handle(AIS_InteractiveContext)& ,
const Handle(V3d_View)& )
{
ApplicationCommonWindow::getApplication()->onSelectionChanged();
}
void View::fitAll()
{
myView->FitAll();
@@ -165,22 +132,22 @@ void View::fitAll()
void View::fitArea()
{
setCurrentAction (CurAction3d_WindowZooming);
myCurrentMode = CurAction3d_WindowZooming;
}
void View::zoom()
{
setCurrentAction (CurAction3d_DynamicZooming);
myCurrentMode = CurAction3d_DynamicZooming;
}
void View::pan()
{
setCurrentAction (CurAction3d_DynamicPanning);
myCurrentMode = CurAction3d_DynamicPanning;
}
void View::rotation()
{
setCurrentAction (CurAction3d_DynamicRotation);
myCurrentMode = CurAction3d_DynamicRotation;
}
void View::globalPan()
@@ -190,7 +157,7 @@ void View::globalPan()
// Do a Global Zoom
myView->FitAll();
// Set the mode
setCurrentAction (CurAction3d_GlobalPanning);
myCurrentMode = CurAction3d_GlobalPanning;
}
void View::front()
@@ -236,7 +203,8 @@ void View::reset()
void View::hlrOff()
{
QApplication::setOverrideCursor( Qt::WaitCursor );
myView->SetComputedMode (false);
myHlrModeIsOn = Standard_False;
myView->SetComputedMode (myHlrModeIsOn);
myView->Redraw();
QApplication::restoreOverrideCursor();
}
@@ -244,7 +212,8 @@ void View::hlrOff()
void View::hlrOn()
{
QApplication::setOverrideCursor( Qt::WaitCursor );
myView->SetComputedMode (true);
myHlrModeIsOn = Standard_True;
myView->SetComputedMode (myHlrModeIsOn);
myView->Redraw();
QApplication::restoreOverrideCursor();
}
@@ -579,6 +548,31 @@ void View::initRaytraceActions()
myRaytraceActions->insert( ToolAntialiasingId, a );
}
void View::mousePressEvent( QMouseEvent* e )
{
if ( e->button() == Qt::LeftButton )
onLButtonDown( ( e->buttons() | e->modifiers() ), e->pos() );
else if ( e->button() == Qt::MidButton )
onMButtonDown( e->buttons() | e->modifiers(), e->pos() );
else if ( e->button() == Qt::RightButton )
onRButtonDown( e->buttons() | e->modifiers(), e->pos() );
}
void View::mouseReleaseEvent(QMouseEvent* e)
{
if ( e->button() == Qt::LeftButton )
onLButtonUp( e->buttons(), e->pos() );
else if ( e->button() == Qt::MidButton )
onMButtonUp( e->buttons(), e->pos() );
else if( e->button() == Qt::RightButton )
onRButtonUp( e->buttons(), e->pos() );
}
void View::mouseMoveEvent(QMouseEvent* e)
{
onMouseMove( e->buttons(), e->pos() );
}
void View::activateCursor( const CurrentAction3d mode )
{
switch( mode )
@@ -605,124 +599,276 @@ void View::activateCursor( const CurrentAction3d mode )
}
}
void View::mousePressEvent (QMouseEvent* theEvent)
void View::onLButtonDown( const int/*Qt::MouseButtons*/ nFlags, const QPoint point )
{
const Graphic3d_Vec2i aPnt (theEvent->pos().x(), theEvent->pos().y());
const Aspect_VKeyFlags aFlags = qtMouseModifiers2VKeys (theEvent->modifiers());
if (!myView.IsNull()
&& UpdateMouseButtons (aPnt,
qtMouseButtons2VKeys (theEvent->buttons()),
aFlags,
false))
// save the current mouse coordinate in min
myXmin = point.x();
myYmin = point.y();
myXmax = point.x();
myYmax = point.y();
if ( nFlags & CASCADESHORTCUTKEY )
{
updateView();
myCurrentMode = CurAction3d_DynamicZooming;
}
myClickPos = aPnt;
else
{
switch ( myCurrentMode )
{
case CurAction3d_Nothing:
if ( nFlags & MULTISELECTIONKEY )
MultiDragEvent( myXmax, myYmax, -1 );
else
DragEvent( myXmax, myYmax, -1 );
break;
case CurAction3d_DynamicZooming:
break;
case CurAction3d_WindowZooming:
break;
case CurAction3d_DynamicPanning:
break;
case CurAction3d_GlobalPanning:
break;
case CurAction3d_DynamicRotation:
if (myHlrModeIsOn)
{
myView->SetComputedMode (Standard_False);
}
myView->StartRotation( point.x(), point.y() );
break;
default:
throw Standard_Failure( "incompatible Current Mode" );
break;
}
}
activateCursor( myCurrentMode );
}
void View::mouseReleaseEvent (QMouseEvent* theEvent)
void View::onMButtonDown( const int/*Qt::MouseButtons*/ nFlags, const QPoint /*point*/ )
{
const Graphic3d_Vec2i aPnt (theEvent->pos().x(), theEvent->pos().y());
const Aspect_VKeyFlags aFlags = qtMouseModifiers2VKeys (theEvent->modifiers());
if (!myView.IsNull()
&& UpdateMouseButtons (aPnt,
qtMouseButtons2VKeys (theEvent->buttons()),
aFlags,
false))
{
updateView();
}
if (myCurrentMode == CurAction3d_GlobalPanning)
{
myView->Place (aPnt.x(), aPnt.y(), myCurZoom);
}
if (myCurrentMode != CurAction3d_Nothing)
{
setCurrentAction (CurAction3d_Nothing);
}
if (theEvent->button() == Qt::RightButton
&& (aFlags & Aspect_VKeyFlags_CTRL) == 0
&& (myClickPos - aPnt).cwiseAbs().maxComp() <= 4)
{
Popup (aPnt.x(), aPnt.y());
}
if ( nFlags & CASCADESHORTCUTKEY )
myCurrentMode = CurAction3d_DynamicPanning;
activateCursor( myCurrentMode );
}
void View::mouseMoveEvent (QMouseEvent* theEvent)
void View::onRButtonDown( const int/*Qt::MouseButtons*/ nFlags, const QPoint point )
{
const Graphic3d_Vec2i aNewPos (theEvent->pos().x(), theEvent->pos().y());
if (!myView.IsNull()
&& UpdateMousePosition (aNewPos,
qtMouseButtons2VKeys (theEvent->buttons()),
qtMouseModifiers2VKeys (theEvent->modifiers()),
false))
if ( nFlags & CASCADESHORTCUTKEY )
{
updateView();
if (myHlrModeIsOn)
{
myView->SetComputedMode (Standard_False);
}
myCurrentMode = CurAction3d_DynamicRotation;
myView->StartRotation( point.x(), point.y() );
}
else
{
Popup( point.x(), point.y() );
}
activateCursor( myCurrentMode );
}
//==============================================================================
//function : wheelEvent
//purpose :
//==============================================================================
void View::wheelEvent (QWheelEvent* theEvent)
void View::onLButtonUp( Qt::MouseButtons nFlags, const QPoint point )
{
const Graphic3d_Vec2i aPos (theEvent->pos().x(), theEvent->pos().y());
if (!myView.IsNull()
&& UpdateZoom (Aspect_ScrollDelta (aPos, theEvent->delta() / 8)))
{
updateView();
}
switch( myCurrentMode )
{
case CurAction3d_Nothing:
if ( point.x() == myXmin && point.y() == myYmin )
{
// no offset between down and up --> selectEvent
myXmax = point.x();
myYmax = point.y();
if ( nFlags & MULTISELECTIONKEY )
MultiInputEvent( point.x(), point.y() );
else
InputEvent( point.x(), point.y() );
}
else
{
DrawRectangle( myXmin, myYmin, myXmax, myYmax, Standard_False );
myXmax = point.x();
myYmax = point.y();
if ( nFlags & MULTISELECTIONKEY )
MultiDragEvent( point.x(), point.y(), 1 );
else
DragEvent( point.x(), point.y(), 1 );
}
break;
case CurAction3d_DynamicZooming:
myCurrentMode = CurAction3d_Nothing;
noActiveActions();
break;
case CurAction3d_WindowZooming:
DrawRectangle( myXmin, myYmin, myXmax, myYmax, Standard_False );//,LongDash);
myXmax = point.x();
myYmax = point.y();
if ( (abs( myXmin - myXmax ) > ValZWMin ) ||
(abs( myYmin - myYmax ) > ValZWMin ) )
myView->WindowFitAll( myXmin, myYmin, myXmax, myYmax );
myCurrentMode = CurAction3d_Nothing;
noActiveActions();
break;
case CurAction3d_DynamicPanning:
myCurrentMode = CurAction3d_Nothing;
noActiveActions();
break;
case CurAction3d_GlobalPanning :
myView->Place( point.x(), point.y(), myCurZoom );
myCurrentMode = CurAction3d_Nothing;
noActiveActions();
break;
case CurAction3d_DynamicRotation:
myCurrentMode = CurAction3d_Nothing;
noActiveActions();
break;
default:
throw Standard_Failure(" incompatible Current Mode ");
break;
}
activateCursor( myCurrentMode );
ApplicationCommonWindow::getApplication()->onSelectionChanged();
}
// =======================================================================
// function : updateView
// purpose :
// =======================================================================
void View::updateView()
void View::onMButtonUp( Qt::MouseButtons /*nFlags*/, const QPoint /*point*/ )
{
update();
myCurrentMode = CurAction3d_Nothing;
activateCursor( myCurrentMode );
}
void View::defineMouseGestures()
void View::onRButtonUp( Qt::MouseButtons /*nFlags*/, const QPoint point )
{
myMouseGestureMap.Clear();
AIS_MouseGesture aRot = AIS_MouseGesture_RotateOrbit;
activateCursor (myCurrentMode);
switch (myCurrentMode)
{
case CurAction3d_Nothing:
if ( myCurrentMode == CurAction3d_Nothing )
Popup( point.x(), point.y() );
else
{
noActiveActions();
myMouseGestureMap = myDefaultGestures;
break;
QApplication::setOverrideCursor( Qt::WaitCursor );
// reset tyhe good Degenerated mode according to the strored one
// --> dynamic rotation may have change it
if (myHlrModeIsOn)
{
myView->SetComputedMode (myHlrModeIsOn);
myView->Redraw();
}
QApplication::restoreOverrideCursor();
myCurrentMode = CurAction3d_Nothing;
}
case CurAction3d_DynamicZooming:
activateCursor( myCurrentMode );
}
void View::onMouseMove( Qt::MouseButtons nFlags, const QPoint point )
{
if ( nFlags & Qt::LeftButton || nFlags & Qt::RightButton || nFlags & Qt::MidButton )
{
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Zoom);
break;
}
case CurAction3d_GlobalPanning:
switch ( myCurrentMode )
{
break;
case CurAction3d_Nothing:
myXmax = point.x();
myYmax = point.y();
DrawRectangle( myXmin, myYmin, myXmax, myYmax, Standard_False );
if ( nFlags & MULTISELECTIONKEY )
MultiDragEvent( myXmax, myYmax, 0 );
else
DragEvent( myXmax, myYmax, 0 );
DrawRectangle( myXmin, myYmin, myXmax, myYmax, Standard_True );
break;
case CurAction3d_DynamicZooming:
myView->Zoom( myXmax, myYmax, point.x(), point.y() );
myXmax = point.x();
myYmax = point.y();
break;
case CurAction3d_WindowZooming:
myXmax = point.x();
myYmax = point.y();
DrawRectangle( myXmin, myYmin, myXmax, myYmax, Standard_False );
DrawRectangle( myXmin, myYmin, myXmax, myYmax, Standard_True );
break;
case CurAction3d_DynamicPanning:
myView->Pan( point.x() - myXmax, myYmax - point.y() );
myXmax = point.x();
myYmax = point.y();
break;
case CurAction3d_GlobalPanning:
break;
case CurAction3d_DynamicRotation:
myView->Rotation( point.x(), point.y() );
myView->Redraw();
break;
default:
throw Standard_Failure( "incompatible Current Mode" );
break;
}
case CurAction3d_WindowZooming:
}
else
{
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_ZoomWindow);
break;
myXmax = point.x();
myYmax = point.y();
if ( nFlags & MULTISELECTIONKEY )
MultiMoveEvent( point.x(), point.y() );
else
MoveEvent( point.x(), point.y() );
}
case CurAction3d_DynamicPanning:
}
void View::DragEvent( const int x, const int y, const int TheState )
{
// TheState == -1 button down
// TheState == 0 move
// TheState == 1 button up
static Standard_Integer theButtonDownX = 0;
static Standard_Integer theButtonDownY = 0;
if ( TheState == -1 )
{
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Pan);
break;
theButtonDownX = x;
theButtonDownY = y;
}
case CurAction3d_DynamicRotation:
if ( TheState == 1 )
{
myMouseGestureMap.Bind (Aspect_VKeyMouse_LeftButton, aRot);
break;
myContext->Select( theButtonDownX, theButtonDownY, x, y, myView, Standard_True );
emit selectionChanged();
}
}
}
void View::InputEvent( const int /*x*/, const int /*y*/ )
{
myContext->Select (Standard_True);
emit selectionChanged();
}
void View::MoveEvent( const int x, const int y )
{
myContext->MoveTo( x, y, myView, Standard_True );
}
void View::MultiMoveEvent( const int x, const int y )
{
myContext->MoveTo( x, y, myView, Standard_True );
}
void View::MultiDragEvent( const int x, const int y, const int TheState )
{
static Standard_Integer theButtonDownX = 0;
static Standard_Integer theButtonDownY = 0;
if ( TheState == -1 )
{
theButtonDownX = x;
theButtonDownY = y;
}
if ( TheState == 0 )
{
myContext->ShiftSelect( theButtonDownX, theButtonDownY, x, y, myView, Standard_True );
emit selectionChanged();
}
}
void View::MultiInputEvent( const int /*x*/, const int /*y*/ )
{
myContext->ShiftSelect (Standard_True);
emit selectionChanged();
}
void View::Popup( const int /*x*/, const int /*y*/ )
@@ -784,6 +930,49 @@ void View::addItemInPopup( QMenu* /*theMenu*/)
{
}
void View::DrawRectangle(const int MinX, const int MinY,
const int MaxX, const int MaxY, const bool Draw)
{
static Standard_Integer StoredMinX, StoredMaxX, StoredMinY, StoredMaxY;
static Standard_Boolean m_IsVisible;
StoredMinX = (MinX < MaxX) ? MinX: MaxX ;
StoredMinY = (MinY < MaxY) ? MinY: MaxY ;
StoredMaxX = (MinX > MaxX) ? MinX: MaxX ;
StoredMaxY = (MinY > MaxY) ? MinY: MaxY ;
QRect aRect;
aRect.setRect( StoredMinX, StoredMinY, abs(StoredMaxX-StoredMinX), abs(StoredMaxY-StoredMinY));
if ( !myRectBand )
{
myRectBand = new QRubberBand( QRubberBand::Rectangle, this );
myRectBand->setStyle( QStyleFactory::create("windows") );
myRectBand->setGeometry( aRect );
myRectBand->show();
/*QPalette palette;
palette.setColor(myRectBand->foregroundRole(), Qt::white);
myRectBand->setPalette(palette);*/
}
if ( m_IsVisible && !Draw ) // move or up : erase at the old position
{
myRectBand->hide();
delete myRectBand;
myRectBand = 0;
m_IsVisible = false;
}
if (Draw) // move : draw
{
//aRect.setRect( StoredMinX, StoredMinY, abs(StoredMaxX-StoredMinX), abs(StoredMaxY-StoredMinY));
m_IsVisible = true;
myRectBand->setGeometry( aRect );
//myRectBand->show();
}
}
void View::noActiveActions()
{
for ( int i = ViewFitAllId; i < ViewHlrOffId ; i++ )
@@ -863,3 +1052,6 @@ View::CurrentAction3d View::getCurrentMode()
{
return myCurrentMode;
}

View File

@@ -8,14 +8,13 @@
#include <Standard_WarningsRestore.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_ViewController.hxx>
#include <V3d_View.hxx>
class TopoDS_Shape;
class QRubberBand;
//class COMMONSAMPLE_EXPORT View: public QWidget
class View: public QWidget, protected AIS_ViewController
class View: public QWidget
{
Q_OBJECT
protected:
@@ -96,7 +95,6 @@ protected:
virtual void mousePressEvent( QMouseEvent* );
virtual void mouseReleaseEvent(QMouseEvent* );
virtual void mouseMoveEvent( QMouseEvent* );
virtual void wheelEvent (QWheelEvent* );
virtual void addItemInPopup( QMenu* );
@@ -105,41 +103,48 @@ protected:
void activateCursor( const CurrentAction3d );
void Popup( const int x, const int y );
CurrentAction3d getCurrentMode();
void updateView();
//! Setup mouse gestures.
void defineMouseGestures();
//! Set current action.
void setCurrentAction (CurrentAction3d theAction)
{
myCurrentMode = theAction;
defineMouseGestures();
}
//! Handle selection changed event.
void OnSelectionChanged (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView) Standard_OVERRIDE;
virtual void onLButtonDown( const int nFlags, const QPoint point );
virtual void onMButtonDown( const int nFlags, const QPoint point );
virtual void onRButtonDown( const int nFlags, const QPoint point );
virtual void onLButtonUp( Qt::MouseButtons nFlags, const QPoint point );
virtual void onMButtonUp( Qt::MouseButtons nFlags, const QPoint point );
virtual void onRButtonUp( Qt::MouseButtons nFlags, const QPoint point );
virtual void onMouseMove( Qt::MouseButtons nFlags, const QPoint point );
private:
void initCursors();
void initViewActions();
void initRaytraceActions();
void DragEvent( const int x, const int y, const int TheState );
void InputEvent( const int x, const int y );
void MoveEvent( const int x, const int y );
void MultiMoveEvent( const int x, const int y );
void MultiDragEvent( const int x, const int y, const int TheState );
void MultiInputEvent( const int x, const int y );
void DrawRectangle( const int MinX, const int MinY,
const int MaxX, const int MaxY, const bool Draw );
private:
bool myIsRaytracing;
bool myIsShadowsEnabled;
bool myIsReflectionsEnabled;
bool myIsAntialiasingEnabled;
bool myDrawRect; // set when a rect is used for selection or magnify
Handle(V3d_View) myView;
Handle(AIS_InteractiveContext) myContext;
AIS_MouseGestureMap myDefaultGestures;
Graphic3d_Vec2i myClickPos;
CurrentAction3d myCurrentMode;
Standard_Integer myXmin;
Standard_Integer myYmin;
Standard_Integer myXmax;
Standard_Integer myYmax;
Standard_Real myCurZoom;
Standard_Boolean myHlrModeIsOn;
QList<QAction*>* myViewActions;
QList<QAction*>* myRaytraceActions;
QMenu* myBackMenu;
QRubberBand* myRectBand; //!< selection rectangle rubber band
};
#endif

View File

@@ -21,15 +21,10 @@ enum AIS_MouseGesture
{
AIS_MouseGesture_NONE, //!< no active gesture
//
AIS_MouseGesture_SelectRectangle, //!< rectangular selection;
//! press button to start, move mouse to define rectangle, release to finish
AIS_MouseGesture_SelectLasso, //!< polygonal selection;
//! press button to start, move mouse to define polygonal path, release to finish
AIS_MouseGesture_SelectRectangle, //!< rectangular selection
AIS_MouseGesture_SelectLasso, //!< polygonal selection
//
AIS_MouseGesture_Zoom, //!< view zoom gesture;
//! move mouse left to zoom-out, and to the right to zoom-in
AIS_MouseGesture_ZoomWindow, //!< view zoom by window gesture;
//! press button to start, move mouse to define rectangle, release to finish
AIS_MouseGesture_Zoom, //!< view zoom gesture
AIS_MouseGesture_Pan, //!< view panning gesture
AIS_MouseGesture_RotateOrbit, //!< orbit rotation gesture
AIS_MouseGesture_RotateView, //!< view rotation gesture

View File

@@ -153,8 +153,9 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
}
catch (Standard_Failure const& anException)
{
Message::SendFail (TCollection_AsciiString("Error: AIS_Shape::Compute() wireframe presentation builder has failed (")
+ anException.GetMessageString() + ")");
Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ "Error: AIS_Shape::Compute() wireframe presentation builder has failed ("
+ anException.GetMessageString() + ")", Message_Fail);
}
break;
}
@@ -183,8 +184,9 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
}
catch (Standard_Failure const& anException)
{
Message::SendFail (TCollection_AsciiString("Error: AIS_Shape::Compute() shaded presentation builder has failed (")
+ anException.GetMessageString() + ")");
Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ "Error: AIS_Shape::Compute() shaded presentation builder has failed ("
+ anException.GetMessageString() + ")", Message_Fail);
StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
}
}
@@ -293,8 +295,9 @@ void AIS_Shape::computeHlrPresentation (const Handle(Graphic3d_Camera)& theProje
}
catch (Standard_Failure const& anException)
{
Message::SendFail (TCollection_AsciiString("Error: AIS_Shape::Compute() HLR Algorithm has failed (")
+ anException.GetMessageString() + ")");
Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ "Error: AIS_Shape::Compute() HLR Algorithm has failed ("
+ anException.GetMessageString() + ")", Message_Fail);
StdPrs_WFShape::Add (thePrs, theShape, theDrawer);
}
}
@@ -336,8 +339,9 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
}
catch (Standard_Failure const& anException)
{
Message::SendFail (TCollection_AsciiString("Error: AIS_Shape::ComputeSelection(") + aMode + ") has failed ("
+ anException.GetMessageString() + ")");
Message::DefaultMessenger()->Send (TCollection_AsciiString()
+ "Error: AIS_Shape::ComputeSelection(" + aMode + ") has failed ("
+ anException.GetMessageString() + ")", Message_Fail);
if (aMode == 0)
{
aSelection->Clear();

View File

@@ -37,10 +37,9 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_TextLabel,AIS_InteractiveObject)
//purpose :
//=======================================================================
AIS_TextLabel::AIS_TextLabel()
: myText ("?"),
myHasOrientation3D (Standard_False),
myHasOwnAnchorPoint (Standard_True),
myHasFlipping (Standard_False)
: myText ("?"),
myHasOrientation3D (Standard_False),
myHasFlipping (Standard_False)
{
myDrawer->SetTextAspect (new Prs3d_TextAspect());
myDrawer->SetDisplayMode (0);
@@ -323,12 +322,7 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
gp_Ax2 anOrientation = myOrientation3D;
anOrientation.SetLocation (aPosition);
Standard_Boolean aHasOwnAnchor = HasOwnAnchorPoint();
if (myHasFlipping)
{
aHasOwnAnchor = Standard_False; // always not using own anchor if flipping
}
Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (thePrs), anAsp, myText, myOrientation3D, aHasOwnAnchor);
Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (thePrs), anAsp, myText, myOrientation3D, !myHasFlipping);
if (myHasFlipping && isInit)
{
Prs3d_Root::CurrentGroup (thePrs)->SetFlippingOptions (Standard_False, gp_Ax2());

View File

@@ -102,12 +102,6 @@ public:
Standard_EXPORT Standard_Boolean HasFlipping() const;
//! Returns flag if text uses position as point of attach
Standard_Boolean HasOwnAnchorPoint() const { return myHasOwnAnchorPoint; }
//! Set flag if text uses position as point of attach
void SetOwnAnchorPoint (const Standard_Boolean theOwnAnchorPoint) { myHasOwnAnchorPoint = theOwnAnchorPoint; }
//! Define the display type of the text.
//!
//! TODT_NORMAL Default display. Text only.
@@ -137,7 +131,6 @@ protected:
TCollection_ExtendedString myText;
gp_Ax2 myOrientation3D;
Standard_Boolean myHasOrientation3D;
Standard_Boolean myHasOwnAnchorPoint;
Standard_Boolean myHasFlipping;
public:

View File

@@ -76,8 +76,8 @@ void AIS_TexturedShape::SetTextureFileName (const TCollection_AsciiString& theTe
}
else
{
Message::SendFail (TCollection_AsciiString ("Error: texture with ID ") + theTextureFileName
+ " is undefined. Texture 0 will be used instead.");
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: texture with ID ") + theTextureFileName
+ " is undefined! Texture 0 will be used instead.", Message_Fail);
myPredefTexture = Graphic3d_NameOfTexture2D (0);
}
myTextureFile = "";
@@ -311,7 +311,7 @@ void AIS_TexturedShape::updateAttributes (const Handle(Prs3d_Presentation)& theP
}
else
{
Message::SendFail (TCollection_AsciiString ("Error: texture can not be loaded ") + aTextureDesc);
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Error: texture can not be loaded ") + aTextureDesc, Message_Fail);
}
}

View File

@@ -18,12 +18,8 @@
#include <AIS_Manipulator.hxx>
#include <AIS_Point.hxx>
#include <AIS_RubberBand.hxx>
#include <AIS_XRTrackedDevice.hxx>
#include <Aspect_XRSession.hxx>
#include <Aspect_Grid.hxx>
#include <Geom_CartesianPoint.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_Texture2Dmanual.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
#include <gp_Quaternion.hxx>
@@ -64,17 +60,6 @@ AIS_ViewController::AIS_ViewController()
myPrevMoveTo (-1, -1),
myHasHlrOnBeforeRotation (false),
//
myXRPrsDevices (0, 0),
myXRLaserTeleColor (Quantity_NOC_GREEN),
myXRLaserPickColor (Quantity_NOC_BLUE),
myXRLastTeleportHand(Aspect_XRTrackedDeviceRole_Other),
myXRLastPickingHand (Aspect_XRTrackedDeviceRole_Other),
myXRLastPickDepthLeft (Precision::Infinite()),
myXRLastPickDepthRight(Precision::Infinite()),
myXRTurnAngle (M_PI_4),
myToDisplayXRAuxDevices (false),
myToDisplayXRHands (true),
//
myMouseClickThreshold (3.0),
myMouseDoubleClickInt (0.4),
myScrollZoomRatio (15.0f),
@@ -126,18 +111,6 @@ AIS_ViewController::AIS_ViewController()
myMouseGestureMap.Bind (Aspect_VKeyMouse_MiddleButton, AIS_MouseGesture_Pan);
myMouseGestureMap.Bind (Aspect_VKeyMouse_MiddleButton | Aspect_VKeyFlags_CTRL, AIS_MouseGesture_Pan);
myXRTeleportHaptic.Duration = 3600.0f;
myXRTeleportHaptic.Frequency = 0.1f;
myXRTeleportHaptic.Amplitude = 0.2f;
myXRPickingHaptic.Duration = 0.1f;
myXRPickingHaptic.Frequency = 4.0f;
myXRPickingHaptic.Amplitude = 0.1f;
myXRSelectHaptic.Duration = 0.2f;
myXRSelectHaptic.Frequency = 4.0f;
myXRSelectHaptic.Amplitude = 0.5f;
}
// =======================================================================
@@ -748,7 +721,6 @@ bool AIS_ViewController::UpdateMouseButtons (const Graphic3d_Vec2i& thePoint,
break;
}
case AIS_MouseGesture_Zoom:
case AIS_MouseGesture_ZoomWindow:
{
if (!myToAllowZooming)
{
@@ -784,8 +756,7 @@ bool AIS_ViewController::UpdateMouseButtons (const Graphic3d_Vec2i& thePoint,
if (aPrevGesture != myMouseActiveGesture)
{
if (aPrevGesture == AIS_MouseGesture_SelectRectangle
|| aPrevGesture == AIS_MouseGesture_SelectLasso
|| aPrevGesture == AIS_MouseGesture_ZoomWindow)
|| aPrevGesture == AIS_MouseGesture_SelectLasso)
{
myUI.Selection.ToApplyTool = true;
}
@@ -857,13 +828,8 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
switch (myMouseActiveGesture)
{
case AIS_MouseGesture_SelectRectangle:
case AIS_MouseGesture_ZoomWindow:
{
UpdateRubberBand (myMousePressPoint, thePoint);
if (myMouseActiveGesture == AIS_MouseGesture_ZoomWindow)
{
myUI.Selection.Tool = AIS_ViewSelectionTool_ZoomWindow;
}
toUpdateView = true;
break;
}
@@ -1314,7 +1280,6 @@ void AIS_ViewController::handlePanning (const Handle(V3d_View)& theView)
{
theView->Pan (myGL.Panning.Delta.x(), myGL.Panning.Delta.y());
theView->Invalidate();
theView->View()->SynchronizeXRPosedToBaseCamera();
return;
}
@@ -1335,7 +1300,6 @@ void AIS_ViewController::handlePanning (const Handle(V3d_View)& theView)
aPanTrsf.SetTranslation (aCameraPan);
aCam->Transform (aPanTrsf);
theView->Invalidate();
theView->View()->SynchronizeXRPosedToBaseCamera();
}
// =======================================================================
@@ -1360,7 +1324,6 @@ void AIS_ViewController::handleZRotate (const Handle(V3d_View)& theView)
aRotPnt.y() += myGL.ZRotate.Angle * aViewPort.y();
theView->Rotation (int(aRotPnt.x()), int(aRotPnt.y()));
theView->Invalidate();
theView->View()->SynchronizeXRPosedToBaseCamera();
}
// =======================================================================
@@ -1391,7 +1354,6 @@ void AIS_ViewController::handleZoom (const Handle(V3d_View)& theView,
aCoeff = theParams.Delta > 0.0 ? aCoeff : 1.0 / aCoeff;
theView->SetZoom (aCoeff, true);
theView->Invalidate();
theView->View()->SynchronizeXRPosedToBaseCamera();
return;
}
@@ -1463,7 +1425,6 @@ void AIS_ViewController::handleZoom (const Handle(V3d_View)& theView,
aPanTrsf.SetTranslation (aCameraPan);
aCam->Transform (aPanTrsf);
theView->Invalidate();
theView->View()->SynchronizeXRPosedToBaseCamera();
}
// =======================================================================
@@ -1484,7 +1445,7 @@ void AIS_ViewController::handleZFocusScroll (const Handle(V3d_View)& theView,
&& aFocus < 2.0)
{
theView->Camera()->SetZFocus (theView->Camera()->ZFocusType(), aFocus);
theView->Invalidate();
theView->Redraw();
}
}
@@ -1501,9 +1462,7 @@ void AIS_ViewController::handleOrbitRotation (const Handle(V3d_View)& theView,
return;
}
const Handle(Graphic3d_Camera)& aCam = theView->View()->IsActiveXR()
? theView->View()->BaseXRCamera()
: theView->Camera();
const Handle(Graphic3d_Camera)& aCam = theView->Camera();
if (myGL.OrbitRotation.ToStart)
{
// default alternatives
@@ -1542,13 +1501,9 @@ void AIS_ViewController::handleOrbitRotation (const Handle(V3d_View)& theView,
theView->Window()->Size (aWinXY.x(), aWinXY.y());
double aYawAngleDelta = ((myGL.OrbitRotation.PointStart.x() - myGL.OrbitRotation.PointTo.x()) / double (aWinXY.x())) * (M_PI * 0.5);
double aPitchAngleDelta = -((myGL.OrbitRotation.PointStart.y() - myGL.OrbitRotation.PointTo.y()) / double (aWinXY.y())) * (M_PI * 0.5);
double aPitchAngleNew = 0.0, aRoll = 0.0;
const double aYawAngleNew = myRotateStartYawPitchRoll[0] + aYawAngleDelta;
if (!theView->View()->IsActiveXR())
{
aPitchAngleNew = Max (Min (myRotateStartYawPitchRoll[1] + aPitchAngleDelta, M_PI * 0.5 - M_PI / 180.0), -M_PI * 0.5 + M_PI / 180.0);
aRoll = 0.0;
}
const double aPitchAngleNew = Max (Min (myRotateStartYawPitchRoll[1] + aPitchAngleDelta, M_PI * 0.5 - M_PI / 180.0), -M_PI * 0.5 + M_PI / 180.0);
const double aYawAngleNew = myRotateStartYawPitchRoll[0] + aYawAngleDelta;
const double aRoll = 0.0;
gp_Quaternion aRot;
aRot.SetEulerAngles (gp_YawPitchRoll, aYawAngleNew, aPitchAngleNew, aRoll);
@@ -1602,7 +1557,6 @@ void AIS_ViewController::handleOrbitRotation (const Handle(V3d_View)& theView,
}
theView->Invalidate();
theView->View()->SynchronizeXRBaseToPosedCamera();
}
// =======================================================================
@@ -1972,251 +1926,6 @@ void AIS_ViewController::handleCameraActions (const Handle(AIS_InteractiveContex
}
}
// =======================================================================
// function : handleXRInput
// purpose :
// =======================================================================
void AIS_ViewController::handleXRInput (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const AIS_WalkDelta& )
{
theView->View()->ProcessXRInput();
if (!theView->View()->IsActiveXR())
{
return;
}
if (myXRCameraTmp.IsNull())
{
myXRCameraTmp = new Graphic3d_Camera();
}
handleXRTurnPad (theCtx, theView);
handleXRTeleport(theCtx, theView);
handleXRPicking (theCtx, theView);
}
// =======================================================================
// function : handleXRTurnPad
// purpose :
// =======================================================================
void AIS_ViewController::handleXRTurnPad (const Handle(AIS_InteractiveContext)& ,
const Handle(V3d_View)& theView)
{
if (myXRTurnAngle <= 0.0
|| !theView->View()->IsActiveXR())
{
return;
}
// turn left/right at 45 degrees on left/right trackpad clicks
for (int aHand = 0; aHand < 2; ++aHand)
{
const Aspect_XRTrackedDeviceRole aRole = aHand == 0 ? Aspect_XRTrackedDeviceRole_RightHand : Aspect_XRTrackedDeviceRole_LeftHand;
const Handle(Aspect_XRAction)& aPadClickAct = theView->View()->XRSession()->GenericAction (aRole, Aspect_XRGenericAction_InputTrackPadClick);
const Handle(Aspect_XRAction)& aPadPosAct = theView->View()->XRSession()->GenericAction (aRole, Aspect_XRGenericAction_InputTrackPadPosition);
if (aPadClickAct.IsNull()
|| aPadPosAct.IsNull())
{
continue;
}
const Aspect_XRDigitalActionData aPadClick = theView->View()->XRSession()->GetDigitalActionData (aPadClickAct);
const Aspect_XRAnalogActionData aPadPos = theView->View()->XRSession()->GetAnalogActionData (aPadPosAct);
if (aPadClick.IsActive
&& aPadClick.IsPressed
&& aPadClick.IsChanged
&& aPadPos.IsActive
&& Abs (aPadPos.VecXYZ.y()) < 0.5f
&& Abs (aPadPos.VecXYZ.x()) > 0.7f)
{
gp_Trsf aTrsfTurn;
aTrsfTurn.SetRotation (gp_Ax1 (gp::Origin(), theView->View()->BaseXRCamera()->Up()), aPadPos.VecXYZ.x() < 0.0f ? myXRTurnAngle : -myXRTurnAngle);
theView->View()->TurnViewXRCamera (aTrsfTurn);
break;
}
}
}
// =======================================================================
// function : handleXRTeleport
// purpose :
// =======================================================================
void AIS_ViewController::handleXRTeleport (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView)
{
if (!theView->View()->IsActiveXR())
{
return;
}
// teleport on forward trackpad unclicks
const Aspect_XRTrackedDeviceRole aTeleOld = myXRLastTeleportHand;
myXRLastTeleportHand = Aspect_XRTrackedDeviceRole_Other;
for (int aHand = 0; aHand < 2; ++aHand)
{
const Aspect_XRTrackedDeviceRole aRole = aHand == 0 ? Aspect_XRTrackedDeviceRole_RightHand : Aspect_XRTrackedDeviceRole_LeftHand;
const Standard_Integer aDeviceId = theView->View()->XRSession()->NamedTrackedDevice (aRole);
if (aDeviceId == -1)
{
continue;
}
const Handle(Aspect_XRAction)& aPadClickAct = theView->View()->XRSession()->GenericAction (aRole, Aspect_XRGenericAction_InputTrackPadClick);
const Handle(Aspect_XRAction)& aPadPosAct = theView->View()->XRSession()->GenericAction (aRole, Aspect_XRGenericAction_InputTrackPadPosition);
if (aPadClickAct.IsNull()
|| aPadPosAct.IsNull())
{
continue;
}
const Aspect_XRDigitalActionData aPadClick = theView->View()->XRSession()->GetDigitalActionData (aPadClickAct);
const Aspect_XRAnalogActionData aPadPos = theView->View()->XRSession()->GetAnalogActionData (aPadPosAct);
const bool isPressed = aPadClick.IsPressed;
const bool isClicked = !aPadClick.IsPressed
&& aPadClick.IsChanged;
if (aPadClick.IsActive
&& (isPressed || isClicked)
&& aPadPos.IsActive
&& aPadPos.VecXYZ.y() > 0.6f
&& Abs (aPadPos.VecXYZ.x()) < 0.5f)
{
const Aspect_TrackedDevicePose& aPose = theView->View()->XRSession()->TrackedPoses()[aDeviceId];
if (!aPose.IsValidPose)
{
continue;
}
myXRLastTeleportHand = aRole;
Standard_Real& aPickDepth = aRole == Aspect_XRTrackedDeviceRole_LeftHand ? myXRLastPickDepthLeft : myXRLastPickDepthRight;
aPickDepth = Precision::Infinite();
Graphic3d_Vec3 aPickNorm;
const gp_Trsf aHandBase = theView->View()->PoseXRToWorld (aPose.Orientation);
const Standard_Real aHeadHeight = theView->View()->XRSession()->HeadPose().TranslationPart().Y();
{
const Standard_Integer aPickedId = handleXRMoveTo (theCtx, theView, aPose.Orientation, false);
if (aPickedId >= 1)
{
const SelectMgr_SortCriterion& aPickedData = theCtx->MainSelector()->PickedData (aPickedId);
aPickNorm = aPickedData.Normal;
if (aPickNorm.SquareModulus() > ShortRealEpsilon())
{
aPickDepth = aPickedData.Point.Distance (aHandBase.TranslationPart());
}
}
}
if (isClicked)
{
myXRLastTeleportHand = Aspect_XRTrackedDeviceRole_Other;
if (!Precision::IsInfinite (aPickDepth))
{
const gp_Dir aTeleDir = -gp::DZ().Transformed (aHandBase);
const gp_Dir anUpDir = theView->View()->BaseXRCamera()->Up();
bool isHorizontal = false;
gp_Dir aPickNormDir (aPickNorm.x(), aPickNorm.y(), aPickNorm.z());
if (anUpDir.IsEqual ( aPickNormDir, M_PI_4)
|| anUpDir.IsEqual (-aPickNormDir, M_PI_4))
{
isHorizontal = true;
}
gp_Pnt aNewEye = aHandBase.TranslationPart();
if (isHorizontal)
{
aNewEye = aHandBase.TranslationPart()
+ aTeleDir.XYZ() * aPickDepth
+ anUpDir.XYZ() * aHeadHeight;
}
else
{
if (aPickNormDir.Dot (aTeleDir) < 0.0)
{
aPickNormDir.Reverse();
}
aNewEye = aHandBase.TranslationPart()
+ aTeleDir.XYZ() * aPickDepth
- aPickNormDir.XYZ() * aHeadHeight / 4;
}
theView->View()->PosedXRCamera()->MoveEyeTo (aNewEye);
theView->View()->ComputeXRBaseCameraFromPosed (theView->View()->PosedXRCamera(), theView->View()->XRSession()->HeadPose());
}
}
break;
}
}
if (myXRLastTeleportHand != aTeleOld)
{
if (aTeleOld != Aspect_XRTrackedDeviceRole_Other)
{
if (const Handle(Aspect_XRAction)& aHaptic = theView->View()->XRSession()->GenericAction (aTeleOld, Aspect_XRGenericAction_OutputHaptic))
{
theView->View()->XRSession()->AbortHapticVibrationAction (aHaptic);
}
}
if (myXRLastTeleportHand != Aspect_XRTrackedDeviceRole_Other)
{
if (const Handle(Aspect_XRAction)& aHaptic = theView->View()->XRSession()->GenericAction (myXRLastTeleportHand, Aspect_XRGenericAction_OutputHaptic))
{
theView->View()->XRSession()->TriggerHapticVibrationAction (aHaptic, myXRTeleportHaptic);
}
}
}
}
// =======================================================================
// function : handleXRPicking
// purpose :
// =======================================================================
void AIS_ViewController::handleXRPicking (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView)
{
if (!theView->View()->IsActiveXR())
{
return;
}
// handle selection on trigger clicks
Aspect_XRTrackedDeviceRole aPickDevOld = myXRLastPickingHand;
myXRLastPickingHand = Aspect_XRTrackedDeviceRole_Other;
for (int aHand = 0; aHand < 2; ++aHand)
{
const Aspect_XRTrackedDeviceRole aRole = aHand == 0 ? Aspect_XRTrackedDeviceRole_RightHand : Aspect_XRTrackedDeviceRole_LeftHand;
const Handle(Aspect_XRAction)& aTrigClickAct = theView->View()->XRSession()->GenericAction (aRole, Aspect_XRGenericAction_InputTriggerClick);
const Handle(Aspect_XRAction)& aTrigPullAct = theView->View()->XRSession()->GenericAction (aRole, Aspect_XRGenericAction_InputTriggerPull);
if (aTrigClickAct.IsNull()
|| aTrigPullAct.IsNull())
{
continue;
}
const Aspect_XRDigitalActionData aTrigClick = theView->View()->XRSession()->GetDigitalActionData (aTrigClickAct);
const Aspect_XRAnalogActionData aTrigPos = theView->View()->XRSession()->GetAnalogActionData (aTrigPullAct);
if (aTrigPos.IsActive
&& Abs (aTrigPos.VecXYZ.x()) > 0.1f)
{
myXRLastPickingHand = aRole;
handleXRHighlight (theCtx, theView);
if (aTrigClick.IsActive
&& aTrigClick.IsPressed
&& aTrigClick.IsChanged)
{
theCtx->Select (false);
OnSelectionChanged (theCtx, theView);
if (const Handle(Aspect_XRAction)& aHaptic = theView->View()->XRSession()->GenericAction (myXRLastPickingHand, Aspect_XRGenericAction_OutputHaptic))
{
theView->View()->XRSession()->TriggerHapticVibrationAction (aHaptic, myXRSelectHaptic);
}
}
break;
}
}
if (myXRLastPickingHand != aPickDevOld)
{
theCtx->ClearDetected();
}
}
// =======================================================================
// function : OnSelectionChanged
// purpose :
@@ -2325,7 +2034,6 @@ void AIS_ViewController::contextLazyMoveTo (const Handle(AIS_InteractiveContext)
myPrevMoveTo = thePnt;
Handle(SelectMgr_EntityOwner) aLastPicked = theCtx->DetectedOwner();
theView->AutoZFit();
theCtx->MoveTo (thePnt.x(), thePnt.y(), theView, false);
Handle(SelectMgr_EntityOwner) aNewPicked = theCtx->DetectedOwner();
@@ -2405,16 +2113,14 @@ void AIS_ViewController::handleSelectionPoly (const Handle(AIS_InteractiveContex
{
// rubber-band & window polygon selection
if (myGL.Selection.Tool == AIS_ViewSelectionTool_RubberBand
|| myGL.Selection.Tool == AIS_ViewSelectionTool_Polygon
|| myGL.Selection.Tool == AIS_ViewSelectionTool_ZoomWindow)
|| myGL.Selection.Tool == AIS_ViewSelectionTool_Polygon)
{
if (!myGL.Selection.Points.IsEmpty())
{
myRubberBand->ClearPoints();
myRubberBand->SetToUpdate();
const bool anIsRubber = myGL.Selection.Tool == AIS_ViewSelectionTool_RubberBand
|| myGL.Selection.Tool == AIS_ViewSelectionTool_ZoomWindow;
const bool anIsRubber = myGL.Selection.Tool == AIS_ViewSelectionTool_RubberBand;
if (anIsRubber)
{
myRubberBand->SetRectangle (myGL.Selection.Points.First().x(), -myGL.Selection.Points.First().y(),
@@ -2441,8 +2147,8 @@ void AIS_ViewController::handleSelectionPoly (const Handle(AIS_InteractiveContex
}
catch (const Standard_Failure& theEx)
{
Message::SendWarning (TCollection_AsciiString ("Internal error while displaying rubber-band: ")
+ theEx.DynamicType()->Name() + ", " + theEx.GetMessageString());
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Internal error while displaying rubber-band: ")
+ theEx.DynamicType()->Name() + ", " + theEx.GetMessageString(), Message_Warning);
myRubberBand->ClearPoints();
}
if (!theView->Viewer()->ZLayerSettings (myRubberBand->ZLayer()).IsImmediate())
@@ -2478,28 +2184,20 @@ void AIS_ViewController::handleSelectionPoly (const Handle(AIS_InteractiveContex
{
const Graphic3d_Vec2i aPnt1 (aPoints.Value (1).x(), -aPoints.Value (1).y());
const Graphic3d_Vec2i aPnt2 (aPoints.Value (3).x(), -aPoints.Value (3).y());
if (myGL.Selection.Tool == AIS_ViewSelectionTool_ZoomWindow)
theCtx->MainSelector()->AllowOverlapDetection (aPnt1.y() != Min (aPnt1.y(), aPnt2.y()));
if (myGL.Selection.IsXOR)
{
theView->WindowFitAll (aPnt1.x(), aPnt1.y(), aPnt2.x(), aPnt2.y());
theView->Invalidate();
theCtx->ShiftSelect (Min (aPnt1.x(), aPnt2.x()), Min (aPnt1.y(), aPnt2.y()),
Max (aPnt1.x(), aPnt2.x()), Max (aPnt1.y(), aPnt2.y()),
theView, false);
}
else
{
theCtx->MainSelector()->AllowOverlapDetection (aPnt1.y() != Min (aPnt1.y(), aPnt2.y()));
if (myGL.Selection.IsXOR)
{
theCtx->ShiftSelect (Min (aPnt1.x(), aPnt2.x()), Min (aPnt1.y(), aPnt2.y()),
Max (aPnt1.x(), aPnt2.x()), Max (aPnt1.y(), aPnt2.y()),
theView, false);
}
else
{
theCtx->Select (Min (aPnt1.x(), aPnt2.x()), Min (aPnt1.y(), aPnt2.y()),
Max (aPnt1.x(), aPnt2.x()), Max (aPnt1.y(), aPnt2.y()),
theView, false);
}
theCtx->MainSelector()->AllowOverlapDetection (false);
theCtx->Select (Min (aPnt1.x(), aPnt2.x()), Min (aPnt1.y(), aPnt2.y()),
Max (aPnt1.x(), aPnt2.x()), Max (aPnt1.y(), aPnt2.y()),
theView, false);
}
theCtx->MainSelector()->AllowOverlapDetection (false);
}
else if (aPoints.Length() >= 3)
{
@@ -2512,6 +2210,7 @@ void AIS_ViewController::handleSelectionPoly (const Handle(AIS_InteractiveContex
aPolyIter.ChangeValue() = gp_Pnt2d (aNewPnt.x(), -aNewPnt.y());
}
theCtx->MainSelector()->AllowOverlapDetection (false);
if (myGL.Selection.IsXOR)
{
theCtx->ShiftSelect (aPolyline, theView, false);
@@ -2520,17 +2219,14 @@ void AIS_ViewController::handleSelectionPoly (const Handle(AIS_InteractiveContex
{
theCtx->Select (aPolyline, theView, false);
}
theCtx->MainSelector()->AllowOverlapDetection (false);
}
}
// selection affects all Views
theView->Viewer()->Invalidate();
myRubberBand->ClearPoints();
if (myGL.Selection.Tool != AIS_ViewSelectionTool_ZoomWindow)
{
// selection affects all Views
theView->Viewer()->Invalidate();
OnSelectionChanged (theCtx, theView);
}
OnSelectionChanged (theCtx, theView);
}
}
}
@@ -2557,10 +2253,9 @@ void AIS_ViewController::handleDynamicHighlight (const Handle(AIS_InteractiveCon
else if (myToAllowHighlight)
{
if (myPrevMoveTo != aMoveToPnt
|| (!theView->View()->IsActiveXR()
&& (myGL.OrbitRotation.ToRotate
|| myGL.ViewRotation.ToRotate
|| theView->IsInvalidated())))
|| myGL.OrbitRotation.ToRotate
|| myGL.ViewRotation.ToRotate
|| theView->IsInvalidated())
{
ResetPreviousMoveTo();
contextLazyMoveTo (theCtx, theView, aMoveToPnt);
@@ -2626,12 +2321,6 @@ void AIS_ViewController::handleViewRedraw (const Handle(AIS_InteractiveContext)&
setAskNextFrame();
}
if (theView->View()->IsActiveXR())
{
// VR requires continuous rendering
myToAskNextFrame = true;
}
for (V3d_ListOfViewIterator aViewIter (theView->Viewer()->ActiveViewIterator()); aViewIter.More(); aViewIter.Next())
{
const Handle(V3d_View)& aView = aViewIter.Value();
@@ -2660,266 +2349,6 @@ void AIS_ViewController::handleViewRedraw (const Handle(AIS_InteractiveContext)&
}
}
// =======================================================================
// function : handleXRMoveTo
// purpose :
// =======================================================================
Standard_Integer AIS_ViewController::handleXRMoveTo (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const gp_Trsf& thePose,
const Standard_Boolean theToHighlight)
{
//ResetPreviousMoveTo();
Standard_Integer aPickResult = 0;
Handle(Graphic3d_Camera) aCamBack = theView->Camera();
myXRCameraTmp->Copy (aCamBack);
theView->View()->ComputeXRPosedCameraFromBase (*myXRCameraTmp, thePose);
theView->SetCamera (myXRCameraTmp);
Graphic3d_Vec2i aPickPixel;
theView->Window()->Size (aPickPixel.x(), aPickPixel.y());
aPickPixel /= 2;
const Standard_Integer aSelTolerBack = theCtx->MainSelector()->CustomPixelTolerance();
theCtx->MainSelector()->SetPixelTolerance (1);
theView->AutoZFit();
if (theToHighlight)
{
theCtx->MoveTo (aPickPixel.x(), aPickPixel.y(), theView, false);
if (!theCtx->DetectedOwner().IsNull())
{
// ignore 2D objects
for (aPickResult = 1; !theCtx->DetectedOwner()->Selectable()->TransformPersistence().IsNull(); ++aPickResult)
{
if (theCtx->HilightNextDetected (theView, false) <= 1)
{
theCtx->ClearDetected();
aPickResult = 0;
break;
}
}
}
}
else
{
theCtx->MainSelector()->Pick (aPickPixel.x(), aPickPixel.y(), theView);
for (Standard_Integer aPickIter = 1; aPickIter <= theCtx->MainSelector()->NbPicked(); ++aPickIter)
{
const SelectMgr_SortCriterion& aPickedData = theCtx->MainSelector()->PickedData (aPickIter);
if (!aPickedData.Entity->OwnerId()->Selectable()->TransformPersistence().IsNull())
{
// skip 2d objects
continue;
}
aPickResult = aPickIter;
break;
}
}
theCtx->MainSelector()->SetPixelTolerance (aSelTolerBack);
theView->SetCamera (aCamBack);
return aPickResult;
}
// =======================================================================
// function : handleXRHighlight
// purpose :
// =======================================================================
void AIS_ViewController::handleXRHighlight (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView)
{
if (myXRLastPickingHand != Aspect_XRTrackedDeviceRole_LeftHand
&& myXRLastPickingHand != Aspect_XRTrackedDeviceRole_RightHand)
{
return;
}
const Standard_Integer aDeviceId = theView->View()->XRSession()->NamedTrackedDevice (myXRLastPickingHand);
if (aDeviceId == -1)
{
return;
}
const Aspect_TrackedDevicePose& aPose = theView->View()->XRSession()->TrackedPoses()[aDeviceId];
if (!aPose.IsValidPose)
{
return;
}
Handle(SelectMgr_EntityOwner) aDetOld = theCtx->DetectedOwner();
handleXRMoveTo (theCtx, theView, aPose.Orientation, true);
if (!theCtx->DetectedOwner().IsNull()
&& theCtx->DetectedOwner() != aDetOld)
{
if (const Handle(Aspect_XRAction)& aHaptic = theView->View()->XRSession()->GenericAction (myXRLastPickingHand, Aspect_XRGenericAction_OutputHaptic))
{
theView->View()->XRSession()->TriggerHapticVibrationAction (aHaptic, myXRPickingHaptic);
}
}
Standard_Real& aPickDepth = myXRLastPickingHand == Aspect_XRTrackedDeviceRole_LeftHand ? myXRLastPickDepthLeft : myXRLastPickDepthRight;
aPickDepth = Precision::Infinite();
if (theCtx->MainSelector()->NbPicked() > 0)
{
const gp_Trsf aHandBase = theView->View()->PoseXRToWorld (aPose.Orientation);
const SelectMgr_SortCriterion& aPicked = theCtx->MainSelector()->PickedData (1);
aPickDepth = aPicked.Point.Distance (aHandBase.TranslationPart());
}
}
// =======================================================================
// function : handleXRPresentations
// purpose :
// =======================================================================
void AIS_ViewController::handleXRPresentations (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView)
{
if (!theView->View()->IsActiveXR()
|| (!myToDisplayXRAuxDevices
&& !myToDisplayXRHands))
{
for (NCollection_Array1<Handle(AIS_XRTrackedDevice)>::Iterator aPrsIter (myXRPrsDevices); aPrsIter.More(); aPrsIter.Next())
{
if (!aPrsIter.Value().IsNull()
&& aPrsIter.Value()->HasInteractiveContext())
{
theCtx->Remove (aPrsIter.Value(), false);
}
aPrsIter.ChangeValue().Nullify();
}
return;
}
if (myXRPrsDevices.Length() != theView->View()->XRSession()->TrackedPoses().Length())
{
for (NCollection_Array1<Handle(AIS_XRTrackedDevice)>::Iterator aPrsIter (myXRPrsDevices); aPrsIter.More(); aPrsIter.Next())
{
if (!aPrsIter.Value().IsNull())
{
theCtx->Remove (aPrsIter.Value(), false);
}
}
myXRPrsDevices.Resize (theView->View()->XRSession()->TrackedPoses().Lower(), theView->View()->XRSession()->TrackedPoses().Upper(), false);
}
const Standard_Integer aHeadDevice = theView->View()->XRSession()->NamedTrackedDevice (Aspect_XRTrackedDeviceRole_Head);
const Standard_Integer aLeftDevice = theView->View()->XRSession()->NamedTrackedDevice (Aspect_XRTrackedDeviceRole_LeftHand);
const Standard_Integer aRightDevice = theView->View()->XRSession()->NamedTrackedDevice (Aspect_XRTrackedDeviceRole_RightHand);
for (Standard_Integer aDeviceIter = theView->View()->XRSession()->TrackedPoses().Lower(); aDeviceIter <= theView->View()->XRSession()->TrackedPoses().Upper(); ++aDeviceIter)
{
const Aspect_TrackedDevicePose& aPose = theView->View()->XRSession()->TrackedPoses()[aDeviceIter];
Handle(AIS_XRTrackedDevice)& aPosePrs = myXRPrsDevices[aDeviceIter];
if (!aPose.IsValidPose)
{
continue;
}
const bool isHand = aDeviceIter == aLeftDevice
|| aDeviceIter == aRightDevice;
if ((!myToDisplayXRHands && isHand)
|| (!myToDisplayXRAuxDevices && !isHand))
{
if (!aPosePrs.IsNull()
&& aPosePrs->HasInteractiveContext())
{
theCtx->Remove (aPosePrs, false);
}
continue;
}
Aspect_XRTrackedDeviceRole aRole = Aspect_XRTrackedDeviceRole_Other;
if (aDeviceIter == aLeftDevice)
{
aRole = Aspect_XRTrackedDeviceRole_LeftHand;
}
else if (aDeviceIter == aRightDevice)
{
aRole = Aspect_XRTrackedDeviceRole_RightHand;
}
if (!aPosePrs.IsNull()
&& aPosePrs->UnitFactor() != (float )theView->View()->UnitFactor())
{
theCtx->Remove (aPosePrs, false);
aPosePrs.Nullify();
}
if (aPosePrs.IsNull())
{
Handle(Image_Texture) aTexture;
Handle(Graphic3d_ArrayOfTriangles) aTris;
if (aDeviceIter != aHeadDevice)
{
aTris = theView->View()->XRSession()->LoadRenderModel (aDeviceIter, aTexture);
}
if (!aTris.IsNull())
{
aPosePrs = new AIS_XRTrackedDevice (aTris, aTexture);
}
else
{
aPosePrs = new AIS_XRTrackedDevice();
}
aPosePrs->SetUnitFactor ((float )theView->View()->UnitFactor());
aPosePrs->SetMutable (true);
aPosePrs->SetInfiniteState (true);
}
aPosePrs->SetRole (aRole);
if (!aPosePrs->HasInteractiveContext())
{
theCtx->Display (aPosePrs, 0, -1, false);
}
gp_Trsf aPoseLocal = aPose.Orientation;
if (aDeviceIter == aHeadDevice)
{
// show headset position on floor level
aPoseLocal.SetTranslationPart (gp_Vec (aPoseLocal.TranslationPart().X(), 0.0, aPoseLocal.TranslationPart().Z()));
}
const gp_Trsf aPoseWorld = theView->View()->PoseXRToWorld (aPoseLocal);
theCtx->SetLocation (aPosePrs, aPoseWorld);
Standard_Real aLaserLen = 0.0;
if (isHand
&& aPosePrs->Role() == myXRLastPickingHand)
{
aLaserLen = myXRLastPickingHand == Aspect_XRTrackedDeviceRole_LeftHand ? myXRLastPickDepthLeft : myXRLastPickDepthRight;
if (Precision::IsInfinite (aLaserLen))
{
const Bnd_Box aViewBox = theView->View()->MinMaxValues (true);
if (!aViewBox.IsVoid())
{
aLaserLen = Sqrt (aViewBox.SquareExtent());
}
else
{
aLaserLen = 100.0;
}
}
aPosePrs->SetLaserColor (myXRLaserPickColor);
}
else if (isHand
&& aPosePrs->Role() == myXRLastTeleportHand)
{
aLaserLen = myXRLastTeleportHand == Aspect_XRTrackedDeviceRole_LeftHand ? myXRLastPickDepthLeft : myXRLastPickDepthRight;
if (Precision::IsInfinite (aLaserLen))
{
const Bnd_Box aViewBox = theView->View()->MinMaxValues (true);
if (!aViewBox.IsVoid())
{
aLaserLen = Sqrt (aViewBox.SquareExtent());
}
else
{
aLaserLen = 100.0;
}
}
aPosePrs->SetLaserColor (myXRLaserTeleColor);
}
aPosePrs->SetLaserLength ((float )aLaserLen);
}
}
// =======================================================================
// function : HandleViewEvents
// purpose :
@@ -2927,23 +2356,11 @@ void AIS_ViewController::handleXRPresentations (const Handle(AIS_InteractiveCont
void AIS_ViewController::HandleViewEvents (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView)
{
const bool wasImmediateUpdate = theView->SetImmediateUpdate (false);
handleMoveTo (theCtx, theView);
const AIS_WalkDelta aWalk = FetchNavigationKeys (1.0, 1.0);
handleXRInput (theCtx, theView, aWalk);
if (theView->View()->IsActiveXR())
{
theView->View()->SetupXRPosedCamera();
}
handleCameraActions (theCtx, theView, aWalk);
theView->View()->SynchronizeXRPosedToBaseCamera(); // handleCameraActions() may modify posed camera position - copy this modifications also to the base camera
handleXRPresentations (theCtx, theView);
handleMoveTo (theCtx, theView);
handleViewRedraw (theCtx, theView);
theView->View()->UnsetXRPosedCamera();
theView->SetImmediateUpdate (wasImmediateUpdate);
// make sure to not process the same events twice
myGL.Reset();

View File

@@ -16,8 +16,6 @@
#include <Aspect_VKeySet.hxx>
#include <Aspect_TouchMap.hxx>
#include <Aspect_XRHapticActionData.hxx>
#include <Aspect_XRTrackedDeviceRole.hxx>
#include <AIS_DragAction.hxx>
#include <AIS_MouseGesture.hxx>
#include <AIS_NavigationMode.hxx>
@@ -30,7 +28,6 @@
#include <NCollection_Array1.hxx>
#include <OSD_Timer.hxx>
#include <Precision.hxx>
#include <Quantity_ColorRGBA.hxx>
#include <Standard_Mutex.hxx>
class AIS_AnimationCamera;
@@ -38,8 +35,6 @@ class AIS_InteractiveObject;
class AIS_InteractiveContext;
class AIS_Point;
class AIS_RubberBand;
class AIS_XRTrackedDevice;
class Graphic3d_Camera;
class V3d_View;
//! Auxiliary structure for handling viewer events between GUI and Rendering threads.
@@ -205,18 +200,6 @@ public: //! @name global parameters
//! Reset previous position of MoveTo.
void ResetPreviousMoveTo() { myPrevMoveTo = Graphic3d_Vec2i (-1); }
//! Return TRUE to display auxiliary tracked XR devices (like tracking stations).
bool ToDisplayXRAuxDevices() const { return myToDisplayXRAuxDevices; }
//! Set if auxiliary tracked XR devices should be displayed.
void SetDisplayXRAuxDevices (bool theToDisplay) { myToDisplayXRAuxDevices = theToDisplay; }
//! Return TRUE to display XR hand controllers.
bool ToDisplayXRHands() const { return myToDisplayXRHands; }
//! Set if tracked XR hand controllers should be displayed.
void SetDisplayXRHands (bool theToDisplay) { myToDisplayXRHands = theToDisplay; }
public: //! @name keyboard input
//! Return keyboard state.
@@ -565,40 +548,6 @@ public:
Standard_EXPORT virtual void handleViewRedraw (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
public:
//! Perform XR input.
//! This method is expected to be called from rendering thread.
Standard_EXPORT virtual void handleXRInput (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const AIS_WalkDelta& theWalk);
//! Handle trackpad view turn action.
Standard_EXPORT virtual void handleXRTurnPad (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Handle trackpad teleportation action.
Standard_EXPORT virtual void handleXRTeleport (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Handle picking on trigger click.
Standard_EXPORT virtual void handleXRPicking (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Perform dynamic highlighting for active hand.
Standard_EXPORT virtual void handleXRHighlight (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Display auxiliary XR presentations.
Standard_EXPORT virtual void handleXRPresentations (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Perform picking with/without dynamic highlighting for XR pose.
Standard_EXPORT virtual Standard_Integer handleXRMoveTo (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const gp_Trsf& thePose,
const Standard_Boolean theToHighlight);
protected:
//! Flush buffers.
@@ -680,23 +629,6 @@ protected:
Graphic3d_Vec2i myPrevMoveTo; //!< previous position of MoveTo event in 3D viewer
Standard_Boolean myHasHlrOnBeforeRotation; //!< flag for restoring Computed mode after rotation
protected: //! @name XR input variables
NCollection_Array1<Handle(AIS_XRTrackedDevice)> myXRPrsDevices; //!< array of XR tracked devices presentations
Handle(Graphic3d_Camera) myXRCameraTmp; //!< temporary camera
Quantity_Color myXRLaserTeleColor; //!< color of teleport laser
Quantity_Color myXRLaserPickColor; //!< color of picking laser
Aspect_XRTrackedDeviceRole myXRLastTeleportHand;//!< active hand for teleport
Aspect_XRTrackedDeviceRole myXRLastPickingHand; //!< active hand for picking objects
Aspect_XRHapticActionData myXRTeleportHaptic; //!< vibration on picking teleport destination
Aspect_XRHapticActionData myXRPickingHaptic; //!< vibration on dynamic highlighting
Aspect_XRHapticActionData myXRSelectHaptic; //!< vibration on selection
Standard_Real myXRLastPickDepthLeft; //!< last picking depth for left hand
Standard_Real myXRLastPickDepthRight; //!< last picking depth for right hand
Standard_Real myXRTurnAngle; //!< discrete turn angle for XR trackpad
Standard_Boolean myToDisplayXRAuxDevices; //!< flag to display auxiliary tracked XR devices
Standard_Boolean myToDisplayXRHands; //!< flag to display XR hands
protected: //! @name keyboard input variables
Aspect_VKeySet myKeys; //!< keyboard state

View File

@@ -25,8 +25,7 @@ enum AIS_ViewSelectionTool
{
AIS_ViewSelectionTool_Picking, //!< pick to select
AIS_ViewSelectionTool_RubberBand, //!< rubber-band to select
AIS_ViewSelectionTool_Polygon, //!< polyline to select
AIS_ViewSelectionTool_ZoomWindow, //!< zoom-in window (no selection)
AIS_ViewSelectionTool_Polygon //!< polyline to select
};
//! Input buffer type.

View File

@@ -1,202 +0,0 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <AIS_XRTrackedDevice.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_ArrayOfTriangles.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_Texture2Dmanual.hxx>
#include <Image_Texture.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_ShadingAspect.hxx>
#include <Select3D_SensitivePrimitiveArray.hxx>
#include <SelectMgr_EntityOwner.hxx>
//! Texture holder.
class AIS_XRTrackedDevice::XRTexture : public Graphic3d_Texture2Dmanual
{
public:
//! Constructor.
XRTexture (const Handle(Image_Texture)& theImageSource,
const Graphic3d_TextureUnit theUnit = Graphic3d_TextureUnit_BaseColor)
: Graphic3d_Texture2Dmanual (""), myImageSource (theImageSource)
{
if (!theImageSource->TextureId().IsEmpty())
{
myTexId = theImageSource->TextureId();
}
myParams->SetTextureUnit (theUnit);
myIsColorMap = theUnit == Graphic3d_TextureUnit_BaseColor
|| theUnit == Graphic3d_TextureUnit_Emissive;
}
//! Image reader.
virtual Handle(Image_PixMap) GetImage() const Standard_OVERRIDE { return myImageSource->ReadImage(); }
protected:
Handle(Image_Texture) myImageSource;
};
IMPLEMENT_STANDARD_RTTIEXT(AIS_XRTrackedDevice, AIS_InteractiveObject)
//=======================================================================
//function : AIS_XRTrackedDevice
//purpose :
//=======================================================================
AIS_XRTrackedDevice::AIS_XRTrackedDevice (const Handle(Graphic3d_ArrayOfTriangles)& theTris,
const Handle(Image_Texture)& theTexture)
: myTris (theTris),
myLaserColor (Quantity_NOC_BLUE),
myLaserLength (0.0f),
myUnitFactor (1.0f),
myRole (Aspect_XRTrackedDeviceRole_Other),
myToShowAxes (false)
{
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NOM_DEFAULT);
myDrawer->ShadingAspect()->SetColor (Quantity_NOC_WHITE);
if (!theTexture.IsNull())
{
myDrawer->ShadingAspect()->Aspect()->SetTextureMap (new XRTexture (theTexture));
myDrawer->ShadingAspect()->Aspect()->SetTextureMapOn (true);
}
}
//=======================================================================
//function : AIS_XRTrackedDevice
//purpose :
//=======================================================================
AIS_XRTrackedDevice::AIS_XRTrackedDevice()
: myLaserColor (Quantity_NOC_BLUE),
myLaserLength (0.0f),
myUnitFactor (1.0f),
myRole (Aspect_XRTrackedDeviceRole_Other),
myToShowAxes (true)
{
//
}
//=======================================================================
//function : SetLaserColor
//purpose :
//=======================================================================
void AIS_XRTrackedDevice::SetLaserColor (const Quantity_Color& theColor)
{
if (!myLaserColor.IsEqual (theColor))
{
myLaserColor = theColor;
computeLaserRay();
}
}
//=======================================================================
//function : SetLaserLength
//purpose :
//=======================================================================
void AIS_XRTrackedDevice::SetLaserLength (Standard_ShortReal theLength)
{
if (myLaserLength != theLength)
{
myLaserLength = theLength;
computeLaserRay();
}
}
//=======================================================================
//function : computeLaserRay
//purpose :
//=======================================================================
void AIS_XRTrackedDevice::computeLaserRay()
{
if (myRayGroup.IsNull())
{
return;
}
if (!myRayGroup->IsEmpty())
{
myRayGroup->Clear();
}
if (myLaserLength <= 0.0f)
{
return;
}
Handle(Graphic3d_ArrayOfPrimitives) aLines = new Graphic3d_ArrayOfSegments (2, 0, Graphic3d_ArrayFlags_VertexColor);
aLines->AddVertex (gp_Pnt (0.0, 0.0, 0.0), myLaserColor);
aLines->AddVertex (gp_Pnt (0.0, 0.0, -myLaserLength), myLaserColor);
myRayGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect());
myRayGroup->AddPrimitiveArray (aLines, false); // do not extend camera frustum by ray
}
//=======================================================================
//function : Compute
//purpose :
//=======================================================================
void AIS_XRTrackedDevice::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode)
{
if (theMode != 0)
{
return;
}
thePrs->SetInfiniteState (myInfiniteState);
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
if (!myTris.IsNull())
{
aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
aGroup->AddPrimitiveArray (myTris);
}
if (myToShowAxes || myTris.IsNull())
{
const float aSize = 0.1f * myUnitFactor;
aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect());
Handle(Graphic3d_ArrayOfPrimitives) aLines = new Graphic3d_ArrayOfSegments (6, 0, Graphic3d_ArrayFlags_VertexColor);
aLines->AddVertex (gp_Pnt (0.0, 0.0, 0.0), Quantity_Color (Quantity_NOC_RED));
aLines->AddVertex (gp_Pnt (aSize, 0.0, 0.0), Quantity_Color (Quantity_NOC_RED));
aLines->AddVertex (gp_Pnt (0.0, 0.0, 0.0), Quantity_Color (Quantity_NOC_GREEN));
aLines->AddVertex (gp_Pnt (0.0, aSize, 0.0), Quantity_Color (Quantity_NOC_GREEN));
aLines->AddVertex (gp_Pnt (0.0, 0.0, 0.0), Quantity_Color (Quantity_NOC_BLUE));
aLines->AddVertex (gp_Pnt (0.0, 0.0, aSize), Quantity_Color (Quantity_NOC_BLUE));
aGroup->AddPrimitiveArray (aLines);
}
myRayGroup = thePrs->NewGroup();
computeLaserRay();
}
//=======================================================================
//function : ComputeSelection
//purpose :
//=======================================================================
void AIS_XRTrackedDevice::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode)
{
if (theMode != 0)
{
return;
}
if (!myTris.IsNull())
{
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this);
Handle(Select3D_SensitivePrimitiveArray) aSensitive = new Select3D_SensitivePrimitiveArray (anOwner);
aSensitive->InitTriangulation (myTris->Attributes(), myTris->Indices(), TopLoc_Location(), true);
theSel->Add (aSensitive);
}
}

View File

@@ -1,92 +0,0 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_XRTrackedDevice_HeaderFile
#define _AIS_XRTrackedDevice_HeaderFile
#include <AIS_InteractiveObject.hxx>
#include <Aspect_XRTrackedDeviceRole.hxx>
class Graphic3d_ArrayOfTriangles;
class Image_Texture;
//! Auxiliary textured mesh presentation of tracked XR device.
class AIS_XRTrackedDevice : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(AIS_XRTrackedDevice, AIS_InteractiveObject)
public:
//! Main constructor.
Standard_EXPORT AIS_XRTrackedDevice (const Handle(Graphic3d_ArrayOfTriangles)& theTris,
const Handle(Image_Texture)& theTexture);
//! Empty constructor.
Standard_EXPORT AIS_XRTrackedDevice();
//! Return device role.
Aspect_XRTrackedDeviceRole Role() const { return myRole; }
//! Set device role.
void SetRole (Aspect_XRTrackedDeviceRole theRole) { myRole = theRole; }
//! Return laser color.
const Quantity_Color& LaserColor() const { return myLaserColor; }
//! Set laser color.
Standard_EXPORT void SetLaserColor (const Quantity_Color& theColor);
//! Return laser length.
Standard_ShortReal LaserLength() const { return myLaserLength; }
//! Set laser length.
Standard_EXPORT void SetLaserLength (Standard_ShortReal theLength);
//! Return unit scale factor.
Standard_ShortReal UnitFactor() const { return myUnitFactor; }
//! Set unit scale factor.
void SetUnitFactor (Standard_ShortReal theFactor) { myUnitFactor = theFactor; }
protected:
//! Returns true for 0 mode.
virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode == 0; }
//! Compute presentation.
Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Compute selection.
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Compute laser ray presentation.
Standard_EXPORT void computeLaserRay();
private:
//! Texture holder.
class XRTexture;
private:
Handle(Graphic3d_Group) myRayGroup;
Handle(Graphic3d_ArrayOfTriangles) myTris;
Quantity_Color myLaserColor;
Standard_ShortReal myLaserLength;
Standard_ShortReal myUnitFactor;
Aspect_XRTrackedDeviceRole myRole;
Standard_Boolean myToShowAxes;
};
#endif // _AIS_XRTrackedDevice_HeaderFile

View File

@@ -118,28 +118,3 @@ AIS_ViewInputBuffer.hxx
AIS_ViewCube.cxx
AIS_ViewCube.hxx
AIS_WalkDelta.hxx
AIS_AngleDimension.hxx
AIS_Chamf2dDimension.hxx
AIS_Chamf3dDimension.hxx
AIS_ConcentricRelation.hxx
AIS_DiameterDimension.hxx
AIS_Dimension.hxx
AIS_DimensionOwner.hxx
AIS_EllipseRadiusDimension.hxx
AIS_EqualDistanceRelation.hxx
AIS_EqualRadiusRelation.hxx
AIS_FixRelation.hxx
AIS_IdenticRelation.hxx
AIS_LengthDimension.hxx
AIS_MaxRadiusDimension.hxx
AIS_MidPointRelation.hxx
AIS_MinRadiusDimension.hxx
AIS_OffsetDimension.hxx
AIS_ParallelRelation.hxx
AIS_PerpendicularRelation.hxx
AIS_RadiusDimension.hxx
AIS_Relation.hxx
AIS_SymmetricRelation.hxx
AIS_TangentRelation.hxx
AIS_XRTrackedDevice.cxx
AIS_XRTrackedDevice.hxx

View File

@@ -378,3 +378,11 @@ Standard_Integer Adaptor2d_Curve2d::NbSamples() const
return 20;
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Adaptor2d_Curve2d::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_CLASS_BEGIN (theOStream, Adaptor2d_Curve2d)
}

View File

@@ -158,6 +158,8 @@ public:
Standard_EXPORT virtual Handle(Geom2d_BSplineCurve) BSpline() const;
Standard_EXPORT virtual ~Adaptor2d_Curve2d();
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;

View File

@@ -118,6 +118,9 @@ public:
virtual Handle(Geom2d_BSplineCurve) BSpline() const;
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
DEFINE_STANDARD_RTTIEXT(Adaptor2d_HCurve2d,Standard_Transient)
};

View File

@@ -294,3 +294,11 @@ inline Standard_Integer Adaptor2d_HCurve2d::NbKnots() const
return Curve2d().BSpline();
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
inline void Adaptor2d_HCurve2d::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_CLASS_BEGIN (theOStream, Adaptor2d_HCurve2d)
}

View File

@@ -364,3 +364,12 @@ Handle(Geom_OffsetCurve) Adaptor3d_Curve::OffsetCurve() const
{
throw Standard_NotImplemented("Adaptor3d_Curve::OffsetCurve");
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Adaptor3d_Curve::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_CLASS_BEGIN (theOStream, Adaptor3d_Curve)
}

View File

@@ -161,6 +161,8 @@ public:
Standard_EXPORT virtual ~Adaptor3d_Curve();
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;

View File

@@ -1796,5 +1796,23 @@ void Adaptor3d_CurveOnSurface::LocatePart(const gp_Pnt2d& UV, const gp_Vec2d& DU
}
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Adaptor3d_CurveOnSurface::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_CLASS_BEGIN (theOStream, Adaptor3d_CurveOnSurface)
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Adaptor3d_CurveOnSurface)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myType)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCirc)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myLin)
if (!myIntervals.IsNull())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIntervals->Length())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIntCont)
}

View File

@@ -181,6 +181,9 @@ public:
Standard_EXPORT Handle(Geom_BSplineCurve) BSpline() const Standard_OVERRIDE;
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;

View File

@@ -137,6 +137,8 @@ public:
Handle(Geom_OffsetCurve) OffsetCurve() const;
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
DEFINE_STANDARD_RTTIEXT(Adaptor3d_HCurve,Standard_Transient)

View File

@@ -302,3 +302,12 @@ inline Standard_Integer Adaptor3d_HCurve::NbKnots() const
{
return Curve().OffsetCurve();
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
inline void Adaptor3d_HCurve::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_CLASS_BEGIN (theOStream, Adaptor3d_HCurve)
}

View File

@@ -59,6 +59,8 @@ public:
//! Returns the curve used to create the GenHCurve.
Adaptor3d_CurveOnSurface& ChangeCurve();
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;

View File

@@ -40,3 +40,14 @@
#define Handle_Adaptor3d_GenHCurve Handle(Adaptor3d_HCurveOnSurface)
#include <Adaptor3d_GenHCurve.gxx>
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Adaptor3d_HCurveOnSurface::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Adaptor3d_HCurve)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCurve)
}

View File

@@ -161,6 +161,8 @@ public:
Standard_Real OffsetValue() const;
//! Dumps the content of me into the stream
virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;

View File

@@ -483,3 +483,12 @@ inline Standard_Boolean Adaptor3d_HSurface::IsVRational() const
{
return Surface().OffsetValue();
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
inline void Adaptor3d_HSurface::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
}

View File

@@ -571,3 +571,12 @@ Standard_Real Adaptor3d_Surface::OffsetValue() const
{
throw Standard_NotImplemented("Adaptor3d_Surface::OffsetValue");
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void Adaptor3d_Surface::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_CLASS_BEGIN (theOStream, Adaptor3d_Surface)
}

View File

@@ -20,6 +20,7 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_OStream.hxx>
#include <Standard_Real.hxx>
#include <GeomAbs_Shape.hxx>
@@ -211,6 +212,9 @@ public:
Standard_EXPORT virtual Standard_Real OffsetValue() const;
Standard_EXPORT virtual ~Adaptor3d_Surface();
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;

View File

@@ -244,7 +244,7 @@ void AdvApp2Var_ApproxAFunc2Var::InitGrid(const Standard_Integer NbInt)
{
Standard_Integer iu=myConditions.UOrder(),iv=myConditions.VOrder(),iint;
Handle(AdvApp2Var_Patch) M0 = new AdvApp2Var_Patch (myFirstParInU,myLastParInU,myFirstParInV,myLastParInV,iu,iv);
AdvApp2Var_Patch M0(myFirstParInU,myLastParInU,myFirstParInV,myLastParInV,iu,iv);
AdvApp2Var_SequenceOfPatch Net;
Net.Append(M0);
@@ -259,29 +259,29 @@ void AdvApp2Var_ApproxAFunc2Var::InitGrid(const Standard_Integer NbInt)
gp_XY UV1(myFirstParInU,myFirstParInV);
Handle(AdvApp2Var_Node) C1 = new AdvApp2Var_Node (UV1,iu,iv);
AdvApp2Var_Node C1(UV1,iu,iv);
gp_XY UV2(myLastParInU,myFirstParInV);
Handle(AdvApp2Var_Node) C2 = new AdvApp2Var_Node (UV2,iu,iv);
AdvApp2Var_Node C2(UV2,iu,iv);
gp_XY UV4(myLastParInU,myLastParInV);
Handle(AdvApp2Var_Node) C4 = new AdvApp2Var_Node (UV4,iu,iv);
AdvApp2Var_Node C4(UV4,iu,iv);
gp_XY UV3(myFirstParInU,myLastParInV);
Handle(AdvApp2Var_Node) C3 = new AdvApp2Var_Node (UV3,iu,iv);
AdvApp2Var_Node C3(UV3,iu,iv);
AdvApp2Var_SequenceOfNode Bag;
Bag.Append(C1);
Bag.Append(C2);
Bag.Append(C3);
Bag.Append(C4);
Handle(AdvApp2Var_Iso) V0 = new AdvApp2Var_Iso (GeomAbs_IsoV,myFirstParInV,
AdvApp2Var_Iso V0(GeomAbs_IsoV,myFirstParInV,
myFirstParInU,myLastParInU,myFirstParInV,myLastParInV,
1,iu,iv);
Handle(AdvApp2Var_Iso) V1 = new AdvApp2Var_Iso (GeomAbs_IsoV,myLastParInV,
AdvApp2Var_Iso V1(GeomAbs_IsoV,myLastParInV,
myFirstParInU,myLastParInU,myFirstParInV,myLastParInV,
2,iu,iv);
Handle(AdvApp2Var_Iso) U0 = new AdvApp2Var_Iso (GeomAbs_IsoU,myFirstParInU,
AdvApp2Var_Iso U0(GeomAbs_IsoU,myFirstParInU,
myFirstParInU,myLastParInU,myFirstParInV,myLastParInV,
3,iu,iv);
Handle(AdvApp2Var_Iso) U1 = new AdvApp2Var_Iso (GeomAbs_IsoU,myLastParInU,
AdvApp2Var_Iso U1(GeomAbs_IsoU,myLastParInU,
myFirstParInU,myLastParInU,myFirstParInV,myLastParInV,
4,iu,iv);
@@ -557,74 +557,68 @@ void AdvApp2Var_ApproxAFunc2Var::ComputeConstraints(const AdvApprox_Cutting& UCh
Standard_Real dec;
Standard_Boolean more;
Standard_Integer ind1, ind2, NbPatch, NbU, NbV;
AdvApp2Var_Iso Is;
Standard_Integer indN1, indN2;
Standard_Integer iu = myConditions.UOrder(), iv = myConditions.VOrder();
AdvApp2Var_Node N1(iu,iv), N2(iu,iv);
for (Handle(AdvApp2Var_Iso) anIso = myConstraints.FirstNotApprox(ind1, ind2); !anIso.IsNull(); anIso = myConstraints.FirstNotApprox(ind1, ind2))
{
// approximation of iso and calculation of constraints at extremities
const Standard_Integer indN1 = myConstraints.FirstNode(anIso->Type(),ind1,ind2);
N1 = *myConstraints.Node(indN1);
const Standard_Integer indN2 = myConstraints.LastNode(anIso->Type(),ind1,ind2);
N2 = *myConstraints.Node(indN2);
while ( myConstraints.FirstNotApprox(ind1, ind2, Is) ) {
// note that old code attempted to make copy of anIso here (but copy was incomplete)
anIso->MakeApprox (myConditions,
myFirstParInU, myLastParInU,
myFirstParInV, myLastParInV,
Func, N1 , N2);
if (anIso->IsApproximated())
{
// iso is approached at the required tolerance
myConstraints.ChangeIso(ind1,ind2,anIso);
*myConstraints.Node(indN1) = N1;
*myConstraints.Node(indN2) = N2;
// approximation of iso and calculation of constraints at extremities
indN1 = myConstraints.FirstNode(Is.Type(),ind1,ind2);
N1 = myConstraints.Node(indN1);
indN2 = myConstraints.LastNode(Is.Type(),ind1,ind2);
N2 = myConstraints.Node(indN2);
Is.MakeApprox(myConditions,
myFirstParInU, myLastParInU,
myFirstParInV, myLastParInV,
Func, N1 , N2);
if (Is.IsApproximated()) {
// iso is approached at the required tolerance
myConstraints.ChangeIso(ind1,ind2,Is);
myConstraints.ChangeNode(indN1) = N1;
myConstraints.ChangeNode(indN2) = N2;
}
else
{
// Approximation is not satisfactory
else {
// Approximation is not satisfactory
NbU = myResult.NbPatchInU();
NbV = myResult.NbPatchInV();
if (anIso->Type()==GeomAbs_IsoV)
{
NbPatch = (NbU+1)*NbV;
more = UChoice.Value(anIso->T0(), anIso->T1(), dec);
if (Is.Type()==GeomAbs_IsoV) {
NbPatch = (NbU+1)*NbV;
more = UChoice.Value(Is.T0(),Is.T1(),dec);
}
else
{
NbPatch = (NbV+1)*NbU;
more = VChoice.Value(anIso->T0(),anIso->T1(),dec);
else {
NbPatch = (NbV+1)*NbU;
more = VChoice.Value(Is.T0(),Is.T1(),dec);
}
if (NbPatch<=myMaxPatches && more)
{
// It is possible to cut iso
if (anIso->Type()==GeomAbs_IsoV)
{
myResult.UpdateInU(dec);
myConstraints.UpdateInU(dec);
}
else
{
myResult.UpdateInV(dec);
myConstraints.UpdateInV(dec);
}
if (NbPatch<=myMaxPatches && more) {
// It is possible to cut iso
if (Is.Type()==GeomAbs_IsoV) {
myResult.UpdateInU(dec);
myConstraints.UpdateInU(dec);
}
else {
myResult.UpdateInV(dec);
myConstraints.UpdateInV(dec);
}
}
else
{
// It is not possible to cut : the result is preserved
if (anIso->HasResult())
{
anIso->OverwriteApprox();
myConstraints.ChangeIso(ind1,ind2,anIso);
*myConstraints.Node(indN1) = N1;
*myConstraints.Node(indN2) = N2;
}
else
{
myHasResult = myDone = Standard_False;
throw Standard_ConstructionError("AdvApp2Var_ApproxAFunc2Var : Curve Approximation Error");
}
else {
// It is not possible to cut : the result is preserved
if (Is.HasResult()) {
Is.OverwriteApprox();
myConstraints.ChangeIso(ind1,ind2,Is);
myConstraints.ChangeNode(indN1) = N1;
myConstraints.ChangeNode(indN2) = N2;
}
else {
myHasResult = myDone = Standard_False;
throw Standard_ConstructionError("AdvApp2Var_ApproxAFunc2Var : Curve Approximation Error");
}
}
}
}
@@ -644,82 +638,74 @@ void AdvApp2Var_ApproxAFunc2Var::ComputeConstraints(const AdvApprox_Cutting& UCh
Standard_Real dec;
Standard_Boolean more, CritRel = (Crit.Type() == AdvApp2Var_Relative);
Standard_Integer ind1, ind2, NbPatch, NbU, NbV;
AdvApp2Var_Iso Is;
Standard_Integer indN1, indN2;
Standard_Integer iu = myConditions.UOrder(), iv = myConditions.VOrder();
AdvApp2Var_Node N1(iu,iv), N2(iu,iv);
for (Handle(AdvApp2Var_Iso) anIso = myConstraints.FirstNotApprox(ind1, ind2); !anIso.IsNull(); anIso = myConstraints.FirstNotApprox(ind1, ind2))
{
// approximation of the iso and calculation of constraints at the extremities
indN1 = myConstraints.FirstNode(anIso->Type(),ind1,ind2);
N1 = *myConstraints.Node(indN1);
indN2 = myConstraints.LastNode(anIso->Type(),ind1,ind2);
N2 = *myConstraints.Node(indN2);
while ( myConstraints.FirstNotApprox(ind1, ind2, Is) ) {
// note that old code attempted to make copy of anIso here (but copy was incomplete)
anIso->MakeApprox (myConditions,
myFirstParInU, myLastParInU,
myFirstParInV, myLastParInV,
Func, N1 , N2);
// approximation of the iso and calculation of constraints at the extremities
indN1 = myConstraints.FirstNode(Is.Type(),ind1,ind2);
N1 = myConstraints.Node(indN1);
indN2 = myConstraints.LastNode(Is.Type(),ind1,ind2);
N2 = myConstraints.Node(indN2);
if (anIso->IsApproximated())
{
// iso is approached at the required tolerance
myConstraints.ChangeIso(ind1,ind2,anIso);
*myConstraints.Node(indN1) = N1;
*myConstraints.Node(indN2) = N2;
}
else
{
// Approximation is not satisfactory
NbU = myResult.NbPatchInU();
NbV = myResult.NbPatchInV();
if (anIso->Type()==GeomAbs_IsoV)
{
NbPatch = (NbU+1)*NbV;
more = UChoice.Value(anIso->T0(),anIso->T1(),dec);
}
else
{
NbPatch = (NbV+1)*NbU;
more = VChoice.Value(anIso->T0(),anIso->T1(),dec);
Is.MakeApprox(myConditions,
myFirstParInU, myLastParInU,
myFirstParInV, myLastParInV,
Func, N1 , N2);
if (Is.IsApproximated()) {
// iso is approached at the required tolerance
myConstraints.ChangeIso(ind1,ind2,Is);
myConstraints.ChangeNode(indN1) = N1;
myConstraints.ChangeNode(indN2) = N2;
}
// To force Overwrite if the criterion is Absolute
more = more && (CritRel);
else {
// Approximation is not satisfactory
NbU = myResult.NbPatchInU();
NbV = myResult.NbPatchInV();
if (Is.Type()==GeomAbs_IsoV) {
NbPatch = (NbU+1)*NbV;
more = UChoice.Value(Is.T0(),Is.T1(),dec);
}
else {
NbPatch = (NbV+1)*NbU;
more = VChoice.Value(Is.T0(),Is.T1(),dec);
}
if (NbPatch<=myMaxPatches && more)
{
// It is possible to cut iso
if (anIso->Type()==GeomAbs_IsoV)
{
myResult.UpdateInU(dec);
myConstraints.UpdateInU(dec);
}
else
{
myResult.UpdateInV(dec);
myConstraints.UpdateInV(dec);
}
}
else
{
// It is not possible to cut: the result is preserved
if (anIso->HasResult())
{
anIso->OverwriteApprox();
myConstraints.ChangeIso(ind1,ind2,anIso);
*myConstraints.Node(indN1) = N1;
*myConstraints.Node(indN2) = N2;
}
else
{
myHasResult = myDone = Standard_False;
throw Standard_ConstructionError("AdvApp2Var_ApproxAFunc2Var : Curve Approximation Error");
}
// To force Overwrite if the criterion is Absolute
more = more && (CritRel);
if (NbPatch<=myMaxPatches && more) {
// It is possible to cut iso
if (Is.Type()==GeomAbs_IsoV) {
myResult.UpdateInU(dec);
myConstraints.UpdateInU(dec);
}
else {
myResult.UpdateInV(dec);
myConstraints.UpdateInV(dec);
}
}
else {
// It is not possible to cut: the result is preserved
if (Is.HasResult()) {
Is.OverwriteApprox();
myConstraints.ChangeIso(ind1,ind2,Is);
myConstraints.ChangeNode(indN1) = N1;
myConstraints.ChangeNode(indN2) = N2;
}
else {
myHasResult = myDone = Standard_False;
throw Standard_ConstructionError("AdvApp2Var_ApproxAFunc2Var : Curve Approximation Error");
}
}
}
}
}
}
//=======================================================================

View File

@@ -57,30 +57,43 @@ AdvApp2Var_Framework::AdvApp2Var_Framework(const AdvApp2Var_SequenceOfNode& Fram
//purpose : return the first Iso not approximated
//==========================================================================================
Handle(AdvApp2Var_Iso) AdvApp2Var_Framework::FirstNotApprox(Standard_Integer& IndexIso,
Standard_Integer& IndexStrip) const
Standard_Boolean AdvApp2Var_Framework::FirstNotApprox(Standard_Integer& IndexIso,
Standard_Integer& IndexStrip,
AdvApp2Var_Iso& anIso) const
{
for (int anUVIter = 0; anUVIter < 2; ++anUVIter)
{
const AdvApp2Var_SequenceOfStrip& aSeq = anUVIter == 0 ? myUConstraints : myVConstraints;
Standard_Integer i = 1;
for (AdvApp2Var_SequenceOfStrip::Iterator aConstIter (aSeq); aConstIter.More(); aConstIter.Next(), i++)
{
const AdvApp2Var_Strip& S = aConstIter.Value();
Standard_Integer j = 1;
for (AdvApp2Var_Strip::Iterator anIsoIter (S); anIsoIter.More(); anIsoIter.Next(), j++)
{
const Handle(AdvApp2Var_Iso)& anIso = anIsoIter.Value();
if (!anIso->IsApproximated())
{
IndexIso = j;
IndexStrip = i;
return anIso;
}
Standard_Boolean good = Standard_True;
Standard_Integer i,j;
AdvApp2Var_Strip S;
for (i = 1; i <= myUConstraints.Length() && good ; i++) {
S = myUConstraints.Value(i);
for (j = 1; j <= S.Length() && good ; j++) {
good = (S.Value(j)).IsApproximated();
if (!good) {
IndexIso = j;
IndexStrip = i;
anIso = S.Value(j);
}
}
}
return Handle(AdvApp2Var_Iso)();
if (!good) {
goto FINISH;
}
for (i = 1; i <= myVConstraints.Length() && good; i++) {
S = myVConstraints.Value(i);
for (j = 1; j <= S.Length() && good ; j++) {
good = (S.Value(j)).IsApproximated();
if (!good) {
IndexIso = j;
IndexStrip = i;
anIso = S.Value(j);
}
}
}
FINISH:
return !good;
}
//==========================================================================================
@@ -132,12 +145,19 @@ Standard_Integer AdvApp2Var_Framework::LastNode(const GeomAbs_IsoType Type,
void AdvApp2Var_Framework::ChangeIso(const Standard_Integer IndexIso,
const Standard_Integer IndexStrip,
const Handle(AdvApp2Var_Iso)& theIso)
const AdvApp2Var_Iso& anIso)
{
AdvApp2Var_Strip& S0 = theIso->Type() == GeomAbs_IsoV
? myUConstraints.ChangeValue (IndexStrip)
: myVConstraints.ChangeValue (IndexStrip);
S0.SetValue (IndexIso, theIso);
AdvApp2Var_Strip S0;
if (anIso.Type()==GeomAbs_IsoV) {
S0 = myUConstraints.Value(IndexStrip);
S0.SetValue(IndexIso,anIso);
myUConstraints.SetValue(IndexStrip,S0);
}
else {
S0 = myVConstraints.Value(IndexStrip);
S0.SetValue(IndexIso,anIso);
myVConstraints.SetValue(IndexStrip,S0);
}
}
//==========================================================================================
@@ -145,19 +165,16 @@ void AdvApp2Var_Framework::ChangeIso(const Standard_Integer IndexIso,
//purpose : return the node of coordinates (U,V)
//==========================================================================================
const Handle(AdvApp2Var_Node)& AdvApp2Var_Framework::Node(const Standard_Real U,
const AdvApp2Var_Node& AdvApp2Var_Framework::Node(const Standard_Real U,
const Standard_Real V) const
{
for (AdvApp2Var_SequenceOfNode::Iterator aNodeIter (myNodeConstraints); aNodeIter.More(); aNodeIter.Next())
{
const Handle(AdvApp2Var_Node)& aNode = aNodeIter.Value();
if (aNode->Coord().X() == U
&& aNode->Coord().Y() == V)
{
return aNode;
}
Standard_Integer Index=1;
while ( ( ((myNodeConstraints.Value(Index)).Coord()).X() != U
|| ((myNodeConstraints.Value(Index)).Coord()).Y() != V )
&& (Index<myNodeConstraints.Length()) ) {
Index++;
}
return myNodeConstraints.Last();
return myNodeConstraints.Value(Index);
}
//==========================================================================================
@@ -170,20 +187,17 @@ AdvApp2Var_Framework::IsoU(const Standard_Real U,
const Standard_Real V0,
const Standard_Real V1) const
{
Standard_Integer IndexStrip = 1;
while (IndexStrip < myVConstraints.Length()
&& (myVConstraints.Value(IndexStrip).First()->T0() != V0
|| myVConstraints.Value(IndexStrip).First()->T1() != V1))
{
Standard_Integer IndexStrip=1,IndexIso=1;
while ( ( ((myVConstraints.Value(IndexStrip)).Value(1)).T0() != V0
|| ((myVConstraints.Value(IndexStrip)).Value(1)).T1() != V1 )
&& (IndexStrip<myVConstraints.Length()) ) {
IndexStrip++;
}
Standard_Integer IndexIso = 1;
while (IndexIso<=myUConstraints.Length()
&& myVConstraints.Value(IndexStrip).Value(IndexIso)->Constante() != U)
{
while ( ( ((myVConstraints.Value(IndexStrip)).Value(IndexIso)).Constante() != U)
&& (IndexIso<=myUConstraints.Length()) ) {
IndexIso++;
}
return *(myVConstraints.Value(IndexStrip).Value(IndexIso));
return (myVConstraints.Value(IndexStrip)).Value(IndexIso);
}
//==========================================================================================
@@ -196,20 +210,17 @@ AdvApp2Var_Framework::IsoV(const Standard_Real U0,
const Standard_Real U1,
const Standard_Real V) const
{
Standard_Integer IndexStrip = 1;
while (IndexStrip < myUConstraints.Length()
&& (myUConstraints.Value(IndexStrip).First()->T0() != U0
|| myUConstraints.Value(IndexStrip).First()->T1() != U1))
{
Standard_Integer IndexStrip=1,IndexIso=1;
while ( ( ((myUConstraints.Value(IndexStrip)).Value(1)).T0() != U0
|| ((myUConstraints.Value(IndexStrip)).Value(1)).T1() != U1 )
&& (IndexStrip<myUConstraints.Length()) ) {
IndexStrip++;
}
Standard_Integer IndexIso = 1;
while (IndexIso<=myVConstraints.Length()
&& myUConstraints.Value(IndexStrip).Value(IndexIso)->Constante() != V)
{
while ( ( ((myUConstraints.Value(IndexStrip)).Value(IndexIso)).Constante() != V)
&& (IndexIso<=myVConstraints.Length()) ) {
IndexIso++;
}
return *(myUConstraints.Value(IndexStrip).Value(IndexIso));
return (myUConstraints.Value(IndexStrip)).Value(IndexIso);
}
//==========================================================================================
@@ -219,74 +230,65 @@ AdvApp2Var_Framework::IsoV(const Standard_Real U0,
void AdvApp2Var_Framework::UpdateInU(const Standard_Real CuttingValue)
{
Standard_Integer i = 1;
for (AdvApp2Var_SequenceOfStrip::Iterator anUConstIter (myUConstraints); anUConstIter.More(); anUConstIter.Next(), ++i)
{
if (anUConstIter.Value().First()->U0() <= CuttingValue
&& anUConstIter.Value().First()->U1() >= CuttingValue)
{
break;
}
Standard_Integer i=1,j;
while (((myUConstraints.Value(i)).Value(1)).U0()>CuttingValue
|| ((myUConstraints.Value(i)).Value(1)).U1()<CuttingValue) {
i++;
}
AdvApp2Var_Strip S0;
AdvApp2Var_Iso Is;
S0 = myUConstraints.Value(i);
Standard_Real Udeb = (S0.Value(1)).U0(), Ufin = (S0.Value(1)).U1();
{
const AdvApp2Var_Strip& S0 = myUConstraints.Value(i);
const Standard_Real Udeb = S0.First()->U0(), Ufin = S0.First()->U1();
// modification des Isos V de la bande en U d'indice i
for (AdvApp2Var_Strip::Iterator aStripIter (S0); aStripIter.More(); aStripIter.Next())
{
const Handle(AdvApp2Var_Iso)& anIso = aStripIter.Value();
anIso->ChangeDomain (Udeb, CuttingValue);
anIso->ResetApprox();
}
// insertion d'une nouvelle bande en U apres l'indice i
AdvApp2Var_Strip aNewStrip;
for (AdvApp2Var_Strip::Iterator aStripIter (S0); aStripIter.More(); aStripIter.Next())
{
const Handle(AdvApp2Var_Iso)& anIso = aStripIter.Value();
Handle(AdvApp2Var_Iso) aNewIso = new AdvApp2Var_Iso (anIso->Type(), anIso->Constante(),
CuttingValue, Ufin, anIso->V0(), anIso->V1(),
0, anIso->UOrder(), anIso->VOrder());
aNewIso->ResetApprox();
aNewStrip.Append (aNewIso);
}
myUConstraints.InsertAfter (i, aNewStrip);
// modification des Isos V de la bande en U d'indice i
for (j=1;j<=S0.Length();j++) {
Is = S0.Value(j);
Is.ChangeDomain(Udeb,CuttingValue);
Is.ResetApprox();
S0.SetValue(j,Is);
}
myUConstraints.SetValue(i,S0);
// insertion d'une nouvelle bande en U apres l'indice i
AdvApp2Var_Strip NewStrip;
for (j=1;j<=S0.Length();j++) {
AdvApp2Var_Iso NewIso((S0.Value(j)).Type(),(S0.Value(j)).Constante(),
CuttingValue,Ufin,(S0.Value(j)).V0(),(S0.Value(j)).V1(),
0,(S0.Value(j)).UOrder(),(S0.Value(j)).VOrder());
NewIso.ResetApprox();
NewStrip.Append(NewIso);
}
myUConstraints.InsertAfter(i,NewStrip);
// insertion d'une nouvelle Iso U=U* dans chaque bande en V apres l'indice i
// et restriction des paves des Isos adjacentes
for (Standard_Integer j = 1; j <= myVConstraints.Length(); j++)
{
AdvApp2Var_Strip& S0 = myVConstraints.ChangeValue(j);
Handle(AdvApp2Var_Iso) anIso = S0.Value(i);
anIso->ChangeDomain (anIso->U0(), CuttingValue, anIso->V0(), anIso->V1());
Handle(AdvApp2Var_Iso) aNewIso = new AdvApp2Var_Iso (anIso->Type(), CuttingValue, anIso->U0(), CuttingValue, anIso->V0(), anIso->V1(),
0, anIso->UOrder(), anIso->VOrder());
aNewIso->ResetApprox();
S0.InsertAfter (i, aNewIso);
anIso = S0.Value(i+2);
anIso->ChangeDomain (CuttingValue, anIso->U1(), anIso->V0(), anIso->V1());
for (j=1;j<=myVConstraints.Length();j++) {
S0 = myVConstraints.Value(j);
Is = S0.Value(i);
Is.ChangeDomain(Is.U0(),CuttingValue,Is.V0(),Is.V1());
S0.SetValue(i,Is);
AdvApp2Var_Iso NewIso(Is.Type(),CuttingValue,Is.U0(),CuttingValue,Is.V0(),Is.V1(),
0,Is.UOrder(),Is.VOrder());
NewIso.ResetApprox();
S0.InsertAfter(i,NewIso);
Is = S0.Value(i+2);
Is.ChangeDomain(CuttingValue,Is.U1(),Is.V0(),Is.V1());
S0.SetValue(i+2,Is);
myVConstraints.SetValue(j,S0);
}
// insertion des nouveaux noeuds (U*,Vj)
Handle(AdvApp2Var_Node) aNext;
Handle(AdvApp2Var_Node) aPrev = myNodeConstraints.First();
for (Standard_Integer j = 1; j < myNodeConstraints.Length(); j++)
{
aNext = myNodeConstraints.Value(j+1);
if (aPrev->Coord().X() < CuttingValue
&& aNext->Coord().X() > CuttingValue
&& aPrev->Coord().Y() == aNext->Coord().Y())
{
gp_XY aNewUV (CuttingValue, aPrev->Coord().Y());
Handle(AdvApp2Var_Node) aNewNode = new AdvApp2Var_Node (aNewUV, aPrev->UOrder(), aPrev->VOrder());
myNodeConstraints.InsertAfter (j, aNewNode);
AdvApp2Var_Node Prev, Next;
Prev=myNodeConstraints.Value(1);
for (j=1;j<myNodeConstraints.Length();j++) {
Next=myNodeConstraints.Value(j+1);
if ((Prev.Coord()).X()<CuttingValue && ((Next.Coord()).X()>CuttingValue)
&& ((Prev.Coord()).Y()==(Next.Coord()).Y())) {
gp_XY NewUV(CuttingValue,(Prev.Coord()).Y());
AdvApp2Var_Node NewNode(NewUV,Prev.UOrder(),Prev.VOrder());
myNodeConstraints.InsertAfter(j,NewNode);
}
aPrev = aNext;
Prev=Next;
}
}
@@ -297,69 +299,65 @@ void AdvApp2Var_Framework::UpdateInU(const Standard_Real CuttingValue)
void AdvApp2Var_Framework::UpdateInV(const Standard_Real CuttingValue)
{
Standard_Integer j=1;
while (myVConstraints.Value(j).First()->V0() > CuttingValue
|| myVConstraints.Value(j).First()->V1() < CuttingValue)
{
Standard_Integer i,j=1;
while (((myVConstraints.Value(j)).Value(1)).V0()>CuttingValue
|| ((myVConstraints.Value(j)).Value(1)).V1()<CuttingValue) {
j++;
}
AdvApp2Var_Strip S0;
AdvApp2Var_Iso Is;
S0 = myVConstraints.Value(j);
Standard_Real Vdeb = (S0.Value(1)).V0(), Vfin = (S0.Value(1)).V1();
{
AdvApp2Var_Strip& S0 = myVConstraints.ChangeValue(j);
const Standard_Real Vdeb = S0.First()->V0(), Vfin = S0.First()->V1();
// modification des Isos U de la bande en V d'indice j
for (AdvApp2Var_Strip::Iterator anIsoIter (S0); anIsoIter.More(); anIsoIter.Next())
{
const Handle(AdvApp2Var_Iso)& anIso = anIsoIter.Value();
anIso->ChangeDomain (Vdeb, CuttingValue);
anIso->ResetApprox();
}
// insertion d'une nouvelle bande en V apres l'indice j
AdvApp2Var_Strip aNewStrip;
for (AdvApp2Var_Strip::Iterator anIsoIter (S0); anIsoIter.More(); anIsoIter.Next())
{
const Handle(AdvApp2Var_Iso)& anIso = anIsoIter.Value();
Handle(AdvApp2Var_Iso) aNewIso = new AdvApp2Var_Iso (anIso->Type(), anIso->Constante(),
anIso->U0(), anIso->U1(), CuttingValue, Vfin,
0, anIso->UOrder(), anIso->VOrder());
aNewIso->ResetApprox();
aNewStrip.Append (aNewIso);
}
myVConstraints.InsertAfter(j, aNewStrip);
// modification des Isos U de la bande en V d'indice j
for (i=1;i<=S0.Length();i++) {
Is = S0.Value(i);
Is.ChangeDomain(Vdeb,CuttingValue);
Is.ResetApprox();
S0.SetValue(i,Is);
}
myVConstraints.SetValue(j,S0);
// insertion d'une nouvelle Iso V=V* dans chaque bande en U apres l'indice j
// et restriction des paves des Isos adjacentes
for (AdvApp2Var_SequenceOfStrip::Iterator anUConstIter (myUConstraints); anUConstIter.More(); anUConstIter.Next())
{
AdvApp2Var_Strip& S0 = anUConstIter.ChangeValue();
Handle(AdvApp2Var_Iso) anIso = S0.Value(j);
anIso->ChangeDomain (anIso->U0(), anIso->U1(), anIso->V0(), CuttingValue);
// insertion d'une nouvelle bande en V apres l'indice j
AdvApp2Var_Strip NewStrip;
for (i=1;i<=S0.Length();i++) {
AdvApp2Var_Iso NewIso((S0.Value(i)).Type(),(S0.Value(i)).Constante(),
(S0.Value(i)).U0(),(S0.Value(i)).U1(),CuttingValue,Vfin,
0,(S0.Value(i)).UOrder(),(S0.Value(i)).VOrder());
NewIso.ResetApprox();
NewStrip.Append(NewIso);
}
myVConstraints.InsertAfter(j,NewStrip);
Handle(AdvApp2Var_Iso) aNewIso = new AdvApp2Var_Iso (anIso->Type(), CuttingValue, anIso->U0(), anIso->U1(), anIso->V0(), CuttingValue,
0, anIso->UOrder(), anIso->VOrder());
aNewIso->ResetApprox();
S0.InsertAfter (j, aNewIso);
anIso = S0.Value (j + 2);
anIso->ChangeDomain (anIso->U0(), anIso->U1(), CuttingValue, anIso->V1());
// insertion d'une nouvelle Iso V=V* dans chaque bande en U apres l'indice j
// et restriction des paves des Isos adjacentes
for (i=1;i<=myUConstraints.Length();i++) {
S0 = myUConstraints.Value(i);
Is = S0.Value(j);
Is.ChangeDomain(Is.U0(),Is.U1(),Is.V0(),CuttingValue);
S0.SetValue(j,Is);
AdvApp2Var_Iso NewIso(Is.Type(),CuttingValue,Is.U0(),Is.U1(),Is.V0(),CuttingValue,
0,Is.UOrder(),Is.VOrder());
NewIso.ResetApprox();
S0.InsertAfter(j,NewIso);
Is = S0.Value(j+2);
Is.ChangeDomain(Is.U0(),Is.U1(),CuttingValue,Is.V1());
S0.SetValue(j+2,Is);
myUConstraints.SetValue(i,S0);
}
// insertion des nouveaux noeuds (Ui,V*)
Standard_Integer i = 1;
while (i <= myNodeConstraints.Length()
&& myNodeConstraints.Value(i)->Coord().Y() < CuttingValue)
{
i += myUConstraints.Length() + 1;
i = 1;
while ( i<=myNodeConstraints.Length()
&& ( ((myNodeConstraints.Value(i)).Coord()).Y()) < CuttingValue) {
i+=myUConstraints.Length()+1;
}
for (j = 1; j <= myUConstraints.Length() + 1; j++)
{
const Handle(AdvApp2Var_Node)& aJNode = myNodeConstraints.Value(j);
gp_XY NewUV (aJNode->Coord().X(), CuttingValue);
Handle(AdvApp2Var_Node) aNewNode = new AdvApp2Var_Node (NewUV, aJNode->UOrder(), aJNode->VOrder());
myNodeConstraints.InsertAfter (i+j-2, aNewNode);
for (j=1;j<=myUConstraints.Length()+1;j++) {
gp_XY NewUV(((myNodeConstraints.Value(j)).Coord()).X(),CuttingValue);
AdvApp2Var_Node NewNode(NewUV,
(myNodeConstraints.Value(j)).UOrder(),
(myNodeConstraints.Value(j)).VOrder());
myNodeConstraints.InsertAfter(i+j-2,NewNode);
}
}
@@ -372,7 +370,7 @@ const Handle(TColStd_HArray1OfReal)&
AdvApp2Var_Framework::UEquation(const Standard_Integer IndexIso,
const Standard_Integer IndexStrip) const
{
return myVConstraints.Value(IndexStrip).Value(IndexIso)->Polynom();
return ((myVConstraints.Value(IndexStrip)).Value(IndexIso)).Polynom();
}
//==========================================================================================
@@ -384,6 +382,6 @@ const Handle(TColStd_HArray1OfReal)&
AdvApp2Var_Framework::VEquation(const Standard_Integer IndexIso,
const Standard_Integer IndexStrip) const
{
return myUConstraints.Value(IndexStrip).Value(IndexIso)->Polynom();
return myUConstraints.Value(IndexStrip).Value(IndexIso).Polynom();
}

View File

@@ -44,25 +44,27 @@ public:
Standard_EXPORT AdvApp2Var_Framework();
Standard_EXPORT AdvApp2Var_Framework(const AdvApp2Var_SequenceOfNode& Frame, const AdvApp2Var_SequenceOfStrip& UFrontier, const AdvApp2Var_SequenceOfStrip& VFrontier);
//! search the Index of the first Iso not approximated,
//! if all Isos are approximated NULL is returned.
Standard_EXPORT Handle(AdvApp2Var_Iso) FirstNotApprox (Standard_Integer& IndexIso, Standard_Integer& IndexStrip) const;
//! if all Isos are approximated Standard_False is returned.
Standard_EXPORT Standard_Boolean FirstNotApprox (Standard_Integer& IndexIso, Standard_Integer& IndexStrip, AdvApp2Var_Iso& anIso) const;
Standard_EXPORT Standard_Integer FirstNode (const GeomAbs_IsoType Type, const Standard_Integer IndexIso, const Standard_Integer IndexStrip) const;
Standard_EXPORT Standard_Integer LastNode (const GeomAbs_IsoType Type, const Standard_Integer IndexIso, const Standard_Integer IndexStrip) const;
Standard_EXPORT void ChangeIso (const Standard_Integer IndexIso, const Standard_Integer IndexStrip, const Handle(AdvApp2Var_Iso)& anIso);
Standard_EXPORT void ChangeIso (const Standard_Integer IndexIso, const Standard_Integer IndexStrip, const AdvApp2Var_Iso& anIso);
const Handle(AdvApp2Var_Node)& Node (const Standard_Integer IndexNode) const { return myNodeConstraints.Value(IndexNode); }
const AdvApp2Var_Node& Node (const Standard_Integer IndexNode) const;
Standard_EXPORT const Handle(AdvApp2Var_Node)& Node (const Standard_Real U, const Standard_Real V) const;
Standard_EXPORT const AdvApp2Var_Node& Node (const Standard_Real U, const Standard_Real V) const;
Standard_EXPORT const AdvApp2Var_Iso& IsoU (const Standard_Real U, const Standard_Real V0, const Standard_Real V1) const;
Standard_EXPORT const AdvApp2Var_Iso& IsoV (const Standard_Real U0, const Standard_Real U1, const Standard_Real V) const;
AdvApp2Var_Node& ChangeNode (const Standard_Integer IndexNode);
Standard_EXPORT void UpdateInU (const Standard_Real CuttingValue);
Standard_EXPORT void UpdateInV (const Standard_Real CuttingValue);
@@ -71,12 +73,31 @@ public:
Standard_EXPORT const Handle(TColStd_HArray1OfReal)& VEquation (const Standard_Integer IndexIso, const Standard_Integer IndexStrip) const;
protected:
private:
AdvApp2Var_SequenceOfNode myNodeConstraints;
AdvApp2Var_SequenceOfStrip myUConstraints;
AdvApp2Var_SequenceOfStrip myVConstraints;
};
#include <AdvApp2Var_Framework.lxx>
#endif // _AdvApp2Var_Framework_HeaderFile

View File

@@ -1,4 +1,7 @@
// Copyright (c) 2020 OPEN CASCADE SAS
// Created on: 1996-06-17
// Created by: Philippe MANGIN
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -11,14 +14,14 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Aspect_Eye_HeaderFile
#define _Aspect_Eye_HeaderFile
//! Camera eye index within stereoscopic pair.
enum Aspect_Eye
inline const AdvApp2Var_Node& AdvApp2Var_Framework::Node(
const Standard_Integer IndexNode) const
{
Aspect_Eye_Left,
Aspect_Eye_Right
};
return myNodeConstraints.Value(IndexNode);
}
#endif // _Aspect_Eye_HeaderFile
inline AdvApp2Var_Node& AdvApp2Var_Framework::ChangeNode(
const Standard_Integer IndexNode)
{
return myNodeConstraints.ChangeValue(IndexNode);
}

View File

@@ -14,18 +14,16 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <AdvApp2Var_Iso.hxx>
#include <AdvApp2Var_ApproxF2var.hxx>
#include <AdvApp2Var_Context.hxx>
#include <AdvApp2Var_Iso.hxx>
#include <AdvApp2Var_Node.hxx>
#include <gp_Pnt.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <TColStd_HArray2OfReal.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AdvApp2Var_Iso, Standard_Transient)
//=======================================================================
//function : AdvApp2Var_Iso
//purpose :

View File

@@ -31,12 +31,16 @@
class AdvApp2Var_Context;
class AdvApp2Var_Node;
//! used to store constraints on a line U = Ui or V = Vj
class AdvApp2Var_Iso : public Standard_Transient
class AdvApp2Var_Iso
{
DEFINE_STANDARD_RTTIEXT(AdvApp2Var_Iso, Standard_Transient)
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT AdvApp2Var_Iso();
Standard_EXPORT AdvApp2Var_Iso(const GeomAbs_IsoType type, const Standard_Integer iu, const Standard_Integer iv);
@@ -95,13 +99,21 @@ public:
Standard_EXPORT Handle(TColStd_HArray2OfReal) MoyErrors() const;
private:
AdvApp2Var_Iso(const AdvApp2Var_Iso& Other);
AdvApp2Var_Iso& operator= (const AdvApp2Var_Iso& theOther);
protected:
private:
Standard_EXPORT AdvApp2Var_Iso(const AdvApp2Var_Iso& Other);
GeomAbs_IsoType myType;
Standard_Real myConstPar;
Standard_Real myU0;
@@ -120,6 +132,13 @@ private:
Handle(TColStd_HArray1OfReal) mySomTab;
Handle(TColStd_HArray1OfReal) myDifTab;
};
#endif // _AdvApp2Var_Iso_HeaderFile

View File

@@ -52,19 +52,15 @@ AdvApp2Var_Network::AdvApp2Var_Network(const AdvApp2Var_SequenceOfPatch& Net,
//purpose : return the first Patch not approximated
//==========================================================================================
Standard_Boolean AdvApp2Var_Network::FirstNotApprox(Standard_Integer& theIndex) const
Standard_Boolean AdvApp2Var_Network::FirstNotApprox(Standard_Integer& Index) const
{
Standard_Integer anIndex = 1;
for (AdvApp2Var_SequenceOfPatch::Iterator aPatchIter (myNet); aPatchIter.More(); aPatchIter.Next(), ++anIndex)
{
const Handle(AdvApp2Var_Patch)& aPatch = aPatchIter.Value();
if (!aPatch->IsApproximated())
{
theIndex = anIndex;
return true;
}
Standard_Boolean good = Standard_True;
Standard_Integer i;
for (i = 1; i <= myNet.Length() && good; i++) {
good = myNet.Value(i).IsApproximated();
if (!good) {Index = i;}
}
return false;
return !good;
}
//==========================================================================================
@@ -82,20 +78,23 @@ void AdvApp2Var_Network::UpdateInU(const Standard_Real CuttingValue)
}
myUParameters.InsertBefore(i,CuttingValue);
for (j=1; j< myVParameters.Length() ; j++)
{
Standard_Integer indice;
for (j=1; j< myVParameters.Length() ; j++){
// modification des patches concernes par la decoupe
Standard_Integer indice = (myUParameters.Length()-1) * (j-1) + i - 1;
const Handle(AdvApp2Var_Patch)& aPat = myNet.Value(indice);
aPat->ChangeDomain (aPat->U0(), CuttingValue, aPat->V0(), aPat->V1());
aPat->ResetApprox();
AdvApp2Var_Patch Pat;
indice = (myUParameters.Length()-1) * (j-1) + i - 1;
Pat = myNet.Value(indice);
Pat.ChangeDomain(Pat.U0(), CuttingValue, Pat.V0(), Pat.V1());
Pat.ResetApprox();
myNet.SetValue(indice, Pat);
// insertion des nouveaux patches
Handle(AdvApp2Var_Patch) aNewPat = new AdvApp2Var_Patch (CuttingValue,myUParameters.Value(i+1),
AdvApp2Var_Patch NewPat(CuttingValue,myUParameters.Value(i+1),
myVParameters.Value(j),myVParameters.Value(j+1),
aPat->UOrder(), aPat->VOrder());
aNewPat->ResetApprox();
myNet.InsertAfter(indice, aNewPat);
Pat.UOrder(),Pat.VOrder());
NewPat.ResetApprox();
myNet.InsertAfter(indice, NewPat);
}
}
@@ -109,32 +108,31 @@ void AdvApp2Var_Network::UpdateInV(const Standard_Real CuttingValue)
{
// insertion du nouveau parametre de decoupe
Standard_Integer j = 1;
Handle(AdvApp2Var_Patch) Pat;
while (myVParameters.Value(j)<CuttingValue)
{
Standard_Integer i,j=1;
AdvApp2Var_Patch Pat;
while (myVParameters.Value(j)<CuttingValue) {
j++;
}
myVParameters.InsertBefore(j,CuttingValue);
// modification des patches concernes par la decoupe
for (Standard_Integer i = 1; i < myUParameters.Length(); i++)
{
const Standard_Integer indice = (myUParameters.Length()-1) * (j-2) + i;
Standard_Integer indice;
for (i=1; i< myUParameters.Length() ; i++){
indice = (myUParameters.Length()-1) * (j-2) + i;
Pat = myNet.Value(indice);
Pat->ChangeDomain(Pat->U0(), Pat->U1(), Pat->V0(), CuttingValue);
Pat->ResetApprox();
Pat.ChangeDomain(Pat.U0(), Pat.U1(), Pat.V0(), CuttingValue);
Pat.ResetApprox();
myNet.SetValue(indice,Pat);
}
// insertion des nouveaux patches
for (Standard_Integer i = 1; i < myUParameters.Length(); i++)
{
const Standard_Integer indice = (myUParameters.Length()-1) * (j-1) + i-1;
Handle(AdvApp2Var_Patch) aNewPat = new AdvApp2Var_Patch (myUParameters.Value(i), myUParameters.Value(i+1),
for (i=1; i< myUParameters.Length() ; i++){
indice = (myUParameters.Length()-1) * (j-1) + i-1;
AdvApp2Var_Patch NewPat(myUParameters.Value(i), myUParameters.Value(i+1),
CuttingValue,myVParameters.Value(j+1),
Pat->UOrder(),Pat->VOrder());
aNewPat->ResetApprox();
myNet.InsertAfter (indice, aNewPat);
Pat.UOrder(),Pat.VOrder());
NewPat.ResetApprox();
myNet.InsertAfter(indice,NewPat);
}
}
@@ -148,21 +146,22 @@ void AdvApp2Var_Network::SameDegree(const Standard_Integer iu,
Standard_Integer& ncfu,
Standard_Integer& ncfv)
{
// calcul des coeff. max avec init selon l'ordre de continuite
Standard_Integer IndPat;
ncfu = 2*iu+2;
ncfv = 2*iv+2;
for (AdvApp2Var_SequenceOfPatch::Iterator aPatIter (myNet); aPatIter.More(); aPatIter.Next())
{
const Handle(AdvApp2Var_Patch)& aPat = aPatIter.Value();
ncfu = Max(ncfu, aPat->NbCoeffInU());
ncfv = Max(ncfv, aPat->NbCoeffInV());
for (IndPat=1;IndPat<=myNet.Length();IndPat++) {
ncfu = Max(ncfu,myNet.Value(IndPat).NbCoeffInU());
ncfv = Max(ncfv,myNet.Value(IndPat).NbCoeffInV());
}
// augmentation des nombres de coeff.
for (AdvApp2Var_SequenceOfPatch::Iterator aPatIter (myNet); aPatIter.More(); aPatIter.Next())
{
const Handle(AdvApp2Var_Patch)& aPat = aPatIter.Value();
aPat->ChangeNbCoeff (ncfu, ncfv);
AdvApp2Var_Patch Pat;
for (IndPat=1;IndPat<=myNet.Length();IndPat++) {
Pat = myNet.Value(IndPat);
Pat.ChangeNbCoeff(ncfu,ncfv);
myNet.SetValue(IndPat,Pat);
}
}

View File

@@ -46,8 +46,11 @@ public:
//! if all Patches are approximated Standard_False is returned
Standard_EXPORT Standard_Boolean FirstNotApprox (Standard_Integer& Index) const;
AdvApp2Var_Patch& ChangePatch (const Standard_Integer Index) { return *myNet.Value(Index); }
AdvApp2Var_Patch& operator() (const Standard_Integer Index) { return ChangePatch(Index); }
AdvApp2Var_Patch& ChangePatch (const Standard_Integer Index);
AdvApp2Var_Patch& operator() (const Standard_Integer Index)
{
return ChangePatch(Index);
}
Standard_EXPORT void UpdateInU (const Standard_Real CuttingValue);
@@ -64,23 +67,38 @@ public:
Standard_EXPORT Standard_Real UParameter (const Standard_Integer Index) const;
Standard_EXPORT Standard_Real VParameter (const Standard_Integer Index) const;
const AdvApp2Var_Patch& Patch (const Standard_Integer UIndex, const Standard_Integer VIndex) const
{
return *myNet.Value ((VIndex-1)*(myUParameters.Length()-1) + UIndex);
}
const AdvApp2Var_Patch& Patch (const Standard_Integer UIndex, const Standard_Integer VIndex) const;
const AdvApp2Var_Patch& operator() (const Standard_Integer UIndex, const Standard_Integer VIndex) const
{
return Patch(UIndex,VIndex);
}
{
return Patch(UIndex,VIndex);
}
protected:
private:
AdvApp2Var_SequenceOfPatch myNet;
TColStd_SequenceOfReal myUParameters;
TColStd_SequenceOfReal myVParameters;
};
#include <AdvApp2Var_Network.lxx>
#endif // _AdvApp2Var_Network_HeaderFile

View File

@@ -1,4 +1,7 @@
// Copyright (c) 2020 OPEN CASCADE SAS
// Created on: 1996-06-13
// Created by: Philippe MANGIN
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
@@ -11,17 +14,16 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Aspect_XRActionType_HeaderFile
#define _Aspect_XRActionType_HeaderFile
//#include <TColStd_HArray1OfReal.hxx>
//! XR action type.
enum Aspect_XRActionType
inline AdvApp2Var_Patch& AdvApp2Var_Network::ChangePatch(const Standard_Integer Index)
{
Aspect_XRActionType_InputDigital, //!< boolean input (like button)
Aspect_XRActionType_InputAnalog, //!< analog input (1/2/3 axes)
Aspect_XRActionType_InputPose, //!< positional input
Aspect_XRActionType_InputSkeletal, //!< skeletal input
Aspect_XRActionType_OutputHaptic //!< haptic output (vibration)
};
return myNet(Index);
}
inline const AdvApp2Var_Patch& AdvApp2Var_Network::Patch(const Standard_Integer UIndex,
const Standard_Integer VIndex) const
{
return myNet( (VIndex-1)*(myUParameters.Length()-1) + UIndex);
}
#endif // _Aspect_XRActionType_HeaderFile

View File

@@ -14,23 +14,26 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <AdvApp2Var_Node.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AdvApp2Var_Node, Standard_Transient)
#include <AdvApp2Var_Node.hxx>
#include <gp_Pnt.hxx>
#include <gp_XY.hxx>
#include <TColgp_HArray2OfPnt.hxx>
#include <TColStd_HArray2OfReal.hxx>
//=======================================================================
//function : AdvApp2Var_Node
//purpose :
//=======================================================================
AdvApp2Var_Node::AdvApp2Var_Node()
: myTruePoints(0, 2, 0, 2),
myErrors (0, 2, 0, 2),
myOrdInU (2),
myOrdInV (2)
AdvApp2Var_Node::AdvApp2Var_Node() :
myOrdInU(2),
myOrdInV(2)
{
myTruePoints = new TColgp_HArray2OfPnt ( 0, 2, 0, 2);
gp_Pnt P0(0.,0.,0.);
myTruePoints.Init(P0);
myErrors.Init(0.);
myTruePoints->Init(P0);
myErrors = new TColStd_HArray2OfReal( 0, 2, 0, 2);
myErrors->Init(0.);
}
//=======================================================================
@@ -39,15 +42,15 @@ AdvApp2Var_Node::AdvApp2Var_Node()
//=======================================================================
AdvApp2Var_Node::AdvApp2Var_Node(const Standard_Integer iu,
const Standard_Integer iv)
: myTruePoints(0, Max(0,iu), 0, Max(0,iv)),
myErrors (0, Max(0,iu), 0, Max(0,iv)),
myOrdInU (iu),
myOrdInV (iv)
const Standard_Integer iv) :
myOrdInU(iu),
myOrdInV(iv)
{
myTruePoints = new TColgp_HArray2OfPnt ( 0, Max(0,iu), 0, Max(0,iv));
gp_Pnt P0(0.,0.,0.);
myTruePoints.Init(P0);
myErrors.Init(0.);
myTruePoints->Init(P0);
myErrors = new TColStd_HArray2OfReal( 0, Max(0,iu), 0, Max(0,iv));
myErrors->Init(0.);
}
//=======================================================================
@@ -57,14 +60,118 @@ AdvApp2Var_Node::AdvApp2Var_Node(const Standard_Integer iu,
AdvApp2Var_Node::AdvApp2Var_Node(const gp_XY& UV,
const Standard_Integer iu,
const Standard_Integer iv)
: myTruePoints(0, iu, 0, iv),
myErrors (0, iu, 0, iv),
myCoord (UV),
myOrdInU(iu),
myOrdInV(iv)
const Standard_Integer iv) :
myCoord(UV),
myOrdInU(iu),
myOrdInV(iv)
{
myTruePoints = new TColgp_HArray2OfPnt ( 0, iu, 0, iv);
gp_Pnt P0(0.,0.,0.);
myTruePoints.Init(P0);
myErrors.Init(0.);
myTruePoints->Init(P0);
myErrors = new TColStd_HArray2OfReal( 0, iu, 0, iv);
myErrors->Init(0.);
}
//=======================================================================
//function : Coord
//purpose : returns the coordinates (U,V) of the node
//=======================================================================
gp_XY AdvApp2Var_Node::Coord() const
{
return myCoord;
}
//=======================================================================
//function : SetCoord
//purpose : changes the coordinates (U,V) to (x1,x2)
//=======================================================================
void AdvApp2Var_Node::SetCoord(const Standard_Real x1,
const Standard_Real x2)
{
myCoord.SetX(x1);
myCoord.SetY(x2);
}
//=======================================================================
//function : UOrder
//purpose : returns the continuity order in U of the node
//=======================================================================
Standard_Integer AdvApp2Var_Node::UOrder() const
{
return myOrdInU;
}
//=======================================================================
//function : VOrder
//purpose : returns the continuity order in V of the node
//=======================================================================
Standard_Integer AdvApp2Var_Node::VOrder() const
{
return myOrdInV;
}
//=======================================================================
//function : SetPoint
//purpose : affects the value F(U,V) or its derivates on the node (U,V)
//=======================================================================
void AdvApp2Var_Node::SetPoint(const Standard_Integer iu,
const Standard_Integer iv,
const gp_Pnt& Pt)
{
myTruePoints->SetValue(iu, iv, Pt);
}
//=======================================================================
//function : Point
//purpose : returns the value F(U,V) or its derivates on the node (U,V)
//=======================================================================
gp_Pnt AdvApp2Var_Node::Point(const Standard_Integer iu,
const Standard_Integer iv) const
{
return myTruePoints->Value(iu, iv);
}
//=======================================================================
//function : SetError
//purpose : affects the error between F(U,V) and its approximation
//=======================================================================
void AdvApp2Var_Node::SetError(const Standard_Integer iu,
const Standard_Integer iv,
const Standard_Real error)
{
myErrors->SetValue(iu, iv, error);
}
//=======================================================================
//function : Error
//purpose : returns the error between F(U,V) and its approximation
//=======================================================================
Standard_Real AdvApp2Var_Node::Error(const Standard_Integer iu,
const Standard_Integer iv) const
{
return myErrors->Value(iu, iv);
}

View File

@@ -17,85 +17,78 @@
#ifndef _AdvApp2Var_Node_HeaderFile
#define _AdvApp2Var_Node_HeaderFile
#include <gp_XY.hxx>
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Type.hxx>
#include <TColgp_Array2OfPnt.hxx>
#include <TColStd_Array2OfReal.hxx>
#include <gp_XY.hxx>
#include <Standard_Integer.hxx>
#include <TColgp_HArray2OfPnt.hxx>
#include <TColStd_HArray2OfReal.hxx>
#include <Standard_Real.hxx>
class gp_XY;
class gp_Pnt;
//! used to store constraints on a (Ui,Vj) point
class AdvApp2Var_Node : public Standard_Transient
class AdvApp2Var_Node
{
DEFINE_STANDARD_RTTIEXT(AdvApp2Var_Node, Standard_Transient)
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT AdvApp2Var_Node();
Standard_EXPORT AdvApp2Var_Node(const Standard_Integer iu, const Standard_Integer iv);
Standard_EXPORT AdvApp2Var_Node(const gp_XY& UV, const Standard_Integer iu, const Standard_Integer iv);
Standard_EXPORT gp_XY Coord() const;
Standard_EXPORT void SetCoord (const Standard_Real x1, const Standard_Real x2);
Standard_EXPORT Standard_Integer UOrder() const;
Standard_EXPORT Standard_Integer VOrder() const;
Standard_EXPORT void SetPoint (const Standard_Integer iu, const Standard_Integer iv, const gp_Pnt& Cte);
Standard_EXPORT gp_Pnt Point (const Standard_Integer iu, const Standard_Integer iv) const;
Standard_EXPORT void SetError (const Standard_Integer iu, const Standard_Integer iv, const Standard_Real error);
Standard_EXPORT Standard_Real Error (const Standard_Integer iu, const Standard_Integer iv) const;
//! Returns the coordinates (U,V) of the node
const gp_XY& Coord() const { return myCoord; }
//! changes the coordinates (U,V) to (x1,x2)
void SetCoord (const Standard_Real x1, const Standard_Real x2)
{
myCoord.SetX(x1);
myCoord.SetY(x2);
}
//! returns the continuity order in U of the node
Standard_Integer UOrder() const { return myOrdInU; }
//! returns the continuity order in V of the node
Standard_Integer VOrder() const { return myOrdInV; }
protected:
//! affects the value F(U,V) or its derivates on the node (U,V)
void SetPoint (const Standard_Integer iu, const Standard_Integer iv, const gp_Pnt& Pt)
{
myTruePoints.SetValue(iu, iv, Pt);
}
//! returns the value F(U,V) or its derivates on the node (U,V)
const gp_Pnt& Point (const Standard_Integer iu, const Standard_Integer iv) const
{
return myTruePoints.Value(iu, iv);
}
//! affects the error between F(U,V) and its approximation
void SetError (const Standard_Integer iu, const Standard_Integer iv, const Standard_Real error)
{
myErrors.SetValue(iu, iv, error);
}
//! returns the error between F(U,V) and its approximation
Standard_Real Error (const Standard_Integer iu, const Standard_Integer iv) const { return myErrors.Value(iu, iv); }
//! Assign operator.
AdvApp2Var_Node& operator= (const AdvApp2Var_Node& theOther)
{
myTruePoints = theOther.myTruePoints;
myErrors = theOther.myErrors;
myCoord = theOther.myCoord;
myOrdInU = theOther.myOrdInU;
myOrdInV = theOther.myOrdInV;
return *this;
}
private:
AdvApp2Var_Node (const AdvApp2Var_Node& theOther);
Standard_EXPORT AdvApp2Var_Node(const AdvApp2Var_Node& Other);
private:
TColgp_Array2OfPnt myTruePoints;
TColStd_Array2OfReal myErrors;
gp_XY myCoord;
Standard_Integer myOrdInU;
Standard_Integer myOrdInV;
Handle(TColgp_HArray2OfPnt) myTruePoints;
Handle(TColStd_HArray2OfReal) myErrors;
};
#endif // _AdvApp2Var_Node_HeaderFile

View File

@@ -40,8 +40,6 @@
#include <TColStd_HArray1OfReal.hxx>
#include <TColStd_HArray2OfReal.hxx>
IMPLEMENT_STANDARD_RTTIEXT(AdvApp2Var_Patch, Standard_Transient)
//============================================================================
//function : AdvApp2Var_Patch
//purpose :
@@ -146,35 +144,35 @@ void AdvApp2Var_Patch::Discretise(const AdvApp2Var_Context& Conditions,
rho = pow(du,iu)*pow(dv,iv);
// F(U0,V0) and its derivatives normalized on (-1,1)
valnorm = rho * ((Constraints.Node(myU0,myV0))->Point(iu,iv)).X();
valnorm = rho * ((Constraints.Node(myU0,myV0)).Point(iu,iv)).X();
HCOINS->SetValue( 1+NDIMEN*iu+NDIMEN*(IORDRU+2)*iv , valnorm );
valnorm = rho * ((Constraints.Node(myU0,myV0))->Point(iu,iv)).Y();
valnorm = rho * ((Constraints.Node(myU0,myV0)).Point(iu,iv)).Y();
HCOINS->SetValue( 2+NDIMEN*iu+NDIMEN*(IORDRU+2)*iv, valnorm );
valnorm = rho * ((Constraints.Node(myU0,myV0))->Point(iu,iv)).Z();
valnorm = rho * ((Constraints.Node(myU0,myV0)).Point(iu,iv)).Z();
HCOINS->SetValue( 3+NDIMEN*iu+NDIMEN*(IORDRU+2)*iv, valnorm );
// F(U1,V0) and its derivatives normalized on (-1,1)
valnorm = rho * ((Constraints.Node(myU1,myV0))->Point(iu,iv)).X();
valnorm = rho * ((Constraints.Node(myU1,myV0)).Point(iu,iv)).X();
HCOINS->SetValue( SIZE+1+NDIMEN*iu+NDIMEN*(IORDRU+2)*iv, valnorm );
valnorm = rho * ((Constraints.Node(myU1,myV0))->Point(iu,iv)).Y();
valnorm = rho * ((Constraints.Node(myU1,myV0)).Point(iu,iv)).Y();
HCOINS->SetValue( SIZE+2+NDIMEN*iu+NDIMEN*(IORDRU+2)*iv, valnorm );
valnorm = rho * ((Constraints.Node(myU1,myV0))->Point(iu,iv)).Z();
valnorm = rho * ((Constraints.Node(myU1,myV0)).Point(iu,iv)).Z();
HCOINS->SetValue( SIZE+3+NDIMEN*iu+NDIMEN*(IORDRU+2)*iv, valnorm );
// F(U0,V1) and its derivatives normalized on (-1,1)
valnorm = rho * ((Constraints.Node(myU0,myV1))->Point(iu,iv)).X();
valnorm = rho * ((Constraints.Node(myU0,myV1)).Point(iu,iv)).X();
HCOINS->SetValue( 2*SIZE+1+NDIMEN*iu+NDIMEN*(IORDRU+2)*iv, valnorm );
valnorm = rho * ((Constraints.Node(myU0,myV1))->Point(iu,iv)).Y();
valnorm = rho * ((Constraints.Node(myU0,myV1)).Point(iu,iv)).Y();
HCOINS->SetValue( 2*SIZE+2+NDIMEN*iu+NDIMEN*(IORDRU+2)*iv, valnorm );
valnorm = rho * ((Constraints.Node(myU0,myV1))->Point(iu,iv)).Z();
valnorm = rho * ((Constraints.Node(myU0,myV1)).Point(iu,iv)).Z();
HCOINS->SetValue( 2*SIZE+3+NDIMEN*iu+NDIMEN*(IORDRU+2)*iv, valnorm );
// F(U1,V1) and its derivatives normalized on (-1,1)
valnorm = rho * ((Constraints.Node(myU1,myV1))->Point(iu,iv)).X();
valnorm = rho * ((Constraints.Node(myU1,myV1)).Point(iu,iv)).X();
HCOINS->SetValue( 3*SIZE+1+NDIMEN*iu+NDIMEN*(IORDRU+2)*iv, valnorm );
valnorm = rho * ((Constraints.Node(myU1,myV1))->Point(iu,iv)).Y();
valnorm = rho * ((Constraints.Node(myU1,myV1)).Point(iu,iv)).Y();
HCOINS->SetValue( 3*SIZE+2+NDIMEN*iu+NDIMEN*(IORDRU+2)*iv, valnorm );
valnorm = rho * ((Constraints.Node(myU1,myV1))->Point(iu,iv)).Z();
valnorm = rho * ((Constraints.Node(myU1,myV1)).Point(iu,iv)).Z();
HCOINS->SetValue( 3*SIZE+3+NDIMEN*iu+NDIMEN*(IORDRU+2)*iv, valnorm );
}
}
@@ -545,38 +543,38 @@ void AdvApp2Var_Patch::AddConstraints(const AdvApp2Var_Context& Conditions,
// -F(U0,V0) and its derivatives normalized on (-1,1)
ideb = HCOINS->Lower() + NDIMEN*iu+NDIMEN*(IORDRU+2)*iv - 1;
valnorm = -rho * ((Constraints.Node(myU0,myV0))->Point(iu,iv)).X();
valnorm = -rho * ((Constraints.Node(myU0,myV0)).Point(iu,iv)).X();
HCOINS->SetValue( 1+ideb , valnorm );
valnorm = -rho * ((Constraints.Node(myU0,myV0))->Point(iu,iv)).Y();
valnorm = -rho * ((Constraints.Node(myU0,myV0)).Point(iu,iv)).Y();
HCOINS->SetValue( 2+ideb , valnorm );
valnorm = -rho * ((Constraints.Node(myU0,myV0))->Point(iu,iv)).Z();
valnorm = -rho * ((Constraints.Node(myU0,myV0)).Point(iu,iv)).Z();
HCOINS->SetValue( 3+ideb , valnorm );
// -F(U1,V0) and its derivatives normalized on (-1,1)
ideb += SIZE;
valnorm = -rho * ((Constraints.Node(myU1,myV0))->Point(iu,iv)).X();
valnorm = -rho * ((Constraints.Node(myU1,myV0)).Point(iu,iv)).X();
HCOINS->SetValue( 1+ideb , valnorm );
valnorm = -rho * ((Constraints.Node(myU1,myV0))->Point(iu,iv)).Y();
valnorm = -rho * ((Constraints.Node(myU1,myV0)).Point(iu,iv)).Y();
HCOINS->SetValue( 2+ideb , valnorm );
valnorm = -rho * ((Constraints.Node(myU1,myV0))->Point(iu,iv)).Z();
valnorm = -rho * ((Constraints.Node(myU1,myV0)).Point(iu,iv)).Z();
HCOINS->SetValue( 3+ideb , valnorm );
// -F(U0,V1) and its derivatives normalized on (-1,1)
ideb += SIZE;
valnorm = -rho * ((Constraints.Node(myU0,myV1))->Point(iu,iv)).X();
valnorm = -rho * ((Constraints.Node(myU0,myV1)).Point(iu,iv)).X();
HCOINS->SetValue( 1+ideb , valnorm );
valnorm = -rho * ((Constraints.Node(myU0,myV1))->Point(iu,iv)).Y();
valnorm = -rho * ((Constraints.Node(myU0,myV1)).Point(iu,iv)).Y();
HCOINS->SetValue( 2+ideb , valnorm );
valnorm = -rho * ((Constraints.Node(myU0,myV1))->Point(iu,iv)).Z();
valnorm = -rho * ((Constraints.Node(myU0,myV1)).Point(iu,iv)).Z();
HCOINS->SetValue( 3+ideb , valnorm );
// -F(U1,V1) and its derivatives normalized on (-1,1)
ideb += SIZE;
valnorm = -rho * ((Constraints.Node(myU1,myV1))->Point(iu,iv)).X();
valnorm = -rho * ((Constraints.Node(myU1,myV1)).Point(iu,iv)).X();
HCOINS->SetValue( 1+ideb , valnorm );
valnorm = -rho * ((Constraints.Node(myU1,myV1))->Point(iu,iv)).Y();
valnorm = -rho * ((Constraints.Node(myU1,myV1)).Point(iu,iv)).Y();
HCOINS->SetValue( 2+ideb , valnorm );
valnorm = -rho * ((Constraints.Node(myU1,myV1))->Point(iu,iv)).Z();
valnorm = -rho * ((Constraints.Node(myU1,myV1)).Point(iu,iv)).Z();
HCOINS->SetValue( 3+ideb , valnorm );
}
}
@@ -723,13 +721,13 @@ void AdvApp2Var_Patch::AddErrors(const AdvApp2Var_Framework& Constraints)
Standard_Real emax1=0.,emax2=0.,emax3=0.,emax4=0.,err1,err2,err3,err4;
for (iu=0;iu<=myOrdInU;iu++) {
for (iv=0;iv<=myOrdInV;iv++) {
error = (Constraints.Node(myU0,myV0))->Error(iu,iv);
error = (Constraints.Node(myU0,myV0)).Error(iu,iv);
emax1 = Max(emax1,error);
error = (Constraints.Node(myU1,myV0))->Error(iu,iv);
error = (Constraints.Node(myU1,myV0)).Error(iu,iv);
emax2 = Max(emax2,error);
error = (Constraints.Node(myU0,myV1))->Error(iu,iv);
error = (Constraints.Node(myU0,myV1)).Error(iu,iv);
emax3 = Max(emax3,error);
error = (Constraints.Node(myU1,myV1))->Error(iu,iv);
error = (Constraints.Node(myU1,myV1)).Error(iu,iv);
emax4 = Max(emax4,error);
}
}

View File

@@ -35,10 +35,12 @@ class AdvApp2Var_Criterion;
//! used to store results on a domain [Ui,Ui+1]x[Vj,Vj+1]
class AdvApp2Var_Patch : public Standard_Transient
class AdvApp2Var_Patch
{
DEFINE_STANDARD_RTTIEXT(AdvApp2Var_Patch, Standard_Transient)
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT AdvApp2Var_Patch();
@@ -100,13 +102,21 @@ public:
Standard_EXPORT void SetCritValue (const Standard_Real dist);
private:
AdvApp2Var_Patch(const AdvApp2Var_Patch& P);
AdvApp2Var_Patch& operator= (const AdvApp2Var_Patch& theOther);
protected:
private:
Standard_EXPORT AdvApp2Var_Patch(const AdvApp2Var_Patch& P);
Standard_Real myU0;
Standard_Real myU1;
Standard_Real myV0;

View File

@@ -20,6 +20,7 @@
#include <AdvApp2Var_Node.hxx>
#include <NCollection_Sequence.hxx>
typedef NCollection_Sequence<Handle(AdvApp2Var_Node)> AdvApp2Var_SequenceOfNode;
typedef NCollection_Sequence<AdvApp2Var_Node> AdvApp2Var_SequenceOfNode;
#endif

View File

@@ -20,7 +20,7 @@
#include <AdvApp2Var_Patch.hxx>
#include <NCollection_Sequence.hxx>
typedef NCollection_Sequence<Handle(AdvApp2Var_Patch)> AdvApp2Var_SequenceOfPatch;
typedef NCollection_Sequence<AdvApp2Var_Patch> AdvApp2Var_SequenceOfPatch;
#endif

View File

@@ -22,6 +22,6 @@
//! Set of constraints along a same type of Iso on the same level
typedef NCollection_Sequence<Handle(AdvApp2Var_Iso)> AdvApp2Var_Strip;
typedef NCollection_Sequence<AdvApp2Var_Iso> AdvApp2Var_Strip;
#endif

View File

@@ -22,6 +22,7 @@ AdvApp2Var_Data_f2c.hxx
AdvApp2Var_EvaluatorFunc2Var.hxx
AdvApp2Var_Framework.cxx
AdvApp2Var_Framework.hxx
AdvApp2Var_Framework.lxx
AdvApp2Var_Iso.cxx
AdvApp2Var_Iso.hxx
AdvApp2Var_MathBase.cxx
@@ -29,6 +30,7 @@ AdvApp2Var_MathBase.hxx
AdvApp2Var_MathBase_mathinit.cxx
AdvApp2Var_Network.cxx
AdvApp2Var_Network.hxx
AdvApp2Var_Network.lxx
AdvApp2Var_Node.cxx
AdvApp2Var_Node.hxx
AdvApp2Var_Patch.cxx

View File

@@ -54,7 +54,6 @@ const AppParCurves_Constraint LastC)
mylastC = LastC;
myMaxSegments = MAXSEGM;
myInvOrder = Standard_True;
myHangChecking = Standard_True;
alldone = Standard_False;
Perform(Line);
}
@@ -83,7 +82,6 @@ const AppParCurves_Constraint LastC)
mylastC = LastC;
myMaxSegments = MAXSEGM;
myInvOrder = Standard_True;
myHangChecking = Standard_True;
}
//=======================================================================
@@ -99,15 +97,7 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
Standard_Real thetol3d = Precision::Confusion(), thetol2d = Precision::Confusion();
UFirst = Line.FirstParameter();
ULast = Line.LastParameter();
Standard_Real TolU = 0.;
if (myHangChecking)
{
TolU = Max((ULast - UFirst)*1.e-03, Precision::Confusion());
}
else
{
TolU = Max((ULast - UFirst)*1.e-05, Precision::PApproximation());
}
Standard_Real TolU = Max((ULast - UFirst)*1.e-03, Precision::Confusion());
Standard_Real myfirstU = UFirst;
Standard_Real mylastU = ULast;
Standard_Integer aMaxSegments = 0;
@@ -186,7 +176,7 @@ void Approx_ComputeCLine::Perform(const MultiLine& Line)
//cout << myfirstU << " - " << mylastU << " tol : " << thetol3d << " " << thetol2d << endl;
Standard_Boolean aStopCutting = Standard_False;
if (myHangChecking && aNbCut >= aNbComp)
if (aNbCut >= aNbComp)
{
if (aNbCut > aNbImp + 1)
{
@@ -444,15 +434,6 @@ void Approx_ComputeCLine::SetInvOrder(const Standard_Boolean theInvOrder)
myInvOrder = theInvOrder;
}
//=======================================================================
//function : SetHangChecking
//purpose :
//=======================================================================
void Approx_ComputeCLine::SetHangChecking(const Standard_Boolean theHangChecking)
{
myHangChecking = theHangChecking;
}
//=======================================================================
//function : IsAllApproximated
//purpose : returns False if at a moment of the approximation,

View File

@@ -70,12 +70,6 @@ public:
//! By default inverse order is used.
Standard_EXPORT void SetInvOrder(const Standard_Boolean theInvOrder);
//! Set value of hang checking flag
//! if this flag = true, possible hang of algorithm is checked
//! and algorithm is forced to stop.
//! By default hang checking is used.
Standard_EXPORT void SetHangChecking(const Standard_Boolean theHangChecking);
//! returns False if at a moment of the approximation,
//! the status NoApproximation has been sent by the user
//! when more points were needed.
@@ -131,7 +125,6 @@ private:
AppParCurves_Constraint mylastC;
Standard_Integer myMaxSegments;
Standard_Boolean myInvOrder;
Standard_Boolean myHangChecking;
};

View File

@@ -70,12 +70,6 @@ public:
//! By default inverse order is used.
Standard_EXPORT void SetInvOrder(const Standard_Boolean theInvOrder);
//! Set value of hang checking flag
//! if this flag = true, possible hang of algorithm is checked
//! and algorithm is forced to stop.
//! By default hang checking is used.
Standard_EXPORT void SetHangChecking(const Standard_Boolean theHangChecking);
//! returns False if at a moment of the approximation,
//! the status NoApproximation has been sent by the user
//! when more points were needed.
@@ -131,7 +125,6 @@ private:
AppParCurves_Constraint mylastC;
Standard_Integer myMaxSegments;
Standard_Boolean myInvOrder;
Standard_Boolean myHangChecking;
};

View File

@@ -1,55 +0,0 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Aspect_FrustumLRBT_HeaderFile
#define _Aspect_FrustumLRBT_HeaderFile
//! Structure defining frustum boundaries.
template<typename Elem_t>
struct Aspect_FrustumLRBT
{
Elem_t Left;
Elem_t Right;
Elem_t Bottom;
Elem_t Top;
//! Empty constructor.
Aspect_FrustumLRBT() : Left (0), Right (0), Bottom (0), Top (0) {}
//! Copy/cast constructor.
template<typename Other_t>
explicit Aspect_FrustumLRBT (const Aspect_FrustumLRBT<Other_t>& theOther)
: Left (static_cast<Elem_t> (theOther.Left)),
Right (static_cast<Elem_t> (theOther.Right)),
Bottom(static_cast<Elem_t> (theOther.Bottom)),
Top (static_cast<Elem_t> (theOther.Top)) {}
//! Apply multiply factor.
void Multiply (Elem_t theScale)
{
Left *= theScale;
Right *= theScale;
Bottom *= theScale;
Top *= theScale;
}
//! Return multiplied frustum.
Aspect_FrustumLRBT<Elem_t> Multiplied (Elem_t theScale)
{
Aspect_FrustumLRBT<Elem_t> aCopy (*this);
aCopy.Multiply (theScale);
return aCopy;
}
};
#endif // _Aspect_FrustumLRBT_HeaderFile

File diff suppressed because it is too large Load Diff

View File

@@ -1,149 +0,0 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Aspect_OpenVRSession_HeaderFile
#define _Aspect_OpenVRSession_HeaderFile
#include <Aspect_XRSession.hxx>
//! OpenVR wrapper implementing Aspect_XRSession interface.
class Aspect_OpenVRSession : public Aspect_XRSession
{
DEFINE_STANDARD_RTTIEXT(Aspect_OpenVRSession, Aspect_XRSession)
public:
//! Return TRUE if an HMD may be presented on the system (e.g. to show VR checkbox in application GUI).
//! This is fast check, and even if it returns TRUE, opening session may fail.
Standard_EXPORT static bool IsHmdPresent();
public:
//! Empty constructor.
Standard_EXPORT Aspect_OpenVRSession();
//! Destructor.
Standard_EXPORT virtual ~Aspect_OpenVRSession();
//! Return TRUE if session is opened.
Standard_EXPORT virtual bool IsOpen() const Standard_OVERRIDE;
//! Initialize session.
Standard_EXPORT virtual bool Open() Standard_OVERRIDE;
//! Release session.
Standard_EXPORT virtual void Close() Standard_OVERRIDE;
//! Fetch actual poses of tracked devices.
Standard_EXPORT virtual bool WaitPoses() Standard_OVERRIDE;
//! Return recommended viewport Width x Height for rendering into VR.
virtual NCollection_Vec2<int> RecommendedViewport() const Standard_OVERRIDE { return myRendSize; }
//! Return transformation from eye to head.
//! vr::GetEyeToHeadTransform() wrapper.
Standard_EXPORT virtual NCollection_Mat4<double> EyeToHeadTransform (Aspect_Eye theEye) const Standard_OVERRIDE;
//! Return projection matrix.
Standard_EXPORT virtual NCollection_Mat4<double> ProjectionMatrix (Aspect_Eye theEye,
double theZNear,
double theZFar) const Standard_OVERRIDE;
//! Return TRUE.
virtual bool HasProjectionFrustums() const Standard_OVERRIDE { return true; }
//! Receive XR events.
Standard_EXPORT virtual void ProcessEvents() Standard_OVERRIDE;
//! Submit texture eye to XR Composer.
//! @param theTexture [in] texture handle
//! @param theGraphicsLib [in] graphics library in which texture handle is defined
//! @param theColorSpace [in] texture color space;
//! sRGB means no color conversion by composer;
//! Linear means to sRGB color conversion by composer
//! @param theEye [in] eye to display
//! @return FALSE on error
Standard_EXPORT virtual bool SubmitEye (void* theTexture,
Aspect_GraphicsLibrary theGraphicsLib,
Aspect_ColorSpace theColorSpace,
Aspect_Eye theEye) Standard_OVERRIDE;
//! Query information.
Standard_EXPORT virtual TCollection_AsciiString GetString (InfoString theInfo) const Standard_OVERRIDE;
//! Return index of tracked device of known role.
Standard_EXPORT virtual Standard_Integer NamedTrackedDevice (Aspect_XRTrackedDeviceRole theDevice) const Standard_OVERRIDE;
//! Fetch data for digital input action (like button).
Standard_EXPORT virtual Aspect_XRDigitalActionData GetDigitalActionData (const Handle(Aspect_XRAction)& theAction) const Standard_OVERRIDE;
//! Fetch data for analog input action (like axis).
Standard_EXPORT virtual Aspect_XRAnalogActionData GetAnalogActionData (const Handle(Aspect_XRAction)& theAction) const Standard_OVERRIDE;
//! Fetch data for pose input action (like fingertip position).
Standard_EXPORT virtual Aspect_XRPoseActionData GetPoseActionDataForNextFrame (const Handle(Aspect_XRAction)& theAction) const Standard_OVERRIDE;
//! Set tracking origin.
Standard_EXPORT virtual void SetTrackingOrigin (TrackingUniverseOrigin theOrigin) Standard_OVERRIDE;
protected:
//! Find location of default actions manifest file (based on CSF_OCCTResourcePath or CASROOT variables).
Standard_EXPORT TCollection_AsciiString defaultActionsManifest();
//! Release OpenVR device.
Standard_EXPORT void closeVR();
//! Update projection frustums.
Standard_EXPORT virtual void updateProjectionFrustums();
//! Init VR input.
Standard_EXPORT virtual bool initInput();
//! Handle tracked device activation.
Standard_EXPORT virtual void onTrackedDeviceActivated (Standard_Integer theDeviceIndex);
//! Handle tracked device deactivation.
Standard_EXPORT virtual void onTrackedDeviceDeactivated (Standard_Integer theDeviceIndex);
//! Handle tracked device update.
Standard_EXPORT virtual void onTrackedDeviceUpdated (Standard_Integer theDeviceIndex);
//! Trigger vibration.
Standard_EXPORT virtual void triggerHapticVibrationAction (const Handle(Aspect_XRAction)& theAction,
const Aspect_XRHapticActionData& theParams) Standard_OVERRIDE;
//! Return model for displaying device.
Standard_EXPORT virtual Handle(Graphic3d_ArrayOfTriangles) loadRenderModel (Standard_Integer theDevice,
Standard_Boolean theToApplyUnitFactor,
Handle(Image_Texture)& theTexture) Standard_OVERRIDE;
protected:
//! Access vr::IVRSystem* - OpenVR session object.
Standard_EXPORT void* getVRSystem() const;
private:
//! Internal fields
struct VRContext;
class VRImagePixmap;
class VRTextureSource;
protected:
VRContext* myContext;
TCollection_AsciiString myActionsManifest;
};
#endif // _Aspect_OpenVRSession_HeaderFile

View File

@@ -1,36 +0,0 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Aspect_TrackedDevicePose_HeaderFile
#define _Aspect_TrackedDevicePose_HeaderFile
#include <gp_Trsf.hxx>
#include <NCollection_Array1.hxx>
//! Describes a single pose for a tracked object (for XR).
struct Aspect_TrackedDevicePose
{
gp_Trsf Orientation; //!< device to absolute transformation
gp_Vec Velocity; //!< velocity in tracker space in m/s
gp_Vec AngularVelocity; //!< angular velocity in radians/s
bool IsValidPose; //!< indicates valid pose
bool IsConnectedDevice; //!< indicates connected state
//! Empty constructor.
Aspect_TrackedDevicePose() : IsValidPose (false), IsConnectedDevice (false) {}
};
//! Array of tracked poses.
typedef NCollection_Array1<Aspect_TrackedDevicePose> Aspect_TrackedDevicePoseArray;
#endif // _Aspect_TrackedDevicePose_HeaderFile

View File

@@ -1,58 +0,0 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Aspect_XRAction_HeaderFile
#define _Aspect_XRAction_HeaderFile
#include <Aspect_XRActionType.hxx>
#include <NCollection_IndexedDataMap.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
//! XR action definition.
class Aspect_XRAction : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(Aspect_XRAction, Standard_Transient)
public:
//! Return action id.
const TCollection_AsciiString& Id() const { return myId; }
//! Return action type.
Aspect_XRActionType Type() const { return myType; }
//! Return TRUE if action is defined.
bool IsValid() const { return myRawHandle != 0; }
//! Return action handle.
uint64_t RawHandle() const { return myRawHandle; }
//! Set action handle.
void SetRawHandle (uint64_t theHande) { myRawHandle = theHande; }
//! Main constructor.
Aspect_XRAction (const TCollection_AsciiString& theId,
const Aspect_XRActionType theType)
: myId (theId), myRawHandle (0), myType (theType) {}
protected:
TCollection_AsciiString myId; //!< action id
uint64_t myRawHandle; //!< action handle
Aspect_XRActionType myType; //!< action type
};
//! Map of actions with action Id as a key.
typedef NCollection_IndexedDataMap<TCollection_AsciiString, Handle(Aspect_XRAction), TCollection_AsciiString> Aspect_XRActionMap;
#endif // _Aspect_XRAction_HeaderFile

View File

@@ -1,55 +0,0 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Aspect_XRActionSet_HeaderFile
#define _Aspect_XRActionSet_HeaderFile
#include <Aspect_XRAction.hxx>
//! XR action set.
class Aspect_XRActionSet : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(Aspect_XRActionSet, Standard_Transient)
public:
//! Return action id.
const TCollection_AsciiString& Id() const { return myId; }
//! Return action handle.
uint64_t RawHandle() const { return myRawHandle; }
//! Set action handle.
void SetRawHandle (uint64_t theHande) { myRawHandle = theHande; }
//! Add action.
void AddAction (const Handle(Aspect_XRAction)& theAction)
{
myActions.Add (theAction->Id(), theAction);
}
//! Return map of actions.
const Aspect_XRActionMap& Actions() const { return myActions; }
//! Main constructor.
Aspect_XRActionSet (const TCollection_AsciiString& theId)
: myId (theId), myRawHandle (0) {}
protected:
TCollection_AsciiString myId; //!< action set id
uint64_t myRawHandle; //!< action set handle
Aspect_XRActionMap myActions; //!< map of actions
};
typedef NCollection_IndexedDataMap<TCollection_AsciiString, Handle(Aspect_XRActionSet), TCollection_AsciiString> Aspect_XRActionSetMap;
#endif // _Aspect_XRActionSet_HeaderFile

View File

@@ -1,35 +0,0 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Aspect_XRAnalogActionData_HeaderFile
#define _Aspect_XRAnalogActionData_HeaderFile
#include <NCollection_Vec3.hxx>
//! Analog input XR action data.
struct Aspect_XRAnalogActionData
{
uint64_t ActiveOrigin; //!< The origin that caused this action's current state
float UpdateTime; //!< Time relative to now when this event happened. Will be negative to indicate a past time
NCollection_Vec3<float> VecXYZ; //!< the current state of this action
NCollection_Vec3<float> DeltaXYZ; //!< deltas since the previous update
bool IsActive; //!< whether or not this action is currently available to be bound in the active action set
//! Return TRUE if delta is non-zero.
bool IsChanged() { return !DeltaXYZ.IsEqual (NCollection_Vec3<float> (0.0f, 0.0f, 0.0f)); }
//! Empty constructor.
Aspect_XRAnalogActionData() : ActiveOrigin (0), UpdateTime (0.0f), IsActive (false) {}
};
#endif // _Aspect_XRAnalogActionData_HeaderFile

View File

@@ -1,32 +0,0 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Aspect_XRDigitalActionData_HeaderFile
#define _Aspect_XRDigitalActionData_HeaderFile
#include <Standard_TypeDef.hxx>
//! Digital input XR action data.
struct Aspect_XRDigitalActionData
{
uint64_t ActiveOrigin; //!< The origin that caused this action's current state
float UpdateTime; //!< Time relative to now when this event happened. Will be negative to indicate a past time
bool IsActive; //!< whether or not this action is currently available to be bound in the active action set
bool IsPressed; //!< Aspect_InputActionType_Digital state - The current state of this action; will be true if currently pressed
bool IsChanged; //!< Aspect_InputActionType_Digital state - this is true if the state has changed since the last frame
//! Empty constructor.
Aspect_XRDigitalActionData() : ActiveOrigin (0), UpdateTime (0.0f), IsActive (false), IsPressed (false), IsChanged (false) {}
};
#endif // _Aspect_XRDigitalActionData_HeaderFile

View File

@@ -1,40 +0,0 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Aspect_XRGenericAction_HeaderFile
#define _Aspect_XRGenericAction_HeaderFile
//! Generic XR action.
enum Aspect_XRGenericAction
{
Aspect_XRGenericAction_IsHeadsetOn, //!< headset is on/off head
Aspect_XRGenericAction_InputAppMenu, //!< application menu button pressed/released
Aspect_XRGenericAction_InputSysMenu, //!< system menu button pressed/released
Aspect_XRGenericAction_InputTriggerPull, //!< trigger squeezing [0..1], 1 to click
Aspect_XRGenericAction_InputTriggerClick, //!< trigger clicked/released
Aspect_XRGenericAction_InputGripClick, //!< grip state on/off
Aspect_XRGenericAction_InputTrackPadPosition, //!< trackpad 2D position [-1,+1] with X and Y axes
Aspect_XRGenericAction_InputTrackPadTouch, //!< trackpad touched/untouched
Aspect_XRGenericAction_InputTrackPadClick, //!< trackpad clicked/released
Aspect_XRGenericAction_InputThumbstickPosition, //!< thumbstick 2D position [-1,+1] with X and Y axes
Aspect_XRGenericAction_InputThumbstickTouch, //!< thumbstick touched/untouched
Aspect_XRGenericAction_InputThumbstickClick, //!< thumbstick clicked/released
Aspect_XRGenericAction_InputPoseBase, //!< base position of hand
Aspect_XRGenericAction_InputPoseFront, //!< front position of hand
Aspect_XRGenericAction_InputPoseHandGrip, //!< position of main handgrip
Aspect_XRGenericAction_InputPoseFingerTip, //!< position of main fingertip
Aspect_XRGenericAction_OutputHaptic //!< haptic output (vibration)
};
enum { Aspect_XRGenericAction_NB = Aspect_XRGenericAction_OutputHaptic + 1 };
#endif // _Aspect_XRGenericAction_HeaderFile

View File

@@ -1,38 +0,0 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Aspect_XRHapticActionData_HeaderFile
#define _Aspect_XRHapticActionData_HeaderFile
//! Haptic output XR action data.
struct Aspect_XRHapticActionData
{
float Delay; //!< delay in seconds before start
float Duration; //!< duration in seconds
float Frequency; //!< vibration frequency
float Amplitude; //!< vibration amplitude
//! Return TRUE if data is not empty.
bool IsValid() const
{
return Duration > 0.0f
&& Amplitude > 0.0f
&& Frequency > 0.0f
&& Delay >= 0.0f;
}
//! Empty constructor.
Aspect_XRHapticActionData() : Delay (0.0f), Duration (0.0f), Frequency (0.0f), Amplitude (0.0f) {}
};
#endif // _Aspect_XRHapticActionData_HeaderFile

View File

@@ -1,31 +0,0 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Aspect_XRPoseActionData_HeaderFile
#define _Aspect_XRPoseActionData_HeaderFile
#include <Aspect_TrackedDevicePose.hxx>
#include <Standard_TypeDef.hxx>
//! Pose input XR action data.
struct Aspect_XRPoseActionData
{
Aspect_TrackedDevicePose Pose; //!< pose state
uint64_t ActiveOrigin; //!< The origin that caused this action's current state
bool IsActive; //!< whether or not this action is currently available to be bound in the active action set
//! Empty constructor.
Aspect_XRPoseActionData() : ActiveOrigin (0), IsActive (false) {}
};
#endif // _Aspect_XRPoseActionData_HeaderFile

View File

@@ -1,60 +0,0 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Aspect_XRSession.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Aspect_XRSession, Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(Aspect_XRAction, Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(Aspect_XRActionSet, Standard_Transient)
// =======================================================================
// function : Aspect_XRSession
// purpose :
// =======================================================================
Aspect_XRSession::Aspect_XRSession()
: myTrackOrigin (TrackingUniverseOrigin_Standing),
myTrackedPoses (0, 0),
myUnitFactor (1.0),
myAspect (1.0),
myFieldOfView (90.0),
myIod (0.0),
myDispFreq (0.0f)
{
for (Standard_Integer aRoleIter = 0; aRoleIter < Aspect_XRTrackedDeviceRole_NB; ++aRoleIter)
{
myRoleActions[aRoleIter].Resize (0, Aspect_XRGenericAction_NB - 1, false);
}
}
// =======================================================================
// function : AbortHapticVibrationAction
// purpose :
// =======================================================================
void Aspect_XRSession::AbortHapticVibrationAction (const Handle(Aspect_XRAction)& theAction)
{
triggerHapticVibrationAction (theAction, Aspect_XRHapticActionData());
}
// =======================================================================
// function : TriggerHapticVibrationAction
// purpose :
// =======================================================================
void Aspect_XRSession::TriggerHapticVibrationAction (const Handle(Aspect_XRAction)& theAction,
const Aspect_XRHapticActionData& theParams)
{
if (!theParams.IsValid())
{
throw Standard_ProgramError("Aspect_OpenVRSession::TriggerHapticVibrationAction() called for wrong action");
}
triggerHapticVibrationAction (theAction, theParams);
}

View File

@@ -1,262 +0,0 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Aspect_XRSession_HeaderFile
#define _Aspect_XRSession_HeaderFile
#include <Aspect_ColorSpace.hxx>
#include <Aspect_Eye.hxx>
#include <Aspect_FrustumLRBT.hxx>
#include <Aspect_GraphicsLibrary.hxx>
#include <Aspect_XRActionSet.hxx>
#include <Aspect_XRAnalogActionData.hxx>
#include <Aspect_XRDigitalActionData.hxx>
#include <Aspect_XRGenericAction.hxx>
#include <Aspect_XRHapticActionData.hxx>
#include <Aspect_XRPoseActionData.hxx>
#include <Aspect_XRTrackedDeviceRole.hxx>
#include <gp_Trsf.hxx>
#include <NCollection_Array1.hxx>
class Graphic3d_ArrayOfTriangles;
class Image_Texture;
//! Extended Reality (XR) Session interface.
class Aspect_XRSession : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(Aspect_XRSession, Standard_Transient)
public:
//! Identifies which style of tracking origin the application wants to use for the poses it is requesting.
enum TrackingUniverseOrigin
{
TrackingUniverseOrigin_Seated, //! poses are provided relative to the seated zero pose
TrackingUniverseOrigin_Standing, //! poses are provided relative to the safe bounds configured by the user
};
public:
//! Return TRUE if session is opened.
virtual bool IsOpen() const = 0;
//! Initialize session.
virtual bool Open() = 0;
//! Release session.
virtual void Close() = 0;
//! Fetch actual poses of tracked devices.
virtual bool WaitPoses() = 0;
//! Return recommended viewport Width x Height for rendering into VR.
virtual NCollection_Vec2<int> RecommendedViewport() const = 0;
//! Return transformation from eye to head.
virtual NCollection_Mat4<double> EyeToHeadTransform (Aspect_Eye theEye) const = 0;
//! Return transformation from head to eye.
NCollection_Mat4<double> HeadToEyeTransform (Aspect_Eye theEye) const
{
NCollection_Mat4<double> aMat;
EyeToHeadTransform (theEye).Inverted (aMat);
return aMat;
}
//! Return projection matrix.
virtual NCollection_Mat4<double> ProjectionMatrix (Aspect_Eye theEye,
double theZNear,
double theZFar) const = 0;
//! Return FALSE if projection frustums are unsupported and general 4x4 projection matrix should be fetched instead
virtual bool HasProjectionFrustums() const = 0;
//! Receive XR events.
virtual void ProcessEvents() = 0;
//! Submit texture eye to XR Composer.
//! @param theTexture [in] texture handle
//! @param theGraphicsLib [in] graphics library in which texture handle is defined
//! @param theColorSpace [in] texture color space;
//! sRGB means no color conversion by composer;
//! Linear means to sRGB color conversion by composer
//! @param theEye [in] eye to display
//! @return FALSE on error
virtual bool SubmitEye (void* theTexture,
Aspect_GraphicsLibrary theGraphicsLib,
Aspect_ColorSpace theColorSpace,
Aspect_Eye theEye) = 0;
//! Return unit scale factor defined as scale factor for m (meters); 1.0 by default.
Standard_Real UnitFactor() const { return myUnitFactor; }
//! Set unit scale factor.
void SetUnitFactor (Standard_Real theFactor) { myUnitFactor = theFactor; }
//! Return aspect ratio.
Standard_Real Aspect() const { return myAspect; }
//! Return field of view.
Standard_Real FieldOfView() const { return myFieldOfView; }
//! Return Intra-ocular Distance (IOD); also known as Interpupillary Distance (IPD).
//! Defined in meters by default (@sa UnitFactor()).
Standard_Real IOD() const { return myIod; }
//! Return display frequency or 0 if unknown.
Standard_ShortReal DisplayFrequency() const { return myDispFreq; }
//! Return projection frustum.
//! @sa HasProjectionFrustums().
const Aspect_FrustumLRBT<double>& ProjectionFrustum (Aspect_Eye theEye) const
{
return theEye == Aspect_Eye_Right ? myFrustumR : myFrustumL;
}
//! Return head orientation in right-handed system:
//! +y is up
//! +x is to the right
//! -z is forward
//! Distance unit is meters by default (@sa UnitFactor()).
const gp_Trsf& HeadPose() const { return myHeadPose; }
//! Return left hand orientation.
gp_Trsf LeftHandPose() const
{
const Standard_Integer aDevice = NamedTrackedDevice (Aspect_XRTrackedDeviceRole_LeftHand);
return aDevice != -1 ? myTrackedPoses[aDevice].Orientation : gp_Trsf();
}
//! Return right hand orientation.
gp_Trsf RightHandPose() const
{
const Standard_Integer aDevice = NamedTrackedDevice (Aspect_XRTrackedDeviceRole_RightHand);
return aDevice != -1 ? myTrackedPoses[aDevice].Orientation : gp_Trsf();
}
//! Return number of tracked poses array.
const Aspect_TrackedDevicePoseArray& TrackedPoses() const { return myTrackedPoses; }
//! Return TRUE if device orientation is defined.
bool HasTrackedPose (Standard_Integer theDevice) const { return myTrackedPoses[theDevice].IsValidPose; }
//! Return index of tracked device of known role, or -1 if undefined.
virtual Standard_Integer NamedTrackedDevice (Aspect_XRTrackedDeviceRole theDevice) const = 0;
//! Load model for displaying device.
//! @param theDevice [in] device index
//! @param theTexture [out] texture source
//! @return model triangulation or NULL if not found
Handle(Graphic3d_ArrayOfTriangles) LoadRenderModel (Standard_Integer theDevice,
Handle(Image_Texture)& theTexture)
{
return loadRenderModel (theDevice, true, theTexture);
}
//! Load model for displaying device.
//! @param theDevice [in] device index
//! @param theToApplyUnitFactor [in] flag to apply unit scale factor
//! @param theTexture [out] texture source
//! @return model triangulation or NULL if not found
Handle(Graphic3d_ArrayOfTriangles) LoadRenderModel (Standard_Integer theDevice,
Standard_Boolean theToApplyUnitFactor,
Handle(Image_Texture)& theTexture)
{
return loadRenderModel (theDevice, theToApplyUnitFactor, theTexture);
}
//! Fetch data for digital input action (like button).
//! @param theAction [in] action of Aspect_XRActionType_InputDigital type
virtual Aspect_XRDigitalActionData GetDigitalActionData (const Handle(Aspect_XRAction)& theAction) const = 0;
//! Fetch data for digital input action (like axis).
//! @param theAction [in] action of Aspect_XRActionType_InputAnalog type
virtual Aspect_XRAnalogActionData GetAnalogActionData (const Handle(Aspect_XRAction)& theAction) const = 0;
//! Fetch data for pose input action (like fingertip position).
//! The returned values will match the values returned by the last call to WaitPoses().
//! @param theAction [in] action of Aspect_XRActionType_InputPose type
virtual Aspect_XRPoseActionData GetPoseActionDataForNextFrame (const Handle(Aspect_XRAction)& theAction) const = 0;
//! Trigger vibration.
Standard_EXPORT void TriggerHapticVibrationAction (const Handle(Aspect_XRAction)& theAction,
const Aspect_XRHapticActionData& theParams);
//! Abort vibration.
Standard_EXPORT void AbortHapticVibrationAction (const Handle(Aspect_XRAction)& theAction);
//! Return tracking origin.
TrackingUniverseOrigin TrackingOrigin() const { return myTrackOrigin; }
//! Set tracking origin.
virtual void SetTrackingOrigin (TrackingUniverseOrigin theOrigin) { myTrackOrigin = theOrigin; }
//! Return generic action for specific hand or NULL if undefined.
const Handle(Aspect_XRAction)& GenericAction (Aspect_XRTrackedDeviceRole theDevice,
Aspect_XRGenericAction theAction) const
{
const NCollection_Array1<Handle(Aspect_XRAction)>& anActions = myRoleActions[theDevice];
return anActions[theAction];
}
public:
//! Info string enumeration.
enum InfoString
{
InfoString_Vendor,
InfoString_Device,
InfoString_Tracker,
InfoString_SerialNumber,
};
//! Query information.
virtual TCollection_AsciiString GetString (InfoString theInfo) const = 0;
protected:
//! Empty constructor.
Standard_EXPORT Aspect_XRSession();
//! Load model for displaying device.
//! @param theDevice [in] device index
//! @param theToApplyUnitFactor [in] flag to apply unit scale factor
//! @param theTexture [out] texture source
//! @return model triangulation or NULL if not found
virtual Handle(Graphic3d_ArrayOfTriangles) loadRenderModel (Standard_Integer theDevice,
Standard_Boolean theToApplyUnitFactor,
Handle(Image_Texture)& theTexture) = 0;
//! Trigger vibration.
virtual void triggerHapticVibrationAction (const Handle(Aspect_XRAction)& theAction,
const Aspect_XRHapticActionData& theParams) = 0;
protected:
NCollection_Array1<Handle(Aspect_XRAction)>
myRoleActions[Aspect_XRTrackedDeviceRole_NB]; //!< generic actions
Aspect_XRActionSetMap myActionSets; //!< actions sets
TrackingUniverseOrigin myTrackOrigin; //!< tracking origin
Aspect_TrackedDevicePoseArray myTrackedPoses; //!< array of tracked poses
gp_Trsf myHeadPose; //!< head orientation
NCollection_Vec2<int> myRendSize; //!< viewport Width x Height for rendering into VR
Aspect_FrustumLRBT<double> myFrustumL; //!< left eye projection frustum
Aspect_FrustumLRBT<double> myFrustumR; //!< right eye projection frustum
Standard_Real myUnitFactor; //!< unit scale factor defined as scale factor for m (meters)
Standard_Real myAspect; //!< aspect ratio
Standard_Real myFieldOfView; //!< field of view
Standard_Real myIod; //!< intra-ocular distance in meters
Standard_ShortReal myDispFreq; //!< display frequency
};
#endif // _Aspect_XRSession_HeaderFile

View File

@@ -1,27 +0,0 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _Aspect_XRTrackedDeviceRole_HeaderFile
#define _Aspect_XRTrackedDeviceRole_HeaderFile
//! Predefined tracked devices.
enum Aspect_XRTrackedDeviceRole
{
Aspect_XRTrackedDeviceRole_Head, //!< head
Aspect_XRTrackedDeviceRole_LeftHand, //!< left hand
Aspect_XRTrackedDeviceRole_RightHand, //!< right hand
Aspect_XRTrackedDeviceRole_Other, //!< other devices
};
enum { Aspect_XRTrackedDeviceRole_NB = Aspect_XRTrackedDeviceRole_Other + 1 };
#endif // _Aspect_XRTrackedDeviceRole_HeaderFile

View File

@@ -5,32 +5,26 @@ Aspect_Background.cxx
Aspect_Background.hxx
Aspect_CircularGrid.cxx
Aspect_CircularGrid.hxx
Aspect_ColorSpace.hxx
Aspect_Convert.hxx
Aspect_Display.hxx
Aspect_DisplayConnection.cxx
Aspect_DisplayConnection.hxx
Aspect_DisplayConnectionDefinitionError.hxx
Aspect_Drawable.hxx
Aspect_Eye.hxx
Aspect_FBConfig.hxx
Aspect_FillMethod.hxx
Aspect_FrustumLRBT.hxx
Aspect_GenId.cxx
Aspect_GenId.hxx
Aspect_GradientBackground.cxx
Aspect_GradientBackground.hxx
Aspect_GradientFillMethod.hxx
Aspect_GraphicDeviceDefinitionError.hxx
Aspect_GraphicsLibrary.hxx
Aspect_Grid.cxx
Aspect_Grid.hxx
Aspect_GridDrawMode.hxx
Aspect_GridType.hxx
Aspect_NeutralWindow.cxx
Aspect_NeutralWindow.hxx
Aspect_OpenVRSession.cxx
Aspect_OpenVRSession.hxx
Aspect_Handle.hxx
Aspect_HatchStyle.hxx
Aspect_IdentDefinitionError.hxx
@@ -43,7 +37,6 @@ Aspect_SequenceOfColor.hxx
Aspect_ScrollDelta.hxx
Aspect_Touch.hxx
Aspect_TouchMap.hxx
Aspect_TrackedDevicePose.hxx
Aspect_TypeOfColorScaleData.hxx
Aspect_TypeOfColorScaleOrientation.hxx
Aspect_TypeOfColorScalePosition.hxx
@@ -67,15 +60,4 @@ Aspect_Window.hxx
Aspect_WindowDefinitionError.hxx
Aspect_WindowError.hxx
Aspect_XAtom.hxx
Aspect_XRAction.hxx
Aspect_XRActionSet.hxx
Aspect_XRActionType.hxx
Aspect_XRAnalogActionData.hxx
Aspect_XRDigitalActionData.hxx
Aspect_XRGenericAction.hxx
Aspect_XRHapticActionData.hxx
Aspect_XRPoseActionData.hxx
Aspect_XRSession.cxx
Aspect_XRSession.hxx
Aspect_XRTrackedDeviceRole.hxx
Aspect_XWD.hxx

View File

@@ -1002,7 +1002,6 @@ void BOPAlgo_PaveFiller::ForceInterfEE()
aBAC1.D1((aT11 + aT12) * 0.5, aPm, aVTgt1);
if (aVTgt1.SquareMagnitude() < gp::Resolution())
continue;
aVTgt1.Normalize();
BOPDS_ListIteratorOfListOfPaveBlock aItLPB2 = aItLPB1;
for (aItLPB2.Next(); aItLPB2.More(); aItLPB2.Next())
@@ -1035,30 +1034,25 @@ void BOPAlgo_PaveFiller::ForceInterfEE()
aPB2->Range(aT21, aT22);
// Check the angle between edges in the middle point.
// If the angle is more than 25 degrees, do not use the additional
// If the angle is more than 10 degrees, do not use the additional
// tolerance, as it may lead to undesired unification of edges
Standard_Boolean bUseAddTol = Standard_True;
{
GeomAPI_ProjectPointOnCurve& aProjPC = myContext->ProjPC(aE2);
aProjPC.Perform(aPm);
if (!aProjPC.NbPoints())
continue;
BRepAdaptor_Curve aBAC2(aE2);
if (aBAC1.GetType() != GeomAbs_Line ||
aBAC2.GetType() != GeomAbs_Line)
{
GeomAPI_ProjectPointOnCurve& aProjPC = myContext->ProjPC(aE2);
aProjPC.Perform(aPm);
if (!aProjPC.NbPoints())
continue;
gp_Pnt aPm2;
gp_Vec aVTgt2;
aBAC2.D1(aProjPC.LowerDistanceParameter(), aPm2, aVTgt2);
if (aVTgt2.SquareMagnitude() < gp::Resolution())
continue;
// The angle should be close to zero
Standard_Real aCos = aVTgt1.Dot (aVTgt2.Normalized());
if (Abs(aCos) < 0.9063)
bUseAddTol = Standard_False;
}
gp_Pnt aPm2;
gp_Vec aVTgt2;
aBAC2.D1(aProjPC.LowerDistanceParameter(), aPm2, aVTgt2);
if (aVTgt2.SquareMagnitude() < gp::Resolution())
continue;
// The angle should be close to zero
Standard_Real aCos = aVTgt1.Dot(aVTgt2);
if (Abs(aCos) < 0.984)
bUseAddTol = Standard_False;
}
// Add pair for intersection

View File

@@ -847,7 +847,6 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB
// Projection tool
GeomAPI_ProjectPointOnSurf& aProjPS = myContext->ProjPS(aF);
BRepAdaptor_Surface& aSurfAdaptor = myContext->SurfaceAdaptor (aF);
// Iterate on pave blocks and combine pairs containing
// the same vertices
@@ -887,7 +886,7 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB
// Check directions coincidence at middle point on the edge
// and projection of that point on the face.
// If the angle between tangent vector to the curve and normal
// of the face is not in the range of 65 - 115 degrees, do not use the additional
// of the face is not in the range of 80 - 100 degrees, do not use the additional
// tolerance, as it may lead to undesired unification of edge with the face.
Standard_Boolean bUseAddTol = Standard_True;
@@ -927,19 +926,15 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB
if (!myContext->IsPointInFace(aF, gp_Pnt2d(U, V)))
continue;
if (aSurfAdaptor.GetType() != GeomAbs_Plane ||
aBAC.GetType() != GeomAbs_Line)
gp_Pnt aPOnS = aProjPS.NearestPoint();
gp_Vec aVFNorm(aPOnS, aPOnE);
if (aVFNorm.SquareMagnitude() > gp::Resolution())
{
gp_Pnt aPOnS = aProjPS.NearestPoint();
gp_Vec aVFNorm(aPOnS, aPOnE);
if (aVFNorm.SquareMagnitude() > gp::Resolution())
{
// Angle between vectors should be close to 90 degrees.
// We allow deviation of 25 degrees.
Standard_Real aCos = aVFNorm.Normalized().Dot (aVETgt.Normalized());
if (Abs(aCos) > 0.4226)
bUseAddTol = Standard_False;
}
// Angle between vectors should be close to 90 degrees.
// We allow deviation of 10 degrees.
Standard_Real aCos = aVFNorm.Dot(aVETgt);
if (Abs(aCos) > 0.174)
bUseAddTol = Standard_False;
}
// Compute an addition to Fuzzy value

View File

@@ -647,7 +647,6 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
aToApproxC2dOnS2,
anAppTol);
aFF.SetList(aListOfPnts);
aFF.SetFuzzyValue (BOPTest_Objects::FuzzyValue());
//
aFF.Perform (aF1, aF2);
//

View File

@@ -51,25 +51,6 @@ BOPTools_Set::BOPTools_Set
mySum=0;
myUpper=432123;
}
//=======================================================================
//function : BOPTools_Set
//purpose :
//=======================================================================
BOPTools_Set::BOPTools_Set (const BOPTools_Set& theOther)
: myAllocator(theOther.myAllocator),
myShape (theOther.myShape),
myNbShapes (theOther.myNbShapes),
mySum (theOther.mySum),
myUpper (theOther.myUpper)
{
for (TopTools_ListIteratorOfListOfShape aIt (theOther.myShapes); aIt.More(); aIt.Next())
{
const TopoDS_Shape& aShape = aIt.Value();
myShapes.Append (aShape);
}
}
//=======================================================================
//function :~
//purpose :

View File

@@ -40,10 +40,7 @@ public:
Standard_EXPORT virtual ~BOPTools_Set();
Standard_EXPORT BOPTools_Set(const Handle(NCollection_BaseAllocator)& theAllocator);
//! Copy constructor.
Standard_EXPORT BOPTools_Set (const BOPTools_Set& theOther);
Standard_EXPORT BOPTools_Set& Assign (const BOPTools_Set& Other);
BOPTools_Set& operator = (const BOPTools_Set& Other)
{

View File

@@ -679,3 +679,19 @@ Handle(Geom_OffsetCurve) BRepAdaptor_Curve::OffsetCurve() const
return myTrsf.Form() == gp_Identity
? anOffC : Handle(Geom_OffsetCurve)::DownCast(anOffC->Transformed(myTrsf));
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void BRepAdaptor_Curve::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_CLASS_BEGIN (theOStream, BRepAdaptor_Curve)
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Adaptor3d_Curve)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myTrsf)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCurve)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myConSurf.get())
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myEdge)
}

View File

@@ -226,6 +226,9 @@ public:
Standard_EXPORT Handle(Geom_OffsetCurve) OffsetCurve() const Standard_OVERRIDE;
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
protected:

View File

@@ -77,4 +77,15 @@ const TopoDS_Face& BRepAdaptor_Curve2d::Face() const
return myFace;
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void BRepAdaptor_Curve2d::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_CLASS_BEGIN (theOStream, BRepAdaptor_Curve2d)
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Geom2dAdaptor_Curve)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myEdge)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myFace)
}

View File

@@ -61,6 +61,8 @@ public:
//! Returns the Face.
Standard_EXPORT const TopoDS_Face& Face() const;
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;

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