增加OCCT库并增加OpenGL ES的OCCT渲染实现

This commit is contained in:
JackLee 2026-02-18 21:49:58 +08:00
parent 9f5ba8d068
commit 3637555a87
7347 changed files with 675372 additions and 1214 deletions

View File

@ -11,7 +11,6 @@
"arguments": "",
"cppFlags": "",
"abiFilters": [
"arm64-v8a",
"x86_64"
]
}

View File

@ -6,13 +6,13 @@
"lockfileVersion": 3,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"libentry.so@src/main/cpp/types/libentry": "libentry.so@src/main/cpp/types/libentry"
"libocct.so@src/main/cpp/types/libocct": "libocct.so@src/main/cpp/types/libocct"
},
"packages": {
"libentry.so@src/main/cpp/types/libentry": {
"name": "libentry.so",
"libocct.so@src/main/cpp/types/libocct": {
"name": "libocct.so",
"version": "1.0.0",
"resolved": "src/main/cpp/types/libentry",
"resolved": "src/main/cpp/types/libocct",
"registryType": "local"
}
}

View File

@ -6,6 +6,6 @@
"author": "",
"license": "",
"dependencies": {
"libentry.so": "file:./src/main/cpp/types/libentry"
"libocct.so": "file:./src/main/cpp/types/libocct"
}
}

View File

@ -0,0 +1,84 @@
// Created on: 1996-12-11
// Created by: Robert COUBLANC
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_HeaderFile
#define _AIS_HeaderFile
#include "Prs3d_Presentation.hxx"
#include "Standard.hxx"
#include "Standard_DefineAlloc.hxx"
//! Application Interactive Services provide the means to create links between an application GUI
//! viewer and the packages which are used to manage selection and presentation. The tools AIS
//! defined in order to do this include different sorts of entities: both the selectable viewable
//! objects themselves and the context and attribute managers to define their selection and display.
//! To orient the user as he works in a modeling environment, views and selections must be
//! comprehensible. There must be several different sorts of selectable and viewable object defined.
//! These must also be interactive, that is, connecting graphic representation and the underlying
//! reference geometry. These entities are called Interactive Objects, and are divided into four
//! types:
//! - the Datum
//! - the Relation
//! - the Object
//! - None.
//! The Datum groups together the construction elements such as lines, circles, points, trihedra,
//! plane trihedra, planes and axes. The Relation is made up of constraints on one or more
//! interactive shapes and the corresponding reference geometry. For example, you might want to
//! constrain two edges in a parallel relation. This constraint is considered as an object in its
//! own right, and is shown as a sensitive primitive. This takes the graphic form of a perpendicular
//! arrow marked with the || symbol and lying between the two edges. The Object type includes
//! topological shapes, and connections between shapes. None, in order not to eliminate the object,
//! tells the application to look further until it finds an object definition in its generation
//! which is accepted. Inside these categories, you have the possibility of an additional
//! characterization by means of a signature. The signature provides an index to the further
//! characterization. By default, the Interactive Object has a None type and a signature of 0
//! (equivalent to None.) If you want to give a particular type and signature to your interactive
//! object, you must redefine the two virtual methods: Type and Signature. In the C++ inheritance
//! structure of the package, each class representing a specific Interactive Object inherits
//! AIS_InteractiveObject. Among these inheriting classes, AIS_Relation functions as the abstract
//! mother class for tinheriting classes defining display of specific relational constraints and
//! types of dimension. Some of these include:
//! - display of constraints based on relations of symmetry, tangency, parallelism and
//! concentricity
//! - display of dimensions for angles, offsets, diameters, radii and chamfers.
//! No viewer can show everything at once with any coherence or clarity.
//! Views must be managed carefully both sequentially and at any given instant.
//! Another function of the view is that of a context to carry out design in.
//! The design changes are applied to the objects in the view and then extended to the underlying
//! reference geometry by a solver. To make sense of this complicated visual data, several display
//! and selection tools are required. To facilitate management, each object and each construction
//! element has a selection priority. There are also means to modify the default priority. To define
//! an environment of dynamic detection, you can use standard filter classes or create your own. A
//! filter questions the owner of the sensitive primitive to determine if it has the desired
//! qualities. If it answers positively, it is kept. If not, it is rejected. The standard filters
//! supplied in AIS include:
//! - AIS_AttributeFilter
//! - AIS_SignatureFilter
//! - AIS_TypeFilter.
//! A set of functions allows you to choose the interactive objects which you want to act on, the
//! selection modes which you want to activate. An interactive object can have a certain number of
//! graphic attributes which are specific to it, such as visualization mode, color, and material. By
//! the same token, the interactive context has a set of graphic attributes, the Drawer which is
//! valid by default for the objects it controls. When an interactive object is visualized, the
//! required graphic attributes are first taken from the object's own Drawer if one exists, or from
//! the context drawer for the others.
class AIS
{
public:
DEFINE_STANDARD_ALLOC
};
#endif // _AIS_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_AngleDimension_HeaderFile
#define _AIS_AngleDimension_HeaderFile
#include "PrsDim_AngleDimension.hxx"
Standard_DEPRECATED("Deprecated alias to moved class")
typedef PrsDim_AngleDimension AIS_AngleDimension;
#endif // _AIS_AngleDimension_HeaderFile

View File

@ -0,0 +1,219 @@
// Created by: Anastasia BORISOVA
// Copyright (c) 2016 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_Animation_HeaderFile
#define _AIS_Animation_HeaderFile
#include "AIS_AnimationTimer.hxx"
#include "NCollection_Sequence.hxx"
#include "TCollection_AsciiString.hxx"
//! Structure defining current animation progress.
struct AIS_AnimationProgress
{
Standard_Real Pts; //!< global presentation timestamp
Standard_Real LocalPts; //!< presentation within current animation
// clang-format off
Standard_Real LocalNormalized; //!< normalized position within current animation within 0..1 range
// clang-format on
AIS_AnimationProgress()
: Pts(-1.0),
LocalPts(-1.0),
LocalNormalized(-1.0)
{
}
};
DEFINE_STANDARD_HANDLE(AIS_Animation, Standard_Transient)
//! Class represents a basic animation class.
//! AIS_Animation can be used as:
//!
//! - Animation Implementor
//! Sub-classes should override method AIS_Animation::update() to perform specific animation.
//! AIS package provides limited number of such animation atoms - classes AIS_AnimationObject and
//! AIS_AnimationCamera, which could be enough for defining a simple animation. In general case,
//! application is expected defining own AIS_Animation sub-classes implementing
//! application-specific animation logic (e.g. another interpolation or another kind of
//! transformations - like color transition and others). The basic conception of
//! AIS_Animation::update() is defining an exact scene state for the current presentation
//! timestamp, providing a smooth and continuous animation well defined at any time step and in
//! any direction. So that a time difference between two sequential drawn Viewer frames can vary
//! from frame to frame without visual artifacts, increasing rendering framerate would not lead to
//! animation being executed too fast and low framerate (on slow hardware) would not lead to
//! animation played longer than defined duration. Hence, implementation should avoid usage of
//! incremental step logic or should apply it very carefully.
//!
//! - Animation Container
//! AIS_Animation (no sub-classing) can be used to aggregate a sequence of Animation items
//! (children). Each children should be defined with its own duration and start time (presentation
//! timestamp). It is possible defining collection of nested AIS_Animation items, so that within
//! each container level children define start playback time relative to its holder.
//!
//! - Animation playback Controller
//! It is suggested that application would define a single AIS_Animation instance (optional
//! sub-classing) for controlling animation playback as whole. Such controller should be filled in
//! by other AIS_Animation as children objects, and will be managed by application by calling
//! StartTimer(), UpdateTimer() and IsStopped() methods.
//!
//! Note, that AIS_Animation::StartTimer() defines a timer calculating an elapsed time, not a
//! multimedia timer executing Viewer updates at specific intervals! Application should avoid using
//! implicit and immediate Viewer updates to ensure that AIS_Animation::UpdateTimer() is called
//! before each redrawing of a Viewer content. Redrawing logic should be also managed at application
//! level for managing a smooth animation (by defining a multimedia timer provided by used GUI
//! framework executing updates at desired framerate, or as continuous redraws in loop).
class AIS_Animation : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(AIS_Animation, Standard_Transient)
public:
//! Creates empty animation.
Standard_EXPORT AIS_Animation(const TCollection_AsciiString& theAnimationName);
//! Destruct object, clear arguments
Standard_EXPORT virtual ~AIS_Animation();
//! Animation name.
const TCollection_AsciiString& Name() const { return myName; }
public:
//! @return start time of the animation in the timeline
Standard_Real StartPts() const { return myPtsStart; }
//! Sets time limits for animation in the animation timeline
void SetStartPts(const Standard_Real thePtsStart) { myPtsStart = thePtsStart; }
//! @return duration of the animation in the timeline
Standard_Real Duration() const { return Max(myOwnDuration, myChildrenDuration); }
//! Update total duration considering all animations on timeline.
Standard_EXPORT void UpdateTotalDuration();
//! Return true if duration is defined.
Standard_Boolean HasOwnDuration() const { return myOwnDuration > 0.0; }
//! @return own duration of the animation in the timeline
Standard_Real OwnDuration() const { return myOwnDuration; }
//! Defines duration of the animation.
void SetOwnDuration(const Standard_Real theDuration) { myOwnDuration = theDuration; }
//! Add single animation to the timeline.
//! @param theAnimation input animation
Standard_EXPORT void Add(const Handle(AIS_Animation)& theAnimation);
//! Clear animation timeline - remove all animations from it.
Standard_EXPORT void Clear();
//! Return the child animation with the given name.
Standard_EXPORT Handle(AIS_Animation) Find(const TCollection_AsciiString& theAnimationName) const;
//! Remove the child animation.
Standard_EXPORT Standard_Boolean Remove(const Handle(AIS_Animation)& theAnimation);
//! Replace the child animation.
Standard_EXPORT Standard_Boolean Replace(const Handle(AIS_Animation)& theAnimationOld,
const Handle(AIS_Animation)& theAnimationNew);
//! Clears own children and then copy child animations from another object.
//! Copy also Start Time and Duration values.
Standard_EXPORT void CopyFrom(const Handle(AIS_Animation)& theOther);
//! Return sequence of child animations.
const NCollection_Sequence<Handle(AIS_Animation)>& Children() const { return myAnimations; }
public:
//! Start animation with internally defined timer instance.
//! Calls ::Start() internally.
//!
//! Note, that this method initializes a timer calculating an elapsed time (presentation
//! timestamps within AIS_Animation::UpdateTimer()), not a multimedia timer executing Viewer
//! updates at specific intervals! Viewer redrawing should be managed at application level, so
//! that AIS_Animation::UpdateTimer() is called once right before each redrawing of a Viewer
//! content.
//!
//! @param theStartPts starting timer position (presentation timestamp)
//! @param thePlaySpeed playback speed (1.0 means normal speed)
//! @param theToUpdate flag to update defined animations to specified start position
//! @param theToStopTimer flag to pause timer at the starting position
Standard_EXPORT virtual void StartTimer(const Standard_Real theStartPts,
const Standard_Real thePlaySpeed,
const Standard_Boolean theToUpdate,
const Standard_Boolean theToStopTimer = Standard_False);
//! Update single frame of animation, update timer state
//! @return current time of timeline progress.
Standard_EXPORT virtual Standard_Real UpdateTimer();
//! Return elapsed time.
Standard_Real ElapsedTime() const { return !myTimer.IsNull() ? myTimer->ElapsedTime() : 0.0; }
//! Return playback timer.
const Handle(Media_Timer)& Timer() const { return myTimer; }
//! Set playback timer.
void SetTimer(const Handle(Media_Timer)& theTimer) { myTimer = theTimer; }
public:
//! Start animation. This method changes status of the animation to Started.
//! This status defines whether animation is to be performed in the timeline or not.
//! @param theToUpdate call Update() method
Standard_EXPORT virtual void Start(const Standard_Boolean theToUpdate);
//! Pause the process timeline.
Standard_EXPORT virtual void Pause();
//! Stop animation. This method changed status of the animation to Stopped.
//! This status shows that animation will not be performed in the timeline or it is finished.
Standard_EXPORT virtual void Stop();
//! Check if animation is to be performed in the animation timeline.
//! @return True if it is stopped of finished.
bool IsStopped() { return myState != AnimationState_Started; }
//! Update single frame of animation, update timer state
//! @param[in] thePts the time moment within [0; Duration()]
//! @return True if timeline is in progress
Standard_EXPORT virtual Standard_Boolean Update(const Standard_Real thePts);
protected:
//! Process one step of the animation according to the input time progress, including all
//! children. Calls also ::update() to update own animation.
Standard_EXPORT virtual void updateWithChildren(const AIS_AnimationProgress& thePosition);
//! Update the own animation to specified position - should be overridden by sub-class.
virtual void update(const AIS_AnimationProgress& theProgress) { (void)theProgress; }
protected:
//! Defines animation state.
enum AnimationState
{
AnimationState_Started, //!< animation is in progress
AnimationState_Stopped, //!< animation is finished, force stopped or not started
AnimationState_Paused //!< animation is paused and can be started from the pause moment
};
protected:
Handle(Media_Timer) myTimer;
TCollection_AsciiString myName; //!< animation name
NCollection_Sequence<Handle(AIS_Animation)> myAnimations; //!< sequence of child animations
AnimationState myState; //!< animation state - started, stopped of paused
Standard_Real myPtsStart; //!< time of start in the timeline
Standard_Real myOwnDuration; //!< duration of animation excluding children
Standard_Real myChildrenDuration; //!< duration of animation including children
};
#endif // _AIS_Animation_HeaderFile

View File

@ -0,0 +1,49 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_AnimationAxisRotation_HeaderFile
#define _AIS_AnimationAxisRotation_HeaderFile
#include "AIS_BaseAnimationObject.hxx"
#include "gp_TrsfNLerp.hxx"
//! Animation defining object transformation.
class AIS_AnimationAxisRotation : public AIS_BaseAnimationObject
{
DEFINE_STANDARD_RTTIEXT(AIS_AnimationAxisRotation, AIS_BaseAnimationObject)
public:
//! Constructor with initialization.
//! @param[in] theAnimationName animation identifier
//! @param[in] theContext interactive context where object have been displayed
//! @param[in] theObject object to apply rotation
//! @param[in] theAxis rotation axis
//! @param[in] theAngleStart rotation angle at the start of animation
//! @param[in] theAngleEnd rotation angle at the end of animation
Standard_EXPORT AIS_AnimationAxisRotation(const TCollection_AsciiString& theAnimationName,
const Handle(AIS_InteractiveContext)& theContext,
const Handle(AIS_InteractiveObject)& theObject,
const gp_Ax1& theAxis,
const Standard_Real theAngleStart,
const Standard_Real theAngleEnd);
protected:
//! Update the progress.
Standard_EXPORT virtual void update(const AIS_AnimationProgress& theProgress) Standard_OVERRIDE;
private:
gp_Ax1 myRotAxis; //!< rotation axis
Standard_Real myAngleStart; //!< start angle for rotation
Standard_Real myAngleEnd; //!< end angle for rotation
};
#endif // _AIS_AnimationAxisRotation_HeaderFile

View File

@ -0,0 +1,65 @@
// Created by: Anastasia BORISOVA
// Copyright (c) 2016 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_AnimationCamera_HeaderFile
#define _AIS_AnimationCamera_HeaderFile
#include "AIS_Animation.hxx"
class Graphic3d_Camera;
class V3d_View;
//! Camera animation.
class AIS_AnimationCamera : public AIS_Animation
{
DEFINE_STANDARD_RTTIEXT(AIS_AnimationCamera, AIS_Animation)
public:
//! Main constructor.
Standard_EXPORT AIS_AnimationCamera(const TCollection_AsciiString& theAnimationName,
const Handle(V3d_View)& theView);
//! Return the target view.
const Handle(V3d_View)& View() const { return myView; }
//! Set target view.
void SetView(const Handle(V3d_View)& theView) { myView = theView; }
//! Return camera start position.
const Handle(Graphic3d_Camera)& CameraStart() const { return myCamStart; }
//! Define camera start position.
void SetCameraStart(const Handle(Graphic3d_Camera)& theCameraStart)
{
myCamStart = theCameraStart;
}
//! Return camera end position.
const Handle(Graphic3d_Camera)& CameraEnd() const { return myCamEnd; }
//! Define camera end position.
void SetCameraEnd(const Handle(Graphic3d_Camera)& theCameraEnd) { myCamEnd = theCameraEnd; }
protected:
//! Update the progress.
Standard_EXPORT virtual void update(const AIS_AnimationProgress& theProgress) Standard_OVERRIDE;
protected:
Handle(V3d_View) myView; //!< view to setup camera
Handle(Graphic3d_Camera) myCamStart; //!< starting camera position
Handle(Graphic3d_Camera) myCamEnd; //!< end camera position
};
DEFINE_STANDARD_HANDLE(AIS_AnimationCamera, AIS_Animation)
#endif // _AIS_AnimationCamera_HeaderFile

View File

@ -0,0 +1,49 @@
// Created by: Anastasia BORISOVA
// Copyright (c) 2016 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_AnimationObject_HeaderFile
#define _AIS_AnimationObject_HeaderFile
#include "AIS_BaseAnimationObject.hxx"
#include "gp_TrsfNLerp.hxx"
//! Animation defining object transformation.
class AIS_AnimationObject : public AIS_BaseAnimationObject
{
DEFINE_STANDARD_RTTIEXT(AIS_AnimationObject, AIS_BaseAnimationObject)
public:
//! Constructor with initialization.
//! Note that start/end transformations specify exactly local transformation of the object,
//! not the transformation to be applied to existing local transformation.
//! @param[in] theAnimationName animation identifier
//! @param[in] theContext interactive context where object have been displayed
//! @param[in] theObject object to apply local transformation
//! @param[in] theTrsfStart local transformation at the start of animation (e.g.
//! theObject->LocalTransformation())
//! @param[in] theTrsfEnd local transformation at the end of animation
Standard_EXPORT AIS_AnimationObject(const TCollection_AsciiString& theAnimationName,
const Handle(AIS_InteractiveContext)& theContext,
const Handle(AIS_InteractiveObject)& theObject,
const gp_Trsf& theTrsfStart,
const gp_Trsf& theTrsfEnd);
protected:
//! Update the progress.
Standard_EXPORT virtual void update(const AIS_AnimationProgress& theProgress) Standard_OVERRIDE;
private:
gp_TrsfNLerp myTrsfLerp; //!< interpolation tool
};
#endif // _AIS_AnimationObject_HeaderFile

View File

@ -0,0 +1,21 @@
// Created by: Kirill Gavrilov
// Copyright (c) 2016 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_AnimationTimer_HeaderFile
#define _AIS_AnimationTimer_HeaderFile
#include "Media_Timer.hxx"
typedef Media_Timer AIS_AnimationTimer;
#endif // _AIS_AnimationTimer_HeaderFile

View File

@ -0,0 +1,106 @@
// Created on: 1997-03-04
// Created by: Robert COUBLANC
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_AttributeFilter_HeaderFile
#define _AIS_AttributeFilter_HeaderFile
#include "Standard.hxx"
#include "Standard_Type.hxx"
#include "Quantity_NameOfColor.hxx"
#include "Standard_Real.hxx"
#include "SelectMgr_Filter.hxx"
class SelectMgr_EntityOwner;
class AIS_AttributeFilter;
DEFINE_STANDARD_HANDLE(AIS_AttributeFilter, SelectMgr_Filter)
//! Selects Interactive Objects, which have the desired width or color.
//! The filter questions each Interactive Object in local
//! context to determine whether it has an non-null
//! owner, and if so, whether it has the required color
//! and width attributes. If the object returns true in each
//! case, it is kept. If not, it is rejected.
//! This filter is used only in an open local context.
//! In the Collector viewer, you can only locate
//! Interactive Objects, which answer positively to the
//! filters, which are in position when a local context is open.
class AIS_AttributeFilter : public SelectMgr_Filter
{
public:
//! Constructs an empty attribute filter object.
//! This filter object determines whether selectable
//! interactive objects have a non-null owner.
Standard_EXPORT AIS_AttributeFilter();
//! Constructs an attribute filter object defined by the
//! color attribute aCol.
Standard_EXPORT AIS_AttributeFilter(const Quantity_NameOfColor aCol);
//! Constructs an attribute filter object defined by the line
//! width attribute aWidth.
Standard_EXPORT AIS_AttributeFilter(const Standard_Real aWidth);
//! Indicates that the Interactive Object has the color
//! setting specified by the argument aCol at construction time.
Standard_Boolean HasColor() const { return hasC; }
//! Indicates that the Interactive Object has the width
//! setting specified by the argument aWidth at
//! construction time.
Standard_Boolean HasWidth() const { return hasW; }
//! Sets the color.
void SetColor(const Quantity_NameOfColor theCol)
{
myCol = theCol;
hasC = Standard_True;
}
//! Sets the line width.
void SetWidth(const Standard_Real theWidth)
{
myWid = theWidth;
hasW = Standard_True;
}
//! Removes the setting for color from the filter.
void UnsetColor() { hasC = Standard_False; }
//! Removes the setting for width from the filter.
void UnsetWidth() { hasW = Standard_False; }
//! Indicates that the selected Interactive Object passes
//! the filter. The owner, anObj, can be either direct or
//! user. A direct owner is the corresponding
//! construction element, whereas a user is the
//! compound shape of which the entity forms a part.
//! If the Interactive Object returns Standard_True
//! when detected by the Local Context selector through
//! the mouse, the object is kept; if not, it is rejected.
Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& anObj) const
Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(AIS_AttributeFilter, SelectMgr_Filter)
private:
Quantity_NameOfColor myCol;
Standard_Real myWid;
Standard_Boolean hasC;
Standard_Boolean hasW;
};
#endif // _AIS_AttributeFilter_HeaderFile

View File

@ -0,0 +1,137 @@
// Created on: 1995-08-09
// Created by: Arnaud BOUZY/Odile Olivier
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_Axis_HeaderFile
#define _AIS_Axis_HeaderFile
#include "AIS_InteractiveObject.hxx"
#include "AIS_TypeOfAxis.hxx"
#include "gp_Dir.hxx"
#include "gp_Pnt.hxx"
#include "SelectMgr_Selection.hxx"
class Geom_Line;
class Geom_Axis1Placement;
class Geom_Axis2Placement;
class Prs3d_LineAspect;
//! Locates the x, y and z axes in an Interactive Object.
//! These are used to orient it correctly in presentations
//! from different viewpoints, or to construct a revolved
//! shape, for example, from one of the axes. Conversely,
//! an axis can be created to build a revolved shape and
//! then situated relative to one of the axes of the view.
class AIS_Axis : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(AIS_Axis, AIS_InteractiveObject)
public:
//! Initializes the line aComponent
Standard_EXPORT AIS_Axis(const Handle(Geom_Line)& aComponent);
//! initializes the axis2 position
//! aComponent. The coordinate system used is right-handed.
Standard_EXPORT AIS_Axis(const Handle(Geom_Axis2Placement)& aComponent,
const AIS_TypeOfAxis anAxisType);
//! Initializes the axis1 position anAxis.
Standard_EXPORT AIS_Axis(const Handle(Geom_Axis1Placement)& anAxis);
//! Initializes the ray as axis with start point and direction
//! @param[in] theAxis Start point and direction of the ray
//! @param[in] theLength Optional length of the ray (ray is infinite by default).
Standard_EXPORT AIS_Axis(const gp_Ax1& theAxis, const Standard_Real theLength = -1);
//! Returns the axis entity aComponent and identifies it
//! as a component of a shape.
const Handle(Geom_Line)& Component() const { return myComponent; }
//! Sets the coordinates of the lin aComponent.
Standard_EXPORT void SetComponent(const Handle(Geom_Line)& aComponent);
//! Returns the position of axis2 and positions it by
//! identifying it as the x, y, or z axis and giving its
//! direction in 3D space. The coordinate system used is right-handed.
const Handle(Geom_Axis2Placement)& Axis2Placement() const { return myAx2; }
//! Allows you to provide settings for aComponent:the
//! position and direction of an axis in 3D space. The
//! coordinate system used is right-handed.
Standard_EXPORT void SetAxis2Placement(const Handle(Geom_Axis2Placement)& aComponent,
const AIS_TypeOfAxis anAxisType);
//! Constructs a new line to serve as the axis anAxis in 3D space.
Standard_EXPORT void SetAxis1Placement(const Handle(Geom_Axis1Placement)& anAxis);
//! Returns the type of axis.
AIS_TypeOfAxis TypeOfAxis() const { return myTypeOfAxis; }
//! Constructs the entity theTypeAxis to stock information
//! concerning type of axis.
void SetTypeOfAxis(const AIS_TypeOfAxis theTypeAxis) { myTypeOfAxis = theTypeAxis; }
//! Returns a signature of 2 for axis datums. When you
//! activate mode 2 by a signature, you pick AIS objects
//! of type AIS_Axis.
Standard_Boolean IsXYZAxis() const { return myIsXYZAxis; }
//! Returns true if the interactive object accepts the display mode aMode.
Standard_EXPORT Standard_Boolean
AcceptDisplayMode(const Standard_Integer aMode) const Standard_OVERRIDE;
virtual Standard_Integer Signature() const Standard_OVERRIDE { return 2; }
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE
{
return AIS_KindOfInteractive_Datum;
}
Standard_EXPORT void SetColor(const Quantity_Color& aColor) Standard_OVERRIDE;
Standard_EXPORT void SetWidth(const Standard_Real aValue) Standard_OVERRIDE;
//! Set required visualization parameters.
Standard_EXPORT void SetDisplayAspect(const Handle(Prs3d_LineAspect)& theNewDatumAspect);
Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
Standard_EXPORT void UnsetWidth() Standard_OVERRIDE;
private:
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode) Standard_OVERRIDE;
Standard_EXPORT void ComputeFields();
private:
Handle(Geom_Line) myComponent;
Handle(Geom_Axis2Placement) myAx2;
gp_Pnt myPfirst;
gp_Pnt myPlast;
AIS_TypeOfAxis myTypeOfAxis;
Standard_Boolean myIsXYZAxis;
gp_Dir myDir;
Standard_Real myVal;
Standard_CString myText;
Handle(Prs3d_LineAspect) myLineAspect;
};
DEFINE_STANDARD_HANDLE(AIS_Axis, AIS_InteractiveObject)
#endif // _AIS_Axis_HeaderFile

View File

@ -0,0 +1,66 @@
// Created on: 1998-03-04
// Created by: Julia Gerasimova
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_BadEdgeFilter_HeaderFile
#define _AIS_BadEdgeFilter_HeaderFile
#include "Standard.hxx"
#include "TopTools_DataMapOfIntegerListOfShape.hxx"
#include "Standard_Integer.hxx"
#include "SelectMgr_Filter.hxx"
#include "TopAbs_ShapeEnum.hxx"
class SelectMgr_EntityOwner;
class TopoDS_Edge;
class AIS_BadEdgeFilter;
DEFINE_STANDARD_HANDLE(AIS_BadEdgeFilter, SelectMgr_Filter)
//! A Class
class AIS_BadEdgeFilter : public SelectMgr_Filter
{
public:
//! Constructs an empty filter object for bad edges.
Standard_EXPORT AIS_BadEdgeFilter();
Standard_EXPORT virtual Standard_Boolean ActsOn(const TopAbs_ShapeEnum aType) const
Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& EO) const
Standard_OVERRIDE;
//! sets <myContour> with current contour. used by
//! IsOk.
Standard_EXPORT void SetContour(const Standard_Integer Index);
//! Adds an edge to the list of non-selectionnable
//! edges.
Standard_EXPORT void AddEdge(const TopoDS_Edge& anEdge, const Standard_Integer Index);
//! removes from the list of non-selectionnable edges
//! all edges in the contour <Index>.
Standard_EXPORT void RemoveEdges(const Standard_Integer Index);
DEFINE_STANDARD_RTTIEXT(AIS_BadEdgeFilter, SelectMgr_Filter)
protected:
private:
TopTools_DataMapOfIntegerListOfShape myBadEdges;
Standard_Integer myContour;
};
#endif // _AIS_BadEdgeFilter_HeaderFile

View File

@ -0,0 +1,45 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_BaseAnimationObject_HeaderFile
#define _AIS_BaseAnimationObject_HeaderFile
#include "AIS_Animation.hxx"
#include "AIS_InteractiveContext.hxx"
//! Animation defining object transformation.
class AIS_BaseAnimationObject : public AIS_Animation
{
DEFINE_STANDARD_RTTIEXT(AIS_BaseAnimationObject, AIS_Animation)
protected:
//! Constructor with initialization.
//! @param[in] theAnimationName animation identifier
//! @param[in] theContext interactive context where object have been displayed
//! @param[in] theObject object to apply local transformation
Standard_EXPORT AIS_BaseAnimationObject(const TCollection_AsciiString& theAnimationName,
const Handle(AIS_InteractiveContext)& theContext,
const Handle(AIS_InteractiveObject)& theObject);
//! Update the transformation.
Standard_EXPORT void updateTrsf(const gp_Trsf& theTrsf);
private:
//! Invalidate the viewer for proper update.
Standard_EXPORT void invalidateViewer();
protected:
Handle(AIS_InteractiveContext) myContext; //!< context where object is displayed
Handle(AIS_InteractiveObject) myObject; //!< presentation object to set location
};
#endif // _AIS_BaseAnimationObject_HeaderFile

View File

@ -0,0 +1,50 @@
// Created on: 1998-02-04
// Created by: Julia GERASIMOVA
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_C0RegularityFilter_HeaderFile
#define _AIS_C0RegularityFilter_HeaderFile
#include "Standard.hxx"
#include "TopTools_MapOfShape.hxx"
#include "SelectMgr_Filter.hxx"
#include "TopAbs_ShapeEnum.hxx"
class TopoDS_Shape;
class SelectMgr_EntityOwner;
class AIS_C0RegularityFilter;
DEFINE_STANDARD_HANDLE(AIS_C0RegularityFilter, SelectMgr_Filter)
class AIS_C0RegularityFilter : public SelectMgr_Filter
{
public:
Standard_EXPORT AIS_C0RegularityFilter(const TopoDS_Shape& aShape);
Standard_EXPORT virtual Standard_Boolean ActsOn(const TopAbs_ShapeEnum aType) const
Standard_OVERRIDE;
Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& EO) const
Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(AIS_C0RegularityFilter, SelectMgr_Filter)
protected:
private:
TopTools_MapOfShape myMapOfEdges;
};
#endif // _AIS_C0RegularityFilter_HeaderFile

View File

@ -0,0 +1,80 @@
// Created on: 2018-12-12
// Created by: Olga SURYANINOVA
// Copyright (c) 2018 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_CameraFrustum_HeaderFile
#define _AIS_CameraFrustum_HeaderFile
#include "AIS_InteractiveObject.hxx"
class Graphic3d_ArrayOfSegments;
class Graphic3d_ArrayOfTriangles;
//! Presentation for drawing camera frustum.
//! Default configuration is built with filling and some transparency.
class AIS_CameraFrustum : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(AIS_CameraFrustum, AIS_InteractiveObject)
public:
//! Selection modes supported by this object
enum SelectionMode
{
SelectionMode_Edges = 0, //!< detect by edges (default)
SelectionMode_Volume = 1, //!< detect by volume
};
public:
//! Constructs camera frustum with default configuration.
Standard_EXPORT AIS_CameraFrustum();
//! Sets camera frustum.
Standard_EXPORT void SetCameraFrustum(const Handle(Graphic3d_Camera)& theCamera);
//! Setup custom color.
Standard_EXPORT virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE;
//! Restore default color.
Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE;
//! Restore transparency setting.
Standard_EXPORT virtual void UnsetTransparency() Standard_OVERRIDE;
//! Return true if specified display mode is supported.
Standard_EXPORT virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const
Standard_OVERRIDE;
protected:
//! Computes presentation of camera frustum.
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Compute selection.
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode) Standard_OVERRIDE;
private:
//! Fills triangles primitive array for camera frustum filling.
void fillTriangles();
//! Fills polylines primitive array for camera frustum borders.
void fillBorders();
protected:
NCollection_Array1<Graphic3d_Vec3d> myPoints; //!< Array of points
Handle(Graphic3d_ArrayOfTriangles) myTriangles; //!< Triangles for camera frustum filling
Handle(Graphic3d_ArrayOfSegments) myBorders; //!< Segments for camera frustum borders
};
#endif // _AIS_CameraFrustum_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_Chamf2dDimension_HeaderFile
#define _AIS_Chamf2dDimension_HeaderFile
#include "PrsDim_Chamf2dDimension.hxx"
Standard_DEPRECATED("Alias to moved class")
typedef PrsDim_Chamf2dDimension AIS_Chamf2dDimension;
#endif // _AIS_Chamf2dDimension_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_Chamf3dDimension_HeaderFile
#define _AIS_Chamf3dDimension_HeaderFile
#include "PrsDim_Chamf3dDimension.hxx"
Standard_DEPRECATED("Alias to moved class")
typedef PrsDim_Chamf3dDimension AIS_Chamf3dDimension;
#endif // _AIS_Chamf3dDimension_HeaderFile

View File

@ -0,0 +1,130 @@
// Created on: 1997-01-21
// Created by: Prestataire Christiane ARMAND
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_Circle_HeaderFile
#define _AIS_Circle_HeaderFile
#include "AIS_InteractiveObject.hxx"
class Geom_Circle;
//! Constructs circle datums to be used in construction of
//! composite shapes.
class AIS_Circle : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(AIS_Circle, AIS_InteractiveObject)
public:
//! Initializes this algorithm for constructing AIS circle
//! datums initializes the circle aCircle
Standard_EXPORT AIS_Circle(const Handle(Geom_Circle)& aCircle);
//! Initializes this algorithm for constructing AIS circle datums.
//! Initializes the circle theCircle, the arc
//! starting point theUStart, the arc ending point theUEnd,
//! and the type of sensitivity theIsFilledCircleSens.
Standard_EXPORT AIS_Circle(const Handle(Geom_Circle)& theCircle,
const Standard_Real theUStart,
const Standard_Real theUEnd,
const Standard_Boolean theIsFilledCircleSens = Standard_False);
//! Returns index 6 by default.
virtual Standard_Integer Signature() const Standard_OVERRIDE { return 6; }
//! Indicates that the type of Interactive Object is a datum.
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE
{
return AIS_KindOfInteractive_Datum;
}
//! Returns the circle component defined in SetCircle.
const Handle(Geom_Circle)& Circle() const { return myComponent; }
//! Constructs instances of the starting point and the end
//! point parameters, theU1 and theU2.
void Parameters(Standard_Real& theU1, Standard_Real& theU2) const
{
theU1 = myUStart;
theU2 = myUEnd;
}
//! Allows you to provide settings for the circle datum aCircle.
void SetCircle(const Handle(Geom_Circle)& theCircle) { myComponent = theCircle; }
//! Allows you to set the parameter theU for the starting point of an arc.
void SetFirstParam(const Standard_Real theU)
{
myUStart = theU;
myCircleIsArc = Standard_True;
}
//! Allows you to provide the parameter theU for the end point of an arc.
void SetLastParam(const Standard_Real theU)
{
myUEnd = theU;
myCircleIsArc = Standard_True;
}
Standard_EXPORT void SetColor(const Quantity_Color& aColor) Standard_OVERRIDE;
//! Assigns the width aValue to the solid line boundary of the circle datum.
Standard_EXPORT void SetWidth(const Standard_Real aValue) Standard_OVERRIDE;
//! Removes color from the solid line boundary of the circle datum.
Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
//! Removes width settings from the solid line boundary of the circle datum.
Standard_EXPORT void UnsetWidth() Standard_OVERRIDE;
//! Returns the type of sensitivity for the circle;
Standard_Boolean IsFilledCircleSens() const { return myIsFilledCircleSens; }
//! Sets the type of sensitivity for the circle. If theIsFilledCircleSens set to Standard_True
//! then the whole circle will be detectable, otherwise only the boundary of the circle.
void SetFilledCircleSens(const Standard_Boolean theIsFilledCircleSens)
{
myIsFilledCircleSens = theIsFilledCircleSens;
}
private:
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& theprs,
const Standard_Integer theMode) Standard_OVERRIDE;
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode) Standard_OVERRIDE;
Standard_EXPORT void ComputeCircle(const Handle(Prs3d_Presentation)& aPresentation);
Standard_EXPORT void ComputeArc(const Handle(Prs3d_Presentation)& aPresentation);
Standard_EXPORT void ComputeCircleSelection(const Handle(SelectMgr_Selection)& aSelection);
Standard_EXPORT void ComputeArcSelection(const Handle(SelectMgr_Selection)& aSelection);
//! Replace aspects of already computed groups with the new value.
void replaceWithNewLineAspect(const Handle(Prs3d_LineAspect)& theAspect);
private:
Handle(Geom_Circle) myComponent;
Standard_Real myUStart;
Standard_Real myUEnd;
Standard_Boolean myCircleIsArc;
Standard_Boolean myIsFilledCircleSens;
};
DEFINE_STANDARD_HANDLE(AIS_Circle, AIS_InteractiveObject)
#endif // _AIS_Circle_HeaderFile

View File

@ -0,0 +1,518 @@
// Created on: 2015-02-03
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_ColorScale_HeaderFile
#define _AIS_ColorScale_HeaderFile
#include "AIS_InteractiveObject.hxx"
#include "Aspect_TypeOfColorScaleData.hxx"
#include "Aspect_TypeOfColorScalePosition.hxx"
#include "Aspect_SequenceOfColor.hxx"
#include "Standard.hxx"
#include "Standard_DefineHandle.hxx"
#include "TCollection_ExtendedString.hxx"
#include "TColStd_SequenceOfExtendedString.hxx"
class AIS_ColorScale;
DEFINE_STANDARD_HANDLE(AIS_ColorScale, AIS_InteractiveObject)
//! Class for drawing a custom color scale.
//!
//! The color scale consists of rectangular color bar (composed of fixed
//! number of color intervals), optional labels, and title.
//! The labels can be positioned either at the boundaries of the intervals,
//! or at the middle of each interval.
//! Colors and labels can be either defined automatically or set by the user.
//! Automatic labels are calculated from numerical limits of the scale,
//! its type (logarithmic or plain), and formatted by specified format string.
class AIS_ColorScale : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(AIS_ColorScale, AIS_InteractiveObject)
public:
//! Calculate color according passed value; returns true if value is in range or false, if isn't
Standard_EXPORT static Standard_Boolean FindColor(const Standard_Real theValue,
const Standard_Real theMin,
const Standard_Real theMax,
const Standard_Integer theColorsCount,
const Graphic3d_Vec3d& theColorHlsMin,
const Graphic3d_Vec3d& theColorHlsMax,
Quantity_Color& theColor);
//! Calculate color according passed value; returns true if value is in range or false, if isn't
static Standard_Boolean FindColor(const Standard_Real theValue,
const Standard_Real theMin,
const Standard_Real theMax,
const Standard_Integer theColorsCount,
Quantity_Color& theColor)
{
return FindColor(theValue,
theMin,
theMax,
theColorsCount,
Graphic3d_Vec3d(230.0, 1.0, 1.0),
Graphic3d_Vec3d(0.0, 1.0, 1.0),
theColor);
}
//! Shift hue into valid range.
//! Lightness and Saturation should be specified in valid range [0.0, 1.0],
//! however Hue might be given out of Quantity_Color range to specify desired range for
//! interpolation.
static Standard_Real hueToValidRange(const Standard_Real theHue)
{
Standard_Real aHue = theHue;
while (aHue < 0.0)
{
aHue += 360.0;
}
while (aHue > 360.0)
{
aHue -= 360.0;
}
return aHue;
}
public:
//! Default constructor.
Standard_EXPORT AIS_ColorScale();
//! Calculate color according passed value; returns true if value is in range or false, if isn't
Standard_EXPORT Standard_Boolean FindColor(const Standard_Real theValue,
Quantity_Color& theColor) const;
//! Returns minimal value of color scale, 0.0 by default.
Standard_Real GetMin() const { return myMin; }
//! Sets the minimal value of color scale.
void SetMin(const Standard_Real theMin) { SetRange(theMin, GetMax()); }
//! Returns maximal value of color scale, 1.0 by default.
Standard_Real GetMax() const { return myMax; }
//! Sets the maximal value of color scale.
void SetMax(const Standard_Real theMax) { SetRange(GetMin(), theMax); }
//! Returns minimal and maximal values of color scale, 0.0 to 1.0 by default.
void GetRange(Standard_Real& theMin, Standard_Real& theMax) const
{
theMin = myMin;
theMax = myMax;
}
//! Sets the minimal and maximal value of color scale.
//! Note that values order will be ignored - the minimum and maximum values will be swapped if
//! needed.
//! ::SetReversed() should be called to swap displaying order.
Standard_EXPORT void SetRange(const Standard_Real theMin, const Standard_Real theMax);
//! Returns the hue angle corresponding to minimum value, 230 by default (blue).
Standard_Real HueMin() const { return myColorHlsMin[0]; }
//! Returns the hue angle corresponding to maximum value, 0 by default (red).
Standard_Real HueMax() const { return myColorHlsMax[0]; }
//! Returns the hue angle range corresponding to minimum and maximum values, 230 to 0 by default
//! (blue to red).
void HueRange(Standard_Real& theMinAngle, Standard_Real& theMaxAngle) const
{
theMinAngle = myColorHlsMin[0];
theMaxAngle = myColorHlsMax[0];
}
//! Sets hue angle range corresponding to minimum and maximum values.
//! The valid angle range is [0, 360], see Quantity_Color and Quantity_TOC_HLS for more details.
void SetHueRange(const Standard_Real theMinAngle, const Standard_Real theMaxAngle)
{
myColorHlsMin[0] = theMinAngle;
myColorHlsMax[0] = theMaxAngle;
}
//! Returns color range corresponding to minimum and maximum values, blue to red by default.
void ColorRange(Quantity_Color& theMinColor, Quantity_Color& theMaxColor) const
{
theMinColor.SetValues(hueToValidRange(myColorHlsMin[0]),
myColorHlsMin[1],
myColorHlsMin[2],
Quantity_TOC_HLS);
theMaxColor.SetValues(hueToValidRange(myColorHlsMax[0]),
myColorHlsMax[1],
myColorHlsMax[2],
Quantity_TOC_HLS);
}
//! Sets color range corresponding to minimum and maximum values.
void SetColorRange(const Quantity_Color& theMinColor, const Quantity_Color& theMaxColor)
{
theMinColor.Values(myColorHlsMin[0], myColorHlsMin[1], myColorHlsMin[2], Quantity_TOC_HLS);
theMaxColor.Values(myColorHlsMax[0], myColorHlsMax[1], myColorHlsMax[2], Quantity_TOC_HLS);
}
//! Returns the type of labels, Aspect_TOCSD_AUTO by default.
//! Aspect_TOCSD_AUTO - labels as boundary values for intervals
//! Aspect_TOCSD_USER - user specified label is used
Aspect_TypeOfColorScaleData GetLabelType() const { return myLabelType; }
//! Sets the type of labels.
//! Aspect_TOCSD_AUTO - labels as boundary values for intervals
//! Aspect_TOCSD_USER - user specified label is used
void SetLabelType(const Aspect_TypeOfColorScaleData theType) { myLabelType = theType; }
//! Returns the type of colors, Aspect_TOCSD_AUTO by default.
//! Aspect_TOCSD_AUTO - value between Red and Blue
//! Aspect_TOCSD_USER - user specified color from color map
Aspect_TypeOfColorScaleData GetColorType() const { return myColorType; }
//! Sets the type of colors.
//! Aspect_TOCSD_AUTO - value between Red and Blue
//! Aspect_TOCSD_USER - user specified color from color map
void SetColorType(const Aspect_TypeOfColorScaleData theType) { myColorType = theType; }
//! Returns the number of color scale intervals, 10 by default.
Standard_Integer GetNumberOfIntervals() const { return myNbIntervals; }
//! Sets the number of color scale intervals.
Standard_EXPORT void SetNumberOfIntervals(const Standard_Integer theNum);
//! Returns the color scale title string, empty string by default.
const TCollection_ExtendedString& GetTitle() const { return myTitle; }
//! Sets the color scale title string.
void SetTitle(const TCollection_ExtendedString& theTitle) { myTitle = theTitle; }
//! Returns the format for numbers, "%.4g" by default.
//! The same like format for function printf().
//! Used if GetLabelType() is TOCSD_AUTO;
const TCollection_AsciiString& GetFormat() const { return myFormat; }
//! Returns the format of text.
const TCollection_AsciiString& Format() const { return myFormat; }
//! Sets the color scale auto label format specification.
void SetFormat(const TCollection_AsciiString& theFormat) { myFormat = theFormat; }
//! Returns the user specified label with index theIndex.
//! Index is in range from 1 to GetNumberOfIntervals() or to
//! GetNumberOfIntervals() + 1 if IsLabelAtBorder() is true.
//! Returns empty string if label not defined.
Standard_EXPORT TCollection_ExtendedString GetLabel(const Standard_Integer theIndex) const;
//! Returns the user specified color from color map with index (starts at 1).
//! Returns default color if index is out of range in color map.
Standard_EXPORT Quantity_Color GetIntervalColor(const Standard_Integer theIndex) const;
//! Sets the color of the specified interval.
//! Note that list is automatically resized to include specified index.
//! @param theColor color value to set
//! @param theIndex index in range [1, GetNumberOfIntervals()];
//! appended to the end of list if -1 is specified
Standard_EXPORT void SetIntervalColor(const Quantity_Color& theColor,
const Standard_Integer theIndex);
//! Returns the user specified labels.
Standard_EXPORT void GetLabels(TColStd_SequenceOfExtendedString& theLabels) const;
//! Returns the user specified labels.
const TColStd_SequenceOfExtendedString& Labels() const { return myLabels; }
//! Sets the color scale labels.
//! The length of the sequence should be equal to GetNumberOfIntervals() or to
//! GetNumberOfIntervals() + 1 if IsLabelAtBorder() is true. If length of the sequence does not
//! much the number of intervals, then these labels will be considered as "free" and will be
//! located at the virtual intervals corresponding to the number of labels (with flag
//! IsLabelAtBorder() having the same effect as in normal case).
Standard_EXPORT void SetLabels(const TColStd_SequenceOfExtendedString& theSeq);
//! Returns the user specified colors.
Standard_EXPORT void GetColors(Aspect_SequenceOfColor& theColors) const;
//! Returns the user specified colors.
const Aspect_SequenceOfColor& GetColors() const { return myColors; }
//! Sets the color scale colors.
//! The length of the sequence should be equal to GetNumberOfIntervals().
Standard_EXPORT void SetColors(const Aspect_SequenceOfColor& theSeq);
//! Populates colors scale by colors of the same lightness value in CIE Lch
//! color space, distributed by hue, with perceptually uniform differences
//! between consequent colors.
//! See MakeUniformColors() for description of parameters.
void SetUniformColors(Standard_Real theLightness,
Standard_Real theHueFrom,
Standard_Real theHueTo)
{
SetColors(MakeUniformColors(myNbIntervals, theLightness, theHueFrom, theHueTo));
SetColorType(Aspect_TOCSD_USER);
}
//! Generates sequence of colors of the same lightness value in CIE Lch
//! color space (see #Quantity_TOC_CIELch), with hue values in the specified range.
//! The colors are distributed across the range such as to have perceptually
//! same difference between neighbour colors.
//! For each color, maximal chroma value fitting in sRGB gamut is used.
//!
//! @param theNbColors - number of colors to generate
//! @param theLightness - lightness to be used (0 is black, 100 is white, 32 is
//! lightness of pure blue)
//! @param theHueFrom - hue value at the start of the scale
//! @param theHueTo - hue value defining the end of the scale
//!
//! Hue value can be out of the range [0, 360], interpreted as modulo 360.
//! The colors of the scale will be in the order of increasing hue if
//! theHueTo > theHueFrom, and decreasing otherwise.
Standard_EXPORT static Aspect_SequenceOfColor MakeUniformColors(Standard_Integer theNbColors,
Standard_Real theLightness,
Standard_Real theHueFrom,
Standard_Real theHueTo);
//! Returns the position of labels concerning color filled rectangles, Aspect_TOCSP_RIGHT by
//! default.
Aspect_TypeOfColorScalePosition GetLabelPosition() const { return myLabelPos; }
//! Sets the color scale labels position relative to color bar.
void SetLabelPosition(const Aspect_TypeOfColorScalePosition thePos) { myLabelPos = thePos; }
//! Returns the position of color scale title, Aspect_TOCSP_LEFT by default.
Aspect_TypeOfColorScalePosition GetTitlePosition() const { return myTitlePos; }
//! Sets the color scale title position.
Standard_DEPRECATED("AIS_ColorScale::SetTitlePosition() has no effect!")
void SetTitlePosition(const Aspect_TypeOfColorScalePosition thePos) { myTitlePos = thePos; }
//! Returns TRUE if the labels and colors used in reversed order, FALSE by default.
//! - Normal, bottom-up order with Minimal value on the Bottom and Maximum value on Top.
//! - Reversed, top-down order with Maximum value on the Bottom and Minimum value on Top.
Standard_Boolean IsReversed() const { return myIsReversed; }
//! Sets true if the labels and colors used in reversed order.
void SetReversed(const Standard_Boolean theReverse) { myIsReversed = theReverse; }
//! Return TRUE if color transition between neighbor intervals
//! should be linearly interpolated, FALSE by default.
Standard_Boolean IsSmoothTransition() const { return myIsSmooth; }
//! Setup smooth color transition.
void SetSmoothTransition(const Standard_Boolean theIsSmooth) { myIsSmooth = theIsSmooth; }
//! Returns TRUE if the labels are placed at border of color intervals, TRUE by default.
//! The automatically generated label will show value exactly on the current position:
//! - value connecting two neighbor intervals (TRUE)
//! - value in the middle of interval (FALSE)
Standard_Boolean IsLabelAtBorder() const { return myIsLabelAtBorder; }
//! Sets true if the labels are placed at border of color intervals (TRUE by default).
//! If set to False, labels will be drawn at color intervals rather than at borders.
void SetLabelAtBorder(const Standard_Boolean theOn) { myIsLabelAtBorder = theOn; }
//! Returns TRUE if the color scale has logarithmic intervals, FALSE by default.
Standard_Boolean IsLogarithmic() const { return myIsLogarithmic; }
//! Sets true if the color scale has logarithmic intervals.
void SetLogarithmic(const Standard_Boolean isLogarithmic) { myIsLogarithmic = isLogarithmic; }
//! Sets the color scale label at index.
//! Note that list is automatically resized to include specified index.
//! @param theLabel new label text
//! @param theIndex index in range [1, GetNumberOfIntervals()] or [1, GetNumberOfIntervals() + 1]
//! if IsLabelAtBorder() is true;
//! label is appended to the end of list if negative index is specified
Standard_EXPORT void SetLabel(const TCollection_ExtendedString& theLabel,
const Standard_Integer theIndex);
//! Returns the size of color bar, 0 and 0 by default
//! (e.g. should be set by user explicitly before displaying).
void GetSize(Standard_Integer& theBreadth, Standard_Integer& theHeight) const
{
theBreadth = myBreadth;
theHeight = myHeight;
}
//! Sets the size of color bar.
void SetSize(const Standard_Integer theBreadth, const Standard_Integer theHeight)
{
myBreadth = theBreadth;
myHeight = theHeight;
}
//! Returns the breadth of color bar, 0 by default
//! (e.g. should be set by user explicitly before displaying).
Standard_Integer GetBreadth() const { return myBreadth; }
//! Sets the width of color bar.
void SetBreadth(const Standard_Integer theBreadth) { myBreadth = theBreadth; }
//! Returns the height of color bar, 0 by default
//! (e.g. should be set by user explicitly before displaying).
Standard_Integer GetHeight() const { return myHeight; }
//! Sets the height of color bar.
void SetHeight(const Standard_Integer theHeight) { myHeight = theHeight; }
//! Returns the bottom-left position of color scale, 0x0 by default.
void GetPosition(Standard_Real& theX, Standard_Real& theY) const
{
theX = myXPos;
theY = myYPos;
}
//! Sets the position of color scale.
void SetPosition(const Standard_Integer theX, const Standard_Integer theY)
{
myXPos = theX;
myYPos = theY;
}
//! Returns the left position of color scale, 0 by default.
Standard_Integer GetXPosition() const { return myXPos; }
//! Sets the left position of color scale.
void SetXPosition(const Standard_Integer theX) { myXPos = theX; }
//! Returns the bottom position of color scale, 0 by default.
Standard_Integer GetYPosition() const { return myYPos; }
//! Sets the bottom position of color scale.
void SetYPosition(const Standard_Integer theY) { myYPos = theY; }
//! Returns the font height of text labels, 20 by default.
Standard_Integer GetTextHeight() const { return myTextHeight; }
//! Sets the height of text of color scale.
void SetTextHeight(const Standard_Integer theHeight) { myTextHeight = theHeight; }
public:
//! Returns the width of text.
//! @param[in] theText the text of which to calculate width.
Standard_EXPORT Standard_Integer TextWidth(const TCollection_ExtendedString& theText) const;
//! Returns the height of text.
//! @param[in] theText the text of which to calculate height.
Standard_EXPORT Standard_Integer TextHeight(const TCollection_ExtendedString& theText) const;
Standard_EXPORT void TextSize(const TCollection_ExtendedString& theText,
const Standard_Integer theHeight,
Standard_Integer& theWidth,
Standard_Integer& theAscent,
Standard_Integer& theDescent) const;
public:
//! Return true if specified display mode is supported.
virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE
{
return theMode == 0;
}
//! Compute presentation.
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Compute selection - not implemented for color scale.
virtual void ComputeSelection(const Handle(SelectMgr_Selection)& /*aSelection*/,
const Standard_Integer /*aMode*/) Standard_OVERRIDE
{
}
private:
//! Returns the size of color scale.
//! @param[out] theWidth the width of color scale.
//! @param[out] theHeight the height of color scale.
void SizeHint(Standard_Integer& theWidth, Standard_Integer& theHeight) const;
//! Returns the upper value of given interval, or minimum for theIndex = 0.
Standard_Real GetIntervalValue(const Standard_Integer theIndex) const;
//! Returns the color for the given value in the given interval.
//! @param[in] theValue the current value of interval
//! @param[in] theMin the min value of interval
//! @param[in] theMax the max value of interval
Quantity_Color colorFromValue(const Standard_Real theValue,
const Standard_Real theMin,
const Standard_Real theMax) const;
//! Initialize text aspect for drawing the labels.
void updateTextAspect();
//! Simple alias for Prs3d_Text::Draw().
//! @param[in] theGroup presentation group
//! @param[in] theText text to draw
//! @param[in] theX X coordinate of text position
//! @param[in] theY Y coordinate of text position
//! @param[in] theVertAlignment text vertical alignment
void drawText(const Handle(Graphic3d_Group)& theGroup,
const TCollection_ExtendedString& theText,
const Standard_Integer theX,
const Standard_Integer theY,
const Graphic3d_VerticalTextAlignment theVertAlignment);
//! Determine the maximum text label width in pixels.
Standard_Integer computeMaxLabelWidth(const TColStd_SequenceOfExtendedString& theLabels) const;
//! Draw labels.
void drawLabels(const Handle(Graphic3d_Group)& theGroup,
const TColStd_SequenceOfExtendedString& theLabels,
const Standard_Integer theBarBottom,
const Standard_Integer theBarHeight,
const Standard_Integer theMaxLabelWidth,
const Standard_Integer theColorBreadth);
//! Draw a color bar.
void drawColorBar(const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theBarBottom,
const Standard_Integer theBarHeight,
const Standard_Integer theMaxLabelWidth,
const Standard_Integer theColorBreadth);
//! Draw a frame.
//! @param[in] theX the X coordinate of frame position.
//! @param[in] theY the Y coordinate of frame position.
//! @param[in] theWidth the width of frame.
//! @param[in] theHeight the height of frame.
//! @param[in] theColor the color of frame.
void drawFrame(const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theX,
const Standard_Integer theY,
const Standard_Integer theWidth,
const Standard_Integer theHeight,
const Quantity_Color& theColor);
private:
Standard_Real myMin; //!< values range - minimal value
Standard_Real myMax; //!< values range - maximal value
// clang-format off
Graphic3d_Vec3d myColorHlsMin; //!< HLS color corresponding to minimum value
Graphic3d_Vec3d myColorHlsMax; //!< HLS color corresponding to maximum value
TCollection_ExtendedString myTitle; //!< optional title string
TCollection_AsciiString myFormat; //!< sprintf() format for generating label from value
Standard_Integer myNbIntervals; //!< number of intervals
Aspect_TypeOfColorScaleData myColorType; //!< color type
Aspect_TypeOfColorScaleData myLabelType; //!< label type
Standard_Boolean myIsLabelAtBorder; //!< at border
Standard_Boolean myIsReversed; //!< flag indicating reversed order
Standard_Boolean myIsLogarithmic; //!< flag indicating logarithmic scale
Standard_Boolean myIsSmooth; //!< flag indicating smooth transition between the colors
Aspect_SequenceOfColor myColors; //!< sequence of custom colors
TColStd_SequenceOfExtendedString myLabels; //!< sequence of custom text labels
Aspect_TypeOfColorScalePosition myLabelPos; //!< label position relative to the color scale
// clang-format on
Aspect_TypeOfColorScalePosition myTitlePos; //!< title position
Standard_Integer myXPos; //!< left position
Standard_Integer myYPos; //!< bottom position
Standard_Integer myBreadth; //!< color scale breadth
Standard_Integer myHeight; //!< height of the color scale
Standard_Integer mySpacing; //!< extra spacing between element
Standard_Integer myTextHeight; //!< label font height
};
#endif

View File

@ -0,0 +1,74 @@
// Copyright (c) 2016 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_ColoredDrawer_HeaderFile
#define _AIS_ColoredDrawer_HeaderFile
#include "Prs3d_Drawer.hxx"
#include "Quantity_Color.hxx"
//! Customizable properties.
class AIS_ColoredDrawer : public Prs3d_Drawer
{
DEFINE_STANDARD_RTTIEXT(AIS_ColoredDrawer, Prs3d_Drawer)
public:
//! Default constructor.
AIS_ColoredDrawer(const Handle(Prs3d_Drawer)& theLink)
: myIsHidden(false),
myHasOwnMaterial(false),
myHasOwnColor(false),
myHasOwnTransp(false),
myHasOwnWidth(false)
{
Link(theLink);
}
bool IsHidden() const { return myIsHidden; }
void SetHidden(const bool theToHide) { myIsHidden = theToHide; }
bool HasOwnMaterial() const { return myHasOwnMaterial; }
void UnsetOwnMaterial() { myHasOwnMaterial = false; }
void SetOwnMaterial() { myHasOwnMaterial = true; }
bool HasOwnColor() const { return myHasOwnColor; }
void UnsetOwnColor() { myHasOwnColor = false; }
void SetOwnColor(const Quantity_Color& /*theColor*/) { myHasOwnColor = true; }
bool HasOwnTransparency() const { return myHasOwnTransp; }
void UnsetOwnTransparency() { myHasOwnTransp = false; }
void SetOwnTransparency(Standard_Real /*theTransp*/) { myHasOwnTransp = true; }
bool HasOwnWidth() const { return myHasOwnWidth; }
void UnsetOwnWidth() { myHasOwnWidth = false; }
void SetOwnWidth(const Standard_Real /*theWidth*/) { myHasOwnWidth = true; }
public: //! @name list of overridden properties
bool myIsHidden;
bool myHasOwnMaterial;
bool myHasOwnColor;
bool myHasOwnTransp;
bool myHasOwnWidth;
};
DEFINE_STANDARD_HANDLE(AIS_ColoredDrawer, Prs3d_Drawer)
#endif // _AIS_ColoredDrawer_HeaderFile

View File

@ -0,0 +1,180 @@
// Created on: 2014-04-24
// Created by: Kirill Gavrilov
// Copyright (c) 2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_ColoredShape_HeaderFile
#define _AIS_ColoredShape_HeaderFile
#include "AIS_DataMapOfShapeDrawer.hxx"
#include "AIS_Shape.hxx"
#include "NCollection_IndexedDataMap.hxx"
#include "TopoDS_Compound.hxx"
#include "TopTools_MapOfShape.hxx"
class StdSelect_BRepOwner;
//! Presentation of the shape with customizable sub-shapes properties.
class AIS_ColoredShape : public AIS_Shape
{
public:
//! Default constructor
Standard_EXPORT AIS_ColoredShape(const TopoDS_Shape& theShape);
//! Copy constructor
Standard_EXPORT AIS_ColoredShape(const Handle(AIS_Shape)& theShape);
public: //! @name sub-shape aspects
//! Customize properties of specified sub-shape.
//! The shape will be stored in the map but ignored, if it is not sub-shape of main Shape!
//! This method can be used to mark sub-shapes with customizable properties.
Standard_EXPORT virtual Handle(AIS_ColoredDrawer) CustomAspects(const TopoDS_Shape& theShape);
//! Reset the map of custom sub-shape aspects.
Standard_EXPORT virtual void ClearCustomAspects();
//! Reset custom properties of specified sub-shape.
//! @param theToUnregister unregister or not sub-shape from the map
Standard_EXPORT void UnsetCustomAspects(const TopoDS_Shape& theShape,
const Standard_Boolean theToUnregister = Standard_False);
//! Customize color of specified sub-shape
Standard_EXPORT void SetCustomColor(const TopoDS_Shape& theShape, const Quantity_Color& theColor);
//! Customize transparency of specified sub-shape
Standard_EXPORT void SetCustomTransparency(const TopoDS_Shape& theShape,
Standard_Real theTransparency);
//! Customize line width of specified sub-shape
Standard_EXPORT void SetCustomWidth(const TopoDS_Shape& theShape,
const Standard_Real theLineWidth);
//! Return the map of custom aspects.
const AIS_DataMapOfShapeDrawer& CustomAspectsMap() const { return myShapeColors; }
//! Return the map of custom aspects.
AIS_DataMapOfShapeDrawer& ChangeCustomAspectsMap() { return myShapeColors; }
public: //! @name global aspects
//! Setup color of entire shape.
Standard_EXPORT virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE;
//! Setup line width of entire shape.
Standard_EXPORT virtual void SetWidth(const Standard_Real theLineWidth) Standard_OVERRIDE;
//! Sets transparency value.
Standard_EXPORT virtual void SetTransparency(const Standard_Real theValue) Standard_OVERRIDE;
//! Sets the material aspect.
Standard_EXPORT virtual void SetMaterial(const Graphic3d_MaterialAspect& theAspect)
Standard_OVERRIDE;
public:
//! Removes the setting for transparency in the reconstructed compound shape.
Standard_EXPORT virtual void UnsetTransparency() Standard_OVERRIDE;
//! Setup line width of entire shape.
Standard_EXPORT virtual void UnsetWidth() Standard_OVERRIDE;
protected: //! @name override presentation computation
//! Compute presentation considering sub-shape color map.
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Compute selection considering sub-shape hidden state.
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode) Standard_OVERRIDE;
protected:
typedef NCollection_IndexedDataMap<Handle(AIS_ColoredDrawer), TopoDS_Compound>
DataMapOfDrawerCompd;
protected:
//! Recursive function to map shapes.
//! @param theParentDrawer the drawer to be used for undetailed shapes (default colors)
//! @param theShapeToParse the subshape to be recursively parsed
//! @param theShapeDrawerMap shapes map Subshape (in the base shape) -> Drawer
//! @param theParentType the parent subshape type
//! @param theIsParentClosed flag indicating that specified shape is part of closed Solid
//! @param theDrawerOpenedShapePerType the array of shape types to fill
//! @param theDrawerClosedFaces the map for closed faces
Standard_EXPORT static Standard_Boolean dispatchColors(
const Handle(AIS_ColoredDrawer)& theParentDrawer,
const TopoDS_Shape& theShapeToParse,
const AIS_DataMapOfShapeDrawer& theShapeDrawerMap,
const TopAbs_ShapeEnum theParentType,
const Standard_Boolean theIsParentClosed,
DataMapOfDrawerCompd* theDrawerOpenedShapePerType,
DataMapOfDrawerCompd& theDrawerClosedFaces);
protected:
//! Extract myShapeColors map (KeyshapeColored -> Color) to subshapes map (Subshape -> Color).
//! This needed when colored shape is not part of BaseShape (but subshapes are) and actually
//! container for subshapes.
Standard_EXPORT void fillSubshapeDrawerMap(AIS_DataMapOfShapeDrawer& theSubshapeDrawerMap) const;
//! Add shape to presentation
//! @param thePrs the presentation
//! @param theDrawerOpenedShapePerType the shapes map with unique attributes
//! @param theDrawerClosedFaces the map of attributes for closed faces
//! @param theMode display mode
Standard_EXPORT void addShapesWithCustomProps(
const Handle(Prs3d_Presentation)& thePrs,
const DataMapOfDrawerCompd* theDrawerOpenedShapePerType,
const DataMapOfDrawerCompd& theDrawerClosedFaces,
const Standard_Integer theMode);
//! Check all shapes from myShapeColorsfor visibility
Standard_EXPORT Standard_Boolean isShapeEntirelyVisible() const;
//! Resolve (parse) theKeyShape into subshapes, search in they for theBaseShape,
//! bind all resolved subshapes with theOriginKeyShape and store all binds in theShapeDrawerMap
//! @param theShapeDrawerMap shapes map: resolved and found theBaseShape subshape ->
//! theOriginKeyShape
//! @param theKeyShape a shape to be resolved (parse) into smaller (in topological sense)
//! subshapes for new bind cycle
//! @param theDrawer assigned drawer
Standard_EXPORT void bindSubShapes(AIS_DataMapOfShapeDrawer& theShapeDrawerMap,
const TopoDS_Shape& theKeyShape,
const Handle(AIS_ColoredDrawer)& theDrawer) const;
//! Add sub-shape to selection considering hidden state (recursively).
//! @param theParentDrawer drawer of parent shape
//! @param theShapeDrawerMap shapes map
//! @param theShape shape to compute sensitive entities
//! @param theOwner selectable owner object
//! @param theSelection selection to append new sensitive entities
//! @param theTypOfSel type of selection
//! @param theDeflection linear deflection
//! @param theDeflAngle angular deflection
Standard_EXPORT void computeSubshapeSelection(const Handle(AIS_ColoredDrawer)& theParentDrawer,
const AIS_DataMapOfShapeDrawer& theShapeDrawerMap,
const TopoDS_Shape& theShape,
const Handle(StdSelect_BRepOwner)& theOwner,
const Handle(SelectMgr_Selection)& theSelection,
const TopAbs_ShapeEnum theTypOfSel,
const Standard_Integer thePriority,
const Standard_Real theDeflection,
const Standard_Real theDeflAngle);
protected:
AIS_DataMapOfShapeDrawer myShapeColors;
public:
DEFINE_STANDARD_RTTIEXT(AIS_ColoredShape, AIS_Shape)
};
DEFINE_STANDARD_HANDLE(AIS_ColoredShape, AIS_Shape)
#endif // _AIS_ColoredShape_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_ConcentricRelation_HeaderFile
#define _AIS_ConcentricRelation_HeaderFile
#include "PrsDim_ConcentricRelation.hxx"
Standard_DEPRECATED("Alias to moved class")
typedef PrsDim_ConcentricRelation AIS_ConcentricRelation;
#endif // _AIS_ConcentricRelation_HeaderFile

View File

@ -0,0 +1,149 @@
// Created on: 1997-01-08
// Created by: Robert COUBLANC
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_ConnectedInteractive_HeaderFile
#define _AIS_ConnectedInteractive_HeaderFile
#include "AIS_InteractiveObject.hxx"
#include "AIS_KindOfInteractive.hxx"
#include "TopoDS_Shape.hxx"
//! Creates an arbitrary located instance of another Interactive Object,
//! which serves as a reference.
//! This allows you to use the Connected Interactive
//! Object without having to recalculate presentation,
//! selection or graphic structure. These are deduced
//! from your reference object.
//! The relation between the connected interactive object
//! and its source is generally one of geometric transformation.
//! AIS_ConnectedInteractive class supports selection mode 0 for any InteractiveObject and
//! all standard modes if its reference based on AIS_Shape.
//! Descendants may redefine ComputeSelection() though.
//! Also ConnectedInteractive will handle HLR if its reference based on AIS_Shape.
class AIS_ConnectedInteractive : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(AIS_ConnectedInteractive, AIS_InteractiveObject)
public:
//! Disconnects the previous view and sets highlight
//! mode to 0. This highlights the wireframe presentation
//! aTypeOfPresentation3d.
//! Top_AllView deactivates hidden line removal.
Standard_EXPORT AIS_ConnectedInteractive(
const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
//! Returns KOI_Object
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE
{
return AIS_KindOfInteractive_Object;
}
//! Returns 0
virtual Standard_Integer Signature() const Standard_OVERRIDE { return 0; }
//! Establishes the connection between the Connected
//! Interactive Object, anotherIobj, and its reference.
void Connect(const Handle(AIS_InteractiveObject)& theAnotherObj)
{
connect(theAnotherObj, Handle(TopLoc_Datum3D)());
}
//! Establishes the connection between the Connected
//! Interactive Object, anotherIobj, and its reference.
//! Locates instance in aLocation.
void Connect(const Handle(AIS_InteractiveObject)& theAnotherObj, const gp_Trsf& theLocation)
{
connect(theAnotherObj, new TopLoc_Datum3D(theLocation));
}
//! Establishes the connection between the Connected
//! Interactive Object, anotherIobj, and its reference.
//! Locates instance in aLocation.
void Connect(const Handle(AIS_InteractiveObject)& theAnotherObj,
const Handle(TopLoc_Datum3D)& theLocation)
{
connect(theAnotherObj, theLocation);
}
//! Returns true if there is a connection established
//! between the presentation and its source reference.
Standard_Boolean HasConnection() const { return !myReference.IsNull(); }
//! Returns the connection with the reference Interactive Object.
const Handle(AIS_InteractiveObject)& ConnectedTo() const { return myReference; }
//! Clears the connection with a source reference. The
//! presentation will no longer be displayed.
//! Warning Must be done before deleting the presentation.
Standard_EXPORT void Disconnect();
//! Informs the graphic context that the interactive Object
//! may be decomposed into sub-shapes for dynamic selection.
virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE
{
return !myReference.IsNull() && myReference->AcceptShapeDecomposition();
}
//! Return true if reference presentation accepts specified display mode.
virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE
{
return myReference.IsNull() || myReference->AcceptDisplayMode(theMode);
}
protected:
//! Calculates the view aPresentation and its updates.
//! The latter are managed by aPresentationManager.
//! The display mode aMode is 0 by default.
//! this method is redefined virtual;
//! when the instance is connected to another
//! InteractiveObject,this method doesn't
//! compute anything, but just uses the
//! presentation of this last object, with
//! a transformation if there's one stored.
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& theprs,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Computes the presentation according to a point of view.
Standard_EXPORT virtual void computeHLR(const Handle(Graphic3d_Camera)& theProjector,
const Handle(TopLoc_Datum3D)& theTrsf,
const Handle(Prs3d_Presentation)& thePrs)
Standard_OVERRIDE;
//! Generates sensitive entities by copying
//! them from myReference selection, creates and sets an entity
//! owner for this entities and adds them to theSelection
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Generates sensitive entities by copying
//! them from myReference sub shapes selection, creates and sets an entity
//! owner for this entities and adds them to theSelection
Standard_EXPORT void computeSubShapeSelection(const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode);
Standard_EXPORT void updateShape(const Standard_Boolean WithLocation = Standard_True);
Standard_EXPORT void connect(const Handle(AIS_InteractiveObject)& theAnotherObj,
const Handle(TopLoc_Datum3D)& theLocation);
protected:
Handle(AIS_InteractiveObject) myReference;
TopoDS_Shape myShape;
};
DEFINE_STANDARD_HANDLE(AIS_ConnectedInteractive, AIS_InteractiveObject)
#endif // _AIS_ConnectedInteractive_HeaderFile

View File

@ -0,0 +1,19 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef AIS_DataMapIteratorOfDataMapOfIOStatus_HeaderFile
#define AIS_DataMapIteratorOfDataMapOfIOStatus_HeaderFile
#include "AIS_DataMapOfIOStatus.hxx"
#endif

View File

@ -0,0 +1,29 @@
// Created on: 1996-12-11
// Created by: Robert COUBLANC
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef AIS_DataMapOfIOStatus_HeaderFile
#define AIS_DataMapOfIOStatus_HeaderFile
#include "AIS_InteractiveObject.hxx"
#include "AIS_GlobalStatus.hxx"
#include "NCollection_DataMap.hxx"
typedef NCollection_DataMap<Handle(AIS_InteractiveObject), Handle(AIS_GlobalStatus)>
AIS_DataMapOfIOStatus;
typedef NCollection_DataMap<Handle(AIS_InteractiveObject), Handle(AIS_GlobalStatus)>::Iterator
AIS_DataMapIteratorOfDataMapOfIOStatus;
#endif

View File

@ -0,0 +1,24 @@
// Copyright (c) 2016 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_DataMapOfShapeDrawer_HeaderFile
#define _AIS_DataMapOfShapeDrawer_HeaderFile
#include "AIS_ColoredDrawer.hxx"
#include "NCollection_DataMap.hxx"
#include "TopTools_ShapeMapHasher.hxx"
typedef NCollection_DataMap<TopoDS_Shape, Handle(AIS_ColoredDrawer), TopTools_ShapeMapHasher>
AIS_DataMapOfShapeDrawer;
#endif // _AIS_DataMapOfShapeDrawer_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_DiameterDimension_HeaderFile
#define _AIS_DiameterDimension_HeaderFile
#include "PrsDim_DiameterDimension.hxx"
Standard_DEPRECATED("Alias to moved class")
typedef PrsDim_DiameterDimension AIS_DiameterDimension;
#endif // _AIS_DiameterDimension_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_Dimension_HeaderFile
#define _AIS_Dimension_HeaderFile
#include "PrsDim_Dimension.hxx"
Standard_DEPRECATED("Alias to moved class")
typedef PrsDim_Dimension AIS_Dimension;
#endif // _AIS_Dimension_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_DimensionOwner_HeaderFile
#define _AIS_DimensionOwner_HeaderFile
#include "PrsDim_DimensionOwner.hxx"
Standard_DEPRECATED("Alias to moved class")
typedef PrsDim_DimensionOwner AIS_DimensionOwner;
#endif // _AIS_DimensionOwner_HeaderFile

View File

@ -0,0 +1,30 @@
// Created on: 1996-12-11
// Created by: Robert COUBLANC
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_DisplayMode_HeaderFile
#define _AIS_DisplayMode_HeaderFile
//! Sets display modes other than neutral point ones,
//! for interactive objects. The possibilities include:
//! - wireframe,
//! - shaded,
enum AIS_DisplayMode
{
AIS_WireFrame,
AIS_Shaded
};
#endif // _AIS_DisplayMode_HeaderFile

View File

@ -0,0 +1,25 @@
// Created on: 1996-12-11
// Created by: Robert COUBLANC
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_DisplayStatus_HeaderFile
#define _AIS_DisplayStatus_HeaderFile
#include "PrsMgr_DisplayStatus.hxx"
//! To give the display status of an Interactive Object.
typedef PrsMgr_DisplayStatus AIS_DisplayStatus;
#endif // _AIS_DisplayStatus_HeaderFile

View File

@ -0,0 +1,27 @@
// Copyright (c) 2018-2019 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_DragAction_HeaderFile
#define _AIS_DragAction_HeaderFile
//! Dragging action.
enum AIS_DragAction
{
AIS_DragAction_Start, //!< (try) start dragging object
AIS_DragAction_Confirmed, //!< dragging interaction is confirmed.
AIS_DragAction_Update, //!< perform dragging (update position)
AIS_DragAction_Stop, //!< stop dragging (save position)
AIS_DragAction_Abort, //!< abort dragging (restore initial position)
};
#endif // _AIS_DragAction_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_EllipseRadiusDimension_HeaderFile
#define _AIS_EllipseRadiusDimension_HeaderFile
#include "PrsDim_EllipseRadiusDimension.hxx"
Standard_DEPRECATED("Alias to moved class")
typedef PrsDim_EllipseRadiusDimension AIS_EllipseRadiusDimension;
#endif // _AIS_EllipseRadiusDimension_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_EqualDistanceRelation_HeaderFile
#define _AIS_EqualDistanceRelation_HeaderFile
#include "PrsDim_EqualDistanceRelation.hxx"
Standard_DEPRECATED("Deprecated alias to moved class")
typedef PrsDim_EqualDistanceRelation AIS_EqualDistanceRelation;
#endif // _AIS_EqualDistanceRelation_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_EqualRadiusRelation_HeaderFile
#define _AIS_EqualRadiusRelation_HeaderFile
#include "PrsDim_EqualRadiusRelation.hxx"
Standard_DEPRECATED("Deprecated alias to moved class")
typedef PrsDim_EqualRadiusRelation AIS_EqualRadiusRelation;
#endif // _AIS_EqualRadiusRelation_HeaderFile

View File

@ -0,0 +1,106 @@
// Created on: 1997-11-28
// Created by: Robert COUBLANC
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_ExclusionFilter_HeaderFile
#define _AIS_ExclusionFilter_HeaderFile
#include "Standard.hxx"
#include "Standard_Type.hxx"
#include "TColStd_DataMapOfIntegerListOfInteger.hxx"
#include "SelectMgr_Filter.hxx"
#include "AIS_KindOfInteractive.hxx"
#include "Standard_Integer.hxx"
#include "TColStd_ListOfInteger.hxx"
class SelectMgr_EntityOwner;
class AIS_ExclusionFilter;
DEFINE_STANDARD_HANDLE(AIS_ExclusionFilter, SelectMgr_Filter)
//! A framework to reject or to accept only objects of
//! given types and/or signatures.
//! Objects are stored, and the stored objects - along
//! with the flag settings - are used to define the filter.
//! Objects to be filtered are compared with the stored
//! objects added to the filter, and are accepted or
//! rejected according to the exclusion flag setting.
//! - Exclusion flag on
//! - the function IsOk answers true for all objects,
//! except those of the types and signatures stored
//! in the filter framework
//! - Exclusion flag off
//! - the function IsOk answers true for all objects
//! which have the same type and signature as the stored ones.
class AIS_ExclusionFilter : public SelectMgr_Filter
{
public:
//! Constructs an empty exclusion filter object defined by
//! the flag setting ExclusionFlagOn.
//! By default, the flag is set to true.
Standard_EXPORT AIS_ExclusionFilter(const Standard_Boolean ExclusionFlagOn = Standard_True);
//! All the AIS objects of <TypeToExclude>
//! Will be rejected by the IsOk Method.
Standard_EXPORT AIS_ExclusionFilter(const AIS_KindOfInteractive TypeToExclude,
const Standard_Boolean ExclusionFlagOn = Standard_True);
//! Constructs an exclusion filter object defined by the
//! enumeration value TypeToExclude, the signature
//! SignatureInType, and the flag setting ExclusionFlagOn.
//! By default, the flag is set to true.
Standard_EXPORT AIS_ExclusionFilter(const AIS_KindOfInteractive TypeToExclude,
const Standard_Integer SignatureInType,
const Standard_Boolean ExclusionFlagOn = Standard_True);
Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& anObj) const
Standard_OVERRIDE;
//! Adds the type TypeToExclude to the list of types.
Standard_EXPORT Standard_Boolean Add(const AIS_KindOfInteractive TypeToExclude);
Standard_EXPORT Standard_Boolean Add(const AIS_KindOfInteractive TypeToExclude,
const Standard_Integer SignatureInType);
Standard_EXPORT Standard_Boolean Remove(const AIS_KindOfInteractive TypeToExclude);
Standard_EXPORT Standard_Boolean Remove(const AIS_KindOfInteractive TypeToExclude,
const Standard_Integer SignatureInType);
Standard_EXPORT void Clear();
Standard_Boolean IsExclusionFlagOn() const { return myIsExclusionFlagOn; }
void SetExclusionFlag(const Standard_Boolean theStatus) { myIsExclusionFlagOn = theStatus; }
Standard_EXPORT Standard_Boolean IsStored(const AIS_KindOfInteractive aType) const;
Standard_EXPORT void ListOfStoredTypes(TColStd_ListOfInteger& TheList) const;
Standard_EXPORT void ListOfSignature(const AIS_KindOfInteractive aType,
TColStd_ListOfInteger& TheStoredList) const;
DEFINE_STANDARD_RTTIEXT(AIS_ExclusionFilter, SelectMgr_Filter)
private:
Standard_EXPORT Standard_Boolean IsSignatureIn(const AIS_KindOfInteractive aType,
const Standard_Integer aSignature) const;
Standard_Boolean myIsExclusionFlagOn;
TColStd_DataMapOfIntegerListOfInteger myStoredTypes;
};
#endif // _AIS_ExclusionFilter_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_FixRelation_HeaderFile
#define _AIS_FixRelation_HeaderFile
#include "PrsDim_FixRelation.hxx"
Standard_DEPRECATED("Deprecated alias to moved class")
typedef PrsDim_FixRelation AIS_FixRelation;
#endif // _AIS_FixRelation_HeaderFile

View File

@ -0,0 +1,96 @@
// Created on: 1997-01-24
// Created by: Robert COUBLANC
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_GlobalStatus_HeaderFile
#define _AIS_GlobalStatus_HeaderFile
#include "Standard.hxx"
#include "Prs3d_Drawer.hxx"
#include "TColStd_ListOfInteger.hxx"
#include "Standard_Integer.hxx"
#include "Standard_Transient.hxx"
DEFINE_STANDARD_HANDLE(AIS_GlobalStatus, Standard_Transient)
//! Stores information about objects in graphic context:
class AIS_GlobalStatus : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(AIS_GlobalStatus, Standard_Transient)
public:
//! Default constructor.
Standard_EXPORT AIS_GlobalStatus();
//! Returns the display mode.
Standard_Integer DisplayMode() const { return myDispMode; }
//! Sets display mode.
void SetDisplayMode(const Standard_Integer theMode) { myDispMode = theMode; }
//! Returns TRUE if object is highlighted
Standard_Boolean IsHilighted() const { return myIsHilit; }
//! Sets highlighted state.
void SetHilightStatus(const Standard_Boolean theStatus) { myIsHilit = theStatus; }
//! Changes applied highlight style for a particular object
void SetHilightStyle(const Handle(Prs3d_Drawer)& theStyle) { myHiStyle = theStyle; }
//! Returns applied highlight style for a particular object
const Handle(Prs3d_Drawer)& HilightStyle() const { return myHiStyle; }
//! Returns active selection modes of the object.
const TColStd_ListOfInteger& SelectionModes() const { return mySelModes; }
//! Return TRUE if selection mode was registered.
Standard_Boolean IsSModeIn(Standard_Integer theMode) const
{
return mySelModes.Contains(theMode);
}
//! Add selection mode.
Standard_Boolean AddSelectionMode(const Standard_Integer theMode)
{
if (!mySelModes.Contains(theMode))
{
mySelModes.Append(theMode);
return Standard_True;
}
return Standard_False;
}
//! Remove selection mode.
Standard_Boolean RemoveSelectionMode(const Standard_Integer theMode)
{
return mySelModes.Remove(theMode);
}
//! Remove all selection modes.
void ClearSelectionModes() { mySelModes.Clear(); }
Standard_Boolean IsSubIntensityOn() const { return mySubInt; }
void SetSubIntensity(Standard_Boolean theIsOn) { mySubInt = theIsOn; }
private:
TColStd_ListOfInteger mySelModes;
Handle(Prs3d_Drawer) myHiStyle;
Standard_Integer myDispMode;
Standard_Boolean myIsHilit;
Standard_Boolean mySubInt;
};
#endif // _AIS_GlobalStatus_HeaderFile

View File

@ -0,0 +1,68 @@
// Created on: 1997-02-10
// Created by: Robert COUBLANC
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_GraphicTool_HeaderFile
#define _AIS_GraphicTool_HeaderFile
#include "Standard.hxx"
#include "Standard_DefineAlloc.hxx"
#include "Standard_Handle.hxx"
#include "Prs3d_Drawer.hxx"
#include "AIS_TypeOfAttribute.hxx"
#include "Standard_Real.hxx"
#include "Aspect_TypeOfLine.hxx"
class Quantity_Color;
class Graphic3d_MaterialAspect;
class AIS_GraphicTool
{
public:
DEFINE_STANDARD_ALLOC
Standard_EXPORT static Quantity_NameOfColor GetLineColor(
const Handle(Prs3d_Drawer)& aDrawer,
const AIS_TypeOfAttribute TheTypeOfAttributes);
Standard_EXPORT static void GetLineColor(const Handle(Prs3d_Drawer)& aDrawer,
const AIS_TypeOfAttribute TheTypeOfAttributes,
Quantity_Color& TheLineColor);
Standard_EXPORT static Standard_Real GetLineWidth(const Handle(Prs3d_Drawer)& aDrawer,
const AIS_TypeOfAttribute TheTypeOfAttributes);
Standard_EXPORT static Aspect_TypeOfLine GetLineType(
const Handle(Prs3d_Drawer)& aDrawer,
const AIS_TypeOfAttribute TheTypeOfAttributes);
Standard_EXPORT static void GetLineAtt(const Handle(Prs3d_Drawer)& aDrawer,
const AIS_TypeOfAttribute TheTypeOfAttributes,
Quantity_NameOfColor& aCol,
Standard_Real& aWidth,
Aspect_TypeOfLine& aTyp);
Standard_EXPORT static Quantity_NameOfColor GetInteriorColor(const Handle(Prs3d_Drawer)& aDrawer);
Standard_EXPORT static void GetInteriorColor(const Handle(Prs3d_Drawer)& aDrawer,
Quantity_Color& aColor);
Standard_EXPORT static Graphic3d_MaterialAspect GetMaterial(const Handle(Prs3d_Drawer)& aDrawer);
protected:
private:
};
#endif // _AIS_GraphicTool_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_IdenticRelation_HeaderFile
#define _AIS_IdenticRelation_HeaderFile
#include "PrsDim_IdenticRelation.hxx"
Standard_DEPRECATED("Deprecated alias to moved class")
typedef PrsDim_IdenticRelation AIS_IdenticRelation;
#endif // _AIS_IdenticRelation_HeaderFile

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,164 @@
// Created on: 1996-12-11
// Created by: Robert COUBLANC
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_InteractiveObject_HeaderFile
#define _AIS_InteractiveObject_HeaderFile
#include "AIS_KindOfInteractive.hxx"
#include "AIS_DragAction.hxx"
#include "SelectMgr_SelectableObject.hxx"
class AIS_InteractiveContext;
class Prs3d_BasicAspect;
class V3d_View;
//! Defines a class of objects with display and selection services.
//! Entities which are visualized and selected are Interactive Objects.
//! Specific attributes of entities such as arrow aspect for dimensions must be loaded in a
//! Prs3d_Drawer.
//!
//! You can make use of classes of standard Interactive Objects for which all necessary methods have
//! already been programmed, or you can implement your own classes of Interactive Objects. Key
//! interface methods to be implemented by every Interactive Object:
//! * Presentable Object (PrsMgr_PresentableObject)
//! Consider defining an enumeration of supported Display Mode indexes for particular Interactive
//! Object or class of Interactive Objects.
//! - AcceptDisplayMode() accepting display modes implemented by this object;
//! - Compute() computing presentation for the given display mode index;
//! * Selectable Object (SelectMgr_SelectableObject)
//! Consider defining an enumeration of supported Selection Mode indexes for particular
//! Interactive Object or class of Interactive Objects.
//! - ComputeSelection() computing selectable entities for the given selection mode index.
class AIS_InteractiveObject : public SelectMgr_SelectableObject
{
friend class AIS_InteractiveContext;
DEFINE_STANDARD_RTTIEXT(AIS_InteractiveObject, SelectMgr_SelectableObject)
public:
//! Returns the kind of Interactive Object; AIS_KindOfInteractive_None by default.
virtual AIS_KindOfInteractive Type() const { return AIS_KindOfInteractive_None; }
//! Specifies additional characteristics of Interactive Object of Type(); -1 by default.
//! Among the datums, this signature is attributed to the shape.
//! The remaining datums have the following default signatures:
//! - Point signature 1
//! - Axis signature 2
//! - Trihedron signature 3
//! - PlaneTrihedron signature 4
//! - Line signature 5
//! - Circle signature 6
//! - Plane signature 7.
virtual Standard_Integer Signature() const { return -1; }
//! Updates the active presentation; if <AllModes> = Standard_True
//! all the presentations inside are recomputed.
//! IMPORTANT: It is preferable to call Redisplay method of
//! corresponding AIS_InteractiveContext instance for cases when it
//! is accessible. This method just redirects call to myCTXPtr,
//! so this class field must be up to date for proper result.
Standard_EXPORT void Redisplay(const Standard_Boolean AllModes = Standard_False);
//! Indicates whether the Interactive Object has a pointer to an interactive context.
Standard_Boolean HasInteractiveContext() const { return myCTXPtr != NULL; }
//! Returns the context pointer to the interactive context.
AIS_InteractiveContext* InteractiveContext() const { return myCTXPtr; }
//! Sets the interactive context aCtx and provides a link
//! to the default drawing tool or "Drawer" if there is none.
Standard_EXPORT virtual void SetContext(const Handle(AIS_InteractiveContext)& aCtx);
//! Returns true if the object has an owner attributed to it.
//! The owner can be a shape for a set of sub-shapes or a sub-shape for sub-shapes which it is
//! composed of, and takes the form of a transient.
Standard_Boolean HasOwner() const { return !myOwner.IsNull(); }
//! Returns the owner of the Interactive Object.
//! The owner can be a shape for a set of sub-shapes or
//! a sub-shape for sub-shapes which it is composed of,
//! and takes the form of a transient.
//! There are two types of owners:
//! - Direct owners, decomposition shapes such as
//! edges, wires, and faces.
//! - Users, presentable objects connecting to sensitive
//! primitives, or a shape which has been decomposed.
const Handle(Standard_Transient)& GetOwner() const { return myOwner; }
//! Allows you to attribute the owner theApplicativeEntity to
//! an Interactive Object. This can be a shape for a set of
//! sub-shapes or a sub-shape for sub-shapes which it
//! is composed of. The owner takes the form of a transient.
void SetOwner(const Handle(Standard_Transient)& theApplicativeEntity)
{
myOwner = theApplicativeEntity;
}
//! Each Interactive Object has methods which allow us to attribute an Owner to it in the form of
//! a Transient. This method removes the owner from the graphic entity.
void ClearOwner() { myOwner.Nullify(); }
//! Drag object in the viewer.
//! @param[in] theCtx interactive context
//! @param[in] theView active View
//! @param[in] theOwner the owner of detected entity
//! @param[in] theDragFrom drag start point
//! @param[in] theDragTo drag end point
//! @param[in] theAction drag action
//! @return FALSE if object rejects dragging action (e.g. AIS_DragAction_Start)
Standard_EXPORT virtual Standard_Boolean ProcessDragging(
const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const Handle(SelectMgr_EntityOwner)& theOwner,
const Graphic3d_Vec2i& theDragFrom,
const Graphic3d_Vec2i& theDragTo,
const AIS_DragAction theAction);
public:
//! Returns the context pointer to the interactive context.
Standard_EXPORT Handle(AIS_InteractiveContext) GetContext() const;
//! Returns TRUE when this object has a presentation in the current DisplayMode()
Standard_EXPORT Standard_Boolean HasPresentation() const;
//! Returns the current presentation of this object according to the current DisplayMode()
Standard_EXPORT Handle(Prs3d_Presentation) Presentation() const;
//! Sets the graphic basic aspect to the current presentation.
Standard_DEPRECATED("Deprecated method, results might be undefined")
Standard_EXPORT void SetAspect(const Handle(Prs3d_BasicAspect)& anAspect);
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream,
Standard_Integer theDepth = -1) const Standard_OVERRIDE;
protected:
//! The TypeOfPresention3d means that the interactive object
//! may have a presentation dependent on the view of Display.
Standard_EXPORT AIS_InteractiveObject(
const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
//! Set presentation display status.
Standard_EXPORT void SetDisplayStatus(PrsMgr_DisplayStatus theStatus);
protected:
// clang-format off
AIS_InteractiveContext* myCTXPtr; //!< pointer to Interactive Context, where object is currently displayed; @sa SetContext()
// clang-format on
Handle(Standard_Transient) myOwner; //!< application-specific owner object
};
DEFINE_STANDARD_HANDLE(AIS_InteractiveObject, SelectMgr_SelectableObject)
#endif // _AIS_InteractiveObject_HeaderFile

View File

@ -0,0 +1,43 @@
// Created on: 1996-12-11
// Created by: Robert COUBLANC
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_KindOfInteractive_HeaderFile
#define _AIS_KindOfInteractive_HeaderFile
//! Declares the type of Interactive Object.
//! This type can be used for fast pre-filtering of objects of specific group.
enum AIS_KindOfInteractive
{
AIS_KindOfInteractive_None, //!< object of unknown type
AIS_KindOfInteractive_Datum, //!< presentation of construction element (datum)
//! such as points, lines, axes and planes
AIS_KindOfInteractive_Shape, //!< presentation of topological shape
AIS_KindOfInteractive_Object, //!< presentation of group of topological shapes
AIS_KindOfInteractive_Relation, //!< presentation of relation (dimensions and constraints)
AIS_KindOfInteractive_Dimension, //!< presentation of dimension (length, radius, diameter and
//!< angle)
AIS_KindOfInteractive_LightSource, //!< presentation of light source
// old aliases
AIS_KOI_None = AIS_KindOfInteractive_None,
AIS_KOI_Datum = AIS_KindOfInteractive_Datum,
AIS_KOI_Shape = AIS_KindOfInteractive_Shape,
AIS_KOI_Object = AIS_KindOfInteractive_Object,
AIS_KOI_Relation = AIS_KindOfInteractive_Relation,
AIS_KOI_Dimension = AIS_KindOfInteractive_Dimension
};
#endif // _AIS_KindOfInteractive_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_LengthDimension_HeaderFile
#define _AIS_LengthDimension_HeaderFile
#include "PrsDim_LengthDimension.hxx"
Standard_DEPRECATED("Deprecated alias to moved class")
typedef PrsDim_LengthDimension AIS_LengthDimension;
#endif // _AIS_LengthDimension_HeaderFile

View File

@ -0,0 +1,313 @@
// Created on: 2020-09-07
// Created by: Maria KRYLOVA
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_LightSource_HeaderFile
#define _AIS_LightSource_HeaderFile
#include "AIS_InteractiveObject.hxx"
#include "Graphic3d_AspectLine3d.hxx"
#include "Graphic3d_AspectMarker3d.hxx"
#include "SelectMgr_EntityOwner.hxx"
class Select3D_SensitiveSphere;
//! Interactive object for a light source.
//! Each type of light source has it's own presentation:
//! - Ambient light is displayed as a sphere at view corner;
//! - Positional light is represented by a sphere or marker;
//! - Spot light is represented by a cone;
//! - Directional light is represented by a set of arrows at the corner of view.
//! In addition, light source name could be displayed, and clicking on presentation will
//! enable/disable light.
class AIS_LightSource : public AIS_InteractiveObject
{
friend class AIS_LightSourceOwner;
DEFINE_STANDARD_RTTIEXT(AIS_LightSource, AIS_InteractiveObject)
public:
//! Initializes the light source by copying Graphic3d_CLight settings.
Standard_EXPORT AIS_LightSource(const Handle(Graphic3d_CLight)& theLightSource);
//! Returns the light.
const Handle(Graphic3d_CLight)& Light() const { return myLightSource; }
//! Set the light.
void SetLight(const Handle(Graphic3d_CLight)& theLight)
{
myLightSource = theLight;
SetToUpdate();
}
public: //! @name Light properties
//! Returns TRUE if the light source name should be displayed; TRUE by default.
Standard_Boolean ToDisplayName() const { return myToDisplayName; }
//! Show/hide light source name.
void SetDisplayName(Standard_Boolean theToDisplay)
{
if (myToDisplayName != theToDisplay)
{
myToDisplayName = theToDisplay;
SetToUpdate();
}
}
//! Returns TRUE to display light source range as sphere (positional light) or cone (spot light);
//! TRUE by default. Has no effect for non-zoomable presentation.
Standard_Boolean ToDisplayRange() const { return myToDisplayRange; }
//! Show/hide light source range shaded presentation.
void SetDisplayRange(Standard_Boolean theToDisplay)
{
if (myToDisplayRange != theToDisplay)
{
myToDisplayRange = theToDisplay;
SetToUpdate();
}
}
//! Returns the size of presentation; 50 by default.
Standard_Real Size() const { return mySize; }
//! Sets the size of presentation.
void SetSize(Standard_Real theSize)
{
if (mySize != theSize)
{
mySize = theSize;
SetToUpdate();
}
}
//! Returns Sensitive sphere arc size in pixels; 20 by default.
Standard_Integer ArcSize() const { return mySensSphereArcSize; }
//! Sets the size of sensitive sphere arc.
void SetArcSize(Standard_Integer theSize)
{
if (mySensSphereArcSize != theSize)
{
mySensSphereArcSize = theSize;
SetToUpdate();
}
}
//! Returns TRUE if transform-persistence is allowed;
//! TRUE by default for Ambient and Directional lights
//! and FALSE by default for Positional and Spot lights.
bool IsZoomable() const { return myIsZoomable; }
//! Sets if transform-persistence is allowed.
void SetZoomable(bool theIsZoomable)
{
if (myIsZoomable != theIsZoomable)
{
myIsZoomable = theIsZoomable;
SetToUpdate();
}
}
//! Sets if dragging is allowed.
void SetDraggable(bool theIsDraggable)
{
if (myIsDraggable != theIsDraggable)
{
myIsDraggable = theIsDraggable;
}
}
//! Returns TRUE if mouse click will turn light on/off; TRUE by default.
bool ToSwitchOnClick() const { return myToSwitchOnClick; }
//! Sets if mouse click should turn light on/off.
void SetSwitchOnClick(bool theToHandle) { myToSwitchOnClick = theToHandle; }
//! Returns a number of directional light arrows to display; 5 by default.
Standard_Integer NbArrows() const { return myNbArrows; }
//! Returns a number of directional light arrows to display (supported values: 1, 3, 5, 9).
void SetNbArrows(Standard_Integer theNbArrows)
{
if (myNbArrows != theNbArrows)
{
myNbArrows = theNbArrows;
SetToUpdate();
}
}
//! Returns light source icon.
//! @param[in] theIsEnabled marker index for enabled/disabled light source states
const Handle(Graphic3d_MarkerImage)& MarkerImage(bool theIsEnabled) const
{
return myMarkerImages[theIsEnabled ? 1 : 0];
}
//! Returns light source icon.
//! @param[in] theIsEnabled marker index for enabled/disabled light source states
Aspect_TypeOfMarker MarkerType(bool theIsEnabled) const
{
return myMarkerTypes[theIsEnabled ? 1 : 0];
}
//! Sets custom icon to light source.
void SetMarkerImage(const Handle(Graphic3d_MarkerImage)& theImage, bool theIsEnabled)
{
myMarkerImages[theIsEnabled ? 1 : 0] = theImage;
myMarkerTypes[theIsEnabled ? 1 : 0] = !theImage.IsNull()
? Aspect_TOM_USERDEFINED
: (theIsEnabled ? Aspect_TOM_O_POINT : Aspect_TOM_O_X);
}
//! Sets standard icon to light source.
void SetMarkerType(Aspect_TypeOfMarker theType, bool theIsEnabled)
{
myMarkerTypes[theIsEnabled ? 1 : 0] = theType;
}
//! Returns tessellation level for quadric surfaces; 30 by default.
Standard_Integer NbSplitsQuadric() const { return myNbSplitsQuadric; }
//! Sets tessellation level for quadric surfaces.
void SetNbSplitsQuadric(Standard_Integer theNbSplits) { myNbSplitsQuadric = theNbSplits; }
//! Returns tessellation level for arrows; 20 by default.
Standard_Integer NbSplitsArrow() const { return myNbSplitsArrow; }
//! Sets tessellation level for arrows.
void SetNbSplitsArrow(Standard_Integer theNbSplits) { myNbSplitsArrow = theNbSplits; }
//! Returns kind of the object.
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE
{
return AIS_KindOfInteractive_LightSource;
}
protected:
//! Return true if specified display mode is supported: 0 for main presentation and 1 for
//! highlight.
virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE
{
return theMode == 0 || theMode == 1;
}
//! Computes selection sensitive zones(triangulation) for light source presentation.
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Fills presentation.
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Drag object in the viewer.
//! @param[in] theCtx interactive context
//! @param[in] theView active View
//! @param[in] theOwner the owner of detected entity
//! @param[in] theDragFrom drag start point
//! @param[in] theDragTo drag end point
//! @param[in] theAction drag action
//! @return FALSE if object rejects dragging action (e.g. AIS_DragAction_Start)
Standard_EXPORT virtual Standard_Boolean ProcessDragging(
const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const Handle(SelectMgr_EntityOwner)& theOwner,
const Graphic3d_Vec2i& theDragFrom,
const Graphic3d_Vec2i& theDragTo,
const AIS_DragAction theAction) Standard_OVERRIDE;
//! Sets new local transformation, which is propagated to Graphic3d_CLight instance.
Standard_EXPORT virtual void setLocalTransformation(const Handle(TopLoc_Datum3D)& theTrsf)
Standard_OVERRIDE;
//! Updates local transformation basing on a type of light source.
Standard_EXPORT virtual void updateLightLocalTransformation();
//! Updates transform persistence basing on a type of light source.
Standard_EXPORT virtual void updateLightTransformPersistence();
//! Sets color of light.
Standard_EXPORT virtual void updateLightAspects();
//! Compute ambient light source presentation as a sphere at view corner.
Standard_EXPORT virtual void computeAmbient(const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode);
//! Compute directional light source presentation as a set of arrows at view corner.
Standard_EXPORT virtual void computeDirectional(const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode);
//! Compute positional light source presentation as a sphere of either fixed size (no range) or of
//! size representing a maximum range.
Standard_EXPORT virtual void computePositional(const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode);
//! Compute spot light source presentation as a cone.
Standard_EXPORT virtual void computeSpot(const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode);
protected:
Handle(Graphic3d_CLight) myLightSource; //!< displayed light source
// clang-format off
Handle(Graphic3d_AspectMarker3d) myDisabledMarkerAspect; //!< disabled light source marker style
Handle(Graphic3d_AspectLine3d) myArrowLineAspectShadow; //!< arrow shadow style
Handle(Graphic3d_MarkerImage) myMarkerImages[2]; //!< icon of disabled (0) and enabled (1) light
Handle(Select3D_SensitiveSphere) mySensSphere; //!< sensitive sphere of directional light source
Aspect_TypeOfMarker myMarkerTypes[2]; //!< icon of disabled (0) and enabled (1) light
Aspect_TypeOfMarker myCodirMarkerType; //!< icon of arrow co-directional to camera direction (look from)
Aspect_TypeOfMarker myOpposMarkerType; //!< icon of arrow opposite to camera direction (look at)
gp_Trsf myLocTrsfStart; //!< object transformation before transformation
Standard_Real mySize; //!< presentation size
Standard_Integer myNbArrows; //!< number of directional light arrows
Standard_Integer myNbSplitsQuadric; //!< tessellation level for quadric surfaces
Standard_Integer myNbSplitsArrow; //!< tessellation level for arrows
Standard_Integer mySensSphereArcSize; //! sensitive sphere arc size in pixels
Standard_Boolean myIsZoomable; //!< flag to allow/disallow transform-persistence when possible
Standard_Boolean myIsDraggable; //!< flag to allow/disallow rotate directional light source by dragging
// clang-format on
Standard_Boolean myToDisplayName; //!< flag to show/hide name
Standard_Boolean myToDisplayRange; //!< flag to show/hide range of positional/spot light
Standard_Boolean myToSwitchOnClick; //!< flag to handle mouse click to turn light on/off
};
//! Owner of AIS_LightSource presentation.
class AIS_LightSourceOwner : public SelectMgr_EntityOwner
{
DEFINE_STANDARD_RTTIEXT(AIS_LightSourceOwner, SelectMgr_EntityOwner)
public:
//! Main constructor.
Standard_EXPORT AIS_LightSourceOwner(const Handle(AIS_LightSource)& theObject,
Standard_Integer thePriority = 5);
//! Handle mouse button click event.
Standard_EXPORT virtual Standard_Boolean HandleMouseClick(const Graphic3d_Vec2i& thePoint,
Aspect_VKeyMouse theButton,
Aspect_VKeyFlags theModifiers,
bool theIsDoubleClick)
Standard_OVERRIDE;
//! Highlights selectable object's presentation with display mode in presentation manager with
//! given highlight style. Also a check for auto-highlight is performed - if selectable object
//! manages highlighting on its own, execution will be passed to
//! SelectMgr_SelectableObject::HilightOwnerWithColor method.
Standard_EXPORT virtual void HilightWithColor(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Always update dynamic highlighting.
Standard_EXPORT virtual Standard_Boolean IsForcedHilight() const Standard_OVERRIDE;
};
#endif // _AIS_LightSource_HeaderFile

View File

@ -0,0 +1,115 @@
// Created on: 1997-01-21
// Created by: Prestataire Christiane ARMAND
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_Line_HeaderFile
#define _AIS_Line_HeaderFile
#include "AIS_InteractiveObject.hxx"
#include "AIS_KindOfInteractive.hxx"
class Geom_Line;
class Geom_Point;
//! Constructs line datums to be used in construction of
//! composite shapes.
class AIS_Line : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(AIS_Line, AIS_InteractiveObject)
public:
//! Initializes the line aLine.
Standard_EXPORT AIS_Line(const Handle(Geom_Line)& aLine);
//! Initializes a starting point aStartPoint
//! and a finishing point aEndPoint for the line.
Standard_EXPORT AIS_Line(const Handle(Geom_Point)& aStartPoint,
const Handle(Geom_Point)& aEndPoint);
//! Returns the signature 5.
virtual Standard_Integer Signature() const Standard_OVERRIDE { return 5; }
//! Returns the type Datum.
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE
{
return AIS_KindOfInteractive_Datum;
}
//! Constructs an infinite line.
const Handle(Geom_Line)& Line() const { return myComponent; }
//! Returns the starting point thePStart and the end point thePEnd of the line set by SetPoints.
void Points(Handle(Geom_Point)& thePStart, Handle(Geom_Point)& thePEnd) const
{
thePStart = myStartPoint;
thePEnd = myEndPoint;
}
//! instantiates an infinite line.
void SetLine(const Handle(Geom_Line)& theLine)
{
myComponent = theLine;
myLineIsSegment = Standard_False;
}
//! Sets the starting point thePStart and ending point thePEnd of the
//! infinite line to create a finite line segment.
void SetPoints(const Handle(Geom_Point)& thePStart, const Handle(Geom_Point)& thePEnd)
{
myStartPoint = thePStart;
myEndPoint = thePEnd;
myLineIsSegment = Standard_True;
}
//! Provides a new color setting aColor for the line in the drawing tool, or "Drawer".
Standard_EXPORT void SetColor(const Quantity_Color& aColor) Standard_OVERRIDE;
//! Provides the new width setting aValue for the line in
//! the drawing tool, or "Drawer".
Standard_EXPORT void SetWidth(const Standard_Real aValue) Standard_OVERRIDE;
//! Removes the color setting and returns the original color.
Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
//! Removes the width setting and returns the original width.
Standard_EXPORT void UnsetWidth() Standard_OVERRIDE;
private:
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode) Standard_OVERRIDE;
Standard_EXPORT void ComputeInfiniteLine(const Handle(Prs3d_Presentation)& aPresentation);
Standard_EXPORT void ComputeSegmentLine(const Handle(Prs3d_Presentation)& aPresentation);
Standard_EXPORT void ComputeInfiniteLineSelection(const Handle(SelectMgr_Selection)& aSelection);
Standard_EXPORT void ComputeSegmentLineSelection(const Handle(SelectMgr_Selection)& aSelection);
//! Replace aspects of already computed groups with the new value.
void replaceWithNewLineAspect(const Handle(Prs3d_LineAspect)& theAspect);
private:
Handle(Geom_Line) myComponent;
Handle(Geom_Point) myStartPoint;
Handle(Geom_Point) myEndPoint;
Standard_Boolean myLineIsSegment;
};
DEFINE_STANDARD_HANDLE(AIS_Line, AIS_InteractiveObject)
#endif // _AIS_Line_HeaderFile

View File

@ -0,0 +1,19 @@
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef AIS_ListIteratorOfListOfInteractive_HeaderFile
#define AIS_ListIteratorOfListOfInteractive_HeaderFile
#include "AIS_ListOfInteractive.hxx"
#endif

View File

@ -0,0 +1,27 @@
// Created on: 1996-12-11
// Created by: Robert COUBLANC
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef AIS_ListOfInteractive_HeaderFile
#define AIS_ListOfInteractive_HeaderFile
#include "AIS_InteractiveObject.hxx"
#include "NCollection_List.hxx"
typedef NCollection_List<Handle(AIS_InteractiveObject)> AIS_ListOfInteractive;
typedef NCollection_List<Handle(AIS_InteractiveObject)>::Iterator
AIS_ListIteratorOfListOfInteractive;
#endif

View File

@ -0,0 +1,816 @@
// Created on: 2015-12-23
// Created by: Anastasia BORISOVA
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_Manipulator_HeaderFile
#define _AIS_Manipulator_HeaderFile
#include "AIS_InteractiveObject.hxx"
#include "AIS_ManipulatorMode.hxx"
#include "gp_Ax1.hxx"
#include "gp_Dir.hxx"
#include "gp_Pnt.hxx"
#include "Graphic3d_ArrayOfTriangles.hxx"
#include "Graphic3d_Group.hxx"
#include "NCollection_HSequence.hxx"
#include "Poly_Triangulation.hxx"
#include "V3d_View.hxx"
#include "Standard_DefineHandle.hxx"
NCOLLECTION_HSEQUENCE(AIS_ManipulatorObjectSequence, Handle(AIS_InteractiveObject))
DEFINE_STANDARD_HANDLE(AIS_Manipulator, AIS_InteractiveObject)
//! Interactive object class to manipulate local transformation of another interactive
//! object or a group of objects via mouse.
//! It manages three types of manipulations in 3D space:
//! - translation through axis
//! - scaling within axis
//! - rotation around axis
//! To enable one of this modes, selection mode (from 1 to 3) is to be activated.
//! There are three orthogonal transformation axes defined by position property of
//! the manipulator. Particular transformation mode can be disabled for each
//! of the axes or all of them. Furthermore each of the axes can be hidden or
//! made visible.
//! The following steps demonstrate how to attach, configure and use manipulator
//! for an interactive object:
//! Step 1. Create manipulator object and adjust it appearance:
//! @code
//! Handle(AIS_Manipulator) aManipulator = new AIS_Manipulator();
//! aManipulator->SetPart (0, AIS_Manipulator::Scaling, Standard_False);
//! aManipulator->SetPart (1, AIS_Manipulator::Rotation, Standard_False);
//! // Attach manipulator to already displayed object and manage manipulation modes
//! aManipulator->AttachToObject (anAISObject);
//! aManipulator->EnableMode (AIS_Manipulator::Translation);
//! aManipulator->EnableMode (AIS_Manipulator::Rotation);
//! aManipulator->EnableMode (AIS_Manipulator::Scaling);
//! @endcode
//! Note that you can enable only one manipulation mode but have all visual parts displayed.
//! This code allows you to view manipulator and select its manipulation parts.
//! Note that manipulator activates mode on part selection.
//! If this mode is activated, no selection will be performed for manipulator.
//! It can be activated with highlighting. To enable this:
//! @code
//! aManipulator->SetModeActivationOnDetection (Standard_True);
//! @endcode
//! Step 2. To perform transformation of object use next code in your event processing chain:
//! @code
//! // catch mouse button down event
//! if (aManipulator->HasActiveMode())
//! {
//! aManipulator->StartTransform (anXPix, anYPix, aV3dView);
//! }
//! ...
//! // or track mouse move event
//! if (aManipulator->HasActiveMode())
//! {
//! aManipulator->Transform (anXPix, anYPix, aV3dView);
//! aV3dView->Redraw();
//! }
//! ...
//! // or catch mouse button up event (apply) or escape event (cancel)
//! aManipulator->StopTransform(/*Standard_Boolean toApply*/);
//! @endcode
//! Step 3. To deactivate current manipulation mode use:
//! @code aManipulator->DeactivateCurrentMode();
//! @endcode
//! Step 4. To detach manipulator from object use:
//! @code
//! aManipulator->Detach();
//! @endcode
//! The last method erases manipulator object.
class AIS_Manipulator : public AIS_InteractiveObject
{
public:
//! Constructs a manipulator object with default placement and all parts to be displayed.
Standard_EXPORT AIS_Manipulator();
//! Constructs a manipulator object with input location and positions of axes and all parts to be
//! displayed.
Standard_EXPORT AIS_Manipulator(const gp_Ax2& thePosition);
//! Disable or enable visual parts for translation, rotation or scaling for some axis.
//! By default all parts are enabled (will be displayed).
//! @warning Enabling or disabling of visual parts of manipulator does not manage the manipulation
//! (selection) mode.
//! @warning Raises program error if axis index is < 0 or > 2.
Standard_EXPORT void SetPart(const Standard_Integer theAxisIndex,
const AIS_ManipulatorMode theMode,
const Standard_Boolean theIsEnabled);
//! Disable or enable visual parts for translation, rotation or scaling for ALL axes.
//! By default all parts are enabled (will be displayed).
//! @warning Enabling or disabling of visual parts of manipulator does not manage the manipulation
//! (selection) mode.
//! @warning Raises program error if axis index is < 0 or > 2.
Standard_EXPORT void SetPart(const AIS_ManipulatorMode theMode,
const Standard_Boolean theIsEnabled);
//! Behavior settings to be applied when performing transformation:
//! - FollowTranslation - whether the manipulator will be moved together with an object.
//! - FollowRotation - whether the manipulator will be rotated together with an object.
struct OptionsForAttach
{
OptionsForAttach()
: AdjustPosition(Standard_True),
AdjustSize(Standard_False),
EnableModes(Standard_True)
{
}
OptionsForAttach& SetAdjustPosition(const Standard_Boolean theApply)
{
AdjustPosition = theApply;
return *this;
}
OptionsForAttach& SetAdjustSize(const Standard_Boolean theApply)
{
AdjustSize = theApply;
return *this;
}
OptionsForAttach& SetEnableModes(const Standard_Boolean theApply)
{
EnableModes = theApply;
return *this;
}
Standard_Boolean AdjustPosition;
Standard_Boolean AdjustSize;
Standard_Boolean EnableModes;
};
//! Attaches himself to the input interactive object and become displayed in the same context.
//! It is placed in the center of object bounding box, and its size is adjusted to the object
//! bounding box.
Standard_EXPORT void Attach(const Handle(AIS_InteractiveObject)& theObject,
const OptionsForAttach& theOptions = OptionsForAttach());
//! Attaches himself to the input interactive object group and become displayed in the same
//! context. It become attached to the first object, baut manage manipulation of the whole group.
//! It is placed in the center of object bounding box, and its size is adjusted to the object
//! bounding box.
Standard_EXPORT void Attach(const Handle(AIS_ManipulatorObjectSequence)& theObject,
const OptionsForAttach& theOptions = OptionsForAttach());
//! Enable manipualtion mode.
//! @warning It activates selection mode in the current context.
//! If manipulator is not displayed, no mode will be activated.
Standard_EXPORT void EnableMode(const AIS_ManipulatorMode theMode);
//! Enables mode activation on detection (highlighting).
//! By default, mode is activated on selection of manipulator part.
//! @warning If this mode is enabled, selection of parts does nothing.
void SetModeActivationOnDetection(const Standard_Boolean theToEnable)
{
myIsActivationOnDetection = theToEnable;
}
//! @return true if manual mode activation is enabled.
Standard_Boolean IsModeActivationOnDetection() const { return myIsActivationOnDetection; }
public:
//! Drag object in the viewer.
//! @param[in] theCtx interactive context
//! @param[in] theView active View
//! @param[in] theOwner the owner of detected entity
//! @param[in] theDragFrom drag start point
//! @param[in] theDragTo drag end point
//! @param[in] theAction drag action
//! @return FALSE if object rejects dragging action (e.g. AIS_DragAction_Start)
Standard_EXPORT virtual Standard_Boolean ProcessDragging(
const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const Handle(SelectMgr_EntityOwner)& theOwner,
const Graphic3d_Vec2i& theDragFrom,
const Graphic3d_Vec2i& theDragTo,
const AIS_DragAction theAction) Standard_OVERRIDE;
//! Init start (reference) transformation.
//! @warning It is used in chain with StartTransform-Transform(gp_Trsf)-StopTransform
//! and is used only for custom transform set. If Transform(const Standard_Integer, const
//! Standard_Integer) is used, initial data is set automatically, and it is reset on
//! DeactivateCurrentMode call if it is not reset yet.
Standard_EXPORT void StartTransform(const Standard_Integer theX,
const Standard_Integer theY,
const Handle(V3d_View)& theView);
//! Apply to the owning objects the input transformation.
//! @remark The transformation is set using SetLocalTransformation for owning objects.
//! The location of the manipulator is stored also in Local Transformation,
//! so that there's no need to redisplay objects.
//! @warning It is used in chain with StartTransform-Transform(gp_Trsf)-StopTransform
//! and is used only for custom transform set.
//! @warning It will does nothing if transformation is not initiated (with StartTransform() call).
Standard_EXPORT void Transform(const gp_Trsf& aTrsf);
//! Apply camera transformation to flat skin manipulator
Standard_EXPORT void RecomputeTransformation(const Handle(Graphic3d_Camera)& theCamera)
Standard_OVERRIDE;
//! Recomputes sensitive primitives for the given selection mode.
//! @param theMode selection mode to recompute sensitive primitives
Standard_EXPORT void RecomputeSelection(const AIS_ManipulatorMode theMode);
//! Reset start (reference) transformation.
//! @param[in] theToApply option to apply or to cancel the started transformation.
//! @warning It is used in chain with StartTransform-Transform(gp_Trsf)-StopTransform
//! and is used only for custom transform set.
Standard_EXPORT void StopTransform(const Standard_Boolean theToApply = Standard_True);
//! Apply transformation made from mouse moving from start position
//! (save on the first Transform() call and reset on DeactivateCurrentMode() call.)
//! to the in/out mouse position (theX, theY)
Standard_EXPORT gp_Trsf Transform(const Standard_Integer theX,
const Standard_Integer theY,
const Handle(V3d_View)& theView);
//! Computes transformation of parent object according to the active mode and input motion vector.
//! You can use this method to get object transformation according to current mode or use own
//! algorithm to implement any other transformation for modes.
//! @return transformation of parent object.
Standard_EXPORT Standard_Boolean ObjectTransformation(const Standard_Integer theX,
const Standard_Integer theY,
const Handle(V3d_View)& theView,
gp_Trsf& theTrsf);
//! Make inactive the current selected manipulator part and reset current axis index and current
//! mode. After its call HasActiveMode() returns false.
//! @sa HasActiveMode()
Standard_EXPORT void DeactivateCurrentMode();
//! Detaches himself from the owner object, and removes itself from context.
Standard_EXPORT void Detach();
//! @return all owning objects.
Standard_EXPORT Handle(AIS_ManipulatorObjectSequence) Objects() const;
//! @return the first (leading) object of the owning objects.
Standard_EXPORT Handle(AIS_InteractiveObject) Object() const;
//! @return one of the owning objects.
//! @warning raises program error if theIndex is more than owning objects count or less than 1.
Standard_EXPORT Handle(AIS_InteractiveObject) Object(const Standard_Integer theIndex) const;
//! @return true if manipulator is attached to some interactive object (has owning object).
Standard_Boolean IsAttached() const { return HasOwner(); }
//! @return true if some part of manipulator is selected (transformation mode is active, and
//! owning object can be transformed).
Standard_Boolean HasActiveMode() const { return IsAttached() && myCurrentMode != AIS_MM_None; }
Standard_Boolean HasActiveTransformation() { return myHasStartedTransformation; }
gp_Trsf StartTransformation() const
{
return !myStartTrsfs.IsEmpty() ? myStartTrsfs.First() : gp_Trsf();
}
gp_Trsf StartTransformation(Standard_Integer theIndex) const
{
Standard_ProgramError_Raise_if(
theIndex < 1 || theIndex > Objects()->Upper(),
"AIS_Manipulator::StartTransformation(): theIndex is out of bounds");
return !myStartTrsfs.IsEmpty() ? myStartTrsfs(theIndex) : gp_Trsf();
}
public: //! @name Configuration of graphical transformations
//! Enable or disable zoom persistence mode for the manipulator. With
//! this mode turned on the presentation will keep fixed screen size.
//! @warning when turned on this option overrides transform persistence
//! properties and local transformation to achieve necessary visual effect.
//! @warning revise use of AdjustSize argument of of \sa AttachToObjects method
//! when enabling zoom persistence.
Standard_EXPORT void SetZoomPersistence(const Standard_Boolean theToEnable);
//! Returns state of zoom persistence mode, whether it turned on or off.
Standard_Boolean ZoomPersistence() const { return myIsZoomPersistentMode; }
//! Redefines transform persistence management to setup transformation for sub-presentation of
//! axes.
//! @warning this interactive object does not support custom transformation persistence when
//! using \sa ZoomPersistence mode. In this mode the transformation persistence flags for
//! presentations are overridden by this class.
//! @warning Invokes debug assertion to catch incompatible usage of the method with \sa
//! ZoomPersistence mode, silently does nothing in release mode.
//! @warning revise use of AdjustSize argument of of \sa AttachToObjects method
//! when enabling zoom persistence.
Standard_EXPORT virtual void SetTransformPersistence(
const Handle(Graphic3d_TransformPers)& theTrsfPers) Standard_OVERRIDE;
public: //! @name Setters for parameters
enum ManipulatorSkin
{
ManipulatorSkin_Shaded,
ManipulatorSkin_Flat
};
//! @return current manipulator skin mode.
ManipulatorSkin SkinMode() const { return mySkinMode; }
//! Sets skin mode for the manipulator.
Standard_EXPORT void SetSkinMode(const ManipulatorSkin theSkinMode);
AIS_ManipulatorMode ActiveMode() const { return myCurrentMode; }
Standard_Integer ActiveAxisIndex() const { return myCurrentIndex; }
//! @return poition of manipulator interactive object.
const gp_Ax2& Position() const { return myPosition; }
//! Sets position of the manipulator object.
Standard_EXPORT void SetPosition(const gp_Ax2& thePosition);
Standard_ShortReal Size() const { return myAxes[0].Size(); }
//! Sets size (length of side of the manipulator cubic bounding box.
Standard_EXPORT void SetSize(const Standard_ShortReal theSideLength);
//! Sets gaps between translator, scaler and rotator sub-presentations.
Standard_EXPORT void SetGap(const Standard_ShortReal theValue);
public:
//! Behavior settings to be applied when performing transformation:
//! - FollowTranslation - whether the manipulator will be moved together with an object.
//! - FollowRotation - whether the manipulator will be rotated together with an object.
struct BehaviorOnTransform
{
BehaviorOnTransform()
: FollowTranslation(Standard_True),
FollowRotation(Standard_True),
FollowDragging(Standard_True)
{
}
BehaviorOnTransform& SetFollowTranslation(const Standard_Boolean theApply)
{
FollowTranslation = theApply;
return *this;
}
BehaviorOnTransform& SetFollowRotation(const Standard_Boolean theApply)
{
FollowRotation = theApply;
return *this;
}
BehaviorOnTransform& SetFollowDragging(const Standard_Boolean theApply)
{
FollowDragging = theApply;
return *this;
}
Standard_Boolean FollowTranslation;
Standard_Boolean FollowRotation;
Standard_Boolean FollowDragging;
};
//! Sets behavior settings for transformation action carried on the manipulator,
//! whether it translates, rotates together with the transformed object or not.
void SetTransformBehavior(const BehaviorOnTransform& theSettings)
{
myBehaviorOnTransform = theSettings;
}
//! @return behavior settings for transformation action of the manipulator.
BehaviorOnTransform& ChangeTransformBehavior() { return myBehaviorOnTransform; }
//! @return behavior settings for transformation action of the manipulator.
const BehaviorOnTransform& TransformBehavior() const { return myBehaviorOnTransform; }
public: //! @name Presentation computation
//! Fills presentation.
//! @note Manipulator presentation does not use display mode and for all modes has the same
//! presentation.
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode = 0) Standard_OVERRIDE;
//! Computes selection sensitive zones (triangulation) for manipulator.
//! @param[in] theNode Selection mode that is treated as transformation mode.
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overridden
//! methods.
virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE { return Standard_False; }
//! Method which clear all selected owners belonging
//! to this selectable object ( for fast presentation draw ).
Standard_EXPORT virtual void ClearSelected() Standard_OVERRIDE;
//! Method which draws selected owners ( for fast presentation draw ).
Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager)& thePM,
const SelectMgr_SequenceOfOwner& theSeq)
Standard_OVERRIDE;
//! Method which hilight an owner belonging to
//! this selectable object ( for fast presentation draw ).
Standard_EXPORT virtual void HilightOwnerWithColor(
const Handle(PrsMgr_PresentationManager)& thePM,
const Handle(Prs3d_Drawer)& theStyle,
const Handle(SelectMgr_EntityOwner)& theOwner) Standard_OVERRIDE;
protected:
Standard_EXPORT void init();
Standard_EXPORT void updateTransformation();
Standard_EXPORT Handle(Prs3d_Presentation) getHighlightPresentation(
const Handle(SelectMgr_EntityOwner)& theOwner) const;
Standard_EXPORT Handle(Graphic3d_Group) getGroup(const Standard_Integer theIndex,
const AIS_ManipulatorMode theMode) const;
Standard_EXPORT void attachToPoint(const gp_Pnt& thePoint);
Standard_EXPORT void attachToBox(const Bnd_Box& theBox);
Standard_EXPORT void adjustSize(const Bnd_Box& theBox);
Standard_EXPORT void setTransformPersistence(const Handle(Graphic3d_TransformPers)& theTrsfPers);
//! Redefines local transformation management method to inform user of improper use.
//! @warning this interactive object does not support setting custom local transformation,
//! this class solely uses this property to implement visual positioning of the manipulator
//! without need for recomputing presentation.
//! @warning Invokes debug assertion in debug to catch incompatible usage of the
//! method, silently does nothing in release mode.
Standard_EXPORT virtual void setLocalTransformation(const Handle(TopLoc_Datum3D)& theTrsf)
Standard_OVERRIDE;
using AIS_InteractiveObject::SetLocalTransformation; // hide visibility
protected: //! @name Auxiliary classes to fill presentation with proper primitives
class Quadric
{
public:
virtual ~Quadric()
{
myTriangulation.Nullify();
myArray.Nullify();
}
const Handle(Poly_Triangulation)& Triangulation() const { return myTriangulation; }
const Handle(Graphic3d_ArrayOfTriangles)& Array() const { return myArray; }
protected:
Handle(Poly_Triangulation) myTriangulation;
Handle(Graphic3d_ArrayOfTriangles) myArray;
};
class Disk : public Quadric
{
public:
Disk()
: Quadric(),
myInnerRad(0.0f),
myOuterRad(1.0f)
{
}
~Disk() {}
void Init(const Standard_ShortReal theInnerRadius,
const Standard_ShortReal theOuterRadius,
const gp_Ax1& thePosition,
const Standard_Real theAngle,
const Standard_Integer theSlicesNb = 20,
const Standard_Integer theStacksNb = 20);
protected:
gp_Ax1 myPosition;
Standard_ShortReal myInnerRad;
Standard_ShortReal myOuterRad;
};
class Sphere : public Quadric
{
public:
Sphere()
: Quadric(),
myRadius(1.0f)
{
}
void Init(const Standard_ShortReal theRadius,
const gp_Pnt& thePosition,
const ManipulatorSkin theSkinMode,
const Standard_Integer theSlicesNb = 20,
const Standard_Integer theStacksNb = 20);
protected:
gp_Pnt myPosition;
Standard_ShortReal myRadius;
};
class Cube
{
public:
Cube() {}
~Cube() {}
void Init(const gp_Ax1& thePosition,
const Standard_ShortReal myBoxSize,
const ManipulatorSkin theSkinMode);
const Handle(Poly_Triangulation)& Triangulation() const { return myTriangulation; }
const Handle(Graphic3d_ArrayOfTriangles)& Array() const { return myArray; }
private:
void addTriangle(const Standard_Integer theIndex,
const gp_Pnt& theP1,
const gp_Pnt& theP2,
const gp_Pnt& theP3,
const gp_Dir& theNormal);
protected:
Handle(Poly_Triangulation) myTriangulation;
Handle(Graphic3d_ArrayOfTriangles) myArray;
};
class Sector : public Quadric
{
public:
Sector()
: Quadric(),
myRadius(0.0f)
{
}
~Sector() {}
void Init(const Standard_ShortReal theRadius,
const gp_Ax1& thePosition,
const gp_Dir& theXDirection,
const ManipulatorSkin theSkinMode,
const Standard_Integer theSlicesNb = 5,
const Standard_Integer theStacksNb = 5);
protected:
gp_Ax1 myPosition;
Standard_ShortReal myRadius;
};
//! The class describes on axis sub-object.
//! It includes sub-objects itself:
//! -rotator
//! -translator
//! -scaler
class Axis
{
public:
Axis(const gp_Ax1& theAxis = gp_Ax1(),
const Quantity_Color& theColor = Quantity_Color(),
const Standard_ShortReal theLength = 10.0f);
void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Handle(Prs3d_ShadingAspect)& theAspect,
const ManipulatorSkin theSkinMode);
const gp_Ax1& ReferenceAxis() const { return myReferenceAxis; }
void SetPosition(const gp_Ax1& thePosition) { myPosition = thePosition; }
const gp_Ax1& Position() const { return myPosition; }
void SetTransformPersistence(const Handle(Graphic3d_TransformPers)& theTrsfPers)
{
if (!myHighlightTranslator.IsNull())
{
myHighlightTranslator->SetTransformPersistence(theTrsfPers);
}
if (!myHighlightScaler.IsNull())
{
myHighlightScaler->SetTransformPersistence(theTrsfPers);
}
if (!myHighlightRotator.IsNull())
{
myHighlightRotator->SetTransformPersistence(theTrsfPers);
}
if (!myHighlightDragger.IsNull())
{
myHighlightDragger->SetTransformPersistence(theTrsfPers);
}
}
void Transform(const Handle(TopLoc_Datum3D)& theTransformation)
{
if (!myHighlightTranslator.IsNull())
{
myHighlightTranslator->SetTransformation(theTransformation);
}
if (!myHighlightScaler.IsNull())
{
myHighlightScaler->SetTransformation(theTransformation);
}
if (!myHighlightRotator.IsNull())
{
myHighlightRotator->SetTransformation(theTransformation);
}
if (!myHighlightDragger.IsNull())
{
myHighlightDragger->SetTransformation(theTransformation);
}
}
Standard_Boolean HasTranslation() const { return myHasTranslation; }
Standard_Boolean HasRotation() const { return myHasRotation; }
Standard_Boolean HasScaling() const { return myHasScaling; }
Standard_Boolean HasDragging() const { return myHasDragging; }
void SetTranslation(const Standard_Boolean theIsEnabled) { myHasTranslation = theIsEnabled; }
void SetRotation(const Standard_Boolean theIsEnabled) { myHasRotation = theIsEnabled; }
void SetScaling(const Standard_Boolean theIsEnabled) { myHasScaling = theIsEnabled; }
void SetDragging(const Standard_Boolean theIsEnabled) { myHasDragging = theIsEnabled; }
Quantity_Color Color() const { return myColor; }
Standard_ShortReal AxisLength() const { return myLength; }
Standard_ShortReal BoxSize() const { return myBoxSize; }
Standard_ShortReal AxisRadius() const { return myAxisRadius; }
Standard_ShortReal Indent() const { return myIndent; }
void SetAxisRadius(const Standard_ShortReal theValue) { myAxisRadius = theValue; }
const Handle(Prs3d_Presentation)& TranslatorHighlightPrs() const
{
return myHighlightTranslator;
}
const Handle(Prs3d_Presentation)& RotatorHighlightPrs() const { return myHighlightRotator; }
const Handle(Prs3d_Presentation)& ScalerHighlightPrs() const { return myHighlightScaler; }
const Handle(Prs3d_Presentation)& DraggerHighlightPrs() const { return myHighlightDragger; }
const Handle(Graphic3d_Group)& TranslatorGroup() const { return myTranslatorGroup; }
const Handle(Graphic3d_Group)& RotatorGroup() const { return myRotatorGroup; }
const Handle(Graphic3d_Group)& ScalerGroup() const { return myScalerGroup; }
const Handle(Graphic3d_Group)& DraggerGroup() const { return myDraggerGroup; }
const Handle(Graphic3d_ArrayOfTriangles)& TriangleArray() const { return myTriangleArray; }
void SetIndent(const Standard_ShortReal theValue) { myIndent = theValue; }
Standard_ShortReal Size() const { return myInnerRadius + myDiskThickness + myIndent * 2; }
Standard_ShortReal InnerRadius() const { return myInnerRadius + myIndent * 2.0f; }
gp_Pnt ScalerCenter(const gp_Pnt& theLocation) const
{
return theLocation.XYZ()
+ myPosition.Direction().XYZ() * (myLength + myIndent + myBoxSize * 0.5f);
}
void SetSize(const Standard_ShortReal theValue)
{
if (myIndent > theValue * 0.1f)
{
myLength = theValue * 0.7f;
myBoxSize = theValue * 0.15f;
myDiskThickness = theValue * 0.05f;
myIndent = theValue * 0.05f;
}
else // use pre-set value of predent
{
Standard_ShortReal aLength = theValue - 2 * myIndent;
myLength = aLength * 0.8f;
myBoxSize = aLength * 0.15f;
myDiskThickness = aLength * 0.05f;
}
myInnerRadius = myIndent * 2 + myBoxSize + myLength;
myAxisRadius = myBoxSize / 4.0f;
}
Standard_Integer FacettesNumber() const { return myFacettesNumber; }
public:
const gp_Pnt& TranslatorTipPosition() const { return myArrowTipPos; }
const Sector& DraggerSector() const { return mySector; }
const Disk& RotatorDisk() const { return myCircle; }
float RotatorDiskRadius() const { return myCircleRadius; }
const Cube& ScalerCube() const { return myCube; }
const gp_Pnt& ScalerCubePosition() const { return myCubePos; }
protected:
gp_Ax1 myReferenceAxis; //!< Returns reference axis assignment.
gp_Ax1 myPosition; //!< Position of the axis including local transformation.
Quantity_Color myColor;
Standard_Boolean myHasTranslation;
Standard_ShortReal myLength; //!< Length of translation axis.
Standard_ShortReal myAxisRadius;
Standard_Boolean myHasScaling;
Standard_ShortReal myBoxSize; //!< Size of scaling cube.
Standard_Boolean myHasRotation;
Standard_ShortReal myInnerRadius; //!< Radius of rotation circle.
Standard_ShortReal myDiskThickness;
Standard_ShortReal myIndent; //!< Gap between visual part of the manipulator.
Standard_Boolean myHasDragging;
protected:
Standard_Integer myFacettesNumber;
gp_Pnt myArrowTipPos;
Sector mySector;
Disk myCircle;
float myCircleRadius;
Cube myCube;
gp_Pnt myCubePos;
Handle(Graphic3d_Group) myTranslatorGroup;
Handle(Graphic3d_Group) myScalerGroup;
Handle(Graphic3d_Group) myRotatorGroup;
Handle(Graphic3d_Group) myDraggerGroup;
Handle(Prs3d_Presentation) myHighlightTranslator;
Handle(Prs3d_Presentation) myHighlightScaler;
Handle(Prs3d_Presentation) myHighlightRotator;
Handle(Prs3d_Presentation) myHighlightDragger;
Handle(Graphic3d_ArrayOfTriangles) myTriangleArray;
};
protected:
Axis myAxes[3]; //!< Tree axes of the manipulator.
Sphere myCenter; //!< Visual part displaying the center sphere of the manipulator.
// clang-format off
gp_Ax2 myPosition; //!< Position of the manipulator object. it displays its location and position of its axes.
Disk myCircle; //!< Outer circle
Handle(Graphic3d_Group) myCircleGroup;
Disk mySector; //!< Sector indicating the rotation angle
Handle(Graphic3d_Group) mySectorGroup;
Standard_Integer myCurrentIndex; //!< Index of active axis.
AIS_ManipulatorMode myCurrentMode; //!< Name of active manipulation mode.
ManipulatorSkin mySkinMode; //!< Name of active skin mode.
Standard_Boolean myIsActivationOnDetection; //!< Manual activation of modes (not on parts selection).
Standard_Boolean myIsZoomPersistentMode; //!< Zoom persistence mode activation.
BehaviorOnTransform myBehaviorOnTransform; //!< Behavior settings applied on manipulator when transforming an object.
protected: //! @name Fields for interactive transformation. Fields only for internal needs. They do not have public interface.
NCollection_Sequence<gp_Trsf> myStartTrsfs; //!< Owning object transformation for start. It is used internally.
Standard_Boolean myHasStartedTransformation; //!< Shows if transformation is processed (sequential calls of Transform()).
// clang-format on
gp_Ax2 myStartPosition; //! Start position of manipulator.
gp_Pnt myStartPick; //! 3d point corresponding to start mouse pick.
Standard_Real myPrevState; //! Previous value of angle during rotation.
//! Aspect used to color current detected part and current selected part.
Handle(Prs3d_ShadingAspect) myHighlightAspect;
//! Aspect used to color sector part when it's selected.
Handle(Prs3d_ShadingAspect) myDraggerHighlight;
public:
DEFINE_STANDARD_RTTIEXT(AIS_Manipulator, AIS_InteractiveObject)
};
#endif // _AIS_Manipulator_HeaderFile

View File

@ -0,0 +1,29 @@
// Created on: 2015-02-05
// Created by: Anastasia BORISOVA
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_ManipulatorMode_HeaderFile
#define _AIS_ManipulatorMode_HeaderFile
//! Mode to make definite kind of transformations with AIS_Manipulator object.
enum AIS_ManipulatorMode
{
AIS_MM_None = 0,
AIS_MM_Translation = 1,
AIS_MM_Rotation,
AIS_MM_Scaling,
AIS_MM_TranslationPlane
};
#endif

View File

@ -0,0 +1,58 @@
// Created on: 2015-12-23
// Created by: Anastasia BORISOVA
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_ManipulatorOwner_HeaderFile
#define _AIS_ManipulatorOwner_HeaderFile
#include "AIS_Manipulator.hxx"
#include "SelectMgr_EntityOwner.hxx"
#include "SelectMgr_SelectableObject.hxx"
DEFINE_STANDARD_HANDLE(AIS_ManipulatorOwner, SelectMgr_EntityOwner)
//! Entity owner for selection management of AIS_Manipulator object.
class AIS_ManipulatorOwner : public SelectMgr_EntityOwner
{
public:
DEFINE_STANDARD_RTTIEXT(AIS_ManipulatorOwner, SelectMgr_EntityOwner)
Standard_EXPORT AIS_ManipulatorOwner(const Handle(SelectMgr_SelectableObject)& theSelObject,
const Standard_Integer theIndex,
const AIS_ManipulatorMode theMode,
const Standard_Integer thePriority = 0);
Standard_EXPORT virtual void HilightWithColor(const Handle(PrsMgr_PresentationManager)& thePM,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode) Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean
IsHilighted(const Handle(PrsMgr_PresentationManager)& thePM,
const Standard_Integer theMode) const Standard_OVERRIDE;
Standard_EXPORT virtual void Unhilight(const Handle(PrsMgr_PresentationManager)& thePM,
const Standard_Integer theMode) Standard_OVERRIDE;
AIS_ManipulatorMode Mode() const { return myMode; }
//! @return index of manipulator axis.
Standard_Integer Index() const { return myIndex; }
protected:
Standard_Integer myIndex; //!< index of manipulator axis.
AIS_ManipulatorMode myMode; //!< manipulation (highlight) mode.
};
#endif // _AIS_ManipulatorOwner_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_MaxRadiusDimension_HeaderFile
#define _AIS_MaxRadiusDimension_HeaderFile
#include "PrsDim_MaxRadiusDimension.hxx"
Standard_DEPRECATED("Deprecated alias to moved class")
typedef PrsDim_MaxRadiusDimension AIS_MaxRadiusDimension;
#endif // _AIS_MaxRadiusDimension_HeaderFile

View File

@ -0,0 +1,95 @@
// Created by: Kirill GAVRILOV
// Copyright (c) 2019 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_MediaPlayer_HeaderFile
#define _AIS_MediaPlayer_HeaderFile
#include "AIS_InteractiveObject.hxx"
#include "Graphic3d_MediaTextureSet.hxx"
class Media_PlayerContext;
//! Presentation for video playback.
class AIS_MediaPlayer : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(AIS_MediaPlayer, AIS_InteractiveObject)
public:
//! Empty constructor.
Standard_EXPORT AIS_MediaPlayer();
//! Destructor.
Standard_EXPORT virtual ~AIS_MediaPlayer();
//! Setup callback to be called on queue progress (e.g. when new frame should be displayed).
void SetCallback(Graphic3d_MediaTextureSet::CallbackOnUpdate_t theCallbackFunction,
void* theCallbackUserPtr)
{
myFramePair->SetCallback(theCallbackFunction, theCallbackUserPtr);
}
//! Open specified file.
Standard_EXPORT void OpenInput(const TCollection_AsciiString& thePath,
Standard_Boolean theToWait);
//! Display new frame.
Standard_EXPORT bool PresentFrame(const Graphic3d_Vec2i& theLeftCorner,
const Graphic3d_Vec2i& theMaxSize);
//! Return player context.
const Handle(Media_PlayerContext)& PlayerContext() const { return myFramePair->PlayerContext(); }
//! Switch playback state.
Standard_EXPORT void PlayPause();
//! Schedule player to be closed.
void SetClosePlayer()
{
myToClosePlayer = true;
myFramePair->Notify();
}
//! Return duration.
double Duration() const { return myFramePair->Duration(); }
//! @name AIS_InteractiveObject interface
protected:
//! Accept only display mode 0.
virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE
{
return theMode == 0;
}
//! Compute presentation.
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Compute selection
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode) Standard_OVERRIDE;
protected:
//! Update frame size.
Standard_EXPORT bool updateSize(const Graphic3d_Vec2i& theLeftCorner,
const Graphic3d_Vec2i& theMaxSize);
protected:
Handle(Graphic3d_MediaTextureSet) myFramePair;
Handle(Graphic3d_AspectFillArea3d) myFrameAspect;
Graphic3d_Vec2i myFrameBottomLeft;
Graphic3d_Vec2i myFrameSize;
bool myToClosePlayer;
};
#endif // _AIS_MediaPlayer_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_MidPointRelation_HeaderFile
#define _AIS_MidPointRelation_HeaderFile
#include "PrsDim_MidPointRelation.hxx"
Standard_DEPRECATED("Deprecated alias to moved class")
typedef PrsDim_MidPointRelation AIS_MidPointRelation;
#endif // _AIS_MidPointRelation_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_MinRadiusDimension_HeaderFile
#define _AIS_MinRadiusDimension_HeaderFile
#include "PrsDim_MinRadiusDimension.hxx"
Standard_DEPRECATED("Deprecated alias to moved class")
typedef PrsDim_MinRadiusDimension AIS_MinRadiusDimension;
#endif // _AIS_MinRadiusDimension_HeaderFile

View File

@ -0,0 +1,51 @@
// Copyright (c) 2019 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_MouseGesture_HeaderFile
#define _AIS_MouseGesture_HeaderFile
#include "AIS_SelectionScheme.hxx"
#include "NCollection_DataMap.hxx"
//! Mouse gesture - only one can be active at one moment.
enum AIS_MouseGesture
{
AIS_MouseGesture_NONE, //!< no active gesture
//
AIS_MouseGesture_SelectRectangle, //!< rectangular selection;
//! press button to start, move mouse to define rectangle,
//! release to finish
AIS_MouseGesture_SelectLasso, //!< polygonal selection;
//! press button to start, move mouse to define polygonal path,
//! release to finish
//
AIS_MouseGesture_Zoom, //!< view zoom gesture;
//! move mouse left to zoom-out, and to the right to zoom-in
AIS_MouseGesture_ZoomVertical, //!< view zoom gesture;
//! move mouse up to zoom-out, and to the down to zoom-in
AIS_MouseGesture_ZoomWindow, //!< view zoom by window gesture;
//! press button to start, move mouse to define rectangle, release
//! to finish
AIS_MouseGesture_Pan, //!< view panning gesture
AIS_MouseGesture_RotateOrbit, //!< orbit rotation gesture
AIS_MouseGesture_RotateView, //!< view rotation gesture
AIS_MouseGesture_Drag, //!< object dragging;
//! press button to start, move mouse to define rectangle, release to
//! finish
};
//! Map defining mouse gestures.
typedef NCollection_DataMap<unsigned int, AIS_MouseGesture> AIS_MouseGestureMap;
typedef NCollection_DataMap<unsigned int, AIS_SelectionScheme> AIS_MouseSelectionSchemeMap;
#endif // _AIS_MouseGesture_HeaderFile

View File

@ -0,0 +1,149 @@
// Created on: 1997-04-22
// Created by: Guest Design
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_MultipleConnectedInteractive_HeaderFile
#define _AIS_MultipleConnectedInteractive_HeaderFile
#include "AIS_InteractiveObject.hxx"
#include "AIS_KindOfInteractive.hxx"
//! Defines an Interactive Object by gathering together
//! several object presentations. This is done through a
//! list of interactive objects. These can also be
//! Connected objects. That way memory-costly
//! calculations of presentation are avoided.
class AIS_MultipleConnectedInteractive : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(AIS_MultipleConnectedInteractive, AIS_InteractiveObject)
public:
//! Initializes the Interactive Object with multiple
//! connections to AIS_Interactive objects.
Standard_EXPORT AIS_MultipleConnectedInteractive();
//! Establishes the connection between the Connected Interactive Object, theInteractive, and its
//! reference. Locates instance in theLocation and applies specified transformation persistence
//! mode.
//! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
Handle(AIS_InteractiveObject) Connect(const Handle(AIS_InteractiveObject)& theAnotherObj,
const Handle(TopLoc_Datum3D)& theLocation,
const Handle(Graphic3d_TransformPers)& theTrsfPers)
{
return connect(theAnotherObj, theLocation, theTrsfPers);
}
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE
{
return AIS_KindOfInteractive_Object;
}
virtual Standard_Integer Signature() const Standard_OVERRIDE { return 1; }
//! Returns true if the object is connected to others.
Standard_EXPORT Standard_Boolean HasConnection() const;
//! Removes the connection with theInteractive.
Standard_EXPORT void Disconnect(const Handle(AIS_InteractiveObject)& theInteractive);
//! Clears all the connections to objects.
Standard_EXPORT void DisconnectAll();
//! Informs the graphic context that the interactive Object
//! may be decomposed into sub-shapes for dynamic selection.
Standard_EXPORT virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE;
//! Returns common entity owner if the object is an assembly
virtual const Handle(SelectMgr_EntityOwner)& GetAssemblyOwner() const Standard_OVERRIDE
{
return myAssemblyOwner;
}
//! Returns the owner of mode for selection of object as a whole
virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE
{
return myAssemblyOwner;
}
//! Assigns interactive context.
Standard_EXPORT virtual void SetContext(const Handle(AIS_InteractiveContext)& theCtx)
Standard_OVERRIDE;
public: // short aliases to Connect() method
//! Establishes the connection between the Connected Interactive Object, theInteractive, and its
//! reference. Copies local transformation and transformation persistence mode from
//! theInteractive.
//! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
Handle(AIS_InteractiveObject) Connect(const Handle(AIS_InteractiveObject)& theAnotherObj)
{
return connect(theAnotherObj,
theAnotherObj->LocalTransformationGeom(),
theAnotherObj->TransformPersistence());
}
//! Establishes the connection between the Connected Interactive Object, theInteractive, and its
//! reference. Locates instance in theLocation and copies transformation persistence mode from
//! theInteractive.
//! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
Handle(AIS_InteractiveObject) Connect(const Handle(AIS_InteractiveObject)& theAnotherObj,
const gp_Trsf& theLocation)
{
return connect(theAnotherObj,
new TopLoc_Datum3D(theLocation),
theAnotherObj->TransformPersistence());
}
//! Establishes the connection between the Connected Interactive Object, theInteractive, and its
//! reference. Locates instance in theLocation and applies specified transformation persistence
//! mode.
//! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
Handle(AIS_InteractiveObject) Connect(const Handle(AIS_InteractiveObject)& theAnotherObj,
const gp_Trsf& theLocation,
const Handle(Graphic3d_TransformPers)& theTrsfPers)
{
return connect(theAnotherObj, new TopLoc_Datum3D(theLocation), theTrsfPers);
}
protected:
//! this method is redefined virtual;
//! when the instance is connected to another
//! InteractiveObject,this method doesn't
//! compute anything, but just uses the
//! presentation of this last object, with
//! a transformation if there's one stored.
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Establishes the connection between the Connected Interactive Object, theInteractive, and its
//! reference. Locates instance in theLocation and applies specified transformation persistence
//! mode.
//! @return created instance object (AIS_ConnectedInteractive or AIS_MultipleConnectedInteractive)
Standard_EXPORT virtual Handle(AIS_InteractiveObject) connect(
const Handle(AIS_InteractiveObject)& theInteractive,
const Handle(TopLoc_Datum3D)& theLocation,
const Handle(Graphic3d_TransformPers)& theTrsfPers);
private:
//! Computes the selection for whole subtree in scene hierarchy.
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer aMode) Standard_OVERRIDE;
protected:
Handle(SelectMgr_EntityOwner) myAssemblyOwner;
};
DEFINE_STANDARD_HANDLE(AIS_MultipleConnectedInteractive, AIS_InteractiveObject)
#endif // _AIS_MultipleConnectedInteractive_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_NArray1OfEntityOwner_HeaderFile
#define _AIS_NArray1OfEntityOwner_HeaderFile
#include "NCollection_Array1.hxx"
#include "SelectMgr_EntityOwner.hxx"
typedef NCollection_Array1<Handle(SelectMgr_EntityOwner)> AIS_NArray1OfEntityOwner;
#endif // _AIS_NArray1OfEntityOwner_HeaderFile

View File

@ -0,0 +1,24 @@
// Created on: 2003-05-04
// Created by: Alexander Grigoriev (a-grigoriev@opencascade.com)
// Copyright (c) 2003-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_NListTransient_HeaderFile
#define _AIS_NListTransient_HeaderFile
#include "SelectMgr_EntityOwner.hxx"
#include "NCollection_List.hxx"
typedef NCollection_List<Handle(SelectMgr_EntityOwner)> AIS_NListOfEntityOwner;
#endif

View File

@ -0,0 +1,31 @@
// Copyright (c) 2019 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_NavigationMode_HeaderFile
#define _AIS_NavigationMode_HeaderFile
//! Camera navigation mode.
enum AIS_NavigationMode
{
AIS_NavigationMode_Orbit, //!< orbit rotation
AIS_NavigationMode_FirstPersonFlight, //!< flight rotation (first person)
AIS_NavigationMode_FirstPersonWalk, //!< walking mode (first person)
};
enum
{
AIS_NavigationMode_LOWER = 0,
AIS_NavigationMode_UPPER = AIS_NavigationMode_FirstPersonWalk
};
#endif // _V3d_NavigationMode_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_OffsetDimension_HeaderFile
#define _AIS_OffsetDimension_HeaderFile
#include "PrsDim_OffsetDimension.hxx"
Standard_DEPRECATED("Deprecated alias to moved class")
typedef PrsDim_OffsetDimension AIS_OffsetDimension;
#endif // _AIS_OffsetDimension_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_ParallelRelation_HeaderFile
#define _AIS_ParallelRelation_HeaderFile
#include "PrsDim_ParallelRelation.hxx"
Standard_DEPRECATED("Deprecated alias to moved class")
typedef PrsDim_ParallelRelation AIS_ParallelRelation;
#endif // _AIS_ParallelRelation_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_PerpendicularRelation_HeaderFile
#define _AIS_PerpendicularRelation_HeaderFile
#include "PrsDim_PerpendicularRelation.hxx"
Standard_DEPRECATED("Deprecated alias to moved class")
typedef PrsDim_PerpendicularRelation AIS_PerpendicularRelation;
#endif // _AIS_PerpendicularRelation_HeaderFile

View File

@ -0,0 +1,200 @@
// Created on: 1995-08-02
// Created by: Arnaud BOUZY/Odile Olivier
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_Plane_HeaderFile
#define _AIS_Plane_HeaderFile
#include "AIS_InteractiveObject.hxx"
#include "AIS_TypeOfPlane.hxx"
#include "gp_Pnt.hxx"
#include "Select3D_TypeOfSensitivity.hxx"
class Geom_Plane;
class Geom_Axis2Placement;
//! Constructs plane datums to be used in construction of
//! composite shapes.
class AIS_Plane : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(AIS_Plane, AIS_InteractiveObject)
public:
//! initializes the plane aComponent. If
//! the mode aCurrentMode equals true, the drawing
//! tool, "Drawer" is not initialized.
Standard_EXPORT AIS_Plane(const Handle(Geom_Plane)& aComponent,
const Standard_Boolean aCurrentMode = Standard_False);
//! initializes the plane aComponent and
//! the point aCenter. If the mode aCurrentMode
//! equals true, the drawing tool, "Drawer" is not
//! initialized. aCurrentMode equals true, the drawing
//! tool, "Drawer" is not initialized.
Standard_EXPORT AIS_Plane(const Handle(Geom_Plane)& aComponent,
const gp_Pnt& aCenter,
const Standard_Boolean aCurrentMode = Standard_False);
//! initializes the plane aComponent, the
//! point aCenter, and the minimum and maximum
//! points, aPmin and aPmax. If the mode
//! aCurrentMode equals true, the drawing tool, "Drawer" is not initialized.
Standard_EXPORT AIS_Plane(const Handle(Geom_Plane)& aComponent,
const gp_Pnt& aCenter,
const gp_Pnt& aPmin,
const gp_Pnt& aPmax,
const Standard_Boolean aCurrentMode = Standard_False);
Standard_EXPORT AIS_Plane(const Handle(Geom_Axis2Placement)& aComponent,
const AIS_TypeOfPlane aPlaneType,
const Standard_Boolean aCurrentMode = Standard_False);
//! Same value for x and y directions
Standard_EXPORT void SetSize(const Standard_Real aValue);
//! Sets the size defined by the length along the X axis
//! XVal and the length along the Y axis YVal.
Standard_EXPORT void SetSize(const Standard_Real Xval, const Standard_Real YVal);
Standard_EXPORT void UnsetSize();
Standard_EXPORT Standard_Boolean Size(Standard_Real& X, Standard_Real& Y) const;
Standard_Boolean HasOwnSize() const { return myHasOwnSize; }
//! Sets transform persistence for zoom with value of minimum size
Standard_EXPORT void SetMinimumSize(const Standard_Real theValue);
//! Unsets transform persistence zoom
Standard_EXPORT void UnsetMinimumSize();
//! Returns true if transform persistence for zoom is set
Standard_EXPORT Standard_Boolean HasMinimumSize() const;
virtual Standard_Integer Signature() const Standard_OVERRIDE { return 7; }
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE
{
return AIS_KindOfInteractive_Datum;
}
//! Returns the component specified in SetComponent.
const Handle(Geom_Plane)& Component() { return myComponent; }
//! Creates an instance of the plane aComponent.
Standard_EXPORT void SetComponent(const Handle(Geom_Plane)& aComponent);
//! Returns the settings for the selected plane
//! aComponent, provided in SetPlaneAttributes.
//! These include the points aCenter, aPmin, and aPmax
Standard_EXPORT Standard_Boolean PlaneAttributes(Handle(Geom_Plane)& aComponent,
gp_Pnt& aCenter,
gp_Pnt& aPmin,
gp_Pnt& aPmax);
//! Allows you to provide settings other than default ones
//! for the selected plane. These include: center point
//! aCenter, maximum aPmax and minimum aPmin.
Standard_EXPORT void SetPlaneAttributes(const Handle(Geom_Plane)& aComponent,
const gp_Pnt& aCenter,
const gp_Pnt& aPmin,
const gp_Pnt& aPmax);
//! Returns the coordinates of the center point.
const gp_Pnt& Center() const { return myCenter; }
//! Provides settings for the center theCenter other than (0, 0, 0).
void SetCenter(const gp_Pnt& theCenter) { myCenter = theCenter; }
//! Allows you to provide settings for the position and
//! direction of one of the plane's axes, aComponent, in
//! 3D space. The coordinate system used is
//! right-handed, and the type of plane aPlaneType is one of:
//! - AIS_ TOPL_Unknown
//! - AIS_ TOPL_XYPlane
//! - AIS_ TOPL_XZPlane
//! - AIS_ TOPL_YZPlane}.
Standard_EXPORT void SetAxis2Placement(const Handle(Geom_Axis2Placement)& aComponent,
const AIS_TypeOfPlane aPlaneType);
//! Returns the position of the plane's axis2 system
//! identifying the x, y, or z axis and giving the plane a
//! direction in 3D space. An axis2 system is a right-handed coordinate system.
Standard_EXPORT Handle(Geom_Axis2Placement) Axis2Placement();
//! Returns the type of plane - xy, yz, xz or unknown.
AIS_TypeOfPlane TypeOfPlane() { return myTypeOfPlane; }
//! Returns the type of plane - xy, yz, or xz.
Standard_Boolean IsXYZPlane() { return myIsXYZPlane; }
//! Returns the non-default current display mode set by SetCurrentMode.
Standard_Boolean CurrentMode() { return myCurrentMode; }
//! Allows you to provide settings for a non-default
//! current display mode.
void SetCurrentMode(const Standard_Boolean theCurrentMode) { myCurrentMode = theCurrentMode; }
//! Returns true if the display mode selected, aMode, is valid for planes.
Standard_EXPORT virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer aMode) const
Standard_OVERRIDE;
//! connection to <aCtx> default drawer implies a recomputation of Frame values.
Standard_EXPORT virtual void SetContext(const Handle(AIS_InteractiveContext)& aCtx)
Standard_OVERRIDE;
//! Returns the type of sensitivity for the plane;
Select3D_TypeOfSensitivity TypeOfSensitivity() const { return myTypeOfSensitivity; }
//! Sets the type of sensitivity for the plane.
void SetTypeOfSensitivity(Select3D_TypeOfSensitivity theTypeOfSensitivity)
{
myTypeOfSensitivity = theTypeOfSensitivity;
}
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode) Standard_OVERRIDE;
Standard_EXPORT void SetColor(const Quantity_Color& aColor) Standard_OVERRIDE;
Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
private:
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
Standard_EXPORT void ComputeFrame();
Standard_EXPORT void ComputeFields();
Standard_EXPORT void InitDrawerAttributes();
private:
Handle(Geom_Plane) myComponent;
Handle(Geom_Axis2Placement) myAx2;
gp_Pnt myCenter;
gp_Pnt myPmin;
gp_Pnt myPmax;
Standard_Boolean myCurrentMode;
Standard_Boolean myAutomaticPosition;
AIS_TypeOfPlane myTypeOfPlane;
Standard_Boolean myIsXYZPlane;
Standard_Boolean myHasOwnSize;
Select3D_TypeOfSensitivity myTypeOfSensitivity;
};
DEFINE_STANDARD_HANDLE(AIS_Plane, AIS_InteractiveObject)
#endif // _AIS_Plane_HeaderFile

View File

@ -0,0 +1,110 @@
// Created on: 1996-12-13
// Created by: Jean-Pierre COMBE/Odile Olivier
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_PlaneTrihedron_HeaderFile
#define _AIS_PlaneTrihedron_HeaderFile
#include "AIS_InteractiveObject.hxx"
#include "TCollection_AsciiString.hxx"
class AIS_Line;
class AIS_Point;
class Geom_Plane;
//! To construct a selectable 2d axis system in a 3d
//! drawing. This can be placed anywhere in the 3d
//! system, and provides a coordinate system for
//! drawing curves and shapes in a plane.
//! There are 3 selection modes:
//! - mode 0 selection of the whole plane "trihedron"
//! - mode 1 selection of the origin of the plane "trihedron"
//! - mode 2 selection of the axes.
//! Warning
//! For the presentation of planes and trihedra, the
//! millimetre is default unit of length, and 100 the default
//! value for the representation of the axes. If you modify
//! these dimensions, you must temporarily recover the
//! Drawer object. From inside it, take the Aspects in
//! which the values for length are stocked, for example,
//! PlaneAspect for planes and LineAspect for
//! trihedra. Change these values and recalculate the presentation.
class AIS_PlaneTrihedron : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(AIS_PlaneTrihedron, AIS_InteractiveObject)
public:
//! Initializes the plane aPlane. The plane trihedron is
//! constructed from this and an axis.
Standard_EXPORT AIS_PlaneTrihedron(const Handle(Geom_Plane)& aPlane);
//! Returns the component specified in SetComponent.
Standard_EXPORT Handle(Geom_Plane) Component();
//! Creates an instance of the component object aPlane.
Standard_EXPORT void SetComponent(const Handle(Geom_Plane)& aPlane);
//! Returns the "XAxis".
Standard_EXPORT Handle(AIS_Line) XAxis() const;
//! Returns the "YAxis".
Standard_EXPORT Handle(AIS_Line) YAxis() const;
//! Returns the point of origin of the plane trihedron.
Standard_EXPORT Handle(AIS_Point) Position() const;
//! Sets the length of the X and Y axes.
Standard_EXPORT void SetLength(const Standard_Real theLength);
//! Returns the length of X and Y axes.
Standard_EXPORT Standard_Real GetLength() const;
//! Returns true if the display mode selected, aMode, is valid.
Standard_EXPORT Standard_Boolean
AcceptDisplayMode(const Standard_Integer aMode) const Standard_OVERRIDE;
virtual Standard_Integer Signature() const Standard_OVERRIDE { return 4; }
//! Returns datum as the type of Interactive Object.
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE
{
return AIS_KindOfInteractive_Datum;
}
//! Allows you to provide settings for the color aColor.
Standard_EXPORT virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE;
void SetXLabel(const TCollection_AsciiString& theLabel) { myXLabel = theLabel; }
void SetYLabel(const TCollection_AsciiString& theLabel) { myYLabel = theLabel; }
protected:
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& theprsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
private:
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode) Standard_OVERRIDE;
private:
Handle(Geom_Plane) myPlane;
Handle(AIS_InteractiveObject) myShapes[3];
TCollection_AsciiString myXLabel;
TCollection_AsciiString myYLabel;
};
DEFINE_STANDARD_HANDLE(AIS_PlaneTrihedron, AIS_InteractiveObject)
#endif // _AIS_PlaneTrihedron_HeaderFile

View File

@ -0,0 +1,97 @@
// Created on: 1995-08-09
// Created by: Arnaud BOUZY
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_Point_HeaderFile
#define _AIS_Point_HeaderFile
#include "AIS_InteractiveObject.hxx"
class Geom_Point;
class TopoDS_Vertex;
//! Constructs point datums to be used in construction of
//! composite shapes. The datum is displayed as the plus marker +.
class AIS_Point : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(AIS_Point, AIS_InteractiveObject)
public:
//! Initializes the point aComponent from which the point
//! datum will be built.
Standard_EXPORT AIS_Point(const Handle(Geom_Point)& aComponent);
//! Returns index 1, the default index for a point.
virtual Standard_Integer Signature() const Standard_OVERRIDE { return 1; }
//! Indicates that a point is a datum.
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE
{
return AIS_KindOfInteractive_Datum;
}
//! Returns the component specified in SetComponent.
Standard_EXPORT Handle(Geom_Point) Component();
//! Constructs an instance of the point aComponent.
Standard_EXPORT void SetComponent(const Handle(Geom_Point)& aComponent);
//! Returns true if the display mode selected is valid for point datums.
Standard_EXPORT Standard_Boolean
AcceptDisplayMode(const Standard_Integer aMode) const Standard_OVERRIDE;
//! Allows you to provide settings for the Color.
Standard_EXPORT virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE;
//! Allows you to remove color settings.
Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE;
//! Allows you to provide settings for a marker. These include
//! - type of marker,
//! - marker color,
//! - scale factor.
Standard_EXPORT void SetMarker(const Aspect_TypeOfMarker aType);
//! Removes the marker settings.
Standard_EXPORT void UnsetMarker();
//! Returns true if the point datum has a marker.
Standard_Boolean HasMarker() const { return myHasTOM; }
//! Converts a point into a vertex.
Standard_EXPORT TopoDS_Vertex Vertex() const;
protected:
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
private:
Standard_EXPORT void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer aMode) Standard_OVERRIDE;
Standard_EXPORT void UpdatePointValues();
//! Replace aspects of already computed groups with the new value.
void replaceWithNewPointAspect(const Handle(Prs3d_PointAspect)& theAspect);
private:
Handle(Geom_Point) myComponent;
Standard_Boolean myHasTOM;
Aspect_TypeOfMarker myTOM;
};
DEFINE_STANDARD_HANDLE(AIS_Point, AIS_InteractiveObject)
#endif // _AIS_Point_HeaderFile

View File

@ -0,0 +1,164 @@
// Created on: 2014-08-13
// Created by: Maxim GLIBIN
// Copyright (c) 2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_PointCloud_HeaderFile
#define _AIS_PointCloud_HeaderFile
#include "AIS.hxx"
#include "AIS_InteractiveObject.hxx"
#include "Bnd_Box.hxx"
#include "Graphic3d_ArrayOfPoints.hxx"
#include "Quantity_HArray1OfColor.hxx"
#include "SelectMgr_EntityOwner.hxx"
#include "TColgp_HArray1OfDir.hxx"
#include "TColgp_HArray1OfPnt.hxx"
class TColStd_HPackedMapOfInteger;
//! Interactive object for set of points.
//! The presentation supports two display modes:
//! - Points.
//! - Bounding box for highlighting.
//! Presentation provides selection by bounding box.
//! Selection and consequently highlighting can disabled by
//! setting default selection mode to -1. There will be no way
//! to select object from interactive view. Any calls to
//! AIS_InteractiveContext::AddOrRemoveSelected should be also prohibited,
//! to avoid programmatic highlighting (workaround is setting non-supported
//! hilight mode, e.g. 100);
class AIS_PointCloud : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(AIS_PointCloud, AIS_InteractiveObject)
public:
//! Display modes supported by this Point Cloud object
enum DisplayMode
{
DM_Points = 0, //!< display as normal points, default presentation
DM_BndBox = 2 //!< display as bounding box, default for highlighting
};
//! Selection modes supported by this Point Cloud object
enum SelectionMode
{
SM_Points = 0, //!< detected by points
SM_SubsetOfPoints = 1, //!< detect point(s) within Point Cloud rather than object as whole
SM_BndBox = 2, //!< detected by bounding box
};
public:
//! Constructor.
Standard_EXPORT AIS_PointCloud();
//! Sets the points from array of points.
//! Method will not copy the input data - array will be stored as handle.
//! @param[in] thePoints the array of points
Standard_EXPORT virtual void SetPoints(const Handle(Graphic3d_ArrayOfPoints)& thePoints);
//! Sets the points with optional colors.
//! The input data will be copied into internal buffer.
//! The input arrays should have equal length, otherwise
//! the presentation will not be computed and displayed.
//! @param[in] theCoords the array of coordinates
//! @param[in] theColors optional array of colors
//! @param[in] theNormals optional array of normals
Standard_EXPORT virtual void SetPoints(const Handle(TColgp_HArray1OfPnt)& theCoords,
const Handle(Quantity_HArray1OfColor)& theColors = NULL,
const Handle(TColgp_HArray1OfDir)& theNormals = NULL);
public:
//! Get the points array.
//! Method might be overridden to fill in points array dynamically from application data
//! structures.
//! @return the array of points
Standard_EXPORT virtual const Handle(Graphic3d_ArrayOfPoints) GetPoints() const;
//! Get bounding box for presentation.
Standard_EXPORT virtual Bnd_Box GetBoundingBox() const;
public:
//! Setup custom color. Affects presentation only when no per-point color attribute has been
//! assigned.
Standard_EXPORT virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE;
//! Restore default color.
Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE;
//! Setup custom material. Affects presentation only when normals are defined.
Standard_EXPORT virtual void SetMaterial(const Graphic3d_MaterialAspect& theMat)
Standard_OVERRIDE;
//! Restore default material.
Standard_EXPORT virtual void UnsetMaterial() Standard_OVERRIDE;
protected:
//! Prepare presentation for this object.
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Prepare selection for this object.
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode) Standard_OVERRIDE;
private:
Handle(Graphic3d_ArrayOfPoints) myPoints; //!< points array for presentation
Bnd_Box myBndBox; //!< bounding box for presentation
};
DEFINE_STANDARD_HANDLE(AIS_PointCloud, AIS_InteractiveObject)
//! Custom owner for highlighting selected points.
class AIS_PointCloudOwner : public SelectMgr_EntityOwner
{
DEFINE_STANDARD_RTTIEXT(AIS_PointCloudOwner, SelectMgr_EntityOwner)
public:
//! Main constructor.
Standard_EXPORT AIS_PointCloudOwner(const Handle(AIS_PointCloud)& theOrigin);
//! Destructor.
Standard_EXPORT virtual ~AIS_PointCloudOwner();
//! Return selected points.
//! WARNING! Indexation starts with 0 (shifted by -1 comparing to
//! Graphic3d_ArrayOfPoints::Vertice()).
const Handle(TColStd_HPackedMapOfInteger)& SelectedPoints() const { return mySelPoints; }
//! Return last detected points.
//! WARNING! Indexation starts with 0 (shifted by -1 comparing to
//! Graphic3d_ArrayOfPoints::Vertice()).
const Handle(TColStd_HPackedMapOfInteger)& DetectedPoints() const { return myDetPoints; }
//! Always update dynamic highlighting.
Standard_EXPORT virtual Standard_Boolean IsForcedHilight() const Standard_OVERRIDE;
//! Handle dynamic highlighting.
Standard_EXPORT virtual void HilightWithColor(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Removes highlighting.
Standard_EXPORT virtual void Unhilight(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Clears presentation.
Standard_EXPORT virtual void Clear(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Standard_Integer theMode) Standard_OVERRIDE;
protected:
Handle(TColStd_HPackedMapOfInteger) myDetPoints; //!< last detected points
Handle(TColStd_HPackedMapOfInteger) mySelPoints; //!< selected points
};
#endif // _AIS_PointCloud_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_RadiusDimension_HeaderFile
#define _AIS_RadiusDimension_HeaderFile
#include "PrsDim_RadiusDimension.hxx"
Standard_DEPRECATED("Deprecated alias to moved class")
typedef PrsDim_RadiusDimension AIS_RadiusDimension;
#endif // _AIS_RadiusDimension_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_Relation_HeaderFile
#define _AIS_Relation_HeaderFile
#include "PrsDim_Relation.hxx"
Standard_DEPRECATED("Deprecated alias to moved class")
typedef PrsDim_Relation AIS_Relation;
#endif // _AIS_Relation_HeaderFile

View File

@ -0,0 +1,33 @@
// Copyright (c) 2019 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_RotationMode_HeaderFile
#define _AIS_RotationMode_HeaderFile
//! Camera rotation mode.
enum AIS_RotationMode
{
AIS_RotationMode_BndBoxActive, //!< default OCCT rotation
AIS_RotationMode_PickLast, //!< rotate around last picked point
AIS_RotationMode_PickCenter, //!< rotate around point at the center of window
AIS_RotationMode_CameraAt, //!< rotate around camera center
AIS_RotationMode_BndBoxScene, //!< rotate around scene center
};
enum
{
AIS_RotationMode_LOWER = 0,
AIS_RotationMode_UPPER = AIS_RotationMode_BndBoxScene,
};
#endif // _AIS_RotationMode_HeaderFile

View File

@ -0,0 +1,168 @@
// Created on: 2015-11-23
// Created by: Anastasia BORISOVA
// Copyright (c) 2015 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_RubberBand_HeaderFile
#define _AIS_RubberBand_HeaderFile
#include "AIS_InteractiveObject.hxx"
#include "Graphic3d_ArrayOfPolylines.hxx"
#include "Graphic3d_ArrayOfTriangles.hxx"
#include "Graphic3d_Vec2.hxx"
#include "NCollection_Sequence.hxx"
DEFINE_STANDARD_HANDLE(AIS_RubberBand, AIS_InteractiveObject)
//! Presentation for drawing rubber band selection.
//! It supports rectangle and polygonal selection.
//! It is constructed in 2d overlay.
//! Default configuration is built without filling.
//! For rectangle selection use SetRectangle() method.
//! For polygonal selection use AddPoint() and GetPoints() methods.
class AIS_RubberBand : public AIS_InteractiveObject
{
public:
DEFINE_STANDARD_RTTIEXT(AIS_RubberBand, AIS_InteractiveObject)
//! Constructs rubber band with default configuration: empty filling and white solid lines.
//! @warning It binds this object with Graphic3d_ZLayerId_TopOSD layer.
Standard_EXPORT AIS_RubberBand();
//! Constructs the rubber band with empty filling and defined line style.
//! @param[in] theLineColor color of rubber band lines
//! @param[in] theType type of rubber band lines
//! @param[in] theLineWidth width of rubber band line. By default it is 1.
//! @warning It binds this object with Graphic3d_ZLayerId_TopOSD layer.
Standard_EXPORT AIS_RubberBand(const Quantity_Color& theLineColor,
const Aspect_TypeOfLine theType,
const Standard_Real theLineWidth = 1.0,
const Standard_Boolean theIsPolygonClosed = Standard_True);
//! Constructs the rubber band with defined filling and line parameters.
//! @param[in] theLineColor color of rubber band lines
//! @param[in] theType type of rubber band lines
//! @param[in] theFillColor color of rubber band filling
//! @param[in] theTransparency transparency of the filling. 0 is for opaque filling. By default
//! it is transparent.
//! @param[in] theLineWidth width of rubber band line. By default it is 1.
//! @warning It binds this object with Graphic3d_ZLayerId_TopOSD layer.
Standard_EXPORT AIS_RubberBand(const Quantity_Color& theLineColor,
const Aspect_TypeOfLine theType,
const Quantity_Color theFillColor,
const Standard_Real theTransparency = 1.0,
const Standard_Real theLineWidth = 1.0,
const Standard_Boolean theIsPolygonClosed = Standard_True);
Standard_EXPORT virtual ~AIS_RubberBand();
//! Sets rectangle bounds.
Standard_EXPORT void SetRectangle(const Standard_Integer theMinX,
const Standard_Integer theMinY,
const Standard_Integer theMaxX,
const Standard_Integer theMaxY);
//! Adds last point to the list of points. They are used to build polygon for rubber band.
//! @sa RemoveLastPoint(), GetPoints()
Standard_EXPORT void AddPoint(const Graphic3d_Vec2i& thePoint);
//! Remove last point from the list of points for the rubber band polygon.
//! @sa AddPoint(), GetPoints()
Standard_EXPORT void RemoveLastPoint();
//! @return points for the rubber band polygon.
Standard_EXPORT const NCollection_Sequence<Graphic3d_Vec2i>& Points() const;
//! Remove all points for the rubber band polygon.
void ClearPoints() { myPoints.Clear(); }
//! @return the Color attributes.
Standard_EXPORT Quantity_Color LineColor() const;
//! Sets color of lines for rubber band presentation.
Standard_EXPORT void SetLineColor(const Quantity_Color& theColor);
//! @return the color of rubber band filling.
Standard_EXPORT Quantity_Color FillColor() const;
//! Sets color of rubber band filling.
Standard_EXPORT void SetFillColor(const Quantity_Color& theColor);
//! Sets width of line for rubber band presentation.
Standard_EXPORT void SetLineWidth(const Standard_Real theWidth) const;
//! @return width of lines.
Standard_EXPORT Standard_Real LineWidth() const;
//! Sets type of line for rubber band presentation.
Standard_EXPORT void SetLineType(const Aspect_TypeOfLine theType);
//! @return type of lines.
Standard_EXPORT Aspect_TypeOfLine LineType() const;
//! Sets fill transparency.
//! @param[in] theValue the transparency value. 1.0 is for transparent background
Standard_EXPORT void SetFillTransparency(const Standard_Real theValue) const;
//! @return fill transparency.
Standard_EXPORT Standard_Real FillTransparency() const;
//! Enable or disable filling of rubber band.
Standard_EXPORT void SetFilling(const Standard_Boolean theIsFilling);
//! Enable filling of rubber band with defined parameters.
//! @param[in] theColor color of filling
//! @param[in] theTransparency transparency of the filling. 0 is for opaque filling.
Standard_EXPORT void SetFilling(const Quantity_Color theColor,
const Standard_Real theTransparency);
//! @return true if filling of rubber band is enabled.
Standard_EXPORT Standard_Boolean IsFilling() const;
//! @return true if automatic closing of rubber band is enabled.
Standard_EXPORT Standard_Boolean IsPolygonClosed() const;
//! Automatically create an additional line connecting the first and
//! the last screen points to close the boundary polyline
Standard_EXPORT void SetPolygonClosed(Standard_Boolean theIsPolygonClosed);
protected:
//! Returns true if the interactive object accepts the display mode.
Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE
{
return theMode == 0;
}
//! Computes presentation of rubber band.
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Does not fill selection primitives for rubber band.
virtual void ComputeSelection(const Handle(SelectMgr_Selection)& /*aSelection*/,
const Standard_Integer /*aMode*/) Standard_OVERRIDE {};
//! Fills triangles primitive array for rubber band filling.
//! It uses Delaunay triangulation.
//! @return true if array of triangles is successfully filled.
Standard_EXPORT Standard_Boolean fillTriangles();
protected:
NCollection_Sequence<Graphic3d_Vec2i> myPoints; //!< Array of screen points
Handle(Graphic3d_ArrayOfTriangles) myTriangles; //!< Triangles for rubber band filling
Handle(Graphic3d_ArrayOfPolylines) myBorders; //!< Polylines for rubber band borders
Standard_Boolean myIsPolygonClosed; //!< automatic closing of rubber-band flag
};
#endif

View File

@ -0,0 +1,27 @@
// Created on: 1996-12-11
// Created by: Robert COUBLANC
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_SelectStatus_HeaderFile
#define _AIS_SelectStatus_HeaderFile
enum AIS_SelectStatus
{
AIS_SS_Added,
AIS_SS_Removed,
AIS_SS_NotDone
};
#endif // _AIS_SelectStatus_HeaderFile

View File

@ -0,0 +1,124 @@
// Created on: 1995-03-21
// Created by: Jean-Louis Frenkel
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_Selection_HeaderFile
#define _AIS_Selection_HeaderFile
#include "AIS_NArray1OfEntityOwner.hxx"
#include "AIS_NListOfEntityOwner.hxx"
#include "AIS_SelectionScheme.hxx"
#include "AIS_SelectStatus.hxx"
#include "Standard.hxx"
#include "Standard_Type.hxx"
class SelectMgr_Filter;
//! Class holding the list of selected owners.
class AIS_Selection : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(AIS_Selection, Standard_Transient)
public:
//! creates a new selection.
Standard_EXPORT AIS_Selection();
//! removes all the object of the selection.
Standard_EXPORT virtual void Clear();
//! if the object is not yet in the selection, it will be added.
//! if the object is already in the selection, it will be removed.
//! @param[in] theOwner element to change selection state
//! @param[in] theFilter context filter
//! @param[in] theSelScheme selection scheme
//! @param[in] theIsDetected flag of object detection
//! @return result of selection
Standard_EXPORT virtual AIS_SelectStatus Select(const Handle(SelectMgr_EntityOwner)& theOwner,
const Handle(SelectMgr_Filter)& theFilter,
const AIS_SelectionScheme theSelScheme,
const Standard_Boolean theIsDetected);
//! the object is always add int the selection.
//! faster when the number of objects selected is great.
Standard_EXPORT virtual AIS_SelectStatus AddSelect(
const Handle(SelectMgr_EntityOwner)& theObject);
//! clears the selection and adds the object in the selection.
//! @param[in] theObject element to change selection state
//! @param[in] theFilter context filter
//! @param[in] theIsDetected flag of object detection
virtual void ClearAndSelect(const Handle(SelectMgr_EntityOwner)& theObject,
const Handle(SelectMgr_Filter)& theFilter,
const Standard_Boolean theIsDetected)
{
Clear();
Select(theObject, theFilter, AIS_SelectionScheme_Add, theIsDetected);
}
//! checks if the object is in the selection.
Standard_Boolean IsSelected(const Handle(SelectMgr_EntityOwner)& theObject) const
{
return myResultMap.IsBound(theObject);
}
//! Return the list of selected objects.
const AIS_NListOfEntityOwner& Objects() const { return myresult; }
//! Return the number of selected objects.
Standard_Integer Extent() const { return myresult.Size(); }
//! Return true if list of selected objects is empty.
Standard_Boolean IsEmpty() const { return myresult.IsEmpty(); }
public:
//! Start iteration through selected objects.
void Init() { myIterator = AIS_NListOfEntityOwner::Iterator(myresult); }
//! Return true if iterator points to selected object.
Standard_Boolean More() const { return myIterator.More(); }
//! Continue iteration through selected objects.
void Next() { myIterator.Next(); }
//! Return selected object at iterator position.
const Handle(SelectMgr_EntityOwner)& Value() const { return myIterator.Value(); }
//! Select or deselect owners depending on the selection scheme.
//! @param[in] thePickedOwners elements to change selection state
//! @param[in] theSelScheme selection scheme, defines how owner is selected
//! @param[in] theToAllowSelOverlap selection flag, if true - overlapped entities are allowed
//! @param[in] theFilter context filter to skip not acceptable owners
Standard_EXPORT virtual void SelectOwners(const AIS_NArray1OfEntityOwner& thePickedOwners,
const AIS_SelectionScheme theSelScheme,
const Standard_Boolean theToAllowSelOverlap,
const Handle(SelectMgr_Filter)& theFilter);
protected:
//! Append the owner into the current selection if filter is Ok.
//! @param[in] theOwner element to change selection state
//! @param[in] theFilter context filter to skip not acceptable owners
//! @return result of selection
Standard_EXPORT virtual AIS_SelectStatus appendOwner(
const Handle(SelectMgr_EntityOwner)& theOwner,
const Handle(SelectMgr_Filter)& theFilter);
protected:
AIS_NListOfEntityOwner myresult;
AIS_NListOfEntityOwner::Iterator myIterator;
NCollection_DataMap<Handle(SelectMgr_EntityOwner), AIS_NListOfEntityOwner::Iterator> myResultMap;
};
DEFINE_STANDARD_HANDLE(AIS_Selection, Standard_Transient)
#endif // _AIS_Selection_HeaderFile

View File

@ -0,0 +1,30 @@
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_SelectionModesConcurrency_HeaderFile
#define _AIS_SelectionModesConcurrency_HeaderFile
//! The mode specifying how multiple active Selection Modes should be treated during activation of
//! new one.
enum AIS_SelectionModesConcurrency
{
AIS_SelectionModesConcurrency_Single, //!< only one selection mode can be activated at the same
//!< moment - previously activated should be deactivated
AIS_SelectionModesConcurrency_GlobalOrLocal, //!< either Global
//!< (AIS_InteractiveObject::GlobalSelectionMode() or
//!< Local (multiple) selection modes can be active
//!< at the same moment
AIS_SelectionModesConcurrency_Multiple, //!< any combination of selection modes can be activated
};
#endif // _AIS_SelectionModesConcurrency_HeaderFile

View File

@ -0,0 +1,31 @@
// Copyright (c) 2019 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_SelectionScheme_HeaderFile
#define _AIS_SelectionScheme_HeaderFile
//! Sets selection schemes for interactive contexts.
enum AIS_SelectionScheme
{
AIS_SelectionScheme_UNKNOWN = -1, //!< undefined scheme
AIS_SelectionScheme_Replace = 0, //!< clears current selection and select detected objects
AIS_SelectionScheme_Add, //!< adds detected object to current selection
AIS_SelectionScheme_Remove, //!< removes detected object from the current selection
AIS_SelectionScheme_XOR, //!< performs XOR for detected objects, other selected not touched
AIS_SelectionScheme_Clear, //!< clears current selection
AIS_SelectionScheme_ReplaceExtra, //!< replace with one difference: if result of replace is an
//!< empty, and current selection contains detected element, it
//!< will be selected
};
#endif // _AIS_SelectionScheme_HeaderFile

View File

@ -0,0 +1,350 @@
// Created on: 1996-12-20
// Created by: Robert COUBLANC
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_Shape_HeaderFile
#define _AIS_Shape_HeaderFile
#include "AIS_DisplayMode.hxx"
#include "AIS_InteractiveObject.hxx"
#include "Bnd_Box.hxx"
#include "TopoDS_Shape.hxx"
#include "Prs3d_Drawer.hxx"
#include "Prs3d_TypeOfHLR.hxx"
//! A framework to manage presentation and selection of shapes.
//! AIS_Shape is the interactive object which is used the
//! most by applications. There are standard functions
//! available which allow you to prepare selection
//! operations on the constituent elements of shapes -
//! vertices, edges, faces etc - in an open local context.
//! The selection modes specific to "Shape" type objects
//! are referred to as Standard Activation Mode. These
//! modes are only taken into account in open local
//! context and only act on Interactive Objects which
//! have redefined the virtual method
//! AcceptShapeDecomposition so that it returns true.
//! Several advanced functions are also available. These
//! include functions to manage deviation angle and
//! deviation coefficient - both HLR and non-HLR - of
//! an inheriting shape class. These services allow you to
//! select one type of shape interactive object for higher
//! precision drawing. When you do this, the
//! Prs3d_Drawer::IsOwn... functions corresponding to the
//! above deviation angle and coefficient functions return
//! true indicating that there is a local setting available
//! for the specific object.
//!
//! This class allows to map textures on shapes using native UV parametric space of underlying
//! surface of each Face (this means that texture will be visually duplicated on all Faces). To
//! generate texture coordinates, appropriate shading attribute should be set before computing
//! presentation in AIS_Shaded display mode:
//! @code
//! Handle(AIS_Shape) aPrs = new AIS_Shape();
//! aPrs->Attributes()->SetupOwnShadingAspect();
//! aPrs->Attributes()->ShadingAspect()->Aspect()->SetTextureMapOn();
//! aPrs->Attributes()->ShadingAspect()->Aspect()->SetTextureMap (new Graphic3d_Texture2Dmanual
//! (Graphic3d_NOT_2D_ALUMINUM));
//! @endcode
//! The texture itself is parametrized in (0,1)x(0,1).
class AIS_Shape : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(AIS_Shape, AIS_InteractiveObject)
public:
//! Initializes construction of the shape shap from wires,
//! edges and vertices.
Standard_EXPORT AIS_Shape(const TopoDS_Shape& shap);
//! Returns index 0. This value refers to SHAPE from TopAbs_ShapeEnum
virtual Standard_Integer Signature() const Standard_OVERRIDE { return 0; }
//! Returns Object as the type of Interactive Object.
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE
{
return AIS_KindOfInteractive_Shape;
}
//! Returns true if the Interactive Object accepts shape decomposition.
virtual Standard_Boolean AcceptShapeDecomposition() const Standard_OVERRIDE
{
return Standard_True;
}
//! Return true if specified display mode is supported.
virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE
{
return theMode >= 0 && theMode <= 2;
}
//! Returns this shape object.
const TopoDS_Shape& Shape() const { return myshape; }
//! Constructs an instance of the shape object theShape.
void SetShape(const TopoDS_Shape& theShape)
{
myshape = theShape;
myCompBB = Standard_True;
}
//! Alias for ::SetShape().
void Set(const TopoDS_Shape& theShape) { SetShape(theShape); }
//! Sets a local value for deviation coefficient for this specific shape.
Standard_EXPORT Standard_Boolean SetOwnDeviationCoefficient();
//! Sets a local value for deviation angle for this specific shape.
Standard_EXPORT Standard_Boolean SetOwnDeviationAngle();
//! Sets a local value for deviation coefficient for this specific shape.
Standard_EXPORT void SetOwnDeviationCoefficient(const Standard_Real aCoefficient);
//! this compute a new angle and Deviation from the value anAngle
//! and set the values stored in myDrawer with these that become local to the shape
Standard_EXPORT void SetAngleAndDeviation(const Standard_Real anAngle);
//! gives back the angle initial value put by the User.
Standard_EXPORT Standard_Real UserAngle() const;
//! sets myOwnDeviationAngle field in Prs3d_Drawer & recomputes presentation
Standard_EXPORT void SetOwnDeviationAngle(const Standard_Real anAngle);
//! Returns true and the values of the deviation
//! coefficient aCoefficient and the previous deviation
//! coefficient aPreviousCoefficient. If these values are
//! not already set, false is returned.
Standard_EXPORT Standard_Boolean
OwnDeviationCoefficient(Standard_Real& aCoefficient, Standard_Real& aPreviousCoefficient) const;
//! Returns true and the values of the deviation angle
//! anAngle and the previous deviation angle aPreviousAngle.
//! If these values are not already set, false is returned.
Standard_EXPORT Standard_Boolean OwnDeviationAngle(Standard_Real& anAngle,
Standard_Real& aPreviousAngle) const;
//! Sets the type of HLR algorithm used by the shape
void SetTypeOfHLR(const Prs3d_TypeOfHLR theTypeOfHLR) { myDrawer->SetTypeOfHLR(theTypeOfHLR); }
//! Gets the type of HLR algorithm
Prs3d_TypeOfHLR TypeOfHLR() const { return myDrawer->TypeOfHLR(); }
//! Sets the color aColor in the reconstructed
//! compound shape. Acts via the Drawer methods below on the appearance of:
//! - free boundaries:
//! Prs3d_Drawer_FreeBoundaryAspect,
//! - isos: Prs3d_Drawer_UIsoAspect,
//! Prs3dDrawer_VIsoAspect,
//! - shared boundaries:
//! Prs3d_Drawer_UnFreeBoundaryAspect,
//! - shading: Prs3d_Drawer_ShadingAspect,
//! - visible line color in hidden line mode:
//! Prs3d_Drawer_SeenLineAspect
//! - hidden line color in hidden line mode:
//! Prs3d_Drawer_HiddenLineAspect.
Standard_EXPORT virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE;
//! Removes settings for color in the reconstructed compound shape.
Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE;
//! Sets the value aValue for line width in the reconstructed compound shape.
//! Changes line aspects for lines presentation.
Standard_EXPORT virtual void SetWidth(const Standard_Real aValue) Standard_OVERRIDE;
//! Removes the setting for line width in the reconstructed compound shape.
Standard_EXPORT virtual void UnsetWidth() Standard_OVERRIDE;
//! Allows you to provide settings for the material aName
//! in the reconstructed compound shape.
Standard_EXPORT virtual void SetMaterial(const Graphic3d_MaterialAspect& aName) Standard_OVERRIDE;
//! Removes settings for material in the reconstructed compound shape.
Standard_EXPORT virtual void UnsetMaterial() Standard_OVERRIDE;
//! Sets the value aValue for transparency in the reconstructed compound shape.
Standard_EXPORT virtual void SetTransparency(const Standard_Real aValue = 0.6) Standard_OVERRIDE;
//! Removes the setting for transparency in the reconstructed compound shape.
Standard_EXPORT virtual void UnsetTransparency() Standard_OVERRIDE;
//! Constructs a bounding box with which to reconstruct
//! compound topological shapes for presentation.
Standard_EXPORT virtual const Bnd_Box& BoundingBox();
//! AIS_InteractiveObject defines another virtual method BoundingBox,
//! which is not the same as above; keep it visible.
using AIS_InteractiveObject::BoundingBox;
//! Returns the Color attributes of the shape accordingly to
//! the current facing model;
Standard_EXPORT virtual void Color(Quantity_Color& aColor) const Standard_OVERRIDE;
//! Returns the NameOfMaterial attributes of the shape accordingly to
//! the current facing model;
Standard_EXPORT virtual Graphic3d_NameOfMaterial Material() const Standard_OVERRIDE;
//! Returns the transparency attributes of the shape accordingly to
//! the current facing model;
Standard_EXPORT virtual Standard_Real Transparency() const Standard_OVERRIDE;
//! Return shape type for specified selection mode.
static TopAbs_ShapeEnum SelectionType(const Standard_Integer theSelMode)
{
switch (theSelMode)
{
case 1:
return TopAbs_VERTEX;
case 2:
return TopAbs_EDGE;
case 3:
return TopAbs_WIRE;
case 4:
return TopAbs_FACE;
case 5:
return TopAbs_SHELL;
case 6:
return TopAbs_SOLID;
case 7:
return TopAbs_COMPSOLID;
case 8:
return TopAbs_COMPOUND;
case 0:
return TopAbs_SHAPE;
}
return TopAbs_SHAPE;
}
//! Return selection mode for specified shape type.
static Standard_Integer SelectionMode(const TopAbs_ShapeEnum theShapeType)
{
switch (theShapeType)
{
case TopAbs_VERTEX:
return 1;
case TopAbs_EDGE:
return 2;
case TopAbs_WIRE:
return 3;
case TopAbs_FACE:
return 4;
case TopAbs_SHELL:
return 5;
case TopAbs_SOLID:
return 6;
case TopAbs_COMPSOLID:
return 7;
case TopAbs_COMPOUND:
return 8;
case TopAbs_SHAPE:
return 0;
}
return 0;
}
public: //! @name methods to alter texture mapping properties
//! Return texture repeat UV values; (1, 1) by default.
const gp_Pnt2d& TextureRepeatUV() const { return myUVRepeat; }
//! Sets the number of occurrences of the texture on each face. The texture itself is
//! parameterized in (0,1) by (0,1). Each face of the shape to be textured is parameterized in UV
//! space (Umin,Umax) by (Vmin,Vmax).
void SetTextureRepeatUV(const gp_Pnt2d& theRepeatUV) { myUVRepeat = theRepeatUV; }
//! Return texture origin UV position; (0, 0) by default.
const gp_Pnt2d& TextureOriginUV() const { return myUVOrigin; }
//! Use this method to change the origin of the texture.
//! The texel (0,0) will be mapped to the surface (myUVOrigin.X(), myUVOrigin.Y()).
void SetTextureOriginUV(const gp_Pnt2d& theOriginUV) { myUVOrigin = theOriginUV; }
//! Return scale factor for UV coordinates; (1, 1) by default.
const gp_Pnt2d& TextureScaleUV() const { return myUVScale; }
//! Use this method to scale the texture (percent of the face).
//! You can specify a scale factor for both U and V.
//! Example: if you set ScaleU and ScaleV to 0.5 and you enable texture repeat,
//! the texture will appear twice on the face in each direction.
void SetTextureScaleUV(const gp_Pnt2d& theScaleUV) { myUVScale = theScaleUV; }
protected:
//! Compute normal presentation.
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Compute projected presentation.
virtual void computeHLR(const Handle(Graphic3d_Camera)& theProjector,
const Handle(TopLoc_Datum3D)& theTrsf,
const Handle(Prs3d_Presentation)& thePrs) Standard_OVERRIDE
{
if (!theTrsf.IsNull() && theTrsf->Form() != gp_Identity)
{
const TopLoc_Location& aLoc = myshape.Location();
const TopoDS_Shape aShape = myshape.Located(TopLoc_Location(theTrsf->Trsf()) * aLoc);
computeHlrPresentation(theProjector, thePrs, aShape, myDrawer);
}
else
{
computeHlrPresentation(theProjector, thePrs, myshape, myDrawer);
}
}
//! Compute selection.
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Create own aspects (if they do not exist) and set color to them.
//! @return TRUE if new aspects have been created
Standard_EXPORT bool setColor(const Handle(Prs3d_Drawer)& theDrawer,
const Quantity_Color& theColor) const;
//! Create own aspects (if they do not exist) and set width to them.
//! @return TRUE if new aspects have been created
Standard_EXPORT bool setWidth(const Handle(Prs3d_Drawer)& theDrawer,
const Standard_Real theWidth) const;
Standard_EXPORT void setTransparency(const Handle(Prs3d_Drawer)& theDrawer,
const Standard_Real theValue) const;
Standard_EXPORT void setMaterial(const Handle(Prs3d_Drawer)& theDrawer,
const Graphic3d_MaterialAspect& theMaterial,
const Standard_Boolean theToKeepColor,
const Standard_Boolean theToKeepTransp) const;
//! Replace aspects of already computed groups from drawer link by the new own value.
Standard_EXPORT void replaceWithNewOwnAspects();
public:
//! Compute HLR presentation for specified shape.
Standard_EXPORT static void computeHlrPresentation(const Handle(Graphic3d_Camera)& theProjector,
const Handle(Prs3d_Presentation)& thePrs,
const TopoDS_Shape& theShape,
const Handle(Prs3d_Drawer)& theDrawer);
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream,
Standard_Integer theDepth = -1) const Standard_OVERRIDE;
protected:
TopoDS_Shape myshape; //!< shape to display
Bnd_Box myBB; //!< cached bounding box of the shape
gp_Pnt2d myUVOrigin; //!< UV origin vector for generating texture coordinates
gp_Pnt2d myUVRepeat; //!< UV repeat vector for generating texture coordinates
gp_Pnt2d myUVScale; //!< UV scale vector for generating texture coordinates
Standard_Real myInitAng;
Standard_Boolean myCompBB; //!< if TRUE, then bounding box should be recomputed
};
DEFINE_STANDARD_HANDLE(AIS_Shape, AIS_InteractiveObject)
#endif // _AIS_Shape_HeaderFile

View File

@ -0,0 +1,81 @@
// Created on: 1997-03-04
// Created by: Robert COUBLANC
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_SignatureFilter_HeaderFile
#define _AIS_SignatureFilter_HeaderFile
#include "Standard.hxx"
#include "Standard_Type.hxx"
#include "Standard_Integer.hxx"
#include "AIS_TypeFilter.hxx"
#include "AIS_KindOfInteractive.hxx"
class SelectMgr_EntityOwner;
class AIS_SignatureFilter;
DEFINE_STANDARD_HANDLE(AIS_SignatureFilter, AIS_TypeFilter)
//! Selects Interactive Objects through their signatures
//! and types. The signature provides an
//! additional characterization of an object's type, and
//! takes the form of an index. The filter questions each
//! Interactive Object in local context to determine
//! whether it has an non-null owner, and if so, whether
//! it has the desired signature. If the object returns true
//! in each case, it is kept. If not, it is rejected.
//! By default, the interactive object has a None type
//! and a signature of 0. If you want to give a particular
//! type and signature to your Interactive Object, you
//! must redefine two virtual methods: Type and Signature.
//! This filter is only used in an open local contexts.
//! In the Collector viewer, you can only locate
//! Interactive Objects which answer positively to the
//! positioned filters when a local context is open.
//! Warning
//! Some signatures have already been used by standard
//! objects delivered in AIS. These include:
//! - signature 0 - Shape
//! - signature 1 - Point
//! - signature 2 - Axis
//! - signature 3 - Trihedron
//! - signature 4 - PlaneTrihedron
//! - signature 5 - Line
//! - signature 6 - Circle
//! - signature 7 - Plane
class AIS_SignatureFilter : public AIS_TypeFilter
{
public:
//! Initializes the signature filter, adding the signature
//! specification, aGivenSignature, to that for type,
//! aGivenKind, in AIS_TypeFilter.
Standard_EXPORT AIS_SignatureFilter(const AIS_KindOfInteractive aGivenKind,
const Standard_Integer aGivenSignature);
//! Returns False if the transient is not an AIS_InteractiveObject.
//! Returns False if the signature of InteractiveObject
//! is not the same as the stored one in the filter...
Standard_EXPORT Standard_Boolean
IsOk(const Handle(SelectMgr_EntityOwner)& anobj) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(AIS_SignatureFilter, AIS_TypeFilter)
protected:
private:
Standard_Integer mySig;
};
#endif // _AIS_SignatureFilter_HeaderFile

View File

@ -0,0 +1,31 @@
// Created on: 1996-12-11
// Created by: Robert COUBLANC
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_StatusOfDetection_HeaderFile
#define _AIS_StatusOfDetection_HeaderFile
enum AIS_StatusOfDetection
{
AIS_SOD_Error,
AIS_SOD_Nothing,
AIS_SOD_AllBad,
AIS_SOD_Selected,
AIS_SOD_OnlyOneDetected,
AIS_SOD_OnlyOneGood,
AIS_SOD_SeveralGood
};
#endif // _AIS_StatusOfDetection_HeaderFile

View File

@ -0,0 +1,29 @@
// Created on: 1996-12-11
// Created by: Robert COUBLANC
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_StatusOfPick_HeaderFile
#define _AIS_StatusOfPick_HeaderFile
enum AIS_StatusOfPick
{
AIS_SOP_Error,
AIS_SOP_NothingSelected,
AIS_SOP_Removed,
AIS_SOP_OneSelected,
AIS_SOP_SeveralSelected
};
#endif // _AIS_StatusOfPick_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_SymmetricRelation_HeaderFile
#define _AIS_SymmetricRelation_HeaderFile
#include "PrsDim_SymmetricRelation.hxx"
Standard_DEPRECATED("Deprecated alias to moved class")
typedef PrsDim_SymmetricRelation AIS_SymmetricRelation;
#endif // _AIS_SymmetricRelation_HeaderFile

View File

@ -0,0 +1,22 @@
// Copyright (c) 2020 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_TangentRelation_HeaderFile
#define _AIS_TangentRelation_HeaderFile
#include "PrsDim_TangentRelation.hxx"
Standard_DEPRECATED("Deprecated alias to moved class")
typedef PrsDim_TangentRelation AIS_TangentRelation;
#endif // _AIS_TangentRelation_HeaderFile

View File

@ -0,0 +1,177 @@
// Created on: 2014-11-10
// Copyright (c) 2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_TextLabel_HeaderFile
#define _AIS_TextLabel_HeaderFile
#include "AIS_InteractiveObject.hxx"
#include "gp_Pnt.hxx"
#include "gp_Ax2.hxx"
#include "Graphic3d_VerticalTextAlignment.hxx"
#include "Graphic3d_HorizontalTextAlignment.hxx"
#include "Font_FontAspect.hxx"
#include "TCollection_ExtendedString.hxx"
class Font_TextFormatter;
//! Presentation of the text.
class AIS_TextLabel : public AIS_InteractiveObject
{
public:
//! Default constructor
Standard_EXPORT AIS_TextLabel();
//! Return TRUE for supported display mode.
virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE
{
return theMode == 0;
}
//! Setup color of entire text.
Standard_EXPORT virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE;
//! Setup transparency within [0, 1] range.
Standard_EXPORT virtual void SetTransparency(const Standard_Real theValue) Standard_OVERRIDE;
//! Removes the transparency setting.
virtual void UnsetTransparency() Standard_OVERRIDE { SetTransparency(0.0); }
//! Material has no effect for text label.
virtual void SetMaterial(const Graphic3d_MaterialAspect&) Standard_OVERRIDE {}
//! Setup text.
Standard_EXPORT void SetText(const TCollection_ExtendedString& theText);
//! Setup position.
Standard_EXPORT void SetPosition(const gp_Pnt& thePosition);
//! Setup horizontal justification.
Standard_EXPORT void SetHJustification(const Graphic3d_HorizontalTextAlignment theHJust);
//! Setup vertical justification.
Standard_EXPORT void SetVJustification(const Graphic3d_VerticalTextAlignment theVJust);
//! Setup angle.
Standard_EXPORT void SetAngle(const Standard_Real theAngle);
//! Setup zoomable property.
Standard_EXPORT void SetZoomable(const Standard_Boolean theIsZoomable);
//! Setup height.
Standard_EXPORT void SetHeight(const Standard_Real theHeight);
//! Setup font aspect.
Standard_EXPORT void SetFontAspect(const Font_FontAspect theFontAspect);
//! Setup font.
Standard_EXPORT void SetFont(Standard_CString theFont);
//! Setup label orientation in the model 3D space.
Standard_EXPORT void SetOrientation3D(const gp_Ax2& theOrientation);
//! Reset label orientation in the model 3D space.
Standard_EXPORT void UnsetOrientation3D();
//! Returns position.
Standard_EXPORT const gp_Pnt& Position() const;
//! Returns the label text.
const TCollection_ExtendedString& Text() const { return myText; }
//! Returns the font of the label text.
Standard_EXPORT const TCollection_AsciiString& FontName() const;
//! Returns the font aspect of the label text.
Standard_EXPORT Font_FontAspect FontAspect() const;
//! Returns label orientation in the model 3D space.
Standard_EXPORT const gp_Ax2& Orientation3D() const;
//! Returns true if the current text placement mode uses text orientation in the model 3D space.
Standard_EXPORT Standard_Boolean HasOrientation3D() const;
Standard_EXPORT void SetFlipping(const Standard_Boolean theIsFlipping);
Standard_EXPORT Standard_Boolean HasFlipping() const;
//! Returns flag if text uses position as point of attach
Standard_Boolean HasOwnAnchorPoint() const { return myHasOwnAnchorPoint; }
//! Set flag if text uses position as point of attach
void SetOwnAnchorPoint(const Standard_Boolean theOwnAnchorPoint)
{
myHasOwnAnchorPoint = theOwnAnchorPoint;
}
//! Define the display type of the text.
//!
//! TODT_NORMAL Default display. Text only.
//! TODT_SUBTITLE There is a subtitle under the text.
//! TODT_DEKALE The text is displayed with a 3D style.
//! TODT_BLEND The text is displayed in XOR.
//! TODT_DIMENSION Dimension line under text will be invisible.
Standard_EXPORT void SetDisplayType(const Aspect_TypeOfDisplayText theDisplayType);
//! Modifies the colour of the subtitle for the TODT_SUBTITLE TextDisplayType
//! and the colour of backgroubd for the TODT_DEKALE TextDisplayType.
Standard_EXPORT void SetColorSubTitle(const Quantity_Color& theColor);
//! Returns text presentation formatter; NULL by default, which means standard text formatter will
//! be used.
const Handle(Font_TextFormatter)& TextFormatter() const { return myFormatter; }
//! Setup text formatter for presentation. It's empty by default.
void SetTextFormatter(const Handle(Font_TextFormatter)& theFormatter)
{
myFormatter = theFormatter;
}
protected:
//! Compute
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& theprsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Compute selection
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Calculate label center, width and height
Standard_EXPORT Standard_Boolean calculateLabelParams(const gp_Pnt& thePosition,
gp_Pnt& theCenterOfLabel,
Standard_Real& theWidth,
Standard_Real& theHeight) const;
//! Calculate label transformation
Standard_EXPORT gp_Trsf calculateLabelTrsf(const gp_Pnt& thePosition,
gp_Pnt& theCenterOfLabel) const;
protected:
Handle(Font_TextFormatter) myFormatter;
TCollection_ExtendedString myText;
gp_Ax2 myOrientation3D;
Standard_Boolean myHasOrientation3D;
Standard_Boolean myHasOwnAnchorPoint;
Standard_Boolean myHasFlipping;
public:
//! CASCADE RTTI
DEFINE_STANDARD_RTTIEXT(AIS_TextLabel, AIS_InteractiveObject)
};
DEFINE_STANDARD_HANDLE(AIS_TextLabel, AIS_InteractiveObject)
#endif // _AIS_TextLabel_HeaderFile

View File

@ -0,0 +1,216 @@
// Created on: 2001-07-02
// Created by: Mathias BOSSHARD
// Copyright (c) 2001-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_TexturedShape_HeaderFile
#define _AIS_TexturedShape_HeaderFile
#include "AIS_Shape.hxx"
#include "gp_Pnt2d.hxx"
#include "Graphic3d_NameOfTexture2D.hxx"
#include "Image_PixMap.hxx"
#include "Standard_Type.hxx"
#include "TCollection_AsciiString.hxx"
#include "Graphic3d_AspectFillArea3d.hxx"
#include "Prs3d_Presentation.hxx"
#include "PrsMgr_PresentationManager.hxx"
class Graphic3d_AspectFillArea3d;
class Graphic3d_Texture2D;
//! This class allows to map textures on shapes.
//! Presentations modes AIS_WireFrame (0) and AIS_Shaded (1) behave in the same manner as in
//! AIS_Shape, whilst new modes 2 (bounding box) and 3 (texture mapping) extends it functionality.
//!
//! The texture itself is parametrized in (0,1)x(0,1).
//! Each face of a shape located in UV space is provided with these parameters:
//! - Umin - starting position in U
//! - Umax - ending position in U
//! - Vmin - starting position in V
//! - Vmax - ending position in V
//! Each face is triangulated and a texel is assigned to each node.
//! Facets are then filled using a linear interpolation of texture between each 'three texels'.
//! User can act on:
//! - the number of occurrences of the texture on the face
//! - the position of the origin of the texture
//! - the scale factor of the texture
class AIS_TexturedShape : public AIS_Shape
{
public: //! @name main methods
//! Initializes the textured shape.
Standard_EXPORT AIS_TexturedShape(const TopoDS_Shape& theShape);
//! Sets the texture source. <theTextureFileName> can specify path to texture image or one of the
//! standard predefined textures. The accepted file types are those used in Image_AlienPixMap with
//! extensions such as rgb, png, jpg and more. To specify the standard predefined texture, the
//! <theTextureFileName> should contain integer - the Graphic3d_NameOfTexture2D enumeration index.
//! Setting texture source using this method resets the source pixmap (if was set previously).
Standard_EXPORT virtual void SetTextureFileName(
const TCollection_AsciiString& theTextureFileName);
//! Sets the texture source. <theTexturePixMap> specifies image data.
//! Please note that the data should be in Bottom-Up order, the flag of Image_PixMap::IsTopDown()
//! will be ignored by graphic driver. Setting texture source using this method resets the source
//! by filename (if was set previously).
Standard_EXPORT virtual void SetTexturePixMap(const Handle(Image_PixMap)& theTexturePixMap);
//! @return flag to control texture mapping (for presentation mode 3)
Standard_Boolean TextureMapState() const { return myToMapTexture; }
//! Enables texture mapping
Standard_EXPORT void SetTextureMapOn();
//! Disables texture mapping
Standard_EXPORT void SetTextureMapOff();
//! @return path to the texture file
Standard_CString TextureFile() const { return myTextureFile.ToCString(); }
//! @return the source pixmap for texture map
const Handle(Image_PixMap)& TexturePixMap() const { return myTexturePixMap; }
public: //! @name methods to alter texture mapping properties
//! Use this method to display the textured shape without recomputing the whole presentation.
//! Use this method when ONLY the texture content has been changed.
//! If other parameters (ie: scale factors, texture origin, texture repeat...) have changed, the
//! whole presentation has to be recomputed:
//! @code
//! if (myShape->DisplayMode() == 3)
//! {
//! myAISContext->RecomputePrsOnly (myShape);
//! }
//! else
//! {
//! myAISContext->SetDisplayMode (myShape, 3, Standard_False);
//! myAISContext->Display (myShape, Standard_True);
//! }
//! @endcode
Standard_EXPORT void UpdateAttributes();
//! Sets the color.
Standard_EXPORT virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE;
//! Removes settings for the color.
Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE;
//! Sets the material aspect.
Standard_EXPORT virtual void SetMaterial(const Graphic3d_MaterialAspect& theAspect)
Standard_OVERRIDE;
//! Removes settings for material aspect.
Standard_EXPORT virtual void UnsetMaterial() Standard_OVERRIDE;
//! Enables texture modulation
Standard_EXPORT void EnableTextureModulate();
//! Disables texture modulation
Standard_EXPORT void DisableTextureModulate();
//! @return texture repeat flag
Standard_Boolean TextureRepeat() const { return myToRepeat; }
//! @return texture repeat U value
Standard_Real URepeat() const { return myUVRepeat.X(); }
//! @return texture repeat V value
Standard_Real VRepeat() const { return myUVRepeat.Y(); }
//! Sets the number of occurrences of the texture on each face. The texture itself is
//! parameterized in (0,1) by (0,1). Each face of the shape to be textured is parameterized in UV
//! space (Umin,Umax) by (Vmin,Vmax). If RepeatYN is set to false, texture coordinates are clamped
//! in the range (0,1)x(0,1) of the face.
Standard_EXPORT void SetTextureRepeat(const Standard_Boolean theToRepeat,
const Standard_Real theURepeat = 1.0,
const Standard_Real theVRepeat = 1.0);
//! @return true if texture UV origin has been modified
Standard_Boolean TextureOrigin() const { return myIsCustomOrigin; }
//! @return texture origin U position (0.0 by default)
Standard_Real TextureUOrigin() const { return myUVOrigin.X(); }
//! @return texture origin V position (0.0 by default)
Standard_Real TextureVOrigin() const { return myUVOrigin.Y(); }
//! Use this method to change the origin of the texture. The texel (0,0) will be mapped to the
//! surface (UOrigin,VOrigin)
Standard_EXPORT void SetTextureOrigin(const Standard_Boolean theToSetTextureOrigin,
const Standard_Real theUOrigin = 0.0,
const Standard_Real theVOrigin = 0.0);
//! @return true if scale factor should be applied to texture mapping
Standard_Boolean TextureScale() const { return myToScale; }
//! @return scale factor for U coordinate (1.0 by default)
Standard_Real TextureScaleU() const { return myUVScale.X(); }
//! @return scale factor for V coordinate (1.0 by default)
Standard_Real TextureScaleV() const { return myUVScale.Y(); }
//! Use this method to scale the texture (percent of the face).
//! You can specify a scale factor for both U and V.
//! Example: if you set ScaleU and ScaleV to 0.5 and you enable texture repeat,
//! the texture will appear twice on the face in each direction.
Standard_EXPORT void SetTextureScale(const Standard_Boolean theToSetTextureScale,
const Standard_Real theScaleU = 1.0,
const Standard_Real theScaleV = 1.0);
//! @return true if displaying of triangles is requested
Standard_Boolean ShowTriangles() const { return myToShowTriangles; }
//! Use this method to show the triangulation of the shape (for debugging etc.).
Standard_EXPORT void ShowTriangles(const Standard_Boolean theToShowTriangles);
//! @return true if texture color modulation is turned on
Standard_Boolean TextureModulate() const { return myModulate; }
//! Return true if specified display mode is supported (extends AIS_Shape with Display Mode 3).
virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE
{
return theMode >= 0 && theMode <= 3;
}
protected: //! @name overridden methods
//! Compute presentation with texture mapping support.
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
Standard_EXPORT void updateAttributes(const Handle(Prs3d_Presentation)& thePrs);
protected: //! @name presentation fields
Handle(Graphic3d_Texture2D) myTexture;
Handle(Graphic3d_AspectFillArea3d) myAspect;
protected: //! @name texture source fields
Handle(Image_PixMap) myTexturePixMap;
TCollection_AsciiString myTextureFile;
Graphic3d_NameOfTexture2D myPredefTexture;
protected: //! @name texture mapping properties
Standard_Boolean myToMapTexture;
Standard_Boolean myModulate;
Standard_Boolean myIsCustomOrigin;
Standard_Boolean myToRepeat;
Standard_Boolean myToScale;
Standard_Boolean myToShowTriangles;
public:
DEFINE_STANDARD_RTTIEXT(AIS_TexturedShape, AIS_Shape)
};
DEFINE_STANDARD_HANDLE(AIS_TexturedShape, AIS_Shape)
#endif // _AIS_TexturedShape_HeaderFile

View File

@ -0,0 +1,87 @@
// Created on: 2009-12-10
// Created by: Paul SUPRYATKIN
// Copyright (c) 2009-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_Triangulation_HeaderFile
#define _AIS_Triangulation_HeaderFile
#include "TColStd_HArray1OfInteger.hxx"
#include "AIS_InteractiveObject.hxx"
class Poly_Triangulation;
DEFINE_STANDARD_HANDLE(AIS_Triangulation, AIS_InteractiveObject)
//! Interactive object that draws data from Poly_Triangulation, optionally with colors associated
//! with each triangulation vertex. For maximum efficiency colors are represented as 32-bit integers
//! instead of classic Quantity_Color values.
//! Interactive selection of triangles and vertices is not yet implemented.
class AIS_Triangulation : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(AIS_Triangulation, AIS_InteractiveObject)
public:
//! Constructs the Triangulation display object
Standard_EXPORT AIS_Triangulation(const Handle(Poly_Triangulation)& aTriangulation);
//! Set the color for each node.
//! Each 32-bit color is Alpha << 24 + Blue << 16 + Green << 8 + Red
//! Order of color components is essential for further usage by OpenGL
Standard_EXPORT void SetColors(const Handle(TColStd_HArray1OfInteger)& aColor);
//! Get the color for each node.
//! Each 32-bit color is Alpha << 24 + Blue << 16 + Green << 8 + Red
Standard_EXPORT Handle(TColStd_HArray1OfInteger) GetColors() const;
//! Returns true if triangulation has vertex colors.
Standard_Boolean HasVertexColors() const { return (myFlagColor == 1); }
Standard_EXPORT void SetTriangulation(const Handle(Poly_Triangulation)& aTriangulation);
//! Returns Poly_Triangulation .
Standard_EXPORT Handle(Poly_Triangulation) GetTriangulation() const;
//! Sets the value aValue for transparency in the reconstructed compound shape.
Standard_EXPORT virtual void SetTransparency(const Standard_Real aValue = 0.6) Standard_OVERRIDE;
//! Removes the setting for transparency in the reconstructed compound shape.
Standard_EXPORT virtual void UnsetTransparency() Standard_OVERRIDE;
protected:
Standard_EXPORT void updatePresentation();
private:
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSel,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Attenuates 32-bit color by a given attenuation factor (0...1):
//! aColor = Alpha << 24 + Blue << 16 + Green << 8 + Red
//! All color components are multiplied by aComponent, the result is then packed again as 32-bit
//! integer. Color attenuation is applied to the vertex colors in order to have correct visual
//! result after glColorMaterial(GL_AMBIENT_AND_DIFFUSE). Without it, colors look unnatural and
//! flat.
Standard_EXPORT Graphic3d_Vec4ub attenuateColor(const Standard_Integer theColor,
const Standard_Real theComponent);
Handle(Poly_Triangulation) myTriangulation;
Handle(TColStd_HArray1OfInteger) myColor;
Standard_Integer myFlagColor;
Standard_Integer myNbNodes;
Standard_Integer myNbTriangles;
};
#endif // _AIS_Triangulation_HeaderFile

View File

@ -0,0 +1,260 @@
// Created on: 1995-10-09
// Created by: Arnaud BOUZY/Odile Olivier
// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_Trihedron_HeaderFile
#define _AIS_Trihedron_HeaderFile
#include "AIS_InteractiveObject.hxx"
#include "AIS_KindOfInteractive.hxx"
#include "Graphic3d_ArrayOfTriangles.hxx"
#include "PrsMgr_PresentationManager.hxx"
#include "Prs3d_DatumAspect.hxx"
#include "Prs3d_DatumMode.hxx"
#include "Prs3d_DatumParts.hxx"
#include "Prs3d_LineAspect.hxx"
#include "SelectMgr_Selection.hxx"
#include "Quantity_Color.hxx"
class Geom_Axis2Placement;
//! Create a selectable trihedron
//! The trihedron includes 1 origin, 3 axes and 3 labels.
//! Default text of labels are "X", "Y", "Z".
//! Color of origin and any axis, color of arrows and labels may be changed.
//! Visual presentation might be shown in two, shaded and wireframe modes, wireframe by default).
//! There are 4 modes of selection:
//! - AIS_TrihedronSelectionMode_EntireObject to select trihedron, priority = 1
//! - AIS_TrihedronSelectionMode_Origin to select its origin, priority = 5
//! - AIS_TrihedronSelectionMode_Axes to select its axis, priority = 3
//! - AIS_TrihedronSelectionMode_MainPlanes to select its planes, priority = 2
//!
//! Warning!
//! For the presentation of trihedron, the default unit of length is the millimetre,
//! and the default value for the representation of the axes is 100.
//! If you modify these dimensions, you must temporarily recover the Drawer.
//! From inside it, you take the aspect in which the values for length are stocked.
//! For trihedron, this is Prs3d_Drawer_LineAspect.
//! You change the values inside this Aspect and recalculate the presentation.
class AIS_Trihedron : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(AIS_Trihedron, AIS_InteractiveObject)
public:
//! Initializes a trihedron entity.
Standard_EXPORT AIS_Trihedron(const Handle(Geom_Axis2Placement)& theComponent);
//! Returns datum display mode.
Prs3d_DatumMode DatumDisplayMode() const { return myTrihDispMode; }
//! Sets Shading or Wireframe display mode, triangle or segment graphic group is used relatively.
void SetDatumDisplayMode(Prs3d_DatumMode theMode) { myTrihDispMode = theMode; }
//! Returns the right-handed coordinate system set in SetComponent.
const Handle(Geom_Axis2Placement)& Component() const { return myComponent; }
//! Constructs the right-handed coordinate system aComponent.
Standard_EXPORT void SetComponent(const Handle(Geom_Axis2Placement)& theComponent);
//! Returns true if the trihedron object has a size other
//! than the default size of 100 mm. along each axis.
Standard_Boolean HasOwnSize() const { return myHasOwnSize; }
//! Returns the size of trihedron object; 100.0 by DEFAULT.
Standard_EXPORT Standard_Real Size() const;
//! Sets the size of trihedron object.
Standard_EXPORT void SetSize(const Standard_Real theValue);
//! Removes any non-default settings for size of this trihedron object.
//! If the object has 1 color, the default size of the
//! drawer is reproduced, otherwise DatumAspect becomes null.
Standard_EXPORT void UnsetSize();
//! Returns true if trihedron has own text color
Standard_Boolean HasTextColor() const { return myHasOwnTextColor; }
//! Returns trihedron text color
Standard_EXPORT Quantity_Color TextColor() const;
//! Sets color of label of trihedron axes.
Standard_EXPORT void SetTextColor(const Quantity_Color& theColor);
//! Sets color of label of trihedron axis.
Standard_EXPORT void SetTextColor(const Prs3d_DatumParts thePart, const Quantity_Color& theColor);
//! Returns true if trihedron has own arrow color
Standard_Boolean HasArrowColor() const { return myHasOwnArrowColor; }
//! Returns trihedron arrow color
Standard_EXPORT Quantity_Color ArrowColor() const;
//! Sets color of arrow of trihedron axes.
Standard_EXPORT void SetArrowColor(const Quantity_Color& theColor);
//! Sets color of arrow of trihedron axes.
Standard_EXPORT void SetArrowColor(const Prs3d_DatumParts thePart,
const Quantity_Color& theColor);
//! Returns color of datum part: origin or some of trihedron axes.
Standard_EXPORT Quantity_Color DatumPartColor(Prs3d_DatumParts thePart);
//! Sets color of datum part: origin or some of trihedron axes.
//! If presentation is shading mode, this color is set for both sides of facing model
Standard_EXPORT void SetDatumPartColor(const Prs3d_DatumParts thePart,
const Quantity_Color& theColor);
//! Sets color of origin.
//! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead")
Standard_EXPORT void SetOriginColor(const Quantity_Color& theColor);
//! Sets color of x-axis.
//! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead")
Standard_EXPORT void SetXAxisColor(const Quantity_Color& theColor);
//! Sets color of y-axis.
//! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead")
Standard_EXPORT void SetYAxisColor(const Quantity_Color& theColor);
//! Sets color of z-axis.
//! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead")
Standard_EXPORT void SetAxisColor(const Quantity_Color& theColor);
//! Returns true if arrows are to be drawn
Standard_EXPORT Standard_Boolean ToDrawArrows() const;
//! Sets whether to draw the arrows in visualization
Standard_EXPORT void SetDrawArrows(const Standard_Boolean theToDraw);
//! Returns priority of selection for owner of the given type
Standard_Integer SelectionPriority(Prs3d_DatumParts thePart)
{
return mySelectionPriority[thePart];
}
//! Sets priority of selection for owner of the given type
void SetSelectionPriority(Prs3d_DatumParts thePart, Standard_Integer thePriority)
{
mySelectionPriority[thePart] = thePriority;
}
//! Returns text of axis. Parameter thePart should be XAxis, YAxis or ZAxis
const TCollection_ExtendedString& Label(Prs3d_DatumParts thePart) { return myLabels[thePart]; }
//! Sets text label for trihedron axis. Parameter thePart should be XAxis, YAxis or ZAxis
void SetLabel(const Prs3d_DatumParts thePart, const TCollection_ExtendedString& theName)
{
myLabels[thePart] = theName;
}
public:
//! Sets the color theColor for this trihedron object, it changes color of axes.
Standard_EXPORT virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE;
//! Returns true if the display mode selected, aMode, is valid for trihedron datums.
virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE
{
return theMode == 0;
}
//! Returns index 3, selection of the planes XOY, YOZ, XOZ.
virtual Standard_Integer Signature() const Standard_OVERRIDE { return 3; }
//! Indicates that the type of Interactive Object is datum.
virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE
{
return AIS_KindOfInteractive_Datum;
}
//! Removes the settings for color.
Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE;
public:
//! Method which clear all selected owners belonging
//! to this selectable object ( for fast presentation draw ).
Standard_EXPORT virtual void ClearSelected() Standard_OVERRIDE;
//! Method which draws selected owners ( for fast presentation draw ).
Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager)& thePM,
const SelectMgr_SequenceOfOwner& theOwners)
Standard_OVERRIDE;
//! Method which hilight an owner belonging to
//! this selectable object ( for fast presentation draw ).
Standard_EXPORT virtual void HilightOwnerWithColor(
const Handle(PrsMgr_PresentationManager)& thePM,
const Handle(Prs3d_Drawer)& theStyle,
const Handle(SelectMgr_EntityOwner)& theOwner) Standard_OVERRIDE;
protected:
//! Compute trihedron presentation.
Standard_EXPORT void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Compute selection.
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream,
Standard_Integer theDepth = -1) const Standard_OVERRIDE;
protected:
//! Creates a sensitive entity for the datum part that will be used in selection owner creation.
Standard_EXPORT Handle(Select3D_SensitiveEntity) createSensitiveEntity(
const Prs3d_DatumParts thePart,
const Handle(SelectMgr_EntityOwner)& theOwner) const;
//! Computes presentation for display mode equal 1.
Standard_EXPORT void computePresentation(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs);
//! Returns own datum aspect of trihedron, create this aspect if it was not created yet.
Standard_EXPORT void setOwnDatumAspect();
//! Returns primitives.
const Handle(Graphic3d_ArrayOfPrimitives)& arrayOfPrimitives(Prs3d_DatumParts thePart) const
{
return myPrimitives[thePart];
}
//! Updates graphic groups for the current datum mode
//! Parameters of datum position and orientation
Standard_EXPORT void updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect,
Prs3d_DatumMode theMode,
const gp_Pnt& theOrigin,
const gp_Dir& theXDir,
const gp_Dir& theYDir,
const gp_Dir& theZDir);
protected:
Handle(Geom_Axis2Placement) myComponent;
Prs3d_DatumMode myTrihDispMode;
Standard_Boolean myHasOwnSize;
Standard_Boolean myHasOwnTextColor;
Standard_Boolean myHasOwnArrowColor;
TCollection_ExtendedString myLabels[Prs3d_DatumParts_NB];
Standard_Integer mySelectionPriority[Prs3d_DatumParts_NB];
Handle(Graphic3d_Group) myPartToGroup[Prs3d_DatumParts_NB];
NCollection_List<Prs3d_DatumParts> mySelectedParts;
Handle(Graphic3d_AspectLine3d) myHiddenLineAspect;
Handle(Graphic3d_ArrayOfPrimitives) myPrimitives[Prs3d_DatumParts_NB];
};
DEFINE_STANDARD_HANDLE(AIS_Trihedron, AIS_InteractiveObject)
#endif // _AIS_Trihedron_HeaderFile

View File

@ -0,0 +1,57 @@
// Created by: Ilya SEVRIKOV
// Copyright (c) 2016 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_TrihedronOwner_HeaderFile
#define _AIS_TrihedronOwner_HeaderFile
#include "SelectMgr_EntityOwner.hxx"
#include "SelectMgr_SelectableObject.hxx"
#include "Prs3d_DatumParts.hxx"
//! Entity owner for selection management of AIS_Trihedron object.
class AIS_TrihedronOwner : public SelectMgr_EntityOwner
{
DEFINE_STANDARD_RTTIEXT(AIS_TrihedronOwner, SelectMgr_EntityOwner)
public:
//! Creates an owner of AIS_Trihedron object.
Standard_EXPORT AIS_TrihedronOwner(const Handle(SelectMgr_SelectableObject)& theSelObject,
const Prs3d_DatumParts theDatumPart,
const Standard_Integer thePriority);
//! Returns the datum part identifier.
Prs3d_DatumParts DatumPart() const { return myDatumPart; }
//! Highlights selectable object's presentation.
Standard_EXPORT virtual void HilightWithColor(const Handle(PrsMgr_PresentationManager)& thePM,
const Handle(Prs3d_Drawer)& theStyle,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Returns true if the presentation manager thePM
//! highlights selections corresponding to the selection mode aMode.
Standard_EXPORT Standard_Boolean
IsHilighted(const Handle(PrsMgr_PresentationManager)& thePM,
const Standard_Integer theMode) const Standard_OVERRIDE;
//! Removes highlighting from the owner of a detected
//! selectable object in the presentation manager thePM.
Standard_EXPORT virtual void Unhilight(const Handle(PrsMgr_PresentationManager)& thePM,
const Standard_Integer theMode) Standard_OVERRIDE;
protected:
Prs3d_DatumParts myDatumPart; //!< part of datum selected
};
DEFINE_STANDARD_HANDLE(AIS_TrihedronOwner, SelectMgr_EntityOwner)
#endif // _AIS_TrihedronOwner_HeaderFile

View File

@ -0,0 +1,26 @@
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_TrihedronSelectionMode_HeaderFile
#define _AIS_TrihedronSelectionMode_HeaderFile
//! Enumeration defining selection modes supported by AIS_Trihedron.
enum AIS_TrihedronSelectionMode
{
AIS_TrihedronSelectionMode_EntireObject = 0, //!< select trihedron as whole
AIS_TrihedronSelectionMode_Origin = 1, //!< origin
AIS_TrihedronSelectionMode_Axes = 2, //!< axes
AIS_TrihedronSelectionMode_MainPlanes = 3 //!< main planes
};
#endif // _AIS_TrihedronSelectionMode_HeaderFile

View File

@ -0,0 +1,74 @@
// Created on: 1997-03-06
// Created by: Robert COUBLANC
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_TypeFilter_HeaderFile
#define _AIS_TypeFilter_HeaderFile
#include "Standard.hxx"
#include "Standard_Type.hxx"
#include "AIS_KindOfInteractive.hxx"
#include "SelectMgr_Filter.hxx"
class SelectMgr_EntityOwner;
class AIS_TypeFilter;
DEFINE_STANDARD_HANDLE(AIS_TypeFilter, SelectMgr_Filter)
//! Selects Interactive Objects through their types. The
//! filter questions each Interactive Object in local context
//! to determine whether it has an non-null owner, and if
//! so, whether it is of the desired type. If the object
//! returns true in each case, it is kept. If not, it is rejected.
//! By default, the interactive object has a None type
//! and a signature of 0. A filter for type specifies a
//! choice of type out of a range at any level enumerated
//! for type or kind. The choice could be for kind of
//! interactive object, of dimension, of unit, or type of axis,
//! plane or attribute.
//! If you want to give a particular type and signature to
//! your Interactive Object, you must redefine two virtual
//! methods: Type and Signature.
//! This filter is used in both Neutral Point and open local contexts.
//! In the Collector viewer, you can only locate
//! Interactive Objects which answer positively to the
//! positioned filters when a local context is open.
//! Warning
//! When you close a local context, all temporary
//! interactive objects are deleted, all selection modes
//! concerning the context are cancelled, and all content
//! filters are emptied.
class AIS_TypeFilter : public SelectMgr_Filter
{
public:
//! Initializes filter for type, aGivenKind.
Standard_EXPORT AIS_TypeFilter(const AIS_KindOfInteractive aGivenKind);
//! Returns False if the transient is not an Interactive
//! Object, or if the type of the Interactive Object is not
//! the same as that stored in the filter.
Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& anobj) const
Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(AIS_TypeFilter, SelectMgr_Filter)
protected:
AIS_KindOfInteractive myKind;
private:
};
#endif // _AIS_TypeFilter_HeaderFile

View File

@ -0,0 +1,40 @@
// Created on: 1996-12-11
// Created by: Robert COUBLANC
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_TypeOfAttribute_HeaderFile
#define _AIS_TypeOfAttribute_HeaderFile
enum AIS_TypeOfAttribute
{
AIS_TOA_Line,
AIS_TOA_Dimension,
AIS_TOA_Wire,
AIS_TOA_Plane,
AIS_TOA_Vector,
AIS_TOA_UIso,
AIS_TOA_VIso,
AIS_TOA_Free,
AIS_TOA_UnFree,
AIS_TOA_Section,
AIS_TOA_Hidden,
AIS_TOA_Seen,
AIS_TOA_FaceBoundary,
AIS_TOA_FirstAxis,
AIS_TOA_SecondAxis,
AIS_TOA_ThirdAxis
};
#endif // _AIS_TypeOfAttribute_HeaderFile

View File

@ -0,0 +1,29 @@
// Created on: 1996-12-11
// Created by: Robert COUBLANC
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_TypeOfAxis_HeaderFile
#define _AIS_TypeOfAxis_HeaderFile
//! Declares the type of axis.
enum AIS_TypeOfAxis
{
AIS_TOAX_Unknown,
AIS_TOAX_XAxis,
AIS_TOAX_YAxis,
AIS_TOAX_ZAxis
};
#endif // _AIS_TypeOfAxis_HeaderFile

View File

@ -0,0 +1,28 @@
// Created on: 1996-12-11
// Created by: Robert COUBLANC
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_TypeOfIso_HeaderFile
#define _AIS_TypeOfIso_HeaderFile
//! Declares the type of isoparameter displayed.
enum AIS_TypeOfIso
{
AIS_TOI_IsoU,
AIS_TOI_IsoV,
AIS_TOI_Both
};
#endif // _AIS_TypeOfIso_HeaderFile

View File

@ -0,0 +1,29 @@
// Created on: 1996-12-11
// Created by: Robert COUBLANC
// Copyright (c) 1996-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_TypeOfPlane_HeaderFile
#define _AIS_TypeOfPlane_HeaderFile
//! Declares the type of plane.
enum AIS_TypeOfPlane
{
AIS_TOPL_Unknown,
AIS_TOPL_XYPlane,
AIS_TOPL_XZPlane,
AIS_TOPL_YZPlane
};
#endif // _AIS_TypeOfPlane_HeaderFile

View File

@ -0,0 +1,834 @@
// Copyright (c) 2016-2019 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_ViewController_HeaderFile
#define _AIS_ViewController_HeaderFile
#include "Aspect_WindowInputListener.hxx"
#include "Aspect_XRHapticActionData.hxx"
#include "Aspect_XRTrackedDeviceRole.hxx"
#include "AIS_DragAction.hxx"
#include "AIS_MouseGesture.hxx"
#include "AIS_NavigationMode.hxx"
#include "AIS_ViewInputBuffer.hxx"
#include "AIS_RotationMode.hxx"
#include "AIS_WalkDelta.hxx"
#include "gp_Pnt.hxx"
#include "Graphic3d_Vec3.hxx"
#include "NCollection_Array1.hxx"
#include "OSD_Timer.hxx"
#include "Precision.hxx"
#include "Quantity_ColorRGBA.hxx"
#include "Standard_Mutex.hxx"
class AIS_Animation;
class AIS_AnimationCamera;
class AIS_InteractiveObject;
class AIS_InteractiveContext;
class AIS_Point;
class AIS_RubberBand;
class AIS_XRTrackedDevice;
class SelectMgr_EntityOwner;
class V3d_View;
class WNT_HIDSpaceMouse;
//! Auxiliary structure for handling viewer events between GUI and Rendering threads.
//!
//! Class implements the following features:
//! - Buffers storing the state of user input (mouse, touches and keyboard).
//! - Mapping mouse/multi-touch input to View camera manipulations (panning/rotating/zooming).
//! - Input events are not applied immediately but queued for separate processing from two working
//! threads
//! UI thread receiving user input and Rendering thread for OCCT 3D Viewer drawing.
class AIS_ViewController : public Aspect_WindowInputListener
{
public:
//! Empty constructor.
Standard_EXPORT AIS_ViewController();
//! Destructor.
Standard_EXPORT virtual ~AIS_ViewController();
//! Return input buffer.
const AIS_ViewInputBuffer& InputBuffer(AIS_ViewInputBufferType theType) const
{
return theType == AIS_ViewInputBufferType_UI ? myUI : myGL;
}
//! Return input buffer.
AIS_ViewInputBuffer& ChangeInputBuffer(AIS_ViewInputBufferType theType)
{
return theType == AIS_ViewInputBufferType_UI ? myUI : myGL;
}
//! Return view animation; empty (but not NULL) animation by default.
const Handle(AIS_AnimationCamera)& ViewAnimation() const { return myViewAnimation; }
//! Set view animation to be handled within handleViewRedraw().
void SetViewAnimation(const Handle(AIS_AnimationCamera)& theAnimation)
{
myViewAnimation = theAnimation;
}
//! Interrupt active view animation.
Standard_EXPORT void AbortViewAnimation();
//! Return objects animation; empty (but not NULL) animation by default.
const Handle(AIS_Animation)& ObjectsAnimation() const { return myObjAnimation; }
//! Set object animation to be handled within handleViewRedraw().
void SetObjectsAnimation(const Handle(AIS_Animation)& theAnimation)
{
myObjAnimation = theAnimation;
}
//! Return TRUE if object animation should be paused on mouse click; FALSE by default.
bool ToPauseObjectsAnimation() const { return myToPauseObjAnimation; }
//! Set if object animation should be paused on mouse click.
void SetPauseObjectsAnimation(bool theToPause) { myToPauseObjAnimation = theToPause; }
//! Return TRUE if continuous redrawing is enabled; FALSE by default.
//! This option would request a next viewer frame to be completely redrawn right after current
//! frame is finished.
bool IsContinuousRedraw() const { return myIsContinuousRedraw; }
//! Enable or disable continuous updates.
void SetContinuousRedraw(bool theToEnable) { myIsContinuousRedraw = theToEnable; }
public: //! @name global parameters
//! Return camera rotation mode, AIS_RotationMode_BndBoxActive by default.
AIS_RotationMode RotationMode() const { return myRotationMode; }
//! Set camera rotation mode.
void SetRotationMode(AIS_RotationMode theMode) { myRotationMode = theMode; }
//! Return camera navigation mode; AIS_NavigationMode_Orbit by default.
AIS_NavigationMode NavigationMode() const { return myNavigationMode; }
//! Set camera navigation mode.
Standard_EXPORT void SetNavigationMode(AIS_NavigationMode theMode);
//! Return mouse input acceleration ratio in First Person mode; 1.0 by default.
float MouseAcceleration() const { return myMouseAccel; }
//! Set mouse input acceleration ratio.
void SetMouseAcceleration(float theRatio) { myMouseAccel = theRatio; }
//! Return orbit rotation acceleration ratio; 1.0 by default.
float OrbitAcceleration() const { return myOrbitAccel; }
//! Set orbit rotation acceleration ratio.
void SetOrbitAcceleration(float theRatio) { myOrbitAccel = theRatio; }
//! Return TRUE if panning anchor point within perspective projection should be displayed in 3D
//! Viewer; TRUE by default.
bool ToShowPanAnchorPoint() const { return myToShowPanAnchorPoint; }
//! Set if panning anchor point within perspective projection should be displayed in 3D Viewer.
void SetShowPanAnchorPoint(bool theToShow) { myToShowPanAnchorPoint = theToShow; }
//! Return TRUE if rotation point should be displayed in 3D Viewer; TRUE by default.
bool ToShowRotateCenter() const { return myToShowRotateCenter; }
//! Set if rotation point should be displayed in 3D Viewer.
void SetShowRotateCenter(bool theToShow) { myToShowRotateCenter = theToShow; }
//! Return TRUE if camera up orientation within AIS_NavigationMode_Orbit rotation mode should be
//! forced Z up; FALSE by default.
bool ToLockOrbitZUp() const { return myToLockOrbitZUp; }
//! Set if camera up orientation within AIS_NavigationMode_Orbit rotation mode should be forced Z
//! up.
void SetLockOrbitZUp(bool theToForceUp) { myToLockOrbitZUp = theToForceUp; }
//! Return TRUE if z-rotation via two-touches gesture is enabled; FALSE by default.
bool ToAllowTouchZRotation() const { return myToAllowTouchZRotation; }
//! Set if z-rotation via two-touches gesture is enabled.
void SetAllowTouchZRotation(bool theToEnable) { myToAllowTouchZRotation = theToEnable; }
//! Return TRUE if camera rotation is allowed; TRUE by default.
bool ToAllowRotation() const { return myToAllowRotation; }
//! Set if camera rotation is allowed.
void SetAllowRotation(bool theToEnable) { myToAllowRotation = theToEnable; }
//! Return TRUE if panning is allowed; TRUE by default.
bool ToAllowPanning() const { return myToAllowPanning; }
//! Set if panning is allowed.
void SetAllowPanning(bool theToEnable) { myToAllowPanning = theToEnable; }
//! Return TRUE if zooming is allowed; TRUE by default.
bool ToAllowZooming() const { return myToAllowZooming; }
//! Set if zooming is allowed.
void SetAllowZooming(bool theToEnable) { myToAllowZooming = theToEnable; }
//! Return TRUE if ZFocus change is allowed; TRUE by default.
bool ToAllowZFocus() const { return myToAllowZFocus; }
//! Set if ZFocus change is allowed.
void SetAllowZFocus(bool theToEnable) { myToAllowZFocus = theToEnable; }
//! Return TRUE if dynamic highlight on mouse move is allowed; TRUE by default.
bool ToAllowHighlight() const { return myToAllowHighlight; }
//! Set if dragging object is allowed.
void SetAllowHighlight(bool theToEnable) { myToAllowHighlight = theToEnable; }
//! Return TRUE if dragging object is allowed; TRUE by default.
bool ToAllowDragging() const { return myToAllowDragging; }
//! Set if dynamic highlight on mouse move is allowed.
void SetAllowDragging(bool theToEnable) { myToAllowDragging = theToEnable; }
//! Return TRUE if picked point should be projected to picking ray on zooming at point; TRUE by
//! default.
bool ToStickToRayOnZoom() const { return myToStickToRayOnZoom; }
//! Set if picked point should be projected to picking ray on zooming at point.
void SetStickToRayOnZoom(bool theToEnable) { myToStickToRayOnZoom = theToEnable; }
//! Return TRUE if picked point should be projected to picking ray on rotating around point; TRUE
//! by default.
bool ToStickToRayOnRotation() const { return myToStickToRayOnRotation; }
//! Set if picked point should be projected to picking ray on rotating around point.
void SetStickToRayOnRotation(bool theToEnable) { myToStickToRayOnRotation = theToEnable; }
//! Return TRUE if pitch direction should be inverted while processing
//! Aspect_VKey_NavLookUp/Aspect_VKey_NavLookDown; FALSE by default.
bool ToInvertPitch() const { return myToInvertPitch; }
//! Set flag inverting pitch direction.
void SetInvertPitch(bool theToInvert) { myToInvertPitch = theToInvert; }
//! Return normal walking speed, in m/s; 1.5 by default.
float WalkSpeedAbsolute() const { return myWalkSpeedAbsolute; }
//! Set normal walking speed, in m/s; 1.5 by default.
void SetWalkSpeedAbsolute(float theSpeed) { myWalkSpeedAbsolute = theSpeed; }
//! Return walking speed relative to scene bounding box; 0.1 by default.
float WalkSpeedRelative() const { return myWalkSpeedRelative; }
//! Set walking speed relative to scene bounding box.
void SetWalkSpeedRelative(float theFactor) { myWalkSpeedRelative = theFactor; }
//! Return active thrust value; 0.0f by default.
float ThrustSpeed() const { return myThrustSpeed; }
//! Set active thrust value.
void SetThrustSpeed(float theSpeed) { myThrustSpeed = theSpeed; }
//! Return TRUE if previous position of MoveTo has been defined.
bool HasPreviousMoveTo() const { return myPrevMoveTo != Graphic3d_Vec2i(-1); }
//! Return previous position of MoveTo event in 3D viewer.
const Graphic3d_Vec2i& PreviousMoveTo() const { return myPrevMoveTo; }
//! Reset previous position of MoveTo.
void ResetPreviousMoveTo() { myPrevMoveTo = Graphic3d_Vec2i(-1); }
//! Return TRUE to display auxiliary tracked XR devices (like tracking stations).
bool ToDisplayXRAuxDevices() const { return myToDisplayXRAuxDevices; }
//! Set if auxiliary tracked XR devices should be displayed.
void SetDisplayXRAuxDevices(bool theToDisplay) { myToDisplayXRAuxDevices = theToDisplay; }
//! Return TRUE to display XR hand controllers.
bool ToDisplayXRHands() const { return myToDisplayXRHands; }
//! Set if tracked XR hand controllers should be displayed.
void SetDisplayXRHands(bool theToDisplay) { myToDisplayXRHands = theToDisplay; }
public: //! @name keyboard input
using Aspect_WindowInputListener::ChangeKeys;
using Aspect_WindowInputListener::Keys;
//! Press key.
//! Default implementation updates internal cache.
//! @param theKey key pressed
//! @param theTime event timestamp
Standard_EXPORT virtual void KeyDown(Aspect_VKey theKey,
double theTime,
double thePressure = 1.0) Standard_OVERRIDE;
//! Release key.
//! Default implementation updates internal cache.
//! @param theKey key pressed
//! @param theTime event timestamp
Standard_EXPORT virtual void KeyUp(Aspect_VKey theKey, double theTime) Standard_OVERRIDE;
//! Simulate key up/down events from axis value.
//! Default implementation updates internal cache.
Standard_EXPORT virtual void KeyFromAxis(Aspect_VKey theNegative,
Aspect_VKey thePositive,
double theTime,
double thePressure) Standard_OVERRIDE;
//! Fetch active navigation actions.
Standard_EXPORT AIS_WalkDelta FetchNavigationKeys(Standard_Real theCrouchRatio,
Standard_Real theRunRatio);
public: //! @name mouse input
//! Return map defining mouse gestures.
const AIS_MouseGestureMap& MouseGestureMap() const { return myMouseGestureMap; }
//! Return map defining mouse gestures.
AIS_MouseGestureMap& ChangeMouseGestureMap() { return myMouseGestureMap; }
//! Return map defining mouse selection schemes.
const AIS_MouseSelectionSchemeMap& MouseSelectionSchemes() const
{
return myMouseSelectionSchemes;
}
//! Return map defining mouse gestures.
AIS_MouseSelectionSchemeMap& ChangeMouseSelectionSchemes() { return myMouseSelectionSchemes; }
//! Return double click interval in seconds; 0.4 by default.
double MouseDoubleClickInterval() const { return myMouseDoubleClickInt; }
//! Set double click interval in seconds.
void SetMouseDoubleClickInterval(double theSeconds) { myMouseDoubleClickInt = theSeconds; }
//! Perform selection in 3D viewer.
//! This method is expected to be called from UI thread.
//! @param thePnt picking point
//! @param theScheme selection scheme
Standard_EXPORT virtual void SelectInViewer(
const Graphic3d_Vec2i& thePnt,
const AIS_SelectionScheme theScheme = AIS_SelectionScheme_Replace);
//! Perform selection in 3D viewer.
//! This method is expected to be called from UI thread.
//! @param thePnts picking point
//! @param theScheme selection scheme
Standard_EXPORT virtual void SelectInViewer(
const NCollection_Sequence<Graphic3d_Vec2i>& thePnts,
const AIS_SelectionScheme theScheme = AIS_SelectionScheme_Replace);
//! Update rectangle selection tool.
//! This method is expected to be called from UI thread.
//! @param thePntFrom rectangle first corner
//! @param thePntTo rectangle another corner
Standard_EXPORT virtual void UpdateRubberBand(const Graphic3d_Vec2i& thePntFrom,
const Graphic3d_Vec2i& thePntTo);
//! Update polygonal selection tool.
//! This method is expected to be called from UI thread.
//! @param thePnt new point to add to polygon
//! @param theToAppend append new point or update the last point
Standard_EXPORT virtual void UpdatePolySelection(const Graphic3d_Vec2i& thePnt, bool theToAppend);
//! Update zoom event (e.g. from mouse scroll).
//! This method is expected to be called from UI thread.
//! @param theDelta mouse cursor position to zoom at and zoom delta
//! @return TRUE if new zoom event has been created or FALSE if existing one has been updated
Standard_EXPORT virtual bool UpdateZoom(const Aspect_ScrollDelta& theDelta);
//! Update Z rotation event.
//! @param theAngle rotation angle, in radians.
//! @return TRUE if new zoom event has been created or FALSE if existing one has been updated
Standard_EXPORT virtual bool UpdateZRotation(double theAngle);
//! Update mouse scroll event; redirects to UpdateZoom by default.
//! This method is expected to be called from UI thread.
//! @param theDelta mouse cursor position and delta
//! @return TRUE if new event has been created or FALSE if existing one has been updated
Standard_EXPORT virtual bool UpdateMouseScroll(const Aspect_ScrollDelta& theDelta)
Standard_OVERRIDE;
//! Handle mouse button press/release event.
//! This method is expected to be called from UI thread.
//! @param thePoint mouse cursor position
//! @param theButtons pressed buttons
//! @param theModifiers key modifiers
//! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse
//! but emulated from non-precise input like touch on screen
//! @return TRUE if View should be redrawn
Standard_EXPORT virtual bool UpdateMouseButtons(const Graphic3d_Vec2i& thePoint,
Aspect_VKeyMouse theButtons,
Aspect_VKeyFlags theModifiers,
bool theIsEmulated) Standard_OVERRIDE;
//! Handle mouse cursor movement event.
//! This method is expected to be called from UI thread.
//! @param thePoint mouse cursor position
//! @param theButtons pressed buttons
//! @param theModifiers key modifiers
//! @param theIsEmulated if TRUE then mouse event comes NOT from real mouse
//! but emulated from non-precise input like touch on screen
//! @return TRUE if View should be redrawn
Standard_EXPORT virtual bool UpdateMousePosition(const Graphic3d_Vec2i& thePoint,
Aspect_VKeyMouse theButtons,
Aspect_VKeyFlags theModifiers,
bool theIsEmulated) Standard_OVERRIDE;
//! Handle mouse button click event (emulated by UpdateMouseButtons() while releasing single
//! button). Note that as this method is called by UpdateMouseButtons(), it should be executed
//! from UI thread. Default implementation redirects to SelectInViewer(). This method is expected
//! to be called from UI thread.
//! @param thePoint mouse cursor position
//! @param theButton clicked button
//! @param theModifiers key modifiers
//! @param theIsDoubleClick flag indicating double mouse click
//! @return TRUE if View should be redrawn
Standard_EXPORT virtual bool UpdateMouseClick(const Graphic3d_Vec2i& thePoint,
Aspect_VKeyMouse theButton,
Aspect_VKeyFlags theModifiers,
bool theIsDoubleClick);
using Aspect_WindowInputListener::PressMouseButton;
using Aspect_WindowInputListener::ReleaseMouseButton;
using Aspect_WindowInputListener::LastMouseFlags;
using Aspect_WindowInputListener::LastMousePosition;
using Aspect_WindowInputListener::PressedMouseButtons;
public: //! @name multi-touch input
//! Return scale factor for adjusting tolerances for starting multi-touch gestures; 1.0 by default
//! This scale factor is expected to be computed from touch screen resolution.
float TouchToleranceScale() const { return myTouchToleranceScale; }
//! Set scale factor for adjusting tolerances for starting multi-touch gestures.
void SetTouchToleranceScale(float theTolerance) { myTouchToleranceScale = theTolerance; }
//! Add touch point with the given ID.
//! This method is expected to be called from UI thread.
//! @param theId touch unique identifier
//! @param thePnt touch coordinates
//! @param theClearBefore if TRUE previously registered touches will be removed
Standard_EXPORT virtual void AddTouchPoint(Standard_Size theId,
const Graphic3d_Vec2d& thePnt,
Standard_Boolean theClearBefore = false)
Standard_OVERRIDE;
//! Remove touch point with the given ID.
//! This method is expected to be called from UI thread.
//! @param theId touch unique identifier
//! @param theClearSelectPnts if TRUE will initiate clearing of selection points
//! @return TRUE if point has been removed
Standard_EXPORT virtual bool RemoveTouchPoint(Standard_Size theId,
Standard_Boolean theClearSelectPnts = false)
Standard_OVERRIDE;
//! Update touch point with the given ID.
//! If point with specified ID was not registered before, it will be added.
//! This method is expected to be called from UI thread.
//! @param theId touch unique identifier
//! @param thePnt touch coordinates
Standard_EXPORT virtual void UpdateTouchPoint(Standard_Size theId,
const Graphic3d_Vec2d& thePnt) Standard_OVERRIDE;
using Aspect_WindowInputListener::HasTouchPoints;
public: //! @name 3d mouse input
//! Process 3d mouse input event (redirects to translation, rotation and keys).
Standard_EXPORT virtual bool Update3dMouse(const WNT_HIDSpaceMouse& theEvent) Standard_OVERRIDE;
public: //! @name resize events
//! Handle expose event (window content has been invalidation and should be redrawn).
//! Default implementation does nothing.
virtual void ProcessExpose() Standard_OVERRIDE {}
//! Handle window resize event.
//! Default implementation does nothing.
virtual void ProcessConfigure(bool theIsResized) Standard_OVERRIDE { (void)theIsResized; }
//! Handle window input event immediately.
//! Default implementation does nothing - input events are accumulated in internal buffer until
//! explicit FlushViewEvents() call.
virtual void ProcessInput() Standard_OVERRIDE {}
//! Handle focus event.
//! Default implementation resets cached input state (pressed keys).
virtual void ProcessFocus(bool theIsActivated) Standard_OVERRIDE
{
if (!theIsActivated)
{
ResetViewInput();
}
}
//! Handle window close event.
//! Default implementation does nothing.
virtual void ProcessClose() Standard_OVERRIDE {}
public:
using Aspect_WindowInputListener::EventTime;
//! Reset input state (pressed keys, mouse buttons, etc.) e.g. on window focus loss.
//! This method is expected to be called from UI thread.
Standard_EXPORT virtual void ResetViewInput();
//! Reset view orientation.
//! This method is expected to be called from UI thread.
Standard_EXPORT virtual void UpdateViewOrientation(V3d_TypeOfOrientation theOrientation,
bool theToFitAll);
//! Update buffer for rendering thread.
//! This method is expected to be called within synchronization barrier between GUI
//! and Rendering threads (e.g. GUI thread should be locked beforehand to avoid data races).
//! @param theCtx interactive context
//! @param theView active view
//! @param theToHandle if TRUE, the HandleViewEvents() will be called
Standard_EXPORT virtual void FlushViewEvents(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
Standard_Boolean theToHandle = Standard_False);
//! Process events within rendering thread.
Standard_EXPORT virtual void HandleViewEvents(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
public:
//! Callback called by handleMoveTo() on Selection in 3D Viewer.
//! This method is expected to be called from rendering thread.
Standard_EXPORT virtual void OnSelectionChanged(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Callback called by handleMoveTo() on dragging object in 3D Viewer.
//! This method is expected to be called from rendering thread.
Standard_EXPORT virtual void OnObjectDragged(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
AIS_DragAction theAction);
//! Callback called by HandleViewEvents() on Selection of another (sub)view.
//! This method is expected to be called from rendering thread.
Standard_EXPORT virtual void OnSubviewChanged(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theOldView,
const Handle(V3d_View)& theNewView);
//! Pick closest point under mouse cursor.
//! This method is expected to be called from rendering thread.
//! @param[out] thePnt result point
//! @param[in] theCtx interactive context
//! @param[in] theView active view
//! @param[in] theCursor mouse cursor
//! @param[in] theToStickToPickRay when TRUE, the result point will lie on picking ray
//! @return TRUE if result has been found
Standard_EXPORT virtual bool PickPoint(gp_Pnt& thePnt,
const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const Graphic3d_Vec2i& theCursor,
bool theToStickToPickRay);
//! Pick closest point by axis.
//! This method is expected to be called from rendering thread.
//! @param[out] theTopPnt result point
//! @param[in] theCtx interactive context
//! @param[in] theView active view
//! @param[in] theAxis selection axis
//! @return TRUE if result has been found
Standard_EXPORT virtual bool PickAxis(gp_Pnt& theTopPnt,
const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const gp_Ax1& theAxis);
//! Compute rotation gravity center point depending on rotation mode.
//! This method is expected to be called from rendering thread.
Standard_EXPORT virtual gp_Pnt GravityPoint(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Modify view camera to fit all objects.
//! Default implementation fits either all visible and all selected objects (swapped on each
//! call).
Standard_EXPORT virtual void FitAllAuto(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
public:
//! Handle hot-keys defining new camera orientation (Aspect_VKey_ViewTop and similar keys).
//! Default implementation starts an animated transaction from the current to the target camera
//! orientation, when specific action key was pressed. This method is expected to be called from
//! rendering thread.
Standard_EXPORT virtual void handleViewOrientationKeys(
const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Perform navigation (Aspect_VKey_NavForward and similar keys).
//! This method is expected to be called from rendering thread.
Standard_EXPORT virtual AIS_WalkDelta handleNavigationKeys(
const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Perform immediate camera actions (rotate/zoom/pan) on gesture progress.
//! This method is expected to be called from rendering thread.
Standard_EXPORT virtual void handleCameraActions(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const AIS_WalkDelta& theWalk);
//! Perform moveto/selection/dragging.
//! This method is expected to be called from rendering thread.
Standard_EXPORT virtual void handleMoveTo(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Return TRUE if another frame should be drawn right after this one.
bool toAskNextFrame() const { return myToAskNextFrame; }
//! Set if another frame should be drawn right after this one.
void setAskNextFrame(bool theToDraw = true) { myToAskNextFrame = theToDraw; }
//! Return if panning anchor point has been defined.
bool hasPanningAnchorPoint() const { return !Precision::IsInfinite(myPanPnt3d.X()); }
//! Return active panning anchor point.
const gp_Pnt& panningAnchorPoint() const { return myPanPnt3d; }
//! Set active panning anchor point.
void setPanningAnchorPoint(const gp_Pnt& thePnt) { myPanPnt3d = thePnt; }
//! Handle panning event myGL.Panning.
Standard_EXPORT virtual void handlePanning(const Handle(V3d_View)& theView);
//! Handle Z rotation event myGL.ZRotate.
Standard_EXPORT virtual void handleZRotate(const Handle(V3d_View)& theView);
//! Return minimal camera distance for zoom operation.
double MinZoomDistance() const { return myMinCamDistance; }
//! Set minimal camera distance for zoom operation.
void SetMinZoomDistance(double theDist) { myMinCamDistance = theDist; }
//! Handle zoom event myGL.ZoomActions.
//! This method is expected to be called from rendering thread.
Standard_EXPORT virtual void handleZoom(const Handle(V3d_View)& theView,
const Aspect_ScrollDelta& theParams,
const gp_Pnt* thePnt);
//! Handle ZScroll event myGL.ZoomActions.
//! This method is expected to be called from rendering thread.
Standard_EXPORT virtual void handleZFocusScroll(const Handle(V3d_View)& theView,
const Aspect_ScrollDelta& theParams);
//! Handle orbital rotation events myGL.OrbitRotation.
//! @param theView view to modify
//! @param thePnt 3D point to rotate around
//! @param theToLockZUp amend camera to exclude roll angle (put camera Up vector to plane
//! containing global Z and view direction)
Standard_EXPORT virtual void handleOrbitRotation(const Handle(V3d_View)& theView,
const gp_Pnt& thePnt,
bool theToLockZUp);
//! Handle view direction rotation events myGL.ViewRotation.
//! This method is expected to be called from rendering thread.
//! @param theView camera to modify
//! @param theYawExtra extra yaw increment
//! @param thePitchExtra extra pitch increment
//! @param theRoll roll value
//! @param theToRestartOnIncrement flag indicating flight mode
Standard_EXPORT virtual void handleViewRotation(const Handle(V3d_View)& theView,
double theYawExtra,
double thePitchExtra,
double theRoll,
bool theToRestartOnIncrement);
//! Handle view redraw.
//! This method is expected to be called from rendering thread.
Standard_EXPORT virtual void handleViewRedraw(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
public:
//! Perform XR input.
//! This method is expected to be called from rendering thread.
Standard_EXPORT virtual void handleXRInput(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const AIS_WalkDelta& theWalk);
//! Handle trackpad view turn action.
Standard_EXPORT virtual void handleXRTurnPad(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Handle trackpad teleportation action.
Standard_EXPORT virtual void handleXRTeleport(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Handle picking on trigger click.
Standard_EXPORT virtual void handleXRPicking(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Perform dynamic highlighting for active hand.
Standard_EXPORT virtual void handleXRHighlight(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Display auxiliary XR presentations.
Standard_EXPORT virtual void handleXRPresentations(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Perform picking with/without dynamic highlighting for XR pose.
Standard_EXPORT virtual Standard_Integer handleXRMoveTo(
const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const gp_Trsf& thePose,
const Standard_Boolean theToHighlight);
protected:
//! Flush buffers.
Standard_EXPORT virtual void flushBuffers(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Flush touch gestures.
Standard_EXPORT virtual void flushGestures(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Return current and previously fetched event times.
//! This callback is intended to compute delta between sequentially processed events.
//! @param[out] thePrevTime events time fetched previous time by this method
//! @param[out] theCurrTime actual events time
void updateEventsTime(double& thePrevTime, double& theCurrTime)
{
thePrevTime = myLastEventsTime;
myLastEventsTime = EventTime();
theCurrTime = myLastEventsTime;
}
//! Perform selection via mouse click.
//! This method is expected to be called from rendering thread.
Standard_EXPORT virtual void handleSelectionPick(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Perform dynamic highlight on mouse move.
//! This method is expected to be called from rendering thread.
Standard_EXPORT virtual void handleDynamicHighlight(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Perform rubber-band selection.
//! This method is expected to be called from rendering thread.
Standard_EXPORT virtual void handleSelectionPoly(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView);
//! Lazy AIS_InteractiveContext::MoveTo() with myPrevMoveTo check.
Standard_EXPORT virtual void contextLazyMoveTo(const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const Graphic3d_Vec2i& thePnt);
protected:
AIS_ViewInputBuffer myUI; //!< buffer for UI thread
AIS_ViewInputBuffer myGL; //!< buffer for rendering thread
// clang-format off
Standard_Real myLastEventsTime; //!< last fetched events timer value for computing delta/progress
Standard_Boolean myToAskNextFrame; //!< flag indicating that another frame should be drawn right after this one
Standard_Boolean myIsContinuousRedraw; //!< continuous redrawing (without immediate rendering optimization)
Standard_Real myMinCamDistance; //!< minimal camera distance for zoom operation
AIS_RotationMode myRotationMode; //!< rotation mode
AIS_NavigationMode myNavigationMode; //!< navigation mode (orbit rotation / first person)
Standard_ShortReal myMouseAccel; //!< mouse input acceleration ratio in First Person mode
Standard_ShortReal myOrbitAccel; //!< Orbit rotation acceleration ratio
Standard_Boolean myToShowPanAnchorPoint; //!< option displaying panning anchor point
Standard_Boolean myToShowRotateCenter; //!< option displaying rotation center point
Standard_Boolean myToLockOrbitZUp; //!< force camera up orientation within AIS_NavigationMode_Orbit rotation mode
Standard_Boolean myToInvertPitch; //!< flag inverting pitch direction while processing Aspect_VKey_NavLookUp/Aspect_VKey_NavLookDown
Standard_Boolean myToAllowTouchZRotation; //!< enable z-rotation two-touches gesture; FALSE by default
Standard_Boolean myToAllowRotation; //!< enable rotation; TRUE by default
Standard_Boolean myToAllowPanning; //!< enable panning; TRUE by default
Standard_Boolean myToAllowZooming; //!< enable zooming; TRUE by default
Standard_Boolean myToAllowZFocus; //!< enable ZFocus change; TRUE by default
Standard_Boolean myToAllowHighlight; //!< enable dynamic highlight on mouse move; TRUE by default
Standard_Boolean myToAllowDragging; //!< enable dragging object; TRUE by default
Standard_Boolean myToStickToRayOnZoom; //!< project picked point to ray while zooming at point, TRUE by default
Standard_Boolean myToStickToRayOnRotation; //!< project picked point to ray while rotating around point; TRUE by default
Standard_ShortReal myWalkSpeedAbsolute; //!< normal walking speed, in m/s; 1.5 by default
Standard_ShortReal myWalkSpeedRelative; //!< walking speed relative to scene bounding box; 0.1 by default
Standard_ShortReal myThrustSpeed; //!< active thrust value
Standard_Boolean myHasThrust; //!< flag indicating active thrust
Handle(AIS_AnimationCamera) myViewAnimation; //!< view animation
Handle(AIS_Animation) myObjAnimation; //!< objects animation
Standard_Boolean myToPauseObjAnimation; //!< flag to pause objects animation on mouse click; FALSE by default
Handle(AIS_RubberBand) myRubberBand; //!< Rubber-band presentation
Handle(SelectMgr_EntityOwner) myDragOwner; //!< detected owner of currently dragged object
Handle(AIS_InteractiveObject) myDragObject; //!< currently dragged object
Graphic3d_Vec2i myPrevMoveTo; //!< previous position of MoveTo event in 3D viewer
Standard_Boolean myHasHlrOnBeforeRotation; //!< flag for restoring Computed mode after rotation
protected: //! @name XR input variables
NCollection_Array1<Handle(AIS_XRTrackedDevice)> myXRPrsDevices; //!< array of XR tracked devices presentations
// clang-format on
Quantity_Color myXRLaserTeleColor; //!< color of teleport laser
Quantity_Color myXRLaserPickColor; //!< color of picking laser
Aspect_XRTrackedDeviceRole myXRLastTeleportHand; //!< active hand for teleport
Aspect_XRTrackedDeviceRole myXRLastPickingHand; //!< active hand for picking objects
Aspect_XRHapticActionData myXRTeleportHaptic; //!< vibration on picking teleport destination
Aspect_XRHapticActionData myXRPickingHaptic; //!< vibration on dynamic highlighting
Aspect_XRHapticActionData myXRSelectHaptic; //!< vibration on selection
Standard_Real myXRLastPickDepthLeft; //!< last picking depth for left hand
Standard_Real myXRLastPickDepthRight; //!< last picking depth for right hand
Standard_Real myXRTurnAngle; //!< discrete turn angle for XR trackpad
// clang-format off
Standard_Boolean myToDisplayXRAuxDevices; //!< flag to display auxiliary tracked XR devices
Standard_Boolean myToDisplayXRHands; //!< flag to display XR hands
protected: //! @name mouse input variables
Standard_Real myMouseClickThreshold; //!< mouse click threshold in pixels; 3 by default
Standard_Real myMouseDoubleClickInt; //!< double click interval in seconds; 0.4 by default
Standard_ShortReal myScrollZoomRatio; //!< distance ratio for mapping mouse scroll event to zoom; 15.0 by default
AIS_MouseGestureMap myMouseGestureMap; //!< map defining mouse gestures
AIS_MouseGestureMap myMouseGestureMapDrag; //!< secondary map defining mouse gestures for dragging
AIS_MouseGesture myMouseActiveGesture; //!< initiated mouse gesture (by pressing mouse button)
AIS_MouseSelectionSchemeMap
myMouseSelectionSchemes; //!< map defining selection schemes bound to mouse + modifiers
Standard_Boolean myMouseActiveIdleRotation; //!< flag indicating view idle rotation state
Graphic3d_Vec2i myMousePressPoint; //!< mouse position where active gesture was been initiated
Graphic3d_Vec2i myMouseProgressPoint; //!< gesture progress
OSD_Timer myMouseClickTimer; //!< timer for handling double-click event
Standard_Integer myMouseClickCounter; //!< counter for handling double-click event
Standard_Integer myMouseSingleButton; //!< index of mouse button pressed alone (>0)
Standard_Boolean myMouseStopDragOnUnclick; //!< queue stop dragging even with at next mouse unclick
protected: //! @name multi-touch input variables
Standard_ShortReal myTouchToleranceScale; //!< tolerance scale factor; 1.0 by default
Standard_ShortReal myTouchClickThresholdPx; //!< touch click threshold in pixels; 3 by default
Standard_ShortReal myTouchRotationThresholdPx; //!< threshold for starting one-touch rotation gesture in pixels; 6 by default
Standard_ShortReal myTouchZRotationThreshold; //!< threshold for starting two-touch Z-rotation gesture in radians; 2 degrees by default
Standard_ShortReal myTouchPanThresholdPx; //!< threshold for starting two-touch panning gesture in pixels; 4 by default
Standard_ShortReal myTouchZoomThresholdPx; //!< threshold for starting two-touch zoom (pitch) gesture in pixels; 6 by default
Standard_ShortReal myTouchZoomRatio; //!< distance ratio for mapping two-touch zoom (pitch) gesture from pixels to zoom; 0.13 by default
Standard_ShortReal myTouchDraggingThresholdPx; //!< distance for starting one-touch dragging gesture in pixels; 6 by default
Aspect_Touch myTouchClick; //!< single touch position for handling clicks
OSD_Timer myTouchDoubleTapTimer; //!< timer for handling double tap
Graphic3d_Vec2d myStartPanCoord; //!< touch coordinates at the moment of starting panning gesture
Graphic3d_Vec2d myStartRotCoord; //!< touch coordinates at the moment of starting rotating gesture
Standard_Integer myNbTouchesLast; //!< number of touches within previous gesture flush to track gesture changes
Standard_Boolean myUpdateStartPointPan; //!< flag indicating that new anchor point should be picked for starting panning gesture
Standard_Boolean myUpdateStartPointRot; //!< flag indicating that new gravity point should be picked for starting rotation gesture
Standard_Boolean myUpdateStartPointZRot; //!< flag indicating that new gravity point should be picked for starting Z-rotation gesture
protected: //! @name rotation/panning transient state variables
Handle(AIS_Point) myAnchorPointPrs1; //!< anchor point presentation (Graphic3d_ZLayerId_Top)
Handle(AIS_Point) myAnchorPointPrs2; //!< anchor point presentation (Graphic3d_ZLayerId_Topmost)
gp_Pnt myPanPnt3d; //!< active panning anchor point
gp_Pnt myRotatePnt3d; //!< active rotation center of gravity
gp_Dir myCamStartOpUp; //!< camera Up direction at the beginning of rotation
gp_Dir myCamStartOpDir; //!< camera View direction at the beginning of rotation
gp_Pnt myCamStartOpEye; //!< camera Eye position at the beginning of rotation
gp_Pnt myCamStartOpCenter; //!< camera Center position at the beginning of rotation
gp_Vec myCamStartOpToCenter; //!< vector from rotation gravity point to camera Center at the beginning of rotation
gp_Vec myCamStartOpToEye; //!< vector from rotation gravity point to camera Eye at the beginning of rotation
Graphic3d_Vec3d myRotateStartYawPitchRoll; //!< camera yaw pitch roll at the beginning of rotation
// clang-format on
};
#endif // _AIS_ViewController_HeaderFile

View File

@ -0,0 +1,753 @@
// Created on: 2017-07-25
// Created by: Anastasia BOBYLEVA
// Copyright (c) 2017-2019 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_ViewCube_HeaderFile
#define _AIS_ViewCube_HeaderFile
#include "AIS_InteractiveObject.hxx"
#include "Graphic3d_Camera.hxx"
#include "Graphic3d_Vec2.hxx"
#include "Prs3d_DatumParts.hxx"
#include "Prs3d_ShadingAspect.hxx"
#include "Prs3d_TextAspect.hxx"
#include "SelectMgr_EntityOwner.hxx"
#include "V3d_TypeOfOrientation.hxx"
#include "Select3D_SensitivePrimitiveArray.hxx"
class AIS_AnimationCamera;
class AIS_ViewCubeOwner;
class Graphic3d_ArrayOfTriangles;
class V3d_View;
//! Interactive object for displaying the view manipulation cube.
//!
//! View cube consists of several parts that are responsible for different camera manipulations:
//! @li Cube sides represent main views: top, bottom, left, right, front and back.
//! @li Edges represent rotation of one of main views on 45 degrees.
//! @li Vertices represent rotation of one of man views in two directions.
//!
//! The object is expected to behave like a trihedron in the view corner,
//! therefore its position should be defined using transformation persistence flags:
//! @code SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_TriedronPers,
//! Aspect_TOTP_LEFT_LOWER, Graphic3d_Vec2i (100, 100)); @endcode
//!
//! View Cube parts are sensitive to detection, or dynamic highlighting (but not selection),
//! and every its owner AIS_ViewCubeOwner corresponds to camera transformation.
//! @code
//! for (aViewCube->StartAnimation (aDetectedOwner); aViewCube->HasAnimation(); )
//! {
//! aViewCube->UpdateAnimation();
//! ... // updating of application window
//! }
//! @endcode
//! or
//! @code aViewCube->HandleClick (aDetectedOwner); @endcode
//! that includes transformation loop.
//! This loop allows external actions like application updating. For this purpose AIS_ViewCube has
//! virtual interface onAfterAnimation(), that is to be redefined on application level.
class AIS_ViewCube : public AIS_InteractiveObject
{
DEFINE_STANDARD_RTTIEXT(AIS_ViewCube, AIS_InteractiveObject)
public:
//! Return TRUE if specified orientation belongs to box side.
Standard_EXPORT static bool IsBoxSide(V3d_TypeOfOrientation theOrient);
//! Return TRUE if specified orientation belongs to box edge.
Standard_EXPORT static bool IsBoxEdge(V3d_TypeOfOrientation theOrient);
//! Return TRUE if specified orientation belongs to box corner (vertex).
Standard_EXPORT static bool IsBoxCorner(V3d_TypeOfOrientation theOrient);
public:
//! Empty constructor.
Standard_EXPORT AIS_ViewCube();
//! Return view animation.
const Handle(AIS_AnimationCamera)& ViewAnimation() const { return myViewAnimation; }
//! Set view animation.
void SetViewAnimation(const Handle(AIS_AnimationCamera)& theAnimation)
{
myViewAnimation = theAnimation;
}
//! Return TRUE if automatic camera transformation on selection (highlighting) is enabled; TRUE by
//! default.
Standard_Boolean ToAutoStartAnimation() const { return myToAutoStartAnim; }
//! Enable/disable automatic camera transformation on selection (highlighting).
//! The automatic logic can be disabled if application wants performing action manually
//! basing on picking results (AIS_ViewCubeOwner).
void SetAutoStartAnimation(bool theToEnable) { myToAutoStartAnim = theToEnable; }
//! Return TRUE if camera animation should be done in uninterruptible loop; TRUE by default.
Standard_Boolean IsFixedAnimationLoop() const { return myIsFixedAnimation; }
//! Set if camera animation should be done in uninterruptible loop.
void SetFixedAnimationLoop(bool theToEnable) { myIsFixedAnimation = theToEnable; }
//! Reset all size and style parameters to default.
//! @warning It doesn't reset position of View Cube
Standard_EXPORT void ResetStyles();
protected:
//! Set default visual attributes
Standard_EXPORT void setDefaultAttributes();
//! Set default dynamic highlight properties
Standard_EXPORT void setDefaultHighlightAttributes();
public: //! @name Geometry management API
//! @return size (width and height) of View cube sides; 100 by default.
Standard_Real Size() const { return mySize; }
//! Sets size (width and height) of View cube sides.
//! @param theToAdaptAnother if TRUE, then other parameters will be adapted to specified size
Standard_EXPORT void SetSize(Standard_Real theValue, Standard_Boolean theToAdaptAnother = true);
//! Return box facet extension to edge/corner facet split; 10 by default.
Standard_Real BoxFacetExtension() const { return myBoxFacetExtension; }
//! Set new value of box facet extension.
void SetBoxFacetExtension(Standard_Real theValue)
{
if (Abs(myBoxFacetExtension - theValue) > Precision::Confusion())
{
myBoxFacetExtension = theValue;
SetToUpdate();
}
}
//! Return padding between axes and 3D part (box); 10 by default.
Standard_Real AxesPadding() const { return myAxesPadding; }
//! Set new value of padding between axes and 3D part (box).
void SetAxesPadding(Standard_Real theValue)
{
if (Abs(myAxesPadding - theValue) > Precision::Confusion())
{
myAxesPadding = theValue;
SetToUpdate();
}
}
//! Return gap between box edges and box sides; 0 by default.
Standard_Real BoxEdgeGap() const { return myBoxEdgeGap; }
//! Set new value of box edges gap.
void SetBoxEdgeGap(Standard_Real theValue)
{
if (Abs(myBoxEdgeGap - theValue) > Precision::Confusion())
{
myBoxEdgeGap = theValue;
SetToUpdate();
}
}
//! Return minimal size of box edge; 2 by default.
Standard_Real BoxEdgeMinSize() const { return myBoxEdgeMinSize; }
//! Set new value of box edge minimal size.
void SetBoxEdgeMinSize(Standard_Real theValue)
{
if (Abs(myBoxEdgeMinSize - theValue) > Precision::Confusion())
{
myBoxEdgeMinSize = theValue;
SetToUpdate();
}
}
//! Return minimal size of box corner; 2 by default.
Standard_Real BoxCornerMinSize() const { return myCornerMinSize; }
//! Set new value of box corner minimal size.
void SetBoxCornerMinSize(Standard_Real theValue)
{
if (Abs(myCornerMinSize - theValue) > Precision::Confusion())
{
myCornerMinSize = theValue;
SetToUpdate();
}
}
//! Return relative radius of side corners (round rectangle); 0.0 by default.
//! The value in within [0, 0.5] range meaning absolute radius = RoundRadius() / Size().
Standard_Real RoundRadius() const { return myRoundRadius; }
//! Set relative radius of View Cube sides corners (round rectangle).
//! The value should be within [0, 0.5] range.
Standard_EXPORT void SetRoundRadius(const Standard_Real theValue);
//! Returns radius of axes of the trihedron; 1.0 by default.
Standard_Real AxesRadius() const { return myAxesRadius; }
//! Sets radius of axes of the trihedron.
void SetAxesRadius(const Standard_Real theRadius)
{
if (Abs(myAxesRadius - theRadius) > Precision::Confusion())
{
myAxesRadius = theRadius;
SetToUpdate();
}
}
//! Returns radius of cone of axes of the trihedron; 3.0 by default.
Standard_Real AxesConeRadius() const { return myAxesConeRadius; }
//! Sets radius of cone of axes of the trihedron.
void SetAxesConeRadius(Standard_Real theRadius)
{
if (Abs(myAxesConeRadius - theRadius) > Precision::Confusion())
{
myAxesConeRadius = theRadius;
SetToUpdate();
}
}
//! Returns radius of sphere (central point) of the trihedron; 4.0 by default.
Standard_Real AxesSphereRadius() const { return myAxesSphereRadius; }
//! Sets radius of sphere (central point) of the trihedron.
void SetAxesSphereRadius(Standard_Real theRadius)
{
if (Abs(myAxesSphereRadius - theRadius) > Precision::Confusion())
{
myAxesSphereRadius = theRadius;
SetToUpdate();
}
}
//! @return TRUE if trihedron is drawn; TRUE by default.
Standard_Boolean ToDrawAxes() const { return myToDisplayAxes; }
//! Enable/disable drawing of trihedron.
void SetDrawAxes(Standard_Boolean theValue)
{
if (myToDisplayAxes != theValue)
{
myToDisplayAxes = theValue;
SetToUpdate();
}
}
//! @return TRUE if edges of View Cube is drawn; TRUE by default.
Standard_Boolean ToDrawEdges() const { return myToDisplayEdges; }
//! Enable/disable drawing of edges of View Cube.
void SetDrawEdges(Standard_Boolean theValue)
{
if (myToDisplayEdges != theValue)
{
myToDisplayEdges = theValue;
SetToUpdate();
}
}
//! Return TRUE if vertices (vertex) of View Cube is drawn; TRUE by default.
Standard_Boolean ToDrawVertices() const { return myToDisplayVertices; }
//! Enable/disable drawing of vertices (corners) of View Cube.
void SetDrawVertices(Standard_Boolean theValue)
{
if (myToDisplayVertices != theValue)
{
myToDisplayVertices = theValue;
SetToUpdate();
}
}
//! Return TRUE if application expects Y-up viewer orientation instead of Z-up; FALSE by default.
Standard_Boolean IsYup() const { return myIsYup; }
//! Set if application expects Y-up viewer orientation instead of Z-up.
Standard_EXPORT void SetYup(Standard_Boolean theIsYup,
Standard_Boolean theToUpdateLabels = Standard_True);
public: //! @name Style management API
//! Return shading style of box sides.
const Handle(Prs3d_ShadingAspect)& BoxSideStyle() const { return myDrawer->ShadingAspect(); }
//! Return shading style of box edges.
const Handle(Prs3d_ShadingAspect)& BoxEdgeStyle() const { return myBoxEdgeAspect; }
//! Return shading style of box corners.
const Handle(Prs3d_ShadingAspect)& BoxCornerStyle() const { return myBoxCornerAspect; }
//! Return value of front color for the 3D part of object.
const Quantity_Color& BoxColor() const { return myDrawer->ShadingAspect()->Color(); }
//! Set new value of front color for the 3D part of object.
//! @param[in] theColor input color value.
void SetBoxColor(const Quantity_Color& theColor)
{
if (!myDrawer->ShadingAspect()->Color().IsEqual(theColor)
|| !myBoxEdgeAspect->Color().IsEqual(theColor)
|| !myBoxCornerAspect->Color().IsEqual(theColor))
{
myDrawer->ShadingAspect()->SetColor(theColor);
myBoxEdgeAspect->SetColor(theColor);
myBoxCornerAspect->SetColor(theColor);
SynchronizeAspects();
}
}
//! Return transparency for 3D part of object.
Standard_Real BoxTransparency() const { return myDrawer->ShadingAspect()->Transparency(); }
//! Set new value of transparency for 3D part of object.
//! @param[in] theValue input transparency value
void SetBoxTransparency(Standard_Real theValue)
{
if (Abs(myDrawer->ShadingAspect()->Transparency() - theValue) > Precision::Confusion()
|| Abs(myBoxEdgeAspect->Transparency() - theValue) > Precision::Confusion()
|| Abs(myBoxCornerAspect->Transparency() - theValue) > Precision::Confusion())
{
myDrawer->ShadingAspect()->SetTransparency(theValue);
myBoxEdgeAspect->SetTransparency(theValue);
myBoxCornerAspect->SetTransparency(theValue);
SynchronizeAspects();
}
}
//! Return color of sides back material.
const Quantity_Color& InnerColor() const
{
return myDrawer->ShadingAspect()->Color(Aspect_TOFM_BACK_SIDE);
}
//! Set color of sides back material. Alias for:
//! @code Attributes()->ShadingAspect()->Aspect()->ChangeBackMaterial().SetColor() @endcode
void SetInnerColor(const Quantity_Color& theColor)
{
myDrawer->ShadingAspect()->SetColor(theColor, Aspect_TOFM_BACK_SIDE);
SynchronizeAspects();
}
//! Return box side label or empty string if undefined.
//! Default labels: FRONT, BACK, LEFT, RIGHT, TOP, BOTTOM.
TCollection_AsciiString BoxSideLabel(V3d_TypeOfOrientation theSide) const
{
const TCollection_AsciiString* aLabel = myBoxSideLabels.Seek(theSide);
return aLabel != NULL ? *aLabel : TCollection_AsciiString();
}
//! Set box side label.
void SetBoxSideLabel(const V3d_TypeOfOrientation theSide, const TCollection_AsciiString& theLabel)
{
if (!IsBoxSide(theSide))
{
throw Standard_ProgramError("AIS_ViewCube::SetBoxSideLabel(), invalid enumeration value");
}
myBoxSideLabels.Bind(theSide, theLabel);
SetToUpdate();
}
//! Return text color of labels of box sides; BLACK by default.
const Quantity_Color& TextColor() const { return myDrawer->TextAspect()->Aspect()->Color(); }
//! Set color of text labels on box sides. Alias for:
//! @code Attributes()->TextAspect()->SetColor() @endcode
void SetTextColor(const Quantity_Color& theColor)
{
myDrawer->TextAspect()->SetColor(theColor);
SynchronizeAspects();
}
//! Return font name that is used for displaying of sides and axes text. Alias for:
//! @code Attributes()->TextAspect()->Aspect()->SetFont() @endcode
const TCollection_AsciiString& Font() const { return myDrawer->TextAspect()->Aspect()->Font(); }
//! Set font name that is used for displaying of sides and axes text. Alias for:
//! @code Attributes()->TextAspect()->SetFont() @endcode
void SetFont(const TCollection_AsciiString& theFont)
{
myDrawer->TextAspect()->Aspect()->SetFont(theFont);
SynchronizeAspects();
}
//! Return height of font
Standard_Real FontHeight() const { return myDrawer->TextAspect()->Height(); }
//! Change font height. Alias for:
//! @code Attributes()->TextAspect()->SetHeight() @endcode
void SetFontHeight(Standard_Real theValue)
{
if (Abs(myDrawer->TextAspect()->Height() - theValue) > Precision::Confusion())
{
myDrawer->TextAspect()->SetHeight(theValue);
SetToUpdate();
}
}
//! Return axes labels or empty string if undefined.
//! Default labels: X, Y, Z.
TCollection_AsciiString AxisLabel(Prs3d_DatumParts theAxis) const
{
const TCollection_AsciiString* aLabel = myAxesLabels.Seek(theAxis);
return aLabel != NULL ? *aLabel : TCollection_AsciiString();
}
//! Set axes labels.
void SetAxesLabels(const TCollection_AsciiString& theX,
const TCollection_AsciiString& theY,
const TCollection_AsciiString& theZ)
{
myAxesLabels.Bind(Prs3d_DatumParts_XAxis, theX);
myAxesLabels.Bind(Prs3d_DatumParts_YAxis, theY);
myAxesLabels.Bind(Prs3d_DatumParts_ZAxis, theZ);
SetToUpdate();
}
public:
//! Set new value of color for the whole object.
//! @param[in] theColor input color value.
virtual void SetColor(const Quantity_Color& theColor) Standard_OVERRIDE { SetBoxColor(theColor); }
//! Reset color for the whole object.
virtual void UnsetColor() Standard_OVERRIDE
{
myDrawer->ShadingAspect()->SetColor(Quantity_NOC_WHITE);
myBoxEdgeAspect->SetColor(Quantity_NOC_GRAY30);
myBoxCornerAspect->SetColor(Quantity_NOC_GRAY30);
SynchronizeAspects();
}
//! Set new value of transparency for the whole object.
//! @param[in] theValue input transparency value.
virtual void SetTransparency(const Standard_Real theValue) Standard_OVERRIDE
{
SetBoxTransparency(theValue);
}
//! Reset transparency for the whole object.
virtual void UnsetTransparency() Standard_OVERRIDE { SetBoxTransparency(0.0f); }
//! Sets the material for the interactive object.
virtual void SetMaterial(const Graphic3d_MaterialAspect& theMat) Standard_OVERRIDE
{
myDrawer->ShadingAspect()->SetMaterial(theMat);
myBoxEdgeAspect->SetMaterial(theMat);
myBoxCornerAspect->SetMaterial(theMat);
SynchronizeAspects();
}
//! Sets the material for the interactive object.
virtual void UnsetMaterial() Standard_OVERRIDE
{
Graphic3d_MaterialAspect aMat(Graphic3d_NameOfMaterial_UserDefined);
aMat.SetColor(Quantity_NOC_WHITE);
aMat.SetAmbientColor(Quantity_NOC_GRAY60);
myDrawer->ShadingAspect()->SetMaterial(aMat);
myBoxEdgeAspect->SetMaterial(aMat);
myBoxEdgeAspect->SetColor(Quantity_NOC_GRAY30);
myBoxCornerAspect->SetMaterial(aMat);
myBoxCornerAspect->SetColor(Quantity_NOC_GRAY30);
SynchronizeAspects();
}
public: //! @name animation methods
//! Return duration of animation in seconds; 0.5 sec by default
Standard_EXPORT Standard_Real Duration() const;
//! Set duration of animation.
//! @param[in] theValue input value of duration in seconds
Standard_EXPORT void SetDuration(Standard_Real theValue);
//! Return TRUE if new camera Up direction should be always set to default value for a new camera
//! Direction; FALSE by default. When this flag is FALSE, the new camera Up will be set as current
//! Up orthogonalized to the new camera Direction, and will set to default Up on second click.
Standard_Boolean ToResetCameraUp() const { return myToResetCameraUp; }
//! Set if new camera Up direction should be always set to default value for a new camera
//! Direction.
void SetResetCamera(Standard_Boolean theToReset) { myToResetCameraUp = theToReset; }
//! Return TRUE if animation should fit selected objects and FALSE to fit entire scene; TRUE by
//! default.
Standard_Boolean ToFitSelected() const { return myToFitSelected; }
//! Set if animation should fit selected objects or to fit entire scene.
void SetFitSelected(Standard_Boolean theToFitSelected) { myToFitSelected = theToFitSelected; }
//! @return TRUE if View Cube has unfinished animation of view camera.
Standard_EXPORT Standard_Boolean HasAnimation() const;
//! Start camera transformation corresponding to the input detected owner.
//! @param[in] theOwner detected owner.
Standard_EXPORT virtual void StartAnimation(const Handle(AIS_ViewCubeOwner)& theOwner);
//! Perform one step of current camera transformation.
//! theToUpdate[in] enable/disable update of view.
//! @return TRUE if animation is not stopped.
Standard_EXPORT virtual Standard_Boolean UpdateAnimation(const Standard_Boolean theToUpdate);
//! Perform camera transformation corresponding to the input detected owner.
Standard_EXPORT virtual void HandleClick(const Handle(AIS_ViewCubeOwner)& theOwner);
protected:
//! Perform internal single step of animation.
//! @return FALSE if animation has been finished
Standard_EXPORT Standard_Boolean updateAnimation();
//! Fit selected/all into view.
//! @param[in] theView view definition to retrieve scene bounding box
//! @param theCamera [in,out] camera definition
Standard_EXPORT virtual void viewFitAll(const Handle(V3d_View)& theView,
const Handle(Graphic3d_Camera)& theCamera);
protected: //! @name protected virtual API
//! Method that is called after one step of transformation.
virtual void onAfterAnimation() {}
//! Method that is called after transformation finish.
virtual void onAnimationFinished() {}
public: //! @name Presentation computation
//! Return TRUE for supported display mode.
virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const Standard_OVERRIDE
{
return theMode == 0;
}
//! Global selection has no meaning for this class.
virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE
{
return Handle(SelectMgr_EntityOwner)();
}
//! Compute 3D part of View Cube.
//! @param[in] thePrsMgr presentation manager.
//! @param[in] thePrs input presentation that is to be filled with flat presentation primitives.
//! @param[in] theMode display mode.
//! @warning this object accept only 0 display mode.
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
const Handle(Prs3d_Presentation)& thePrs,
const Standard_Integer theMode = 0) Standard_OVERRIDE;
//! Redefine computing of sensitive entities for View Cube.
//! @param[in] theSelection input selection object that is to be filled with sensitive entities.
//! @param[in] theMode selection mode.
//! @warning object accepts only 0 selection mode.
Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode) Standard_OVERRIDE;
//! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overridden
//! methods.
virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE { return Standard_False; }
//! Method which clear all selected owners belonging to this selectable object.
//! @warning this object does not support selection.
virtual void ClearSelected() Standard_OVERRIDE {}
//! Method which highlights input owner belonging to this selectable object.
//! @param[in] thePM presentation manager
//! @param[in] theStyle style for dynamic highlighting.
//! @param[in] theOwner input entity owner.
Standard_EXPORT virtual void HilightOwnerWithColor(
const Handle(PrsMgr_PresentationManager)& thePM,
const Handle(Prs3d_Drawer)& theStyle,
const Handle(SelectMgr_EntityOwner)& theOwner) Standard_OVERRIDE;
//! Method which draws selected owners.
Standard_EXPORT virtual void HilightSelected(const Handle(PrsMgr_PresentationManager)& thePM,
const SelectMgr_SequenceOfOwner& theSeq)
Standard_OVERRIDE;
//! Set default parameters for visual attributes
//! @sa Attributes()
virtual void UnsetAttributes() Standard_OVERRIDE
{
setDefaultAttributes();
SetToUpdate();
}
//! Set default parameters for dynamic highlighting attributes, reset highlight attributes
virtual void UnsetHilightAttributes() Standard_OVERRIDE
{
myHilightDrawer.Nullify();
setDefaultHighlightAttributes();
SetToUpdate();
}
protected: //! @name Auxiliary classes to fill presentation with proper primitives
//! Create triangulation for a box part - for presentation and selection purposes.
//! @param theTris [in,out] triangulation to fill, or NULL to return size
//! @param theNbNodes [in,out] should be incremented by a number of nodes defining this
//! triangulation
//! @param theNbTris [in,out] should be incremented by a number of triangles defining this
//! triangulation
//! @param[in] theDir part to define
Standard_EXPORT virtual void createBoxPartTriangles(
const Handle(Graphic3d_ArrayOfTriangles)& theTris,
Standard_Integer& theNbNodes,
Standard_Integer& theNbTris,
V3d_TypeOfOrientation theDir) const;
//! Create triangulation for a box side.
//! @param theTris [in,out] triangulation to fill, or NULL to return size
//! @param theNbNodes [in,out] should be incremented by a number of nodes defining this
//! triangulation
//! @param theNbTris [in,out] should be incremented by a number of triangles defining this
//! triangulation
//! @param[in] theDir part to define
Standard_EXPORT virtual void createBoxSideTriangles(
const Handle(Graphic3d_ArrayOfTriangles)& theTris,
Standard_Integer& theNbNodes,
Standard_Integer& theNbTris,
V3d_TypeOfOrientation theDir) const;
//! Create triangulation for a box edge.
//! @param theTris [in,out] triangulation to fill, or NULL to return size
//! @param theNbNodes [in,out] should be incremented by a number of nodes defining this
//! triangulation
//! @param theNbTris [in,out] should be incremented by a number of triangles defining this
//! triangulation
//! @param[in] theDir part to define
Standard_EXPORT virtual void createBoxEdgeTriangles(
const Handle(Graphic3d_ArrayOfTriangles)& theTris,
Standard_Integer& theNbNodes,
Standard_Integer& theNbTris,
V3d_TypeOfOrientation theDir) const;
//! Create triangulation for a box corner (vertex).
//! @param theTris [in,out] triangulation to fill, or NULL to return size
//! @param theNbNodes [in,out] should be incremented by a number of nodes defining this
//! triangulation
//! @param theNbTris [in,out] should be incremented by a number of triangles defining this
//! triangulation
//! @param[in] theDir part to define
Standard_EXPORT virtual void createBoxCornerTriangles(
const Handle(Graphic3d_ArrayOfTriangles)& theTris,
Standard_Integer& theNbNodes,
Standard_Integer& theNbTris,
V3d_TypeOfOrientation theDir) const;
protected:
//! Create triangulation for a rectangle with round corners.
//! @param theTris [in,out] triangulation to fill, or NULL to return size
//! @param theNbNodes [in,out] should be incremented by a number of nodes defining this
//! triangulation
//! @param theNbTris [in,out] should be incremented by a number of triangles defining this
//! triangulation
//! @param[in] theSize rectangle dimensions
//! @param[in] theRadius radius at corners
//! @param[in] theTrsf transformation
Standard_EXPORT static void createRoundRectangleTriangles(
const Handle(Graphic3d_ArrayOfTriangles)& theTris,
Standard_Integer& theNbNodes,
Standard_Integer& theNbTris,
const gp_XY& theSize,
Standard_Real theRadius,
const gp_Trsf& theTrsf);
protected:
NCollection_DataMap<V3d_TypeOfOrientation, TCollection_AsciiString>
myBoxSideLabels; //!< map with box side labels
NCollection_DataMap<Prs3d_DatumParts, TCollection_AsciiString>
myAxesLabels; //!< map with axes labels
Handle(Prs3d_ShadingAspect) myBoxEdgeAspect; //!< style for box edges
Handle(Prs3d_ShadingAspect) myBoxCornerAspect; //!< style for box corner
Standard_Real mySize; //!< size of box side, length of one axis
Standard_Real myBoxEdgeMinSize; //!< minimal size of box edge
Standard_Real myBoxEdgeGap; //!< gap between box side and box edge
Standard_Real myBoxFacetExtension; //!< box facet extension
Standard_Real myAxesPadding; //!< Padding between box and axes
// clang-format off
Standard_Real myAxesRadius; //!< radius of axes of the trihedron; 1.0 by default
Standard_Real myAxesConeRadius; //!< radius of cone of axes of the trihedron; 3.0 by default
Standard_Real myAxesSphereRadius; //!< radius of sphere (central point) of the trihedron; 4.0 by default
Standard_Real myCornerMinSize; //!< minimal size of box corner
Standard_Real myRoundRadius; //!< relative round radius within [0; 0.5] range
Standard_Boolean myToDisplayAxes; //!< trihedron visibility
Standard_Boolean myToDisplayEdges; //!< box edges visibility
Standard_Boolean myToDisplayVertices; //!< box corners (vertices) visibility
Standard_Boolean myIsYup; //!< flag indicating that application expects Y-up viewer orientation instead of Z-up
// clang-format on
protected: //! @name Animation options
Handle(AIS_AnimationCamera) myViewAnimation; //!< Camera animation object
Handle(Graphic3d_Camera) myStartState; //!< Start state of view camera
Handle(Graphic3d_Camera) myEndState; //!< End state of view camera
Standard_Boolean myToAutoStartAnim; //!< start animation automatically on click
Standard_Boolean myIsFixedAnimation; //!< fixed-loop animation
Standard_Boolean myToFitSelected; //!< fit selected or fit entire scene
// clang-format off
Standard_Boolean myToResetCameraUp; //!< always reset camera up direction to default
// clang-format on
};
//! Redefined entity owner that is highlighted when owner is detected,
//! even if Interactive Context highlighted on last detection procedure.
class AIS_ViewCubeOwner : public SelectMgr_EntityOwner
{
DEFINE_STANDARD_RTTIEXT(AIS_ViewCubeOwner, SelectMgr_EntityOwner)
public:
//! Main constructor.
AIS_ViewCubeOwner(const Handle(AIS_ViewCube)& theObject,
V3d_TypeOfOrientation theOrient,
Standard_Integer thePriority = 5)
: SelectMgr_EntityOwner((const Handle(SelectMgr_SelectableObject)&)theObject, thePriority),
myMainOrient(theOrient)
{
myFromDecomposition = true;
}
//! @return TRUE. This owner will always call method
//! Hilight for its Selectable Object when the owner is detected.
virtual Standard_Boolean IsForcedHilight() const Standard_OVERRIDE { return Standard_True; }
//! Return new orientation to set.
V3d_TypeOfOrientation MainOrientation() const { return myMainOrient; }
//! Handle mouse button click event.
virtual Standard_Boolean HandleMouseClick(const Graphic3d_Vec2i& thePoint,
Aspect_VKeyMouse theButton,
Aspect_VKeyFlags theModifiers,
bool theIsDoubleClick) Standard_OVERRIDE
{
(void)thePoint;
(void)theButton;
(void)theModifiers;
(void)theIsDoubleClick;
AIS_ViewCube* aCubePrs = dynamic_cast<AIS_ViewCube*>(mySelectable);
aCubePrs->HandleClick(this);
return Standard_True;
}
protected:
V3d_TypeOfOrientation myMainOrient; //!< new orientation to set
};
//! Simple sensitive element for picking by point only.
class AIS_ViewCubeSensitive : public Select3D_SensitivePrimitiveArray
{
DEFINE_STANDARD_RTTIEXT(AIS_ViewCubeSensitive, Select3D_SensitivePrimitiveArray)
public:
//! Constructor.
Standard_EXPORT AIS_ViewCubeSensitive(const Handle(SelectMgr_EntityOwner)& theOwner,
const Handle(Graphic3d_ArrayOfTriangles)& theTris);
//! Checks whether element overlaps current selecting volume.
Standard_EXPORT virtual Standard_Boolean Matches(SelectBasics_SelectingVolumeManager& theMgr,
SelectBasics_PickResult& thePickResult)
Standard_OVERRIDE;
protected:
//! Checks if picking ray can be used for detection.
Standard_EXPORT bool isValidRay(const SelectBasics_SelectingVolumeManager& theMgr) const;
};
#endif // _AIS_ViewCube_HeaderFile

View File

@ -0,0 +1,193 @@
// Copyright (c) 2016-2019 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_ViewInputBuffer_HeaderFile
#define _AIS_ViewInputBuffer_HeaderFile
#include "Aspect_ScrollDelta.hxx"
#include "AIS_SelectionScheme.hxx"
#include "Graphic3d_Vec2.hxx"
#include "NCollection_Sequence.hxx"
#include "V3d_TypeOfOrientation.hxx"
//! Selection mode
enum AIS_ViewSelectionTool
{
AIS_ViewSelectionTool_Picking, //!< pick to select
AIS_ViewSelectionTool_RubberBand, //!< rubber-band to select
AIS_ViewSelectionTool_Polygon, //!< polyline to select
AIS_ViewSelectionTool_ZoomWindow, //!< zoom-in window (no selection)
};
//! Input buffer type.
enum AIS_ViewInputBufferType
{
AIS_ViewInputBufferType_UI, //!< input buffer for filling from UI thread
AIS_ViewInputBufferType_GL, //!< input buffer accessible from GL thread
};
//! Auxiliary structure defining viewer events
class AIS_ViewInputBuffer
{
public:
bool IsNewGesture; //!< transition from one action to another
NCollection_Sequence<Aspect_ScrollDelta> ZoomActions; //!< the queue with zoom actions
struct _orientation
{
bool ToFitAll; //!< perform FitAll operation
bool ToSetViewOrient; //!< set new view orientation
V3d_TypeOfOrientation ViewOrient; //!< new view orientation
_orientation()
: ToFitAll(false),
ToSetViewOrient(false),
ViewOrient(V3d_Xpos)
{
}
} Orientation;
struct _highlighting
{
bool ToHilight; //!< perform dynamic highlighting at specified point
Graphic3d_Vec2i Point; //!< the new point for dynamic highlighting
_highlighting()
: ToHilight(false)
{
}
} MoveTo;
struct _selection
{
AIS_ViewSelectionTool Tool; //!< perform selection
AIS_SelectionScheme Scheme; //!< selection scheme
NCollection_Sequence<Graphic3d_Vec2i> Points; //!< the points for selection
bool ToApplyTool; //!< apply rubber-band selection tool
_selection()
: Tool(AIS_ViewSelectionTool_Picking),
Scheme(AIS_SelectionScheme_UNKNOWN),
ToApplyTool(false)
{
}
} Selection;
struct _panningParams
{
bool ToStart; //!< start panning
Graphic3d_Vec2i PointStart; //!< panning start point
bool ToPan; //!< perform panning
Graphic3d_Vec2i Delta; //!< panning delta
_panningParams()
: ToStart(false),
ToPan(false)
{
}
} Panning;
struct _draggingParams
{
bool ToStart; //!< start dragging
bool ToConfirm; //!< confirm dragging
bool ToMove; //!< perform dragging
bool ToStop; //!< stop dragging
bool ToAbort; //!< abort dragging (restore previous position)
Graphic3d_Vec2i PointStart; //!< drag start point
Graphic3d_Vec2i PointTo; //!< drag end point
_draggingParams()
: ToStart(false),
ToConfirm(false),
ToMove(false),
ToStop(false),
ToAbort(false)
{
}
} Dragging;
struct _orbitRotation
{
bool ToStart; //!< start orbit rotation
Graphic3d_Vec2d PointStart; //!< orbit rotation start point
bool ToRotate; //!< perform orbit rotation
Graphic3d_Vec2d PointTo; //!< orbit rotation end point
_orbitRotation()
: ToStart(false),
ToRotate(false)
{
}
} OrbitRotation;
struct _viewRotation
{
bool ToStart; //!< start view rotation
Graphic3d_Vec2d PointStart; //!< view rotation start point
bool ToRotate; //!< perform view rotation
Graphic3d_Vec2d PointTo; //!< view rotation end point
_viewRotation()
: ToStart(false),
ToRotate(false)
{
}
} ViewRotation;
struct _zrotateParams
{
Graphic3d_Vec2i Point; //!< Z rotation start point
double Angle; //!< Z rotation angle
bool ToRotate; //!< start Z rotation
_zrotateParams()
: Angle(0.0),
ToRotate(false)
{
}
} ZRotate;
public:
AIS_ViewInputBuffer()
: IsNewGesture(false)
{
}
//! Reset events buffer.
void Reset()
{
Orientation.ToFitAll = false;
Orientation.ToSetViewOrient = false;
MoveTo.ToHilight = false;
Selection.ToApplyTool = false;
IsNewGesture = false;
ZoomActions.Clear();
Panning.ToStart = false;
Panning.ToPan = false;
Dragging.ToStart = false;
Dragging.ToConfirm = false;
Dragging.ToMove = false;
Dragging.ToStop = false;
Dragging.ToAbort = false;
OrbitRotation.ToStart = false;
OrbitRotation.ToRotate = false;
ViewRotation.ToStart = false;
ViewRotation.ToRotate = false;
ZRotate.ToRotate = false;
}
};
#endif // _AIS_ViewInputBuffer_HeaderFile

View File

@ -0,0 +1,133 @@
// Copyright (c) 2019 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _AIS_WalkDelta_HeaderFile
#define _AIS_WalkDelta_HeaderFile
#include "Standard_Real.hxx"
//! Walking translation components.
enum AIS_WalkTranslation
{
AIS_WalkTranslation_Forward = 0, //!< translation delta, Forward walk
AIS_WalkTranslation_Side, //!< translation delta, Side walk
AIS_WalkTranslation_Up, //!< translation delta, Up walk
};
//! Walking rotation components.
enum AIS_WalkRotation
{
AIS_WalkRotation_Yaw = 0, //!< yaw rotation angle
AIS_WalkRotation_Pitch, //!< pitch rotation angle
AIS_WalkRotation_Roll, //!< roll rotation angle
};
//! Walking value.
struct AIS_WalkPart
{
Standard_Real Value; //!< value
Standard_Real Pressure; //!< key pressure
Standard_Real Duration; //!< duration
//! Return TRUE if delta is empty.
bool IsEmpty() const { return Abs(Value) <= RealSmall(); }
//! Empty constructor.
AIS_WalkPart()
: Value(0.0),
Pressure(1.0),
Duration(0.0)
{
}
};
//! Walking values.
struct AIS_WalkDelta
{
//! Empty constructor.
AIS_WalkDelta()
: myIsDefined(false),
myIsJumping(false),
myIsCrouching(false),
myIsRunning(false)
{
}
//! Return translation component.
const AIS_WalkPart& operator[](AIS_WalkTranslation thePart) const
{
return myTranslation[thePart];
}
//! Return translation component.
AIS_WalkPart& operator[](AIS_WalkTranslation thePart) { return myTranslation[thePart]; }
//! Return rotation component.
const AIS_WalkPart& operator[](AIS_WalkRotation thePart) const { return myRotation[thePart]; }
//! Return rotation component.
AIS_WalkPart& operator[](AIS_WalkRotation thePart) { return myRotation[thePart]; }
//! Return jumping state.
bool IsJumping() const { return myIsJumping; }
//! Set jumping state.
void SetJumping(bool theIsJumping) { myIsJumping = theIsJumping; }
//! Return crouching state.
bool IsCrouching() const { return myIsCrouching; }
//! Set crouching state.
void SetCrouching(bool theIsCrouching) { myIsCrouching = theIsCrouching; }
//! Return running state.
bool IsRunning() const { return myIsRunning; }
//! Set running state.
void SetRunning(bool theIsRunning) { myIsRunning = theIsRunning; }
//! Return TRUE if navigation keys are pressed even if delta from the previous frame is empty.
bool IsDefined() const { return myIsDefined || !IsEmpty(); }
//! Set if any navigation key is pressed.
void SetDefined(bool theIsDefined) { myIsDefined = theIsDefined; }
//! Return TRUE when both Rotation and Translation deltas are empty.
bool IsEmpty() const { return !ToMove() && !ToRotate(); }
//! Return TRUE if translation delta is defined.
bool ToMove() const
{
return !myTranslation[AIS_WalkTranslation_Forward].IsEmpty()
|| !myTranslation[AIS_WalkTranslation_Side].IsEmpty()
|| !myTranslation[AIS_WalkTranslation_Up].IsEmpty();
}
//! Return TRUE if rotation delta is defined.
bool ToRotate() const
{
return !myRotation[AIS_WalkRotation_Yaw].IsEmpty()
|| !myRotation[AIS_WalkRotation_Pitch].IsEmpty()
|| !myRotation[AIS_WalkRotation_Roll].IsEmpty();
}
private:
AIS_WalkPart myTranslation[3];
AIS_WalkPart myRotation[3];
bool myIsDefined;
bool myIsJumping;
bool myIsCrouching;
bool myIsRunning;
};
#endif // _AIS_WalkDelta_HeaderFile

View File

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

View File

@ -0,0 +1,64 @@
// Created on: 1998-07-08
// Created by: Christian CAILLET
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _APIHeaderSection_EditHeader_HeaderFile
#define _APIHeaderSection_EditHeader_HeaderFile
#include "Standard.hxx"
#include "IFSelect_Editor.hxx"
#include "Standard_Integer.hxx"
class TCollection_AsciiString;
class IFSelect_EditForm;
class TCollection_HAsciiString;
class Standard_Transient;
class Interface_InterfaceModel;
class APIHeaderSection_EditHeader;
DEFINE_STANDARD_HANDLE(APIHeaderSection_EditHeader, IFSelect_Editor)
class APIHeaderSection_EditHeader : public IFSelect_Editor
{
public:
Standard_EXPORT APIHeaderSection_EditHeader();
Standard_EXPORT TCollection_AsciiString Label() const Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean
Recognize(const Handle(IFSelect_EditForm)& form) const Standard_OVERRIDE;
Standard_EXPORT Handle(TCollection_HAsciiString) StringValue(
const Handle(IFSelect_EditForm)& form,
const Standard_Integer num) const Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean
Apply(const Handle(IFSelect_EditForm)& form,
const Handle(Standard_Transient)& ent,
const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
Standard_EXPORT Standard_Boolean
Load(const Handle(IFSelect_EditForm)& form,
const Handle(Standard_Transient)& ent,
const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(APIHeaderSection_EditHeader, IFSelect_Editor)
protected:
private:
};
#endif // _APIHeaderSection_EditHeader_HeaderFile

View File

@ -0,0 +1,196 @@
// Created on: 1993-08-12
// Created by: Frederic MAUPAS
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _APIHeaderSection_MakeHeader_HeaderFile
#define _APIHeaderSection_MakeHeader_HeaderFile
#include "Standard.hxx"
#include "Standard_DefineAlloc.hxx"
#include "Standard_Handle.hxx"
#include "Standard_Boolean.hxx"
#include "Standard_Integer.hxx"
#include "Interface_HArray1OfHAsciiString.hxx"
class HeaderSection_FileName;
class HeaderSection_FileSchema;
class HeaderSection_FileDescription;
class StepData_StepModel;
class Interface_Protocol;
class TCollection_HAsciiString;
//! This class allows to consult and prepare/edit data stored in
//! a Step Model Header
class APIHeaderSection_MakeHeader
{
public:
DEFINE_STANDARD_ALLOC
//! Prepares a new MakeHeader from scratch
Standard_EXPORT APIHeaderSection_MakeHeader(const Standard_Integer shapetype = 0);
//! Prepares a MakeHeader from the content of a StepModel
//! See IsDone to know if the Header is well defined
Standard_EXPORT APIHeaderSection_MakeHeader(const Handle(StepData_StepModel)& model);
//! Cancels the former definition and gives a FileName
//! To be used when a Model has no well defined Header
Standard_EXPORT void Init(const Standard_CString nameval);
//! Returns True if all data have been defined (see also
//! HasFn, HasFs, HasFd)
Standard_EXPORT Standard_Boolean IsDone() const;
//! Creates an empty header for a new
//! STEP model and allows the header fields to be completed.
Standard_EXPORT void Apply(const Handle(StepData_StepModel)& model) const;
//! Builds a Header, creates a new StepModel, then applies the
//! Header to the StepModel
//! The Schema Name is taken from the Protocol (if it inherits
//! from StepData, else it is left in blanks)
Standard_EXPORT Handle(StepData_StepModel) NewModel(
const Handle(Interface_Protocol)& protocol) const;
//! Checks whether there is a
//! file_name entity. Returns True if there is one.
Standard_EXPORT Standard_Boolean HasFn() const;
//! Returns the file_name entity.
//! Returns an empty entity if the file_name entity is not initialized.
Standard_EXPORT Handle(HeaderSection_FileName) FnValue() const;
Standard_EXPORT void SetName(const Handle(TCollection_HAsciiString)& aName);
//! Returns the name attribute for the file_name entity.
Standard_EXPORT Handle(TCollection_HAsciiString) Name() const;
Standard_EXPORT void SetTimeStamp(const Handle(TCollection_HAsciiString)& aTimeStamp);
//! Returns the value of the time_stamp attribute for the file_name entity.
Standard_EXPORT Handle(TCollection_HAsciiString) TimeStamp() const;
Standard_EXPORT void SetAuthor(const Handle(Interface_HArray1OfHAsciiString)& aAuthor);
Standard_EXPORT void SetAuthorValue(const Standard_Integer num,
const Handle(TCollection_HAsciiString)& aAuthor);
Standard_EXPORT Handle(Interface_HArray1OfHAsciiString) Author() const;
//! Returns the value of the name attribute for the file_name entity.
Standard_EXPORT Handle(TCollection_HAsciiString) AuthorValue(const Standard_Integer num) const;
//! Returns the number of values for the author attribute in the file_name entity.
Standard_EXPORT Standard_Integer NbAuthor() const;
Standard_EXPORT void SetOrganization(
const Handle(Interface_HArray1OfHAsciiString)& aOrganization);
Standard_EXPORT void SetOrganizationValue(const Standard_Integer num,
const Handle(TCollection_HAsciiString)& aOrganization);
Standard_EXPORT Handle(Interface_HArray1OfHAsciiString) Organization() const;
//! Returns the value of attribute
//! organization for the file_name entity.
Standard_EXPORT Handle(TCollection_HAsciiString) OrganizationValue(
const Standard_Integer num) const;
//! Returns the number of values for
//! the organization attribute in the file_name entity.
Standard_EXPORT Standard_Integer NbOrganization() const;
Standard_EXPORT void SetPreprocessorVersion(
const Handle(TCollection_HAsciiString)& aPreprocessorVersion);
//! Returns the name of the preprocessor_version for the file_name entity.
Standard_EXPORT Handle(TCollection_HAsciiString) PreprocessorVersion() const;
Standard_EXPORT void SetOriginatingSystem(
const Handle(TCollection_HAsciiString)& aOriginatingSystem);
Standard_EXPORT Handle(TCollection_HAsciiString) OriginatingSystem() const;
Standard_EXPORT void SetAuthorisation(const Handle(TCollection_HAsciiString)& aAuthorisation);
//! Returns the value of the authorization attribute for the file_name entity.
Standard_EXPORT Handle(TCollection_HAsciiString) Authorisation() const;
//! Checks whether there is a file_schema entity. Returns True if there is one.
Standard_EXPORT Standard_Boolean HasFs() const;
//! Returns the file_schema entity. Returns an empty entity if the file_schema entity is not
//! initialized.
Standard_EXPORT Handle(HeaderSection_FileSchema) FsValue() const;
Standard_EXPORT void SetSchemaIdentifiers(
const Handle(Interface_HArray1OfHAsciiString)& aSchemaIdentifiers);
Standard_EXPORT void SetSchemaIdentifiersValue(
const Standard_Integer num,
const Handle(TCollection_HAsciiString)& aSchemaIdentifier);
Standard_EXPORT Handle(Interface_HArray1OfHAsciiString) SchemaIdentifiers() const;
//! Returns the value of the schema_identifier attribute for the file_schema entity.
Standard_EXPORT Handle(TCollection_HAsciiString) SchemaIdentifiersValue(
const Standard_Integer num) const;
//! Returns the number of values for the schema_identifier attribute in the file_schema entity.
Standard_EXPORT Standard_Integer NbSchemaIdentifiers() const;
//! Add a subname of schema (if not yet in the list)
Standard_EXPORT void AddSchemaIdentifier(
const Handle(TCollection_HAsciiString)& aSchemaIdentifier);
//! Checks whether there is a file_description entity. Returns True if there is one.
Standard_EXPORT Standard_Boolean HasFd() const;
//! Returns the file_description
//! entity. Returns an empty entity if the file_description entity is not initialized.
Standard_EXPORT Handle(HeaderSection_FileDescription) FdValue() const;
Standard_EXPORT void SetDescription(const Handle(Interface_HArray1OfHAsciiString)& aDescription);
Standard_EXPORT void SetDescriptionValue(const Standard_Integer num,
const Handle(TCollection_HAsciiString)& aDescription);
Standard_EXPORT Handle(Interface_HArray1OfHAsciiString) Description() const;
//! Returns the value of the
//! description attribute for the file_description entity.
Standard_EXPORT Handle(TCollection_HAsciiString) DescriptionValue(
const Standard_Integer num) const;
//! Returns the number of values for
//! the file_description entity in the STEP file header.
Standard_EXPORT Standard_Integer NbDescription() const;
Standard_EXPORT void SetImplementationLevel(
const Handle(TCollection_HAsciiString)& aImplementationLevel);
//! Returns the value of the
//! implementation_level attribute for the file_description entity.
Standard_EXPORT Handle(TCollection_HAsciiString) ImplementationLevel() const;
protected:
private:
Standard_Boolean done;
Handle(HeaderSection_FileName) fn;
Handle(HeaderSection_FileSchema) fs;
Handle(HeaderSection_FileDescription) fd;
};
#endif // _APIHeaderSection_MakeHeader_HeaderFile

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