/usr/include/BALL/VIEW/KERNEL/common.h is in libballview1.4-dev 1.4.3~beta1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | // -*- 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 <QtGui/QColorDialog>
#include <QtGui/QLabel>
#include <QtGui/QDropEvent>
namespace BALL
{
namespace VIEW
{
class GeometricObject;
class MainControl;
class ColorRGBA;
class Camera;
/** @name defines
\ingroup ViewKernelOther
*/
//@{
/** The default port for the VIEW::Server.
Default port is 20000.
\see Server
*/
#define VIEW_DEFAULT_PORT 20000
/** Assign the name of a QObject to its variable name, needed e.g. for the GUI testing
*/
#define BALL_ASSIGN_NAME(OBJ)\
OBJ->setObjectName(#OBJ);
//@}
/** @name General enumerations, methods and typedefs
These predefined types are used in VIEW for portability and
comprehensibility.
\ingroup ViewKernelOther
*/
//@{
/** Enumeration of Events
These events are used to communicate between different threads.
Have a look at QWidget::customEvent(QEvent*) to learn about
QT and its events concept. This enum is used to give every type
of derived QEvent its individual type id.
*/
enum EventsIDs
{
/// An event with a contained VIEW message
MESSAGE_EVENT = 60000,
/// Event to print output from a Thread
LOG_EVENT,
/// Event that encodes a 6 dimensional transformation
TRANSFORMATION_EVENT_6D,
/// Event that encodes a head tracker position change
HEADTRACKING_EVENT,
/// Event that encodes a motion tracker position change
MOTIONTRACKING_EVENT,
/// Event for button press events of custom input devices
BUTTON_PRESS_EVENT,
/// Event for button press events of custom input devices
BUTTON_RELEASE_EVENT,
/// Event for passing BALL Messages accross threads
NOTIFICATION_EVENT,
/// Event posted by renderers after a new buffer is available
RENDER_TO_BUFFER_FINISHED_EVENT
};
//@}
/** @name Enumerations for Representations and Renderer
Enums and methods to describe the models and drawing methods.
\ingroup ViewKernelOther
*/
//@{
/// Enumeration for Drawing Modes
enum DrawingMode
{
///
DRAWING_MODE_DOTS = 0,
///
DRAWING_MODE_WIREFRAME,
///
DRAWING_MODE_SOLID,
///
DRAWING_MODE_TOON
};
/// Number of drawing modes
#define BALL_VIEW_MAXIMAL_DRAWING_MODE 4
/// Enumeration for Drawing Precisions.
enum DrawingPrecision
{
///
DRAWING_PRECISION_INVALID = -1,
///
DRAWING_PRECISION_LOW = 0,
///
DRAWING_PRECISION_MEDIUM,
///
DRAWING_PRECISION_HIGH,
///
DRAWING_PRECISION_ULTRA
};
/// Number of drawing precisions
#define BALL_VIEW_MAXIMAL_DRAWING_PRECISION 4
/// MAXIMAL_DRAWING_PRECISION * MAXIMAL_DRAWING_MODE
#define BALL_VIEW_MAXIMAL_DISPLAY_LIST_OBJECT_SIZE BALL_VIEW_MAXIMAL_DRAWING_PRECISION * BALL_VIEW_MAXIMAL_DRAWING_MODE
/// Mapping from the enum to the float values of Surfaces
BALL_VIEW_EXPORT extern float SurfaceDrawingPrecisions[4];
/** This properties define the available models.
Add new model entries directly before MODEL_LABEL if you want them to show up
in the DisplayProperties dialog!
You may have to modify the following methods, if you add a new ModelType:
@see getModelName(ModelType type)
@see getColoringName(ColoringMethod type)
@see isSurfaceModel(ModelType type)
@see modelMuteableByDisplayProperties(ModelType type)
@see modelMustBeRebuild(ModelType type)
*/
enum ModelType
{
/// defines the property for the model: Lines
MODEL_LINES = 0,
/// defines the property for the model: Stick
MODEL_STICK,
/// defines the property for the model: Ball and Stick
MODEL_BALL_AND_STICK,
/// defines the property for the model: Van der Waals
MODEL_VDW,
/// defines the property for the model: solvent-excluded surface
MODEL_SE_SURFACE,
/// defines the property for the model: solvent-accessible surface
MODEL_SA_SURFACE,
/// defines the property for the model: Backbone
MODEL_BACKBONE,
/// defines the property for the model: Cartoon
MODEL_CARTOON,
/// defines the property for the model: Ribbon
MODEL_RIBBON,
/// defines the property for the model: H-Bonds
MODEL_HBONDS,
///
MODEL_FORCES,
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// add new model types before this comment!!!!
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
/// defines the property for the model: Label
MODEL_LABEL = 100,
/// defines the property for the model: contour surface
MODEL_CONTOUR_SURFACE,
///
MODEL_GRID_SLICE,
///
MODEL_GRID_VOLUME,
///
MODEL_FIELD_LINES,
///
MODEL_INFORMATIONS,
///
MODEL_COORDINATE_SYSTEM,
/// defines the property for the model: proximity light
MODEL_PROXIMITY_LIGHT,
///
MODEL_PLANE,
///
MODEL_SPHERE,
/// unkown property
MODEL_UNKNOWN = 200
};
/** Enumeration for Coloring Methods.
<b>Add new coloring methods before COLORING_CUSTOM.</b>
*/
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
};
/** A special Composite, which is ignored by all ColoringProcessors,
the GeometricObjects, which have this Composite set, will be colored
by the default color.
*/
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);
/// create a string from a float and cut after a given number of digits after the dot
BALL_VIEW_EXPORT String createFloatString(float value, Size precision);
/** Get MainControl
This method is only to be used for code, which is not part of
a ModularWidget.
On Windows, it uses the following cast:\\
MainControl* mc = dynamic_cast<MainControl*>(qApp->mainWidget());\\
On all other platforms, it uses MainControl::getInstance(0);
*/
BALL_VIEW_EXPORT MainControl* getMainControl();
/// Create a temporary filename in the users home dir
BALL_VIEW_EXPORT String createTemporaryFilename();
///
BALL_VIEW_EXPORT Vector3 getNormal(const Vector3& v);
/// Event class used for thread safe output to logview
class BALL_VIEW_EXPORT LogEvent
: public QEvent
{
public:
///
LogEvent();
///
void setMessage(const String& msg) {message_ = msg;}
///
String getMessage() {return message_;}
/// will allways be shown in Statusbar or just when no other message shown?
bool isImportant() { return important_;}
///
void setImportant(bool state) { important_ = state;}
/// only show in logview, no change to status bar
bool showOnlyInLogView() const { return only_log_;}
///
void setShowOnlyInLogView(bool state) { only_log_ = state;}
protected:
String message_;
bool important_;
bool only_log_;
};
/// thread safe output to logview
BALL_VIEW_EXPORT void logString(const String& data);
/// BALLView Debug macro
#define BALLVIEW_DEBUG logString(String("A problem occured in ") + __FILE__ + " " + \
String(__LINE__) + ". Please notify us per mail: ball@bioinf.uni-sb.de\n");
BALL_VIEW_EXPORT void processDropEvent(QDropEvent* e);
/** Focus the camera on a Composite
Sends a SceneMessage.
*/
BALL_VIEW_EXPORT Camera focusCamera(Composite* composite);
/** Focus the camera on a list of points, e.g. atoms or geometric objects.
Sends a SceneMessage.
*/
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);
/** Uses the de-Casteljou algorithm to evalute a cubic Hermite interpolation
* polynomial at interpolated_values.size() equidistant values.
*/
BALL_VIEW_EXPORT void cubicInterpolation(const Vector3& a, const Vector3& b,
const Vector3& tangent_a, const Vector3& tangent_b,
std::vector<Vector3>& interpolated_values);
//////////////////////////////////////////////////////////////////////////////
/// Code to refine a icosaeder:
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);
/// calcualte a random set of points, dependening of the field strength of a grid
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
|