1 // Created on: 1995-03-15
2 // Created by: Robert COUBLANC
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _StdSelect_ViewerSelector3d_HeaderFile
18 #define _StdSelect_ViewerSelector3d_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22 #include <Standard_Type.hxx>
24 #include <Graphic3d_SequenceOfStructure.hxx>
25 #include <Graphic3d_SequenceOfHClipPlane.hxx>
26 #include <SelectMgr_ViewerSelector.hxx>
27 #include <SelectMgr_Selection.hxx>
28 #include <StdSelect_TypeOfSelectionImage.hxx>
29 #include <NCollection_Handle.hxx>
30 #include <V3d_ImageDumpOptions.hxx>
32 class Graphic3d_Group;
33 class Graphic3d_Structure;
34 class Graphic3d_TransformPers;
36 class SelectMgr_EntityOwner;
37 class SelectMgr_SelectableObjectSet;
40 //! Selector Usable by Viewers from V3d
41 class StdSelect_ViewerSelector3d : public SelectMgr_ViewerSelector
46 //! Constructs an empty 3D selector object.
47 Standard_EXPORT StdSelect_ViewerSelector3d();
49 //! Sets the pixel tolerance <theTolerance>.
50 Standard_EXPORT void SetPixelTolerance (const Standard_Integer theTolerance);
52 //! Returns the pixel tolerance.
53 Standard_Integer PixelTolerance() const { return myTolerances.Tolerance(); }
55 //! Picks the sensitive entity at the pixel coordinates of
56 //! the mouse <theXPix> and <theYPix>. The selector looks for touched areas and owners.
57 Standard_EXPORT void Pick (const Standard_Integer theXPix,
58 const Standard_Integer theYPix,
59 const Handle(V3d_View)& theView);
61 //! Picks the sensitive entity according to the minimum
62 //! and maximum pixel values <theXPMin>, <theYPMin>, <theXPMax>
63 //! and <theYPMax> defining a 2D area for selection in the 3D view aView.
64 Standard_EXPORT void Pick (const Standard_Integer theXPMin,
65 const Standard_Integer theYPMin,
66 const Standard_Integer theXPMax,
67 const Standard_Integer theYPMax,
68 const Handle(V3d_View)& theView);
70 //! pick action - input pixel values for polyline selection for selection.
71 Standard_EXPORT void Pick (const TColgp_Array1OfPnt2d& thePolyline,
72 const Handle(V3d_View)& theView);
74 //! Dump of detection results into image.
75 //! This method performs axis picking for each pixel in the image
76 //! and generates a color depending on picking results and selection image type.
77 //! @param theImage result image, should be initialized
78 //! @param theView 3D view defining camera position
79 //! @param theType type of image to define
80 //! @param thePickedIndex index of picked entity (1 means topmost)
81 Standard_EXPORT Standard_Boolean ToPixMap (Image_PixMap& theImage,
82 const Handle(V3d_View)& theView,
83 const StdSelect_TypeOfSelectionImage theType,
84 const Standard_Integer thePickedIndex = 1);
86 //! Displays sensitives in view <theView>.
87 Standard_EXPORT void DisplaySensitive (const Handle(V3d_View)& theView);
89 Standard_EXPORT void ClearSensitive (const Handle(V3d_View)& theView);
91 Standard_EXPORT void DisplaySensitive (const Handle(SelectMgr_Selection)& theSel,
92 const gp_Trsf& theTrsf,
93 const Handle(V3d_View)& theView,
94 const Standard_Boolean theToClearOthers = Standard_True);
96 Standard_EXPORT virtual Standard_Boolean HasDepthClipping (const Handle(SelectMgr_EntityOwner)& theOwner) const Standard_OVERRIDE;
98 DEFINE_STANDARD_RTTIEXT(StdSelect_ViewerSelector3d,SelectMgr_ViewerSelector)
102 Standard_EXPORT void computeSensitivePrs (const Handle(Graphic3d_Structure)& theStructure,
103 const Handle(SelectMgr_Selection)& theSel,
104 const gp_Trsf& theLoc,
105 const Handle(Graphic3d_TransformPers)& theTrsfPers);
107 //! Update z-layers order map.
108 Standard_EXPORT void updateZLayers (const Handle(V3d_View)& theView);
112 Graphic3d_SequenceOfStructure myStructs;
115 DEFINE_STANDARD_HANDLE(StdSelect_ViewerSelector3d, SelectMgr_ViewerSelector)