00001
00002
00003
00004
00005
00006
00007 #ifndef BALL_VIEW_KERNEL_COMMON_H
00008 #define BALL_VIEW_KERNEL_COMMON_H
00009
00010 #ifndef BALL_DATATYPE_STRING_H
00011 #include <BALL/DATATYPE/string.h>
00012 #endif
00013
00014 #ifndef BALL_MATHS_VECTOR3
00015 #include <BALL/MATHS/vector3.h>
00016 #endif
00017
00018 #ifndef BALL_CONCEPT_COMPOSITE_H
00019 #include <BALL/CONCEPT/composite.h>
00020 #endif
00021
00022 #ifndef BALL_DATATYPE_REGULARDATA3D_H
00023 #include <BALL/DATATYPE/regularData3D.h>
00024 #endif
00025
00026 #include <QtCore/QEvent>
00027 #include <QtGui/QColorDialog>
00028 #include <QtGui/QLabel>
00029 #include <QtGui/QDropEvent>
00030
00031 namespace BALL
00032 {
00033 namespace VIEW
00034 {
00035
00036 class GeometricObject;
00037 class MainControl;
00038 class ColorRGBA;
00039 class Camera;
00040
00045
00050 #define VIEW_DEFAULT_PORT 20000
00051
00054 #define BALL_ASSIGN_NAME(OBJ)\
00055 OBJ->setObjectName(#OBJ);
00056
00058
00064
00071 enum EventsIDs
00072 {
00074 MESSAGE_EVENT = 60000,
00075
00077 LOG_EVENT,
00078
00080 TRANSFORMATION_EVENT_6D,
00081
00083 HEADTRACKING_EVENT,
00084
00086 MOTIONTRACKING_EVENT,
00087
00089 BUTTON_PRESS_EVENT,
00090
00092 BUTTON_RELEASE_EVENT
00093 };
00094
00096
00101
00103 enum DrawingMode
00104 {
00106 DRAWING_MODE_DOTS = 0,
00107
00109 DRAWING_MODE_WIREFRAME,
00110
00112 DRAWING_MODE_SOLID,
00113
00115 DRAWING_MODE_TOON
00116 };
00117
00119 #define BALL_VIEW_MAXIMAL_DRAWING_MODE 4
00120
00122 enum DrawingPrecision
00123 {
00125 DRAWING_PRECISION_INVALID = -1,
00126
00128 DRAWING_PRECISION_LOW = 0,
00129
00131 DRAWING_PRECISION_MEDIUM,
00132
00134 DRAWING_PRECISION_HIGH,
00135
00137 DRAWING_PRECISION_ULTRA
00138 };
00139
00141 #define BALL_VIEW_MAXIMAL_DRAWING_PRECISION 4
00142
00144 #define BALL_VIEW_MAXIMAL_DISPLAY_LIST_OBJECT_SIZE BALL_VIEW_MAXIMAL_DRAWING_PRECISION * BALL_VIEW_MAXIMAL_DRAWING_MODE
00145
00147 BALL_VIEW_EXPORT extern float SurfaceDrawingPrecisions[4];
00148
00159 enum ModelType
00160 {
00162 MODEL_LINES = 0,
00163
00165 MODEL_STICK,
00166
00168 MODEL_BALL_AND_STICK,
00169
00171 MODEL_VDW,
00172
00174 MODEL_SE_SURFACE,
00175
00177 MODEL_SA_SURFACE,
00178
00180 MODEL_BACKBONE,
00181
00183 MODEL_CARTOON,
00184
00186 MODEL_RIBBON,
00187
00189 MODEL_HBONDS,
00190
00192 MODEL_FORCES,
00193
00194
00195
00196
00197
00199 MODEL_LABEL = 100,
00200
00202 MODEL_CONTOUR_SURFACE,
00203
00205 MODEL_GRID_SLICE,
00206
00208 MODEL_GRID_VOLUME,
00209
00211 MODEL_FIELD_LINES,
00212
00214 MODEL_INFORMATIONS,
00215
00217 MODEL_COORDINATE_SYSTEM,
00218
00220 MODEL_UNKNOWN = 200
00221 };
00222
00223
00227 enum ColoringMethod
00228 {
00230 COLORING_ELEMENT = 0,
00231
00233 COLORING_RESIDUE_INDEX,
00234
00236 COLORING_RESIDUE_NAME,
00237
00239 COLORING_SECONDARY_STRUCTURE,
00240
00242 COLORING_ATOM_CHARGE,
00243
00245 COLORING_DISTANCE,
00246
00248 COLORING_TEMPERATURE_FACTOR,
00249
00251 COLORING_OCCUPANCY,
00252
00254 COLORING_FORCES,
00255
00257 COLORING_RESIDUE_TYPE,
00258
00260 COLORING_CHAIN,
00261
00263 COLORING_MOLECULE,
00264
00265
00266
00267
00268
00270 COLORING_CUSTOM,
00271
00273 COLORING_UNKNOWN = 200
00274 };
00275
00280 BALL_VIEW_EXPORT extern Composite composite_to_be_ignored_for_colorprocessors_;
00281
00283
00285 BALL_VIEW_EXPORT String vector3ToString(const Vector3& v);
00286
00288 BALL_VIEW_EXPORT bool stringToVector3(const String& data, Vector3& v);
00289
00291 BALL_VIEW_EXPORT String createFloatString(float value, Size precision);
00292
00300 BALL_VIEW_EXPORT MainControl* getMainControl();
00301
00303 BALL_VIEW_EXPORT String createTemporaryFilename();
00304
00306 BALL_VIEW_EXPORT Vector3 getNormal(const Vector3& v);
00307
00309 class BALL_VIEW_EXPORT LogEvent
00310 : public QEvent
00311 {
00312 public:
00313
00315 LogEvent();
00316
00318 void setMessage(const String& msg) {message_ = msg;}
00319
00321 String getMessage() {return message_;}
00322
00324 bool isImportant() { return important_;}
00325
00327 void setImportant(bool state) { important_ = state;}
00328
00330 bool showOnlyInLogView() const { return only_log_;}
00331
00333 void setShowOnlyInLogView(bool state) { only_log_ = state;}
00334
00335 protected:
00336 String message_;
00337 bool important_;
00338 bool only_log_;
00339 };
00340
00342 BALL_VIEW_EXPORT void logString(const String& data);
00343
00345 #define BALLVIEW_DEBUG logString(String("A problem occured in ") + __FILE__ + " " + \
00346 String(__LINE__) + ". Please notify us per mail: ball@bioinf.uni-sb.de\n");
00347
00348
00349 BALL_VIEW_EXPORT void processDropEvent(QDropEvent* e);
00350
00354 BALL_VIEW_EXPORT Camera focusCamera(Composite* composite);
00355
00359 BALL_VIEW_EXPORT Camera focusCamera(const std::list<Vector3>& points);
00360
00362 BALL_VIEW_EXPORT String ascii(const QString& str);
00363
00365 BALL_VIEW_EXPORT ColorRGBA getColor(const QLabel* label);
00366
00368 BALL_VIEW_EXPORT void setColor(const QLabel* label, const ColorRGBA& color);
00369
00371 BALL_VIEW_EXPORT QColor chooseColor(QLabel* label);
00372
00374 BALL_VIEW_EXPORT void setTextColor(QLabel* label, const ColorRGBA& color);
00375
00379 BALL_VIEW_EXPORT void cubicInterpolation(const Vector3& a, const Vector3& b,
00380 const Vector3& tangent_a, const Vector3& tangent_b,
00381 std::vector<Vector3>& interpolated_values);
00382
00385 extern float icosaeder_vertices[12][3];
00386 extern Position icosaeder_indices[20][3];
00387
00388 BALL_VIEW_EXPORT void subdivideTriangle(vector<Vector3>& results, Vector3& v1, Vector3& v2, Vector3& v3, Size precision);
00389
00390 BALL_VIEW_EXPORT vector<Vector3> createSphere(Size precision);
00391
00392 BALL_VIEW_EXPORT void calculateHistogramEqualization(const vector<float>& values, vector<float>& normalized_values, bool use_absolute_values = false);
00393
00395 BALL_VIEW_EXPORT void calculateRandomPoints(const RegularData3D& grid, Size nr_points, vector<Vector3>& resulting_points);
00396
00398
00399 }
00400 }
00401
00402 #endif // BALL_VIEW_KERNEL_COMMON_H