29 #ifndef CDPL_VIS_STRUCTUREGRIDVIEW2D_HPP
30 #define CDPL_VIS_STRUCTUREGRIDVIEW2D_HPP
38 #include <boost/unordered_map.hpp>
132 static constexpr
double DEF_CELL_WIDTH = 250.0;
137 static constexpr
double DEF_CELL_HEIGHT = 250.0;
203 void setText(
const std::string& text,
unsigned int pos = DEF_TEXT_POSITION,
211 const std::string&
getText(
unsigned int pos = DEF_TEXT_POSITION)
const;
223 bool hasText(
unsigned int pos = DEF_TEXT_POSITION)
const;
251 void setSize(
double width,
double height);
255 void parentChanged();
260 static std::size_t posToArrayIndex(
unsigned int pos);
301 bool write(
const std::string& file_name);
314 bool write(
const std::string& file_name,
const std::string& fmt);
340 bool write(std::ostream& os,
const std::string& fmt);
425 void resize(std::size_t num_rows, std::size_t num_cols);
466 CellPointer allocCell();
468 static Cell* newCell();
469 static void deleteCell(
Cell* cell);
470 static void cleanupCell(
Cell& cell);
472 typedef std::pair<std::size_t, std::size_t> CellID;
473 typedef boost::unordered_map<CellID, Cell::SharedPointer> CellMap;
481 std::size_t numColumns;
Definition of constants in namespace CDPL::Vis::Alignment.
Definition of the class CDPL::Chem::BasicMolecule.
Provides CDPKit build configuration information.
Definition of the class CDPL::Util::ObjectPool.
Definition of the class CDPL::Vis::StructureView2D.
Definition of the class CDPL::Vis::TextBlockPrimitive2D.
Definition of vector data types.
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 safe, type checked container for arbitrary data of variable type.
Definition: Any.hpp:59
A class providing methods for the storage and lookup of control-parameter values.
Definition: ControlParameterContainer.hpp:93
An unique lookup key for control-parameter and property values.
Definition: LookupKey.hpp:54
BasicMolecule.
Definition: BasicMolecule.hpp:54
MolecularGraph.
Definition: MolecularGraph.hpp:52
std::shared_ptr< ObjectType > SharedObjectPointer
Definition: ObjectPool.hpp:65
An interface class with methods that provide information about the metrics of a font.
Definition: FontMetrics.hpp:71
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
Data structure storing the contents of a grid cell.
Definition: StructureGridView2D.hpp:148
void clearStructure()
Hides the dcurrently displayed molecular structure (if any) and clears the stored data.
bool hasText(unsigned int pos=DEF_TEXT_POSITION) const
Tells whether any text is displayed at the specified position.
const Chem::MolecularGraph & getStructure() const
Returns the stored data of the currently displayed molecular structure (if any).
std::shared_ptr< Cell > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated Cell instances.
Definition: StructureGridView2D.hpp:154
bool hasAnyText() const
Tells whether this cell displays any text.
Cell & operator=(const Cell &cell)
Performs a copy assignment of the specified Cell instance.
Cell(const Cell &)=delete
bool hasStructure() const
Tells whether this cell displays a molecular structure.
void setText(const std::string &text, unsigned int pos=DEF_TEXT_POSITION, unsigned int line_almnt=Alignment::NONE)
Specifies the text that shall be displayed at the given position.
const std::string & getText(unsigned int pos=DEF_TEXT_POSITION) const
Returns the text displayed at the specified position.
void clearAllText()
Clears all text blocks.
void setStructure(const Chem::MolecularGraph &molgraph)
Specifies the molecular structure that shall be displayed in this cell.
void clearText(unsigned int pos=DEF_TEXT_POSITION)
Clears the text displayed at the specified position.
Implements the 2D visualization of multiple chemical structures arrange in a grid.
Definition: StructureGridView2D.hpp:126
StructureGridView2D()
Constructs and initializes a StructureGridView2D instance for the visualization of multiple chemical ...
std::size_t getNumColumns() const
Returns the current number of grid columns.
void setFontMetrics(FontMetrics *font_metrics)
Specifies a font metrics object that will be used to measure the dimension of text labels.
Cell & operator()(std::size_t row, std::size_t col)
Returns the Cell instance storing the contents of the specified grid cell.
double getCellHeight() const
Returns the active grid cell height.
void clearStructures()
Clears all specified structures.
FontMetrics * getFontMetrics() const
Returns a pointer to the used font metrics object.
void clearAllText()
Clears all specified text blocks.
void setCellSize(double width, double height)
Allows to specify the desired width and height of the cells in grid output renderings.
bool write(std::ostream &os, const Base::DataFormat &fmt)
Renders the grid with the specified cell contents and writes the generated image data to the output s...
bool write(const std::string &file_name)
Renders the grid with the specified cell contents and stores the generated image in the file file_nam...
StructureGridView2D & operator=(const StructureGridView2D &grid_view)
Performs a copy assignment of the specified StructureGridView2D instance.
const Cell & operator()(std::size_t row, std::size_t col) const
Returns the Cell instance storing the contents of the specified grid cell.
~StructureGridView2D()
Destructor.
std::size_t getNumRows() const
Returns the current number of grid rows.
void getModelBounds(Rectangle2D &bounds)
Calculates the bounding rectangle of the visualized model.
void resize(std::size_t num_rows, std::size_t num_cols)
Chnages the current number of grid rows and columns.
bool write(const std::string &file_name, const std::string &fmt)
Renders the grid with the specified cell contents and stores the generated image in the file file_nam...
bool write(std::ostream &os, const std::string &fmt)
Renders the grid with the specified cell contents and writes the generated image data to the output s...
StructureGridView2D(const StructureGridView2D &grid_view)
Constructs a copy of the StructureGridView2D instance grid_view.
double getCellWidth() const
Returns the active grid cell width.
void render(Renderer2D &renderer)
Renders the visual representation of the model using the specified Vis::Renderer2D instance.
bool write(const std::string &file_name, const Base::DataFormat &fmt)
Renders the grid with the specified cell contents and stores the generated image in the file file_nam...
std::shared_ptr< StructureGridView2D > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated StructureGridView2D instances.
Definition: StructureGridView2D.hpp:142
Implements the 2D visualization of chemical structures.
Definition: StructureView2D.hpp:678
A graphics primitive representing a block of styled text.
Definition: TextBlockPrimitive2D.hpp:69
The abstract base of classes implementing the 2D visualization of data objects.
Definition: View2D.hpp:59
MatrixRow< M > row(MatrixExpression< M > &e, typename MatrixRow< M >::SizeType i)
Definition: MatrixProxy.hpp:716
CVector< double, 2 > Vector2D
A bounded 2 element vector holding floating point values of type double.
Definition: Vector.hpp:1632
constexpr unsigned int H_CENTER
Specifies that an object has to be centered horizontally.
Definition: Alignment.hpp:67
constexpr unsigned int BOTTOM
Specifies an alignment to the bottom.
Definition: Alignment.hpp:82
constexpr unsigned int NONE
Specifies that an object has no special alignment.
Definition: Alignment.hpp:52
The namespace of the Chemical Data Processing Library.