1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

0024070: OpenGL capped object-level clipping planes

Graphical clipping:
- Use "Graphic3d_ClipPlane" to defined clipping for PrsMgr_PresentableObject (local clipping), for V3d_View (global clipping).

Get rid of old implementations:
- Remove Visual3d_ClipPlane.
- Port V3d_Plane to Graphic3d_ClipPlane core.

Selection Sensitives:
- Port "Matches" method to add full set of arguments (SelectBasics_PickArgs), including min-max depth coming from selector.
- Get rid of transient data for pair Matches -> ComputeDepth.
- Extend SelectMgr_ViewerSelector::LoadResult to work with local clipping, add virtual callbacks to compute globa/local depth clipping for picking.

Capping rendering algorithm:
- Recursive rendering algorithm for OpenGl_Groups.
- Introduced Rendering filter for groups.

Clipping plane management in TKOpenGl:
- Added OpenGl_ClippingState to OpenGl_Context.

DRAWEXE commands:
- Ported "vclipplane" command for new approach.
- Added "vsettexturemode" command for changing texture details in views (enable / disable textures).

Correct DownCast syntax (compilation error)

Fix new compiler warnings

tests/bugs/vis/bug22906 migrated to the new vclipplane syntax
This commit is contained in:
apl
2013-09-19 16:58:00 +04:00
committed by bugmaster
parent 788cbaf4c4
commit 4269bd1b11
111 changed files with 4168 additions and 2293 deletions

View File

@@ -10,3 +10,5 @@ V3d_Viewer_3.cxx
V3d_Viewer_4.cxx
V3d_View_Print.cxx
V3d_View_5.cxx
V3d_Plane.hxx
V3d_Plane.cxx

View File

@@ -213,9 +213,6 @@ is
class SpotLight;
---Purpose: Services of spot light sources.
class Plane;
---Pupose: Services of any kind of clipping plane.
---------------------------------
---Category: Instantiated classes
---------------------------------

View File

@@ -1,131 +0,0 @@
-- Created on: 1992-01-17
-- Created by: GG
-- Copyright (c) 1992-1999 Matra Datavision
-- Copyright (c) 1999-2012 OPEN CASCADE SAS
--
-- The content of this file is subject to the Open CASCADE Technology Public
-- License Version 6.5 (the "License"). You may not use the content of this file
-- except in compliance with the License. Please obtain a copy of the License
-- at http://www.opencascade.org and read it completely before using this file.
--
-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
--
-- The Original Code and all software distributed under the License is
-- distributed on an "AS IS" basis, without warranty of any kind, and the
-- Initial Developer hereby disclaims all such warranties, including without
-- limitation, any warranties of merchantability, fitness for a particular
-- purpose or non-infringement. Please see the License for the specific terms
-- and conditions governing the rights and limitations under the License.
-- Modified: GG 23/11/00 Add Display(),Erase(),IsDisplayed() methods
class Plane from V3d
inherits
TShared
---Purpose: Defines the services of Plane type objects. Only
-- the creation and editing of the functions is dealt
-- with here.
-- Warning: The representation of the clipping plane must be
-- calculated by the application by means of Graphic3d.
-- Editing of this representation must be coherent with
-- respect to the position of the plane.
uses
View from V3d,
ClipPlane from Visual3d,
Structure from Graphic3d,
Parameter from Quantity,
Color from Quantity
raises
BadValue from V3d
is
--
-- The methods :
--
Create (A: Parameter = 0.0;
B: Parameter = 0.0;
C: Parameter = 1.0;
D: Parameter = 0.0
) returns mutable Plane
---Level : Public
---Purpose: Creates a clipping plane using the equation :
-- <A>*X + <B>*Y + <C>*Z + <D> = 0.0
raises BadValue from V3d;
---Purpose: Warning! raises BadValue from V3d
-- if the norm of the plane is NULL.
--------------------------------------------------------
---Category: Methods to modify the Attributs of the Plane
--------------------------------------------------------
SetPlane( me : mutable; A,B,C,D : Parameter)
---Level : Public
---Purpose: Modifies the plane equation.
raises BadValue from V3d
---Purpose: Warning! raises BadValue from V3d
-- if the norm of the plane is NULL.
-- If the norm of the plane is NULL.
is static;
Display(me: mutable; aView: View from V3d;
aColor: Color from Quantity= Quantity_NOC_GRAY)
---Level : Public
---Purpose: Display the plane representation
-- in the choosen view.
is virtual;
Erase(me: mutable) is static;
---Level: Public
---Purpose: Erase the plane representation.
---------------------------------------------------
---Category: Inquire methods
---------------------------------------------------
Plane( me ; A,B,C,D : out Parameter ) is static;
---Level : Public
---Purpose: Returns the parameters of the plane .
IsDisplayed( me ) returns Boolean from Standard is static;
---Level : Public
---Purpose: Returns TRUE when the plane representation is displayed
-----------------------------------------
---Category: Private or Protected methods
-----------------------------------------
Plane( me) returns mutable ClipPlane from Visual3d is static private ;
---Level : Internal
---Purpose: Returns the associated plane from Visual3d.
Update( me : mutable ) is static private;
---Level : Internal
---Purpose: Updates the the plane representation.
fields
MyPlane: ClipPlane from Visual3d ;
MyGraphicStructure: Structure from Graphic3d is protected;
friends
SetPlaneOn from class View from V3d ( me : mutable ),
SetPlaneOn from class View from V3d
( me : mutable ; Plane : Plane from V3d ),
SetPlaneOff from class View from V3d ( me : mutable ),
SetPlaneOff from class View from V3d
( me : mutable ; Plane : Plane from V3d )
end Plane;

215
src/V3d/V3d_Plane.cxx Executable file → Normal file
View File

@@ -1,6 +1,6 @@
// Created by: GG
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
// Copyright (c) 1999-2013 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
@@ -17,120 +17,149 @@
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
//-Version
//-Design
//-Warning
//-References
//-Language C++ 2.1
#include <V3d.hxx>
#include <V3d_Plane.ixx>
#include <V3d_BadValue.hxx>
#include <V3d_Plane.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_ArrayOfQuadrangles.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_ArrayOfQuadrangles.hxx>
#include <gp_Pln.hxx>
//-Constructors
IMPLEMENT_STANDARD_HANDLE(V3d_Plane, MMgt_TShared)
IMPLEMENT_STANDARD_RTTIEXT(V3d_Plane, MMgt_TShared)
V3d_Plane::V3d_Plane(const Standard_Real A, const Standard_Real B, const Standard_Real C, const Standard_Real D)
// =======================================================================
// function : V3d_Plane
// purpose :
// =======================================================================
V3d_Plane::V3d_Plane (const Standard_Real theA,
const Standard_Real theB,
const Standard_Real theC,
const Standard_Real theD)
: myGraphicStructure(),
myPlane (new Graphic3d_ClipPlane (gp_Pln (theA, theB, theC, theD)))
{
V3d_BadValue_Raise_if( sqrt(A*A + B*B + C*C) <= 0., "V3d_Plane::V3d_Plane, bad plane coefficients");
MyPlane = new Visual3d_ClipPlane(A,B,C,D) ;
}
//-Methods, in order
void V3d_Plane::SetPlane(const Standard_Real A, const Standard_Real B, const Standard_Real C, const Standard_Real D)
// =======================================================================
// function : V3d_Plane
// purpose :
// =======================================================================
void V3d_Plane::SetPlane (const Standard_Real theA,
const Standard_Real theB,
const Standard_Real theC,
const Standard_Real theD)
{
V3d_BadValue_Raise_if( sqrt(A*A + B*B + C*C) <= 0., "V3d_Plane::SetPlane, bad plane coefficients");
MyPlane->SetPlane(A,B,C,D) ;
if( IsDisplayed() )
myPlane->SetEquation (gp_Pln (theA, theB, theC, theD));
if (IsDisplayed())
{
Update();
}
}
void V3d_Plane::Display(const Handle(V3d_View)& aView,
const Quantity_Color& aColor)
// =======================================================================
// function : Display
// purpose :
// =======================================================================
void V3d_Plane::Display (const Handle(V3d_View)& theView,
const Quantity_Color& theColor)
{
Handle(V3d_Viewer) theViewer = aView->Viewer();
if (!MyGraphicStructure.IsNull())
MyGraphicStructure->Clear();
Handle(V3d_Viewer) aViewer = theView->Viewer();
if (!myGraphicStructure.IsNull())
{
myGraphicStructure->Clear();
}
MyGraphicStructure = new Graphic3d_Structure(theViewer->Viewer());
Handle(Graphic3d_Group) group = new Graphic3d_Group(MyGraphicStructure);
Handle(Graphic3d_AspectFillArea3d) aspect = new Graphic3d_AspectFillArea3d();
Graphic3d_MaterialAspect plastic(Graphic3d_NOM_PLASTIC);
plastic.SetColor(aColor);
plastic.SetTransparency(0.5);
aView->SetTransparency(Standard_True);
aspect->SetFrontMaterial(plastic);
aspect->SetInteriorStyle (Aspect_IS_HATCH);
aspect->SetHatchStyle (Aspect_HS_GRID_DIAGONAL_WIDE);
MyGraphicStructure->SetPrimitivesAspect(aspect);
myGraphicStructure = new Graphic3d_Structure (aViewer->Viewer());
Handle(Graphic3d_Group) aGroup = new Graphic3d_Group (myGraphicStructure);
Handle(Graphic3d_AspectFillArea3d) anAsp = new Graphic3d_AspectFillArea3d();
Graphic3d_MaterialAspect aPlastic (Graphic3d_NOM_PLASTIC);
aPlastic.SetColor (theColor);
aPlastic.SetTransparency (0.5);
theView->SetTransparency (Standard_True);
anAsp->SetFrontMaterial (aPlastic);
anAsp->SetInteriorStyle (Aspect_IS_HATCH);
anAsp->SetHatchStyle (Aspect_HS_GRID_DIAGONAL_WIDE);
myGraphicStructure->SetPrimitivesAspect (anAsp);
const Standard_ShortReal size = (Standard_ShortReal)(0.5*theViewer->DefaultViewSize());
const Standard_ShortReal offset = size/5000.F;
const Standard_ShortReal aSize = (Standard_ShortReal)(0.5*aViewer->DefaultViewSize());
const Standard_ShortReal anOffset = aSize/5000.0f;
Handle(Graphic3d_ArrayOfQuadrangles) aPrims = new Graphic3d_ArrayOfQuadrangles(4);
aPrims->AddVertex(-size,-size,offset);
aPrims->AddVertex(-size, size,offset);
aPrims->AddVertex( size, size,offset);
aPrims->AddVertex( size,-size,offset);
group->AddPrimitiveArray(aPrims);
aPrims->AddVertex (-aSize,-aSize, anOffset);
aPrims->AddVertex (-aSize, aSize, anOffset);
aPrims->AddVertex ( aSize, aSize, anOffset);
aPrims->AddVertex ( aSize,-aSize, anOffset);
aGroup->AddPrimitiveArray(aPrims);
MyGraphicStructure->Display(0);
myGraphicStructure->Display(0);
Update();
}
// =======================================================================
// function : Erase
// purpose :
// =======================================================================
void V3d_Plane::Erase()
{
if (!MyGraphicStructure.IsNull()) MyGraphicStructure->Erase();
}
void V3d_Plane::Plane(Standard_Real& A, Standard_Real& B, Standard_Real& C, Standard_Real& D) const
{
MyPlane->Plane(A,B,C,D) ;
}
Handle(Visual3d_ClipPlane) V3d_Plane::Plane()const
{
return MyPlane;
}
Standard_Boolean V3d_Plane::IsDisplayed() const
{
if( MyGraphicStructure.IsNull() ) return Standard_False;
return MyGraphicStructure->IsDisplayed();
}
void V3d_Plane::Update()
{
if( !MyGraphicStructure.IsNull() ) {
TColStd_Array2OfReal matrix(1,4,1,4);
Standard_Real A,B,C,D;
MyPlane->Plane(A,B,C,D) ;
gp_Pln plan(A,B,C,D);
gp_Trsf trsf;
trsf.SetTransformation(plan.Position());
trsf.Invert();
for (Standard_Integer i=1; i<=3; i++){
for (Standard_Integer j=1; j<=4; j++){
matrix.SetValue(i,j,trsf.Value(i,j));
}
}
matrix.SetValue(4,1,0.);
matrix.SetValue(4,2,0.);
matrix.SetValue(4,3,0.);
matrix.SetValue(4,4,1.);
MyGraphicStructure->SetTransform(matrix,Graphic3d_TOC_REPLACE);
if (!myGraphicStructure.IsNull())
{
myGraphicStructure->Erase();
}
}
// =======================================================================
// function : Plane
// purpose :
// =======================================================================
void V3d_Plane::Plane (Standard_Real& theA, Standard_Real& theB, Standard_Real& theC, Standard_Real& theD) const
{
const Graphic3d_ClipPlane::Equation& anEquation = myPlane->GetEquation();
theA = anEquation[0];
theB = anEquation[1];
theC = anEquation[2];
theD = anEquation[3];
}
// =======================================================================
// function : IsDisplayed
// purpose :
// =======================================================================
Standard_Boolean V3d_Plane::IsDisplayed() const
{
if (myGraphicStructure.IsNull())
{
return Standard_False;
}
return myGraphicStructure->IsDisplayed();
}
// =======================================================================
// function : Update
// purpose :
// =======================================================================
void V3d_Plane::Update()
{
if(!myGraphicStructure.IsNull())
{
TColStd_Array2OfReal aMatrix (1, 4, 1, 4);
Standard_Real theA, theB, theC, theD;
this->Plane(theA, theB, theC, theD);
gp_Pln aGeomPln (theA, theB, theC, theD);
gp_Trsf aTransform;
aTransform.SetTransformation (aGeomPln.Position());
aTransform.Invert();
for (Standard_Integer i = 1; i <= 3; i++)
{
for (Standard_Integer j = 1; j <= 4; j++)
{
aMatrix.SetValue (i, j, aTransform.Value (i,j));
}
}
aMatrix.SetValue (4,1,0.);
aMatrix.SetValue (4,2,0.);
aMatrix.SetValue (4,3,0.);
aMatrix.SetValue (4,4,1.);
myGraphicStructure->SetTransform (aMatrix, Graphic3d_TOC_REPLACE);
}
}

105
src/V3d/V3d_Plane.hxx Normal file
View File

@@ -0,0 +1,105 @@
// Created by: GG
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2013 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef _V3d_Plane_H__
#define _V3d_Plane_H__
#include <Graphic3d_ClipPlane.hxx>
#include <Graphic3d_Structure.hxx>
#include <V3d_View.hxx>
DEFINE_STANDARD_HANDLE (V3d_Plane, MMgt_TShared)
//! Obsolete clip plane presentation class.
//! Ported on new core of Graphic3d_ClipPlane approach.
//! Please access Graphic3d_ClipPlane via ClipPlane() method
//! to use it for standard clipping workflow.
//! Example of use:
//! @code
//!
//! Handle(V3d_Plane) aPlane (0, 1, 0, -20);
//! Handle(V3d_View) aView;
//! aView->AddClipPlane (aPlane->ClipPlane());
//!
//! aPlane->Display (aView);
//! aPlane->SetPlane (0, 1, 0, -30);
//! aView->RemoveClipPlane (aPlane->ClipPlane());
//!
//! @endcode
//! Use interface of this class to modify plane equation synchronously
//! with clipping equation.
class V3d_Plane : public MMgt_TShared
{
public:
//! Creates a clipping plane from plane coefficients.
Standard_EXPORT V3d_Plane (const Quantity_Parameter theA = 0.0,
const Quantity_Parameter theB = 0.0,
const Quantity_Parameter theC = 1.0,
const Quantity_Parameter theD = 0.0);
//! Change plane equation.
Standard_EXPORT void SetPlane (const Quantity_Parameter theA,
const Quantity_Parameter theB,
const Quantity_Parameter theC,
const Quantity_Parameter theD);
//! Display the plane representation in the choosen view.
Standard_EXPORT virtual void Display (const Handle(V3d_View)& theView,
const Quantity_Color& theColor = Quantity_NOC_GRAY);
//! Erase the plane representation.
Standard_EXPORT void Erase();
//! Returns the parameters of the plane.
Standard_EXPORT void Plane (Quantity_Parameter& theA,
Quantity_Parameter& theB,
Quantity_Parameter& theC,
Quantity_Parameter& theD) const;
//! Returns TRUE when the plane representation is displayed <br>
Standard_EXPORT Standard_Boolean IsDisplayed() const;
//! Use this method to pass clipping plane implementation for
//! standard clipping workflow.
//! @return clipping plane implementation handle.
Standard_EXPORT const Handle(Graphic3d_ClipPlane)& ClipPlane() const
{
return myPlane;
}
private:
//! Updates the the plane representation.
Standard_EXPORT void Update();
protected:
Handle(Graphic3d_Structure) myGraphicStructure;
private:
Handle(Graphic3d_ClipPlane) myPlane; //!< clip plane implementation.
public:
DEFINE_STANDARD_RTTI(V3d_Plane)
};
#endif

View File

@@ -101,7 +101,6 @@ uses
TypeOfBackfacingModel from V3d,
Viewer from V3d,
Light from V3d,
Plane from V3d,
View from Visual3d,
ViewMapping from Visual3d,
ViewOrientation from Visual3d,
@@ -136,8 +135,9 @@ uses
FontAspect from Font,
AsciiString from TCollection,
ExtendedString from TCollection,
PrintAlgo from Aspect
PrintAlgo from Aspect,
ClipPlane_Handle from Graphic3d,
SetOfHClipPlane from Graphic3d
raises
BadValue from V3d, TypeMismatch from Standard,
@@ -392,7 +392,7 @@ is
---Level: Public
---Purpose: Deactivate all the Lights defined in this view.
IsActiveLight( me ; aLight: Light from V3d )
IsActiveLight( me ; aLight: Light from V3d )
returns Boolean from Standard;
---Level: Public
---Purpose: Returns TRUE when the light is active in this view.
@@ -401,34 +401,6 @@ is
---Level: Public
---Purpose: Activate/Deactivate the transparency in this view.
SetPlaneOn( me : mutable ; MyPlane : Plane from V3d )
---Level: Public
---Purpose: Activates the clipping plane in this view.
raises BadValue from V3d ;
---Purpose: If No More Plane can be activated in MyView .
SetPlaneOn( me : mutable )
---Level: Public
---Purpose: Activate all the clipping planes defined in
-- this view.
raises BadValue from V3d;
---Purpose: If No More Plane can be activated in MyView .
SetPlaneOff( me : mutable ; MyPlane : Plane from V3d );
---Level: Public
---Purpose: Desactivates the clipping plane defined
-- in this view.
SetPlaneOff( me : mutable );
---Level: Public
---Purpose: Deactivate all clipping planes defined
-- in this view.
IsActivePlane( me ; aPlane: Plane from V3d )
returns Boolean from Standard;
---Level: Public
---Purpose: Returns TRUE when the plane is active in this view.
SetImmediateUpdate(me: mutable; theImmediateUpdate: Boolean from Standard)
returns Boolean from Standard;
---Purpose: sets the immediate update mode and returns the previous one.
@@ -438,7 +410,7 @@ is
-- Triedron methods
---------------------------------------------------
ZBufferTriedronSetup ( me : mutable;
ZBufferTriedronSetup ( me : mutable;
XColor : NameOfColor from Quantity = Quantity_NOC_RED;
YColor : NameOfColor from Quantity = Quantity_NOC_GREEN;
ZColor : NameOfColor from Quantity = Quantity_NOC_BLUE1;
@@ -1223,27 +1195,6 @@ is
ActiveLight(me) returns mutable Light from V3d;
---Level: Advanced
IfMorePlanes( me ) returns Boolean;
---Level: Advanced
---Purpose: Returns True if One clipping plane more can be
-- activated in this View.
InitActivePlanes(me: mutable);
---Level: Advanced
---Purpose: initializes an iteration on the active Planes.
MoreActivePlanes (me) returns Boolean from Standard;
---Level: Advanced
---Purpose: returns true if there are more active Plane(s) to return.
NextActivePlanes (me: mutable);
---Level: Advanced
---Purpose : Go to the next active Plane
-- (if there is not, ActivePlane will raise an exception)
ActivePlane(me) returns mutable Plane from V3d;
---Level: Advanced
Viewer ( me ) returns mutable Viewer from V3d;
---Level: Advanced
---Purpose: Returns the viewer in which the view has been created.
@@ -1604,13 +1555,36 @@ is
---Purpose: returns the current state of the gl lighting
-- currently used in triedron displaying
AddClipPlane (me : mutable; thePlane : ClipPlane_Handle from Graphic3d) is virtual;
---Purpose: Adds clip plane to the view. The composition of clip planes truncates the
-- rendering space to convex volume. Number of supported clip planes can be consulted
-- by PlaneLimit method of associated Visual3d_View. Please be aware that the planes
-- which exceed the limit are igonred during rendering.
-- @param thePlane [in] the clip plane to be added to view.
RemoveClipPlane (me : mutable; thePlane : ClipPlane_Handle from Graphic3d) is virtual;
---Purpose: Removes clip plane from the view.
-- @param thePlane [in] the clip plane to be removed from view.
SetClipPlanes (me : mutable; thePlanes : SetOfHClipPlane from Graphic3d);
---Purpose: Set clip planes to the view. The planes that have been set
-- before are removed from the view. The composition of clip planes
-- truncates the rendering space to convex volume. Number of supported
-- clip planes can be consulted by PlaneLimit method of associated
-- Visual3d_View. Please be aware that the planes which exceed the limit
-- are igonred during rendering.
-- @param thePlanes [in] the clip planes to set.
GetClipPlanes (me) returns SetOfHClipPlane from Graphic3d;
---C++: return const&
---Purpose: Get clip planes.
-- @return sequence clip planes that have been set for the view
fields
MyType : TypeOfView from V3d is protected ;
MyViewer : ViewerPointer from V3d ;
MyActiveLights: ListOfTransient from V3d;
MyActivePlanes: ListOfTransient from V3d;
MyView : View from Visual3d is protected ;
MyViewMapping : ViewMapping from Visual3d is protected ;
@@ -1626,7 +1600,6 @@ fields
MyPlotter: Plotter from Graphic3d;
myActiveLightsIterator: ListIteratorOfListOfTransient from TColStd;
myActivePlanesIterator: ListIteratorOfListOfTransient from TColStd;
sx,sy: Integer from Standard;
rx,ry: Real from Standard;

View File

@@ -144,7 +144,6 @@ To solve the problem (for lack of a better solution) I make 2 passes.
#include <Standard_TypeMismatch.hxx>
#include <Visual3d_ViewManager.hxx>
#include <Visual3d_Light.hxx>
#include <Visual3d_ClipPlane.hxx>
#include <Graphic3d_Structure.hxx>
#include <Graphic3d_MapIteratorOfMapOfStructure.hxx>
#include <Graphic3d_MapOfStructure.hxx>
@@ -269,10 +268,8 @@ V3d_View::V3d_View(const Handle(V3d_Viewer)& VM, const V3d_TypeOfView Type ) :
MyType ( Type ),
MyViewer(VM.operator->()),
MyActiveLights(),
MyActivePlanes(),
MyViewContext (),
myActiveLightsIterator(),
myActivePlanesIterator(),
SwitchSetFront(Standard_False),
MyTrsf (1, 4, 1, 4), // S3892
MyProjModel(V3d_TPM_SCREEN)
@@ -372,10 +369,8 @@ V3d_View::V3d_View(const Handle(V3d_Viewer)& VM,const Handle(V3d_View)& V, const
MyType ( Type ),
MyViewer(VM.operator->()),
MyActiveLights(),
MyActivePlanes(),
MyViewContext (),
myActiveLightsIterator(),
myActivePlanesIterator(),
SwitchSetFront(Standard_False),
MyTrsf (1, 4, 1, 4), // S3892
MyProjModel(V3d_TPM_SCREEN)
@@ -387,8 +382,6 @@ MyProjModel(V3d_TPM_SCREEN)
for (V->InitActiveLights();V->MoreActiveLights();V->NextActiveLights()){
MyActiveLights.Append(V->ActiveLight());}
for (V->InitActivePlanes();V->MoreActivePlanes();V->NextActivePlanes()){
MyActivePlanes.Append(V->ActivePlane());}
MyViewContext = FromView->Context() ;

View File

@@ -44,7 +44,6 @@
#include <V3d_View.jxx>
#include <Visual3d_View.hxx>
#include <Visual3d_Light.hxx>
#include <Visual3d_ClipPlane.hxx>
#include <V3d_Static.hxx>
#include <V3d.hxx>
@@ -119,70 +118,6 @@ Standard_Boolean V3d_View::Transparency() const {
return MyTransparencyFlag;
}
void V3d_View::SetPlaneOn( const Handle(V3d_Plane)& ThePlane ) {
#ifdef GER61454
if( !MyActivePlanes.Contains(ThePlane)) {
V3d_BadValue_Raise_if( MyActivePlanes.Extent() >= MyView->PlaneLimit(), "too many planes");
MyActivePlanes.Append(ThePlane) ;
}
MyViewContext.SetClipPlaneOn(ThePlane->Plane()) ;
MyView->SetContext(MyViewContext);
#else //GER61454
if( !MyActivePlanes.Contains(ThePlane)) {
V3d_BadValue_Raise_if( MyActivePlanes.Extent() >= Visual3d_ClipPlane::Limit(), "too many planes");
MyActivePlanes.Append(ThePlane) ;
MyViewContext.SetClipPlaneOn(ThePlane->Plane()) ;
MyView->SetContext(MyViewContext);
}
#endif //GER61454
}
void V3d_View::SetPlaneOff( const Handle(V3d_Plane)& ThePlane ) {
MyActivePlanes.Remove(ThePlane);
MyViewContext.SetClipPlaneOff(ThePlane->Plane()) ;
MyView->SetContext(MyViewContext) ;
}
Standard_Boolean V3d_View::IsActivePlane(const Handle(V3d_Plane)& aPlane) const {
if( aPlane.IsNull() ) return Standard_False;
return MyActivePlanes.Contains(aPlane);
}
void V3d_View::SetPlaneOn( ) {
#ifdef GER61454
for(MyViewer->InitDefinedPlanes();MyViewer->MoreDefinedPlanes();MyViewer->NextDefinedPlanes()) {
if(!MyActivePlanes.Contains(MyViewer->DefinedPlane())) {
V3d_BadValue_Raise_if( MyActivePlanes.Extent() >= MyView->PlaneLimit(), "too many planes");
MyActivePlanes.Append(MyViewer->DefinedPlane());
}
MyViewContext.SetClipPlaneOn(MyViewer->DefinedPlane()->Plane());
}
MyView->SetContext(MyViewContext) ;
#else //GER61454
for(MyViewer->InitDefinedPlanes();MyViewer->MoreDefinedPlanes();MyViewer->NextDefinedPlanes()) {
if(!MyActivePlanes.Contains(MyViewer->DefinedPlane())) {
V3d_BadValue_Raise_if( MyActivePlanes.Extent() >= Visual3d_ClipPlane::Limit(),
"too many planes");
MyActivePlanes.Append(MyViewer->DefinedPlane());
MyViewContext.SetClipPlaneOn(MyViewer->DefinedPlane()->Plane());
MyView->SetContext(MyViewContext) ;
}
}
#endif //GER61454
}
void V3d_View::SetPlaneOff( ) {
for(InitActivePlanes();MoreActivePlanes();NextActivePlanes()) {
MyViewContext.SetClipPlaneOff(ActivePlane()->Plane());}
MyActivePlanes.Clear();
MyView->SetContext(MyViewContext) ;
}
void V3d_View::InitActiveLights() {
myActiveLightsIterator.Initialize(MyActiveLights);
}
@@ -195,30 +130,6 @@ void V3d_View::NextActiveLights () {
Handle(V3d_Light) V3d_View::ActiveLight() const {
return (Handle(V3d_Light)&)(myActiveLightsIterator.Value());}
void V3d_View::InitActivePlanes() {
myActivePlanesIterator.Initialize(MyActivePlanes);
}
Standard_Boolean V3d_View::MoreActivePlanes () const {
return myActivePlanesIterator.More();
}
void V3d_View::NextActivePlanes () {
myActivePlanesIterator.Next();
}
Handle(V3d_Plane) V3d_View::ActivePlane() const {
return (Handle(V3d_Plane)&)(myActivePlanesIterator.Value());}
Standard_Boolean V3d_View::IfMorePlanes() const {
#ifdef GER61454
return MyActivePlanes.Extent() < MyView->PlaneLimit();
#else
return MyActivePlanes.Extent() < Visual3d_ClipPlane::Limit();
#endif
}
Standard_Boolean V3d_View::IfMoreLights() const {
#ifdef GER61454
@@ -228,3 +139,50 @@ Standard_Boolean V3d_View::IfMoreLights() const {
return MyActiveLights.Extent();
#endif
}
//=======================================================================
//function : AddClipPlane
//purpose :
//=======================================================================
void V3d_View::AddClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane)
{
Graphic3d_SetOfHClipPlane aCurrPlanes = MyViewContext.GetClipPlanes();
if (!aCurrPlanes.Add (thePlane))
return;
MyViewContext.SetClipPlanes (aCurrPlanes);
MyView->SetContext (MyViewContext) ;
}
//=======================================================================
//function : RemoveClipPlane
//purpose :
//=======================================================================
void V3d_View::RemoveClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane)
{
Graphic3d_SetOfHClipPlane aCurrPlanes = MyViewContext.GetClipPlanes();
if (!aCurrPlanes.Remove (thePlane))
return;
MyViewContext.SetClipPlanes (aCurrPlanes);
MyView->SetContext (MyViewContext) ;
}
//=======================================================================
//function : SetClipPlanes
//purpose :
//=======================================================================
void V3d_View::SetClipPlanes (const Graphic3d_SetOfHClipPlane& thePlanes)
{
MyViewContext.SetClipPlanes (thePlanes);
MyView->SetContext (MyViewContext) ;
}
//=======================================================================
//function : GetClipPlanes
//purpose :
//=======================================================================
const Graphic3d_SetOfHClipPlane& V3d_View::GetClipPlanes() const
{
return MyViewContext.GetClipPlanes();
}

View File

@@ -51,7 +51,6 @@ uses
TypeOfOrientation from V3d,
View from V3d,
Light from V3d,
Plane from V3d,
ListOfTransient from V3d,
ListIteratorOfListOfTransient from TColStd,
SequenceOfInteger from TColStd,
@@ -431,28 +430,6 @@ is
DefinedLight(me) returns Light from V3d;
---Level: Advanced
AddPlane( me: mutable; MyPlane : Plane from V3d);
---Purpose: Adds Plane in Sequence Of Planes.
DelPlane( me: mutable; MyPlane : Plane from V3d);
---Purpose: Delete Plane in Sequence Of Planes.
InitDefinedPlanes(me: mutable);
---Level: Advanced
---Purpose: initializes an iteration on the Defined Planes.
MoreDefinedPlanes (me) returns Boolean from Standard;
---Level: Advanced
---Purpose: returns true if there are more Defined Plane(s) to return.
NextDefinedPlanes (me: mutable);
---Level: Advanced
---Purpose : Go to the next Defined Plane
-- (if there is not, DefinedPlane will raise an exception)
DefinedPlane(me) returns Plane from V3d;
---Level: Advanced
Viewer (me) returns mutable ViewManager ;
---Level: Advanced
---Purpose: Returns the viewer associated to Visual3d .
@@ -714,7 +691,6 @@ fields
MyActiveViews: ListOfTransient from V3d;
MyDefinedLights: ListOfTransient from V3d;
MyActiveLights: ListOfTransient from V3d;
MyDefinedPlanes: ListOfTransient from V3d;
MyBackground: Background from Aspect ;
MyGradientBackground: GradientBackground from Aspect ;
MyViewSize: Real ;
@@ -731,7 +707,6 @@ fields
myDefinedViewsIterator: ListIteratorOfListOfTransient from TColStd;
myActiveLightsIterator: ListIteratorOfListOfTransient from TColStd;
myDefinedLightsIterator: ListIteratorOfListOfTransient from TColStd;
myDefinedPlanesIterator: ListIteratorOfListOfTransient from TColStd;
myComputedMode: Boolean from Standard;
myDefaultComputedMode: Boolean from Standard;
myPrivilegedPlane: Ax3 from gp;
@@ -751,6 +726,5 @@ friends
class View from V3d,
class Light from V3d,
class Plane from V3d,
SetPlane from package V3d (aViewer: Viewer from V3d; x1,y1,z1,x2,y2,z2: Length from Quantity)
end Viewer;

View File

@@ -73,12 +73,10 @@ MyDefinedViews(),
MyActiveViews(),
MyDefinedLights(),
MyActiveLights(),
MyDefinedPlanes(),
myActiveViewsIterator(),
myDefinedViewsIterator(),
myActiveLightsIterator(),
myDefinedLightsIterator(),
myDefinedPlanesIterator(),
myComputedMode (theComputedMode),
myDefaultComputedMode (theDefaultComputedMode),
myPrivilegedPlane (gp_Ax3 (gp_Pnt (0.,0.,0), gp_Dir (0.,0.,1.), gp_Dir (1.,0.,0.))),
@@ -369,16 +367,6 @@ void V3d_Viewer::DelView( const Handle(V3d_View)& TheView ) {
MyDefinedViews.Remove(TheView);
}
void V3d_Viewer::AddPlane( const Handle(V3d_Plane)& ThePlane ) {
MyDefinedPlanes.Append(ThePlane) ;
}
void V3d_Viewer::DelPlane( const Handle(V3d_Plane)& ThePlane ) {
MyDefinedPlanes.Remove(ThePlane);
}
//=======================================================================
//function : AddZLayer
//purpose :

View File

@@ -70,16 +70,3 @@ void V3d_Viewer::NextDefinedLights () {
}
Handle(V3d_Light) V3d_Viewer::DefinedLight() const {
return (Handle(V3d_Light)&)(myDefinedLightsIterator.Value());}
void V3d_Viewer::InitDefinedPlanes() {
myDefinedPlanesIterator.Initialize(MyDefinedPlanes);
}
Standard_Boolean V3d_Viewer::MoreDefinedPlanes () const {
return myDefinedPlanesIterator.More();
}
void V3d_Viewer::NextDefinedPlanes () {
myDefinedPlanesIterator.Next();
}
Handle(V3d_Plane) V3d_Viewer::DefinedPlane() const {
return (Handle(V3d_Plane)&)(myDefinedPlanesIterator.Value());}