Commit Graph

18 Commits

Author SHA1 Message Date
Greg Landrum
912b522096 Fixes #3392 (#3395)
a bit of code modernization too
2020-09-18 15:25:18 +02:00
Greg Landrum
fc7b884c48 Fixes #3258 (#3259)
* Fixes #3258

* test #3258

* one additional little test
2020-06-28 05:11:00 +02:00
Greg Landrum
2a897ebba3 Fixes #3226 (#3227) 2020-06-27 06:36:24 +02:00
David Cosgrove
bf86d93346 Fix drawing of N plus (#3165)
* Fixed poor position of + charge in S NH2+ group.  Also made it say Cu2+ rather than Cu+2.

* Fixed bug where H of [NH+](C)(C)C sometimes went on top of bond.

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2020-06-09 16:05:39 +02:00
Greg Landrum
ff29e8aea4 Fixes #3126 (#3133)
* Fixes #3126

* make the default value zero
2020-05-08 04:44:27 +02:00
David Cosgrove
be986757ae Fixed dative bonds so they are 2-colour if the atom colourrs warrant it. (#3066)
Pull point of arrow back because the arrowhead goes beyond the end of the plain line.
Changed/simplified way ends of bonds are adjusted for atoms labels.

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
2020-05-08 04:29:36 +02:00
Greg Landrum
1fcf7d65d2 Tweaks and refinements to new drawing code. (#3034)
* Several things here

1) move "atomNote" and "bondNote" to common_properties
2) move addStereoAnnotation to the MolDraw2DUtils namespace
3) add addAtomIndices and addBondIndices
4) initialize MolDrawOptions members directly instead of via the ctor
5) add tests for all that
6) the usual reformatting

* Move the annotations functions to MolDraw2DDetails,
no need for them to be in the public API

Remove MolDraw2DDetails.h from the installed headers.

* turn off redundant prepareMolsForDrawing in _moltoimg
2020-03-26 10:40:06 +01:00
Greg Landrum
082b7e940f we weren't unsetting the dash pattern after drawing aromatic bonds. (#3032)
This also has a bunch of reformatting mixed in
2020-03-24 11:45:46 -04:00
David Cosgrove
ea54f66558 Commit of 2D draw annotation. (#3010)
* Commit of 2D draw annotation.

* update expected psql results

* First pass at improved radical drawing.

* Fix?

* Fixed different string draw behaviour.

* Removed vestiges of previous radical handling.

* Fixed bug with annnotation placement and added fallback postion.

* Removed unused var.

* update expected reaction svg

* Added option for always having circular highlights.

* Updated JSON to drawOptionns.

* Fixed bug in scale calculation.  Centres drawn molecule with option not to.

* Tidied up scale calculation.

* Changed atomHighlightCircles to atomHighlightsAreCircles.
Used shared_ptr for StringRect as VS barfed on unique_ptr.

* Fixed bug with reaction cruft not following now-centred molecules.

* temporary stash

* Stepped back centring of molecule by drawMolecule and fixes to drawReaction prompted by it.

* allow annotations to be disabled at the class level.
disable them for MolDraw2DCairo on win32 (where they just don't work)

* some test cleanup

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: greg landrum <greg.landrum@gmail.com>
2020-03-20 13:54:45 +01:00
David Cosgrove
774892a9ab 2ddrawenhancements2931 (#2979)
* First pass of fixing layout of OH/NH type drawing.

* Fixed scale for N/S NH type groups.

* Fixed bond end points with new display of heteroatoms.

* Fixed case where it drew aromatic dashed bonds in wrong ring for morphine.

* Minor edit.

* Fixed non-drawing of chiral bonds.

* Removed use of boost for_each.

* Modern atom traversal.

* Put in fixed scale for drawings.
Made drawMolecule() take note of prepareMolsBeforeDrawing.
Updated more iterators to modern idiom.

* Added fixed bond length for drawing.

* Fixed drawing of CH4, NH3 etc.

* Stash of working but ugly, prior to re-work.

* Better, simpler splitting of atom symbols.

* Took clang-tidy's advice about use of override.

* Tidied up drawing of text strings.

* Tweaked what is classed as vertical bond in drawing.

* fixedBondLength now down-scales if it would overflow the draw window.

* Some tidying.

* Tests for new parameters in JSON.
Fixed some existing tests where, for example, scale on picture is now different.

* Added option to rotate 2D draw coords before drawing.

* First pass at highlighting atoms in multiple colours.  Circles only at the moment.

* Line width scales if big enough.

* Tweaked SVG text drawing.

* Added highlighting with more than 1 colour on an atom.  C++ only.

* Fixed some issues with widths of highlights in a frustrating game of whackamole.
Updated some tests accordingly.

* Added Python wrapper for new drawing code.

* Removed debugging writes.

* Added C++ test for multi-coloured highlights.

* Added python test for multi-coloured highlights.

* Attempt to show radicals.

* Tidied up radicals in drawing, including a bullet instead of full stop in SVG.

* Fixed catch_tests.cpp for MolDraw2D.

* Fixed crash in Python wrappers on OSX.

* Fixed test5_2.svg bug (trailing </tspan>).
Made wavy line width scale as other lines do.

* Improved placing of charges.

* We're already in the future.

* Fixed a number of bugs that made drawMolecules not set the scales properly.

* Fixed Cairo wavy line width.

* Fixed non-closure of collision boxes.

* Added maximum font size for text, with tests.

* Addressed all Greg's first PR change requests.

* Fixed crash in extractAtomsymbols.

* stop using coordgen and adjust tests to reflect that
there's a bit of reformatting in here too

* Fixed layout of reactions.

* Fiddled with moldraw2DTest1 tests again.

* Fiddled with catch test.

* Fixed istope postion in W atom labels.

* Minor tweak to cairo,

* update expected results

Co-authored-by: David Cosgrove <david@cozchemix.co.uk>
Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
2020-03-10 17:33:59 +01:00
Greg Landrum
d41752d558 run clang-tidy with readability-braces-around-statements (#2899)
* run clang-tidy with readability-braces-around-statements
clang-format the results
clean up all the parts that clang-tidy-8 broke

* fix problem on windows
2020-01-25 14:19:32 +01:00
Greg Landrum
272aa26205 Add a drawOptions object to IPythonConsole (#2691)
* add a C++ test to confirm that copying the drawOptions object works

* add SetDrawOptions() to python API

* add a drawOptions object to IPythonConsole
This allows global drawing settings to be more easily changed
2019-10-10 10:18:33 -04:00
Greg Landrum
946458c08f add bond-selector info to SVGs (#2664)
* add bond-selector information to the SVG too

* changes in response to review
2019-10-02 15:30:37 -04:00
Greg Landrum
576506206a draw zero-order bonds (#2630) 2019-08-28 18:11:12 -04:00
Greg Landrum
a0314c244a Allows dative bonds to be drawn (#2573)
* backup: move arrow drawing out

* add a drawArrow() method
draw dative bonds using an arrow

* backup, need to rebase

* add test/demo
get two of the calls properly working

* update expected test results

* update documentation
2019-08-05 15:47:38 -04:00
Greg Landrum
881d4e2b42 Enable SimilarityMaps in C++ (#2562)
* basic conrec integration

* basic conrec integration

* add molecule contouring

* update

* add an alpha channel to the color

* allow filling the grid

* cleanup

* remove some debugging output

* first pass at getting similarity maps to actually work

* updates

* add another test
explicitly set linewidth to 1

* some SVG cleanup

* add option for extra padding

* update expected test results

* efficiency

* at least something of a test

* forgot an import

* fix SWIG wrappers

* cleanups in response to review

* allow calling the functions without providing levels

* allow contouring numpy grids
2019-07-28 08:59:06 -04:00
Greg Landrum
7869e086cd Improve interactivity of output SVG (#2253)
* Add clickable atoms when tagAtoms() is called

* add python tests

* add class tags for atoms and bonds

* add marker to allow easy insertion of extra text
2019-02-15 15:41:10 -05:00
Greg Landrum
395c312345 Fixes #2220 (#2221)
* untested

* test works now

* add python wrapper
2019-01-14 12:58:50 -05:00