35 #ifndef ANA_OBJECT_OBJECT_H
36 #define ANA_OBJECT_OBJECT_H
73 typedef std::list<carto::rc_ptr<GLItem> >
PrimList;
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 ); }
187 std::vector<float> & bmax )
const;
204 std::vector<float> & bmax )
const;
236 {
return const_cast<AObject *
>(
this)->GetMaterial(); }
269 const std::set<AWindow*> &
WinList() {
return _winList; }
339 virtual float mixedTexValue(
const std::vector<float> & pos )
const;
348 virtual std::vector<float>
texValues(
const std::vector<float> & pos,
350 virtual std::vector<float>
351 texValues(
const std::vector<float> & pos )
const;
354 virtual bool savable()
const {
return false; }
365 virtual bool reload(
const std::string & filename );
373 {
return objectTypeName(_type); };
375 bool save(
const std::string & filename,
bool onlyIfModified );
377 virtual bool save(
const std::string & filename );
410 static std::list<AObject *>
load(
const std::string & filename );
418 _objectmenu_map[type] = om;
422 return _objectmenu_map[type];
424 static std::map<std::string, carto::rc_ptr<ObjectMenu> >
427 return _objectmenu_map;
479 static std::map<std::string, carto::rc_ptr<ObjectMenu> >
482 friend class StaticInitializers;
499 inline std::vector<float>
502 std::vector<float> t;
Base Anatomist object (abstract)
void setFileName(const std::string &filename)
const Referential * previousReferential() const
Referential that the object was in before the last change.
virtual AObject * clone(bool shallow=true)
Makes a copy of the object, with a duplicated object structure, palette and material,...
const PrimList & primitives() const
virtual bool hasTexture() const
Textured objects have values associated with a geometric coordinate.
virtual Material & GetMaterial()
void setType(int type)
Method to set type id, because type() is not virtual.
virtual MObject * mObjectAPI()
bool hasReferenceChanged() const
virtual bool Is2DObject()=0
virtual bool savable() const
static std::map< std::string, carto::rc_ptr< ObjectMenu > > _objectmenu_map
Object Menu Map.
static bool reload(AObject *object, bool onlyoutdated=false)
Reads from disk again.
virtual unsigned dimTexture() const
Number of texture values for a point.
Material _material
Should be a pointer: some objects don't have a material (2D objects)
int Visible() const
Visibility in control window.
virtual bool loadable() const
AObject *& _referentialInheritance()
provide access to derived classes
virtual void adjustPalette()
Creates or updates object palette according to object values (if needed)
virtual const AObjectPalette * getOrCreatePalette() const
User normally calls this function.
virtual GLComponent * glAPI()
OpenGL objects API.
virtual AObject * objectAt(const std::vector< float > &pos, float tol, const Referential *orgref, const Point3df &orggeom)
Same with origin window referential.
AObject(const AObject &)
copy constructor, protected and used only to reimplement clone()
const ParentList & parents() const
List of multi-objects containing this one.
virtual const Material & material() const
virtual void SetMaterial(const Material &mat)
static std::list< AObject * > load(const std::string &filename)
Static object loader: creates an objects, loads its contents.
AObjectPalette * _palette
Palette.
std::set< AWindow * > _winList
carto::Object aimsMeshFromGLComponent()
virtual AObjectPalette * palette()
Normally, getOrCreatePalette() should be used instead of this function in most cases.
virtual bool save(const std::string &filename)
virtual bool IsFusion2DAllowed()
virtual std::string toolTip() const
tooltip displayed in 3D views (HTML).
static void addObjectMenuRegistration(ObjectMenuRegistrerFunction)
ParentList & Parents()
List of multi-objects containing this one. Obsolete: use parents()
virtual float MaxT() const
Obsolete, deprecated.
virtual Tree * optionTree() const
Menu tree for new options, see object/optionMatcher.h.
virtual AObject * fallbackReferentialInheritance() const
object to take referential from when no ref is assigned
int type() const
Object type identifier.
static std::map< std::string, int > _objectTypes
name-to-type map
static void cleanStatic()
cleanup static global variables (called when quitting anatomist)
virtual int CanBeDestroyed()
Allows / unallows destruction of object.
virtual bool boundingBox(std::vector< float > &bmin, std::vector< float > &bmax) const
Fills bmin and bmax with the N-D bounding box extrema in the object's referential coordinates.
static std::map< std::string, carto::rc_ptr< ObjectMenu > > & getObjectMenuMap()
virtual void registerWindow(AWindow *window)
virtual void update(const Observable *observable, void *arg)
This method is called whenever the observed object is changed.
virtual void clearReferentialInheritance()
sets the object to get referential from to null, unregister it
bool save(const std::string &filename, bool onlyIfModified)
long loadDate() const
Time the object was created, loaded or reloaded.
static int registerObjectType(const std::string &id)
Creates a new object type number and returns it.
virtual void storeHeaderOptions()
Store some object properties into the header (.minf), such as material, palette etc before saving the...
virtual AObject * objectAt(const std::vector< float > &pos, float tol=0)
Find the object (sub-object) at given postion with a tolerence.
bool userModified() const
if the object has been modified by user interaction, and needs saving
virtual carto::Object makeHeaderOptions() const
get object properties into a generic object, such as material, palette etc before saving the object
virtual bool Is3DObject()=0
virtual void setReferentialInheritance(AObject *ao)
virtual bool renderingIsObserverDependent() const
true only if the rendering (openGL) of the object changes with the observer position/orientation of t...
virtual bool textured2D() const
true if 2D rendering uses a textured plane (not a full openGL object)
std::set< MObject * > ParentList
Storage type for parent objects (multi-objects containing this one)
virtual bool render(PrimList &, const ViewState &)
rendering (generally 2D or 3D using OpenGL).
virtual void clearHasChangedFlags() const
Reset has-changed flags.
int id() const
Unique ID assigned upon construction, but somewhat unused now...
Referential * getReferential() const
virtual std::string objectFullTypeName(void) const
Get Object Full Type Name.
virtual bool reload(const std::string &filename)
Re-reads objects from disk.
virtual void UnregisterParent(MObject *pob)
ObjectType
Base object type identifiers.
virtual ObjectMenu * optionMenu() const
const std::set< AWindow * > & WinList()
List of windows showing this object.
bool _referenceHasChanged
Reference has-changed flag.
virtual void setReferenceChanged()
AObject(const std::string &filename="")
virtual bool boundingBox2D(std::vector< float > &bmin, std::vector< float > &bmax) const
Bounding box in 2D views mode.
virtual const GLComponent * glAPI() const
OpenGL objects const API.
AObject * referentialInheritance() const
if not null, the object referential is inherited from this object
virtual std::vector< float > texValues(const std::vector< float > &pos, const Referential *orgRef) const
Gets the array of texture values at a given location.
virtual void setPalette(const AObjectPalette &palette)
virtual void setProperties(carto::Object options)
Same as setHeaderOptions() and used by it, allows passing a dictionary.
virtual bool printTalairachCoord(const Point3df &, const Referential *) const
should be replaced by a real referential
virtual void unregisterObservable(Observable *)
Called when an observable is destroyed, only called by Observable: don't use this function directly.
virtual void cleanup()
must be called by objects destructors - Must be explicitly called by each object destructor since it ...
virtual void RegisterParent(MObject *pob)
void setCopyFlag(bool x=true)
virtual const AObjectPalette * palette() const
virtual void setGeomExtrema()
Scans the object internals and determines its geometry extrema.
int _type
Should be static in each object class.
virtual void unregisterWindow(AWindow *window)
virtual const MObject * mObjectAPI() const
virtual void setInternalsChanged()
Notifies some underlying lower-level objects have changed.
std::string fileName() const
File name (if any) for loaded objects.
static std::string objectTypeName(int type)
void setHeaderOptions()
Set some object properties according to the header (.minf), such as material, palette etc.
void setName(const std::string &n)
static carto::rc_ptr< ObjectMenu > getObjectMenu(std::string type)
static void addObjectMenuRegistration(ObjectMenuRegistrerClass *)
virtual std::vector< float > voxelSize() const
Returns at least 4 sizes. For 3D objects, returns (1, 1, 1, 1)
void setUserModified(bool state=true)
if the object has been modified by user interaction, and needs saving
virtual int isMultiObject() const
maybe not necessary ?: we can use dynamic_cast instead
void SetVisibility(int v)
virtual bool isTransparent() const
virtual void setVoxelSize(const std::vector< float > &)
virtual float MinT() const
Obsolete, deprecated.
virtual void setReferential(Referential *ref)
static std::map< int, std::string > _objectTypeNames
type-to-name map
virtual void createDefaultPalette(const std::string &name="")
function called by getOrCreatePalette() - overloadable, need not be called directly
virtual void internalUpdate()
Updates the state of the object.
virtual ~AObject()
AObject subclasses must call cleanup() in their destructor.
int InMemory() const
For objects loading only when needed (not used yet...)
virtual float mixedTexValue(const std::vector< float > &pos, const Referential *orgRef) const
Gets a "mixed" texture value at a given space / time location.
Referential * _referential
Referentiel.
ParentList & parents()
List of multi-objects containing this one.
std::string name() const
Name shown in control window.
virtual void SetExtrema()
Scans the object internals and determines its (texture) extrema values.
static void setObjectMenu(std::string type, carto::rc_ptr< ObjectMenu > om)
Abstract base class Anatomist window.
Base class for all OpenGL objects in Anatomist (with OpenGL display lists)
Multi-object : base abstract class for objects that contain others.
This class has to be rewritten, it's really really a shame.......
This class can be subclassed to represent an object that the programmer wants to have observed.
A class can implement the Observer interface when it wants to be informed of changes in observable ob...
Referential: marker for transformations, with an associated color.
std::list< carto::rc_ptr< GLItem > > PrimList
#define DECLARE_GENERIC_OBJECT_TYPE(T)
ViewState holds information about how a view wants to see an object.