35#ifndef ANA_OBJECT_OBJECT_H
36#define ANA_OBJECT_OBJECT_H
43#include <cartodata/volume/volume.h>
44#include <cartobase/smart/rcptr.h>
45#include <cartobase/object/object.h>
74 typedef std::list<carto::rc_ptr<GLItem> >
PrimList;
188 std::vector<float> & bmax )
const;
205 std::vector<float> & bmax )
const;
337 int *vertex,
float *distance,
340 bool tex_only =
false,
341 int target_poly = -1 )
const;
364 int poly = -1 )
const;
368 int poly = -1 )
const;
385 virtual std::vector<float>
texValues(
const std::vector<float> & pos,
387 int poly = -1 )
const;
388 virtual std::vector<float>
389 texValues(
const std::vector<float> & pos,
int poly = -1 )
const;
391 const std::vector<float> & pos,
int axis,
const Referential* orgRef,
392 int poly = -1 )
const;
394 const std::vector<float> & pos,
int axis,
int poly = -1 )
const;
397 std::vector<std::string> & texlabels,
398 std::string & textype )
const;
401 virtual bool savable()
const {
return false; }
412 virtual bool reload(
const std::string & filename );
424 bool save(
const std::string & filename,
bool onlyIfModified );
426 virtual bool save(
const std::string & filename );
459 static std::list<AObject *>
load(
const std::string & filename );
473 static std::map<std::string, carto::rc_ptr<ObjectMenu> >
528 static std::map<std::string, carto::rc_ptr<ObjectMenu> >
545 std::vector<float> tval =
texValues( pos, poly );
549 std::vector<float>::const_iterator i, e = tval.end();
550 for( i=tval.begin(); i!=e; ++i )
552 return sum / tval.size();
Base Anatomist object (abstract)
void setFileName(const std::string &filename)
virtual const MObject * mObjectAPI() const
virtual bool hasTexture() const
Textured objects have values associated with a geometric coordinate.
ObjectMenu *(* ObjectMenuRegistrerFunction)(const AObject *objtype, ObjectMenu *menu)
dynamic menu registration function
void setType(int type)
Method to set type id, because type() is not virtual.
virtual AObjectPalette * palette()
Normally, getOrCreatePalette() should be used instead of this function in most cases.
virtual std::vector< float > voxelSize() const
Returns at least 4 sizes. For 3D objects, returns (1, 1, 1, 1)
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 std::map< std::string, carto::rc_ptr< ObjectMenu > > & getObjectMenuMap()
virtual const AObjectPalette * getOrCreatePalette() const
User normally calls this function.
virtual float mixedTexValue(const std::vector< float > &pos, const Referential *orgRef, int poly=-1) const
Gets a "mixed" texture value at a given space / time location.
AObject * referentialInheritance() const
if not null, the object referential is inherited from this object
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
virtual AObject * objectAt(const std::vector< float > &pos, float tol, const Referential *orgref, const Point3df &orggeom)
Same with origin window referential.
virtual const Material & material() const
virtual carto::rc_ptr< carto::Volume< float > > texValuesSeries(const std::vector< float > &pos, int axis, const Referential *orgRef, int poly=-1) const
virtual void adjustPalette()
Creates or updates object palette according to object values (if needed)
AObject(const AObject &)
copy constructor, protected and used only to reimplement clone()
virtual void SetMaterial(const Material &mat)
Referential * getReferential() const
AObjectPalette * _palette
Palette.
virtual const AObjectPalette * palette() const
std::set< AWindow * > _winList
virtual void getTextureLabels(const std::vector< float > &texvalues, std::vector< std::string > &texlabels, std::string &textype) const
carto::Object aimsMeshFromGLComponent()
const std::set< AWindow * > & WinList()
List of windows showing this object.
static carto::rc_ptr< ObjectMenu > getObjectMenu(std::string type)
virtual bool save(const std::string &filename)
virtual AObject * clone(bool shallow=true)
Makes a copy of the object, with a duplicated object structure, palette and material,...
virtual bool IsFusion2DAllowed()
virtual carto::rc_ptr< carto::Volume< float > > texValuesSeries(const std::vector< float > &pos, int axis, int poly=-1) const
virtual std::string toolTip() const
tooltip displayed in 3D views (HTML).
static void addObjectMenuRegistration(ObjectMenuRegistrerFunction)
virtual float MaxT() const
Obsolete, deprecated.
static std::list< AObject * > load(const std::string &filename)
Static object loader: creates an objects, loads its contents.
int type() const
Object type identifier.
const Referential * previousReferential() const
Referential that the object was in before the last change.
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.
friend class StaticInitializers
virtual MObject * mObjectAPI()
virtual Tree * optionTree() const
Menu tree for new options, see object/optionMatcher.h.
virtual void registerWindow(AWindow *window)
virtual void update(const Observable *observable, void *arg)
This method is called whenever the observed object is changed.
void setAllowsOverwriteOnSave(bool x)
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...
ParentList & Parents()
List of multi-objects containing this one. Obsolete: use parents()
virtual const GLComponent * glAPI() const
OpenGL objects const API.
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...
virtual std::string objectFullTypeName(void) const
Get Object Full Type Name.
virtual bool reload(const std::string &filename)
Re-reads objects from disk.
virtual AObject * objectAt(const std::vector< float > &pos, float tol=0)
Find the object (sub-object) at given postion with a tolerence.
virtual void UnregisterParent(MObject *pob)
ObjectType
Base object type identifiers.
@ OTHER
External object type (unknown from the base anatomist library)
virtual GLComponent * glAPI()
OpenGL objects API.
bool _referenceHasChanged
Reference has-changed flag.
virtual void setReferenceChanged()
const ParentList & parents() const
List of multi-objects containing this one.
AObject(const std::string &filename="")
virtual bool boundingBox2D(std::vector< float > &bmin, std::vector< float > &bmax) const
Bounding box in 2D views mode.
virtual AObject * fallbackReferentialInheritance() const
object to take referential from when no ref is assigned
virtual std::vector< float > texValues(const std::vector< float > &pos, int poly=-1) const
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 const AObject * nearestVertex(const std::vector< float > &pos, int *vertex, float *distance, float tol=-1, int *polygon=0, bool tex_only=false, int target_poly=-1) const
Get the nearest vertex to a given position.
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 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 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 void addObjectMenuRegistration(ObjectMenuRegistrerClass *)
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
ParentList & parents()
List of multi-objects containing this one.
virtual Material & GetMaterial()
AObject *& _referentialInheritance()
provide access to derived classes
virtual ObjectMenu * optionMenu() const
virtual void internalUpdate()
Updates the state of the object.
virtual ~AObject()
AObject subclasses must call cleanup() in their destructor.
const PrimList & primitives() const
int InMemory() const
For objects loading only when needed (not used yet...)
Referential * _referential
Referentiel.
virtual std::vector< float > texValues(const std::vector< float > &pos, const Referential *orgRef, int poly=-1) const
Gets the array of texture values at a given location.
bool allowsOverwriteOnSave() const
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)
OpenGL item (display list, texture, ...) with reference counter and cleanup upon destruction.
Multi-object : base abstract class for objects that contain others.
This class has to be rewritten, it's really really a shame.......
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
DataTypeTraits< T >::LongType sum(const Volume< T > &vol)
#define DECLARE_GENERIC_OBJECT_TYPE(T)
ViewState holds information about how a view wants to see an object.
AimsVector< float, 3 > Point3df