Loading...
Searching...
No Matches
representation.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_VIEW_KERNEL_REPRESENTATION_H
#define BALL_VIEW_KERNEL_REPRESENTATION_H
#ifndef BALL_CONCEPT_PROPERTY_H
# include <BALL/CONCEPT/property.h>
#endif
#ifndef BALL_CONCEPT_COMPOSITE_H
# include <BALL/CONCEPT/composite.h>
#endif
#ifndef BALL_VIEW_KERNEL_COMMON_H
# include <BALL/VIEW/KERNEL/common.h>
#endif
#ifndef BALL_CONCEPT_MOLECULARINFORMATION_H
# include <BALL/CONCEPT/molecularInformation.h>
#endif
#ifndef BALL_VIEW_KERNEL_MODELINFORMATION_H
# include <BALL/VIEW/KERNEL/modelInformation.h>
#endif
// next two defines need to be included in header file, because of iC file
#ifndef BALL_VIEW_MODELS_MODELPROCESSOR_H
# include <BALL/VIEW/MODELS/modelProcessor.h>
#endif
#ifndef BALL_VIEW_MODELS_COLORPROCESSOR_H
# include <BALL/VIEW/MODELS/colorProcessor.h>
#endif
namespace BALL
{
namespace VIEW
{
class ModelProcessor;
class ColorProcessor;
class GeometricObject;
class UpdateRepresentationThread;
class RepresentationManager;
class BALL_VIEW_EXPORT Representation
: public PropertyManager
{
friend class UpdateRepresentationThread;
friend class RepresentationManager;
public:
BALL_CREATE(Representation)
enum Properties
{
PROPERTY__ALWAYS_FRONT = 0,
PROPERTY__IS_COORDINATE_SYSTEM
};
Representation();
Representation(ModelType model_type,
DrawingPrecision drawing_precision,
DrawingMode drawing_mode);
Representation(const Representation& representation);
virtual ~Representation();
const Representation& operator = (const Representation& rep);
void clear();
void setHidden(bool state) ;
bool isHidden() const;
void setDrawingPrecision(DrawingPrecision precision);
DrawingPrecision getDrawingPrecision() const;
float getSurfaceDrawingPrecision() const;
void setSurfaceDrawingPrecision(float precision);
void setDrawingMode(DrawingMode mode);
DrawingMode getDrawingMode() const;
Size getTransparency() const;
void setTransparency(Size value);
const GeometricObjectList& getGeometricObjects() const;
GeometricObjectList& getGeometricObjects();
void setGeometricObjects(GeometricObjectList& gol)
{ geometric_objects_ = gol;}
void insert(GeometricObject& object) ;
const std::list<const Composite*>& getComposites() const
{ return composites_;}
void setComposites(const std::list<const Composite*>& composites);
void setComposite(const Composite* composite);
const ModelProcessor* getModelProcessor() const;
ModelProcessor* getModelProcessor();
void setModelProcessor(ModelProcessor* processor);
ColorProcessor* getColorProcessor();
void setColorProcessor(ColorProcessor* processor);
void setModelType(ModelType type);
ModelType getModelType() const;
String getName() const;
void setName(const String& name);
String getCompositeName() const;
void setColoringMethod(ColoringMethod type);
ColoringMethod getColoringMethod() const;
void enableModelUpdate(bool state);
void enableColoringUpdate(bool state) { coloring_update_enabled_ = state;}
bool modelUpdateEnabled() const { return model_update_enabled_;}
bool coloringUpdateEnabled() const { return coloring_update_enabled_;}
String getProperties() const;
bool isValid() const;
void update(bool rebuild);
void clearGeometricObjects();
const PreciseTime& getModelBuildTime() const;
bool needsUpdate() const;
void setNeedsUpdate(bool state=true);
void dump(std::ostream& s = std::cout, Size depth = 0) const;
String toString() const;
void setModelInformation(const ModelInformation& mi);
const ModelInformation& getModelInformation() const;
bool operator == (const Representation& object) const;
bool operator < (const Representation& object) const
{ return this < &object;}
protected:
void update_();
// Create a hashmap with the numerical position of every composite in its root Composite.
// Needed for toString().
void collectRecursive_(const Composite& c, HashMap<const Composite*, Position>& hashmap) const;
//_
DrawingMode drawing_mode_;
//_
DrawingPrecision drawing_precision_;
//_
float surface_drawing_precision_;
//_
ModelType model_type_;
//_
ColoringMethod coloring_method_;
//_
Size transparency_;
//_
ModelProcessor* model_processor_;
//_
ColorProcessor* color_processor_;
//_
std::list<const Composite*> composites_;
//_
PreciseTime model_build_time_;
//_ set to true, if update is called, while representation is hidden
bool needs_update_;
//_ true means the ModelProcessor will be applied in the next update
bool rebuild_;
//_ true means the ColorProcessor was changed since the last update call, so apply it!
bool changed_color_processor_;
//_
bool hidden_;
//_
GeometricObjectList geometric_objects_;
//_
bool model_update_enabled_;
//_
bool coloring_update_enabled_;
String name_;
//_ used for getName()
static MolecularInformation information_;
//_ used for getName()
static ModelInformation model_information_;
const ModelInformation* custom_model_information_;
};
typedef std::list<Representation*> RepresentationList;
# ifndef BALL_NO_INLINE_FUNCTIONS
# include <BALL/VIEW/KERNEL/representation.iC>
# endif
} // namespace VIEW
} // namespace BALL
#endif // BALL_VIEW_KERNEL_REPRESENTATION_H
BALL_VIEW_EXPORT
#define BALL_VIEW_EXPORT
Definition COMMON/global.h:52
common.h
BALL::Composite
Definition composite.h:74
BALL::HashMap
HashMap class based on the STL map (containing serveral convenience functions).
Definition hashMap.h:74
BALL::MolecularInformation
Definition molecularInformation.h:23
BALL::PreciseTime
Definition timeStamp.h:38
BALL::PropertyManager::PropertyManager
BALL_INLINE PropertyManager()
Default constructor.
BALL::String
Definition string.h:57
BALL::VIEW::ColorProcessor
Definition colorProcessor.h:52
BALL::VIEW::GeometricObject
Definition geometricObject.h:37
BALL::VIEW::ModelInformation
Definition modelInformation.h:27
BALL::VIEW::ModelProcessor
Definition modelProcessor.h:40
BALL::VIEW::RepresentationManager
Definition representationManager.h:47
BALL::VIEW::Representation::coloring_method_
ColoringMethod coloring_method_
Definition representation.h:292
BALL::VIEW::Representation::setNeedsUpdate
void setNeedsUpdate(bool state=true)
BALL::VIEW::Representation::information_
static MolecularInformation information_
Definition representation.h:333
BALL::VIEW::Representation::modelUpdateEnabled
bool modelUpdateEnabled() const
Definition representation.h:209
BALL::VIEW::Representation::Representation
Representation(const Representation &representation)
BALL::VIEW::Representation::color_processor_
ColorProcessor * color_processor_
Definition representation.h:301
BALL::VIEW::Representation::update_
void update_()
BALL::VIEW::Representation::needsUpdate
bool needsUpdate() const
BALL::VIEW::Representation::model_processor_
ModelProcessor * model_processor_
Definition representation.h:298
BALL::VIEW::Representation::getProperties
String getProperties() const
Get a descpription string (nr triangles and geometric objects, transparency, mode).
BALL::VIEW::Representation::drawing_precision_
DrawingPrecision drawing_precision_
Definition representation.h:283
BALL::VIEW::Representation::getModelInformation
const ModelInformation & getModelInformation() const
BALL::VIEW::Representation::geometric_objects_
GeometricObjectList geometric_objects_
Definition representation.h:322
BALL::VIEW::Representation::isValid
bool isValid() const
Check if drawing mode, transparency and drawing precision have reasonable values.
BALL::VIEW::Representation::setSurfaceDrawingPrecision
void setSurfaceDrawingPrecision(float precision)
BALL::VIEW::Representation::enableModelUpdate
void enableModelUpdate(bool state)
BALL::VIEW::Representation::getTransparency
Size getTransparency() const
get transparency (0 - 255)
BALL::VIEW::Representation::model_build_time_
PreciseTime model_build_time_
Definition representation.h:307
BALL::VIEW::Representation::setModelInformation
void setModelInformation(const ModelInformation &mi)
Set a custom ModelInformation e.g. when new models were added external of the library.
BALL::VIEW::Representation::needs_update_
bool needs_update_
Definition representation.h:310
BALL::VIEW::Representation::getGeometricObjects
GeometricObjectList & getGeometricObjects()
BALL::VIEW::Representation::clearGeometricObjects
void clearGeometricObjects()
Clear and destroy all stored GeometricObject.
BALL::VIEW::Representation::setHidden
void setHidden(bool state)
BALL::VIEW::Representation::setModelType
void setModelType(ModelType type)
BALL::VIEW::Representation::getName
String getName() const
BALL::VIEW::Representation::collectRecursive_
void collectRecursive_(const Composite &c, HashMap< const Composite *, Position > &hashmap) const
BALL::VIEW::Representation::getComposites
const std::list< const Composite * > & getComposites() const
Definition representation.h:157
BALL::VIEW::Representation::getSurfaceDrawingPrecision
float getSurfaceDrawingPrecision() const
BALL::VIEW::Representation::composites_
std::list< const Composite * > composites_
Definition representation.h:304
BALL::VIEW::Representation::getModelBuildTime
const PreciseTime & getModelBuildTime() const
BALL::VIEW::Representation::isHidden
bool isHidden() const
BALL::VIEW::Representation::Representation
Representation()
BALL::VIEW::Representation::setDrawingMode
void setDrawingMode(DrawingMode mode)
BALL::VIEW::Representation::setTransparency
void setTransparency(Size value)
set transparency (0 - 255)
BALL::VIEW::Representation::getDrawingPrecision
DrawingPrecision getDrawingPrecision() const
BALL::VIEW::Representation::getModelProcessor
ModelProcessor * getModelProcessor()
BALL::VIEW::Representation::enableColoringUpdate
void enableColoringUpdate(bool state)
Definition representation.h:206
BALL::VIEW::Representation::dump
void dump(std::ostream &s=std::cout, Size depth=0) const
Dum to ostream for debugging.
BALL::VIEW::Representation::model_update_enabled_
bool model_update_enabled_
Definition representation.h:325
BALL::VIEW::Representation::setComposite
void setComposite(const Composite *composite)
BALL::VIEW::Representation::~Representation
virtual ~Representation()
BALL::VIEW::Representation::getCompositeName
String getCompositeName() const
Returns a human-readable, potentially abbreviated string describing the molecular entity this represe...
BALL::VIEW::Representation::getModelType
ModelType getModelType() const
BALL::VIEW::Representation::transparency_
Size transparency_
Definition representation.h:295
BALL::VIEW::Representation::UpdateRepresentationThread
friend class UpdateRepresentationThread
Definition representation.h:60
BALL::VIEW::Representation::Properties
Properties
Properties.
Definition representation.h:72
BALL::VIEW::Representation::PROPERTY__ALWAYS_FRONT
@ PROPERTY__ALWAYS_FRONT
Definition representation.h:74
BALL::VIEW::Representation::PROPERTY__IS_COORDINATE_SYSTEM
@ PROPERTY__IS_COORDINATE_SYSTEM
Definition representation.h:77
BALL::VIEW::Representation::surface_drawing_precision_
float surface_drawing_precision_
Definition representation.h:286
BALL::VIEW::Representation::changed_color_processor_
bool changed_color_processor_
Definition representation.h:316
BALL::VIEW::Representation::custom_model_information_
const ModelInformation * custom_model_information_
Definition representation.h:338
BALL::VIEW::Representation::clear
void clear()
Clears all properties.
BALL::VIEW::Representation::setName
void setName(const String &name)
BALL::VIEW::Representation::setColorProcessor
void setColorProcessor(ColorProcessor *processor)
BALL::VIEW::Representation::getColoringMethod
ColoringMethod getColoringMethod() const
BALL::VIEW::Representation::getDrawingMode
DrawingMode getDrawingMode() const
BALL::VIEW::Representation::update
void update(bool rebuild)
BALL::VIEW::Representation::hidden_
bool hidden_
Definition representation.h:319
BALL::VIEW::Representation::model_information_
static ModelInformation model_information_
Definition representation.h:336
BALL::VIEW::Representation::setDrawingPrecision
void setDrawingPrecision(DrawingPrecision precision)
BALL::VIEW::Representation::Representation
Representation(ModelType model_type, DrawingPrecision drawing_precision, DrawingMode drawing_mode)
BALL::VIEW::Representation::insert
void insert(GeometricObject &object)
BALL::VIEW::Representation::coloring_update_enabled_
bool coloring_update_enabled_
Definition representation.h:328
BALL::VIEW::Representation::drawing_mode_
DrawingMode drawing_mode_
Definition representation.h:280
BALL::VIEW::Representation::name_
String name_
Definition representation.h:330
BALL::VIEW::Representation::getColorProcessor
ColorProcessor * getColorProcessor()
BALL::VIEW::Representation::setComposites
void setComposites(const std::list< const Composite * > &composites)
BALL::VIEW::Representation::RepresentationManager
friend class RepresentationManager
Definition representation.h:61
BALL::VIEW::Representation::rebuild_
bool rebuild_
Definition representation.h:313
BALL::VIEW::Representation::model_type_
ModelType model_type_
Definition representation.h:289
BALL::VIEW::Representation::setColoringMethod
void setColoringMethod(ColoringMethod type)
BALL::VIEW::Representation::getGeometricObjects
const GeometricObjectList & getGeometricObjects() const
BALL::VIEW::Representation::toString
String toString() const
Get a String containing all settings for Usage in project files.
BALL::VIEW::Representation::getModelProcessor
const ModelProcessor * getModelProcessor() const
BALL::VIEW::Representation::setModelProcessor
void setModelProcessor(ModelProcessor *processor)
BALL::VIEW::Representation::coloringUpdateEnabled
bool coloringUpdateEnabled() const
Definition representation.h:212
BALL::VIEW::Representation::setGeometricObjects
void setGeometricObjects(GeometricObjectList &gol)
Definition representation.h:150
BALL::VIEW::UpdateRepresentationThread
Definition threads.h:161
colorProcessor.h
composite.h
BALL_CREATE
#define BALL_CREATE(name)
Definition create.h:62
modelInformation.h
modelProcessor.h
molecularInformation.h
BALL::VIEW
Definition constraints.h:35
BALL::VIEW::DrawingPrecision
DrawingPrecision
Enumeration for Drawing Precisions.
Definition VIEW/KERNEL/common.h:129
BALL::VIEW::RepresentationList
std::list< Representation * > RepresentationList
Definition representation.h:342
BALL::VIEW::GeometricObjectList
std::list< GeometricObject * > GeometricObjectList
Definition geometricObject.h:185
BALL::VIEW::ColoringMethod
ColoringMethod
Definition VIEW/KERNEL/common.h:243
BALL::VIEW::DrawingMode
DrawingMode
Enumeration for Drawing Modes.
Definition VIEW/KERNEL/common.h:110
BALL::VIEW::ModelType
ModelType
Definition VIEW/KERNEL/common.h:166
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
property.h