Changeset 6727 for code/branches/hudelements/src/orxonox/interfaces
- Timestamp:
- Apr 14, 2010, 7:54:41 PM (15 years ago)
- Location:
- code/branches/hudelements/src/orxonox/interfaces
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hudelements/src/orxonox/interfaces/RadarListener.h
r5781 r6727 41 41 virtual ~RadarListener() { } 42 42 43 virtual void displayObject(RadarViewable* viewable, bool bIsMarked) = 0; 43 virtual void addObject(RadarViewable* viewable) = 0; 44 virtual void removeObject(RadarViewable* viewable) = 0; 45 virtual void objectChanged(RadarViewable* viewable) = 0; 44 46 virtual float getRadarSensitivity() const = 0; 45 47 virtual void radarTick(float dt) = 0; -
code/branches/hudelements/src/orxonox/interfaces/RadarViewable.cc
r6717 r6727 40 40 @brief Constructor. 41 41 */ 42 RadarViewable::RadarViewable( )42 RadarViewable::RadarViewable(BaseObject* creator) 43 43 : isHumanShip_(false) 44 44 , bVisibility_(true) 45 , bInitialized_(false) 46 , creator_(creator) 45 47 , radarObjectCamouflage_(0.0f) 46 48 , radarObjectShape_(Dot) … … 50 52 51 53 this->uniqueId_=getUniqueNumberString(); 54 this->creator_->getScene()->getRadar()->addRadarObject(this); 55 this->bInitialized_ = true; 52 56 } 53 57 … … 55 59 RadarViewable::~RadarViewable() 56 60 { 61 if( this->bInitialized_ ) 62 this->creator_->getScene()->getRadar()->removeRadarObject(this); 57 63 } 58 64 59 void RadarViewable::setRadarObjectDescription(const std::string& str)60 {61 Radar* radar = this->getWorldEntity()->getScene()->getRadar();62 if (radar)63 this->radarObjectShape_ = radar->addObjectDescription(str);64 else65 {66 CCOUT(2) << "Attempting to access the radar, but the radar is non existent." << std::endl;67 }68 this->radarObjectDescription_ = str;69 }65 // void RadarViewable::setRadarObjectDescription(const std::string& str) 66 // { 67 // Radar* radar = this->getWorldEntity()->getScene()->getRadar(); 68 // if (radar) 69 // this->radarObjectShape_ = radar->addObjectDescription(str); 70 // else 71 // { 72 // CCOUT(2) << "Attempting to access the radar, but the radar is non existent." << std::endl; 73 // } 74 // this->radarObjectDescription_ = str; 75 // } 70 76 71 77 const Vector3& RadarViewable::getRVWorldPosition() const … … 91 97 } 92 98 } 99 100 void RadarViewable::settingsChanged() 101 { 102 this->creator_->getScene()->getRadar()->radarObjectChanged(this); 103 } 93 104 } -
code/branches/hudelements/src/orxonox/interfaces/RadarViewable.h
r6717 r6727 40 40 namespace orxonox 41 41 { 42 class BaseObject; 43 42 44 /** 43 45 @brief Interface for receiving window events. … … 55 57 56 58 public: 57 RadarViewable( );59 RadarViewable(BaseObject* creator); 58 60 virtual ~RadarViewable(); 59 61 60 62 inline void setRadarObjectCamouflage(float camouflage) 61 { this->radarObjectCamouflage_ = camouflage; } 63 { 64 if( this->radarObjectCamouflage_ != camouflage ) 65 { 66 this->radarObjectCamouflage_ = camouflage; 67 this->settingsChanged(); 68 } 69 } 62 70 inline float getRadarObjectCamouflage() const 63 71 { return this->radarObjectCamouflage_; } 64 72 65 73 inline void setRadarObjectColour(const ColourValue& colour) 66 { this->radarObjectColour_ = colour; } 74 { 75 if(this->radarObjectColour_ != colour) 76 { 77 this->radarObjectColour_ = colour; 78 this->settingsChanged(); 79 } 80 } 67 81 inline const ColourValue& getRadarObjectColour() const 68 82 { return this->radarObjectColour_; } 69 83 70 void setRadarObjectDescription(const std::string& str);71 inline const std::string& getRadarObjectDescription() const72 { return this->radarObjectDescription_; }84 // void setRadarObjectDescription(const std::string& str); 85 // inline const std::string& getRadarObjectDescription() const 86 // { return this->radarObjectDescription_; } 73 87 74 88 inline void setRadarVisibility(bool b) 75 { this->bVisibility_ = b; } 89 { 90 if(b!=this->bVisibility_) 91 { 92 this->bVisibility_ = b; 93 this->settingsChanged(); 94 } 95 } 76 96 inline bool getRadarVisibility() const 77 97 { return this->bVisibility_; } … … 83 103 84 104 inline void setRadarObjectShape(Shape shape) 85 { this->radarObjectShape_ = shape; } 105 { 106 if( this->radarObjectShape_ != shape ) 107 { 108 this->radarObjectShape_ = shape; 109 this->settingsChanged(); 110 } 111 } 86 112 inline Shape getRadarObjectShape() const 87 113 { return this->radarObjectShape_; } 114 void settingsChanged(); 88 115 89 116 … … 98 125 void validate(const WorldEntity* object) const; 99 126 bool bVisibility_; 127 bool bInitialized_; 100 128 //Map 101 129 std::string uniqueId_; 130 BaseObject* creator_; 102 131 103 132
Note: See TracChangeset
for help on using the changeset viewer.