View Issue Details

IDProjectCategoryView StatusLast Update
0031326Open CASCADEOCCT:Visualizationpublic2020-12-02 17:12
Reporternds Assigned Tobugmaster  
PrioritynormalSeverityfeature 
Status closedResolutionfixed 
Target Version7.5.0Fixed in Version7.5.0 
Summary0031326: Foundation Classes - Init from Json for base OCCT classes
DescriptionSome OCCT classes have DumpJson into a stream.
It's proposed to be able to fulfill an instance of the object by the stream.
Result is the object and a boolean state about success.
TagsNo tags attached.
Test case numberNot required

Attached Files

  • initFromJson.png (36,024 bytes)

Relationships

child of 0031313 closedbugmaster Foundation Classes - Dump improvement for classes 
child of 0030949 closedbugmaster Foundation Classes - Dump improvement for OCCT classes 

Activities

git

2020-01-28 18:31

administrator   ~0090110

Branch CR31326 has been created by nds.

SHA-1: 4bd49af69b5ea0fa9e40d68f0c6f8bcc311eb724


Detailed log of new commits:

Author: nds
Date: Tue Jan 28 18:28:00 2020 +0300

    0031326: Foundation Classes - Init from Json for base OCCT classes

git

2020-01-30 01:57

administrator   ~0090176

Branch CR31326_1 has been created by nds.

SHA-1: 427c6cd7d47af1d7b902927e7fa411acfe1ef325


Detailed log of new commits:

Author: nds
Date: Tue Jan 28 18:28:00 2020 +0300

    0031326: Foundation Classes - Init from Json for base OCCT classes

git

2020-01-30 08:45

administrator   ~0090188

Branch CR31326 has been deleted by nds.

SHA-1: 4bd49af69b5ea0fa9e40d68f0c6f8bcc311eb724

nds

2020-01-30 09:33

developer   ~0090191

Dear Kirill,

could you please review patch.
Jenkins job: http://jenkins-test-12.nnov.opencascade.com/view/CR31326_1-master-NDS/view/COMPARE/
please, note that patch is based on fix for 31313.

Thank you in advance, Natalia

kgv

2020-01-30 12:35

developer   ~0090198

+  Standard_Boolean InitFromJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
+  {

Please move method implementation after class declaration.

+  //! Inits the content of me into the stream

...from the stream.

+Standard_Boolean  gp_Ax3::InitFromJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)
...
+Standard_Boolean  gp_Trsf::InitFromJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)

Double space.

+  Standard_Real mymatrix[3][3];
...
+  Standard_Real myshape;

aMatrix, aShape.

+Standard_Boolean Standard_Dump::ProcessStreamName (const Standard_SStream& theStream,
+                                                   const TCollection_AsciiString& theName,
+                                                   Standard_Integer& theStreamPos)
+{
+  TCollection_AsciiString aText = Text (theStream);

This conception looks very confusing.
Why not just read from JSON loaded into TCollection_AsciiString?

+  if (aSubText.StartsWith (JsonKeyToString (Standard_JsonKey_SeparatorValueToValue)))

Adding "StartsWithAt()" taking position would allow avoiding creation of redundant copy.

nds

2020-01-30 22:59

developer   ~0090218

Dear Kirill,

Something is not clear:
1. < This conception looks very confusing.
Why not just read from JSON loaded into TCollection_AsciiString? >

Here, is it expected that parameter of this method is not a stream but a text?

2. << Adding "StartsWithAt()"... >>

 TCollection_AsciiString has no StartsWithAt(). Could you please explain in more detail what do you mean here?

kgv

2020-01-30 23:39

developer   ~0090219

> Here, is it expected that parameter of this method is not a stream but a text?
Yes, it makes no sense passing stream everywhere, to read it entirely into string.

+  TCollection_AsciiString aSubText = aText.SubString (theStreamPos, aText.Length());
+  if (aSubText.StartsWith (JsonKeyToString (Standard_JsonKey_SeparatorValueToValue)))
+  {
+    theStreamPos += JsonKeyLength (Standard_JsonKey_SeparatorValueToValue);
+    aSubText = aText.SubString (theStreamPos, aText.Length());
+  }

> TCollection_AsciiString has no StartsWithAt(). Could you please explain in more detail what do you mean here?
if (theText.StartsWithAt (", ", theStreamPos))
{
  theStreamPos += JsonKeyLength (Standard_JsonKey_SeparatorValueToValue);
}
TCollection_AsciiString aSubText = aText.SubString (theStreamPos, aText.Length());

git

2020-02-12 23:35

administrator   ~0090499

Branch CR31326_2 has been created by nds.

SHA-1: 10ac0403384f4d7020d4155b7db1de8d5752bde8


No new revisions were added by this update.

git

2020-02-12 23:35

administrator   ~0090500

Branch CR31326_2 has been updated by nds.

SHA-1: 55b405ba591587b3456d77e0d406a117e8ded286


Detailed log of new commits:

Author: nds
Date: Wed Feb 12 23:35:54 2020 +0300

    0031326: Foundation Classes - Init from Json for base OCCT classes

git

2020-04-11 10:37

administrator   ~0091509

Branch CR31326_3 has been created by nds.

SHA-1: 39f197676cb85d2b84ad0ff15266eed118cbbaff


Detailed log of new commits:

Author: nds
Date: Wed Feb 12 23:35:54 2020 +0300

    0031326: Foundation Classes - Init from Json for base OCCT classes

git

2020-09-05 11:59

administrator   ~0094045

Branch CR31326_4 has been created by nds.

SHA-1: 6148c4586b3ffa8a6f399e33e3d0c9824e310b49


Detailed log of new commits:

Author: nds
Date: Sat Sep 5 11:58:19 2020 +0300

    initFromJSon using during convet stream into presentation

Author: nds
Date: Wed Feb 12 23:35:54 2020 +0300

    0031326: Foundation Classes - Init from Json for base OCCT classes
    
    (cherry picked from commit 39f197676cb85d2b84ad0ff15266eed118cbbaff)
    (cherry picked from commit 4a5e30db5bbdfc7a77a03d1e55e8a3bee5d79d2d)

git

2020-09-05 12:36

administrator   ~0094116

Branch CR31326_4 has been updated by nds.

SHA-1: 821f8e408359680053f8c8b0c2cc37d4d6a2155f


Detailed log of new commits:

Author: nds
Date: Sat Sep 5 12:39:24 2020 +0300

    using BRepPreviewAPI_MakeBox to prepare box.

git

2020-09-05 12:38

administrator   ~0094117

Branch CR31326_5 has been created by nds.

SHA-1: 238d69f1e0f88be32038566076057fc3b046f867


Detailed log of new commits:

Author: nds
Date: Sat Sep 5 12:41:19 2020 +0300

    0031326: Foundation Classes - Init from Json for base OCCT classes

git

2020-09-06 08:37

administrator   ~0094157

Branch CR31326_5 has been updated by nds.

SHA-1: 73fa34c49e82a07d1d4cbe88ec556b30b7a4d9d9


Detailed log of new commits:

Author: nds
Date: Sun Sep 6 08:40:01 2020 +0300

    correction for remark about stream in ProcessStreamName

git

2020-09-06 09:56

administrator   ~0094158

Branch CR31326_5 has been updated forcibly by nds.

SHA-1: c4c25131e18e36a3d53631b5a9dc809407144a26

nds

2020-09-06 09:58

developer   ~0094159

Dear Kirill,

could you please review.

Best regards, Natalia

nds

2020-09-06 11:24

developer  

initFromJson.png (36,024 bytes)

kgv

2020-09-06 12:42

developer   ~0094169

+    if (n == 1)
+    {
+    }
+    if (n == 2)
...
+    if (n == 3)

else if

+  //! @param theSStream stream with values
+  //! @param theStreamPos current position in the stream
+  //! @param theValue stream value

Please add [in]/[out] modifiers.

+  gp_XYZ aDir;
+  OCCT_INIT_VECTOR_CLASS (aStreamStr, "Direction", aPos, 3,
+                          &aDir.ChangeCoord (1), &aDir.ChangeCoord (2), &aDir.ChangeCoord (3))
+  gp_XYZ aXDir;
+  OCCT_INIT_VECTOR_CLASS (aStreamStr, "XDirection", aPos, 3,
+                          &aXDir.ChangeCoord (1), &aXDir.ChangeCoord (2), &aXDir.ChangeCoord (3))
+  gp_XYZ anYDir;
+  OCCT_INIT_VECTOR_CLASS (aStreamStr, "YDirection", aPos, 3,
+                          &anYDir.ChangeCoord (1), &anYDir.ChangeCoord (2), &anYDir.ChangeCoord (3))
+
+  SetXDirection (aXDir);
+  SetYDirection (anYDir);
+
+  if (!Direction().IsEqual (aDir, Precision::Confusion()))
+    return Standard_False;

gp_Ax2/gp_Ax3 initialization code using independent methods SetXDirection()/SetYDirection() doesn't look correct as they perform correction of input vector basing on current state...

+  Standard_Real mymatrix[3][3];
...
+  Standard_Real myshape;
+  OCCT_INIT_FIELD_VALUE_INTEGER (aStreamStr, aPos, myshape);

Unexpected "my" prefix for local variables.

git

2020-09-08 00:04

administrator   ~0094227

Branch CR31326_5 has been updated by nds.

SHA-1: 24ee805c5ceaded4a52c6293212bd45475322eae


Detailed log of new commits:

Author: nds
Date: Tue Sep 8 00:06:56 2020 +0300

    remarks correction.

git

2020-09-08 00:13

administrator   ~0094228

Branch CR31326_6 has been created by nds.

SHA-1: b34b150d96d1573de0291296b5696f022dc86088


Detailed log of new commits:

Author: nds
Date: Tue Sep 8 00:16:32 2020 +0300

    0031326: Foundation Classes - Init from Json for base OCCT classes
    
    InitFromJson method implementation for some simple classes.
    OCCT_INIT_* defines introduction to do automatic parsing of the stream into values.
    Inspector is extended to visualize objects created on the dump stream if it might be created.

nds

2020-09-08 08:23

developer   ~0094230

Dear Kirill,

remarks are corrected, please review.

Best regards, Natalia

kgv

2020-09-08 10:46

developer   ~0094234

+  //! Inits the content of me into the stream
+  Standard_EXPORT Standard_Boolean InitFromJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos);

Shouldn't it be "from the stream"?

git

2020-09-08 10:57

administrator   ~0094237

Branch CR31326_6 has been updated forcibly by nds.

SHA-1: c00c6c10a61c298517ee58846f1cd6054ea8a6ba

nds

2020-09-08 10:58

developer   ~0094238

corrected, please check.

nds

2020-09-09 19:39

developer   ~0094318

OCCT: CR31326_6
PRODUCTS: NOT

bugmaster

2020-09-13 11:04

administrator   ~0094536

Combination -
OCCT branch : IR-2020-09-11
master SHA - d1b25684e9402d995dafec22fb98f83957d5fb76
a206de37fbfa0bf71bd534ae47192bbec23b8522
Products branch : IR-2020-09-11 SHA - a7e55a291cf6642cb4af945a999deeeb5f91272a
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: 17333.360000000142 / 17325.800000000123 [+0.04%]
Products
Total CPU difference: 12056.720000000096 / 12079.64000000011 [-0.19%]
Windows-64-VC14:
OCCT
Total CPU difference: 18817.921875 / 18792.46875 [+0.14%]
Products
Total CPU difference: 13294.09375 / 13274.75 [+0.15%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2020-09-13 11:46

administrator   ~0094589

Branch CR31326_6 has been deleted by inv.

SHA-1: c00c6c10a61c298517ee58846f1cd6054ea8a6ba

git

2020-09-13 11:46

administrator   ~0094592

Branch CR31326_5 has been deleted by inv.

SHA-1: 24ee805c5ceaded4a52c6293212bd45475322eae

git

2020-09-13 11:46

administrator   ~0094599

Branch CR31326_4 has been deleted by inv.

SHA-1: 821f8e408359680053f8c8b0c2cc37d4d6a2155f

git

2020-09-13 11:47

administrator   ~0094611

Branch CR31326_3 has been deleted by inv.

SHA-1: 39f197676cb85d2b84ad0ff15266eed118cbbaff

git

2020-09-13 11:47

administrator   ~0094616

Branch CR31326_2 has been deleted by inv.

SHA-1: 55b405ba591587b3456d77e0d406a117e8ded286

git

2020-09-13 11:47

administrator   ~0094617

Branch CR31326_1 has been deleted by inv.

SHA-1: 427c6cd7d47af1d7b902927e7fa411acfe1ef325

Related Changesets

occt: master 6b63dc83

2020-09-07 21:16:32

nds


Committer: bugmaster Details Diff
0031326: Foundation Classes - Init from Json for base OCCT classes

InitFromJson method implementation for some simple classes.
OCCT_INIT_* defines introduction to do automatic parsing of the stream into values.
Inspector is extended to visualize objects created on the dump stream if it might be created.
Affected Issues
0031326
mod - src/Bnd/Bnd_Box.cxx Diff File
mod - src/Bnd/Bnd_Box.hxx Diff File
mod - src/BVH/BVH_Box.hxx Diff File
mod - src/gp/gp_Ax1.cxx Diff File
mod - src/gp/gp_Ax1.hxx Diff File
mod - src/gp/gp_Ax2.cxx Diff File
mod - src/gp/gp_Ax2.hxx Diff File
mod - src/gp/gp_Ax3.cxx Diff File
mod - src/gp/gp_Ax3.hxx Diff File
mod - src/gp/gp_Dir.cxx Diff File
mod - src/gp/gp_Dir.hxx Diff File
mod - src/gp/gp_Pnt.cxx Diff File
mod - src/gp/gp_Pnt.hxx Diff File
mod - src/gp/gp_Trsf.cxx Diff File
mod - src/gp/gp_Trsf.hxx Diff File
mod - src/gp/gp_XYZ.cxx Diff File
mod - src/gp/gp_XYZ.hxx Diff File
mod - src/Quantity/Quantity_Color.cxx Diff File
mod - src/Quantity/Quantity_Color.hxx Diff File
mod - src/Quantity/Quantity_ColorRGBA.cxx Diff File
mod - src/Quantity/Quantity_ColorRGBA.hxx Diff File
mod - src/Standard/Standard_Dump.cxx Diff File
mod - src/Standard/Standard_Dump.hxx Diff File
mod - tools/Convert/Convert_Tools.cxx Diff File
mod - tools/Convert/Convert_Tools.hxx Diff File
mod - tools/TreeModel/TreeModel_ItemBase.cxx Diff File
mod - tools/TreeModel/TreeModel_ItemBase.hxx Diff File
mod - tools/View/View_Displayer.cxx Diff File
mod - tools/View/View_DisplayPreview.cxx Diff File
mod - tools/View/View_DisplayPreview.hxx Diff File
mod - tools/View/View_PreviewParameters.cxx Diff File
mod - tools/VInspector/VInspector_ItemPresentableObject.cxx Diff File
mod - tools/VInspector/VInspector_Window.cxx Diff File

Issue History

Date Modified Username Field Change
2020-01-28 18:30 nds New Issue
2020-01-28 18:30 nds Assigned To => nds
2020-01-28 18:31 git Note Added: 0090110
2020-01-28 18:32 nds Relationship added child of 0031313
2020-01-30 01:57 git Note Added: 0090176
2020-01-30 08:36 nds Assigned To nds => kgv
2020-01-30 08:36 nds Status new => resolved
2020-01-30 08:36 nds Additional Information Updated
2020-01-30 08:45 git Note Added: 0090188
2020-01-30 09:33 nds Note Added: 0090191
2020-01-30 09:33 nds Additional Information Updated
2020-01-30 12:09 kgv Relationship added child of 0030949
2020-01-30 12:35 kgv Note Added: 0090198
2020-01-30 12:35 kgv Assigned To kgv => nds
2020-01-30 12:35 kgv Severity minor => feature
2020-01-30 12:35 kgv Status resolved => assigned
2020-01-30 22:59 nds Note Added: 0090218
2020-01-30 23:39 kgv Note Added: 0090219
2020-02-12 23:35 git Note Added: 0090499
2020-02-12 23:35 git Note Added: 0090500
2020-04-11 10:37 git Note Added: 0091509
2020-09-05 11:59 git Note Added: 0094045
2020-09-05 12:36 git Note Added: 0094116
2020-09-05 12:38 git Note Added: 0094117
2020-09-06 08:37 git Note Added: 0094157
2020-09-06 09:56 git Note Added: 0094158
2020-09-06 09:58 nds Note Added: 0094159
2020-09-06 09:58 nds Assigned To nds => kgv
2020-09-06 09:58 nds Status assigned => resolved
2020-09-06 11:24 nds File Added: initFromJson.png
2020-09-06 12:42 kgv Note Added: 0094169
2020-09-06 12:42 kgv Assigned To kgv => nds
2020-09-06 12:42 kgv Status resolved => assigned
2020-09-08 00:04 git Note Added: 0094227
2020-09-08 00:13 git Note Added: 0094228
2020-09-08 08:23 nds Note Added: 0094230
2020-09-08 08:23 nds Assigned To nds => kgv
2020-09-08 08:23 nds Status assigned => resolved
2020-09-08 10:46 kgv Note Added: 0094234
2020-09-08 10:57 git Note Added: 0094237
2020-09-08 10:58 nds Note Added: 0094238
2020-09-08 11:04 kgv Assigned To kgv => bugmaster
2020-09-08 11:04 kgv Status resolved => reviewed
2020-09-09 19:39 nds Note Added: 0094318
2020-09-13 11:04 bugmaster Note Added: 0094536
2020-09-13 11:04 bugmaster Status reviewed => tested
2020-09-13 11:12 bugmaster Test case number => Not required
2020-09-13 11:24 bugmaster Changeset attached => occt master 6b63dc83
2020-09-13 11:24 bugmaster Status tested => verified
2020-09-13 11:24 bugmaster Resolution open => fixed
2020-09-13 11:46 git Note Added: 0094589
2020-09-13 11:46 git Note Added: 0094592
2020-09-13 11:46 git Note Added: 0094599
2020-09-13 11:47 git Note Added: 0094611
2020-09-13 11:47 git Note Added: 0094616
2020-09-13 11:47 git Note Added: 0094617
2020-12-02 16:41 emo Fixed in Version => 7.5.0
2020-12-02 17:12 emo Status verified => closed