Commit e4b0abb3 authored by Tao Zhong's avatar Tao Zhong

Merge branch 'develop' into 'master'

parents 57e8dec1 2967ff71
Pipeline #15971 failed with stages
in 11 seconds
build/
backup*
cmake-build-debug/
.DS_Store
.idea
examples/
bin/
tests/
.vscode
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.dll
*.dylib
# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
# Qt unit tests
target_wrapper.*
# QtCreator
*.autosave
# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*
# QtCreator CMake
CMakeLists.txt.user*
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# Change Log
All notable changes to this project will be documented in this file.
## v0.8.6 [08.01.2019]
## Added
- Add zoom extents option #64
- Add zoom Windows option #64
- Add wirte ini-files feature #27
## Changed
- Improve statbility #105
- Use panning mode by middle button
## Bugs fixed
- Fix shortcut for "Del"
## v0.8.5 [02.11.2018]
## Added
- Add Auto Saving function #67
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -57,6 +57,7 @@
<addaction name="actionAuto_Definition"/>
<addaction name="actionGather_data"/>
<addaction name="actionLandmarkWidget"/>
<addaction name="actionNew_Inifile"/>
</widget>
<widget class="QMenu" name="menuView">
<property name="title">
......@@ -65,10 +66,12 @@
<addaction name="actiongridmode"/>
<addaction name="actionShow_Point_of_Origin"/>
<addaction name="actionRotate_90_deg_clockwise"/>
<addaction name="actionPanning_Mode"/>
<addaction name="separator"/>
<addaction name="actionanglesnap"/>
<addaction name="actionObjectsnap"/>
<addaction name="separator"/>
<addaction name="actionZoom_Windows"/>
<addaction name="actionZoom_Extents"/>
</widget>
<widget class="QMenu" name="menuEdit">
<property name="title">
......@@ -124,7 +127,6 @@
<addaction name="separator"/>
<addaction name="actiongridmode"/>
<addaction name="actionObjectsnap"/>
<addaction name="actionPanning_Mode"/>
<addaction name="separator"/>
<addaction name="actionRoom"/>
</widget>
......@@ -704,6 +706,44 @@
<bool>true</bool>
</property>
</action>
<action name="actionNew_Inifile">
<property name="text">
<string>New Inifile</string>
</property>
<property name="shortcut">
<string>Meta+I</string>
</property>
</action>
<action name="actionBack_to_Origin">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Back to Origin</string>
</property>
<property name="shortcut">
<string>Meta+O</string>
</property>
<property name="visible">
<bool>true</bool>
</property>
</action>
<action name="actionZoom_Windows">
<property name="text">
<string>Zoom Windows</string>
</property>
<property name="shortcut">
<string>Meta+W</string>
</property>
</action>
<action name="actionZoom_Extents">
<property name="text">
<string>Zoom Extents</string>
</property>
<property name="shortcut">
<string>Meta+E</string>
</property>
</action>
</widget>
<resources>
<include location="../Resources/resources.qrc"/>
......
......@@ -20,19 +20,26 @@ greaterThan(QT_MAJOR_VERSION, 4):QT += widgets
TEMPLATE = app
TARGET = JPSeditor
CONFIG += qt xml gui;
CONFIG += c++11
QMAKE_CXXFLAGS += -std=c++11
QMAKE_CXXFLAGS += -static
#QMAKE_CXXFLAGS += -static-libgcc
#QMAKE_CXXFLAGS += -static-libstdc++
#QMAKE_CXXFLAGS_WARN_ON = -Wall -Wno-unused-parameter
FORMS += \
forms/mainwindow.ui \
forms/roomwidget.ui \
forms/widgetlandmark.ui \
forms/widgetsettings.ui \
forms/settingdialog.ui \
forms/inifilewidget.ui \
forms/settingdialog.ui
HEADERS += \
src/mainWindow.h \
......@@ -68,7 +75,10 @@ HEADERS += \
src/AutomaticRoomIdentification/roomdefinition.h \
src/AutomaticRoomIdentification/roomidentification.h \
src/dtrace.h \
src/settingdialog.h
src/settingdialog.h \
src/tinyxml/tinystr.h \
src/tinyxml/tinyxml.h \
src/inifilewidget.h \
SOURCES += \
......@@ -95,7 +105,12 @@ SOURCES += \
src/jpsregion.cpp \
src/AutomaticRoomIdentification/roomdefinition.cpp \
src/AutomaticRoomIdentification/roomidentification.cpp \
src/settingdialog.cpp
src/settingdialog.cpp \
src/tinyxml/tinystr.cpp \
src/tinyxml/tinyxml.cpp \
src/tinyxml/tinyxmlerror.cpp \
src/tinyxml/tinyxmlparser.cpp \
src/inifilewidget.cpp \
#INCLUDEPATH += D:/boost_1_59_0/boost_1_59_0
......@@ -106,7 +121,7 @@ RESOURCES += \
RC_FILE = Resources/jpseditor.rc
#osx fix
ICON = Resources/jpseditor.icns
#INCLUDEPATH += $$(ROOTSYS)/include
CONFIG(debug, debug|release) {
......@@ -137,6 +152,9 @@ MOC_DIR = $$DESTDIR/.moc
RCC_DIR = $$DESTDIR/.qrc
UI_DIR = $$DESTDIR/.u
demos.path = /usr/local/bin/jpseditor
demos.files = examples/*
INSTALLS += demos
target.path = /usr/local/bin/jpseditor
......
......@@ -67,7 +67,7 @@ jpsGraphicsView::jpsGraphicsView(QWidget* parent, jpsDatamanager *datamanager):Q
statDoor=false;
statExit=false;
_statHLine=false;
statPanning=false;
statzoomwindows=false;
_statCopy=0;
statLandmark=false;
markedLandmark=nullptr;
......@@ -179,7 +179,7 @@ void jpsGraphicsView::mouseMoveEvent(QMouseEvent *mouseEvent)
}
if (midbutton_hold && statPanning)
if (midbutton_hold)
{
translations(old_pos);
}
......@@ -521,6 +521,19 @@ void jpsGraphicsView::mouseReleaseEvent(QMouseEvent *event)
emit RegionDefCompleted();
_regionDef=false;
}
else if(statzoomwindows)
{
this->fitInView(currentSelectRect->rect(),Qt::KeepAspectRatio);
gl_scale_f=1/this->transform().m11();
//translations
QPointF old_pos;
old_pos.setX(pos.x()+translation_x);
old_pos.setY(pos.y()+translation_y);
translations(old_pos);
statzoomwindows=false;
}
else
{
// Select lines by creating a rect with the cursor
......@@ -1634,14 +1647,11 @@ void jpsGraphicsView::delete_marked_lines()
RemoveIntersections(marked_lines[i]);
delete marked_lines[i]->get_line();
qDebug()<< "jpsGraphicsView::delete_marked_lines(): Delete undefined line!";
//marked_lines[i]->set_line(nullptr);
delete marked_lines[i];
line_vector.removeOne(marked_lines[i]);
}
marked_lines.clear();
......@@ -1870,40 +1880,6 @@ void jpsGraphicsView::en_disableWall()
}
bool jpsGraphicsView::statusPanning()
{
return statPanning;
}
void jpsGraphicsView::en_disablePanning()
{
statPanning=!statPanning;
statWall=false;
statDoor=false;
statExit=false;
_statHLine=false;
statLandmark=false;
if (statPanning==false)
{
QString info = "Panning Mode is off!";
QMessageBox messageBox;
messageBox.information(0,tr("Panning Mode"),info);
}
else
{
QString info = "\
Panning Mode is on!\n\
Press middle button to move view";
QMessageBox messageBox;
messageBox.information(0,tr("Panning Mode"),info);
}
}
bool jpsGraphicsView::statusWall()
{
......@@ -2032,3 +2008,8 @@ void jpsGraphicsView::ScaleLines(const double &factor)
}
}
void jpsGraphicsView::selectedWindows()
{
statzoomwindows=true;
}
......@@ -82,9 +82,6 @@ public:
bool statusLandmark();
void en_disableLandmark();
bool statusPanning();
void en_disablePanning();
// global functions
qreal get_scale_f();
void take_l_from_lineEdit(const qreal &length);
......@@ -99,6 +96,7 @@ public:
void AutoZoom();
qreal CalcGridSize();
void ShowOrigin();
void selectedWindows();
//Catch lines, points and intersections
......@@ -205,7 +203,6 @@ private:
bool statDoor;
bool statExit;
bool statLandmark;
bool statPanning;
bool _statHLine;
int _statCopy;
QPointF _copyOrigin;
......@@ -247,6 +244,8 @@ private:
ActionStack _undoStack;
ActionStack _redoStack;
//View
bool statzoomwindows;
signals:
void mouse_moved();
......
......@@ -1580,15 +1580,38 @@ void jpsDatamanager::remove_all()
void jpsDatamanager::remove_marked_lines()
{
dtrace("Enter jpsDatamanager::remove_marked_lines");
QList<jpsLineItem* > marked_lines = _mView->get_markedLines();
QList<jpsObstacle*> obstacle_list = this->get_obstaclelist();
QList<jpsRoom* > cList= this->get_roomlist();
for (int i=0; i<marked_lines.size(); i++)
{
if (marked_lines[i]->is_Wall()==true)
if (marked_lines[i]->is_Wall()==true && obstacle_list.size()>0)
{
for (int m=0; m<obstacle_list.size(); m++)
{
QList<jpsLineItem* > deleted_obstacle_lines;
for (int n=0; n<obstacle_list[m]->get_listWalls().size(); n++)
{
if(marked_lines[i]==obstacle_list[m]->get_listWalls()[n])
{
deleted_obstacle_lines.push_back(obstacle_list[m]->get_listWalls()[n]);
}
}
obstacle_list[m]->removeWall(deleted_obstacle_lines);
qDebug()<< "jpsDatamanager::remove_marked_lines(): Obstacle line is deleted!";
}
}
else
{
qDebug()<< "jpsDatamanager::remove_marked_lines(): Marked line isn't in obstacle!";
}
if (marked_lines[i]->is_Wall()==true && cList.size()>0)
{
QList<jpsRoom* > cList= this->get_roomlist();
for (int j=0; j<cList.size(); j++)
{ QList<jpsLineItem* > delete_candidates;
{
QList<jpsLineItem* > delete_candidates;
for (int k=0; k<cList[j]->get_listWalls().size(); k++)
{
if (marked_lines[i]==cList[j]->get_listWalls()[k])
......@@ -1597,6 +1620,7 @@ void jpsDatamanager::remove_marked_lines()
}
}
cList[j]->removeWall(delete_candidates);
qDebug()<< "jpsDatamanager::remove_marked_lines(): Wall line is deleted!";
}
}
......@@ -1611,9 +1635,13 @@ void jpsDatamanager::remove_marked_lines()
break;
}
}
qDebug()<< "jpsDatamanager::remove_marked_lines(): Door line is deleted!";
}
else
{
qDebug()<< "jpsDatamanager::remove_marked_lines(): Marked line isn't defined!";
}
}
dtrace("Leave jpsDatamanager::remove_marked_lines");
}
void jpsDatamanager::set_view(jpsGraphicsView *view)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
#ifndef INIFILEWIDGET_H
#define INIFILEWIDGET_H
#include <QWidget>
#include "tinyxml/tinyxml.h"
namespace Ui {
class InifileWidget;
}
class InifileWidget : public QWidget
{
Q_OBJECT
public:
explicit InifileWidget(QWidget *parent = nullptr);
~InifileWidget();
private slots:
//Inside Inifilewidget
void on_pushButton_write_clicked();
void on_pushButton_read_clicked();
//Inside Tab General
void on_checkBox_general_1_clicked();
void on_checkBox_general_2_clicked();
//Inside Tab Groups
void on_spinBox_groups_1_valueChanged(int);
void on_comboBox_groups_1_currentIndexChanged(int index);
//Inside Tab Agents
void on_spinBox_agents_gcfm_1_valueChanged(int);
void on_spinBox_agents_gompertz_1_valueChanged(int);
void on_spinBox_agents_tordeux_1_valueChanged(int);
void on_spinBox_agents_gradnav_1_valueChanged(int);
void on_spinBox_agents_krausz_1_valueChanged(int);
//Inside Tab Constraints
void on_spinBox_constraints_1_valueChanged(int);
void on_spinBox_constraints_2_valueChanged(int);
//Inside Tab Goals
void on_spinBox_goals_1_valueChanged(int);
private:
Ui::InifileWidget *ui;
bool CheckHeaderData();
bool CheckTrafficData();
bool CheckRoutingData();
bool CheckAgentData();
bool CheckModelGcfmData();
bool CheckAgentGcfmData();
bool CheckModelGompData();
bool CheckAgentGompData();
bool CheckModelTordData();
bool CheckAgentTordData();
bool CheckModelGradData();
bool CheckAgentGradData();
bool CheckModelKrauData();
bool CheckAgentKrauData();
bool CheckRouteChoiceData();
QString WriteHeaderData();
QString WriteTrafficData();
QString WriteRoutingData();
QString WriteAgentData();
QString WriteModelGcfmData();
QString WriteModelGompData();
QString WriteModelTordData();
QString WriteModelGradData();
QString WriteModelKrauData();
QString WriteRouteChoiceData();
void ReadJuPedSimData(TiXmlElement* JuPedSim);
void ReadHeaderData(TiXmlElement* JuPedSim);
void ReadTrafficData(TiXmlElement* JuPedSim);
void ReadRoutingData(TiXmlElement* JuPedSim);
void ReadAgentData(TiXmlElement* JuPedSim);
void ReadModelData(TiXmlElement* JuPedSim);
void ReadRouteChoiceData(TiXmlElement* JuPedSim);
};
#endif // INIFILEWIDGET_H
......@@ -145,13 +145,10 @@ MWindow :: MWindow() {
connect(actionDoor,SIGNAL(triggered(bool)),this,SLOT(dis_selectMode()));
connect(actionExit,SIGNAL(triggered(bool)),this,SLOT(dis_selectMode()));
connect(actionScale,SIGNAL(triggered(bool)),this,SLOT(enableScale()));
// Tab View
connect(actionRotate_90_deg_clockwise,SIGNAL(triggered(bool)),this,SLOT(rotate()));
connect(actionShow_Point_of_Origin,SIGNAL(triggered(bool)),this,SLOT(ShowOrigin()));
// Panning mode
connect(actionPanning_Mode,SIGNAL(triggered(bool)),this,SLOT(en_disablePanning()));
// Length edit
// connect(length_edit,SIGNAL(returnPressed()),this,SLOT(send_length()));
......@@ -198,8 +195,6 @@ MWindow :: MWindow() {
// room type data gathering
connect(actionGather_data,SIGNAL(triggered(bool)),this, SLOT(GatherData()));
}
MWindow::~MWindow()
......@@ -520,7 +515,7 @@ void MWindow::info(){
2018. All rights reserved.";
QMessageBox messageBox;
messageBox.information(0,tr("About..."),info);
messageBox.information(nullptr,tr("About..."),info);
}
void MWindow::anglesnap()
......@@ -607,8 +602,8 @@ void MWindow::delete_marked_lines()
void MWindow::send_length()
{
qreal length = length_edit->text().toFloat();
if(length != 0 )
qreal length = length_edit->text().toDouble();
if(length != 0)
{
mview->take_l_from_lineEdit(length);
}
......@@ -617,8 +612,8 @@ void MWindow::send_length()
void MWindow::send_xy()
{
qreal x = x_edit->text().toFloat();
qreal y = x_edit->text().toFloat();
qreal x = x_edit->text().toDouble();
qreal y = x_edit->text().toDouble();
QPointF endpoint;
endpoint.setX(x);
......@@ -731,7 +726,7 @@ void MWindow::ScaleLines()
{
if (_statScale)
{
qreal factor = length_edit->text().toFloat();
qreal factor = length_edit->text().toDouble();
mview->ScaleLines(factor);
length_edit->clear();
_statScale=false;
......@@ -832,11 +827,25 @@ QMap<QString, QString> MWindow::loadSettings()
return settingsmap;
}
// Panning mode
void MWindow::en_disablePanning()
void MWindow::on_actionNew_Inifile_triggered()
{
this->disableDrawing();
mview->en_disablePanning();
inifileWidget = new InifileWidget(this);
inifileWidget->show();
qDebug()<< "MWindow::on_actionNew_Inifile_triggered(): inifile widget is showed!";
}
void MWindow::on_actionBack_to_Origin_triggered()
{
mview->centerOn(QPointF(0.0,0.0)); //TODO: Ensure in any situation
}
void MWindow::on_actionZoom_Windows_triggered()
{
en_selectMode();
mview->selectedWindows();
}
void MWindow::on_actionZoom_Extents_triggered()
{
mview->AutoZoom();
}
......@@ -42,6 +42,8 @@
#include "datamanager.h"
#include "rooms.h"
#include "src/settingdialog.h"
#include "inifilewidget.h"
class MWindow : public QMainWindow, private Ui::MainWindow {
......@@ -54,6 +56,7 @@ public:
private:
roomWidget* rwidget;
widgetLandmark* lwidget;
InifileWidget * inifileWidget;
// WidgetSettings* _settings;
jpsDatamanager* dmanager;
jpsGraphicsView* mview;
......@@ -107,7 +110,6 @@ protected slots:
void en_disableExit();
void en_disableLandmark();
void en_disableHLine();
void en_disablePanning();
void disableDrawing();
void objectsnap();
......@@ -164,6 +166,10 @@ private slots:
//default setting
void saveSettings(QMap<QString, QString> settingsmap);
QMap<QString, QString> loadSettings();
void on_actionNew_Inifile_triggered();