29 #ifndef CDPL_VIS_STRUCTUREVIEW2D_HPP
30 #define CDPL_VIS_STRUCTUREVIEW2D_HPP
66 class PropertyContainer;
81 class StructureView2DParameters;
742 void renderGraphicsPrimitives(
Renderer2D&)
const;
746 void initTextLabelBounds();
748 void createAtomPrimitives();
749 void createBondPrimitives();
751 void createHighlightingPrimitives();
753 void createAtomHighlightingPrimitives(
double,
double,
double);
754 void createAtomHighlightingPrimitives(
const Chem::Atom&,
double,
double,
double);
756 void createBondHighlightingPrimitives(
double,
double,
double);
757 void createBondHighlightingPrimitives(
const Chem::Bond&,
double,
double,
double);
768 void createAtomConfigLabelPrimitive(
const Chem::Atom&,
char);
769 void createAtomCustomLabelPrimitive(
const Chem::Atom&,
const std::string&,
bool);
772 double createBondRxnInfoLabelPrimitive(
const Chem::Bond&,
const Line2D&,
int);
773 void createBondQueryInfoLabelPrimitive(
const Chem::Bond&,
const Line2D&,
int,
double);
782 void createDownSingleBondPrimitives(
const Chem::Bond&,
const Line2D&,
bool);
783 void createEitherSingleBondPrimitives(
const Chem::Bond&,
const Line2D&,
bool);
787 void createAsymDoubleBondPrimitives(
const Chem::Bond&,
bool,
const Line2D&,
int);
794 int getBondAsymmetryShiftDirection(
const Chem::Bond&)
const;
796 bool trimLine(
Line2D&,
double,
bool)
const;
799 bool clipLineAgainstAtomBounds(
Line2D&, std::size_t,
bool)
const;
805 std::size_t getHydrogenCount(
const Chem::Atom&)
const;
810 double calcInputBondLength(
const Chem::Bond&)
const;
812 void prepareStructureData();
813 void initInputAtomPosArray();
815 void calcViewTransforms();
817 double calcAvgInputBondLength()
const;
819 void calcStdBondLengthScalingFactor();
820 void calcViewportAdjustmentScalingFactor();
822 void calcInputStructureBounds();
823 void calcOutputStructureBounds();
824 void calcOutputAtomCoords();
826 void initOutputBondLineArray();
829 std::size_t getBondOrder(
const Chem::Bond& bond)
const;
831 void setHasAtomCoordsFlag();
834 double getRxnCenterLineLength(
const Chem::Bond&)
const;
835 double getRxnCenterLineSpacing(
const Chem::Bond&)
const;
839 double getWedgeWidth(
const Chem::Bond&)
const;
840 double getHashSpacing(
const Chem::Bond&)
const;
842 double getConfigLabelSize(
const Chem::Bond&)
const;
866 double getConfigLabelSize(
const Chem::Atom&)
const;
868 double getElectronDotSize(
const Chem::Atom&)
const;
889 void setupSecondaryLabelFont(
const Chem::Atom&);
907 void freeGraphicsPrimitives();
918 typedef std::vector<const GraphicsPrimitive2D*> GraphicsPrimitiveList;
919 typedef std::vector<Rectangle2D> RectangleList;
920 typedef std::vector<RectangleList> RectangleListArray;
921 typedef std::vector<Line2D> BondLineArray;
922 typedef std::vector<std::size_t> UIntArray;
923 typedef std::pair<std::size_t, double> UIntDoublePair;
924 typedef std::vector<UIntDoublePair> UIntDoublePairList;
925 typedef std::vector<UIntDoublePairList> UIntDoublePairListArray;
926 typedef std::vector<double> DoubleArray;
935 typedef std::unique_ptr<StructureView2DParameters> StructureView2DParametersPtr;
936 typedef std::unique_ptr<Chem::Fragment> FragmentPtr;
938 StructureView2DParametersPtr parameters;
941 FragmentPtr hDepleteStructure;
949 BondLineArray outputBondLines;
950 RectangleListArray atomLabelBounds;
951 RectangleListArray bondLabelBounds;
952 UIntArray atomCoreLabelCounts;
954 UIntDoublePairListArray highlightedBondLists;
955 DoubleArray atomHighlightAreaRadii;
956 GraphicsPrimitiveList drawListLayer0;
957 GraphicsPrimitiveList drawListLayer1;
958 GraphicsPrimitiveList drawListLayer2;
959 GraphicsPrimitiveList drawListLayer3;
960 double avgInputBondLength;
961 double stdBondLengthScalingFactor;
962 double viewportAdjustmentScalingFactor;
963 double viewScalingFactor;
965 bool structureChanged;
966 bool fontMetricsChanged;
968 Font activeLabelFont;
969 Font activeSecondaryLabelFont;
970 double activeLabelMargin;
971 bool reactionContext;
Definition of the type CDPL::Util::BitSet.
Definition of the class CDPL::Vis::Brush.
Definition of the class CDPL::Vis::ClipPathPrimitive2D.
Definition of the class CDPL::Vis::Color.
Definition of the class CDPL::Vis::Font.
Definition of the class CDPL::Vis::Line2D.
Definition of the class CDPL::Vis::LinePrimitive2D.
Definition of the class CDPL::Vis::LineSegmentListPrimitive2D.
Definition of the class CDPL::Util::ObjectStack.
Definition of the class CDPL::Vis::PathPrimitive2D.
Definition of the class CDPL::Vis::Pen.
Definition of the class CDPL::Vis::PointListPrimitive2D.
Definition of the class CDPL::Vis::PolygonPrimitive2D.
Definition of the class CDPL::Vis::PolylinePrimitive2D.
Definition of the class CDPL::Vis::Rectangle2D.
Definition of the class CDPL::Vis::SizeSpecification.
Definition of the class CDPL::Vis::TextLabelPrimitive2D.
Definition of the class CDPL::Math::VectorArray.
Definition of the class CDPL::Vis::View2D.
Definition of the preprocessor macro CDPL_VIS_API.
#define CDPL_VIS_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
A class providing methods for the storage and lookup of object properties.
Definition: PropertyContainer.hpp:75
Atom.
Definition: Atom.hpp:52
Bond.
Definition: Bond.hpp:50
MolecularGraph.
Definition: MolecularGraph.hpp:52
Specifies the fill pattern and fill color of shapes.
Definition: Brush.hpp:50
A graphics primitive representing a clipping region in 2D space.
Definition: ClipPathPrimitive2D.hpp:51
Specifies a color in terms of its red, green and blue components and an alpha-channel for transparenc...
Definition: Color.hpp:52
An interface class with methods that provide information about the metrics of a font.
Definition: FontMetrics.hpp:71
Specifies a font for drawing text.
Definition: Font.hpp:54
Specifies a line segment in 2D space.
Definition: Line2D.hpp:48
A graphics primitive representing a single line.
Definition: LinePrimitive2D.hpp:51
A graphics primitive representing a list of disjoint line segments.
Definition: LineSegmentListPrimitive2D.hpp:51
A graphics primitive representing an arbitrary path in 2D space.
Definition: PathPrimitive2D.hpp:53
Specifies how to draw lines and outlines of shapes.
Definition: Pen.hpp:53
A graphics primitive representing a list of points.
Definition: PointListPrimitive2D.hpp:51
A graphics primitive representing a polygon.
Definition: PolygonPrimitive2D.hpp:52
A graphics primitive representing a set of connected line segments.
Definition: PolylinePrimitive2D.hpp:51
Implements the 2D visualization of chemical reactions.
Definition: ReactionView2D.hpp:589
Specifies an axis aligned rectangular area in 2D space.
Definition: Rectangle2D.hpp:51
An interface that provides methods for low level 2D drawing operations.
Definition: Renderer2D.hpp:86
Specifies the value and type of a size attribute and defines how the value may change during processi...
Definition: SizeSpecification.hpp:45
Implements the 2D visualization of chemical structures.
Definition: StructureView2D.hpp:678
void getModelBounds(Rectangle2D &bounds)
Calculates the bounds of the rendered structure in output space.
void setStructure(const Chem::MolecularGraph *molgraph)
Specifies the chemical structure to visualize.
~StructureView2D()
Destructor.
StructureView2D & operator=(const StructureView2D &)=delete
StructureView2D(const Chem::MolecularGraph *molgraph=0)
Constructs and initializes a StructureView2D instance for the visualization of the chemical structure...
void setFontMetrics(FontMetrics *font_metrics)
Specifies a font metrics object that will be used to measure the dimension of text labels.
StructureView2D(const StructureView2D &)=delete
const Chem::MolecularGraph * getStructure() const
Returns a pointer to the visualized chemical structure.
std::shared_ptr< StructureView2D > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated StructureView2D instances.
Definition: StructureView2D.hpp:684
void render(Renderer2D &renderer)
Renders the visual representation of the model using the specified Vis::Renderer2D instance.
FontMetrics * getFontMetrics() const
Returns a pointer to the used font metrics object.
A graphics primitive representing a text label.
Definition: TextLabelPrimitive2D.hpp:51
The abstract base of classes implementing the 2D visualization of data objects.
Definition: View2D.hpp:59
ValueType calcBondAngle(const CoordsVec &term_atom1_pos, const CoordsVec &ctr_atom_pos, const CoordsVec &term_atom2_pos)
Calculates the bond angle between the two bonds i-j and j-k.
CVector< double, 2 > Vector2D
A bounded 2 element vector holding floating point values of type double.
Definition: Vector.hpp:1632
VectorArray< Vector2D > Vector2DArray
An array of Math::Vector2D objects.
Definition: VectorArray.hpp:79
Array< unsigned int > UIArray
An array of unsigned integers.
Definition: Array.hpp:562
boost::dynamic_bitset BitSet
A dynamic bitset class.
Definition: BitSet.hpp:46
CDPL_VIS_API const Color & getCustomLabelColor(const Chem::Atom &atom)
CDPL_VIS_API const SizeSpecification & getCustomLabelSize(const Chem::Atom &atom)
CDPL_VIS_API const Font & getLabelFont(const Chem::Atom &atom)
CDPL_VIS_API const Color & getColor(const Chem::Atom &atom)
CDPL_VIS_API const Font & getSecondaryLabelFont(const Chem::Atom &atom)
CDPL_VIS_API const Brush & getHighlightAreaBrush(const Chem::Atom &atom)
CDPL_VIS_API const SizeSpecification & getLabelSize(const Chem::Atom &atom)
CDPL_VIS_API const SizeSpecification & getDoubleBondTrimLength(const Chem::Bond &bond)
CDPL_VIS_API const SizeSpecification & getBondHighlightAreaWidth(const Chem::MolecularGraph &molgraph)
CDPL_VIS_API const SizeSpecification & getLineSpacing(const Chem::Bond &bond)
CDPL_VIS_API const SizeSpecification & getHighlightAreaOutlineWidth(const Chem::MolecularGraph &molgraph)
CDPL_VIS_API const SizeSpecification & getTripleBondTrimLength(const Chem::Bond &bond)
CDPL_VIS_API const SizeSpecification & getAtomHighlightAreaSize(const Chem::MolecularGraph &molgraph)
CDPL_VIS_API const SizeSpecification & getLineWidth(const Chem::Bond &bond)
CDPL_VIS_API const SizeSpecification & getSecondaryLabelSize(const Chem::Atom &atom)
CDPL_VIS_API const Font & getCustomLabelFont(const Chem::Atom &atom)
The namespace of the Chemical Data Processing Library.