DiscussionsIssue archiveOCCT:Visualization

Archived issue #0029993

Visualization - AIS_TextLabel computes selection primitive only for attachment point

Open CASCADEOCCT:Visualizationclosed16 public notes

Search issues

Description

AIS_TextLabel::ComputeSelection() adds only one sensitive entity - Select3D_SensitivePoint.

It is desired improving this functionality to select text label as whole (as rectangle).

Steps to reproduce

Not required

Public activity

16 archived notes

Participants are labeled by their role within this record.

01Commenter 2
Branch [archived branch] has been created by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Tue Dec 3 12:32:39 2019 +0300

    0029993: Visualization - AIS_TextLabel computes selection primitive only for attachment point
    
    The text label is selected as a rectangle (adds a sensitive object - Select3D_SensitiveFace).
    The bounding box has been resized to fit the sensitive rectangle.
    Transform persistent has been added to AIS_TextLabel to correctly position the sensitive rectangle.
    The vconnect command was also changed to correctly connect objects with transform persistence.
    
    bugs/vis/bug29993: test case added
02Commenter 2
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
03Commenter 3
04Commenter 3
The patch CR29993 is ready to review
05Author
+ tests/bugs/vis/bug29993
It would be better makes an extra screenshot with vsensdis to existing test case rather than creating a new one.

--- a/src/ViewerTest/ViewerTest_ObjectCommands.cxx
+++ b/src/ViewerTest/ViewerTest_ObjectCommands.cxx
@@ -4254,6 +4254,10 @@ static Handle(AIS_InteractiveObject) findConnectedObject (const TCollection_Asci
     aConnected->SetDisplayMode (aPrs->DisplayMode());
   }
   aConnected->Connect (aPrs, aPrs->LocalTransformationGeom());
+  if (!aPrs->TransformPersistence().IsNull())
+  {
+    aConnected->SetTransformPersistence (aPrs->TransformPersistence());
+  }

This looks unrelated to bug.
Do you have a test case for this issue?

--- a/src/AIS/AIS_TextLabel.hxx
+++ b/src/AIS/AIS_TextLabel.hxx
@@ -132,6 +132,16 @@ private:
   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

Please change section private -> protected for all these methods.

+  aLabelPlane.SetTranslationPart (theCenterOfLabel.Coord());

theCenterOfLabel.XYZ() is more common.

+    isInit = Standard_True;

This temporary variable looks redundant in new method.

+  if (Handle(Font_FTFont) aFont = Font_FTFont::FindAndCreate (anAsp->Aspect()->Font(), anAsp->Aspect()->GetTextFontAspect(), aFontParams))

Handle(Font_FTFont) aFont = ...;
if (aFont.IsNull()) { return false; }

+      Handle(Select3D_SensitiveEntity) aTextSensitive;
...
+        aTextSensitive = new Select3D_SensitivePoint (anEntityOwner, aPosition);
+        theSelection->Add (aTextSensitive);
+        break;

Defining variable in advance looks redundant.

+        aBox.Add (NCollection_Vec4<float> ((float) aMinPnt.X(), (float) aMinPnt.Y(), (float) aMinPnt.Z(), 1.0));

Graphic3d_Vec4
06Commenter 3
>This looks unrelated to bug.
>Do you have a test case for this issue?


This problem can be reproduced in test bugs/vis/bug24837_2

test bugs vis bug24837_2 1
vsensdis

For text labels, transform persistent is not set

07Author
> This problem can be reproduced in test bugs/vis/bug24837_2
Please extend this test case with an extra screenshot.
08Commenter 2
Branch [archived branch] has been updated by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Sun Jul 5 19:31:44 2020 +0300

    remarks from kgv

09Commenter 2
Branch [archived branch] has been created by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Tue Dec 3 12:32:39 2019 +0300

    0029993: Visualization - AIS_TextLabel computes selection primitive only for attachment point
    
    The text label is selected as a rectangle (adds a sensitive object - Select3D_SensitiveFace).
    The bounding box has been resized to fit the sensitive rectangle.
    Transform persistent has been added to AIS_TextLabel to correctly position the sensitive rectangle.
    The findConnectedObject function has also been changed to correctly set transform persistence.
10Commenter 3
The patch CR29993_1 is ready to review
11Commenter 2
Branch [archived branch] has been updated by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Sun Jul 5 20:15:05 2020 +0300

    remarks from kgv

12Commenter 2
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
13Author
Please raise the patch in OCCT branch CR29993_1.
14Commenter 1
Combination -
OCCT branch : [archived branch]
master SHA - [revision removed]
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 17210.790000000085 / 17175.910000000105 [+0.20%]
Products
Total CPU difference: 11229.020000000071 / 11228.490000000076 [+0.00%]
Windows-64-VC14:
OCCT
Total CPU difference: 18725.6875 / 18705.46875 [+0.11%]
Products
Total CPU difference: 11144.125 / 13046.140625 [-14.58%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
15Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]
16Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]