Skip to content
Snippets Groups Projects
Commit 3ed711b3 authored by Ulrich Kemloh's avatar Ulrich Kemloh
Browse files

option to display and change the color of obstacles

parent 565f3521
Branches
Tags
No related merge requests found
...@@ -539,7 +539,7 @@ border-color: rgb(255, 255, 255);</string> ...@@ -539,7 +539,7 @@ border-color: rgb(255, 255, 255);</string>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>450</width> <width>450</width>
<height>25</height> <height>22</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">
...@@ -591,6 +591,7 @@ border-color: rgb(255, 255, 255);</string> ...@@ -591,6 +591,7 @@ border-color: rgb(255, 255, 255);</string>
<addaction name="actionFloor_Color"/> <addaction name="actionFloor_Color"/>
<addaction name="actionWalls_Color"/> <addaction name="actionWalls_Color"/>
<addaction name="actionExits_Color"/> <addaction name="actionExits_Color"/>
<addaction name="actionObstacles_Color"/>
<addaction name="actionNavigation_Lines_Color"/> <addaction name="actionNavigation_Lines_Color"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionPedestrian_Shape"/> <addaction name="actionPedestrian_Shape"/>
...@@ -628,6 +629,7 @@ border-color: rgb(255, 255, 255);</string> ...@@ -628,6 +629,7 @@ border-color: rgb(255, 255, 255);</string>
<addaction name="actionShow_Wall_Caption"/> <addaction name="actionShow_Wall_Caption"/>
<addaction name="actionShow_Room_Caption"/> <addaction name="actionShow_Room_Caption"/>
<addaction name="actionShow_Door_Caption"/> <addaction name="actionShow_Door_Caption"/>
<addaction name="actionShow_Obstacles"/>
<addaction name="actionShow_Navigation_Lines"/> <addaction name="actionShow_Navigation_Lines"/>
<addaction name="actionShow_Geometry_Captions"/> <addaction name="actionShow_Geometry_Captions"/>
<addaction name="actionFirst_Group"/> <addaction name="actionFirst_Group"/>
...@@ -1319,6 +1321,22 @@ border-color: rgb(255, 255, 255);</string> ...@@ -1319,6 +1321,22 @@ border-color: rgb(255, 255, 255);</string>
<string>Ctrl+G</string> <string>Ctrl+G</string>
</property> </property>
</action> </action>
<action name="actionShow_Obstacles">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Show Obstacles</string>
</property>
</action>
<action name="actionObstacles_Color">
<property name="text">
<string>Obstacles Color</string>
</property>
</action>
</widget> </widget>
<resources> <resources>
<include location="icons.qrc"/> <include location="icons.qrc"/>
...@@ -2172,6 +2190,38 @@ border-color: rgb(255, 255, 255);</string> ...@@ -2172,6 +2190,38 @@ border-color: rgb(255, 255, 255);</string>
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>actionShow_Obstacles</sender>
<signal>triggered()</signal>
<receiver>mainwindow</receiver>
<slot>slotShowHideObstacles()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>224</x>
<y>199</y>
</hint>
</hints>
</connection>
<connection>
<sender>actionObstacles_Color</sender>
<signal>triggered()</signal>
<receiver>mainwindow</receiver>
<slot>slotChangeObstacleColor()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>224</x>
<y>199</y>
</hint>
</hints>
</connection>
</connections> </connections>
<slots> <slots>
<slot>slotHelpAbout()</slot> <slot>slotHelpAbout()</slot>
...@@ -2236,5 +2286,7 @@ border-color: rgb(255, 255, 255);</string> ...@@ -2236,5 +2286,7 @@ border-color: rgb(255, 255, 255);</string>
<slot>slotShowHideFloor()</slot> <slot>slotShowHideFloor()</slot>
<slot>slotChangeFloorColor()</slot> <slot>slotChangeFloorColor()</slot>
<slot>slotShowGeometryStructure()</slot> <slot>slotShowGeometryStructure()</slot>
<slot>slotChangeObstacleColor()</slot>
<slot>slotShowHideObstacles()</slot>
</slots> </slots>
</ui> </ui>
...@@ -1515,6 +1515,23 @@ void MainWindow::slotChangeFloorColor() ...@@ -1515,6 +1515,23 @@ void MainWindow::slotChangeFloorColor()
delete colorDialog; delete colorDialog;
} }
void MainWindow::slotChangeObstacleColor()
{
QColorDialog* colorDialog = new QColorDialog(this);
colorDialog->setToolTip("Choose a new color for the obstacles");
QColor col=colorDialog->getColor(Qt::white,this,"Select new obstalce color");
//the user may have cancelled the process
if(col.isValid()==false) return;
_visualisationThread->setObstacleColor(col);
QSettings settings;
settings.setValue("options/obstacle", col);
delete colorDialog;
}
void MainWindow::slotSetCameraPerspectiveToTop() void MainWindow::slotSetCameraPerspectiveToTop()
{ {
int p= 1; //TOP int p= 1; //TOP
...@@ -1680,6 +1697,13 @@ void MainWindow::loadAllSettings() ...@@ -1680,6 +1697,13 @@ void MainWindow::loadAllSettings()
slotShowHideNavLines(); slotShowHideNavLines();
qDebug()<<"show Navlines: "<<checked; qDebug()<<"show Navlines: "<<checked;
} }
if (settings.contains("view/showObstacles"))
{
bool checked = settings.value("view/showObstacles").toBool();
ui.actionShow_Obstacles->setChecked(checked);
slotShowHideObstacles();
qDebug()<<"show showObstacles: "<<checked;
}
if (settings.contains("view/showOnScreensInfos")) if (settings.contains("view/showOnScreensInfos"))
{ {
bool checked = settings.value("view/showOnScreensInfos").toBool(); bool checked = settings.value("view/showOnScreensInfos").toBool();
...@@ -1730,6 +1754,12 @@ void MainWindow::loadAllSettings() ...@@ -1730,6 +1754,12 @@ void MainWindow::loadAllSettings()
SystemSettings::setNavLinesColor(color); SystemSettings::setNavLinesColor(color);
qDebug()<<"Navlines color: "<<color; qDebug()<<"Navlines color: "<<color;
} }
if (settings.contains("options/obstaclesColor"))
{
QColor color = settings.value("options/obstaclesColor").value<QColor>();
SystemSettings::setObstacleColor(color);
qDebug()<<"Obstacles color: "<<color;
}
extern_force_system_update=true; extern_force_system_update=true;
} }
...@@ -1752,6 +1782,7 @@ void MainWindow::saveAllSettings() ...@@ -1752,6 +1782,7 @@ void MainWindow::saveAllSettings()
settings.setValue("view/showGeoCaptions", ui.actionShow_Geometry_Captions->isChecked()); settings.setValue("view/showGeoCaptions", ui.actionShow_Geometry_Captions->isChecked());
settings.setValue("view/showNavLines", ui.actionShow_Navigation_Lines->isChecked()); settings.setValue("view/showNavLines", ui.actionShow_Navigation_Lines->isChecked());
settings.setValue("view/showOnScreensInfos", ui.actionShow_Onscreen_Infos->isChecked()); settings.setValue("view/showOnScreensInfos", ui.actionShow_Onscreen_Infos->isChecked());
settings.setValue("view/showObstacles", ui.actionShow_Obstacles->isChecked());
//options: the color settings are saved in the methods where they are used. //options: the color settings are saved in the methods where they are used.
settings.setValue("options/listeningPort", SystemSettings::getListeningPort()); settings.setValue("options/listeningPort", SystemSettings::getListeningPort());
...@@ -1845,7 +1876,12 @@ void MainWindow::slotShowHideGeometryCaptions() ...@@ -1845,7 +1876,12 @@ void MainWindow::slotShowHideGeometryCaptions()
//SystemSettings::setShowCaptions(value); //SystemSettings::setShowCaptions(value);
//SystemSettings::setOnScreenInfos(value); //SystemSettings::setOnScreenInfos(value);
} }
void MainWindow::slotShowHideObstacles()
{
bool value=ui.actionShow_Obstacles->isChecked();
_visualisationThread->showObstacle(value);
SystemSettings::setShowObstacles(value);
}
void MainWindow::slotShowGeometryStructure() void MainWindow::slotShowGeometryStructure()
{ {
//QListView list; //QListView list;
... ...
......
...@@ -172,6 +172,8 @@ public Q_SLOTS: ...@@ -172,6 +172,8 @@ public Q_SLOTS:
void slotShowHideFloor(); void slotShowHideFloor();
/// shows/hide geometry captions /// shows/hide geometry captions
void slotShowHideGeometryCaptions(); void slotShowHideGeometryCaptions();
/// show hide the obstacles
void slotShowHideObstacles();
/// show pedestrians only without trail /// show pedestrians only without trail
void slotShowPedestrianOnly(); void slotShowPedestrianOnly();
...@@ -192,7 +194,6 @@ public Q_SLOTS: ...@@ -192,7 +194,6 @@ public Q_SLOTS:
/// enable/disable the pedestrian captions /// enable/disable the pedestrian captions
void slotShowPedestrianCaption(); void slotShowPedestrianCaption();
/// update the contrast /// update the contrast
void slotUpdateContrastSlider(int newValue); void slotUpdateContrastSlider(int newValue);
...@@ -237,8 +238,11 @@ public Q_SLOTS: ...@@ -237,8 +238,11 @@ public Q_SLOTS:
/// change the floor color /// change the floor color
void slotChangeFloorColor(); void slotChangeFloorColor();
/// change the obstacle color
void slotChangeObstacleColor();
/// show/hide onscreen information /// show/hide onscreen information
/// information include Time and pedestrians left in the facility /// information include Time and number pedestrians left in the facility
void slotShowOnScreenInfos(); void slotShowOnScreenInfos();
///show the detailed structure of the geometry ///show the detailed structure of the geometry
... ...
......
...@@ -53,12 +53,14 @@ bool SystemSettings::showWalls=true; ...@@ -53,12 +53,14 @@ bool SystemSettings::showWalls=true;
bool SystemSettings::showExits=true; bool SystemSettings::showExits=true;
bool SystemSettings::showNavLines=true; bool SystemSettings::showNavLines=true;
bool SystemSettings::showTrajectories=false; bool SystemSettings::showTrajectories=false;
bool SystemSettings::showObstacle=true;
unsigned short SystemSettings::port=8989; unsigned short SystemSettings::port=8989;
//double SystemSettings::bgColor[]= {1.0,1.0,1.0}; //double SystemSettings::bgColor[]= {1.0,1.0,1.0};
QColor SystemSettings::bgColor = QColor(Qt::white); QColor SystemSettings::bgColor = QColor(Qt::white);
QColor SystemSettings::floorColor = QColor(0,0,255); QColor SystemSettings::floorColor = QColor(0,0,255);
QColor SystemSettings::wallsColor = QColor(180,180,180);//180.0/255,180.0/255.0,180.0/255.0 QColor SystemSettings::wallsColor = QColor(180,180,180);//180.0/255,180.0/255.0,180.0/255.0
QColor SystemSettings::obstacleColor = QColor(180,180,180);//180.0/255,180.0/255.0,180.0/255.0
QColor SystemSettings::exitsColor = QColor(175,175,255); //175.0/255,175.0/255.0,255.0/255.0 QColor SystemSettings::exitsColor = QColor(175,175,255); //175.0/255,175.0/255.0,255.0/255.0
QColor SystemSettings::navLinesColor = QColor(Qt::white); QColor SystemSettings::navLinesColor = QColor(Qt::white);
...@@ -193,6 +195,16 @@ bool SystemSettings::getShowWalls() ...@@ -193,6 +195,16 @@ bool SystemSettings::getShowWalls()
return showWalls; return showWalls;
} }
void SystemSettings::setShowObstacles(bool status)
{
showObstacle=status;
}
bool SystemSettings::getShowObstacles()
{
return showObstacle;
}
void SystemSettings::setShowNavLines(bool status) void SystemSettings::setShowNavLines(bool status)
{ {
showNavLines=status; showNavLines=status;
...@@ -268,6 +280,16 @@ const QColor& SystemSettings::getNavLinesColor() ...@@ -268,6 +280,16 @@ const QColor& SystemSettings::getNavLinesColor()
return navLinesColor; return navLinesColor;
} }
const QColor& SystemSettings::getObstacleColor()
{
return obstacleColor;
}
void SystemSettings::setObstacleColor(const QColor &col)
{
obstacleColor=col;
}
void SystemSettings::setNavLinesColor(const QColor &col) void SystemSettings::setNavLinesColor(const QColor &col)
{ {
navLinesColor=col; navLinesColor=col;
... ...
......
...@@ -83,6 +83,10 @@ public: ...@@ -83,6 +83,10 @@ public:
void static setShowWalls(bool status); void static setShowWalls(bool status);
bool static getShowWalls(); bool static getShowWalls();
//set/get the obstacles visibility
void static setShowObstacles(bool status);
bool static getShowObstacles();
// set/get the navigation lines visibility // set/get the navigation lines visibility
void static setShowNavLines(bool status); void static setShowNavLines(bool status);
bool static getShowNavLines(); bool static getShowNavLines();
...@@ -111,11 +115,13 @@ public: ...@@ -111,11 +115,13 @@ public:
static const QColor& getNavLinesColor(); static const QColor& getNavLinesColor();
void static setNavLinesColor(const QColor &col); void static setNavLinesColor(const QColor &col);
static const QColor& getObstacleColor();
void static setObstacleColor(const QColor &col);
/// set/get pedestrian private sphere ellipse resolution /// set/get pedestrian private sphere ellipse resolution
int static getEllipseResolution(); int static getEllipseResolution();
void static setEllipseResolution(int resolution); void static setEllipseResolution(int resolution);
/// set/get the pedestrian shape /// set/get the pedestrian shape
/// 0 for default, 1 for Ellipse, 2 for pinguins /// 0 for default, 1 for Ellipse, 2 for pinguins
void static setPedestrianShape(int shape); void static setPedestrianShape(int shape);
...@@ -200,6 +206,7 @@ private: ...@@ -200,6 +206,7 @@ private:
static bool showGeometry; static bool showGeometry;
static bool showGeometryCaptions; static bool showGeometryCaptions;
static bool showFloor; static bool showFloor;
static bool showObstacle;
static bool showWalls; static bool showWalls;
static bool showExits; static bool showExits;
static bool showNavLines; static bool showNavLines;
...@@ -209,6 +216,7 @@ private: ...@@ -209,6 +216,7 @@ private:
static QColor floorColor; static QColor floorColor;
static QColor wallsColor; static QColor wallsColor;
static QColor exitsColor; static QColor exitsColor;
static QColor obstacleColor;
static QColor navLinesColor; static QColor navLinesColor;
static int ellipseResolution; static int ellipseResolution;
static int pedestriansColor[3][3]; // 3 groups, and 3 color per groups static int pedestriansColor[3][3]; // 3 groups, and 3 color per groups
... ...
......
...@@ -343,17 +343,18 @@ void ThreadVisualisation::run() ...@@ -343,17 +343,18 @@ void ThreadVisualisation::run()
setGeometryVisibility(SystemSettings::getShowGeometry()); setGeometryVisibility(SystemSettings::getShowGeometry());
setOnscreenInformationVisibility(SystemSettings::getOnScreenInfos()); setOnscreenInformationVisibility(SystemSettings::getOnScreenInfos());
showFloor(SystemSettings::getShowFloor()); showFloor(SystemSettings::getShowFloor());
showWalls((SystemSettings::getShowWalls())); showWalls(SystemSettings::getShowWalls());
showDoors((SystemSettings::getShowExits())); showObstacle(SystemSettings::getShowObstacles());
showNavLines((SystemSettings::getShowNavLines())); showDoors(SystemSettings::getShowExits());
showNavLines(SystemSettings::getShowNavLines());
setGeometryLabelsVisibility(SystemSettings::getShowGeometryCaptions()); setGeometryLabelsVisibility(SystemSettings::getShowGeometryCaptions());
setBackgroundColor(SystemSettings::getBackgroundColor()); setBackgroundColor(SystemSettings::getBackgroundColor());
setWallsColor(SystemSettings::getWallsColor()); setWallsColor(SystemSettings::getWallsColor());
setObstacleColor(SystemSettings::getObstacleColor());
setFloorColor(SystemSettings::getFloorColor()); setFloorColor(SystemSettings::getFloorColor());
setExitsColor(SystemSettings::getExitsColor()); setExitsColor(SystemSettings::getExitsColor());
setNavLinesColor(SystemSettings::getNavLinesColor()); setNavLinesColor(SystemSettings::getNavLinesColor());
_renderWinInteractor->Start(); _renderWinInteractor->Start();
...@@ -431,6 +432,10 @@ void ThreadVisualisation::showFloor(bool status) ...@@ -431,6 +432,10 @@ void ThreadVisualisation::showFloor(bool status)
{ {
_geometry.ShowFloor(status); _geometry.ShowFloor(status);
} }
void ThreadVisualisation::showObstacle(bool status)
{
_geometry.ShowObstacles(status);
}
void ThreadVisualisation::initGlyphs2D() void ThreadVisualisation::initGlyphs2D()
{ {
...@@ -793,6 +798,13 @@ void ThreadVisualisation::setFloorColor(const QColor &color) ...@@ -793,6 +798,13 @@ void ThreadVisualisation::setFloorColor(const QColor &color)
_geometry.ChangeFloorColor(rbgColor); _geometry.ChangeFloorColor(rbgColor);
} }
void ThreadVisualisation::setObstacleColor(const QColor &color)
{
double rbgColor[3];
QcolorToDouble(color,rbgColor);
_geometry.ChangeObstaclesColor(rbgColor);
}
void ThreadVisualisation::setGeometryLabelsVisibility(int v) void ThreadVisualisation::setGeometryLabelsVisibility(int v)
{ {
_geometry.ShowGeometryLabels(v); _geometry.ShowGeometryLabels(v);
... ...
......
...@@ -122,6 +122,9 @@ public: ...@@ -122,6 +122,9 @@ public:
/// change the floor color /// change the floor color
void setFloorColor(const QColor &color); void setFloorColor(const QColor &color);
/// change the obstacle color
void setObstacleColor(const QColor &color);
/// change the exits color. /// change the exits color.
void setExitsColor(const QColor &color); void setExitsColor(const QColor &color);
...@@ -140,6 +143,10 @@ public: ...@@ -140,6 +143,10 @@ public:
/// show/ hide the floor /// show/ hide the floor
void showFloor(bool status); void showFloor(bool status);
/// show/ hide the obstacles
void showObstacle(bool status);
/// show / hide stairs /// show / hide stairs
///not implemented ///not implemented
void showStairs(bool status); void showStairs(bool status);
... ...
......
...@@ -30,6 +30,7 @@ public: ...@@ -30,6 +30,7 @@ public:
void ShowWalls(bool status); void ShowWalls(bool status);
void ShowNavLines(bool status); void ShowNavLines(bool status);
void ShowFloor(bool status); void ShowFloor(bool status);
void ShowObstacles(bool status);
void ShowGeometryLabels(int status); void ShowGeometryLabels(int status);
bool RefreshView(); bool RefreshView();
void Clear(); void Clear();
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment