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
00095 NOTIFICATION_EVENT
00096 };
00097
00099
00104
00106 enum DrawingMode
00107 {
00109 DRAWING_MODE_DOTS = 0,
00110
00112 DRAWING_MODE_WIREFRAME,
00113
00115 DRAWING_MODE_SOLID,
00116
00118 DRAWING_MODE_TOON
00119 };
00120
00122 #define BALL_VIEW_MAXIMAL_DRAWING_MODE 4
00123
00125 enum DrawingPrecision
00126 {
00128 DRAWING_PRECISION_INVALID = -1,
00129
00131 DRAWING_PRECISION_LOW = 0,
00132
00134 DRAWING_PRECISION_MEDIUM,
00135
00137 DRAWING_PRECISION_HIGH,
00138
00140 DRAWING_PRECISION_ULTRA
00141 };
00142
00144 #define BALL_VIEW_MAXIMAL_DRAWING_PRECISION 4
00145
00147 #define BALL_VIEW_MAXIMAL_DISPLAY_LIST_OBJECT_SIZE BALL_VIEW_MAXIMAL_DRAWING_PRECISION * BALL_VIEW_MAXIMAL_DRAWING_MODE
00148
00150 BALL_VIEW_EXPORT extern float SurfaceDrawingPrecisions[4];
00151
00162 enum ModelType
00163 {
00165 MODEL_LINES = 0,
00166
00168 MODEL_STICK,
00169
00171 MODEL_BALL_AND_STICK,
00172
00174 MODEL_VDW,
00175
00177 MODEL_SE_SURFACE,
00178
00180 MODEL_SA_SURFACE,
00181
00183 MODEL_BACKBONE,
00184
00186 MODEL_CARTOON,
00187
00189 MODEL_RIBBON,
00190
00192 MODEL_HBONDS,
00193
00195 MODEL_FORCES,
00196
00197
00198
00199
00200
00202 MODEL_LABEL = 100,
00203
00205 MODEL_CONTOUR_SURFACE,
00206
00208 MODEL_GRID_SLICE,
00209
00211 MODEL_GRID_VOLUME,
00212
00214 MODEL_FIELD_LINES,
00215
00217 MODEL_INFORMATIONS,
00218
00220 MODEL_COORDINATE_SYSTEM,
00221
00223 MODEL_UNKNOWN = 200
00224 };
00225
00226
00230 enum ColoringMethod
00231 {
00233 COLORING_ELEMENT = 0,
00234
00236 COLORING_RESIDUE_INDEX,
00237
00239 COLORING_RESIDUE_NAME,
00240
00242 COLORING_SECONDARY_STRUCTURE,
00243
00245 COLORING_ATOM_CHARGE,
00246
00248 COLORING_DISTANCE,
00249
00251 COLORING_TEMPERATURE_FACTOR,
00252
00254 COLORING_OCCUPANCY,
00255
00257 COLORING_FORCES,
00258
00260 COLORING_RESIDUE_TYPE,
00261
00263 COLORING_CHAIN,
00264
00266 COLORING_MOLECULE,
00267
00268
00269
00270
00271
00273 COLORING_CUSTOM,
00274
00276 COLORING_UNKNOWN = 200
00277 };
00278
00283 BALL_VIEW_EXPORT extern Composite composite_to_be_ignored_for_colorprocessors_;
00284
00286
00288 BALL_VIEW_EXPORT String vector3ToString(const Vector3& v);
00289
00291 BALL_VIEW_EXPORT bool stringToVector3(const String& data, Vector3& v);
00292
00294 BALL_VIEW_EXPORT String createFloatString(float value, Size precision);
00295
00303 BALL_VIEW_EXPORT MainControl* getMainControl();
00304
00306 BALL_VIEW_EXPORT String createTemporaryFilename();
00307
00309 BALL_VIEW_EXPORT Vector3 getNormal(const Vector3& v);
00310
00312 class BALL_VIEW_EXPORT LogEvent
00313 : public QEvent
00314 {
00315 public:
00316
00318 LogEvent();
00319
00321 void setMessage(const String& msg) {message_ = msg;}
00322
00324 String getMessage() {return message_;}
00325
00327 bool isImportant() { return important_;}
00328
00330 void setImportant(bool state) { important_ = state;}
00331
00333 bool showOnlyInLogView() const { return only_log_;}
00334
00336 void setShowOnlyInLogView(bool state) { only_log_ = state;}
00337
00338 protected:
00339 String message_;
00340 bool important_;
00341 bool only_log_;
00342 };
00343
00345 BALL_VIEW_EXPORT void logString(const String& data);
00346
00348 #define BALLVIEW_DEBUG logString(String("A problem occured in ") + __FILE__ + " " + \
00349 String(__LINE__) + ". Please notify us per mail: ball@bioinf.uni-sb.de\n");
00350
00351
00352 BALL_VIEW_EXPORT void processDropEvent(QDropEvent* e);
00353
00357 BALL_VIEW_EXPORT Camera focusCamera(Composite* composite);
00358
00362 BALL_VIEW_EXPORT Camera focusCamera(const std::list<Vector3>& points);
00363
00365 BALL_VIEW_EXPORT String ascii(const QString& str);
00366
00368 BALL_VIEW_EXPORT ColorRGBA getColor(const QLabel* label);
00369
00371 BALL_VIEW_EXPORT void setColor(const QLabel* label, const ColorRGBA& color);
00372
00374 BALL_VIEW_EXPORT QColor chooseColor(QLabel* label);
00375
00377 BALL_VIEW_EXPORT void setTextColor(QLabel* label, const ColorRGBA& color);
00378
00382 BALL_VIEW_EXPORT void cubicInterpolation(const Vector3& a, const Vector3& b,
00383 const Vector3& tangent_a, const Vector3& tangent_b,
00384 std::vector<Vector3>& interpolated_values);
00385
00388 extern float icosaeder_vertices[12][3];
00389 extern Position icosaeder_indices[20][3];
00390
00391 BALL_VIEW_EXPORT void subdivideTriangle(vector<Vector3>& results, Vector3& v1, Vector3& v2, Vector3& v3, Size precision);
00392
00393 BALL_VIEW_EXPORT vector<Vector3> createSphere(Size precision);
00394
00395 BALL_VIEW_EXPORT void calculateHistogramEqualization(const vector<float>& values, vector<float>& normalized_values, bool use_absolute_values = false);
00396
00398 BALL_VIEW_EXPORT void calculateRandomPoints(const RegularData3D& grid, Size nr_points, vector<Vector3>& resulting_points);
00399
00401
00402 }
00403 }
00404
00405 #endif // BALL_VIEW_KERNEL_COMMON_H