mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-13 14:27:08 +03:00
0024623: Visualization - improve selection mechanism
Redesign of selection mechanism: - implemented 3-level BVH tree for selection; - selection now calculates in 3D space; - intersection tests were moved to SelectMgr_BaseFrustum descendants; - removed .cdl files in Select3D and .cdl related to selection in MeshVS; - SelectMgr_ViewerSelectors are now shared between local and global contexts; - transformations of sensitive entities are now stored in SelectMgr_SelectableObject only. Sensitive entities are independent from transformations, it is applied to SelectMgr_SelectingVolumeManager instance only; - connected and multiple connected interactive objects are now represented by their child objects only for SelectMgr_SelectionManager; - if interactive object has child objects, they will be stored as separate objects in SelectMgr_SelectionManager now. - test cases bugs/vis/bug24623_1, bug24623_2, bug24623_3, bug24623_4 to test performance and memory issues.
This commit is contained in:
92
src/Select3D/Select3D_SensitiveEntity.hxx
Normal file
92
src/Select3D/Select3D_SensitiveEntity.hxx
Normal file
@@ -0,0 +1,92 @@
|
||||
// Created on: 1995-03-13
|
||||
// Created by: Robert COUBLANC
|
||||
// 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 _Select3D_SensitiveEntity_HeaderFile
|
||||
#define _Select3D_SensitiveEntity_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
|
||||
#include <SelectBasics_SensitiveEntity.hxx>
|
||||
#include <Handle_SelectBasics_EntityOwner.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <SelectMgr_SelectingVolumeManager.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
|
||||
#include <TopLoc_Location.hxx>
|
||||
|
||||
class Select3D_SensitiveEntity;
|
||||
class Handle(Select3D_SensitiveEntity);
|
||||
class SelectBasics_EntityOwner;
|
||||
|
||||
//! Abstract framework to define 3D sensitive entities.
|
||||
//! As the selection process uses the principle of a
|
||||
//! projection of 3D shapes onto a 2D view where
|
||||
//! nearness to a rectangle determines whether a shape
|
||||
//! is picked or not, all 3D shapes need to be converted
|
||||
//! into 2D ones in order to be selected.
|
||||
class Select3D_SensitiveEntity : public SelectBasics_SensitiveEntity
|
||||
{
|
||||
public:
|
||||
|
||||
//! Originally this method intended to return sensitive
|
||||
//! entity with new location aLocation, but currently sensitive
|
||||
//! entities do not hold a location, instead HasLocation() and
|
||||
//! Location() methods call corresponding entity owner's methods.
|
||||
//! Thus all entities returned by GetConnected() share the same
|
||||
//! location propagated from corresponding selectable object.
|
||||
//! You must redefine this function for any type of
|
||||
//! sensitive entity which can accept another connected
|
||||
//! sensitive entity.//can be connected to another sensitive entity.
|
||||
Standard_EXPORT virtual Handle(Select3D_SensitiveEntity) GetConnected();
|
||||
|
||||
//! Checks whether sensitive overlaps current selecting volume.
|
||||
//! Stores minimum depth, distance to center of geometry and
|
||||
//! closest point detected into thePickResult
|
||||
Standard_EXPORT virtual Standard_Boolean Matches (SelectBasics_SelectingVolumeManager& theMgr,
|
||||
SelectBasics_PickResult& thePickResult) Standard_OVERRIDE;
|
||||
|
||||
//! Returns the number of sub-entities or elements in
|
||||
//! sensitive entity. Is used to determine if entity is
|
||||
//! complex and needs to pre-build BVH at the creation of
|
||||
//! sensitive entity step or is light-weighted so the tree
|
||||
//! can be build on demand with unnoticeable delay
|
||||
virtual Standard_Integer NbSubElements() = 0;
|
||||
|
||||
//! Returns bounding box of a sensitive with transformation applied
|
||||
virtual Select3D_BndBox3d BoundingBox() = 0;
|
||||
|
||||
//! Returns center of a sensitive with transformation applied
|
||||
virtual gp_Pnt CenterOfGeometry() const = 0;
|
||||
|
||||
//! Builds BVH tree for a sensitive if needed
|
||||
Standard_EXPORT virtual void BVH() Standard_OVERRIDE;
|
||||
|
||||
//! Clears up all resources and memory
|
||||
Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
|
||||
|
||||
DEFINE_STANDARD_RTTI(Select3D_SensitiveEntity)
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT Select3D_SensitiveEntity (const Handle(SelectBasics_EntityOwner)& theOwnerId);
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Select3D_SensitiveEntity, SelectBasics_SensitiveEntity)
|
||||
|
||||
#endif // _Select3D_SensitiveEntity_HeaderFile
|
Reference in New Issue
Block a user