Index: code/branches/presentation3/src/orxonox/interfaces/RadarViewable.cc
===================================================================
--- code/branches/presentation3/src/orxonox/interfaces/RadarViewable.cc	(revision 6912)
+++ code/branches/presentation3/src/orxonox/interfaces/RadarViewable.cc	(revision 6942)
@@ -29,15 +29,9 @@
 #include "RadarViewable.h"
 
-#include <OgreSceneManager.h>
-#include <OgreSceneNode.h>
-#include <OgreEntity.h>
-
 #include "util/StringUtils.h"
 #include "core/CoreIncludes.h"
-#include "tools/DynamicLines.h"
 #include "worldentities/WorldEntity.h"
 #include "Radar.h"
 #include "Scene.h"
-#include "overlays/Map.h"
 
 namespace orxonox
@@ -46,11 +40,9 @@
         @brief Constructor.
     */
-    RadarViewable::RadarViewable()
-        : MapNode_(NULL)
-        , MapEntity_(NULL)
-        , line_(NULL)
-        , LineNode_(NULL)
-        , isHumanShip_(false)
+    RadarViewable::RadarViewable(BaseObject* creator)
+        : isHumanShip_(false)
         , bVisibility_(true)
+        , bInitialized_(false)
+        , creator_(creator)
         , radarObjectCamouflage_(0.0f)
         , radarObjectShape_(Dot)
@@ -60,11 +52,7 @@
 
         this->uniqueId_=getUniqueNumberString();
-/*
-        if(Map::getSingletonPtr() && Map::getSingletonPtr()->getMapSceneManagerPtr())
-        {
-            this->addEntity();
-        }
-
-        */
+        this->radar_ = this->creator_->getScene()->getRadar();
+        this->radar_->addRadarObject(this);
+        this->bInitialized_ = true;
     }
 
@@ -72,76 +60,19 @@
     RadarViewable::~RadarViewable()
     {
-        if (this->isHumanShip_ && MapNode_)
-            MapNode_->removeAllChildren();
-
-        if (MapNode_)
-            delete MapNode_;
-
-        if (MapEntity_)
-            delete MapEntity_;
-
-        if (line_)
-            delete line_;
-
-        if (LineNode_)
-            delete LineNode_;
+        if( this->bInitialized_ )
+            this->radar_->removeRadarObject(this);
     }
 
-    void RadarViewable::addMapEntity()
-    { //TODO Check shape and add accordantly
-        if( this->MapNode_ && !this->MapEntity_ && Map::getSingletonPtr() && Map::getSingletonPtr()->getMapSceneManagerPtr() )
-        {
-            COUT(0) << "Adding " << this->uniqueId_ << " to Map.\n";
-            this->MapEntity_ = Map::getSingletonPtr()->getMapSceneManagerPtr()->createEntity( this->uniqueId_, "drone.mesh");
-            /*this->line_ =  Map::getSingletonPtr()->getMapSceneManagerPtr()->createManualObject(this->uniqueId_ + "_l");
-            this->line_->begin("Map/line_", Ogre::RenderOperation::OT_LINE_STRIP);
-            //line_->position(0, -it->getRVWorldPosition().y, 0);
-            //this->line_->position(0, -20, 0);
-            this->line_->position(0, 0, -10); //Front Arrow
-            this->line_->position(0, 0, 0);
-
-            this->line_->end(); */
-            this->line_ = new Ogre::DynamicLines(Ogre::RenderOperation::OT_LINE_LIST);
-            this->line_->addPoint( Vector3(0,0,0) );
-            this->line_->addPoint( Vector3(0,0,0) );
-
-            this->MapNode_->attachObject( this->MapEntity_ );
-
-            this->LineNode_ = this->MapNode_->createChildSceneNode();
-            this->LineNode_->attachObject( this->line_ );
-        }
-        else
-        {
-            COUT(0) << "Unable to load " << this->uniqueId_ << " to Map.\n";
-        }
-    }
-
-    void RadarViewable::updateMapPosition()
-    {
-        if( this->MapNode_ )
-        {
-            this->MapNode_->setPosition( this->getRVWorldPosition() );
-            this->MapNode_->translate( this->getRVOrientedVelocity(), static_cast<Ogre::Node::TransformSpace>(3) );
-            this->MapNode_->setOrientation( this->getWorldEntity()->getOrientation() );
-//Vector3 v = this->getRVWorldPosition();
-            //this->line_->setPoint(1, Vector3(0,v.y,0) );
-            this->line_->setPoint(1, Vector3( 0, static_cast<float>(static_cast<int>( -Map::getSingletonPtr()->movablePlane_->getDistance( this->getRVWorldPosition() ) ) ) ,0 ));
-            this->line_->update();
-            if( Map::getSingletonPtr()->playerShipNode_ )
-                this->LineNode_->setDirection( Map::getSingletonPtr()->playerShipNode_->getLocalAxes().GetColumn(1) ,Ogre::Node::TS_WORLD,Vector3::UNIT_Y);
-        }
-    }
-
-    void RadarViewable::setRadarObjectDescription(const std::string& str)
-    {
-        Radar* radar = this->getWorldEntity()->getScene()->getRadar();
-        if (radar)
-            this->radarObjectShape_ = radar->addObjectDescription(str);
-        else
-        {
-            CCOUT(2) << "Attempting to access the radar, but the radar is non existent." << std::endl;
-        }
-        this->radarObjectDescription_ = str;
-    }
+//     void RadarViewable::setRadarObjectDescription(const std::string& str)
+//     {
+//         Radar* radar = this->getWorldEntity()->getScene()->getRadar();
+//         if (radar)
+//             this->radarObjectShape_ = radar->addObjectDescription(str);
+//         else
+//         {
+//             CCOUT(2) << "Attempting to access the radar, but the radar is non existent." << std::endl;
+//         }
+//         this->radarObjectDescription_ = str;
+//     }
 
     const Vector3& RadarViewable::getRVWorldPosition() const
@@ -167,3 +98,8 @@
         }
     }
+    
+    void RadarViewable::settingsChanged()
+    {
+        this->radar_->radarObjectChanged(this);
+    }
 }
