mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0022751: Issues around Prs3d_TextAspect::Print()
This commit is contained in:
parent
8413a813df
commit
8ca7beb8ad
@ -33,7 +33,6 @@ Graphic3d_Group.pxx
|
||||
Graphic3d_Group_1.cxx
|
||||
Graphic3d_Group_2.cxx
|
||||
Graphic3d_Group_3.cxx
|
||||
Graphic3d_Group_4.cxx
|
||||
Graphic3d_Group_5.cxx
|
||||
Graphic3d_Group_7.cxx
|
||||
Graphic3d_Group_8.cxx
|
||||
|
@ -320,59 +320,6 @@ is
|
||||
is deferred;
|
||||
---Purpose: call_togl_structure
|
||||
|
||||
--------------------------------
|
||||
-- Category: Exploration methods
|
||||
--------------------------------
|
||||
|
||||
DumpGroup ( me : mutable;
|
||||
ACGroup : CGroup from Graphic3d )
|
||||
is deferred;
|
||||
---Purpose: call_togl_structure_exploration
|
||||
|
||||
DumpStructure ( me : mutable;
|
||||
ACStructure : CStructure from Graphic3d )
|
||||
is deferred;
|
||||
---Purpose: call_togl_structure_exploration
|
||||
|
||||
DumpView ( me : mutable;
|
||||
ACView : CView from Graphic3d )
|
||||
is deferred;
|
||||
---Purpose: call_togl_view_exploration
|
||||
|
||||
ElementExploration ( me : mutable;
|
||||
ACStructure : CStructure from Graphic3d;
|
||||
ElementNumber : Integer from Standard;
|
||||
AVertex : out VertexNC from Graphic3d;
|
||||
AVector : out Vector from Graphic3d )
|
||||
returns Boolean from Standard
|
||||
is deferred;
|
||||
---Purpose: call_togl_element_exploration
|
||||
|
||||
ElementType ( me : mutable;
|
||||
ACStructure : CStructure from Graphic3d;
|
||||
ElementNumber : Integer from Standard )
|
||||
returns TypeOfPrimitive from Graphic3d
|
||||
is deferred;
|
||||
---Purpose: call_togl_element_type
|
||||
|
||||
------------------------------------
|
||||
-- Category: Pick management methods
|
||||
------------------------------------
|
||||
|
||||
InitPick ( me : mutable )
|
||||
is deferred;
|
||||
---Purpose: call_togl_init_pick
|
||||
|
||||
Pick ( me : mutable;
|
||||
ACPick : out CPick from Graphic3d )
|
||||
is deferred;
|
||||
---Purpose: call_togl_pick
|
||||
|
||||
PickId ( me : mutable;
|
||||
ACGroup : CGroup from Graphic3d )
|
||||
is deferred;
|
||||
---Purpose: call_togl_pickid
|
||||
|
||||
------------------------------------
|
||||
-- Category: Structured mode methods
|
||||
------------------------------------
|
||||
|
@ -233,34 +233,6 @@
|
||||
-- group <me>.
|
||||
---Category: Methods to modify the class definition
|
||||
|
||||
--------------------------------------------------
|
||||
-- Category: Methods to manage the pick identifier
|
||||
--------------------------------------------------
|
||||
|
||||
PickId ( me )
|
||||
returns Integer from Standard
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the pick identifier of the group <me>.
|
||||
-- Category: Methods to manage the pick identifier
|
||||
-- Warning: Returns 0 if the pick identifier is not defined.
|
||||
|
||||
RemovePickId ( me : mutable )
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Removes the pick identifier of the group <me>.
|
||||
-- Category: Methods to manage the pick identifier
|
||||
-- Warning: Now the Pick Identifier is null.
|
||||
|
||||
SetPickId ( me : mutable;
|
||||
Id : Integer from Standard )
|
||||
---Level: Public
|
||||
---Purpose: Places a pick identifier in the group <me>.
|
||||
-- Category: Methods to manage the pick identifier
|
||||
-- Warning: A Pick Identifier is an integer greater than zero.
|
||||
--- Raises PickIdDefinitionError if <Id> is a negative value.
|
||||
raises PickIdDefinitionError from Graphic3d is static;
|
||||
|
||||
-------------------------------------
|
||||
-- Category: Methods to create Marker
|
||||
-------------------------------------
|
||||
@ -975,13 +947,7 @@
|
||||
----------------------------
|
||||
-- Category: Private methods
|
||||
----------------------------
|
||||
|
||||
Exploration ( me )
|
||||
is static;
|
||||
---Level: Internal
|
||||
---Purpose: Prints informations about the group <me>.
|
||||
---Category: Private methods
|
||||
|
||||
|
||||
Labels ( me;
|
||||
LB, LE : in out Integer from Standard )
|
||||
is static private;
|
||||
|
@ -109,14 +109,6 @@ void Graphic3d_Group::Labels (Standard_Integer& LB, Standard_Integer& LE) const
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_Group::Exploration () const {
|
||||
|
||||
if (IsDeleted ()) return;
|
||||
|
||||
MyGraphicDriver->DumpGroup (MyCGroup);
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_Group::Update () const {
|
||||
|
||||
if (IsDeleted ()) return;
|
||||
|
@ -1,61 +0,0 @@
|
||||
|
||||
// File Graphic3d_Group_4.cxx (PickId)
|
||||
// Created Fevrier 1992
|
||||
// Author NW,JPB,CAL
|
||||
|
||||
//-Copyright MatraDatavision 1991,1992
|
||||
|
||||
//-Version
|
||||
|
||||
//-Design Declaration des variables specifiques aux groupes
|
||||
// de primitives
|
||||
|
||||
//-Warning Un groupe est defini dans une structure
|
||||
// Il s'agit de la plus petite entite editable
|
||||
|
||||
//-References
|
||||
|
||||
//-Language C++ 2.0
|
||||
|
||||
//-Declarations
|
||||
|
||||
// for the class
|
||||
#include <Graphic3d_Group.jxx>
|
||||
#include <Graphic3d_Group.pxx>
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
Standard_Integer Graphic3d_Group::PickId () const {
|
||||
|
||||
return (Standard_Integer (MyCGroup.PickId.Value));
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_Group::RemovePickId () {
|
||||
|
||||
if (IsDeleted ()) return;
|
||||
|
||||
MyCGroup.PickId.IsDef = 0;
|
||||
MyCGroup.PickId.Value = 0;
|
||||
|
||||
MyGraphicDriver->PickId (MyCGroup);
|
||||
|
||||
MyCGroup.PickId.IsSet = 0;
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_Group::SetPickId (const Standard_Integer Id) {
|
||||
|
||||
if (IsDeleted ()) return;
|
||||
|
||||
if (Id <= 0)
|
||||
Graphic3d_PickIdDefinitionError::Raise ("Bad value for PickId");
|
||||
|
||||
MyCGroup.PickId.IsDef = 1;
|
||||
MyCGroup.PickId.Value = int (Id);
|
||||
|
||||
MyGraphicDriver->PickId (MyCGroup);
|
||||
|
||||
MyCGroup.PickId.IsSet = 1;
|
||||
|
||||
}
|
@ -414,90 +414,7 @@ is
|
||||
-- Polygons, Triangles or Quadrangles.
|
||||
---Category: Inquire methods
|
||||
|
||||
Exploration ( me;
|
||||
ElementNumber : Integer from Standard;
|
||||
AVertex : out VertexNC from Graphic3d;
|
||||
AVector : out Vector from Graphic3d )
|
||||
returns Boolean from Standard
|
||||
is static;
|
||||
---Level: Internal
|
||||
---Purpose: Explores a structure element of <me>.
|
||||
-- Returns Standard_True if the exploration succeded and
|
||||
-- Standard_False if the exploration is done or if the
|
||||
-- specified structure element is not in the structure.
|
||||
-- <AVertex> contains the coordinates, the normal and
|
||||
-- the color of the vertex found in the structure element.
|
||||
-- <AVector> contains the normal of the face.
|
||||
-- Warning: - The structure element number is given by
|
||||
-- Visual3d_ViewManager::Pick method.
|
||||
-- - The primitive type is given by
|
||||
-- Graphic3d_Structure::Type method.
|
||||
-- - The normal is (0.0, 0.0, 0.0) when the normal is not
|
||||
-- specified in the structure element.
|
||||
-- - The color is (0.0, 0.0, 0.0) when the color is not
|
||||
-- specified in the structure element.
|
||||
-- - To initialize the exploration, you have to call the
|
||||
-- Graphic3d_Structure::Type method before this method.
|
||||
--
|
||||
-- Programming example :
|
||||
--
|
||||
-- // Define a graphic device
|
||||
-- Handle(Graphic3d_GraphicDevice) GD =
|
||||
-- new Graphic3d_GraphicDevice ("dummy:0.0");
|
||||
--
|
||||
-- // Define a view manager
|
||||
-- Handle(Visual3d_ViewManager) VM = new Visual3d_ViewManager (GD);
|
||||
--
|
||||
-- // Define a view
|
||||
-- Handle(Visual3d_View) V = new Visual3d_View (VM);
|
||||
--
|
||||
-- // Define a window
|
||||
-- Handle(Aspect_Window) W = new Aspect_Window
|
||||
-- (GD, "Graphic View 1", 0.695, 0.695, 0.600, 0.600,
|
||||
-- Xw_WQ_3DQUALITY, Quantity_NOC_MATRAGRAY);
|
||||
--
|
||||
-- // Define a context pick
|
||||
-- Visual3d_ContextPick CTXP;
|
||||
--
|
||||
-- // Activate the view
|
||||
-- V->SetWindow (W);
|
||||
-- V->Activate ();
|
||||
--
|
||||
-- // Create a structure
|
||||
-- Handle(Graphic3d_Structure) S = new Graphic3d_Structure (V);
|
||||
-- Handle(Graphic3d_Group) G = new Graphic3d_Group (S);
|
||||
--
|
||||
-- // Create a polygon
|
||||
-- G->Polygon (PtsArray);
|
||||
--
|
||||
-- // Display the structure
|
||||
-- S->Display ();
|
||||
--
|
||||
-- // Pick
|
||||
-- Visual3d_PickDescriptor PDes (CTXP);
|
||||
-- PDes.Clear ();
|
||||
-- PDes = V->Pick (CTXP, W, x, y);
|
||||
--
|
||||
-- // Explore the top structure
|
||||
-- Standard_Boolean Next = Standard_True;
|
||||
-- Graphic3d_Vertex AVertex;
|
||||
-- Graphic3d_Vector AVector;
|
||||
-- if ((PDes.TopStructure ())->Type () == Graphic3d_TOP_POLYGON)
|
||||
-- while (Next) {
|
||||
-- Next = S->Exploration (PDes.TopElementNumber (),
|
||||
-- AVertex, AVector);
|
||||
-- if (Next) {
|
||||
-- cout << "Point " << AVertex.X () << " , "
|
||||
-- << AVertex.Y () << " , " << AVertex.Z () << "\n";
|
||||
-- if (! AVector.LengthZero ())
|
||||
-- cout << "Normal " << AVector.X () << " , "
|
||||
-- << AVector.Y () << " , " << AVector.Z () << "\n";
|
||||
-- cout << flush;
|
||||
-- }
|
||||
-- }
|
||||
--
|
||||
---Category: Inquire methods
|
||||
|
||||
|
||||
FillArea3dAspect ( me )
|
||||
returns AspectFillArea3d from Graphic3d
|
||||
is static;
|
||||
@ -641,20 +558,6 @@ is
|
||||
---Purpose: Returns the values of the current default attributes.
|
||||
---Category: Inquire methods
|
||||
|
||||
Type ( me;
|
||||
ElementNumber : Integer from Standard )
|
||||
returns TypeOfPrimitive from Graphic3d
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the primitive type stored in the structure
|
||||
-- element <ElementNumber>.
|
||||
-- Initialises the exploration of this primitive.
|
||||
-- If the structure element is not a primitive, returns
|
||||
-- Graphic3d_TOP_UNDEFINED.
|
||||
-- Warning: The structure element number is given by
|
||||
-- Visual3d_ViewManager::Pick method.
|
||||
---Category: Inquire methods
|
||||
|
||||
Visual ( me )
|
||||
returns TypeOfStructure from Graphic3d
|
||||
is static;
|
||||
@ -900,12 +803,6 @@ is
|
||||
-- <ADelta> = +1 or -1
|
||||
---Category: Private methods
|
||||
|
||||
Exploration ( me )
|
||||
is static;
|
||||
---Level: Internal
|
||||
---Purpose: Prints informations about the structure <me>.
|
||||
---Category: Private methods
|
||||
|
||||
GraphicClear ( me : mutable;
|
||||
WithDestruction : Boolean from Standard )
|
||||
is static;
|
||||
|
@ -1875,39 +1875,6 @@ Handle(Graphic3d_StructureManager) Graphic3d_Structure::StructureManager () cons
|
||||
|
||||
}
|
||||
|
||||
Graphic3d_TypeOfPrimitive Graphic3d_Structure::Type (const Standard_Integer ElementNumber) const {
|
||||
|
||||
if (IsDeleted ()) return (Graphic3d_TOP_UNDEFINED);
|
||||
|
||||
Graphic3d_TypeOfPrimitive Result;
|
||||
|
||||
Result = MyGraphicDriver->ElementType
|
||||
(MyCStructure, ElementNumber);
|
||||
|
||||
return (Result);
|
||||
|
||||
}
|
||||
|
||||
Standard_Boolean Graphic3d_Structure::Exploration (const Standard_Integer ElementNumber, Graphic3d_VertexNC& AVertex, Graphic3d_Vector& AVector) const {
|
||||
|
||||
Standard_Boolean Result = Standard_False;
|
||||
|
||||
if (IsDeleted ()) return (Result);
|
||||
|
||||
Result = MyGraphicDriver->ElementExploration
|
||||
(MyCStructure, ElementNumber, AVertex, AVector);
|
||||
|
||||
return (Result);
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_Structure::Exploration () const {
|
||||
|
||||
if (IsDeleted ()) return;
|
||||
|
||||
MyGraphicDriver->DumpStructure (MyCStructure);
|
||||
|
||||
}
|
||||
|
||||
void Graphic3d_Structure::MinMaxCoord (Standard_Real& XMin, Standard_Real& YMin, Standard_Real& ZMin, Standard_Real& XMax, Standard_Real& YMax, Standard_Real& ZMax) const {
|
||||
|
||||
|
@ -7,8 +7,6 @@ OpenGl_GraphicDriver_1.cxx
|
||||
OpenGl_GraphicDriver_2.cxx
|
||||
OpenGl_GraphicDriver_3.cxx
|
||||
OpenGl_GraphicDriver_4.cxx
|
||||
OpenGl_GraphicDriver_5.cxx
|
||||
OpenGl_GraphicDriver_6.cxx
|
||||
OpenGl_GraphicDriver_7.cxx
|
||||
OpenGl_GraphicDriver_8.cxx
|
||||
OpenGl_GraphicDriver_9.cxx
|
||||
|
@ -130,14 +130,6 @@ public: // Methods for graphical structures
|
||||
|
||||
public:
|
||||
|
||||
Standard_EXPORT void DumpGroup (const Graphic3d_CGroup& theCGroup);
|
||||
Standard_EXPORT void DumpStructure (const Graphic3d_CStructure& theCStructure);
|
||||
Standard_EXPORT void DumpView (const Graphic3d_CView& theCView);
|
||||
Standard_EXPORT Standard_Boolean ElementExploration (const Graphic3d_CStructure& ACStructure, const Standard_Integer ElementNumber, Graphic3d_VertexNC& AVertex, Graphic3d_Vector& AVector);
|
||||
Standard_EXPORT Graphic3d_TypeOfPrimitive ElementType (const Graphic3d_CStructure& ACStructure, const Standard_Integer ElementNumber);
|
||||
Standard_EXPORT void InitPick ();
|
||||
Standard_EXPORT void Pick (Graphic3d_CPick& ACPick);
|
||||
Standard_EXPORT void PickId (const Graphic3d_CGroup& ACGroup);
|
||||
Standard_EXPORT void ActivateView (const Graphic3d_CView& ACView);
|
||||
Standard_EXPORT void AntiAliasing (const Graphic3d_CView& ACView, const Standard_Boolean AFlag);
|
||||
Standard_EXPORT void Background (const Graphic3d_CView& ACView);
|
||||
|
@ -108,7 +108,6 @@ void OpenGl_GraphicDriver::Structure (Graphic3d_CStructure& theCStructure)
|
||||
Standard_Integer aStatus = 0;
|
||||
if (theCStructure.highlight) aStatus |= OPENGL_NS_HIGHLIGHT;
|
||||
if (!theCStructure.visible) aStatus |= OPENGL_NS_HIDE;
|
||||
if (theCStructure.pick) aStatus |= OPENGL_NS_PICK;
|
||||
aStructure->SetNamedStatus (aStatus);
|
||||
|
||||
theCStructure.ptrStructure = aStructure;
|
||||
|
@ -1,33 +0,0 @@
|
||||
// File: OpenGl_GraphicDriver_5.cxx
|
||||
// Created: 20 October 2011
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
|
||||
void OpenGl_GraphicDriver::DumpGroup (const Graphic3d_CGroup& ACGroup)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::DumpStructure (const Graphic3d_CStructure& ACStructure)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::DumpView (const Graphic3d_CView& ACView)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
Standard_Boolean OpenGl_GraphicDriver::ElementExploration (const Graphic3d_CStructure & ACStructure, const Standard_Integer ElementNumber, Graphic3d_VertexNC& AVertex, Graphic3d_Vector& AVector)
|
||||
{
|
||||
// Do nothing
|
||||
return (Standard_False);
|
||||
}
|
||||
|
||||
Graphic3d_TypeOfPrimitive OpenGl_GraphicDriver::ElementType (const Graphic3d_CStructure & ACStructure, const Standard_Integer ElementNumber)
|
||||
{
|
||||
// Do nothing
|
||||
return Graphic3d_TOP_UNDEFINED;
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
// File: OpenGl_GraphicDriver_6.cxx
|
||||
// Created: 20 October 2011
|
||||
// Author: Sergey ZERCHANINOV
|
||||
// Copyright: OPEN CASCADE 2011
|
||||
|
||||
#include <OpenGl_GraphicDriver.hxx>
|
||||
|
||||
void OpenGl_GraphicDriver::InitPick ()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::Pick (Graphic3d_CPick& ACPick)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void OpenGl_GraphicDriver::PickId (const Graphic3d_CGroup& ACGroup)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
@ -87,7 +87,6 @@ void OpenGl_GraphicDriver::NameSetStructure (const Graphic3d_CStructure& ACStruc
|
||||
Standard_Integer aStatus = 0;
|
||||
if (ACStructure.highlight) aStatus |= OPENGL_NS_HIGHLIGHT;
|
||||
if (!ACStructure.visible) aStatus |= OPENGL_NS_HIDE;
|
||||
if (ACStructure.pick) aStatus |= OPENGL_NS_PICK;
|
||||
astructure->SetNamedStatus( aStatus );
|
||||
}
|
||||
}
|
||||
|
@ -8,21 +8,20 @@
|
||||
|
||||
// Dynamic fields
|
||||
#define OPENGL_NS_HIDE (1<<0)
|
||||
#define OPENGL_NS_PICK (1<<1)
|
||||
#define OPENGL_NS_HIGHLIGHT (1<<2)
|
||||
#define OPENGL_NS_WIREFRAME (1<<3)
|
||||
#define OPENGL_NS_RESMAT (1<<4)
|
||||
#define OPENGL_NS_ADD (1<<5)
|
||||
#define OPENGL_NS_IMMEDIATE (1<<6)
|
||||
#define OPENGL_NS_TEXTURE (1<<7)
|
||||
#define OPENGL_NS_ANTIALIASING (1<<8)
|
||||
#define OPENGL_NS_ANIMATION (1<<9)
|
||||
#define OPENGL_NS_UPDATEAM (1<<10)
|
||||
#define OPENGL_NS_DEGENERATION (1<<11)
|
||||
#define OPENGL_NS_2NDPASSNEED (1<<12)
|
||||
#define OPENGL_NS_2NDPASSDO (1<<13)
|
||||
#define OPENGL_NS_FORBIDSETTEX (1<<14)
|
||||
#define OPENGL_NS_FLIST (1<<15)
|
||||
#define OPENGL_NS_WHITEBACK (1<<16)
|
||||
#define OPENGL_NS_HIGHLIGHT (1<<1)
|
||||
#define OPENGL_NS_WIREFRAME (1<<2)
|
||||
#define OPENGL_NS_RESMAT (1<<3)
|
||||
#define OPENGL_NS_ADD (1<<4)
|
||||
#define OPENGL_NS_IMMEDIATE (1<<5)
|
||||
#define OPENGL_NS_TEXTURE (1<<6)
|
||||
#define OPENGL_NS_ANTIALIASING (1<<7)
|
||||
#define OPENGL_NS_ANIMATION (1<<8)
|
||||
#define OPENGL_NS_UPDATEAM (1<<9)
|
||||
#define OPENGL_NS_DEGENERATION (1<<10)
|
||||
#define OPENGL_NS_2NDPASSNEED (1<<11)
|
||||
#define OPENGL_NS_2NDPASSDO (1<<12)
|
||||
#define OPENGL_NS_FORBIDSETTEX (1<<13)
|
||||
#define OPENGL_NS_FLIST (1<<14)
|
||||
#define OPENGL_NS_WHITEBACK (1<<15)
|
||||
|
||||
#endif //_OpenGl_NamedStatus_Header
|
||||
|
@ -49,7 +49,6 @@ is
|
||||
|
||||
SetArrowAspect(me: mutable; anAspect: ArrowAspect from Prs3d) is static;
|
||||
---Purpose: Sets how an arrow head which points to an angle will be displayed.
|
||||
Print(me; s: in out OStream from Standard) is static;
|
||||
|
||||
fields
|
||||
|
||||
|
@ -28,12 +28,3 @@ void Prs3d_AngleAspect::SetTextAspect (
|
||||
const Handle(Prs3d_TextAspect)& anAspect) {
|
||||
myTextAspect = anAspect;
|
||||
}
|
||||
|
||||
void Prs3d_AngleAspect::Print (Standard_OStream& s) const {
|
||||
|
||||
s << "AngleAspect: " << endl;
|
||||
s << " " ; myLineAspect->Print(s); s << endl;
|
||||
s << " arrow " ; myArrowAspect->Print(s); s << endl;
|
||||
s << " " ; myTextAspect->Print(s); s << endl;
|
||||
}
|
||||
|
||||
|
@ -54,9 +54,6 @@ is
|
||||
|
||||
Aspect(me) returns AspectLine3d from Graphic3d;
|
||||
|
||||
Print( me; s: in out OStream from Standard)
|
||||
is virtual;
|
||||
|
||||
fields
|
||||
myArrowAspect: AspectLine3d from Graphic3d;
|
||||
myAngle: PlaneAngle from Quantity;
|
||||
|
@ -41,12 +41,6 @@ Quantity_Length Prs3d_ArrowAspect::Length () const
|
||||
return myLength;
|
||||
}
|
||||
|
||||
void Prs3d_ArrowAspect::Print (Standard_OStream& s) const {
|
||||
|
||||
s << "ArrowAspect: Length: " << myLength << " Angle: " << myAngle;
|
||||
|
||||
}
|
||||
|
||||
#ifdef IMP120100
|
||||
void Prs3d_ArrowAspect::SetColor(const Quantity_Color &aColor) {
|
||||
myArrowAspect->SetColor(aColor);
|
||||
|
@ -43,8 +43,7 @@ is
|
||||
---Purpose: Returns the length of the displayed second axis.
|
||||
|
||||
ThirdAxisLength(me) returns Length from Quantity;
|
||||
---Purpose: Returns the length of the displayed third axis.
|
||||
Print(me; s: in out OStream from Standard) is static;
|
||||
---Purpose: Returns the length of the displayed third axis.
|
||||
|
||||
fields
|
||||
|
||||
|
@ -79,26 +79,3 @@ Quantity_Length Prs3d_DatumAspect::ThirdAxisLength () const {
|
||||
return myThirdAxisLength;
|
||||
|
||||
}
|
||||
|
||||
void Prs3d_DatumAspect::Print (Standard_OStream& s) const {
|
||||
|
||||
s << "DatumAspect: " << endl;
|
||||
s << " FirstAxis: length " << myFirstAxisLength << " ";
|
||||
myFirstAxisAspect->Print(s);
|
||||
s << endl;
|
||||
s << " SecondAxis: length " << mySecondAxisLength << " ";
|
||||
mySecondAxisAspect->Print(s);
|
||||
s << endl;
|
||||
s << " ThirdAxis: length " << myThirdAxisLength << " ";
|
||||
myThirdAxisAspect->Print(s);
|
||||
s << endl;
|
||||
if (myDrawFirstAndSecondAxis)
|
||||
s << " Draws first and second axis";
|
||||
else
|
||||
s << " Does not draw first and second axis";
|
||||
|
||||
if (myDrawThirdAxis)
|
||||
s << " Draws third axis";
|
||||
else
|
||||
s << " Does not draw third axis";
|
||||
}
|
||||
|
@ -485,9 +485,7 @@ is
|
||||
|
||||
SetSectionAspect(me:mutable;anAspect: LineAspect from Prs3d)
|
||||
is virtual;
|
||||
---Purpose: Sets the parameter anAspect for display attributes of sections.
|
||||
Print (me; s: in out OStream from Standard)
|
||||
is virtual;
|
||||
---Purpose: Sets the parameter anAspect for display attributes of sections.
|
||||
|
||||
fields
|
||||
myUIsoAspect: IsoAspect from Prs3d is protected;
|
||||
|
@ -420,84 +420,3 @@ Handle (Prs3d_LineAspect) Prs3d_Drawer::SectionAspect () {
|
||||
void Prs3d_Drawer::SetSectionAspect ( const Handle(Prs3d_LineAspect)& anAspect) {
|
||||
mySectionAspect = anAspect;
|
||||
}
|
||||
|
||||
|
||||
void Prs3d_Drawer::Print (Standard_OStream& s) const {
|
||||
|
||||
s << "Drawer: " << endl;
|
||||
s << "UIsoAspect: " ;
|
||||
myUIsoAspect->Print(s);
|
||||
s << endl;
|
||||
|
||||
s << "VIsoAspect: " ;
|
||||
myVIsoAspect->Print(s);
|
||||
s << endl;
|
||||
|
||||
s << "LineAspect: " ;
|
||||
myLineAspect->Print(s);
|
||||
s << endl;
|
||||
|
||||
if (myDrawHiddenLine)
|
||||
s << "draws hidden lines" << endl;
|
||||
else
|
||||
s << "does not draw hidden lines" << endl;
|
||||
|
||||
s << "HiddenLineAspect: ";
|
||||
myHiddenLineAspect->Print(s);
|
||||
s << endl ;
|
||||
|
||||
s << "SeenLineAspect: ";
|
||||
mySeenLineAspect->Print(s);
|
||||
s << endl;
|
||||
|
||||
s << "WireAspect: ";
|
||||
myWireAspect->Print(s);
|
||||
s << endl;
|
||||
|
||||
s << "FreeBoundaryAspect: ";
|
||||
myFreeBoundaryAspect->Print(s);
|
||||
s << endl;
|
||||
|
||||
s << "UnFreeBoundaryAspect: ";
|
||||
myUnFreeBoundaryAspect->Print(s);
|
||||
s << endl;
|
||||
|
||||
|
||||
s << "SectionAspect: ";
|
||||
mySectionAspect->Print(s);
|
||||
s << endl;
|
||||
|
||||
s << "DatumAspect: ";
|
||||
|
||||
myDatumAspect->Print(s);
|
||||
s << endl;
|
||||
|
||||
s << "VectorAspect: ";
|
||||
myVectorAspect->Print(s);
|
||||
s << endl;
|
||||
|
||||
|
||||
s << "PointAspect: ";
|
||||
myPointAspect->Print(s);
|
||||
s << endl;
|
||||
|
||||
s << "TextAspect: ";
|
||||
myTextAspect->Print(s);
|
||||
s << endl;
|
||||
|
||||
s << "ArrowAspect: ";
|
||||
myArrowAspect->Print(s);
|
||||
s << endl;
|
||||
|
||||
s << "LengthAspect: ";
|
||||
myLengthAspect->Print(s);
|
||||
|
||||
s << "AngleAspect: ";
|
||||
myAngleAspect->Print(s);
|
||||
|
||||
if (myTypeOfDeflection == Aspect_TOD_RELATIVE)
|
||||
s << "TypeOfDeflection: TOD_Relative; Coefficient: " << myDeviationCoefficient << endl;
|
||||
else
|
||||
s << "TypeOfDeflection: TOD_Absolute; Maximal chordial deviation: " << myChordialDeviation << endl;
|
||||
s << "HLRAngle: " << myHLRAngle;
|
||||
}
|
||||
|
@ -47,8 +47,6 @@ is
|
||||
Number (me) returns Integer from Standard
|
||||
---Purpose: returns the number of U or V isoparametric curves drawn for a single face.
|
||||
is static;
|
||||
|
||||
Print(me; s: in out OStream from Standard) is redefined;
|
||||
|
||||
fields
|
||||
|
||||
|
@ -25,10 +25,3 @@ void Prs3d_IsoAspect::SetNumber (const Standard_Integer aNumber) {
|
||||
}
|
||||
|
||||
Standard_Integer Prs3d_IsoAspect::Number () const {return myNumber;}
|
||||
|
||||
void Prs3d_IsoAspect::Print(Standard_OStream& s) const {
|
||||
|
||||
s << "IsoAspect: " << myNumber << " ";
|
||||
Prs3d_LineAspect::Print(s);
|
||||
|
||||
}
|
||||
|
@ -58,8 +58,7 @@ is
|
||||
---Purpose: Sets the DrawSecondArrow attributes to active.
|
||||
|
||||
DrawSecondArrow(me) returns Boolean from Standard is static;
|
||||
---Purpose: Returns true if the second arrow can be drawn.
|
||||
Print(me; s: in out OStream from Standard) is static;
|
||||
---Purpose: Returns true if the second arrow can be drawn.
|
||||
|
||||
fields
|
||||
|
||||
|
@ -51,12 +51,3 @@ void Prs3d_LengthAspect::SetDrawSecondArrow (const Standard_Boolean draw) {
|
||||
Standard_Boolean Prs3d_LengthAspect::DrawSecondArrow () const {
|
||||
return myDrawSecondArrow;
|
||||
}
|
||||
|
||||
void Prs3d_LengthAspect::Print (Standard_OStream& s) const {
|
||||
|
||||
s << "LengthAspect: " << endl;
|
||||
s << " " ; myLineAspect->Print(s); s << endl;
|
||||
s << " First arrow " ; myArrow1Aspect->Print(s); s << endl;
|
||||
s << " Second arrow " ; myArrow2Aspect->Print(s); s << endl;
|
||||
s << " " ; myTextAspect->Print(s); s << endl;
|
||||
}
|
||||
|
@ -65,10 +65,7 @@ is
|
||||
is static;
|
||||
--- Purpose: Returns the line aspect. This is defined as the set of
|
||||
-- color, type and thickness attributes.
|
||||
|
||||
Print( me; s: in out OStream from Standard)
|
||||
is virtual;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myAspect: AspectLine3d from Graphic3d;
|
||||
|
@ -40,28 +40,3 @@ void Prs3d_LineAspect::SetWidth(const Standard_Real aWidth){
|
||||
Handle (Graphic3d_AspectLine3d) Prs3d_LineAspect::Aspect () const {
|
||||
return myAspect;
|
||||
}
|
||||
|
||||
void Prs3d_LineAspect::Print (Standard_OStream& s) const {
|
||||
|
||||
Quantity_Color C;
|
||||
Aspect_TypeOfLine T;
|
||||
Standard_Real W;
|
||||
myAspect->Values(C,T,W);
|
||||
switch (T) {
|
||||
case Aspect_TOL_SOLID:
|
||||
s << "LineAspect: " << Quantity_Color::StringName(C.Name()) << " SOLID " << W;
|
||||
break;
|
||||
case Aspect_TOL_DASH:
|
||||
s << "LineAspect: " << Quantity_Color::StringName(C.Name()) << " DASH " << W;
|
||||
break;
|
||||
case Aspect_TOL_DOT:
|
||||
s << "LineAspect: " << Quantity_Color::StringName(C.Name()) << " DOT " << W;
|
||||
break;
|
||||
case Aspect_TOL_DOTDASH:
|
||||
s << "LineAspect: " << Quantity_Color::StringName(C.Name()) << " DOTDASH " << W;
|
||||
break;
|
||||
case Aspect_TOL_USERDEFINED:
|
||||
s << "LineAspect: " << Quantity_Color::StringName(C.Name()) << " USERDEFINED " << W;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -64,8 +64,6 @@ is
|
||||
Aspect(me) returns AspectMarker3d from Graphic3d
|
||||
is static;
|
||||
|
||||
Print( me; s: in out OStream from Standard);
|
||||
|
||||
GetTextureSize (me:mutable; AWidth : out Integer from Standard;
|
||||
AHeight : out Integer from Standard);
|
||||
---Level: Public
|
||||
|
@ -50,59 +50,7 @@ void Prs3d_PointAspect::SetScale(const Standard_Real aScale){
|
||||
Handle (Graphic3d_AspectMarker3d) Prs3d_PointAspect::Aspect () const {
|
||||
return myAspect;
|
||||
}
|
||||
void Prs3d_PointAspect::Print (Standard_OStream& s) const {
|
||||
|
||||
Quantity_Color C;
|
||||
Aspect_TypeOfMarker T;
|
||||
Standard_Real S;
|
||||
myAspect->Values(C,T,S);
|
||||
switch (T) {
|
||||
case Aspect_TOM_POINT:
|
||||
s << "PointAspect: " << Quantity_Color::StringName(C.Name()) << " POINT " << S;
|
||||
break;
|
||||
case Aspect_TOM_PLUS:
|
||||
s << "PointAspect: " << Quantity_Color::StringName(C.Name()) << " PLUS " << S;
|
||||
break;
|
||||
case Aspect_TOM_STAR:
|
||||
s << "PointAspect: " << Quantity_Color::StringName(C.Name()) << " STAR " << S;
|
||||
break;
|
||||
case Aspect_TOM_O:
|
||||
s << "PointAspect: " << Quantity_Color::StringName(C.Name()) << " O " << S;
|
||||
break;
|
||||
case Aspect_TOM_X:
|
||||
s << "PointAspect: " << Quantity_Color::StringName(C.Name()) << " X " << S;
|
||||
break;
|
||||
case Aspect_TOM_O_POINT:
|
||||
s << "PointAspect: " << Quantity_Color::StringName(C.Name()) << " O_POINT " << S;
|
||||
break;
|
||||
case Aspect_TOM_O_PLUS:
|
||||
s << "PointAspect: " << Quantity_Color::StringName(C.Name()) << " O_PLUS " << S;
|
||||
break;
|
||||
case Aspect_TOM_O_STAR:
|
||||
s << "PointAspect: " << Quantity_Color::StringName(C.Name()) << " O_STAR " << S;
|
||||
break;
|
||||
case Aspect_TOM_O_X:
|
||||
s << "PointAspect: " << Quantity_Color::StringName(C.Name()) << " O_X " << S;
|
||||
break;
|
||||
case Aspect_TOM_BALL:
|
||||
s << "PointAspect: " << Quantity_Color::StringName(C.Name()) << " BALL " << S;
|
||||
break;
|
||||
case Aspect_TOM_RING1:
|
||||
s << "PointAspect: " << Quantity_Color::StringName(C.Name()) << " RING1 " << S;
|
||||
break;
|
||||
case Aspect_TOM_RING2:
|
||||
s << "PointAspect: " << Quantity_Color::StringName(C.Name()) << " RING2 " << S;
|
||||
break;
|
||||
case Aspect_TOM_RING3:
|
||||
s << "PointAspect: " << Quantity_Color::StringName(C.Name()) << " RING3 " << S;
|
||||
break;
|
||||
case Aspect_TOM_USERDEFINED:
|
||||
s << "PointAspect: " << Quantity_Color::StringName(C.Name()) << " USERDEFINED " << S;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
void Prs3d_PointAspect::GetTextureSize(Standard_Integer& AWidth, Standard_Integer& AHeight)
|
||||
{
|
||||
myAspect->GetTextureSize( AWidth, AHeight);
|
||||
|
@ -91,8 +91,7 @@ is
|
||||
-- - color
|
||||
-- - font
|
||||
-- - height/width ratio, that is, the expansion factor, and
|
||||
-- - space between characters.
|
||||
Print( me; s: in out OStream from Standard);
|
||||
-- - space between characters.
|
||||
|
||||
fields
|
||||
myTextAspect: AspectText3d from Graphic3d;
|
||||
|
@ -82,20 +82,3 @@ Graphic3d_TextPath Prs3d_TextAspect::Orientation () const {return myOrientation;
|
||||
Handle(Graphic3d_AspectText3d) Prs3d_TextAspect::Aspect() const {
|
||||
return myTextAspect;
|
||||
}
|
||||
|
||||
void Prs3d_TextAspect::Print (Standard_OStream& s) const {
|
||||
|
||||
Quantity_Color C;
|
||||
Standard_CString F;
|
||||
Standard_Real Ratio;
|
||||
Standard_Real Space;
|
||||
|
||||
myTextAspect->Values(C,F,Ratio,Space);
|
||||
|
||||
Standard_CString FontName;
|
||||
|
||||
strcpy((char*)FontName,(char*)F);
|
||||
|
||||
s << "TextAspect:" << Quantity_Color::StringName(C.Name()) << " Font: " << FontName << " Ratio: " << Ratio << " Space: " << Space;
|
||||
|
||||
}
|
||||
|
@ -203,9 +203,6 @@ is
|
||||
class SpotLight;
|
||||
---Purpose: Services of spot light sources.
|
||||
|
||||
class Camera;
|
||||
---Purpose: Services of camera, edition tool of view.
|
||||
|
||||
class Plane;
|
||||
---Pupose: Services of any kind of clipping plane.
|
||||
|
||||
|
@ -1,221 +0,0 @@
|
||||
-- File: Camera.cdl
|
||||
-- Created: Thu Oct 20 10:14:50 1994
|
||||
-- Author: FDA
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
class Camera from V3d
|
||||
|
||||
---Version:
|
||||
|
||||
---Purpose: Creation and modification of a spot.
|
||||
|
||||
---Keywords:
|
||||
|
||||
---Warning:
|
||||
|
||||
---References:
|
||||
|
||||
|
||||
inherits
|
||||
|
||||
TShared
|
||||
|
||||
uses
|
||||
|
||||
TypeOfOrientation from V3d,
|
||||
TypeOfRepresentation from V3d,
|
||||
TypeOfPickCamera from V3d,
|
||||
Coordinate from V3d,
|
||||
PlaneAngle from Quantity,
|
||||
Coefficient from Quantity,
|
||||
Parameter from Quantity,
|
||||
View from V3d,
|
||||
Structure from Graphic3d,
|
||||
Vertex from Graphic3d,
|
||||
Group from Graphic3d
|
||||
|
||||
raises BadValue from Viewer
|
||||
|
||||
|
||||
is
|
||||
|
||||
Create ( aView : View from V3d ) returns mutable Camera;
|
||||
---Level: Public
|
||||
---Purpose: Creates the camera which relatives of View
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
---Category: Methods to modify the Attributes of the camera
|
||||
-----------------------------------------------------------
|
||||
|
||||
SetPosition ( me : mutable; X,Y,Z : Coordinate ) is static;
|
||||
---Level: Public
|
||||
---Purpose: Defines the position of the camera. .
|
||||
|
||||
SetAngle ( me : mutable; Angle : PlaneAngle )
|
||||
---Level: Public
|
||||
---Purpose: Defines the angular position of camera.
|
||||
raises BadValue from Viewer
|
||||
---Purpose: Warning! raises BadValue from Viewer if Abs(Angle) > 2*PI;
|
||||
-- If the angle is <= 0 ou > PI .
|
||||
is static;
|
||||
|
||||
SetAperture ( me : mutable; Angle : PlaneAngle )
|
||||
---Level: Public
|
||||
---Purpose: Defines the Aperture.
|
||||
raises BadValue from Viewer
|
||||
---Purpose: Warning! raises BadValue from Viewer if angle <= 0 or > PI
|
||||
is static;
|
||||
|
||||
SetTarget (me : mutable; X,Y,Z : Coordinate)
|
||||
---Level: Public
|
||||
---Purpose: Defines the target of the camera.
|
||||
is static;
|
||||
|
||||
SetRadius ( me : mutable; Radius : Parameter)
|
||||
---Level: Public
|
||||
---Purpose: Define the radius.
|
||||
raises BadValue from Viewer
|
||||
---Purpose: Warning! raises BadValue from Viewer if radius <= 0 .
|
||||
is static;
|
||||
|
||||
OnHideFace (me : mutable; aView : View from V3d) is static;
|
||||
---Level: Public
|
||||
---Purpose: Calculate the position of the camera, on the hide face
|
||||
-- of the picking sphere.
|
||||
|
||||
OnSeeFace (me : mutable; aView : View from V3d) is static;
|
||||
---Level: Public
|
||||
---Purpose: Calculate the position of the camera, on the seen face
|
||||
-- of the picking sphere.
|
||||
|
||||
Tracking (me : mutable; aView : View from V3d;
|
||||
WathPick : TypeOfPickCamera from V3d;
|
||||
Xpix,Ypix : Integer from Standard) is static;
|
||||
---Level: Public
|
||||
---Purpose: Tracking the camera position, or the picking sphere,
|
||||
-- or the radius of the picking sphere, that depends of
|
||||
-- initial picking "WhatPick" (see the pick method).
|
||||
-- If WhatPick is SPACECAMERA, then the parameters
|
||||
-- Xpix, Ypix are the coordinates of a translation vector.
|
||||
|
||||
|
||||
AerialPilot (me : mutable; aView : View from V3d;
|
||||
Xpix,Ypix : Integer from Standard) is static;
|
||||
---Level: Public
|
||||
---Purpose: Permits the driving of the camera in aerial mode.
|
||||
-- The user believes fly in plane ...
|
||||
|
||||
EarthPilot (me : mutable; aView : View from V3d;
|
||||
Xpix,Ypix : Integer from Standard) is static;
|
||||
---Level: Public
|
||||
---Purpose: Permits the driving of the camera in earth mode.
|
||||
-- The user believes drive a car ...
|
||||
|
||||
Move (me : mutable; Dist : Parameter) is static;
|
||||
---Level: Public
|
||||
---Purpose: The camera move or move back in the direction camera,
|
||||
-- target of camera.
|
||||
|
||||
GoUp (me : mutable; Haut : Parameter) is static;
|
||||
---Level: Public
|
||||
---Purpose: The camera go up or go down on the z axis,
|
||||
-- the direction of camera is the same.
|
||||
|
||||
---------------------------------------------------
|
||||
---Category: display methods
|
||||
---------------------------------------------------
|
||||
|
||||
Display(me: mutable; aView: View from V3d;
|
||||
Representation : TypeOfRepresentation)
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Display the graphic structure of camera
|
||||
-- in the choosen view. We have two types of representation.
|
||||
-- - SIMPLE : Only the camera position is displayed.
|
||||
-- - COMPLETE : The position camera, the picking sphere and
|
||||
-- the radius of sphere are displayed.
|
||||
|
||||
Erase(me: mutable) is static;
|
||||
---Level: Public
|
||||
---Purpose: Erase the graphic structure of camera.
|
||||
|
||||
---------------------------------------------------
|
||||
---Category: Inquire methods
|
||||
---------------------------------------------------
|
||||
|
||||
Position ( me; X,Y,Z : out Coordinate ) is static;
|
||||
---Level: Public
|
||||
---Purpose : Returns the position of the camera.
|
||||
|
||||
Target ( me; X,Y,Z : out Coordinate) is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the position of the target of camera.
|
||||
|
||||
Angle ( me ) returns PlaneAngle is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the angle.
|
||||
|
||||
Aperture ( me ) returns PlaneAngle is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the Aperture.
|
||||
|
||||
Radius (me ) returns Parameter is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the radius of the picking sphere.
|
||||
|
||||
SeeOrHide (me; aView: View from V3d) returns Boolean is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns a Boolean on the status seen or hidden of the
|
||||
-- camera.
|
||||
-- If True the camera has seen.
|
||||
-- If False the camera has hidden.
|
||||
|
||||
Pick ( me; aView: View from V3d; Xpix, Ypix: Integer from Standard)
|
||||
returns TypeOfPickCamera from V3d is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the type of pick element.
|
||||
-- "POSITIONCAMERA" : Representation of camera position.
|
||||
-- "SPACECAMERA" : Representation of picking sphere.
|
||||
-- "ExtRADIUSCAMERA" : Representation of extern arrow.
|
||||
-- "IntRADIUSCAMERA" : Representation of intern arrow.
|
||||
-- "RADIUSTEXTCAMERA": Representation of radius value.
|
||||
-- "NOTHINGCAMERA" : Any component of camera.
|
||||
-- Determinate which type of tracking apply.
|
||||
|
||||
-----------------------------------------
|
||||
---Category: Private or Protected methods
|
||||
-----------------------------------------
|
||||
|
||||
Symbol ( me ; gsymbol : mutable Group from Graphic3d ;
|
||||
aView : View from V3d ) is static private;
|
||||
---Level: Internal
|
||||
---Purpose: Defined the representation of camera position.
|
||||
|
||||
SymetricPointOnSphere ( myclass ; aView : View from V3d;
|
||||
Center : Vertex from Graphic3d;
|
||||
aPoint : Vertex from Graphic3d;
|
||||
Radius : Parameter;
|
||||
X,Y,Z : out Coordinate;
|
||||
VX,VY,VZ : out Parameter )
|
||||
is private ;
|
||||
---Level: Internal
|
||||
---Purpose: Returns the symetric point coordinates of "aPoint"
|
||||
-- on the sphere of center "Center" and radius "Radius".
|
||||
-- VX,VY,VZ is the project vector of view.
|
||||
|
||||
fields
|
||||
|
||||
MyPosition: Vertex from Graphic3d;
|
||||
MyTarget: Vertex from Graphic3d;
|
||||
MyAngle: PlaneAngle from Quantity;
|
||||
MyAperture: PlaneAngle from Quantity;
|
||||
MyGraphicStructure: Structure from Graphic3d;
|
||||
MyGraphicStructure1: Structure from Graphic3d;
|
||||
MyTypeOfRepresentation: TypeOfRepresentation from V3d;
|
||||
|
||||
end Camera;
|
||||
|
||||
|
||||
|
@ -1,835 +0,0 @@
|
||||
/***********************************************************************
|
||||
|
||||
FONCTION :
|
||||
----------
|
||||
Classe V3d_Camera :
|
||||
|
||||
HISTORIQUE DES MODIFICATIONS :
|
||||
--------------------------------
|
||||
00-09-92 : GG ; Creation.
|
||||
18-06-96 : FMN ; Ajout MyGraphicStructure1 pour sauvegarder snopick
|
||||
24-12-97 : FMN ; Remplacement de math par MathGra
|
||||
31-12-97 : CAL ; Suppression de MathGra
|
||||
21-01-98 : CAL ; Window de Xw et WNT remplacee par Aspect_Window
|
||||
23-02-98 : FMN ; Remplacement PI par Standard_PI
|
||||
02.15.100 : JR : Clutter
|
||||
|
||||
************************************************************************/
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Includes
|
||||
*/
|
||||
|
||||
#include <V3d_Camera.ixx>
|
||||
#include <V3d.hxx>
|
||||
#include <V3d_PerspectiveView.hxx>
|
||||
#include <Graphic3d_Vector.hxx>
|
||||
#include <Graphic3d_Vertex.hxx>
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_Array1OfVertex.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
#include <Visual3d_ViewManager.hxx>
|
||||
#include <Visual3d_ContextPick.hxx>
|
||||
#include <Visual3d_PickDescriptor.hxx>
|
||||
#include <Visual3d_HSequenceOfPickPath.hxx>
|
||||
#include <Visual3d_PickPath.hxx>
|
||||
#include <Viewer_BadValue.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <TColStd_Array2OfReal.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Aspect_Window.hxx>
|
||||
|
||||
//-Declarations
|
||||
#define DEUXPI (2. * M_PI)
|
||||
|
||||
//-Constructors
|
||||
|
||||
V3d_Camera::V3d_Camera(const Handle(V3d_View)& aView) {
|
||||
Standard_Real X,Y,Z;
|
||||
Graphic3d_Vertex P,T;
|
||||
|
||||
// The eye point defines the position of the camera
|
||||
aView->Eye(X,Y,Z);
|
||||
P.SetCoord(X,Y,Z);
|
||||
MyPosition = P;
|
||||
// The target point defines the target of the camera
|
||||
aView->At(X,Y,Z);
|
||||
T.SetCoord(X,Y,Z);
|
||||
MyTarget = T;
|
||||
// Incline Angle of the camera
|
||||
MyAngle = aView->Twist();
|
||||
// Aperture Angle of the camera
|
||||
MyAperture = (aView->DynamicType()==STANDARD_TYPE(V3d_PerspectiveView)) ?
|
||||
((Handle(V3d_PerspectiveView)&)aView)->Angle() : 0.;
|
||||
|
||||
}
|
||||
|
||||
//-Methods, in order
|
||||
|
||||
void V3d_Camera::SetPosition(const Standard_Real Xp, const Standard_Real Yp, const Standard_Real Zp) {
|
||||
|
||||
MyPosition.SetCoord(Xp,Yp,Zp) ;
|
||||
}
|
||||
|
||||
void V3d_Camera::SetAngle(const Standard_Real Angle) {
|
||||
|
||||
Viewer_BadValue_Raise_if( Abs(Angle) > DEUXPI, "V3d_Camera::SetAngle, bad angle" );
|
||||
MyAngle = Angle ;
|
||||
}
|
||||
|
||||
void V3d_Camera::SetAperture(const Standard_Real Angle) {
|
||||
|
||||
Viewer_BadValue_Raise_if( Angle <= 0. || Angle >= M_PI ,"V3d_Camera::SetAperture, bad angle");
|
||||
MyAperture = Angle ;
|
||||
}
|
||||
|
||||
void V3d_Camera::SetTarget(const Standard_Real X, const Standard_Real Y, const Standard_Real Z) {
|
||||
|
||||
MyTarget.SetCoord(X,Y,Z);
|
||||
}
|
||||
|
||||
void V3d_Camera::SetRadius(const Standard_Real Radius) {
|
||||
|
||||
Viewer_BadValue_Raise_if( Radius <= 0., "V3d_Camera::SetRadius, bad radius");
|
||||
|
||||
Standard_Real X0,Y0,Z0,Xn,Yn,Zn;
|
||||
|
||||
// Targer point remains unchanged, only the position of the camera is modified
|
||||
// preserving the direction.
|
||||
Graphic3d_Vector D(MyTarget,MyPosition);
|
||||
D.Normalize();
|
||||
D.Coord(Xn,Yn,Zn);
|
||||
MyTarget.Coord(X0,Y0,Z0);
|
||||
Xn = X0 + Radius*Xn;
|
||||
Yn = Y0 + Radius*Yn;
|
||||
Zn = Z0 + Radius*Zn;
|
||||
MyPosition.SetCoord(Xn,Yn,Zn) ;
|
||||
|
||||
}
|
||||
|
||||
void V3d_Camera::OnHideFace(const Handle(V3d_View)& aView) {
|
||||
|
||||
Standard_Real XP,YP,ZP,Rayon,X,Y,Z,VX,VY,VZ;
|
||||
|
||||
Rayon = this->Radius();
|
||||
MyPosition.Coord(XP,YP,ZP);
|
||||
SymetricPointOnSphere(aView,MyTarget,MyPosition,Rayon,X,Y,Z,VX,VY,VZ);
|
||||
// This point is visible
|
||||
if ( (VX*(X-XP) < 0.) && (VY*(Y-YP) < 0.) && (VZ*(Z-ZP) < 0.) ) {
|
||||
this->SetPosition(X,Y,Z);
|
||||
}
|
||||
}
|
||||
|
||||
void V3d_Camera::OnSeeFace(const Handle(V3d_View)& aView) {
|
||||
|
||||
Standard_Real XP,YP,ZP,Rayon,X,Y,Z,VX,VY,VZ;
|
||||
|
||||
Rayon = this->Radius();
|
||||
MyPosition.Coord(XP,YP,ZP);
|
||||
SymetricPointOnSphere(aView,MyTarget,MyPosition,Rayon,X,Y,Z,VX,VY,VZ);
|
||||
// This point is hidden
|
||||
if ( (VX*(X-XP) > 0.) && (VY*(Y-YP) > 0.) && (VZ*(Z-ZP) > 0.) ) {
|
||||
this->SetPosition(X,Y,Z);
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean V3d_Camera::SeeOrHide(const Handle(V3d_View)& aView) const {
|
||||
|
||||
Standard_Real XP,YP,ZP,Rayon,X,Y,Z,VX,VY,VZ;
|
||||
Standard_Boolean Val;
|
||||
|
||||
Rayon = this->Radius();
|
||||
MyPosition.Coord(XP,YP,ZP);
|
||||
SymetricPointOnSphere(aView,MyTarget,MyPosition,Rayon,X,Y,Z,VX,VY,VZ);
|
||||
// Is it a visible or a hidden point?
|
||||
if ( (VX*(X-XP) > 0.) || (VY*(Y-YP) > 0.) || (VZ*(Z-ZP) > 0.) )
|
||||
// the source is on the hidden face
|
||||
Val = Standard_False;
|
||||
else
|
||||
// the source is on the visible face.
|
||||
Val = Standard_True;
|
||||
|
||||
return Val;
|
||||
|
||||
}
|
||||
|
||||
void V3d_Camera::Position(Standard_Real& Xp, Standard_Real& Yp, Standard_Real& Zp)const {
|
||||
|
||||
MyPosition.Coord(Xp,Yp,Zp) ;
|
||||
}
|
||||
|
||||
Standard_Real V3d_Camera::Angle()const {
|
||||
|
||||
return MyAngle ;
|
||||
}
|
||||
|
||||
Standard_Real V3d_Camera::Aperture()const {
|
||||
|
||||
return MyAperture ;
|
||||
}
|
||||
|
||||
void V3d_Camera::Target(Standard_Real& Xp, Standard_Real& Yp, Standard_Real& Zp)const {
|
||||
|
||||
// Graphic3d_Vertex P ;
|
||||
MyTarget.Coord(Xp,Yp,Zp) ;
|
||||
}
|
||||
|
||||
Standard_Real V3d_Camera::Radius() const {
|
||||
|
||||
Standard_Real Xp,Yp,Zp,Xc,Yc,Zc,Radius;
|
||||
MyPosition.Coord(Xp,Yp,Zp);
|
||||
MyTarget.Coord(Xc,Yc,Zc);
|
||||
Radius = Square(Xc - Xp) + Square(Yc - Yp) + Square(Zc - Zp);
|
||||
Radius = Sqrt(Radius);
|
||||
return Radius ;
|
||||
}
|
||||
|
||||
void V3d_Camera::Symbol (const Handle(Graphic3d_Group)& gsymbol,
|
||||
// const Handle(V3d_View)& aView) const {
|
||||
const Handle(V3d_View)& ) const {
|
||||
|
||||
Standard_Real X0,Y0,Z0,XP,YP,ZP,Dx,Dy,Dz,Lng;
|
||||
Standard_Real Xc1,Yc1,Zc1,Xc2,Yc2,Zc2,Xi,Yi,Zi,Xj,Yj,Zj;
|
||||
Standard_Real Xn,Yn,Zn,X,Y,Z,Norme;
|
||||
Standard_Real cosinus,sinus;
|
||||
Standard_Real Alpha = M_PI / 4.;
|
||||
Standard_Integer NbPoints = 4, i;
|
||||
Graphic3d_Array1OfVertex VN1(1,NbPoints+1);
|
||||
Graphic3d_Array1OfVertex VN2(1,NbPoints+1);
|
||||
Graphic3d_Array1OfVertex V2(1,2);
|
||||
|
||||
// Direction of the camera
|
||||
MyPosition.Coord(XP,YP,ZP);
|
||||
MyTarget.Coord(X0,Y0,Z0);
|
||||
Dx = X0 - XP; Dy = Y0 - YP; Dz = Z0 - ZP;
|
||||
Lng = this->Radius()/10.;
|
||||
|
||||
// Find centers of base squares of the case of the camera :
|
||||
Xc1 = XP - Dx * Lng; Yc1 = YP - Dy * Lng; Zc1 = ZP - Dz * Lng;
|
||||
Xc2 = XP + Dx * Lng; Yc2 = YP + Dy * Lng; Zc2 = ZP + Dz * Lng;
|
||||
|
||||
// Construction of a mark i,j for rectangles :
|
||||
Xn=0., Yn=0., Zn=0.;
|
||||
|
||||
if ( Abs(Dx) <= Abs(Dy) && Abs(Dx) <= Abs(Dz)) Xn=1.;
|
||||
else if ( Abs(Dy) <= Abs(Dz) && Abs(Dy) <= Abs(Dx)) Yn=1.;
|
||||
else Zn=1.;
|
||||
Xi = Dy * Zn - Dz * Yn;
|
||||
Yi = Dz * Xn - Dx * Zn;
|
||||
Zi = Dx * Yn - Dy * Xn;
|
||||
|
||||
Norme = Sqrt ( Xi*Xi + Yi*Yi + Zi*Zi );
|
||||
Xi= Xi / Norme; Yi = Yi / Norme; Zi = Zi/Norme;
|
||||
|
||||
Xj = Dy * Zi - Dz * Yi;
|
||||
Yj = Dz * Xi - Dx * Zi;
|
||||
Zj = Dx * Yi - Dy * Xi;
|
||||
|
||||
// Scheme of the case
|
||||
for (i = 1 ; i <= NbPoints ; i++) {
|
||||
|
||||
cosinus = Cos ( Alpha + (i - 1) * M_PI / 2. );
|
||||
sinus = Sin ( Alpha + (i - 1) * M_PI/2. );
|
||||
|
||||
// First base square
|
||||
X = Xc1 + (cosinus * Xi + sinus * Xj) * Lng / 2.;
|
||||
Y = Yc1 + (cosinus * Yi + sinus * Yj) * Lng / 2.;
|
||||
Z = Zc1 + (cosinus * Zi + sinus * Zj) * Lng / 2.;
|
||||
VN1(i).SetCoord(X,Y,Z);
|
||||
if(i==1) VN1(NbPoints+1).SetCoord(X,Y,Z);
|
||||
V2(1).SetCoord(X,Y,Z);
|
||||
|
||||
// Second base square
|
||||
X = Xc2 + (cosinus * Xi + sinus * Xj) * Lng / 2.;
|
||||
Y = Yc2 + (cosinus * Yi + sinus * Yj) * Lng / 2.;
|
||||
Z = Zc2 + (cosinus * Zi + sinus * Zj) * Lng / 2.;
|
||||
VN2(i).SetCoord(X,Y,Z);
|
||||
if(i==1) VN2(NbPoints+1).SetCoord(X,Y,Z);
|
||||
V2(2).SetCoord(X,Y,Z);
|
||||
|
||||
gsymbol->Polyline(V2);
|
||||
}
|
||||
gsymbol->Polyline(VN1);
|
||||
gsymbol->Polyline(VN2);
|
||||
|
||||
// Scheme of the objective
|
||||
for (i = 1 ; i <= NbPoints ; i++) {
|
||||
|
||||
cosinus = Cos ( Alpha + (i - 1) * M_PI / 2. );
|
||||
sinus = Sin ( Alpha + (i - 1) * M_PI / 2. );
|
||||
|
||||
// Premier carre de base
|
||||
X = Xc2 + (cosinus * Xi + sinus * Xj) * Lng / 6.;
|
||||
Y = Yc2 + (cosinus * Yi + sinus * Yj) * Lng / 6.;
|
||||
Z = Zc2 + (cosinus * Zi + sinus * Zj) * Lng / 6.;
|
||||
VN1(i).SetCoord(X,Y,Z);
|
||||
if(i==1) VN1(NbPoints+1).SetCoord(X,Y,Z);
|
||||
V2(1).SetCoord(X,Y,Z);
|
||||
|
||||
// Second base square
|
||||
X = Xc2 + Dx * Lng / 6. + (cosinus * Xi + sinus * Xj) * Lng / 3.;
|
||||
Y = Yc2 + Dy * Lng / 6. + (cosinus * Yi + sinus * Yj) * Lng / 3.;
|
||||
Z = Zc2 + Dz * Lng / 6. + (cosinus * Zi + sinus * Zj) * Lng / 3.;
|
||||
VN2(i).SetCoord(X,Y,Z);
|
||||
if(i==1) VN2(NbPoints+1).SetCoord(X,Y,Z);
|
||||
V2(2).SetCoord(X,Y,Z);
|
||||
|
||||
gsymbol->Polyline(V2);
|
||||
}
|
||||
gsymbol->Polyline(VN1);
|
||||
gsymbol->Polyline(VN2);
|
||||
|
||||
}
|
||||
|
||||
void V3d_Camera::Display( const Handle(V3d_View)& aView,
|
||||
const V3d_TypeOfRepresentation TPres) {
|
||||
|
||||
Graphic3d_Array1OfVertex PRadius(0,1);
|
||||
Graphic3d_Vertex PText ;
|
||||
Standard_Real X,Y,Z,Rayon;
|
||||
Standard_Real X0,Y0,Z0,VX,VY,VZ;
|
||||
Standard_Real X1,Y1,Z1,XT,YT,ZT,PXT,PYT;
|
||||
Standard_Real DXRef,DYRef,DZRef,DXini,DYini,DZini;
|
||||
Standard_Integer IXP,IYP;
|
||||
V3d_TypeOfRepresentation Pres;
|
||||
V3d_TypeOfUpdate UpdSov;
|
||||
|
||||
|
||||
// Creation of a structure of markable elements (position of the
|
||||
// camera, and the sphere of displacement of this camera)
|
||||
|
||||
Pres = TPres;
|
||||
Handle(V3d_Viewer) TheViewer = aView->Viewer();
|
||||
UpdSov = TheViewer->UpdateMode();
|
||||
TheViewer->SetUpdateMode(V3d_WAIT);
|
||||
if (!MyGraphicStructure.IsNull()) {
|
||||
MyGraphicStructure->Disconnect(MyGraphicStructure1);
|
||||
MyGraphicStructure->Clear();
|
||||
MyGraphicStructure1->Clear();
|
||||
if (Pres == V3d_SAMELAST) Pres = MyTypeOfRepresentation;
|
||||
}
|
||||
else {
|
||||
if (Pres == V3d_SAMELAST) Pres = V3d_SIMPLE;
|
||||
Handle(Graphic3d_Structure) scamera = new Graphic3d_Structure(TheViewer->Viewer());
|
||||
MyGraphicStructure = scamera;
|
||||
Handle(Graphic3d_Structure) snopick = new Graphic3d_Structure(TheViewer->Viewer());
|
||||
MyGraphicStructure1 = snopick;
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) gradius;
|
||||
Handle(Graphic3d_Group) gExtArrow;
|
||||
Handle(Graphic3d_Group) gIntArrow;
|
||||
if (Pres == V3d_COMPLETE) {
|
||||
gradius = new Graphic3d_Group(MyGraphicStructure);
|
||||
gExtArrow = new Graphic3d_Group(MyGraphicStructure);
|
||||
gIntArrow = new Graphic3d_Group(MyGraphicStructure);
|
||||
}
|
||||
Handle(Graphic3d_Group) gcamera = new Graphic3d_Group(MyGraphicStructure);
|
||||
Handle(Graphic3d_Group) gsphere;
|
||||
if (Pres == V3d_COMPLETE || Pres == V3d_PARTIAL) gsphere = new Graphic3d_Group(MyGraphicStructure);
|
||||
|
||||
// Creation of a structure of non-markable elements (meridian and
|
||||
// parallel ).
|
||||
Handle(Graphic3d_Group) gnopick = new Graphic3d_Group(MyGraphicStructure1);
|
||||
MyGraphicStructure1->SetPick(Standard_False);
|
||||
|
||||
MyTarget.Coord(X0,Y0,Z0);
|
||||
|
||||
// Display of the position of the camera.
|
||||
|
||||
gcamera->SetPickId(1);
|
||||
if (Pres == V3d_SIMPLE) {
|
||||
// a viewfinder is drawn
|
||||
Graphic3d_Array1OfVertex PViseur(1,2);
|
||||
aView->Project(X0,Y0,Z0,PXT,PYT);
|
||||
aView->Convert(PXT,PYT,IXP,IYP);
|
||||
aView->Convert(IXP,IYP,XT,YT,ZT);
|
||||
aView->Convert(IXP+20,IYP,X,Y,Z);
|
||||
PViseur(1).SetCoord(X+X0-XT,Y+Y0-YT,Z+Z0-ZT);
|
||||
aView->Convert(IXP-20,IYP,X,Y,Z);
|
||||
PViseur(2).SetCoord(X+X0-XT,Y+Y0-YT,Z+Z0-ZT);
|
||||
gcamera->Polyline(PViseur);
|
||||
aView->Convert(IXP,IYP-20,X,Y,Z);
|
||||
PViseur(1).SetCoord(X+X0-XT,Y+Y0-YT,Z+Z0-ZT);
|
||||
aView->Convert(IXP,IYP+20,X,Y,Z);
|
||||
PViseur(2).SetCoord(X+X0-XT,Y+Y0-YT,Z+Z0-ZT);
|
||||
gcamera->Polyline(PViseur);
|
||||
}
|
||||
// a camera is drawn
|
||||
else this->Symbol(gcamera,aView);
|
||||
|
||||
// Display of the marking sphere (limited to circle).
|
||||
|
||||
if (Pres == V3d_COMPLETE || Pres == V3d_PARTIAL) {
|
||||
|
||||
Rayon = this->Radius();
|
||||
aView->Proj(VX,VY,VZ);
|
||||
gsphere->SetPickId(2);
|
||||
V3d::CircleInPlane(gsphere,X0,Y0,Z0,VX,VY,VZ,Rayon);
|
||||
|
||||
// Display of the radius of the sphere (line + text)
|
||||
|
||||
if (Pres == V3d_COMPLETE) {
|
||||
gradius->SetPickId(3);
|
||||
gExtArrow->SetPickId(4);
|
||||
gIntArrow->SetPickId(5);
|
||||
PRadius(0).SetCoord(X0,Y0,Z0);
|
||||
MyPosition.Coord(X,Y,Z);
|
||||
PRadius(1).SetCoord(X,Y,Z);
|
||||
gnopick->Polyline(PRadius);
|
||||
V3d::ArrowOfRadius(gExtArrow,X-(X-X0)/10.,
|
||||
Y-(Y-Y0)/10.,
|
||||
Z-(Z-Z0)/10., X-X0, Y-Y0, Z-Z0, M_PI / 15., Rayon / 20.);
|
||||
V3d::ArrowOfRadius(gIntArrow, X0, Y0, Z0, X0-X, Y0-Y, Z0-Z, M_PI / 15.,
|
||||
Rayon/20.);
|
||||
TCollection_AsciiString ValOfRadius(Rayon);
|
||||
PText.SetCoord( (X0+X)/2., (Y0+Y)/2. , (Z0+Z)/2. );
|
||||
gradius->Text(ValOfRadius.ToCString(),PText,0.01);
|
||||
}
|
||||
|
||||
// Display of the meridian
|
||||
|
||||
Quantity_Color Col2(Quantity_NOC_GREEN);
|
||||
Handle(Graphic3d_AspectLine3d) Asp2 = new Graphic3d_AspectLine3d
|
||||
(Col2,Aspect_TOL_SOLID,1.);
|
||||
gnopick->SetPrimitivesAspect(Asp2);
|
||||
|
||||
// Definition of the axis of circle
|
||||
aView->Up(DXRef,DYRef,DZRef);
|
||||
this->Position(X,Y,Z);
|
||||
DXini = X-X0; DYini = Y-Y0; DZini = Z-Z0;
|
||||
VX = DYRef*DZini - DZRef*DYini;
|
||||
VY = DZRef*DXini - DXRef*DZini;
|
||||
VZ = DXRef*DYini - DYRef*DXini;
|
||||
|
||||
V3d::CircleInPlane(gnopick,X0,Y0,Z0,VX,VY,VZ,Rayon);
|
||||
|
||||
// Display of the parallel
|
||||
|
||||
// Definition of the axis of circle
|
||||
aView->Proj(VX,VY,VZ);
|
||||
aView->Up(X1,Y1,Z1);
|
||||
DXRef = VY * Z1 - VZ * Y1;
|
||||
DYRef = VZ * X1 - VX * Z1;
|
||||
DZRef = VX * Y1 - VY * X1;
|
||||
this->Position(X,Y,Z);
|
||||
DXini = X-X0; DYini = Y-Y0; DZini = Z-Z0;
|
||||
VX = DYRef*DZini - DZRef*DYini;
|
||||
VY = DZRef*DXini - DXRef*DZini;
|
||||
VZ = DXRef*DYini - DYRef*DXini;
|
||||
|
||||
V3d::CircleInPlane(gnopick,X0,Y0,Z0,VX,VY,VZ,Rayon);
|
||||
|
||||
}
|
||||
|
||||
MyGraphicStructure->Connect(MyGraphicStructure1,Graphic3d_TOC_DESCENDANT);
|
||||
MyTypeOfRepresentation = Pres;
|
||||
MyGraphicStructure->Display();
|
||||
TheViewer->SetUpdateMode(UpdSov);
|
||||
}
|
||||
|
||||
void V3d_Camera::Erase() {
|
||||
|
||||
if (!MyGraphicStructure.IsNull()) MyGraphicStructure->Erase();
|
||||
if (!MyGraphicStructure1.IsNull()) MyGraphicStructure1->Erase();
|
||||
}
|
||||
|
||||
V3d_TypeOfPickCamera V3d_Camera::Pick(const Handle(V3d_View)& aView,
|
||||
const Standard_Integer Xpix,
|
||||
const Standard_Integer Ypix) const
|
||||
{
|
||||
|
||||
Standard_Integer i, Lng, Id;
|
||||
Standard_Boolean kcont;
|
||||
V3d_TypeOfPickCamera TPick;
|
||||
|
||||
Handle(Visual3d_ViewManager) VM = (aView->Viewer())->Viewer();
|
||||
Visual3d_ContextPick CTXP;
|
||||
Visual3d_PickDescriptor Pdes = VM->Pick(CTXP,aView->Window (),Xpix,Ypix);
|
||||
Visual3d_PickPath OnePPath;
|
||||
Handle(Visual3d_HSequenceOfPickPath) PPath = Pdes.PickPath();
|
||||
Lng = PPath->Length();
|
||||
kcont = Standard_True;
|
||||
TPick = V3d_NOTHINGCAMERA;
|
||||
for (i=1; i<=Lng && kcont; i++) {
|
||||
OnePPath = PPath->Value(i);
|
||||
Id = OnePPath.PickIdentifier();
|
||||
if (MyGraphicStructure == OnePPath.StructIdentifier()){
|
||||
switch (Id) {
|
||||
case 1 : TPick = V3d_POSITIONCAMERA;
|
||||
break;
|
||||
case 2 : TPick = V3d_SPACECAMERA;
|
||||
break;
|
||||
case 3 : TPick = V3d_RADIUSTEXTCAMERA;
|
||||
break;
|
||||
case 4 : TPick = V3d_ExtRADIUSCAMERA;
|
||||
break;
|
||||
case 5 : TPick = V3d_IntRADIUSCAMERA;
|
||||
break;
|
||||
}
|
||||
kcont = Standard_False;
|
||||
}
|
||||
}
|
||||
return TPick;
|
||||
}
|
||||
|
||||
void V3d_Camera::Tracking( const Handle(V3d_View)& aView,
|
||||
const V3d_TypeOfPickCamera WhatPick,
|
||||
const Standard_Integer Xpix,
|
||||
const Standard_Integer Ypix) {
|
||||
|
||||
|
||||
Standard_Real XPp,YPp,PXT,PYT,X,Y,Z,Rayon,Ylim;
|
||||
Standard_Real XMinTrack,XMaxTrack,YMinTrack,YMaxTrack;
|
||||
Standard_Real XT,YT,ZT,X0,Y0,Z0,XP,YP,ZP,VX,VY,VZ,A,B,C,Delta;
|
||||
Standard_Real DX,DY,PXP,PYP,Xproj,Yproj;
|
||||
Standard_Real A1,A2,B1,B2,Rap,OldRprj,NewRprj;
|
||||
Standard_Real Xi,Yi,Zi,DeltaX,DeltaY,DeltaZ,Lambda;
|
||||
Standard_Integer IPX,IPY;
|
||||
|
||||
|
||||
aView->Convert(Xpix,Ypix,XPp,YPp);
|
||||
MyTarget.Coord(X0,Y0,Z0);
|
||||
aView->Project(X0,Y0,Z0,PXT,PYT);
|
||||
aView->Convert(PXT,PYT,IPX,IPY);
|
||||
// Coord 3d in the plane of projection of the target.
|
||||
aView->Convert(IPX,IPY,XT,YT,ZT);
|
||||
switch (WhatPick) {
|
||||
case V3d_POSITIONCAMERA :
|
||||
// Coordinates should remain inside of the sphere
|
||||
Rayon = this->Radius();
|
||||
XMinTrack = PXT - Rayon;
|
||||
XMaxTrack = PXT + Rayon;
|
||||
Ylim = Sqrt( Square(Rayon) - Square(XPp - PXT) );
|
||||
YMinTrack = PYT - Ylim;
|
||||
YMaxTrack = PYT + Ylim;
|
||||
if (XPp >= XMinTrack && XPp <= XMaxTrack) {
|
||||
if (YPp >= YMinTrack && YPp <= YMaxTrack) {
|
||||
aView->ProjReferenceAxe(Xpix,Ypix,XP,YP,ZP,VX,VY,VZ);
|
||||
DeltaX = X0 - XP;
|
||||
DeltaY = Y0 - YP;
|
||||
DeltaZ = Z0 - ZP;
|
||||
|
||||
// The point of intersection of straight lines defined by :
|
||||
// - Straight line passing by the point of projection and the eye
|
||||
// if this is a perspective, parallel to the normal of the
|
||||
// view if there is an axonometric view.
|
||||
// position in the view is parallel to the normal of the view
|
||||
// - The distance position of the target camera cible is equal
|
||||
// to the radius.
|
||||
|
||||
A = VX*VX + VY*VY + VZ*VZ ;
|
||||
B = -2. * (VX*DeltaX + VY*DeltaY + VZ*DeltaZ);
|
||||
C = DeltaX*DeltaX + DeltaY*DeltaY + DeltaZ*DeltaZ
|
||||
- Rayon*Rayon ;
|
||||
Delta = B*B - 4.*A*C;
|
||||
if ( Delta >= 0 ) {
|
||||
Lambda = (-B + Sqrt(Delta))/(2.*A);
|
||||
X = XP + Lambda*VX;
|
||||
Y = YP + Lambda*VY;
|
||||
Z = ZP + Lambda*VZ;
|
||||
MyPosition.SetCoord(X,Y,Z);
|
||||
this->Display(aView,MyTypeOfRepresentation);
|
||||
aView->Update();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case V3d_SPACECAMERA :
|
||||
aView->Convert(PXT,PYT,IPX,IPY);
|
||||
// In case Xpix,Ypix corresponding to a distance , relative
|
||||
// to the translation that is planned to be done on the sphere.
|
||||
aView->Convert(IPX+Xpix,IPY+Ypix,X,Y,Z);
|
||||
X = X+X0-XT;
|
||||
Y = Y+Y0-YT;
|
||||
Z = Z+Z0-ZT;
|
||||
MyTarget.SetCoord(X,Y,Z);
|
||||
MyPosition.Coord(Xi,Yi,Zi);
|
||||
Xi = Xi + (X - X0);
|
||||
Yi = Yi + (Y - Y0);
|
||||
Zi = Zi + (Z - Z0);
|
||||
MyPosition.SetCoord(Xi,Yi,Zi);
|
||||
this->Display(aView,MyTypeOfRepresentation);
|
||||
aView->Update();
|
||||
break;
|
||||
|
||||
case V3d_ExtRADIUSCAMERA :
|
||||
// It is attempted to preserve the target positioning direction of the
|
||||
// camera ==> the point is projected on the target camera direction.
|
||||
this->Position(Xi,Yi,Zi);
|
||||
aView->Project(Xi,Yi,Zi,PXP,PYP);
|
||||
DX = PXP - PXT;
|
||||
DY = PYP - PYT;
|
||||
A1 = DY/DX ; B1 = PYT - A1*PXT;
|
||||
A2 = -DX/DY; B2 = YPp - A2*XPp;
|
||||
Xproj = (B2 - B1) / (A1 - A2);
|
||||
Yproj = A1*Xproj + B1;
|
||||
if ( (DX*(Xproj-PXT) > 0.) && (DY*(Yproj-PYT) > 0.) ) {
|
||||
OldRprj = Sqrt ( Square (PXP-PXT) + Square (PYP-PYT) );
|
||||
NewRprj = Sqrt ( Square (Xproj-PXT) + Square (Yproj-PYT) );
|
||||
Rap = NewRprj/OldRprj;
|
||||
Rayon = this->Radius();
|
||||
Rayon = Rayon * Rap;
|
||||
this->SetRadius(Rayon);
|
||||
this->Display(aView,MyTypeOfRepresentation);
|
||||
aView->Update();
|
||||
}
|
||||
break;
|
||||
case V3d_IntRADIUSCAMERA :
|
||||
// It is attempted to preserve the target positioning direction of the
|
||||
// camera ==> the point is projected on the target camera direction.
|
||||
this->Position(Xi,Yi,Zi);
|
||||
aView->Project(Xi,Yi,Zi,PXP,PYP);
|
||||
DX = PXP - PXT;
|
||||
DY = PYP - PYT;
|
||||
A1 = DY/DX ; B1 = PYT - A1*PXT;
|
||||
A2 = -DX/DY; B2 = YPp - A2*XPp;
|
||||
Xproj = (B2 - B1) / (A1 - A2);
|
||||
Yproj = A1*Xproj + B1;
|
||||
if ( (DX*(Xproj-PXP) < 0.) && (DY*(Yproj-PYP) < 0.) ) {
|
||||
OldRprj = Sqrt ( Square (PXP-PXT) + Square (PYP-PYT) );
|
||||
NewRprj = Sqrt ( Square (Xproj-PXP) + Square (Yproj-PYP) );
|
||||
Rap = NewRprj/OldRprj;
|
||||
Rayon = this->Radius();
|
||||
Rayon = Rayon * Rap;
|
||||
// the camera should remain at a fixed position, only the target is modified.
|
||||
Graphic3d_Vector Dir(MyPosition,MyTarget);
|
||||
Dir.Normalize();
|
||||
Dir.Coord(X,Y,Z);
|
||||
X = Xi + Rayon*X;
|
||||
Y = Yi + Rayon*Y;
|
||||
Z = Zi + Rayon*Z;
|
||||
MyTarget.SetCoord(X,Y,Z);
|
||||
this->Display(aView,MyTypeOfRepresentation);
|
||||
aView->Update();
|
||||
}
|
||||
break;
|
||||
case V3d_RADIUSTEXTCAMERA :
|
||||
break;
|
||||
case V3d_NOTHINGCAMERA :
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void V3d_Camera::AerialPilot( const Handle(V3d_View)& aView,
|
||||
const Standard_Integer Xpix,
|
||||
const Standard_Integer Ypix) {
|
||||
|
||||
Standard_Real Xp,Yp,Zp,Xc,Yc,Zc,Xv,Yv,Zv,Xf,Yf,Zf;
|
||||
Standard_Real VX,VY,VZ,DXH,DYH,DZH,A,B,C,PXT,PYT,X1,Y1,Z1,Dist;
|
||||
Standard_Real Height,Width,Beta,CosBeta,SinBeta,Coef;
|
||||
Standard_Integer IPX,IPY,IHeight,IWidth;
|
||||
TColStd_Array2OfReal MatRot(0,2,0,2);
|
||||
|
||||
|
||||
MyPosition.Coord(Xp,Yp,Zp);
|
||||
MyTarget.Coord(Xc,Yc,Zc);
|
||||
aView->At(Xv,Yv,Zv);
|
||||
aView->Project(Xv,Yv,Zv,PXT,PYT);
|
||||
aView->Convert(PXT,PYT,IPX,IPY);
|
||||
// Find the pitching ==> Xpix = IPX and Ypix inverted
|
||||
// The target point turns around an axis passing through the eye and the
|
||||
// direction of vector belonging to the view plane
|
||||
// and perpendicular to the vector above the view.
|
||||
if ( Ypix != IPY ) {
|
||||
aView->Size(Width,Height);
|
||||
IHeight = aView->Convert(Height);
|
||||
Beta = ((IPY - Ypix) * M_PI) / (IHeight * 2.);
|
||||
aView->Proj(VX,VY,VZ);
|
||||
aView->Up(DXH,DYH,DZH);
|
||||
A = VY*DZH - VZ*DYH;
|
||||
B = VZ*DXH - VX*DZH;
|
||||
C = VX*DYH - VY*DXH;
|
||||
Dist = Sqrt( A*A + B*B + C*C);
|
||||
A = A/Dist; B = B/Dist; C = C/Dist;
|
||||
CosBeta = Cos(Beta);
|
||||
SinBeta = Sin(Beta);
|
||||
Coef = 1. - CosBeta;
|
||||
MatRot(0,0) = A * A + (1. - A * A) * CosBeta;
|
||||
MatRot(0,1) = -C * SinBeta + Coef * A * B;
|
||||
MatRot(0,2) = B * SinBeta + Coef * A * C;
|
||||
MatRot(1,0) = C * SinBeta + Coef * A * B;
|
||||
MatRot(1,1) = B * B + (1. - B * B) * CosBeta;
|
||||
MatRot(1,2) = -A * SinBeta + Coef * B * C;
|
||||
MatRot(2,0) = -B * SinBeta + Coef * A * C;
|
||||
MatRot(2,1) = A * SinBeta + Coef * B * C;
|
||||
MatRot(2,2) = C * C + (1. - C * C) * CosBeta;
|
||||
Xf = Xp * MatRot(0,0) + Yp * MatRot(0,1) + Zp * MatRot(0,2);
|
||||
Yf = Xp * MatRot(1,0) + Yp * MatRot(1,1) + Zp * MatRot(1,2);
|
||||
Zf = Xp * MatRot(2,0) + Yp * MatRot(2,1) + Zp * MatRot(2,2);
|
||||
// Rotation of the target point (target of the camera)
|
||||
X1 = Xc * MatRot(0,0) + Yc * MatRot(0,1) + Zc * MatRot(0,2);
|
||||
Y1 = Xc * MatRot(1,0) + Yc * MatRot(1,1) + Zc * MatRot(1,2);
|
||||
Z1 = Xc * MatRot(2,0) + Yc * MatRot(2,1) + Zc * MatRot(2,2);
|
||||
Xc = X1 + Xp - Xf ; Yc = Y1 + Yp - Yf ; Zc = Z1 + Zp - Zf;
|
||||
MyTarget.SetCoord(Xc,Yc,Zc);
|
||||
}
|
||||
// Find the rolling determined by Xpix
|
||||
if ( Xpix != IPX ) {
|
||||
IWidth = aView->Convert(Width);
|
||||
Beta = ((IPX - Xpix) * M_PI) / (IWidth * 2.);
|
||||
MyAngle = MyAngle + Beta;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void V3d_Camera::EarthPilot( const Handle(V3d_View)& aView,
|
||||
const Standard_Integer Xpix,
|
||||
const Standard_Integer Ypix) {
|
||||
// Piloting in land mode, resembles to the car driving
|
||||
// In this case, only the target point is modified.
|
||||
|
||||
Standard_Real Xp,Yp,Zp,Xc,Yc,Zc,Xv,Yv,Zv,Xf,Yf,Zf;
|
||||
Standard_Real VX,VY,VZ,DXH,DYH,DZH,A,B,C,PXT,PYT,X1,Y1,Z1,Dist;
|
||||
Standard_Real Height,Width,Beta,CosBeta,SinBeta,Coef;
|
||||
Standard_Integer IPX,IPY,IHeight,IWidth;
|
||||
TColStd_Array2OfReal MatRot(0,2,0,2);
|
||||
|
||||
MyPosition.Coord(Xp,Yp,Zp);
|
||||
MyTarget.Coord(Xc,Yc,Zc);
|
||||
aView->At(Xv,Yv,Zv);
|
||||
aView->Project(Xv,Yv,Zv,PXT,PYT);
|
||||
aView->Convert(PXT,PYT,IPX,IPY);
|
||||
// Find the pitching ==> Xpix = IPX and Ypix inverted
|
||||
// The target point turns around an axis passing through the eye and the
|
||||
// direction of vector belonging to the view plane
|
||||
// and perpendicular to the vector above the view.
|
||||
if ( Ypix != IPY ) {
|
||||
aView->Size(Width,Height);
|
||||
IHeight = aView->Convert(Height);
|
||||
Beta = ((IPY - Ypix) * M_PI) / (IHeight * 2.);
|
||||
aView->Proj(VX,VY,VZ);
|
||||
aView->Up(DXH,DYH,DZH);
|
||||
A = VY*DZH - VZ*DYH;
|
||||
B = VZ*DXH - VX*DZH;
|
||||
C = VX*DYH - VY*DXH;
|
||||
Dist = Sqrt( A*A + B*B + C*C);
|
||||
A = A/Dist; B = B/Dist; C = C/Dist;
|
||||
CosBeta = Cos(Beta);
|
||||
SinBeta = Sin(Beta);
|
||||
Coef = 1. - CosBeta;
|
||||
MatRot(0,0) = A * A + (1. - A * A) * CosBeta;
|
||||
MatRot(0,1) = -C * SinBeta + Coef * A * B;
|
||||
MatRot(0,2) = B * SinBeta + Coef * A * C;
|
||||
MatRot(1,0) = C * SinBeta + Coef * A * B;
|
||||
MatRot(1,1) = B * B + (1. - B * B) * CosBeta;
|
||||
MatRot(1,2) = -A * SinBeta + Coef * B * C;
|
||||
MatRot(2,0) = -B * SinBeta + Coef * A * C;
|
||||
MatRot(2,1) = A * SinBeta + Coef * B * C;
|
||||
MatRot(2,2) = C * C + (1. - C * C) * CosBeta;
|
||||
Xf = Xp * MatRot(0,0) + Yp * MatRot(0,1) + Zp * MatRot(0,2);
|
||||
Yf = Xp * MatRot(1,0) + Yp * MatRot(1,1) + Zp * MatRot(1,2);
|
||||
Zf = Xp * MatRot(2,0) + Yp * MatRot(2,1) + Zp * MatRot(2,2);
|
||||
// Rotation of the target point (target of the camera)
|
||||
X1 = Xc * MatRot(0,0) + Yc * MatRot(0,1) + Zc * MatRot(0,2);
|
||||
Y1 = Xc * MatRot(1,0) + Yc * MatRot(1,1) + Zc * MatRot(1,2);
|
||||
Z1 = Xc * MatRot(2,0) + Yc * MatRot(2,1) + Zc * MatRot(2,2);
|
||||
Xc = X1 + Xp - Xf ; Yc = Y1 + Yp - Yf ; Zc = Z1 + Zp - Zf;
|
||||
}
|
||||
// Find turning ==> Ypix = IPY . The target point rotates around
|
||||
// an axis // a vector above passing through the eye
|
||||
if ( Xpix != IPX ) {
|
||||
IWidth = aView->Convert(Width);
|
||||
Beta = ((IPX - Xpix) * M_PI) / (IWidth * 2.);
|
||||
aView->Up(A,B,C);
|
||||
Dist = Sqrt( A*A + B*B + C*C);
|
||||
A = A/Dist; B = B/Dist; C = C/Dist;
|
||||
CosBeta = Cos(Beta);
|
||||
SinBeta = Sin(Beta);
|
||||
Coef = 1. - CosBeta;
|
||||
MatRot(0,0) = A * A + (1. - A * A) * CosBeta;
|
||||
MatRot(0,1) = -C * SinBeta + Coef * A * B;
|
||||
MatRot(0,2) = B * SinBeta + Coef * A * C;
|
||||
MatRot(1,0) = C * SinBeta + Coef * A * B;
|
||||
MatRot(1,1) = B * B + (1. - B * B) * CosBeta;
|
||||
MatRot(1,2) = -A * SinBeta + Coef * B * C;
|
||||
MatRot(2,0) = -B * SinBeta + Coef * A * C;
|
||||
MatRot(2,1) = A * SinBeta + Coef * B * C;
|
||||
MatRot(2,2) = C * C + (1. - C * C) * CosBeta;
|
||||
Xf = Xp * MatRot(0,0) + Yp * MatRot(0,1) + Zp * MatRot(0,2);
|
||||
Yf = Xp * MatRot(1,0) + Yp * MatRot(1,1) + Zp * MatRot(1,2);
|
||||
Zf = Xp * MatRot(2,0) + Yp * MatRot(2,1) + Zp * MatRot(2,2);
|
||||
// Rotation of the target point (target of the camera)
|
||||
X1 = Xc * MatRot(0,0) + Yc * MatRot(0,1) + Zc * MatRot(0,2);
|
||||
Y1 = Xc * MatRot(1,0) + Yc * MatRot(1,1) + Zc * MatRot(1,2);
|
||||
Z1 = Xc * MatRot(2,0) + Yc * MatRot(2,1) + Zc * MatRot(2,2);
|
||||
Xc = X1 + Xp - Xf ; Yc = Y1 + Yp - Yf ; Zc = Z1 + Zp - Zf;
|
||||
}
|
||||
MyTarget.SetCoord(Xc,Yc,Zc);
|
||||
}
|
||||
|
||||
void V3d_Camera::Move (const Standard_Real Dist) {
|
||||
// Displacement of the camera by preserving the direction camera - target.
|
||||
|
||||
Standard_Real XP,YP,ZP,X0,Y0,Z0,DX,DY,DZ,Norme;
|
||||
|
||||
MyPosition.Coord(XP,YP,ZP);
|
||||
MyTarget.Coord(X0,Y0,Z0);
|
||||
DX = X0 - XP; DY = Y0 - YP; DZ = Z0 - ZP;
|
||||
Norme = Sqrt(DX*DX + DY*DY + DZ*DZ);
|
||||
DX = Dist*DX/Norme; DY = Dist*DY/Norme; DZ = Dist*DZ/Norme;
|
||||
XP = XP + DX; YP = YP + DY; ZP = ZP + DZ;
|
||||
X0 = X0 + DX; Y0 = Y0 + DY; Z0 = Z0 + DZ;
|
||||
MyPosition.SetCoord(XP,YP,ZP);
|
||||
MyTarget.SetCoord(X0,Y0,Z0);
|
||||
}
|
||||
|
||||
void V3d_Camera::GoUp (const Standard_Real Haut) {
|
||||
|
||||
// Displacement of the camera by axis z, preserving the direction camera -
|
||||
// target of the camera
|
||||
|
||||
MyPosition.SetZCoord(MyPosition.Z()+Haut);
|
||||
MyTarget.SetZCoord(MyTarget.Z()+Haut);
|
||||
}
|
||||
|
||||
void V3d_Camera::SymetricPointOnSphere (const Handle(V3d_View)& aView, const Graphic3d_Vertex &Center, const Graphic3d_Vertex &aPoint, const Standard_Real Rayon, Standard_Real& X, Standard_Real& Y, Standard_Real& Z, Standard_Real& VX, Standard_Real& VY, Standard_Real& VZ ) {
|
||||
|
||||
Standard_Real X0,Y0,Z0,XP,YP,ZP;
|
||||
Standard_Real PXP,PYP,DeltaX,DeltaY,DeltaZ;
|
||||
Standard_Real A,B,C,Delta,Lambda;
|
||||
Standard_Integer IPX,IPY;
|
||||
|
||||
Center.Coord(X0,Y0,Z0);
|
||||
aPoint.Coord(XP,YP,ZP);
|
||||
aView->Project(XP,YP,ZP,PXP,PYP);
|
||||
aView->Convert(PXP,PYP,IPX,IPY);
|
||||
aView->ProjReferenceAxe(IPX,IPY,X,Y,Z,VX,VY,VZ);
|
||||
DeltaX = X0 - XP;
|
||||
DeltaY = Y0 - YP;
|
||||
DeltaZ = Z0 - ZP;
|
||||
|
||||
// The point of intersection of straight lines defined by :
|
||||
// - Straight line passing by the point of projection and the eye
|
||||
// if this is a perspective, parallel to the normal of the
|
||||
// view if there is an axonometric view.
|
||||
// position in the view is parallel to the normal of the view
|
||||
// - The distance position of the target camera cible is equal
|
||||
// to the radius.
|
||||
|
||||
A = VX*VX + VY*VY + VZ*VZ ;
|
||||
B = -2. * (VX*DeltaX + VY*DeltaY + VZ*DeltaZ);
|
||||
C = DeltaX*DeltaX + DeltaY*DeltaY + DeltaZ*DeltaZ
|
||||
- Rayon*Rayon ;
|
||||
Delta = B*B - 4.*A*C;
|
||||
if ( Delta >= 0 ) {
|
||||
Lambda = (-B + Sqrt(Delta))/(2.*A);
|
||||
if ( Lambda >= -0.0001 && Lambda <= 0.0001 )
|
||||
Lambda = (-B - Sqrt(Delta))/(2.*A);
|
||||
X = XP + Lambda*VX;
|
||||
Y = YP + Lambda*VY;
|
||||
Z = ZP + Lambda*VZ;
|
||||
}
|
||||
else {
|
||||
X = XP; Y = YP; Z = ZP;
|
||||
}
|
||||
}
|
@ -228,7 +228,6 @@ void V3d_DirectionalLight::Display( const Handle(V3d_View)& aView,
|
||||
|
||||
//Display of the position of the light.
|
||||
|
||||
glight->SetPickId(1);
|
||||
this->Color(Quantity_TOC_RGB,R1,G1,B1);
|
||||
Quantity_Color Col1(R1,G1,B1,Quantity_TOC_RGB);
|
||||
Handle(Graphic3d_AspectLine3d) Asp1 = new Graphic3d_AspectLine3d();
|
||||
@ -242,7 +241,6 @@ void V3d_DirectionalLight::Display( const Handle(V3d_View)& aView,
|
||||
|
||||
Rayon = this->Radius();
|
||||
aView->Proj(VX,VY,VZ);
|
||||
gsphere->SetPickId(2);
|
||||
V3d::CircleInPlane(gsphere,X0,Y0,Z0,VX,VY,VZ,Rayon);
|
||||
|
||||
//Display of the meridian
|
||||
|
@ -96,16 +96,6 @@ is
|
||||
---Category: Inquire methods
|
||||
---------------------------------------------------
|
||||
|
||||
Pick ( me; aView: View from V3d; Xpix, Ypix: Integer from Standard)
|
||||
returns TypeOfPickLight from V3d is virtual;
|
||||
---Level: Public
|
||||
---Purpose: Returns the type of pick element.
|
||||
-- "POSITIONLIGHT" : Representation of position light.
|
||||
-- "SPACELIGHT" : Representation of lighting space.
|
||||
-- "RADIUSLIGHT" : Representation of lighting space radius.
|
||||
-- "NOTHING" : Any component of light.
|
||||
-- Determinate which type of tracking apply.
|
||||
|
||||
Radius (me ) returns Parameter is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns the radius of the picking sphere.
|
||||
|
@ -185,7 +185,6 @@ void V3d_PositionLight::Display( const Handle(V3d_View)& aView,
|
||||
|
||||
// Display of the light position.
|
||||
|
||||
glight->SetPickId(1);
|
||||
this->Color(Quantity_TOC_RGB,R1,G1,B1);
|
||||
Quantity_Color Col1(R1,G1,B1,Quantity_TOC_RGB);
|
||||
Handle(Graphic3d_AspectLine3d) Asp1 = new Graphic3d_AspectLine3d();
|
||||
@ -199,7 +198,6 @@ void V3d_PositionLight::Display( const Handle(V3d_View)& aView,
|
||||
|
||||
Rayon = this->Radius();
|
||||
aView->Proj(VX,VY,VZ);
|
||||
gsphere->SetPickId(2);
|
||||
V3d::CircleInPlane(gsphere,X0,Y0,Z0,VX,VY,VZ,Rayon);
|
||||
|
||||
|
||||
@ -208,9 +206,6 @@ void V3d_PositionLight::Display( const Handle(V3d_View)& aView,
|
||||
//Display of the radius of the sphere (line + text)
|
||||
|
||||
if (Pres == V3d_COMPLETE) {
|
||||
gradius->SetPickId(3);
|
||||
gExtArrow->SetPickId(4);
|
||||
gIntArrow->SetPickId(5);
|
||||
PRadius(0).SetCoord(X0,Y0,Z0);
|
||||
this->Position(X,Y,Z);
|
||||
PRadius(1).SetCoord(X,Y,Z);
|
||||
@ -266,57 +261,6 @@ void V3d_PositionLight::Display( const Handle(V3d_View)& aView,
|
||||
TheViewer->SetUpdateMode(UpdSov);
|
||||
}
|
||||
|
||||
V3d_TypeOfPickLight V3d_PositionLight::Pick(const Handle(V3d_View)& aView,
|
||||
const Standard_Integer Xpix,
|
||||
const Standard_Integer Ypix)
|
||||
const {
|
||||
|
||||
Standard_Integer i, Lng, Id;
|
||||
Standard_Boolean kcont;
|
||||
V3d_TypeOfPickLight TPick;
|
||||
|
||||
Handle(Visual3d_ViewManager) VM = (aView->Viewer())->Viewer();
|
||||
#ifdef WNT
|
||||
Handle( WNT_Window ) WW = Handle( WNT_Window ) :: DownCast ( aView -> Window () );
|
||||
#else
|
||||
Handle( Xw_Window ) WW = Handle( Xw_Window ) :: DownCast ( aView -> Window () );
|
||||
#endif
|
||||
Visual3d_ContextPick CTXP;
|
||||
Visual3d_PickDescriptor Pdes = VM->Pick(CTXP,WW,Xpix,Ypix);
|
||||
Visual3d_PickPath OnePPath;
|
||||
Handle(Visual3d_HSequenceOfPickPath) PPath = Pdes.PickPath();
|
||||
Lng = PPath->Length();
|
||||
kcont = Standard_True;
|
||||
TPick = V3d_NOTHING;
|
||||
for (i=1; i<=Lng && kcont; i++) {
|
||||
OnePPath = PPath->Value(i);
|
||||
Id = OnePPath.PickIdentifier();
|
||||
if (MyGraphicStructure == OnePPath.StructIdentifier()){
|
||||
switch (Id) {
|
||||
case 1 :
|
||||
TPick = V3d_POSITIONLIGHT;
|
||||
break;
|
||||
case 2 :
|
||||
TPick = V3d_SPACELIGHT;
|
||||
break;
|
||||
case 3 :
|
||||
if (MyType != V3d_DIRECTIONAL)
|
||||
TPick = V3d_RADIUSTEXTLIGHT;
|
||||
break;
|
||||
case 4 :
|
||||
if (MyType != V3d_DIRECTIONAL)
|
||||
TPick = V3d_ExtRADIUSLIGHT;
|
||||
break;
|
||||
case 5 :
|
||||
if (MyType != V3d_DIRECTIONAL)
|
||||
TPick = V3d_IntRADIUSLIGHT;
|
||||
break;
|
||||
}
|
||||
kcont = Standard_False;
|
||||
}
|
||||
}
|
||||
return TPick;
|
||||
}
|
||||
|
||||
void V3d_PositionLight::Tracking( const Handle(V3d_View)& aView,
|
||||
const V3d_TypeOfPickLight WhatPick,
|
||||
|
@ -224,7 +224,6 @@ void V3d_PositionalLight::Display( const Handle(V3d_View)& aView,
|
||||
|
||||
// Display of the position of the light.
|
||||
|
||||
glight->SetPickId(1);
|
||||
this->Color(Quantity_TOC_RGB,R1,G1,B1);
|
||||
Quantity_Color Col1(R1,G1,B1,Quantity_TOC_RGB);
|
||||
Handle(Graphic3d_AspectLine3d) Asp1 = new Graphic3d_AspectLine3d();
|
||||
@ -238,15 +237,11 @@ void V3d_PositionalLight::Display( const Handle(V3d_View)& aView,
|
||||
|
||||
Rayon = this->Radius();
|
||||
aView->Proj(VX,VY,VZ);
|
||||
gsphere->SetPickId(2);
|
||||
V3d::CircleInPlane(gsphere,X0,Y0,Z0,VX,VY,VZ,Rayon);
|
||||
|
||||
// Display of the radius of the sphere (line + text)
|
||||
|
||||
if (Pres == V3d_COMPLETE) {
|
||||
gradius->SetPickId(3);
|
||||
gExtArrow->SetPickId(4);
|
||||
gIntArrow->SetPickId(5);
|
||||
PRadius(0).SetCoord(X0,Y0,Z0);
|
||||
this->Position(X,Y,Z);
|
||||
PRadius(1).SetCoord(X,Y,Z);
|
||||
|
@ -251,7 +251,6 @@ void V3d_SpotLight::Display( const Handle(V3d_View)& aView,
|
||||
|
||||
//Display of the position of the light.
|
||||
|
||||
glight->SetPickId(1);
|
||||
this->Color(Quantity_TOC_RGB,R1,G1,B1);
|
||||
Quantity_Color Col1(R1,G1,B1,Quantity_TOC_RGB);
|
||||
Handle(Graphic3d_AspectLine3d) Asp1 = new Graphic3d_AspectLine3d();
|
||||
@ -265,15 +264,11 @@ void V3d_SpotLight::Display( const Handle(V3d_View)& aView,
|
||||
|
||||
Rayon = this->Radius();
|
||||
aView->Proj(VX,VY,VZ);
|
||||
gsphere->SetPickId(2);
|
||||
V3d::CircleInPlane(gsphere,X0,Y0,Z0,VX,VY,VZ,Rayon);
|
||||
|
||||
// Display of the radius of the sphere (line + text)
|
||||
|
||||
if (Pres == V3d_COMPLETE) {
|
||||
gradius->SetPickId(3);
|
||||
gExtArrow->SetPickId(4);
|
||||
gIntArrow->SetPickId(5);
|
||||
PRadius(0).SetCoord(X0,Y0,Z0);
|
||||
this->Position(X,Y,Z);
|
||||
PRadius(1).SetCoord(X,Y,Z);
|
||||
|
@ -15,6 +15,7 @@ Novembre 1998 : CAL : Creation.
|
||||
#include <Visual3d_Layer.ixx>
|
||||
|
||||
#include <Graphic3d_GraphicDevice.hxx>
|
||||
#include <Graphic3d_TypeOfPrimitive.hxx>
|
||||
#include <Visual3d_ViewManager.hxx>
|
||||
|
||||
//-Aliases
|
||||
|
@ -962,12 +962,6 @@ is
|
||||
---Purpose: Erases the structure <AStructure> from the view <me>.
|
||||
---Category: Private methods
|
||||
|
||||
Exploration ( me )
|
||||
is static;
|
||||
---Level: Internal
|
||||
---Purpose: Prints informations about the view <me>.
|
||||
---Category: Private methods
|
||||
|
||||
Highlight ( me : mutable;
|
||||
AStructure : Structure from Graphic3d;
|
||||
AMethod : TypeOfHighlightMethod from Aspect )
|
||||
|
@ -2964,13 +2964,6 @@ Standard_Integer Visual3d_View::Identification () const {
|
||||
|
||||
}
|
||||
|
||||
void Visual3d_View::Exploration () const {
|
||||
|
||||
if (IsDeleted ()) return;
|
||||
|
||||
MyGraphicDriver->DumpView (MyCView);
|
||||
|
||||
}
|
||||
|
||||
Standard_Boolean Visual3d_View::ZBufferIsActivated () const {
|
||||
|
||||
|
@ -222,17 +222,6 @@ is
|
||||
-- recently displayed. --
|
||||
-------------------------------------------------
|
||||
|
||||
Pick ( me : mutable;
|
||||
CTX : ContextPick from Visual3d;
|
||||
AWindow : Window from Aspect;
|
||||
AX, AY : Integer from Standard )
|
||||
returns PickDescriptor from Visual3d
|
||||
is static;
|
||||
---Level: Public
|
||||
---Purpose: Returns a graphic pick with the pick context <CTX>
|
||||
-- at the coordinates <AX>, <AY> in the window <AWindow>.
|
||||
---Category: Inquire methods
|
||||
|
||||
------------------------------
|
||||
-- Category: Redefined methods
|
||||
------------------------------
|
||||
|
@ -984,150 +984,6 @@ Standard_Boolean BResult;
|
||||
|
||||
}
|
||||
|
||||
Visual3d_PickDescriptor Visual3d_ViewManager::Pick (const Visual3d_ContextPick& CTX, const Handle(Aspect_Window)& AWindow, const Standard_Integer AX, const Standard_Integer AY) {
|
||||
|
||||
// The marking is activated only if the data is correct
|
||||
Standard_Boolean DoPick = Standard_False;
|
||||
|
||||
CALL_DEF_PICK apick;
|
||||
Standard_Integer Width, Height;
|
||||
|
||||
// Parse the list of views to find a
|
||||
// view having this specified window
|
||||
Visual3d_SetIteratorOfSetOfView MyIterator(MyDefinedView);
|
||||
int TheWindowIdOfView;
|
||||
|
||||
#ifndef WNT
|
||||
const Handle(Xw_Window) THEWindow = *(Handle(Xw_Window) *) &AWindow;
|
||||
int TheSpecifiedWindowId = int (THEWindow->XWindow ());
|
||||
#else
|
||||
const Handle(WNT_Window) THEWindow = *(Handle(WNT_Window) *) &AWindow;
|
||||
int TheSpecifiedWindowId = int (THEWindow->HWindow ());
|
||||
#endif // WNT
|
||||
|
||||
while ((! DoPick) && (MyIterator.More ())) {
|
||||
|
||||
if ( ((MyIterator.Value ())->IsDefined ()) &&
|
||||
((MyIterator.Value ())->IsActive ()) ) {
|
||||
|
||||
const Handle(Aspect_Window) AspectWindow = (MyIterator.Value ())->Window ();
|
||||
#ifndef WNT
|
||||
const Handle(Xw_Window) theWindow = *(Handle(Xw_Window) *) &AspectWindow;
|
||||
TheWindowIdOfView = int (theWindow->XWindow ());
|
||||
#else
|
||||
const Handle(WNT_Window) theWindow = *(Handle(WNT_Window) *) &AspectWindow;
|
||||
TheWindowIdOfView = int (theWindow->HWindow ());
|
||||
#endif // WNT
|
||||
// Comparision on window IDs
|
||||
if (TheWindowIdOfView == TheSpecifiedWindowId) {
|
||||
DoPick = Standard_True;
|
||||
|
||||
// Update
|
||||
apick.WsId =
|
||||
int ((MyIterator.Value ())->Identification ());
|
||||
|
||||
apick.ViewId =
|
||||
int ((MyIterator.Value ())->Identification ());
|
||||
#ifndef WNT
|
||||
apick.DefWindow.XWindow = TheSpecifiedWindowId;
|
||||
#else
|
||||
apick.DefWindow.XWindow = (HWND) TheSpecifiedWindowId;
|
||||
#endif
|
||||
|
||||
apick.x = int (AX);
|
||||
apick.y = int (AY);
|
||||
|
||||
theWindow->Size (Width, Height);
|
||||
apick.DefWindow.dx = float (Width);
|
||||
apick.DefWindow.dy = float (Height);
|
||||
|
||||
apick.Context.aperture = (float) CTX.Aperture ();
|
||||
apick.Context.order = int (CTX.Order ());
|
||||
apick.Context.depth = int (CTX.Depth ());
|
||||
|
||||
}
|
||||
} /* if ((MyIterator.Value ())->IsDefined ()) { */
|
||||
|
||||
// MyIterator.Next () is located on the next view
|
||||
MyIterator.Next ();
|
||||
}
|
||||
|
||||
if (DoPick)
|
||||
MyGraphicDriver->Pick (apick);
|
||||
else
|
||||
apick.Pick.depth = 0;
|
||||
|
||||
// Picking : return
|
||||
Standard_Integer i, j=0;
|
||||
Standard_Integer NbPick;
|
||||
|
||||
Visual3d_PickDescriptor PDes (CTX);
|
||||
Visual3d_PickPath PPat;
|
||||
|
||||
PDes.Clear ();
|
||||
NbPick = 0;
|
||||
// For i=0 it is not a graphic structure it is a view structure
|
||||
// For i=1 it is the displayed graphic structure
|
||||
// For i=2 to apick.Pick.depth-1 it is the connected graphic structures
|
||||
if (apick.Pick.depth != 0) {
|
||||
j = apick.Pick.listid[1];
|
||||
if ((Graphic3d_StructureManager::Identification (j))->
|
||||
IsSelectable ()) {
|
||||
// Maj element number
|
||||
PPat.SetElementNumber (apick.Pick.listelem[1]);
|
||||
// Maj pick identifier
|
||||
PPat.SetPickIdentifier (apick.Pick.listpickid[1]);
|
||||
// Maj structure
|
||||
PPat.SetStructIdentifier
|
||||
(Graphic3d_StructureManager::Identification (j));
|
||||
// Maj PickPath
|
||||
PDes.AddPickPath (PPat);
|
||||
NbPick++;
|
||||
}
|
||||
}
|
||||
|
||||
// Not very efficient, revise (CAL 22/09/95)
|
||||
if (apick.Pick.depth > 2) {
|
||||
Handle(Graphic3d_Structure) StructCur =
|
||||
Graphic3d_StructureManager::Identification (j);
|
||||
Standard_Boolean found;
|
||||
Graphic3d_MapOfStructure Set;
|
||||
|
||||
for (i=2; i<apick.Pick.depth; i++) {
|
||||
found = Standard_False;
|
||||
j = apick.Pick.listid[i-1];
|
||||
Set.Clear ();
|
||||
StructCur->Descendants (Set);
|
||||
Graphic3d_MapIteratorOfMapOfStructure IteratorD (Set);
|
||||
|
||||
j = apick.Pick.listid[i];
|
||||
while (IteratorD.More () && !found) {
|
||||
StructCur = IteratorD.Key ();
|
||||
if (StructCur->Identification () == j ) {
|
||||
found = Standard_True;
|
||||
// Maj element number
|
||||
PPat.SetElementNumber (apick.Pick.listelem[i]);
|
||||
// Maj pick identifier
|
||||
PPat.SetPickIdentifier (apick.Pick.listpickid[i]);
|
||||
// Maj structure
|
||||
PPat.SetStructIdentifier (StructCur);
|
||||
// Maj PickPath
|
||||
PDes.AddPickPath (PPat);
|
||||
NbPick++;
|
||||
}
|
||||
// IteratorD.Next () is located on the next structure
|
||||
IteratorD.Next ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apick.Pick.depth = int (NbPick);
|
||||
|
||||
MyGraphicDriver->InitPick ();
|
||||
|
||||
return (PDes);
|
||||
|
||||
}
|
||||
|
||||
Standard_Boolean Visual3d_ViewManager::ViewExists (const Handle(Aspect_Window)& AWindow, Graphic3d_CView& TheCView) const {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user