DiscussionsIssue archiveOCCT:Visualization

Archived issue #0025785

Visualization - introduce AIS_ColorScale presentation for Color Scale

Open CASCADEOCCT:Visualizationclosed42 public notes

Search issues

Description

As far as z-layers can now draw 2d objects, color scale must be implemented as AIS interactive object.

Steps to reproduce

tests/bugs/vis/bug25136

Additional information

ColorScale as global property of V3d_View has been removed with associated methods V3d_View::ColorScaleDisplay(), V3d_View::ColorScaleErase(), V3d_View::ColorScaleIsDisplayed(), V3d_View::ColorScale() and classes V3d_ColorScale, V3d_ColorScaleLayerItem, Aspect_ColorScale.

New interactive object AIS_ColorScale (provides the same configuration API as previously Aspect_ColorScale and V3d_ColorScale) should be used instead and displayed as 2D presentation:
Handle(AIS_ColorScale) aCS = new AIS_ColorScale();
// configuring
aCS->SetHeight            (0.95);
aCS->SetRange             (0.0, 10.0);
aCS->SetNumberOfIntervals (10);
// displaying
aCS->SetZLayer (Graphic3d_ZLayerId_TopOSD);
aCS->SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt (-1,-1,0));
aCS->SetToUpdate();
theContextAIS->Display (aCS);

Public activity

42 archived notes

Participants are labeled by their role within this record.

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

[revision removed]


Detailed log of new commits:

Author: Author
Date: Tue Feb 3 12:06:37 2015 +0300

    0025785: Redesign of color scale on AIS
    
    Color scale is implemented on AIS. Draw command vcolorscale now works with AIS_ColorScale.
02Commenter 2
Dear Kirill,
Please review branch CR25785.
03Commenter 3
The patch is messed up with #0025136.
04Commenter 2
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Wed Feb 11 13:54:24 2015 +0300

    0025785: Visualization - introduce AIS_ColorScale presentation for Color Scale
    
    Color scale is implemented on AIS. Draw command vcolorscale now works with AIS_ColorScale.

Author: Author
Date: Mon Feb 9 13:49:08 2015 +0300

    Flags' values for TPF_2D and Graphic3d_TMF_2d were changed to 0x40.

Author: Author
Date: Mon Feb 9 11:36:58 2015 +0300

    Flag TPF_2D is added to transform persistence flags. Matrix settings for drawing 2d objects were moved into BeginTransformPersistence() method.
    Vdisplay command is modified: options -overlay and -underlay were added to be able to display objects in overlay and underlay;
    options -select and -noselect were added to control selection; selection for 2d objects is turned off by default.
    Test case bug25783 was added to check the new options of vdisplay command.

Author: Commenter 3
Date: Tue Feb 3 16:06:39 2015 +0300

    cosmetics

Author: Author
Date: Tue Feb 3 10:51:19 2015 +0300

    0025783: Designing 2d layers with z-layers
    
    Displaying objects in 2d now works through zlayers. Is2d flag is added to ZlayerSettings.
    Graphic3d_ZLayerId_BotOSD with id -5 is added to draw underlay.
05Commenter 5
Dear Kirill,
Please review branch CR25785_1.
06Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
07Commenter 2
Branch [archived branch] has been updated by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Thu Feb 19 14:48:09 2015 +0300

    Draw command OCC12584 updated.

08Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
09Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
10Commenter 2
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Fri Apr 17 15:34:29 2015 +0300

    0025785: Visualization - introduce AIS_ColorScale presentation for Color Scale
    
    Color scale is implemented on AIS. Draw command vcolorscale now works with AIS_ColorScale.
11Commenter 3
AIS_ColorScale should replace old color scale, not provide extra one.
12Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
13Commenter 13
Dear Kirill,
Please review branch CR25785_2.
14Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
15Commenter 3
+  for (Standard_Integer ci = 1; ci <= colors.Length() && step > 0; ci++) {
+    Standard_Integer y = (Standard_Integer)( myYPos + ( ci - 1 )* step + offset );
+    Standard_Integer h = (Standard_Integer)( myYPos + ( ci ) * step + offset ) - y;
+    DrawRectangle (thePresentation, x, y, colorWidth, h, colors.Value( ci ), Standard_True);
+  }

this code should be replaced by generation of single colored triangles array.

--- /dev/null
+++ b/src/AIS/AIS_ColorScale.cxx
@@ -0,0 +1,759 @@
+#include <AIS_ColorScale.hxx>
...
--- /dev/null
+++ b/src/AIS/AIS_ColorScale.hxx
@@ -0,0 +1,257 @@
+#ifndef _AIS_ColorScale_HeaderFile
+#define _AIS_ColorScale_HeaderFile
+
+#include <AIS_InteractiveObject.hxx>

file headers are missing for new files.

+class AIS_ColorScale : public AIS_InteractiveObject {

class should be documented.

+  //! Returns minimal value of color scale;
+  Standard_EXPORT   Standard_Real GetMin() const { return myMin; }

here and in other places - please re-format the code in new files in accordance with OCCT code rules.

+  void DrawRectangle ( const Handle(Prs3d_Presentation)& thePresentation,
+                       const Standard_Integer theX, const Standard_Integer theY,
+                       const Standard_Integer theWidth, const Standard_Integer theHeight,
+                       const Quantity_Color& theColor, const Standard_Boolean theFilled = Standard_False);
+
+  //! Draws a text.
+  //! @param theText [in] the text to draw.
+  //! @param theX [in] the X coordinate of text position.
+  //! @param theY [in] the Y coordinate of text position.
+  //! @param theColor [in] the color of text.
+  void DrawText ( const Handle(Prs3d_Presentation)& thePresentation,
+                  const TCollection_ExtendedString& theText,
+                  const Standard_Integer theX, const Standard_Integer theY,
+                  const Quantity_Color& theColor );

it seems to be that these methods should not be declared as public.
Please make them protected and add missing Standard_EXPORT.

+  Standard_EXPORT   void SizeHint (Standard_Integer& theWidth, Standard_Integer& theHeight) const;
+  //! Returns the format of text.
+  Standard_EXPORT   TCollection_AsciiString Format() const;
+
+  //! Returns the value of given interval.
+  Standard_EXPORT   Standard_Real GetNumber (const Standard_Integer anIndex) const;
+
+  //! Returns the color's hue for the given value in the given interval.
+  //! @param theValue [in] the current value of interval.
+  //! @param theMin [in] the min value of interval.
+  //! @param theMax [in] the max value of interval.
+  Standard_EXPORT static   Standard_Integer HueFromValue (const Standard_Integer aValue, const Standard_Integer aMin, const Standard_Integer aMax);
+

there no point in exporting private methods.

+  Standard_EXPORT static   Standard_Integer HueFromValue (const Standard_Integer aValue, const Standard_Integer aMin, const Standard_Integer aMax);
+
+  Standard_Real myMin;
+  Standard_Real myMax;

methods and fields should be separated.
16Commenter 2
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Thu Jul 16 13:29:31 2015 +0300

    Drawing colors with DrawRectangle method was replaced by generation of single colored triangles array.
    Added fixes to correspond coding rules.

Author: Author
Date: Thu Apr 23 18:02:21 2015 +0300

    0025785: Visualization - introduce AIS_ColorScale presentation for Color Scale
    
    Color scale is implemented on AIS. Draw command vcolorscale now works with AIS_ColorScale.
17Commenter 17
Dear Kirill,
Please review branch CR25785_3.
18Commenter 3
Please squash and rebase to current master.
19Commenter 2
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Thu Jul 23 09:23:00 2015 +0300

    0025785: Visualization - introduce AIS_ColorScale presentation for Color Scale
    
    Color scale is implemented on AIS. Draw command vcolorscale now works with AIS_ColorScale.
20Commenter 20
Dear Kirill,
Please review branch CR25785_4.
21Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
22Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
23Commenter 3
Please make sure that all samples have been updated.
24Commenter 2
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Fri Jul 31 12:19:06 2015 +0300

    0025785: Visualization - introduce AIS_ColorScale presentation for Color Scale
    
    Color scale is implemented on AIS. Draw command vcolorscale now works with AIS_ColorScale.
    In a qt sample VoxelDemo there was added a field AIS_ColorScale myColorsScale to control a color scale. Method displayColorScale and other methods were changed in order to work with this field.
25Commenter 25
In Products repository there was created branch CR25785.
26Commenter 26
Dear Kirill,
Please review occt branch CR25785_5 and Products branch CR25785.
27Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
28Commenter 3
Please test the patch.
29Commenter 29
Dear Commenter 1,

Branch CR25785_5 from occt git-repository (and CR25785 from products git-repository) was compiled on Linux and Windows platforms and tested.
[revision removed]
[revision removed]

Number of compiler warnings:
occt component:
   Linux: 15 (15 on master)
   Windows: 0 (0 on master)
products component:
   Linux: 39 (39 on master)
   Windows: 0 (0 on master)

Regressions/Differences:
http://occt-tests/CR25785-5-CR25785-occt-64/Debian70-64/summary.html
http://occt-tests/CR25785-5-CR25785-occt-64/Windows-64-VC10/summary.html
3rdparty fonts A1
bugs vis bug21091_1, bug25027

Testing on Linux:
Total MEMORY difference: 91807899 / 91580356 [+0.25%]
Total CPU difference: 17901.069999998996 / 18130.909999999098 [-1.27%]

Testing on Windows:
Total MEMORY difference: 57602948 / 57626727 [-0.04%]
Total CPU difference: 16356.03404569925 / 16351.588017199178 [+0.03%]

There are differences in images found by testdiff:
http://occt-tests/CR25785-5-CR25785-occt-64/Debian70-64/diff-Debian70-64.html
http://occt-tests/CR25785-5-CR25785-occt-64/Windows-64-VC10/diff-Windows-64-VC10.html
bugs vis bug22819
bugs vis bug12584
bugs vis bug25136

30Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
31Commenter 31
Dear Anton,
Please review branch CR25785_5 (There were changes in:
src/QABugs/QABugs_11.cxx
3rdparty fonts A1
bugs vis bug21091_1, bug25027
bugs vis bug22819
bugs vis bug12584).

32Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
33Commenter 33
Reviewed, please test.
34Commenter 2
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
35Commenter 35
Dear Commenter 1,
Branch CR25785_5 was rebased on IR-2015-08-06 of occt git-repository.
[revision removed]

Branch CR25785 was rebased on IR-2015-08-06 of products git-repository.
[revision removed]
36Commenter 36
Dear Commenter 1,
Branch CR25785_5 from occt git-repository (and CR25785from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
[revision removed]
[revision removed]

Number of compiler warnings:

occt component :
Linux: 15 (15 on master)
Windows: 0 (0 on master)

products component :
Linux: 39 (39 on master)
Windows: 0 (0 on master)

Regressions/Differences/Improvements:
No regressions/differences

Testing cases:
http://occt-tests/CR25785-5-CR25785-occt-64/Debian70-64/bugs/vis/bug25136.html
http://occt-tests/CR25785-5-CR25785-occt-64/Windows-64-VC10/bugs/vis/bug25136.html
bugs vis bug25136: OK

Testing on Linux:
occt component :
Total MEMORY difference: 90886819 / 91021141 [-0.15%]
Total CPU difference: 17952.419999998918 / 17854.169999998892 [+0.55%]
products component :
Total MEMORY difference: 24876493 / 24836344 [+0.16%]
Total CPU difference: 6958.550000000001 / 7006.110000000006 [-0.68%]

Testing on Windows:
occt component :
Total MEMORY difference: 56905357 / 56927651 [-0.04%]
Total CPU difference: 16544.857656099055 / 16683.792146699026 [-0.83%]
products component :
Total MEMORY difference: 16011380 / 16018363 [-0.04%]
Total CPU difference: 5126.957264899962 / 5276.780625299962 [-2.84%]

There are no differences in images found by testdiff.
37Commenter 2
Branch [archived branch] has been deleted by Participant.

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

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

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

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

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

[revision removed]

Related records