00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef CEYLAN_LOCATABLE_H_
00028 #define CEYLAN_LOCATABLE_H_
00029
00030
00031 #include "CeylanEventSource.h"
00032 #include "CeylanEventListener.h"
00033 #include "CeylanTextDisplayable.h"
00034
00035
00036 #include <string>
00037
00038
00039 namespace Ceylan
00040 {
00041
00042
00043 namespace Maths
00044 {
00045
00046
00047 namespace Linear
00048 {
00049
00050
00051 class Matrix ;
00052
00053 }
00054
00055 }
00056
00057
00059 class CEYLAN_DLL LocatableException : public Ceylan::Exception
00060 {
00061
00062 public:
00063
00064 LocatableException( const std::string & message ) ;
00065
00066 virtual ~LocatableException() throw() ;
00067
00068 } ;
00069
00070
00071
00072
00078 class CEYLAN_DLL ReferentialChangedEvent : public Event
00079 {
00080
00081 public:
00082
00083 explicit ReferentialChangedEvent( EventSource & source ) ;
00084
00085 virtual ~ReferentialChangedEvent() throw() ;
00086
00087 } ;
00088
00089
00090
00091
00179 class CEYLAN_DLL Locatable : public EventSource, public EventListener
00180 {
00181
00182
00183 public:
00184
00185
00186
00201 explicit Locatable( Locatable & fatherLocatable ) ;
00202
00203
00204
00210 Locatable() ;
00211
00212
00213
00240 Locatable( Locatable & fatherLocatable,
00241 Maths::Linear::Matrix & localReferential ) ;
00242
00243
00244
00256 explicit Locatable( Maths::Linear::Matrix & localReferential ) ;
00257
00258
00260 virtual ~Locatable() throw() ;
00261
00262
00263
00274 virtual bool isAbsolute() const ;
00275
00276
00277
00284 virtual bool hasLocalReferential() const ;
00285
00286
00287
00296 virtual Maths::Linear::Matrix & getLocalReferential() const ;
00297
00298
00299
00306 virtual void setLocalReferential(
00307 Maths::Linear::Matrix & newGlobalReferential ) ;
00308
00309
00310
00320 virtual void blankLocalReferential() = 0 ;
00321
00322
00323
00329 virtual bool hasGlobalReferential() const ;
00330
00331
00332
00347 virtual Maths::Linear::Matrix & getGlobalReferential() ;
00348
00349
00350
00358 virtual bool isUpToDate() const ;
00359
00360
00361
00368 virtual void setUpToDateState( bool newState ) ;
00369
00370
00371
00382 virtual void beNotifiedOf( const Event & newEvent ) ;
00383
00384
00385
00396 virtual const std::string toString(
00397 VerbosityLevels level = high ) const ;
00398
00399
00400
00401
00402 protected:
00403
00404
00412 virtual void changed() ;
00413
00414
00415
00430 virtual void updateFromFather(
00431 const Maths::Linear::Matrix & upToDateFatherReferential ) = 0 ;
00432
00433
00434
00443 virtual void detachFromFather() ;
00444
00445
00446
00454 virtual const std::string describe( VerbosityLevels level ) const ;
00455
00456
00457
00458
00459
00460
00461
00468 Locatable * _father ;
00469
00470
00479 Maths::Linear::Matrix * _localReferential ;
00480
00481
00490 Maths::Linear::Matrix * _globalReferential ;
00491
00492
00493
00494
00502 ReferentialChangedEvent * _changedEvent ;
00503
00504
00505
00506 private:
00507
00508
00516 bool _isUpToDate ;
00517
00518
00519
00526
00527
00528
00537 Locatable & operator = ( const Locatable & source ) ;
00538
00539
00540 } ;
00541
00542 }
00543
00544
00545
00546 #endif // CEYLAN_LOCATABLE_H_
00547