Loading...
Searching...
No Matches
VIEW/KERNEL/common.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: common.h,v 1.40.16.4 2007/04/20 14:16:50 amoll Exp $
//
#ifndef BALL_VIEW_KERNEL_COMMON_H
#define BALL_VIEW_KERNEL_COMMON_H
#ifndef BALL_DATATYPE_STRING_H
#include <BALL/DATATYPE/string.h>
#endif
#ifndef BALL_MATHS_VECTOR3
#include <BALL/MATHS/vector3.h>
#endif
#ifndef BALL_CONCEPT_COMPOSITE_H
#include <BALL/CONCEPT/composite.h>
#endif
#ifndef BALL_DATATYPE_REGULARDATA3D_H
#include <BALL/DATATYPE/regularData3D.h>
#endif
#include <QtCore/QEvent>
#include <QtWidgets/QColorDialog>
#include <QtWidgets/QLabel>
#include <QtGui/QDropEvent>
namespace BALL
{
namespace VIEW
{
class GeometricObject;
class MainControl;
class ColorRGBA;
class Camera;
#define VIEW_DEFAULT_PORT 20000
#define BALL_ASSIGN_NAME(OBJ)\
OBJ->setObjectName(#OBJ);
enum EventsIDs
{
MESSAGE_EVENT = 60000,
LOG_EVENT,
TRANSFORMATION_EVENT_6D,
HEADTRACKING_EVENT,
MOTIONTRACKING_EVENT,
BUTTON_PRESS_EVENT,
BUTTON_RELEASE_EVENT,
NOTIFICATION_EVENT,
RENDER_TO_BUFFER_FINISHED_EVENT
};
enum DrawingMode
{
DRAWING_MODE_DOTS = 0,
DRAWING_MODE_WIREFRAME,
DRAWING_MODE_SOLID,
DRAWING_MODE_TOON
};
#define BALL_VIEW_MAXIMAL_DRAWING_MODE 4
enum DrawingPrecision
{
DRAWING_PRECISION_INVALID = -1,
DRAWING_PRECISION_LOW = 0,
DRAWING_PRECISION_MEDIUM,
DRAWING_PRECISION_HIGH,
DRAWING_PRECISION_ULTRA
};
#define BALL_VIEW_MAXIMAL_DRAWING_PRECISION 4
#define BALL_VIEW_MAXIMAL_DISPLAY_LIST_OBJECT_SIZE BALL_VIEW_MAXIMAL_DRAWING_PRECISION * BALL_VIEW_MAXIMAL_DRAWING_MODE
BALL_VIEW_EXPORT extern float SurfaceDrawingPrecisions[4];
enum ModelType
{
MODEL_LINES = 0,
MODEL_STICK,
MODEL_BALL_AND_STICK,
MODEL_VDW,
MODEL_SE_SURFACE,
MODEL_SA_SURFACE,
MODEL_BACKBONE,
MODEL_CARTOON,
MODEL_RIBBON,
MODEL_HBONDS,
MODEL_FORCES,
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// add new model types before this comment!!!!
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
MODEL_LABEL = 100,
MODEL_CONTOUR_SURFACE,
MODEL_GRID_SLICE,
MODEL_GRID_VOLUME,
MODEL_FIELD_LINES,
MODEL_INFORMATIONS,
MODEL_COORDINATE_SYSTEM,
MODEL_PROXIMITY_LIGHT,
MODEL_PLANE,
MODEL_SPHERE,
MODEL_UNKNOWN = 200
};
enum ColoringMethod
{
COLORING_ELEMENT = 0,
COLORING_RESIDUE_INDEX,
COLORING_RESIDUE_NAME,
COLORING_SECONDARY_STRUCTURE,
COLORING_ATOM_CHARGE,
COLORING_DISTANCE,
COLORING_TEMPERATURE_FACTOR,
COLORING_OCCUPANCY,
COLORING_FORCES,
COLORING_RESIDUE_TYPE,
COLORING_CHAIN,
COLORING_MOLECULE,
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// add new coloring types before this comment!!!!
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
COLORING_CUSTOM,
COLORING_UNKNOWN = 200
};
BALL_VIEW_EXPORT extern Composite composite_to_be_ignored_for_colorprocessors_;
BALL_VIEW_EXPORT String vector3ToString(const Vector3& v);
BALL_VIEW_EXPORT bool stringToVector3(const String& data, Vector3& v);
BALL_VIEW_EXPORT String createFloatString(float value, Size precision);
BALL_VIEW_EXPORT MainControl* getMainControl();
BALL_VIEW_EXPORT String createTemporaryFilename();
BALL_VIEW_EXPORT Vector3 getNormal(const Vector3& v);
class BALL_VIEW_EXPORT LogEvent
: public QEvent
{
public:
LogEvent();
void setMessage(const String& msg) {message_ = msg;}
String getMessage() {return message_;}
bool isImportant() { return important_;}
void setImportant(bool state) { important_ = state;}
bool showOnlyInLogView() const { return only_log_;}
void setShowOnlyInLogView(bool state) { only_log_ = state;}
protected:
String message_;
bool important_;
bool only_log_;
};
BALL_VIEW_EXPORT void logString(const String& data);
#define BALLVIEW_DEBUG logString(String("A problem occurred in ") + __FILE__ + " " + \
String(__LINE__) + ". Please notify us on GitHub: " + \
"https://github.com/ball-project/ball/issues\n");
BALL_VIEW_EXPORT void processDropEvent(QDropEvent* e);
BALL_VIEW_EXPORT Camera focusCamera(Composite* composite);
BALL_VIEW_EXPORT Camera focusCamera(const std::list<Vector3>& points);
BALL_VIEW_EXPORT String ascii(const QString& str);
BALL_VIEW_EXPORT ColorRGBA getColor(const QLabel* label);
BALL_VIEW_EXPORT void setColor(const QLabel* label, const ColorRGBA& color);
BALL_VIEW_EXPORT QColor chooseColor(QLabel* label);
BALL_VIEW_EXPORT void setTextColor(QLabel* label, const ColorRGBA& color);
BALL_VIEW_EXPORT void cubicInterpolation(const Vector3& a, const Vector3& b,
const Vector3& tangent_a, const Vector3& tangent_b,
std::vector<Vector3>& interpolated_values);
extern float icosaeder_vertices[12][3];
extern Position icosaeder_indices[20][3];
BALL_VIEW_EXPORT void subdivideTriangle(vector<Vector3>& results, Vector3& v1, Vector3& v2, Vector3& v3, Size precision);
BALL_VIEW_EXPORT vector<Vector3> createSphere(Size precision);
BALL_VIEW_EXPORT void calculateHistogramEqualization(const vector<float>& values, vector<float>& normalized_values, bool use_absolute_values = false);
BALL_VIEW_EXPORT void calculateRandomPoints(const RegularData3D& grid, Size nr_points, vector<Vector3>& resulting_points);
} // namespace VIEW
} // namespace BALL
#endif // BALL_VIEW_KERNEL_COMMON_H
BALL_VIEW_EXPORT
#define BALL_VIEW_EXPORT
Definition COMMON/global.h:52
BALL::Composite
Definition composite.h:74
BALL::String
Definition string.h:57
BALL::VIEW::Camera
Definition camera.h:24
BALL::VIEW::ColorRGBA
Definition colorRGBA.h:32
BALL::VIEW::GeometricObject
Definition geometricObject.h:37
BALL::VIEW::LogEvent::message_
String message_
Definition VIEW/KERNEL/common.h:349
BALL::VIEW::LogEvent::LogEvent
LogEvent()
BALL::VIEW::LogEvent::important_
bool important_
Definition VIEW/KERNEL/common.h:350
BALL::VIEW::LogEvent::getMessage
String getMessage()
Definition VIEW/KERNEL/common.h:334
BALL::VIEW::LogEvent::setMessage
void setMessage(const String &msg)
Definition VIEW/KERNEL/common.h:331
BALL::VIEW::LogEvent::only_log_
bool only_log_
Definition VIEW/KERNEL/common.h:351
BALL::VIEW::LogEvent::setImportant
void setImportant(bool state)
Definition VIEW/KERNEL/common.h:340
BALL::VIEW::LogEvent::isImportant
bool isImportant()
will allways be shown in Statusbar or just when no other message shown?
Definition VIEW/KERNEL/common.h:337
BALL::VIEW::LogEvent::showOnlyInLogView
bool showOnlyInLogView() const
only show in logview, no change to status bar
Definition VIEW/KERNEL/common.h:343
BALL::VIEW::LogEvent::setShowOnlyInLogView
void setShowOnlyInLogView(bool state)
Definition VIEW/KERNEL/common.h:346
BALL::VIEW::MainControl
Definition mainControl.h:118
QEvent
composite.h
BALL::VIEW
Definition constraints.h:35
BALL::VIEW::cubicInterpolation
BALL_VIEW_EXPORT void cubicInterpolation(const Vector3 &a, const Vector3 &b, const Vector3 &tangent_a, const Vector3 &tangent_b, std::vector< Vector3 > &interpolated_values)
BALL::VIEW::composite_to_be_ignored_for_colorprocessors_
BALL_VIEW_EXPORT Composite composite_to_be_ignored_for_colorprocessors_
BALL::VIEW::getMainControl
BALL_VIEW_EXPORT MainControl * getMainControl()
BALL::VIEW::getNormal
BALL_VIEW_EXPORT Vector3 getNormal(const Vector3 &v)
BALL::VIEW::icosaeder_indices
Position icosaeder_indices[20][3]
BALL::VIEW::subdivideTriangle
BALL_VIEW_EXPORT void subdivideTriangle(vector< Vector3 > &results, Vector3 &v1, Vector3 &v2, Vector3 &v3, Size precision)
BALL::VIEW::setColor
BALL_VIEW_EXPORT void setColor(const QLabel *label, const ColorRGBA &color)
BALL::VIEW::chooseColor
BALL_VIEW_EXPORT QColor chooseColor(QLabel *label)
BALL::VIEW::DrawingPrecision
DrawingPrecision
Enumeration for Drawing Precisions.
Definition VIEW/KERNEL/common.h:129
BALL::VIEW::DRAWING_PRECISION_ULTRA
@ DRAWING_PRECISION_ULTRA
Definition VIEW/KERNEL/common.h:143
BALL::VIEW::DRAWING_PRECISION_LOW
@ DRAWING_PRECISION_LOW
Definition VIEW/KERNEL/common.h:134
BALL::VIEW::DRAWING_PRECISION_MEDIUM
@ DRAWING_PRECISION_MEDIUM
Definition VIEW/KERNEL/common.h:137
BALL::VIEW::DRAWING_PRECISION_INVALID
@ DRAWING_PRECISION_INVALID
Definition VIEW/KERNEL/common.h:131
BALL::VIEW::DRAWING_PRECISION_HIGH
@ DRAWING_PRECISION_HIGH
Definition VIEW/KERNEL/common.h:140
BALL::VIEW::icosaeder_vertices
float icosaeder_vertices[12][3]
Code to refine a icosaeder:
BALL::VIEW::focusCamera
BALL_VIEW_EXPORT Camera focusCamera(Composite *composite)
BALL::VIEW::createTemporaryFilename
BALL_VIEW_EXPORT String createTemporaryFilename()
Create a temporary filename in the users home dir.
BALL::VIEW::getColor
BALL_VIEW_EXPORT ColorRGBA getColor(const QLabel *label)
BALL::VIEW::vector3ToString
BALL_VIEW_EXPORT String vector3ToString(const Vector3 &v)
BALL::VIEW::processDropEvent
BALL_VIEW_EXPORT void processDropEvent(QDropEvent *e)
BALL::VIEW::createSphere
BALL_VIEW_EXPORT vector< Vector3 > createSphere(Size precision)
BALL::VIEW::ascii
BALL_VIEW_EXPORT String ascii(const QString &str)
BALL::VIEW::calculateHistogramEqualization
BALL_VIEW_EXPORT void calculateHistogramEqualization(const vector< float > &values, vector< float > &normalized_values, bool use_absolute_values=false)
BALL::VIEW::SurfaceDrawingPrecisions
BALL_VIEW_EXPORT float SurfaceDrawingPrecisions[4]
Mapping from the enum to the float values of Surfaces.
BALL::VIEW::ColoringMethod
ColoringMethod
Definition VIEW/KERNEL/common.h:243
BALL::VIEW::COLORING_DISTANCE
@ COLORING_DISTANCE
Definition VIEW/KERNEL/common.h:260
BALL::VIEW::COLORING_SECONDARY_STRUCTURE
@ COLORING_SECONDARY_STRUCTURE
Definition VIEW/KERNEL/common.h:254
BALL::VIEW::COLORING_RESIDUE_TYPE
@ COLORING_RESIDUE_TYPE
Definition VIEW/KERNEL/common.h:272
BALL::VIEW::COLORING_UNKNOWN
@ COLORING_UNKNOWN
Definition VIEW/KERNEL/common.h:288
BALL::VIEW::COLORING_ATOM_CHARGE
@ COLORING_ATOM_CHARGE
Definition VIEW/KERNEL/common.h:257
BALL::VIEW::COLORING_OCCUPANCY
@ COLORING_OCCUPANCY
Definition VIEW/KERNEL/common.h:266
BALL::VIEW::COLORING_CUSTOM
@ COLORING_CUSTOM
Definition VIEW/KERNEL/common.h:285
BALL::VIEW::COLORING_FORCES
@ COLORING_FORCES
Definition VIEW/KERNEL/common.h:269
BALL::VIEW::COLORING_CHAIN
@ COLORING_CHAIN
Definition VIEW/KERNEL/common.h:275
BALL::VIEW::COLORING_ELEMENT
@ COLORING_ELEMENT
Definition VIEW/KERNEL/common.h:245
BALL::VIEW::COLORING_RESIDUE_INDEX
@ COLORING_RESIDUE_INDEX
Definition VIEW/KERNEL/common.h:248
BALL::VIEW::COLORING_RESIDUE_NAME
@ COLORING_RESIDUE_NAME
Definition VIEW/KERNEL/common.h:251
BALL::VIEW::COLORING_MOLECULE
@ COLORING_MOLECULE
Definition VIEW/KERNEL/common.h:278
BALL::VIEW::COLORING_TEMPERATURE_FACTOR
@ COLORING_TEMPERATURE_FACTOR
Definition VIEW/KERNEL/common.h:263
BALL::VIEW::EventsIDs
EventsIDs
Definition VIEW/KERNEL/common.h:72
BALL::VIEW::LOG_EVENT
@ LOG_EVENT
Event to print output from a Thread.
Definition VIEW/KERNEL/common.h:77
BALL::VIEW::MESSAGE_EVENT
@ MESSAGE_EVENT
An event with a contained VIEW message.
Definition VIEW/KERNEL/common.h:74
BALL::VIEW::BUTTON_RELEASE_EVENT
@ BUTTON_RELEASE_EVENT
Event for button press events of custom input devices.
Definition VIEW/KERNEL/common.h:92
BALL::VIEW::BUTTON_PRESS_EVENT
@ BUTTON_PRESS_EVENT
Event for button press events of custom input devices.
Definition VIEW/KERNEL/common.h:89
BALL::VIEW::TRANSFORMATION_EVENT_6D
@ TRANSFORMATION_EVENT_6D
Event that encodes a 6 dimensional transformation.
Definition VIEW/KERNEL/common.h:80
BALL::VIEW::MOTIONTRACKING_EVENT
@ MOTIONTRACKING_EVENT
Event that encodes a motion tracker position change.
Definition VIEW/KERNEL/common.h:86
BALL::VIEW::NOTIFICATION_EVENT
@ NOTIFICATION_EVENT
Event for passing BALL Messages accross threads.
Definition VIEW/KERNEL/common.h:95
BALL::VIEW::HEADTRACKING_EVENT
@ HEADTRACKING_EVENT
Event that encodes a head tracker position change.
Definition VIEW/KERNEL/common.h:83
BALL::VIEW::RENDER_TO_BUFFER_FINISHED_EVENT
@ RENDER_TO_BUFFER_FINISHED_EVENT
Event posted by renderers after a new buffer is available.
Definition VIEW/KERNEL/common.h:98
BALL::VIEW::DrawingMode
DrawingMode
Enumeration for Drawing Modes.
Definition VIEW/KERNEL/common.h:110
BALL::VIEW::DRAWING_MODE_SOLID
@ DRAWING_MODE_SOLID
Definition VIEW/KERNEL/common.h:118
BALL::VIEW::DRAWING_MODE_WIREFRAME
@ DRAWING_MODE_WIREFRAME
Definition VIEW/KERNEL/common.h:115
BALL::VIEW::DRAWING_MODE_DOTS
@ DRAWING_MODE_DOTS
Definition VIEW/KERNEL/common.h:112
BALL::VIEW::DRAWING_MODE_TOON
@ DRAWING_MODE_TOON
Definition VIEW/KERNEL/common.h:121
BALL::VIEW::ModelType
ModelType
Definition VIEW/KERNEL/common.h:166
BALL::VIEW::MODEL_FIELD_LINES
@ MODEL_FIELD_LINES
Definition VIEW/KERNEL/common.h:217
BALL::VIEW::MODEL_SPHERE
@ MODEL_SPHERE
Definition VIEW/KERNEL/common.h:232
BALL::VIEW::MODEL_STICK
@ MODEL_STICK
defines the property for the model: Stick
Definition VIEW/KERNEL/common.h:171
BALL::VIEW::MODEL_BALL_AND_STICK
@ MODEL_BALL_AND_STICK
defines the property for the model: Ball and Stick
Definition VIEW/KERNEL/common.h:174
BALL::VIEW::MODEL_PLANE
@ MODEL_PLANE
Definition VIEW/KERNEL/common.h:229
BALL::VIEW::MODEL_RIBBON
@ MODEL_RIBBON
defines the property for the model: Ribbon
Definition VIEW/KERNEL/common.h:192
BALL::VIEW::MODEL_SA_SURFACE
@ MODEL_SA_SURFACE
defines the property for the model: solvent-accessible surface
Definition VIEW/KERNEL/common.h:183
BALL::VIEW::MODEL_CONTOUR_SURFACE
@ MODEL_CONTOUR_SURFACE
defines the property for the model: contour surface
Definition VIEW/KERNEL/common.h:208
BALL::VIEW::MODEL_VDW
@ MODEL_VDW
defines the property for the model: Van der Waals
Definition VIEW/KERNEL/common.h:177
BALL::VIEW::MODEL_UNKNOWN
@ MODEL_UNKNOWN
unkown property
Definition VIEW/KERNEL/common.h:235
BALL::VIEW::MODEL_PROXIMITY_LIGHT
@ MODEL_PROXIMITY_LIGHT
defines the property for the model: proximity light
Definition VIEW/KERNEL/common.h:226
BALL::VIEW::MODEL_CARTOON
@ MODEL_CARTOON
defines the property for the model: Cartoon
Definition VIEW/KERNEL/common.h:189
BALL::VIEW::MODEL_LINES
@ MODEL_LINES
defines the property for the model: Lines
Definition VIEW/KERNEL/common.h:168
BALL::VIEW::MODEL_GRID_VOLUME
@ MODEL_GRID_VOLUME
Definition VIEW/KERNEL/common.h:214
BALL::VIEW::MODEL_SE_SURFACE
@ MODEL_SE_SURFACE
defines the property for the model: solvent-excluded surface
Definition VIEW/KERNEL/common.h:180
BALL::VIEW::MODEL_BACKBONE
@ MODEL_BACKBONE
defines the property for the model: Backbone
Definition VIEW/KERNEL/common.h:186
BALL::VIEW::MODEL_GRID_SLICE
@ MODEL_GRID_SLICE
Definition VIEW/KERNEL/common.h:211
BALL::VIEW::MODEL_HBONDS
@ MODEL_HBONDS
defines the property for the model: H-Bonds
Definition VIEW/KERNEL/common.h:195
BALL::VIEW::MODEL_INFORMATIONS
@ MODEL_INFORMATIONS
Definition VIEW/KERNEL/common.h:220
BALL::VIEW::MODEL_FORCES
@ MODEL_FORCES
Definition VIEW/KERNEL/common.h:198
BALL::VIEW::MODEL_LABEL
@ MODEL_LABEL
defines the property for the model: Label
Definition VIEW/KERNEL/common.h:205
BALL::VIEW::MODEL_COORDINATE_SYSTEM
@ MODEL_COORDINATE_SYSTEM
Definition VIEW/KERNEL/common.h:223
BALL::VIEW::stringToVector3
BALL_VIEW_EXPORT bool stringToVector3(const String &data, Vector3 &v)
BALL::VIEW::calculateRandomPoints
BALL_VIEW_EXPORT void calculateRandomPoints(const RegularData3D &grid, Size nr_points, vector< Vector3 > &resulting_points)
calcualte a random set of points, dependening of the field strength of a grid
BALL::VIEW::logString
BALL_VIEW_EXPORT void logString(const String &data)
thread safe output to logview
BALL::VIEW::setTextColor
BALL_VIEW_EXPORT void setTextColor(QLabel *label, const ColorRGBA &color)
BALL::VIEW::createFloatString
BALL_VIEW_EXPORT String createFloatString(float value, Size precision)
create a string from a float and cut after a given number of digits after the dot
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::RegularData3D
TRegularData3D< float > RegularData3D
Definition regularData3D.h:515
BALL::Position
BALL_SIZE_TYPE Position
Definition COMMON/global.h:140
BALL::Vector3
TVector3< float > Vector3
Definition vector3.h:1084
regularData3D.h
string.h
vector3.h