35 #ifndef ANA_OBJECT_OBJECT_H 36 #define ANA_OBJECT_OBJECT_H 73 typedef std::list<carto::rc_ptr<GLItem> >
PrimList;
134 typedef ObjectMenu* (*ObjectMenuRegistrerFunction)
137 AObject(
const std::string & filename =
"" );
147 virtual AObject* clone(
bool shallow =
true );
158 int type()
const {
return( _type ); }
163 int id()
const {
return( _id ); }
165 std::string
name()
const {
return( _name ); }
167 std::string
fileName()
const {
return( _filename ); }
168 void setName(
const std::string & n );
169 void setFileName(
const std::string & filename );
170 void setId(
int id );
175 virtual float MinT()
const;
177 virtual float MaxT()
const;
186 virtual bool boundingBox2D( std::vector<float> & bmin,
187 std::vector<float> & bmax )
const;
203 virtual bool boundingBox( std::vector<float> & bmin,
204 std::vector<float> & bmax )
const;
210 virtual bool render( PrimList &,
const ViewState & );
212 virtual std::vector<float> voxelSize()
const;
217 virtual void internalUpdate();
231 virtual void createDefaultPalette(
const std::string & name =
"" );
233 virtual void SetMaterial(
const Material & mat );
236 {
return const_cast<AObject *
>(
this)->GetMaterial(); }
240 AObject *referentialInheritance()
const;
241 virtual void setReferentialInheritance(
AObject* ao );
244 virtual AObject* fallbackReferentialInheritance()
const;
253 virtual Tree* optionTree()
const;
265 const ParentList &
parents()
const {
return _parents; }
269 const std::set<AWindow*> &
WinList() {
return _winList; }
270 virtual void registerWindow(
AWindow* window);
271 virtual void unregisterWindow(
AWindow* window);
272 virtual bool Is2DObject() = 0;
273 virtual bool Is3DObject() = 0;
276 virtual bool isTransparent()
const;
281 virtual bool renderingIsObserverDependent()
const;
285 virtual int CanBeDestroyed();
287 virtual void setReferenceChanged();
288 bool hasReferenceChanged()
const;
291 virtual void setInternalsChanged();
298 virtual void clearHasChangedFlags()
const;
303 virtual AObject* objectAt(
const std::vector<float> & pos,
float tol = 0 );
306 virtual AObject* objectAt(
const std::vector<float> & pos,
329 virtual float mixedTexValue(
const std::vector<float> & pos,
333 virtual float mixedTexValue(
const std::vector<float> & pos )
const;
342 virtual std::vector<float> texValues(
const std::vector<float> & pos,
344 virtual std::vector<float>
345 texValues(
const std::vector<float> & pos )
const;
348 virtual bool savable()
const {
return false; }
359 virtual bool reload(
const std::string & filename );
367 {
return objectTypeName(_type); };
369 virtual bool save(
const std::string & filename );
376 void setHeaderOptions();
385 virtual void storeHeaderOptions();
390 long loadDate()
const;
391 void setLoadDate(
long t );
392 virtual void update(
const Observable *observable,
void *arg );
394 void setCopyFlag(
bool x =
true );
399 virtual std::string toolTip()
const;
402 static std::list<AObject *> load(
const std::string & filename );
404 static bool reload(
AObject*
object,
bool onlyoutdated =
false );
406 static int registerObjectType(
const std::string &
id );
407 static std::string objectTypeName(
int type );
410 _objectmenu_map[type] = om;
414 return _objectmenu_map[type];
416 static std::map<std::string, carto::rc_ptr<ObjectMenu> >
419 return _objectmenu_map;
421 static void addObjectMenuRegistration( ObjectMenuRegistrerFunction );
425 static void cleanStatic();
431 const PrimList & primitives()
const;
432 PrimList & primitives();
435 virtual void cleanup();
437 virtual void clearReferentialInheritance();
439 AObject *& _referentialInheritance();
440 virtual void unregisterObservable(
Observable * );
471 static std::map<std::string, carto::rc_ptr<ObjectMenu> >
474 friend class StaticInitializers;
491 inline std::vector<float>
494 std::vector<float> t;
#define DECLARE_GENERIC_OBJECT_TYPE(T)
virtual Material & GetMaterial()
virtual unsigned dimTexture() const
Number of texture values for a point.
bool _referenceHasChanged
Reference has-changed flag.
virtual void UnregisterParent(MObject *pob)
ViewState holds information about how a view wants to see an object.
virtual AObjectPalette * palette()
Normally, getOrCreatePalette() should be used instead of this function in most cases.
Base Anatomist object (abstract)
static std::map< std::string, carto::rc_ptr< ObjectMenu > > & getObjectMenuMap()
const std::set< AWindow * > & WinList()
List of windows showing this object.
std::string fileName() const
File name (if any) for loaded objects.
std::list< carto::rc_ptr< GLItem > > PrimList
A class can implement the Observer interface when it wants to be informed of changes in observable ob...
virtual void RegisterParent(MObject *pob)
Multi-object : base abstract class for objects that contain others.
Abstract base class Anatomist window.
const ParentList & parents() const
List of multi-objects containing this one.
static void setObjectMenu(std::string type, carto::rc_ptr< ObjectMenu > om)
virtual bool hasTexture() const
Textured objects have values associated with a geometric coordinate.
static carto::rc_ptr< ObjectMenu > getObjectMenu(std::string type)
virtual void adjustPalette()
Creates or updates object palette according to object values (if needed)
virtual void setGeomExtrema()
Scans the object internals and determines its geometry extrema.
This class can be subclassed to represent an object that the programmer wants to have observed...
virtual const GLComponent * glAPI() const
OpenGL objects const API.
std::string name() const
Name shown in control window.
static std::map< int, std::string > _objectTypeNames
type-to-name map
void setType(int type)
Method to set type id, because type() is not virtual.
void SetVisibility(int v)
This class has to be rewritten, it's really really a shame.......
std::set< AWindow * > _winList
virtual const MObject * mObjectAPI() const
virtual float mixedTexValue(const std::vector< float > &pos, const Referential *orgRef) const
Gets a "mixed" texture value at a given space / time location.
virtual GLComponent * glAPI()
OpenGL objects API.
int id() const
Unique ID assigned upon construction, but somewhat unused now...
virtual MObject * mObjectAPI()
virtual int isMultiObject() const
maybe not necessary ?: we can use dynamic_cast instead
virtual bool textured2D() const
true if 2D rendering uses a textured plane (not a full openGL object)
ParentList & parents()
List of multi-objects containing this one.
virtual bool printTalairachCoord(const Point3df &, const Referential *) const
should be replaced by a real referential
int Visible() const
Visibility in control window.
ParentList & Parents()
List of multi-objects containing this one. Obsolete: use parents()
Base class for all OpenGL objects in Anatomist (with OpenGL display lists)
AObjectPalette * _palette
Palette.
ObjectType
Base object type identifiers.
virtual std::vector< float > texValues(const std::vector< float > &pos, const Referential *orgRef) const
Gets the array of texture values at a given location.
std::set< MObject * > ParentList
Storage type for parent objects (multi-objects containing this one)
virtual const AObjectPalette * palette() const
Material _material
Should be a pointer: some objects don't have a material (2D objects)
static std::map< std::string, int > _objectTypes
name-to-type map
static std::map< std::string, carto::rc_ptr< ObjectMenu > > _objectmenu_map
Object Menu Map.
virtual bool loadable() const
virtual void SetExtrema()
Scans the object internals and determines its (texture) extrema values.
int type() const
Object type identifier.
virtual const Material & material() const
int _type
Should be static in each object class.
virtual bool savable() const
Referential: marker for transformations, with an associated color.
int InMemory() const
For objects loading only when needed (not used yet...)
Referential * _referential
Referentiel.
virtual std::string objectFullTypeName(void) const
Get Object Full Type Name.
virtual void setVoxelSize(const std::vector< float > &)
reference_wrapper< T > ref(T &ref)