Task: Fixes #6816 (rdkit/rdkit#6827)

org: rdkit
repo: rdkit
pr_number: 6827
issue_title: Fixes #6816
issue_body: This PR addressees #6816 by making sure that `reapplyMolBlockWedging()` also restores the double bond stereo depiction as originally specified in the molblock, either V2000 (`sss` bond stereo field) or V3000 (through the `CFG` field in the bond block).
Currently, this was happening only partially for the V3000 format, and not at all for the V2000 format.
I added a unit test to make sure things works as expected; here's the gist that I used to set up the unit test:

[Jupyter notebook used for `TEST_CASE("test GitHub6816")` in `Code/GraphMol/Depictor/catch_tests.cpp`](https://gist.github.com/ptosco/aa51700b3fcafa6e0629a638e1f1cc0a)

UPDATE: this PR also fixes #6893, which was found by @rvianello at a later stage.
resolved_issues: number: 6816
title: Double bonds should not be depicted as crossed bonds in the presence of wavy bonds
body: I have compared the ChemDraw depictions to RDKit depictions for a few cases where undefined geometric isomerism at a double bond is represented as:

1. _Either_ single bonds on the stereochemistry-determining atoms (bond stereo 4) (Examples 1-3)
2. _Cis or trans (either)_ double bond (bond stereo 3) (Example 4)

```
from rdkit import Chem
from rdkit.Chem.Draw import IPythonConsole, rdMolDraw2D, rdDepictor
```

# Example 1
### ChemDraw
![image](https://github.com/rdkit/rdkit/assets/5244385/fda6d3a9-9427-49b7-b1c1-51fc8d791212)

### RDKit
```
mol = Chem.MolFromMolBlock("""double.mol
  ChemDraw10192311132D

  4  3  0  0  0  0  0  0  0  0999 V2000
   -0.7145    0.2062    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.0000    0.6188    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.7145    0.2062    0.0000 F   0  0  0  0  0  0  0  0  0  0  0  0
   -0.7145   -0.6188    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  2  0        0
  2  3  1  4        0
  1  4  1  4        0
M  END
""")
Chem.ReapplyMolBlockWedging(mol)
mol
```
![image](https://github.com/rdkit/rdkit/assets/5244385/48c7b5d1-81e3-4315-9cfc-4a3730157581)

# Example 2
### ChemDraw
![image](https://github.com/rdkit/rdkit/assets/5244385/5d045eb3-2c6e-4bd7-9d2b-194472aaff31)

### RDKit
```
mol = Chem.MolFromMolBlock("""double-2.mol
  ChemDraw10192311332D

  4  3  0  0  0  0  0  0  0  0999 V2000
   -0.3572   -0.2062    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.3572    0.2062    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    1.0717    0.6188    0.0000 F   0  0  0  0  0  0  0  0  0  0  0  0
   -1.0717   -0.6188    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  2  0        0
  2  3  1  4        0
  1  4  1  4        0
M  END
""")
Chem.ReapplyMolBlockWedging(mol)
mol
```
![image](https://github.com/rdkit/rdkit/assets/5244385/38482587-0365-4a9b-81c3-3d169a10cd1f)

# Example 3
### ChemDraw
![image](https://github.com/rdkit/rdkit/assets/5244385/d0951139-484e-41b6-94e4-b4371d4acaaa)

### RDKit
```
mol = Chem.MolFromMolBlock("""di-imine-2-2000.mol
  ChemDraw10192311522D

  8  7  0  0  0  0  0  0  0  0999 V2000
   -0.9959   -1.0600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.4125   -0.4767    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.4125   -0.4767    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.9959   -1.0600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.7282    0.2855    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
   -0.9971    1.0600    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.7282    0.2855    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
    0.9971    1.0270    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  1  0        0
  2  3  1  0        0
  3  4  1  0        0
  2  5  2  0        0
  5  6  1  4        0
  3  7  2  0        0
  7  8  1  4        0
M  END
""")
Chem.ReapplyMolBlockWedging(mol)
mol
```
![image](https://github.com/rdkit/rdkit/assets/5244385/4092b183-a56c-4ef2-a335-e9c094cb4d6c)

# Example 4
### ChemDraw
![image](https://github.com/rdkit/rdkit/assets/5244385/6aad781d-b086-404d-bdbc-9fe1ad39f363)

### RDKit
```
mol = Chem.MolFromMolBlock("""di-imine-cross-2000.mol
  ChemDraw10192311582D

  8  7  0  0  0  0  0  0  0  0999 V2000
   -1.0099   -1.1129    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.5974   -0.3984    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.2276   -0.3984    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    0.6401   -1.1129    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
   -0.8109    0.3984    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
    0.6401    0.3160    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
   -1.2234    1.1129    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    1.2234    0.8994    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  1  0        0
  2  3  1  0        0
  3  4  1  0        0
  2  5  2  3        0
  3  6  2  3        0
  5  7  1  0        0
  6  8  1  0        0
M  END
""")
Chem.ReapplyMolBlockWedging(mol)
mol
```
![image](https://github.com/rdkit/rdkit/assets/5244385/d43c0563-d6cc-4c1d-ad67-10c1e440e997)

Example 4 looks correct to me.
In examples 1-3 I believe the crossed bond depicted by RDKit is redundant since the wavy bonds are sufficient to specificy undefined stereochemistry.

Reference solution:
fix_patch: diff --git a/Code/GraphMol/Chirality.cpp b/Code/GraphMol/Chirality.cpp
index f748b413ca5..ba6b3fdae43 100644
--- a/Code/GraphMol/Chirality.cpp
+++ b/Code/GraphMol/Chirality.cpp
@@ -3303,13 +3303,17 @@ void detectBondStereochemistry(ROMol &mol, int confId) {
   }
 }
 
-void clearSingleBondDirFlags(ROMol &mol) {
+void clearSingleBondDirFlags(ROMol &mol, bool retainCisTransInfo) {
   for (auto bond : mol.bonds()) {
     if (bond->getBondType() == Bond::SINGLE) {
-      if (bond->getBondDir() == Bond::UNKNOWN) {
+      auto bondDir = bond->getBondDir();
+      if (bondDir == Bond::UNKNOWN) {
         bond->setProp(common_properties::_UnknownStereo, 1);
       }
-      bond->setBondDir(Bond::NONE);
+      if (!retainCisTransInfo ||
+          (bondDir != Bond::ENDDOWNRIGHT && bondDir != Bond::ENDUPRIGHT)) {
+        bond->setBondDir(Bond::NONE);
+      }
     }
   }
 }
diff --git a/Code/GraphMol/MolOps.h b/Code/GraphMol/MolOps.h
index 47bf9bdb3b8..8d611d84e02 100644
--- a/Code/GraphMol/MolOps.h
+++ b/Code/GraphMol/MolOps.h
@@ -975,8 +975,10 @@ RDKIT_GRAPHMOL_EXPORT void detectBondStereochemistry(ROMol &mol,
 RDKIT_GRAPHMOL_EXPORT void setDoubleBondNeighborDirections(
     ROMol &mol, const Conformer *conf = nullptr);
 //! removes directions from single bonds. Wiggly bonds will have the property
-//! _UnknownStereo set on them
-RDKIT_GRAPHMOL_EXPORT void clearSingleBondDirFlags(ROMol &mol);
+//! _UnknownStereo set on them. If retainCisTransInfo is true,
+//! ENDUPRIGHT and ENDDOWNRIGHT bond directions will not be cleared
+RDKIT_GRAPHMOL_EXPORT void clearSingleBondDirFlags(
+    ROMol &mol, bool retainCisTransInfo = false);
 
 //! Assign CIS/TRANS bond stereochemistry tags based on neighboring
 //! directions
diff --git a/Code/GraphMol/WedgeBonds.cpp b/Code/GraphMol/WedgeBonds.cpp
index 7ed32594fb3..a24a1e85eaf 100644
--- a/Code/GraphMol/WedgeBonds.cpp
+++ b/Code/GraphMol/WedgeBonds.cpp
@@ -506,7 +506,7 @@ void wedgeBond(Bond *bond, unsigned int fromAtomIdx, const Conformer *conf) {
 }
 
 void reapplyMolBlockWedging(ROMol &mol) {
-  MolOps::clearSingleBondDirFlags(mol);
+  MolOps::clearSingleBondDirFlags(mol, true);
   for (auto b : mol.bonds()) {
     int explicit_unknown_stereo = -1;
     if (b->getPropIfPresent<int>(common_properties::_UnknownStereo,
@@ -522,25 +522,40 @@ void reapplyMolBlockWedging(ROMol &mol) {
       } else if (bond_dir == 6) {
         b->setBondDir(Bond::BEGINDASH);
       }
+      if (b->getBondType() == Bond::DOUBLE) {
+        if (bond_dir == 0 && b->getStereo() == Bond::STEREOANY) {
+          b->setBondDir(Bond::NONE);
+          b->setStereo(Bond::STEREONONE);
+        } else if (bond_dir == 3) {
+          b->setBondDir(Bond::EITHERDOUBLE);
+          b->setStereo(Bond::STEREOANY);
+        }
+      }
     }
     int cfg = -1;
-    if (b->getPropIfPresent<int>(common_properties::_MolFileBondCfg, cfg)) {
-      switch (cfg) {
-        case 1:
-          b->setBondDir(Bond::BEGINWEDGE);
-          break;
-        case 2:
-          if (b->getBondType() == Bond::SINGLE) {
-            b->setBondDir(Bond::UNKNOWN);
-          } else if (b->getBondType() == Bond::DOUBLE) {
-            b->setBondDir(Bond::EITHERDOUBLE);
-            b->setStereo(Bond::STEREOANY);
-          }
-          break;
-        case 3:
-          b->setBondDir(Bond::BEGINDASH);
-          break;
-      }
+    b->getPropIfPresent<int>(common_properties::_MolFileBondCfg, cfg);
+    switch (cfg) {
+      case 1:
+        b->setBondDir(Bond::BEGINWEDGE);
+        break;
+      case 2:
+        if (b->getBondType() == Bond::SINGLE) {
+          b->setBondDir(Bond::UNKNOWN);
+        } else if (b->getBondType() == Bond::DOUBLE) {
+          b->setBondDir(Bond::EITHERDOUBLE);
+          b->setStereo(Bond::STEREOANY);
+        }
+        break;
+      case 3:
+        b->setBondDir(Bond::BEGINDASH);
+        break;
+      case 0:
+      case -1:
+        if (bond_dir == -1 && b->getBondType() == Bond::DOUBLE &&
+            b->getStereo() == Bond::STEREOANY) {
+          b->setBondDir(Bond::NONE);
+          b->setStereo(Bond::STEREONONE);
+        }
     }
   }
 }