mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0028889: Visualization, V3d_View - View specific Graphic3d_Structure should be removed if the view is removed
V3d_View::Remove() - erase trihedron and grid structures from structure manager.
This commit is contained in:
parent
25e59720d6
commit
475c2302d4
@ -11,14 +11,11 @@
|
|||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
// commercial license or contractual agreement.
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
// Modified 23/02/98 : FMN ; Remplacement PI par Standard_PI
|
|
||||||
|
|
||||||
#include <Aspect_CircularGrid.hxx>
|
#include <Aspect_CircularGrid.hxx>
|
||||||
#include <Aspect_Grid.hxx>
|
|
||||||
#include <Standard_NegativeValue.hxx>
|
#include <Standard_NegativeValue.hxx>
|
||||||
#include <Standard_NullValue.hxx>
|
#include <Standard_NullValue.hxx>
|
||||||
#include <Standard_NumericError.hxx>
|
#include <Standard_NumericError.hxx>
|
||||||
#include <Standard_Type.hxx>
|
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(Aspect_CircularGrid,Aspect_Grid)
|
IMPLEMENT_STANDARD_RTTIEXT(Aspect_CircularGrid,Aspect_Grid)
|
||||||
|
|
||||||
|
@ -28,12 +28,9 @@ class Standard_NegativeValue;
|
|||||||
class Standard_NullValue;
|
class Standard_NullValue;
|
||||||
class Standard_NumericError;
|
class Standard_NumericError;
|
||||||
|
|
||||||
class Aspect_CircularGrid;
|
|
||||||
DEFINE_STANDARD_HANDLE(Aspect_CircularGrid, Aspect_Grid)
|
|
||||||
|
|
||||||
class Aspect_CircularGrid : public Aspect_Grid
|
class Aspect_CircularGrid : public Aspect_Grid
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(Aspect_CircularGrid, Aspect_Grid)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! creates a new grid. By default this grid is not
|
//! creates a new grid. By default this grid is not
|
||||||
@ -49,7 +46,7 @@ public:
|
|||||||
Standard_EXPORT void SetGridValues (const Standard_Real XOrigin, const Standard_Real YOrigin, const Standard_Real RadiusStep, const Standard_Integer DivisionNumber, const Standard_Real RotationAngle);
|
Standard_EXPORT void SetGridValues (const Standard_Real XOrigin, const Standard_Real YOrigin, const Standard_Real RadiusStep, const Standard_Integer DivisionNumber, const Standard_Real RotationAngle);
|
||||||
|
|
||||||
//! returns the point of the grid the closest to the point X,Y
|
//! returns the point of the grid the closest to the point X,Y
|
||||||
Standard_EXPORT void Compute (const Standard_Real X, const Standard_Real Y, Standard_Real& gridX, Standard_Real& gridY) const Standard_OVERRIDE;
|
Standard_EXPORT virtual void Compute (const Standard_Real X, const Standard_Real Y, Standard_Real& gridX, Standard_Real& gridY) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! returns the x step of the grid.
|
//! returns the x step of the grid.
|
||||||
Standard_EXPORT Standard_Real RadiusStep() const;
|
Standard_EXPORT Standard_Real RadiusStep() const;
|
||||||
@ -57,9 +54,7 @@ public:
|
|||||||
//! returns the x step of the grid.
|
//! returns the x step of the grid.
|
||||||
Standard_EXPORT Standard_Integer DivisionNumber() const;
|
Standard_EXPORT Standard_Integer DivisionNumber() const;
|
||||||
|
|
||||||
Standard_EXPORT void Init() Standard_OVERRIDE;
|
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(Aspect_CircularGrid,Aspect_Grid)
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -71,4 +66,6 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DEFINE_STANDARD_HANDLE(Aspect_CircularGrid, Aspect_Grid)
|
||||||
|
|
||||||
#endif // _Aspect_CircularGrid_HeaderFile
|
#endif // _Aspect_CircularGrid_HeaderFile
|
||||||
|
@ -11,123 +11,96 @@
|
|||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
// commercial license or contractual agreement.
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
|
|
||||||
#include <Aspect_Grid.hxx>
|
#include <Aspect_Grid.hxx>
|
||||||
#include <Quantity_Color.hxx>
|
|
||||||
#include <Standard_Type.hxx>
|
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(Aspect_Grid,Standard_Transient)
|
IMPLEMENT_STANDARD_RTTIEXT(Aspect_Grid,Standard_Transient)
|
||||||
|
|
||||||
Aspect_Grid::Aspect_Grid(
|
Aspect_Grid::Aspect_Grid (const Standard_Real theXOrigin,
|
||||||
const Standard_Real anXOrigin,
|
const Standard_Real theYOrigin,
|
||||||
const Standard_Real anYOrigin,
|
const Standard_Real theAngle,
|
||||||
const Standard_Real anAngle,
|
const Quantity_Color& theColor,
|
||||||
const Quantity_Color& aColor,
|
const Quantity_Color& theTenthColor)
|
||||||
const Quantity_Color& aTenthColor)
|
: myRotationAngle (theAngle),
|
||||||
: myRotationAngle(anAngle),
|
myXOrigin (theXOrigin),
|
||||||
myXOrigin(anXOrigin),
|
myYOrigin (theYOrigin),
|
||||||
myYOrigin(anYOrigin),
|
myColor (theColor),
|
||||||
myColor(aColor),
|
myTenthColor (theTenthColor),
|
||||||
myTenthColor(aTenthColor),
|
myIsActive (Standard_False),
|
||||||
myIsActive(Standard_False),
|
myDrawMode (Aspect_GDM_Lines)
|
||||||
myDrawMode(Aspect_GDM_Lines)
|
|
||||||
{
|
{
|
||||||
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Aspect_Grid::SetXOrigin (const Standard_Real theOrigin)
|
||||||
void Aspect_Grid::SetXOrigin(const Standard_Real anOrigin) {
|
{
|
||||||
myXOrigin = anOrigin;
|
myXOrigin = theOrigin;
|
||||||
Init();
|
Init();
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aspect_Grid::SetYOrigin(const Standard_Real anOrigin) {
|
void Aspect_Grid::SetYOrigin (const Standard_Real theOrigin)
|
||||||
myYOrigin = anOrigin;
|
{
|
||||||
|
myYOrigin = theOrigin;
|
||||||
Init();
|
Init();
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aspect_Grid::SetRotationAngle(const Standard_Real anAngle){
|
void Aspect_Grid::SetRotationAngle (const Standard_Real theAngle)
|
||||||
|
{
|
||||||
|
myRotationAngle = theAngle;
|
||||||
myRotationAngle = anAngle;
|
|
||||||
Init();
|
|
||||||
UpdateDisplay();
|
|
||||||
}
|
|
||||||
void Aspect_Grid::Rotate(const Standard_Real anAngle) {
|
|
||||||
myRotationAngle += anAngle;
|
|
||||||
Init();
|
|
||||||
UpdateDisplay();
|
|
||||||
}
|
|
||||||
void Aspect_Grid::Translate(const Standard_Real aDx,
|
|
||||||
const Standard_Real aDy) {
|
|
||||||
myXOrigin += aDx;
|
|
||||||
myYOrigin += aDy;
|
|
||||||
Init();
|
Init();
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aspect_Grid::SetColors(const Quantity_Color& aColor,
|
void Aspect_Grid::Rotate (const Standard_Real theAngle)
|
||||||
const Quantity_Color& aTenthColor) {
|
{
|
||||||
myColor = aColor;
|
myRotationAngle += theAngle;
|
||||||
myTenthColor = aTenthColor;
|
Init();
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aspect_Grid::Colors(Quantity_Color& aColor,
|
void Aspect_Grid::Translate (const Standard_Real theDx,
|
||||||
Quantity_Color& aTenthColor) const {
|
const Standard_Real theDy)
|
||||||
aColor = myColor;
|
{
|
||||||
aTenthColor = myTenthColor;
|
myXOrigin += theDx;
|
||||||
|
myYOrigin += theDy;
|
||||||
|
Init();
|
||||||
|
UpdateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aspect_Grid::Hit(const Standard_Real X,
|
void Aspect_Grid::SetColors (const Quantity_Color& theColor,
|
||||||
const Standard_Real Y,
|
const Quantity_Color& theTenthColor)
|
||||||
Standard_Real& gridX,
|
{
|
||||||
Standard_Real& gridY) const {
|
myColor = theColor;
|
||||||
if (myIsActive) {
|
myTenthColor = theTenthColor;
|
||||||
Compute(X,Y,gridX,gridY);}
|
UpdateDisplay();
|
||||||
else{
|
}
|
||||||
gridX = X;
|
|
||||||
gridY = Y;
|
void Aspect_Grid::Colors (Quantity_Color& theColor,
|
||||||
|
Quantity_Color& theTenthColor) const
|
||||||
|
{
|
||||||
|
theColor = myColor;
|
||||||
|
theTenthColor = myTenthColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Aspect_Grid::Hit (const Standard_Real theX,
|
||||||
|
const Standard_Real theY,
|
||||||
|
Standard_Real& theGridX,
|
||||||
|
Standard_Real& theGridY) const
|
||||||
|
{
|
||||||
|
if (myIsActive)
|
||||||
|
{
|
||||||
|
Compute (theX, theY, theGridX, theGridY);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
theGridX = theX;
|
||||||
|
theGridY = theY;
|
||||||
}
|
}
|
||||||
void Aspect_Grid::Activate () {
|
|
||||||
myIsActive = Standard_True;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aspect_Grid::Deactivate () {
|
void Aspect_Grid::SetDrawMode (const Aspect_GridDrawMode theDrawMode)
|
||||||
myIsActive = Standard_False;
|
{
|
||||||
}
|
myDrawMode = theDrawMode;
|
||||||
|
|
||||||
Standard_Real Aspect_Grid::XOrigin() const {
|
|
||||||
return myXOrigin;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Real Aspect_Grid::YOrigin() const {
|
|
||||||
return myYOrigin;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Real Aspect_Grid::RotationAngle() const {
|
|
||||||
return myRotationAngle;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_Boolean Aspect_Grid::IsActive() const {
|
|
||||||
return myIsActive;
|
|
||||||
}
|
|
||||||
void Aspect_Grid::Display() {}
|
|
||||||
|
|
||||||
void Aspect_Grid::Erase () const {}
|
|
||||||
|
|
||||||
void Aspect_Grid::UpdateDisplay () {}
|
|
||||||
|
|
||||||
|
|
||||||
Standard_Boolean Aspect_Grid::IsDisplayed() const {
|
|
||||||
return Standard_False;}
|
|
||||||
|
|
||||||
void Aspect_Grid::SetDrawMode(const Aspect_GridDrawMode aDrawMode) {
|
|
||||||
myDrawMode = aDrawMode;
|
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
}
|
}
|
||||||
Aspect_GridDrawMode Aspect_Grid::DrawMode() const {
|
|
||||||
return myDrawMode;
|
|
||||||
}
|
|
||||||
|
@ -25,12 +25,9 @@
|
|||||||
#include <Aspect_GridDrawMode.hxx>
|
#include <Aspect_GridDrawMode.hxx>
|
||||||
#include <Standard_Transient.hxx>
|
#include <Standard_Transient.hxx>
|
||||||
|
|
||||||
class Aspect_Grid;
|
|
||||||
DEFINE_STANDARD_HANDLE(Aspect_Grid, Standard_Transient)
|
|
||||||
|
|
||||||
class Aspect_Grid : public Standard_Transient
|
class Aspect_Grid : public Standard_Transient
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(Aspect_Grid, Standard_Transient)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! defines the x Origin of the grid.
|
//! defines the x Origin of the grid.
|
||||||
@ -39,7 +36,7 @@ public:
|
|||||||
//! defines the y Origin of the grid.
|
//! defines the y Origin of the grid.
|
||||||
Standard_EXPORT void SetYOrigin (const Standard_Real anOrigin);
|
Standard_EXPORT void SetYOrigin (const Standard_Real anOrigin);
|
||||||
|
|
||||||
//! defines the orientation of the the grid.
|
//! defines the orientation of the grid.
|
||||||
Standard_EXPORT void SetRotationAngle (const Standard_Real anAngle);
|
Standard_EXPORT void SetRotationAngle (const Standard_Real anAngle);
|
||||||
|
|
||||||
//! Rotate the grid from a relative angle.
|
//! Rotate the grid from a relative angle.
|
||||||
@ -62,23 +59,23 @@ public:
|
|||||||
//! activates the grid. The Hit method will return
|
//! activates the grid. The Hit method will return
|
||||||
//! gridx and gridx computed according to the steps
|
//! gridx and gridx computed according to the steps
|
||||||
//! of the grid.
|
//! of the grid.
|
||||||
Standard_EXPORT void Activate();
|
void Activate() { myIsActive = Standard_True; }
|
||||||
|
|
||||||
//! deactivates the grid. The hit method will return
|
//! deactivates the grid. The hit method will return
|
||||||
//! gridx and gridx as the enter value X & Y.
|
//! gridx and gridx as the enter value X & Y.
|
||||||
Standard_EXPORT void Deactivate();
|
void Deactivate() { myIsActive = Standard_False; }
|
||||||
|
|
||||||
//! returns the x Origin of the grid.
|
//! returns the x Origin of the grid.
|
||||||
Standard_EXPORT Standard_Real XOrigin() const;
|
Standard_Real XOrigin() const { return myXOrigin; }
|
||||||
|
|
||||||
//! returns the x Origin of the grid.
|
//! returns the x Origin of the grid.
|
||||||
Standard_EXPORT Standard_Real YOrigin() const;
|
Standard_Real YOrigin() const { return myYOrigin; }
|
||||||
|
|
||||||
//! returns the x Angle of the grid.
|
//! returns the x Angle of the grid.
|
||||||
Standard_EXPORT Standard_Real RotationAngle() const;
|
Standard_Real RotationAngle() const { return myRotationAngle; }
|
||||||
|
|
||||||
//! Returns TRUE when the grid is active.
|
//! Returns TRUE when the grid is active.
|
||||||
Standard_EXPORT Standard_Boolean IsActive() const;
|
Standard_Boolean IsActive() const { return myIsActive; }
|
||||||
|
|
||||||
//! Returns the colors of the grid.
|
//! Returns the colors of the grid.
|
||||||
Standard_EXPORT void Colors (Quantity_Color& aColor, Quantity_Color& aTenthColor) const;
|
Standard_EXPORT void Colors (Quantity_Color& aColor, Quantity_Color& aTenthColor) const;
|
||||||
@ -87,41 +84,43 @@ public:
|
|||||||
Standard_EXPORT void SetDrawMode (const Aspect_GridDrawMode aDrawMode);
|
Standard_EXPORT void SetDrawMode (const Aspect_GridDrawMode aDrawMode);
|
||||||
|
|
||||||
//! Returns the grid aspect.
|
//! Returns the grid aspect.
|
||||||
Standard_EXPORT Aspect_GridDrawMode DrawMode() const;
|
Aspect_GridDrawMode DrawMode() const { return myDrawMode; }
|
||||||
|
|
||||||
//! Display the grid at screen.
|
//! Display the grid at screen.
|
||||||
Standard_EXPORT virtual void Display();
|
Standard_EXPORT virtual void Display() = 0;
|
||||||
|
|
||||||
//! Erase the grid from screen.
|
//! Erase the grid from screen.
|
||||||
Standard_EXPORT virtual void Erase() const;
|
Standard_EXPORT virtual void Erase() const = 0;
|
||||||
|
|
||||||
//! Returns TRUE when the grid is displayed at screen.
|
//! Returns TRUE when the grid is displayed at screen.
|
||||||
Standard_EXPORT virtual Standard_Boolean IsDisplayed() const;
|
Standard_EXPORT virtual Standard_Boolean IsDisplayed() const = 0;
|
||||||
|
|
||||||
Standard_EXPORT virtual void Init() = 0;
|
Standard_EXPORT virtual void Init() = 0;
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(Aspect_Grid,Standard_Transient)
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//! creates a new grid. By default this grid is not
|
//! Creates a new grid. By default this grid is not active.
|
||||||
//! active.
|
Standard_EXPORT Aspect_Grid (const Standard_Real theXOrigin = 0.0,
|
||||||
Standard_EXPORT Aspect_Grid(const Standard_Real anXOrigin = 0.0, const Standard_Real anYOrigin = 0.0, const Standard_Real aRotationAngle = 0, const Quantity_Color& aColor = Quantity_NOC_GRAY50, const Quantity_Color& aTenthColor = Quantity_NOC_GRAY70);
|
const Standard_Real theYOrigin = 0.0,
|
||||||
|
const Standard_Real theRotationAngle = 0,
|
||||||
|
const Quantity_Color& theColor = Quantity_NOC_GRAY50,
|
||||||
|
const Quantity_Color& theTenthColor = Quantity_NOC_GRAY70);
|
||||||
|
|
||||||
//! Updates the grid parameters.
|
//! Updates the grid parameters.
|
||||||
Standard_EXPORT virtual void UpdateDisplay();
|
Standard_EXPORT virtual void UpdateDisplay() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
Standard_Real myRotationAngle;
|
Standard_Real myRotationAngle;
|
||||||
Standard_Real myXOrigin;
|
Standard_Real myXOrigin;
|
||||||
Standard_Real myYOrigin;
|
Standard_Real myYOrigin;
|
||||||
Quantity_Color myColor;
|
Quantity_Color myColor;
|
||||||
Quantity_Color myTenthColor;
|
Quantity_Color myTenthColor;
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Standard_Boolean myIsActive;
|
Standard_Boolean myIsActive;
|
||||||
Aspect_GridDrawMode myDrawMode;
|
Aspect_GridDrawMode myDrawMode;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DEFINE_STANDARD_HANDLE(Aspect_Grid, Standard_Transient)
|
||||||
|
|
||||||
#endif // _Aspect_Grid_HeaderFile
|
#endif // _Aspect_Grid_HeaderFile
|
||||||
|
@ -11,13 +11,11 @@
|
|||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
// commercial license or contractual agreement.
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
// Modified 23/02/98 : FMN ; Remplacement PI par Standard_PI
|
|
||||||
|
|
||||||
#include <Aspect_RectangularGrid.hxx>
|
#include <Aspect_RectangularGrid.hxx>
|
||||||
|
|
||||||
#include <Standard_NegativeValue.hxx>
|
#include <Standard_NegativeValue.hxx>
|
||||||
#include <Standard_NullValue.hxx>
|
#include <Standard_NullValue.hxx>
|
||||||
#include <Standard_NumericError.hxx>
|
#include <Standard_NumericError.hxx>
|
||||||
#include <Standard_Type.hxx>
|
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(Aspect_RectangularGrid,Aspect_Grid)
|
IMPLEMENT_STANDARD_RTTIEXT(Aspect_RectangularGrid,Aspect_Grid)
|
||||||
|
|
||||||
@ -157,5 +155,3 @@ Standard_Boolean Aspect_RectangularGrid::CheckAngle(const Standard_Real alpha,
|
|||||||
const Standard_Real beta) const {
|
const Standard_Real beta) const {
|
||||||
return (Abs( Sin(alpha) * Cos(beta + M_PI / 2.) - Cos(alpha) * Sin(beta + M_PI / 2.)) != 0) ;
|
return (Abs( Sin(alpha) * Cos(beta + M_PI / 2.) - Cos(alpha) * Sin(beta + M_PI / 2.)) != 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,15 +27,11 @@ class Standard_NegativeValue;
|
|||||||
class Standard_NullValue;
|
class Standard_NullValue;
|
||||||
class Standard_NumericError;
|
class Standard_NumericError;
|
||||||
|
|
||||||
class Aspect_RectangularGrid;
|
|
||||||
DEFINE_STANDARD_HANDLE(Aspect_RectangularGrid, Aspect_Grid)
|
|
||||||
|
|
||||||
class Aspect_RectangularGrid : public Aspect_Grid
|
class Aspect_RectangularGrid : public Aspect_Grid
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(Aspect_RectangularGrid, Aspect_Grid)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
//! creates a new grid. By default this grid is not
|
//! creates a new grid. By default this grid is not
|
||||||
//! active.
|
//! active.
|
||||||
//! The first angle is given relatively to the horizontal.
|
//! The first angle is given relatively to the horizontal.
|
||||||
@ -56,7 +52,7 @@ public:
|
|||||||
Standard_EXPORT void SetGridValues (const Standard_Real XOrigin, const Standard_Real YOrigin, const Standard_Real XStep, const Standard_Real YStep, const Standard_Real RotationAngle);
|
Standard_EXPORT void SetGridValues (const Standard_Real XOrigin, const Standard_Real YOrigin, const Standard_Real XStep, const Standard_Real YStep, const Standard_Real RotationAngle);
|
||||||
|
|
||||||
//! returns the point of the grid the closest to the point X,Y
|
//! returns the point of the grid the closest to the point X,Y
|
||||||
Standard_EXPORT void Compute (const Standard_Real X, const Standard_Real Y, Standard_Real& gridX, Standard_Real& gridY) const Standard_OVERRIDE;
|
Standard_EXPORT virtual void Compute (const Standard_Real X, const Standard_Real Y, Standard_Real& gridX, Standard_Real& gridY) const Standard_OVERRIDE;
|
||||||
|
|
||||||
//! returns the x step of the grid.
|
//! returns the x step of the grid.
|
||||||
Standard_EXPORT Standard_Real XStep() const;
|
Standard_EXPORT Standard_Real XStep() const;
|
||||||
@ -70,14 +66,14 @@ public:
|
|||||||
//! returns the y Angle of the grid, relatively to the vertical.
|
//! returns the y Angle of the grid, relatively to the vertical.
|
||||||
Standard_EXPORT Standard_Real SecondAngle() const;
|
Standard_EXPORT Standard_Real SecondAngle() const;
|
||||||
|
|
||||||
Standard_EXPORT void Init() Standard_OVERRIDE;
|
Standard_EXPORT virtual void Init() Standard_OVERRIDE;
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(Aspect_RectangularGrid,Aspect_Grid)
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean CheckAngle (const Standard_Real alpha, const Standard_Real beta) const;
|
Standard_EXPORT Standard_Boolean CheckAngle (const Standard_Real alpha, const Standard_Real beta) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
Standard_Real myXStep;
|
Standard_Real myXStep;
|
||||||
Standard_Real myYStep;
|
Standard_Real myYStep;
|
||||||
Standard_Real myFirstAngle;
|
Standard_Real myFirstAngle;
|
||||||
@ -91,4 +87,6 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DEFINE_STANDARD_HANDLE(Aspect_RectangularGrid, Aspect_Grid)
|
||||||
|
|
||||||
#endif // _Aspect_RectangularGrid_HeaderFile
|
#endif // _Aspect_RectangularGrid_HeaderFile
|
||||||
|
@ -34,7 +34,6 @@ IMPLEMENT_STANDARD_RTTIEXT(V3d_CircularGrid,Aspect_CircularGrid)
|
|||||||
* Constant
|
* Constant
|
||||||
*/
|
*/
|
||||||
#define DIVISION 8
|
#define DIVISION 8
|
||||||
#define MYMINMAX 25.
|
|
||||||
#define MYFACTOR 50.
|
#define MYFACTOR 50.
|
||||||
|
|
||||||
/*----------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------*/
|
||||||
@ -57,6 +56,15 @@ V3d_CircularGrid::V3d_CircularGrid (const V3d_ViewerPointer& aViewer, const Quan
|
|||||||
SetRadiusStep (step);
|
SetRadiusStep (step);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
V3d_CircularGrid::~V3d_CircularGrid()
|
||||||
|
{
|
||||||
|
myGroup.Nullify();
|
||||||
|
if (!myStructure.IsNull())
|
||||||
|
{
|
||||||
|
myStructure->Erase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void V3d_CircularGrid::SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor)
|
void V3d_CircularGrid::SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor)
|
||||||
{
|
{
|
||||||
if( myColor != aColor || myTenthColor != aTenthColor ) {
|
if( myColor != aColor || myTenthColor != aTenthColor ) {
|
||||||
@ -144,10 +152,9 @@ void V3d_CircularGrid::UpdateDisplay ()
|
|||||||
myCurViewPlane = ThePlane;
|
myCurViewPlane = ThePlane;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (DrawMode())
|
switch (myDrawMode)
|
||||||
{
|
{
|
||||||
default:
|
case Aspect_GDM_Points:
|
||||||
//case Aspect_GDM_Points:
|
|
||||||
DefinePoints ();
|
DefinePoints ();
|
||||||
myCurDrawMode = Aspect_GDM_Points;
|
myCurDrawMode = Aspect_GDM_Points;
|
||||||
break;
|
break;
|
||||||
@ -155,11 +162,9 @@ void V3d_CircularGrid::UpdateDisplay ()
|
|||||||
DefineLines ();
|
DefineLines ();
|
||||||
myCurDrawMode = Aspect_GDM_Lines;
|
myCurDrawMode = Aspect_GDM_Lines;
|
||||||
break;
|
break;
|
||||||
#ifdef IMP210100
|
|
||||||
case Aspect_GDM_None:
|
case Aspect_GDM_None:
|
||||||
myCurDrawMode = Aspect_GDM_None;
|
myCurDrawMode = Aspect_GDM_None;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
myCurAreDefined = Standard_True;
|
myCurAreDefined = Standard_True;
|
||||||
}
|
}
|
||||||
|
@ -29,21 +29,16 @@
|
|||||||
#include <Aspect_CircularGrid.hxx>
|
#include <Aspect_CircularGrid.hxx>
|
||||||
class Graphic3d_Structure;
|
class Graphic3d_Structure;
|
||||||
class Graphic3d_Group;
|
class Graphic3d_Group;
|
||||||
class Quantity_Color;
|
|
||||||
|
|
||||||
|
|
||||||
class V3d_CircularGrid;
|
|
||||||
DEFINE_STANDARD_HANDLE(V3d_CircularGrid, Aspect_CircularGrid)
|
|
||||||
|
|
||||||
|
|
||||||
class V3d_CircularGrid : public Aspect_CircularGrid
|
class V3d_CircularGrid : public Aspect_CircularGrid
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(V3d_CircularGrid, Aspect_CircularGrid)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT V3d_CircularGrid(const V3d_ViewerPointer& aViewer, const Quantity_Color& aColor, const Quantity_Color& aTenthColor);
|
Standard_EXPORT V3d_CircularGrid(const V3d_ViewerPointer& aViewer, const Quantity_Color& aColor, const Quantity_Color& aTenthColor);
|
||||||
|
|
||||||
|
Standard_EXPORT virtual ~V3d_CircularGrid();
|
||||||
|
|
||||||
Standard_EXPORT void SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor) Standard_OVERRIDE;
|
Standard_EXPORT void SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor) Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT void Display() Standard_OVERRIDE;
|
Standard_EXPORT void Display() Standard_OVERRIDE;
|
||||||
@ -56,25 +51,18 @@ public:
|
|||||||
|
|
||||||
Standard_EXPORT void SetGraphicValues (const Standard_Real Radius, const Standard_Real OffSet);
|
Standard_EXPORT void SetGraphicValues (const Standard_Real Radius, const Standard_Real OffSet);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(V3d_CircularGrid,Aspect_CircularGrid)
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT void UpdateDisplay() Standard_OVERRIDE;
|
Standard_EXPORT void UpdateDisplay() Standard_OVERRIDE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT void DefineLines();
|
Standard_EXPORT void DefineLines();
|
||||||
|
|
||||||
Standard_EXPORT void DefinePoints();
|
Standard_EXPORT void DefinePoints();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
Handle(Graphic3d_Structure) myStructure;
|
Handle(Graphic3d_Structure) myStructure;
|
||||||
Handle(Graphic3d_Group) myGroup;
|
Handle(Graphic3d_Group) myGroup;
|
||||||
gp_Ax3 myCurViewPlane;
|
gp_Ax3 myCurViewPlane;
|
||||||
@ -89,13 +77,8 @@ private:
|
|||||||
Standard_Real myRadius;
|
Standard_Real myRadius;
|
||||||
Standard_Real myOffSet;
|
Standard_Real myOffSet;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DEFINE_STANDARD_HANDLE(V3d_CircularGrid, Aspect_CircularGrid)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _V3d_CircularGrid_HeaderFile
|
#endif // _V3d_CircularGrid_HeaderFile
|
||||||
|
@ -11,21 +11,7 @@
|
|||||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||||
// commercial license or contractual agreement.
|
// commercial license or contractual agreement.
|
||||||
|
|
||||||
/***********************************************************************
|
#include <V3d_RectangularGrid.hxx>
|
||||||
FONCTION :
|
|
||||||
----------
|
|
||||||
Classe V3d_CircularGrid :
|
|
||||||
HISTORIQUE DES MODIFICATIONS :
|
|
||||||
--------------------------------
|
|
||||||
16-08-98 : CAL ; S3892. Ajout grilles 3d.
|
|
||||||
13-10-98 : CAL ; S3892. Ajout de la gestion de la taille des grilles 3d.
|
|
||||||
23-10-98 : CAL ; PRO 15885. Patch K4403 et K4404
|
|
||||||
03-11-98 : CAL ; PRO 16161. Patch K4418 et K4419
|
|
||||||
************************************************************************/
|
|
||||||
/*----------------------------------------------------------------------*/
|
|
||||||
/*
|
|
||||||
* Includes
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <Graphic3d_ArrayOfPoints.hxx>
|
#include <Graphic3d_ArrayOfPoints.hxx>
|
||||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||||
@ -38,7 +24,6 @@
|
|||||||
#include <Standard_Type.hxx>
|
#include <Standard_Type.hxx>
|
||||||
#include <TColgp_SequenceOfPnt.hxx>
|
#include <TColgp_SequenceOfPnt.hxx>
|
||||||
#include <TColStd_Array2OfReal.hxx>
|
#include <TColStd_Array2OfReal.hxx>
|
||||||
#include <V3d_RectangularGrid.hxx>
|
|
||||||
#include <V3d_Viewer.hxx>
|
#include <V3d_Viewer.hxx>
|
||||||
|
|
||||||
IMPLEMENT_STANDARD_RTTIEXT(V3d_RectangularGrid,Aspect_RectangularGrid)
|
IMPLEMENT_STANDARD_RTTIEXT(V3d_RectangularGrid,Aspect_RectangularGrid)
|
||||||
@ -47,7 +32,6 @@ IMPLEMENT_STANDARD_RTTIEXT(V3d_RectangularGrid,Aspect_RectangularGrid)
|
|||||||
/*
|
/*
|
||||||
* Constant
|
* Constant
|
||||||
*/
|
*/
|
||||||
#define MYMINMAX 25.
|
|
||||||
#define MYFACTOR 50.
|
#define MYFACTOR 50.
|
||||||
|
|
||||||
/*----------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------*/
|
||||||
@ -72,6 +56,15 @@ V3d_RectangularGrid::V3d_RectangularGrid (const V3d_ViewerPointer& aViewer, cons
|
|||||||
SetYStep (step);
|
SetYStep (step);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
V3d_RectangularGrid::~V3d_RectangularGrid()
|
||||||
|
{
|
||||||
|
myGroup.Nullify();
|
||||||
|
if (!myStructure.IsNull())
|
||||||
|
{
|
||||||
|
myStructure->Erase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void V3d_RectangularGrid::SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor)
|
void V3d_RectangularGrid::SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor)
|
||||||
{
|
{
|
||||||
if( myColor != aColor || myTenthColor != aTenthColor ) {
|
if( myColor != aColor || myTenthColor != aTenthColor ) {
|
||||||
@ -158,10 +151,9 @@ void V3d_RectangularGrid::UpdateDisplay ()
|
|||||||
myCurViewPlane = ThePlane;
|
myCurViewPlane = ThePlane;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (DrawMode ())
|
switch (myDrawMode)
|
||||||
{
|
{
|
||||||
default:
|
case Aspect_GDM_Points:
|
||||||
//case Aspect_GDM_Points:
|
|
||||||
DefinePoints ();
|
DefinePoints ();
|
||||||
myCurDrawMode = Aspect_GDM_Points;
|
myCurDrawMode = Aspect_GDM_Points;
|
||||||
break;
|
break;
|
||||||
@ -169,11 +161,9 @@ void V3d_RectangularGrid::UpdateDisplay ()
|
|||||||
DefineLines ();
|
DefineLines ();
|
||||||
myCurDrawMode = Aspect_GDM_Lines;
|
myCurDrawMode = Aspect_GDM_Lines;
|
||||||
break;
|
break;
|
||||||
#ifdef IMP210100
|
|
||||||
case Aspect_GDM_None:
|
case Aspect_GDM_None:
|
||||||
myCurDrawMode = Aspect_GDM_None;
|
myCurDrawMode = Aspect_GDM_None;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
myCurAreDefined = Standard_True;
|
myCurAreDefined = Standard_True;
|
||||||
}
|
}
|
||||||
|
@ -28,52 +28,40 @@
|
|||||||
#include <Aspect_RectangularGrid.hxx>
|
#include <Aspect_RectangularGrid.hxx>
|
||||||
class Graphic3d_Structure;
|
class Graphic3d_Structure;
|
||||||
class Graphic3d_Group;
|
class Graphic3d_Group;
|
||||||
class Quantity_Color;
|
|
||||||
|
|
||||||
|
|
||||||
class V3d_RectangularGrid;
|
|
||||||
DEFINE_STANDARD_HANDLE(V3d_RectangularGrid, Aspect_RectangularGrid)
|
|
||||||
|
|
||||||
|
|
||||||
class V3d_RectangularGrid : public Aspect_RectangularGrid
|
class V3d_RectangularGrid : public Aspect_RectangularGrid
|
||||||
{
|
{
|
||||||
|
DEFINE_STANDARD_RTTIEXT(V3d_RectangularGrid, Aspect_RectangularGrid)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT V3d_RectangularGrid(const V3d_ViewerPointer& aViewer, const Quantity_Color& aColor, const Quantity_Color& aTenthColor);
|
Standard_EXPORT V3d_RectangularGrid(const V3d_ViewerPointer& aViewer, const Quantity_Color& aColor, const Quantity_Color& aTenthColor);
|
||||||
|
|
||||||
Standard_EXPORT void SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor) Standard_OVERRIDE;
|
Standard_EXPORT virtual ~V3d_RectangularGrid();
|
||||||
|
|
||||||
Standard_EXPORT void Display() Standard_OVERRIDE;
|
Standard_EXPORT virtual void SetColors (const Quantity_Color& aColor, const Quantity_Color& aTenthColor) Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT void Erase() const Standard_OVERRIDE;
|
Standard_EXPORT virtual void Display() Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean IsDisplayed() const Standard_OVERRIDE;
|
Standard_EXPORT virtual void Erase() const Standard_OVERRIDE;
|
||||||
|
|
||||||
|
Standard_EXPORT virtual Standard_Boolean IsDisplayed() const Standard_OVERRIDE;
|
||||||
|
|
||||||
Standard_EXPORT void GraphicValues (Standard_Real& XSize, Standard_Real& YSize, Standard_Real& OffSet) const;
|
Standard_EXPORT void GraphicValues (Standard_Real& XSize, Standard_Real& YSize, Standard_Real& OffSet) const;
|
||||||
|
|
||||||
Standard_EXPORT void SetGraphicValues (const Standard_Real XSize, const Standard_Real YSize, const Standard_Real OffSet);
|
Standard_EXPORT void SetGraphicValues (const Standard_Real XSize, const Standard_Real YSize, const Standard_Real OffSet);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(V3d_RectangularGrid,Aspect_RectangularGrid)
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
Standard_EXPORT virtual void UpdateDisplay() Standard_OVERRIDE;
|
||||||
Standard_EXPORT void UpdateDisplay() Standard_OVERRIDE;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT void DefineLines();
|
Standard_EXPORT void DefineLines();
|
||||||
|
|
||||||
Standard_EXPORT void DefinePoints();
|
Standard_EXPORT void DefinePoints();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
Handle(Graphic3d_Structure) myStructure;
|
Handle(Graphic3d_Structure) myStructure;
|
||||||
Handle(Graphic3d_Group) myGroup;
|
Handle(Graphic3d_Group) myGroup;
|
||||||
gp_Ax3 myCurViewPlane;
|
gp_Ax3 myCurViewPlane;
|
||||||
@ -89,13 +77,8 @@ private:
|
|||||||
Standard_Real myYSize;
|
Standard_Real myYSize;
|
||||||
Standard_Real myOffSet;
|
Standard_Real myOffSet;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DEFINE_STANDARD_HANDLE(V3d_RectangularGrid, Aspect_RectangularGrid)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _V3d_RectangularGrid_HeaderFile
|
#endif // _V3d_RectangularGrid_HeaderFile
|
||||||
|
@ -127,6 +127,15 @@ V3d_Trihedron::V3d_Trihedron()
|
|||||||
myTextAspect->SetVerticalJustification (Graphic3d_VTA_BOTTOM);
|
myTextAspect->SetVerticalJustification (Graphic3d_VTA_BOTTOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// function : V3d_Trihedron
|
||||||
|
// purpose :
|
||||||
|
// ============================================================================
|
||||||
|
V3d_Trihedron::~V3d_Trihedron()
|
||||||
|
{
|
||||||
|
Erase();
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// function : SetLabelsColor
|
// function : SetLabelsColor
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@ -35,6 +35,9 @@ public:
|
|||||||
//! Creates a default trihedron.
|
//! Creates a default trihedron.
|
||||||
Standard_EXPORT V3d_Trihedron();
|
Standard_EXPORT V3d_Trihedron();
|
||||||
|
|
||||||
|
//! Destructor.
|
||||||
|
Standard_EXPORT virtual ~V3d_Trihedron();
|
||||||
|
|
||||||
//! Switch wireframe / shaded trihedron.
|
//! Switch wireframe / shaded trihedron.
|
||||||
void SetWireframe (const Standard_Boolean theAsWireframe) { myIsWireframe = theAsWireframe; }
|
void SetWireframe (const Standard_Boolean theAsWireframe) { myIsWireframe = theAsWireframe; }
|
||||||
|
|
||||||
|
@ -200,6 +200,15 @@ void V3d_View::SetWindow (const Handle(Aspect_Window)& theWindow,
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
void V3d_View::Remove() const
|
void V3d_View::Remove() const
|
||||||
{
|
{
|
||||||
|
if (!MyGrid.IsNull())
|
||||||
|
{
|
||||||
|
MyGrid->Erase();
|
||||||
|
}
|
||||||
|
if (!myTrihedron.IsNull())
|
||||||
|
{
|
||||||
|
myTrihedron->Erase();
|
||||||
|
}
|
||||||
|
|
||||||
MyViewer->DelView (this);
|
MyViewer->DelView (this);
|
||||||
myView->Remove();
|
myView->Remove();
|
||||||
Handle(Aspect_Window)& aWin = const_cast<Handle(Aspect_Window)&> (MyWindow);
|
Handle(Aspect_Window)& aWin = const_cast<Handle(Aspect_Window)&> (MyWindow);
|
||||||
@ -2437,33 +2446,24 @@ Standard_Boolean V3d_View::ScreenAxis( const gp_Dir &Vpn, const gp_Dir &Vup, Gra
|
|||||||
//function : TrsPoint
|
//function : TrsPoint
|
||||||
//purpose :
|
//purpose :
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
Graphic3d_Vertex V3d_View::TrsPoint( const Graphic3d_Vertex &P, const TColStd_Array2OfReal &Matrix )
|
gp_XYZ V3d_View::TrsPoint (const Graphic3d_Vertex& thePnt, const TColStd_Array2OfReal& theMat)
|
||||||
{
|
{
|
||||||
Graphic3d_Vertex PP ;
|
|
||||||
Standard_Real X,Y,Z,XX,YY,ZZ ;
|
|
||||||
|
|
||||||
// CAL. S3892
|
// CAL. S3892
|
||||||
Standard_Integer lr, ur, lc, uc;
|
const Standard_Integer lr = theMat.LowerRow();
|
||||||
lr = Matrix.LowerRow ();
|
const Standard_Integer ur = theMat.UpperRow();
|
||||||
ur = Matrix.UpperRow ();
|
const Standard_Integer lc = theMat.LowerCol();
|
||||||
lc = Matrix.LowerCol ();
|
const Standard_Integer uc = theMat.UpperCol();
|
||||||
uc = Matrix.UpperCol ();
|
if ((ur - lr + 1 != 4) || (uc - lc + 1 != 4))
|
||||||
if ((ur - lr + 1 != 4) || (uc - lc + 1 != 4) ) {
|
{
|
||||||
P.Coord(X,Y,Z) ;
|
return gp_XYZ (thePnt.X(), thePnt.Y(), thePnt.Z());
|
||||||
PP.SetCoord(X,Y,Z) ;
|
|
||||||
return PP ;
|
|
||||||
}
|
}
|
||||||
P.Coord(X,Y,Z) ;
|
|
||||||
XX = (Matrix(lr,lc+3) + X*Matrix(lr,lc) + Y*Matrix(lr,lc+1)+
|
|
||||||
Z*Matrix(lr,lc+2))/Matrix(lr+3,lc+3) ;
|
|
||||||
|
|
||||||
YY = (Matrix(lr+1,lc+3) + X*Matrix(lr+1,lc) + Y*Matrix(lr+1,lc+1) +
|
Standard_Real X, Y, Z;
|
||||||
Z*Matrix(lr+1,lc+2))/Matrix(lr+3,lc+3) ;
|
thePnt.Coord (X,Y,Z);
|
||||||
|
const Standard_Real XX = (theMat(lr,lc+3) + X*theMat(lr,lc) + Y*theMat(lr,lc+1) + Z*theMat(lr,lc+2)) / theMat(lr+3,lc+3);
|
||||||
ZZ = (Matrix(lr+2,lc+3) + X*Matrix(lr+2,lc) + Y*Matrix(lr+2,lc+1) +
|
const Standard_Real YY = (theMat(lr+1,lc+3) + X*theMat(lr+1,lc) + Y*theMat(lr+1,lc+1) + Z*theMat(lr+1,lc+2))/theMat(lr+3,lc+3);
|
||||||
Z*Matrix(lr+2,lc+2))/Matrix(lr+3,lc+3) ;
|
const Standard_Real ZZ = (theMat(lr+2,lc+3) + X*theMat(lr+2,lc) + Y*theMat(lr+2,lc+1) + Z*theMat(lr+2,lc+2))/theMat(lr+3,lc+3);
|
||||||
PP.SetCoord(XX,YY,ZZ) ;
|
return gp_XYZ (XX, YY, ZZ);
|
||||||
return PP ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -985,7 +985,7 @@ private:
|
|||||||
Standard_EXPORT static Standard_Boolean ScreenAxis (const gp_Dir& Vpn, const gp_Dir& Vup, Graphic3d_Vector& Xaxe, Graphic3d_Vector& Yaxe, Graphic3d_Vector& Zaxe);
|
Standard_EXPORT static Standard_Boolean ScreenAxis (const gp_Dir& Vpn, const gp_Dir& Vup, Graphic3d_Vector& Xaxe, Graphic3d_Vector& Yaxe, Graphic3d_Vector& Zaxe);
|
||||||
|
|
||||||
//! Transforms the Vertex V according to the matrice Matrix .
|
//! Transforms the Vertex V according to the matrice Matrix .
|
||||||
Standard_EXPORT static Graphic3d_Vertex TrsPoint (const Graphic3d_Vertex& V, const TColStd_Array2OfReal& Matrix);
|
Standard_EXPORT static gp_XYZ TrsPoint (const Graphic3d_Vertex& V, const TColStd_Array2OfReal& Matrix);
|
||||||
|
|
||||||
//! Returns the objects number and the projection window
|
//! Returns the objects number and the projection window
|
||||||
//! of the objects contained in the view.
|
//! of the objects contained in the view.
|
||||||
|
@ -150,117 +150,74 @@ void toCartesianCoords (const Standard_Real theR, const Standard_Real thePhi,
|
|||||||
//function : Compute
|
//function : Compute
|
||||||
//purpose :
|
//purpose :
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
Graphic3d_Vertex V3d_View::Compute (const Graphic3d_Vertex & AVertex) const
|
Graphic3d_Vertex V3d_View::Compute (const Graphic3d_Vertex& theVertex) const
|
||||||
{
|
{
|
||||||
Graphic3d_Vertex CurPoint, NewPoint;
|
const Handle(Graphic3d_Camera)& aCamera = Camera();
|
||||||
Standard_Real X1, Y1, Z1, X2, Y2, Z2;
|
gp_Dir VPN = aCamera->Direction().Reversed(); // RefPlane
|
||||||
Standard_Real XPp, YPp;
|
gp_Dir GPN = MyPlane.Direction();
|
||||||
Handle(Graphic3d_Camera) aCamera = Camera();
|
|
||||||
|
|
||||||
gp_Dir aRefPlane = aCamera->Direction().Reversed();
|
Standard_Real XPp = 0.0, YPp = 0.0;
|
||||||
X1 = aRefPlane.X(); Y1 = aRefPlane.Y(); Z1 = aRefPlane.Z();
|
Project (theVertex.X(), theVertex.Y(), theVertex.Z(), XPp, YPp);
|
||||||
MyPlane.Direction ().Coord (X2, Y2, Z2);
|
|
||||||
|
|
||||||
gp_Dir VPN (X1, Y1, Z1);
|
|
||||||
gp_Dir GPN (X2, Y2, Z2);
|
|
||||||
|
|
||||||
AVertex.Coord (X1, Y1, Z1);
|
|
||||||
Project (X1, Y1, Z1, XPp, YPp);
|
|
||||||
|
|
||||||
// Casw when the plane of the grid and the plane of the view
|
// Casw when the plane of the grid and the plane of the view
|
||||||
// are perpendicular to MYEPSILON2 close radians
|
// are perpendicular to MYEPSILON2 close radians
|
||||||
if (Abs (VPN.Angle (GPN) - M_PI / 2.) < MYEPSILON2) {
|
if (Abs (VPN.Angle (GPN) - M_PI / 2.) < MYEPSILON2)
|
||||||
NewPoint.SetCoord (X1, Y1, Z1);
|
{
|
||||||
return NewPoint;
|
return theVertex;
|
||||||
}
|
}
|
||||||
|
|
||||||
Standard_Boolean IsRectangular =
|
const gp_XYZ aPnt0 = V3d_View::TrsPoint (Graphic3d_Vertex (0.0, 0.0, 0.0), MyTrsf);
|
||||||
MyGrid->IsKind (STANDARD_TYPE (Aspect_RectangularGrid));
|
|
||||||
|
|
||||||
Graphic3d_Vertex P1;
|
|
||||||
|
|
||||||
Standard_Real x0, y0, z0, x1, y1, z1, x2, y2, z2;
|
|
||||||
|
|
||||||
P1.SetCoord (0.0, 0.0, 0.0);
|
|
||||||
CurPoint = V3d_View::TrsPoint (P1, MyTrsf);
|
|
||||||
CurPoint.Coord (x0, y0, z0);
|
|
||||||
|
|
||||||
// get grid axes in world space
|
// get grid axes in world space
|
||||||
P1.SetCoord (1.0, 0.0, 0.0);
|
const gp_XYZ aPnt1 = V3d_View::TrsPoint (Graphic3d_Vertex (1.0, 0.0, 0.0), MyTrsf);
|
||||||
CurPoint = V3d_View::TrsPoint (P1, MyTrsf);
|
gp_Vec aGridX (aPnt0, aPnt1);
|
||||||
CurPoint.Coord (x1, y1, z1);
|
|
||||||
gp_Vec aGridX (gp_Pnt (x0, y0, z0), gp_Pnt (x1, y1, z1));
|
|
||||||
aGridX.Normalize();
|
aGridX.Normalize();
|
||||||
|
|
||||||
P1.SetCoord (0.0, 1.0, 0.0);
|
const gp_XYZ aPnt2 = V3d_View::TrsPoint (Graphic3d_Vertex (0.0, 1.0, 0.0), MyTrsf);
|
||||||
CurPoint = V3d_View::TrsPoint (P1, MyTrsf);
|
gp_Vec aGridY (aPnt0, aPnt2);
|
||||||
CurPoint.Coord (x2, y2, z2);
|
|
||||||
gp_Vec aGridY (gp_Pnt (x0, y0, z0), gp_Pnt (x2, y2, z2));
|
|
||||||
aGridY.Normalize();
|
aGridY.Normalize();
|
||||||
|
|
||||||
// get grid normal
|
|
||||||
MyPlane.Direction().Coord (x2, y2, z2);
|
|
||||||
gp_Vec aPlaneNormal (x2, y2, z2);
|
|
||||||
|
|
||||||
gp_Vec aPointOnPlane = gp_Vec (0.0, 0.0, 0.0);
|
|
||||||
|
|
||||||
AVertex.Coord (x1, y1, z1);
|
|
||||||
|
|
||||||
// project ray from camera onto grid plane
|
// project ray from camera onto grid plane
|
||||||
gp_Vec aProjection = aCamera->IsOrthographic()
|
const gp_Vec aProjection = aCamera->IsOrthographic()
|
||||||
? gp_Vec (aCamera->Direction())
|
? gp_Vec (aCamera->Direction())
|
||||||
: gp_Vec (aCamera->Eye(), gp_Pnt (x1, y1, z1)).Normalized();
|
: gp_Vec (aCamera->Eye(), gp_Pnt (theVertex.X(), theVertex.Y(), theVertex.Z())).Normalized();
|
||||||
gp_Vec aPointOrigin = gp_Vec (gp_Pnt (x1, y1, z1), gp_Pnt (x0, y0, z0));
|
const gp_Vec aPointOrigin = gp_Vec (gp_Pnt (theVertex.X(), theVertex.Y(), theVertex.Z()), aPnt0);
|
||||||
Standard_Real aT = aPointOrigin.Dot (aPlaneNormal) / aProjection.Dot (aPlaneNormal);
|
const Standard_Real aT = aPointOrigin.Dot (MyPlane.Direction()) / aProjection.Dot (MyPlane.Direction());
|
||||||
aPointOnPlane = gp_Vec (x1, y1, z1) + aProjection * aT;
|
const gp_XYZ aPointOnPlane = gp_XYZ (theVertex.X(), theVertex.Y(), theVertex.Z()) + aProjection.XYZ() * aT;
|
||||||
|
|
||||||
if (IsRectangular) {
|
|
||||||
Standard_Real XS, YS;
|
|
||||||
Handle(Aspect_RectangularGrid) theGrid =
|
|
||||||
Handle(Aspect_RectangularGrid)::DownCast (MyGrid);
|
|
||||||
XS = theGrid->XStep (), YS = theGrid->YStep ();
|
|
||||||
|
|
||||||
|
if (Handle(Aspect_RectangularGrid) aRectGrid = Handle(Aspect_RectangularGrid)::DownCast (MyGrid))
|
||||||
|
{
|
||||||
// project point on plane to grid local space
|
// project point on plane to grid local space
|
||||||
gp_Vec aToPoint (gp_Pnt (x0, y0, z0),
|
const gp_Vec aToPoint (aPnt0, aPointOnPlane);
|
||||||
gp_Pnt (aPointOnPlane.X(), aPointOnPlane.Y(), aPointOnPlane.Z()));
|
const Standard_Real anXSteps = Round (aGridX.Dot (aToPoint) / aRectGrid->XStep());
|
||||||
Standard_Real anXSteps = Round (aGridX.Dot (aToPoint) / XS);
|
const Standard_Real anYSteps = Round (aGridY.Dot (aToPoint) / aRectGrid->YStep());
|
||||||
Standard_Real anYSteps = Round (aGridY.Dot (aToPoint) / YS);
|
|
||||||
|
|
||||||
// clamp point to grid
|
// clamp point to grid
|
||||||
gp_Vec aResult = aGridX * anXSteps * XS + aGridY * anYSteps * YS + gp_Vec (x0, y0, z0);
|
const gp_Vec aResult = aGridX * anXSteps * aRectGrid->XStep()
|
||||||
NewPoint.SetCoord (aResult.X(), aResult.Y(), aResult.Z());
|
+ aGridY * anYSteps * aRectGrid->YStep()
|
||||||
|
+ gp_Vec (aPnt0);
|
||||||
|
return Graphic3d_Vertex (aResult.X(), aResult.Y(), aResult.Z());
|
||||||
}
|
}
|
||||||
else // IsCircular
|
else // IsCircular
|
||||||
{
|
{
|
||||||
Standard_Real RS;
|
Handle(Aspect_CircularGrid) aCircleGrid = Handle(Aspect_CircularGrid)::DownCast (MyGrid);
|
||||||
Standard_Integer DN;
|
const Standard_Real anAlpha = M_PI / Standard_Real (aCircleGrid->DivisionNumber());
|
||||||
Standard_Real Alpha;
|
|
||||||
Handle(Aspect_CircularGrid) theGrid =
|
|
||||||
Handle(Aspect_CircularGrid)::DownCast (MyGrid);
|
|
||||||
RS = theGrid->RadiusStep ();
|
|
||||||
DN = theGrid->DivisionNumber ();
|
|
||||||
Alpha = M_PI / Standard_Real (DN);
|
|
||||||
|
|
||||||
// project point on plane to grid local space
|
// project point on plane to grid local space
|
||||||
gp_Vec aToPoint (gp_Pnt (x0, y0, z0),
|
const gp_Vec aToPoint (aPnt0, aPointOnPlane);
|
||||||
gp_Pnt (aPointOnPlane.X(), aPointOnPlane.Y(), aPointOnPlane.Z()));
|
|
||||||
|
|
||||||
Standard_Real anR = 0.0, aPhi = 0.0;
|
|
||||||
Standard_Real aLocalX = aGridX.Dot (aToPoint);
|
Standard_Real aLocalX = aGridX.Dot (aToPoint);
|
||||||
Standard_Real aLocalY = aGridY.Dot (aToPoint);
|
Standard_Real aLocalY = aGridY.Dot (aToPoint);
|
||||||
|
Standard_Real anR = 0.0, aPhi = 0.0;
|
||||||
toPolarCoords (aLocalX, aLocalY, anR, aPhi);
|
toPolarCoords (aLocalX, aLocalY, anR, aPhi);
|
||||||
|
|
||||||
// clamp point to grid
|
// clamp point to grid
|
||||||
Standard_Real anRSteps = Round (anR / RS);
|
const Standard_Real anRSteps = Round (anR / aCircleGrid->RadiusStep());
|
||||||
Standard_Real aPhiSteps = Round (aPhi / Alpha);
|
const Standard_Real aPhiSteps = Round (aPhi / anAlpha);
|
||||||
toCartesianCoords (anRSteps * RS, aPhiSteps * Alpha, aLocalX, aLocalY);
|
toCartesianCoords (anRSteps * aCircleGrid->RadiusStep(), aPhiSteps * anAlpha, aLocalX, aLocalY);
|
||||||
|
|
||||||
gp_Vec aResult = aGridX * aLocalX + aGridY * aLocalY + gp_Vec (x0, y0, z0);
|
const gp_Vec aResult = aGridX * aLocalX + aGridY * aLocalY + gp_Vec (aPnt0);
|
||||||
NewPoint.SetCoord (aResult.X(), aResult.Y(), aResult.Z());
|
return Graphic3d_Vertex (aResult.X(), aResult.Y(), aResult.Z());
|
||||||
}
|
}
|
||||||
|
|
||||||
return NewPoint;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
Loading…
x
Reference in New Issue
Block a user