00001
00002
00003
00004
00005
00006
00007 #ifndef BALL_VIEW_KERNEL_REPRESENTATION_H
00008 #define BALL_VIEW_KERNEL_REPRESENTATION_H
00009
00010 #ifndef BALL_CONCEPT_PROPERTY_H
00011 # include <BALL/CONCEPT/property.h>
00012 #endif
00013
00014 #ifndef BALL_DATATYPE_LIST_H
00015 # include <BALL/DATATYPE/list.h>
00016 #endif
00017
00018 #ifndef BALL_CONCEPT_COMPOSITE_H
00019 # include <BALL/CONCEPT/composite.h>
00020 #endif
00021
00022 #ifndef BALL_VIEW_KERNEL_COMMON_H
00023 # include <BALL/VIEW/KERNEL/common.h>
00024 #endif
00025
00026 #ifndef BALL_CONCEPT_MOLECULARINFORMATION_H
00027 # include <BALL/CONCEPT/molecularInformation.h>
00028 #endif
00029
00030 #ifndef BALL_VIEW_KERNEL_MODELINFORMATION_H
00031 # include <BALL/VIEW/KERNEL/modelInformation.h>
00032 #endif
00033
00034
00035 #ifndef BALL_VIEW_MODELS_MODELPROCESSOR_H
00036 # include <BALL/VIEW/MODELS/modelProcessor.h>
00037 #endif
00038
00039 #ifndef BALL_VIEW_MODELS_COLORPROCESSOR_H
00040 # include <BALL/VIEW/MODELS/colorProcessor.h>
00041 #endif
00042
00043
00044 namespace BALL
00045 {
00046 namespace VIEW
00047 {
00048 class ModelProcessor;
00049 class ColorProcessor;
00050 class GeometricObject;
00051 class UpdateRepresentationThread;
00052 class RepresentationManager;
00053
00063 class BALL_VIEW_EXPORT Representation
00064 : public PropertyManager
00065 {
00066 friend class UpdateRepresentationThread;
00067 friend class RepresentationManager;
00068 public:
00069
00070 BALL_CREATE(Representation)
00071
00072
00075
00076
00077 enum Properties
00078 {
00080 PROPERTY__ALWAYS_FRONT = 0,
00081
00083 PROPERTY__IS_COORDINATE_SYSTEM
00084 };
00085
00087
00090
00093 Representation();
00094
00096 Representation(ModelType model_type,
00097 DrawingPrecision drawing_precision,
00098 DrawingMode drawing_mode);
00099
00102 Representation(const Representation& representation);
00103
00106 virtual ~Representation();
00107
00109
00112
00114 const Representation& operator = (const Representation& rep);
00115
00117 void clear();
00118
00120 void setHidden(bool state) ;
00121
00123 bool isHidden() const;
00124
00126 void setDrawingPrecision(DrawingPrecision precision);
00127
00129 DrawingPrecision getDrawingPrecision() const;
00130
00132 float getSurfaceDrawingPrecision() const;
00133
00135 void setSurfaceDrawingPrecision(float precision);
00136
00138 void setDrawingMode(DrawingMode mode);
00139
00141 DrawingMode getDrawingMode() const;
00142
00144 Size getTransparency() const;
00145
00147 void setTransparency(Size value);
00148
00150 const GeometricObjectList& getGeometricObjects() const;
00151
00153 GeometricObjectList& getGeometricObjects();
00154
00156 void setGeometricObjects(GeometricObjectList& gol)
00157 { geometric_objects_ = gol;}
00158
00160 void insert(GeometricObject& object) ;
00161
00163 const List<const Composite*>& getComposites() const
00164 { return composites_;}
00165
00167 void setComposites(const List<const Composite*>& composites);
00168
00170 void setComposite(const Composite* composite);
00171
00173 const ModelProcessor* getModelProcessor() const;
00174
00176 ModelProcessor* getModelProcessor();
00177
00179 void setModelProcessor(ModelProcessor* processor);
00180
00182 ColorProcessor* getColorProcessor();
00183
00185 void setColorProcessor(ColorProcessor* processor);
00186
00188 void setModelType(ModelType type);
00189
00191 ModelType getModelType() const;
00192
00194 String getName() const;
00195
00197 void setName(const String& name);
00198
00200 String getCompositeName() const;
00201
00203 void setColoringMethod(ColoringMethod type);
00204
00206 ColoringMethod getColoringMethod() const;
00207
00209 void enableModelUpdate(bool state);
00210
00212 void enableColoringUpdate(bool state) { coloring_update_enabled_ = state;}
00213
00215 bool modelUpdateEnabled() const { return model_update_enabled_;}
00216
00218 bool coloringUpdateEnabled() const { return coloring_update_enabled_;}
00219
00221 String getProperties() const;
00222
00224 bool isValid() const;
00225
00230 void update(bool rebuild);
00231
00233 void clearGeometricObjects();
00234
00240 const PreciseTime& getModelBuildTime() const;
00241
00246 bool needsUpdate() const;
00247
00249 void setNeedsUpdate(bool state=true);
00250
00252 void dump(std::ostream& s = std::cout, Size depth = 0) const;
00253
00255 String toString() const;
00256
00258 void setModelInformation(const ModelInformation& mi);
00259
00261 const ModelInformation& getModelInformation() const;
00262
00264 bool operator == (const Representation& object) const;
00265
00266
00268 bool operator < (const Representation& object) const
00269 { return this < &object;}
00270
00272
00273 protected:
00274
00279 void update_();
00280
00281
00282
00283 void collectRecursive_(const Composite& c, HashMap<const Composite*, Position>& hashmap) const;
00284
00285
00286 DrawingMode drawing_mode_;
00287
00288
00289 DrawingPrecision drawing_precision_;
00290
00291
00292 float surface_drawing_precision_;
00293
00294
00295 ModelType model_type_;
00296
00297
00298 ColoringMethod coloring_method_;
00299
00300
00301 Size transparency_;
00302
00303
00304 ModelProcessor* model_processor_;
00305
00306
00307 ColorProcessor* color_processor_;
00308
00309
00310 List<const Composite*> composites_;
00311
00312
00313 PreciseTime model_build_time_;
00314
00315
00316 bool needs_update_;
00317
00318
00319 bool rebuild_;
00320
00321
00322 bool changed_color_processor_;
00323
00324
00325 bool hidden_;
00326
00327
00328 GeometricObjectList geometric_objects_;
00329
00330
00331 bool model_update_enabled_;
00332
00333
00334 bool coloring_update_enabled_;
00335
00336 String name_;
00337
00338
00339 static MolecularInformation information_;
00340
00341
00342 static ModelInformation model_information_;
00343
00344 const ModelInformation* custom_model_information_;
00345 };
00346
00348 typedef List<Representation*> RepresentationList;
00349
00350 # ifndef BALL_NO_INLINE_FUNCTIONS
00351 # include <BALL/VIEW/KERNEL/representation.iC>
00352 # endif
00353
00354 }
00355 }
00356
00357 #endif // BALL_VIEW_KERNEL_REPRESENTATION_H