View Issue Details

IDProjectCategoryView StatusLast Update
0012121Open CASCADEOCCT:Visualizationpublic2014-04-16 12:01
ReporterepaAssigned Tobugmaster  
Status closedResolutionfixed 
Target Version6.5.3Fixed in Version6.5.3 
Summary0012121: Optimization of existing selection classes
DescriptionDetailed problem description and the solution may be seen here:
Additional information
and documentation updates
Documentation remark, added by SAN 2007-03-09 17:33:43:

Optimization of packages related to interactive selection in 3D view
(SelectBasics, Select3D, SelectMgr, StdSelect) has been accomplished.
The two main aspects of this optimization are:
1. More efficient memory usage - double values (8 bytes) replaced with float
(4 bytes) where applicable, unused data fields removed, misplaced data fields
moved from one abstraction level to another (example: TopoDS_Shape object
from a generic owner class - SelectMgr_EntityOwner - to concrete entity owner
implementation - StdSelect_BRepOwner). These changes resulted in ~30% less
memory occupied by data structures used for interactive selection on meshes
(MeshVS_Mesh presentation).
2. General code revision - unused methods removed, class hierarchy improved
(example: Select3D package)
Modified entities:
SelectBasics package

SelectBasics_SensitiveEntity.cdl - SelectBasics_SensitiveEntity class:
Size() method removed, mySFactor field type changed to ShortReal

SelectBasics_EntityOwner.cdl - SelectBasics_EntityOwner class:
obsolete "myusers" field and related methods removed, pure virtual methods
working with locations added to eliminate cyclic dependency Select3D <-->
SelectMgr, methods related to priority made inline for more efficiency

Select3D package

Changed files:

Select3D.cdl - new classes SensitivePoly, Box2d, Pnt
Pnt2d added

Select3D_SensitiveBox.cdl - Select3D_SensitiveBox class: obsolete
ComputeSize() method removed

Select3D_SensitiveCircle.cdl - Select3D_SensitiveCircle class: derived
from Select3D_SensitivePoly class, Project() and Areas() methods and fields
holding 3D and 2D geometry moved to the base class; obsolete ComputeSize()
method removed

Select3D_SensitiveCurve.cdl - Select3D_SensitiveCurve class: derived
from Select3D_SensitivePoly class; Project(), Areas() and Points3D() methods
and fields holding 3D and 2D geometry moved to the base class; obsolete
ComputeSize() method removed

Select3D_SensitiveEntity.cdl - Select3D_SensitiveEntity class: "myLoc"
field removed - location management methods now rely on the corresponding
entity owner's methods; obsolete Size()
method, "mylastsize", "myhascomputed", "myX" and "myY" fields removed;
SetLastDepth() protected method added to avoid direct modification
of "mylastdepth" field by successors

Select3D_SensitiveFace.cdl - Select3D_SensitiveFace class: derived
from Select3D_SensitivePoly class; Project(), Areas() and Points3D() methods
and fields holding 3D and 2D geometry moved to the base class; obsolete
ComputeSize() method removed

Select3D_SensitiveGroup.cdl - Select3D_SensitiveGroup
class: "myLastTol" field size changed to ShortReal, "myX" and "myY" fields
moved here from SensitiveEntity class with type changed to ShortReal, obsolete
ComputeSize() method removed

Select3D_SensitivePoint.cdl - Select3D_SensitivePoint class: types
of "mypoint" and "myprojpt" fields changed, Point() method returns gp_Pnt
object constructed on-the-fly, obsolete ComputeSize() method removed

Select3D_SensitiveSegment.cdl - Select3D_SensitiveSegment class: types
fields holding 3D and 2D points changed, StartPoint() and EndPoint() method
return gp_Pnt object constructed on-the-fly, obsolete ComputeSize() method

Select3D_SensitiveTriangle.cdl - Select3D_SensitiveTriangle class:
from Select3D_SensitivePoly class; Project() and Areas() methods and fields
holding 3D and 2D geometry moved to the base class; obsolete ComputeSize()
method removed

Select3D_SensitiveTriangulation.cdl - Select3D_SensitiveTriangulation class:
obsolete ComputeSize() method removed

Select3D_SensitiveWire.cdl - Select3D_SensitiveWire class: obsolete
ComputeSize() method removed

New files:

Select3D_SensitivePoly.cdl - Select3D_SensitivePoly class: common
class for sensitive polylines and polygons; it holds 3D points and computes
projected 2D points and 2D bounding box and stores them in a compact form with
ShortReal co-ordinates

Select3D_Box2d.hxx - Select3D_Box2d class: 2D bounding box
having compact memory representation due to ShortReal co-ordinates used

Select3D_Macro.hxx - DToF() macro for safe conversion from
double to float

Select3D_Pnt.hxx - Select3D_Pnt class: 3D point with
ShortReal co-ordinates and automatic conversion to gp_Pnt, gp_XYZ

Select3D_Pnt2d.hxx - Select3D_Pnt2d class: 2D point with
ShortReal co-ordinates and automatic conversion to gp_Pnt2d, gp_XY

SelectMgr package

SelectMgr_EntityOwner.cdl - SelectMgr_EntityOwner class: "myShape"
and "myFromDecomposition" fields and related methods moved to
StdSelect_BRepOwner class; "myLoc" field removed, location management methods
changed so as to rely on the correspodning methods of
SelectMgr_SelectableObject class

SelectMgr_SelectableObject.cdl - SelectMgr_SelectableObject class: empty
re-implementation of UpdateLocation(me: mutable;P : mutable Presentation from
Prs3d) removed

SelectMgr_SortCriterion.cdl - SelectMgr_SortCriterion class:
obsolete "mySize" field and related methods removed

StdSelect package

StdSelect_BRepOwner.cdl - StdSelect_BRepOwner class: "myShape"
and "myFromDecomposition" fields and related methods moved here from
SelectMgr_EntityOwner class

StdSelect_BRepSelectionTool.cdl - StdSelect_BRepSelectionTool class:
obsolete Load() method implementation having "Users" argument removed

AIS package

AIS_ConnectedInteractive.cdl - AIS_ConnectedInteractive class: empty re-
implementation of UpdateLocation(me: mutable;P : mutable Presentation from
Prs3d) removed

MeshVS package

MeshVS_SensitivePolyhedron.cdl - MeshVS_SensitivePolyhedron class:
obsolete ComputeSize() method removed


XSDRAWSTLVRML_DataSource.cdl - XSDRAWSTLVRML_DataSource class: types
of "myElemNodes", "myNodeCoords" fields changed from map to HArray2 to
memory usage; unnecessary "myElemCoords" field removed; "myElemNormals" field
added to pre-calculate mesh face normals

Documentation remark, added by aaa 2011-12-12 18:20:

Modified Entities:

SelectBasics package:

SelectBasics_SensitiveEntity.cdl - SelectBasics_SensitiveEntity class: method Set(const Handle(SelectBasics_EntityOwner)& TheOwnerId) becomes virtual.

Select3D package:

Added virtual method GetConnected() from Select3D_SensitiveEntity to the following files:

Changed description for method GetConnected() in Select3D_SensitiveEntity.cdl

Implemented method GetConnected() in the following files:

Added new fields to the following classes:
Select3D_SensitiveCircle :
    Handle(Geom_Circle) myCircle;
    Standard_Real mystart;
    Standard_Real myend;
    Handle(Geom_Curve) myCurve;

Added virtual method Set() from SelectBasics_SensitiveEntity to the following files:

Implemented method Set() in the following files:

AIS package:

Changed description of method ComputeSelection in following files:

AIS_ConnectedShape.cxx – reimplemented method
ComputeSelection (const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer aMode)

AIS_ ConnectedInteractive.cxx – corrected the mistake in method
ComputeSelection (const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer aMode)


Added new DRAW commands:

vconnect – creates and displays AIS_ConnectedInteractive object from given object with new location
vconnectsh - creates and displays AIS_ConnectedShape from given shape with new location
vselmode – set given selection mode for named object or for all displayed objects
TagsNo tags attached.
Test case numberchl 934 P8

Attached Files

  • epa-OCC12121-v1.tar.gz (80,188 bytes)
  • epa-OCC12121-v2.tar.gz (97,024 bytes)
  • epa-OCC12121-v3.tar.gz (101,823 bytes)
  • epa-OCC12121-v4.tar.gz (9,150 bytes)
  • epaOCC12121-v5.tar.gz (115,704 bytes)
  • san-OCC12121-v6.tar.gz (71,809 bytes)
  • psn_OCC21211_v7.tar (112,640 bytes)
  • vconnectsh.tcl (134 bytes)
  • CrankArm.brep (387,980 bytes)
  • P8 (5,822 bytes)


has duplicate 0022039 closedbugmaster Open CASCADE Incorrect interactive detection(highlights) of elements 
related to 0022554 closedbugmaster Open CASCADE Application hangs on selection 
related to 0024837 closedbugmaster Open CASCADE Visualization - revise design and implementation of connected Interactive Objects 


2006-04-05 16:33


epa-OCC12121-v1.tar.gz (80,188 bytes)

2006-12-06 09:50


epa-OCC12121-v2.tar.gz (97,024 bytes)

2006-12-07 14:51


epa-OCC12121-v3.tar.gz (101,823 bytes)

2006-12-15 15:42


epa-OCC12121-v4.tar.gz (9,150 bytes)

2006-12-19 08:12


epaOCC12121-v5.tar.gz (115,704 bytes)

2007-02-24 13:18


san-OCC12121-v6.tar.gz (71,809 bytes)

2010-10-05 09:26


psn_OCC21211_v7.tar (112,640 bytes)


2011-08-09 16:22

administrator   ~0017946

Last edited: 2011-12-26 16:10


Could you please finalize works on this issue.
SAN could you explain history of this bug.

So far as I understood fixes up to v4 have been integrated to development version.

Or may be there is since to close this bug and open new one


2011-12-12 18:23

developer   ~0018824

SVN branch http://svn/svn/occt/branches/OCC12121 is ready for reviewing


2011-12-16 10:49

developer   ~0018879

Last edited: 2011-12-16 10:55

The branch reviewed with the following remarks:


Lines 19 - 21: The class documentation should be improved, and at least some basic spell checking should be applied in order to avoid
spelling mistakes!
Instead of

        -- Note, that ConnectedInteractive object doesn't suport selection
        -- modes differed from 0. For other selection modes use
        -- AIS_ConnectedShape, that is inherited from this class.

I suggest:

        -- AIS_ConnectedInteractive class doesn't support selection
        -- modes different from 0. Descendants should redefine ComputeSelection()
        -- method in order to handle other selection modes and generate connected
        -- sensitive entities properly. Refer to AIS_ConnectedShape class
        -- for exisiting implementation of a connected interactive object
        -- for AIS_Shape that supports all standard sub-shape selection modes.


Line 168: I would expect a C++ comment here explaining why SetLocation() is called just few lines after calling
GetConnected() with the same location. But please do not say that this is for Select3D_SensitiveTriangulation only, this class
is just an example of a sensitive entity that caches some location-dependent data.

Line 169: unnecessary empty line

Line 171: tabulation should be replaced with spaces.

Please, re-write documentation for ComputeSelection() method, currently it is a kind of meaningless abracadabra.

Line 197: "aDataMap" variable name is a bad choice, it violates coding rules. Please, try to use self-explaining variable names, e.g.

Line 201: Comments like " // Fill in our map" have no value. Instead, explain why you have to fill a special map before creating
sensitive entities.

Lines 238, 245: please do not say that this is for Select3D_SensitiveTriangulation only, this class
is just an example of a sensitive entity that caches some location-dependent data, thus calling virtual SetLocation() is a way
to update internal sensitive entity data.

mystart, myend initializations: Why use -1 and not 0? Does it have any special meaning?
As far as I understand, mystart and myend are just two parameter values i.e. two real numbers.
The only thing that matters is there equality (it means a full circle).

myCircle initalization: OCCT handles should never be initalized by NULL or 0!!! An empty handle is automatically initalized
with a special "undefined" address. DO not hesitate to have a look inside src\Standard\Handle_Standard_Transient.hxx.

Line 107: this line has no effect, see lines 100-101 above.

Line 129: remove commented code.

myCurve initalization: OCCT handles should never be initalized by NULL or 0!!! An empty handle is automatically initalized
with a special "undefined" address. DO not hesitate to have a look inside src\Standard\Handle_Standard_Transient.hxx.

I strongly recommend you provide extended documentation for GetConnected() virtual method here and its relation to HasLocation() and Location() methods.
We have to mention somewhere that 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.

Remove tabulations in your changes

Line 360 - 361: what is the purpose of this code??? Casting Select3D_Pnt* to gp_Pnt* is really unsafe, as these two classes are unrelated!
Most likely you need to call Select3D_Pnt::operator gp_Pnt() here instead.

Line 41: remove trailing spaces

Add method header for newly added Select3D_SensitiveWire::Set() - please check also other methods you have added to other classes,
I noticed missing method headers somewhere.

A lot of lines has trailing spaces, please pay attention to this in order not to violate the coding rules!


2011-12-21 18:01

developer   ~0018933

SVN branch http://svn/svn/occt/branches/OCC12121 is ready for reviewing


2011-12-23 18:46

developer   ~0018992

Last edited: 2011-12-23 18:49

The branch reviewed with the following remarks:

Line 178: "DataMap" type name is ambiguous and its prupose is not clear, use more meaningful type name instead.
Line 222, 231: Use the previously typedef'ed name instead of full template instantiation.

Lines 128 - 138: please remove commented code.

Lines 336 - 346: why cannot we write it like this:

gp_Pnt P1 = mypolyg3d[0];

Select3D_Pnt class has operator gp_Pnt() to facilitate the conversion!
Please pay more attention to reading class declarations!


2011-12-26 15:13

developer   ~0019005

SVN branch http://svn/svn/occt/branches/OCC12121 is ready for reviewing


2011-12-27 15:14

developer   ~0019016

Last edited: 2011-12-27 17:43

File vconnectsh.tcl were added.

This script restores an object from file CrankArm.brep (don't forget to change the full path to this file), creates connected object and displays them. The right one is original object and the left one is connected object.
When the mouse point is on the original object the both objects are highlighted. When the mouse point is on the connected object only it is highlighted.

It's possible to change selection mode for displayed objects using DRAW command vselmode. For example, command "vselmode 4 1" turns on the FACE selection mode for all displayed objects (in our case the both(original and connected) objects are highlighted in this mode and in other modes correctly).


2011-12-27 15:14


vconnectsh.tcl (134 bytes)


2011-12-27 15:16


CrankArm.brep (387,980 bytes)


2011-12-27 17:44

developer   ~0019019

Last edited: 2011-12-27 19:10

Reminder sent to: san

Dear SAN,

Please, assign this bug to bugmaster, if you have no more remarks.


2011-12-27 19:22

developer   ~0019022

The branch has been reviewed without remarks.


2011-12-29 15:08

tester   ~0019049

Dear BugMaster,
Workbench KAS:dev:mkv-12121-occt has been created from SVN branch http://svn/svn/occt/branches/OCC12121
(and mkv-12121-products from trunk) and compiled on Linux platform.

There are not regressions in mkv-12121-products regarding to KAS:dev:products-20111216-opt

See results in /QADisk/occttests/results/KAS/dev/mkv-12121-products_28122011/lin
See reference results in /QADisk/occttests/results/KAS/dev/products-20111216-opt_17122011/lin
See test cases in /QADisk/occttests/tests/ED
N.B. In order to launch testing case you can make use the following instructions


2011-12-29 17:03

administrator   ~0019057

Last edited: 2011-12-29 17:03

Integration into trunk of occt repository

Date: 2011-12-29 16:48:06 +0400 (Thu, 29 Dec 2011)
New Revision: 9959



2011-12-29 17:05

administrator   ~0019058

Issue will be verified after :

1. Updated users guide will be revised ATP and integrated.
2. Testing cases will be created


2012-01-20 16:57

administrator   ~0019209


Maybe is there sense to finalize all works on this bug and integrate it.


2012-01-31 16:02

developer   ~0019323

Dear Igor,

I see no reasons not to close this issue as fixed.
Documentation remark was added by AAA, new DRAW commands for creation of non-regression test cases were also added.
Do you need any further actions from my side?


2012-02-03 16:40

developer   ~0019386

Descriptions of 3 new commands (vconnect, vconnectsh, vselmode) have been added to the UG. The UG has been updated and put to SVN/trunk/doc/UserGuides


2012-02-06 12:27


P8 (5,822 bytes)


2012-02-06 12:28

administrator   ~0019404

Test case chl 934 P8 was added.

Related Changesets

occt: master ac04d101

2011-12-29 12:48:06


Committer: bugmaster Details Diff
0012121: Optimization of existing selection classes Affected Issues
mod - src/AIS/AIS_ConnectedInteractive.cdl Diff File
mod - src/AIS/AIS_ConnectedInteractive.cxx Diff File
mod - src/AIS/AIS_ConnectedShape.cdl Diff File
mod - src/AIS/AIS_ConnectedShape.cxx Diff File
mod - src/OpenGl/OpenGl_togl_begin_immediat_mode.cxx Diff File
mod - src/Select3D/Select3D_SensitiveBox.cxx Diff File
mod - src/Select3D/Select3D_SensitiveCircle.cdl Diff File
mod - src/Select3D/Select3D_SensitiveCircle.cxx Diff File
mod - src/Select3D/Select3D_SensitiveCurve.cdl Diff File
mod - src/Select3D/Select3D_SensitiveCurve.cxx Diff File
mod - src/Select3D/Select3D_SensitiveEntity.cdl Diff File
mod - src/Select3D/Select3D_SensitiveEntity.cxx Diff File
mod - src/Select3D/Select3D_SensitiveFace.cdl Diff File
mod - src/Select3D/Select3D_SensitiveFace.cxx Diff File
mod - src/Select3D/Select3D_SensitiveGroup.cdl Diff File
mod - src/Select3D/Select3D_SensitiveGroup.cxx Diff File
mod - src/Select3D/Select3D_SensitivePoint.cxx Diff File
mod - src/Select3D/Select3D_SensitivePoly.cdl Diff File
mod - src/Select3D/Select3D_SensitivePoly.cxx Diff File
mod - src/Select3D/Select3D_SensitiveSegment.cxx Diff File
mod - src/Select3D/Select3D_SensitiveTriangle.cdl Diff File
mod - src/Select3D/Select3D_SensitiveTriangle.cxx Diff File
mod - src/Select3D/Select3D_SensitiveTriangulation.cxx Diff File
mod - src/Select3D/Select3D_SensitiveWire.cdl Diff File
mod - src/Select3D/Select3D_SensitiveWire.cxx Diff File
mod - src/SelectBasics/SelectBasics_SensitiveEntity.cdl Diff File
mod - src/ViewerTest/ViewerTest_ObjectCommands.cxx Diff File

Issue History

Date Modified Username Field Change
2006-04-06 17:44 bugmaster Assigned To bugmaster => epa
2006-04-06 17:44 bugmaster Status new => assigned
2006-11-08 18:33 san Status assigned => resolved
2006-12-06 15:53 abv CC => abv
2006-12-14 20:19 mkv Status resolved => tested
2007-01-23 18:14 bugmaster Status tested => verified
2007-03-07 16:03 bugmaster Assigned To epa => bugmaster
2007-03-07 16:03 bugmaster Status verified => assigned
2007-03-07 16:03 bugmaster Assigned To bugmaster => san
2007-03-09 19:36 san Status assigned => resolved
2007-08-01 11:05 bugmaster Status resolved => assigned
2009-01-23 16:56 san Assigned To san => gka
2010-09-30 14:43 san Assigned To gka => psn
2010-10-05 11:28 psn Status assigned => resolved
2011-08-02 11:24 bugmaster Category OCCT:VIZ => OCCT:Visualization
2011-08-09 16:22 bugmaster Note Added: 0017946
2011-08-09 16:22 bugmaster Assigned To psn => apl
2011-08-09 16:22 bugmaster Status resolved => assigned
2011-10-05 15:11 san Assigned To apl => aaa
2011-10-05 15:11 san Target Version => 6.5.3
2011-10-05 15:11 san Description Updated
2011-10-05 15:11 san Additional Information Updated
2011-10-07 17:15 san Relationship added parent of 0022039
2011-12-12 18:21 aaa Additional Information Updated
2011-12-12 18:23 aaa Note Added: 0018824
2011-12-12 18:24 aaa Assigned To aaa => san
2011-12-16 10:49 san Note Added: 0018879
2011-12-16 10:55 san Note Edited: 0018879
2011-12-16 10:57 san Status assigned => feedback
2011-12-16 10:58 san Assigned To san => aaa
2011-12-16 10:58 san Status feedback => assigned
2011-12-16 10:58 san Resolution fixed => open
2011-12-21 18:01 aaa Note Added: 0018933
2011-12-21 18:01 aaa Assigned To aaa => san
2011-12-21 18:10 aaa Additional Information Updated
2011-12-23 18:46 san Assigned To san => aaa
2011-12-23 18:46 san Note Added: 0018992
2011-12-23 18:47 san Note Edited: 0018992
2011-12-23 18:49 san Note Edited: 0018992
2011-12-26 15:13 aaa Note Added: 0019005
2011-12-26 15:14 aaa Assigned To aaa => san
2011-12-26 15:33 atp Additional Information Updated
2011-12-26 15:34 atp Additional Information Updated
2011-12-26 16:10 atp Note Edited: 0017946
2011-12-27 15:14 aaa Note Added: 0019016
2011-12-27 15:14 aaa File Added: vconnectsh.tcl
2011-12-27 15:16 aaa File Added: CrankArm.brep
2011-12-27 17:43 aaa Note Edited: 0019016
2011-12-27 17:44 aaa Note Added: 0019019
2011-12-27 19:10 aaa Note Edited: 0019019
2011-12-27 19:22 san Assigned To san => bugmaster
2011-12-27 19:22 san Status assigned => feedback
2011-12-27 19:22 san Note Added: 0019022
2011-12-27 19:22 san Status feedback => reviewed
2011-12-29 15:08 mkv Note Added: 0019049
2011-12-29 15:08 mkv Status reviewed => tested
2011-12-29 17:03 bugmaster Note Added: 0019057
2011-12-29 17:03 bugmaster Note Edited: 0019057
2011-12-29 17:05 bugmaster Note Added: 0019058
2012-01-20 16:57 bugmaster Note Added: 0019209
2012-01-20 16:57 bugmaster Assigned To bugmaster => san
2012-01-20 16:57 bugmaster Status tested => feedback
2012-01-31 16:00 san Assigned To san => bugmaster
2012-01-31 16:02 san Note Added: 0019323
2012-02-01 16:40 san Relationship added related to 0022554
2012-02-02 13:28 san Relationship deleted parent of 0022039
2012-02-02 13:28 san Relationship added has duplicate 0022039
2012-02-03 16:40 atp Note Added: 0019386
2012-02-06 12:27 apn File Added: P8
2012-02-06 12:28 apn Test case number => chl 934 P8
2012-02-06 12:28 apn Note Added: 0019404
2012-02-06 15:30 bugmaster Assigned To bugmaster => aaa
2012-02-06 15:30 bugmaster Status feedback => reviewed
2012-02-06 15:30 bugmaster Status reviewed => verified
2012-02-06 15:30 bugmaster Resolution open => fixed
2012-03-29 17:26 bugmaster Changeset attached => occt master ac04d101
2014-04-16 12:01 kgv Relationship added related to 0024837