Browse Source

Update readme, G0 done

Tom Troppmann 4 years ago
parent
commit
a5f7a3c246

+ 19 - 0
README.md

@@ -19,5 +19,24 @@ A visualization tool for combinatorial optmization.
 <!-- 	ballot box with check &#9745;  
 		Entity: ballot box unchecked &#9744;
 -->
+#### Goals
+| Milostone | Goal | Comment | Done |
+| --------- | ---- | ------- | ---- |
+| MS1		| G0: Memory layout | Save efficient bits in the memory | &#9745; |
+|			| G1: File Reader | File reader who can detinguish between real values and integer and the bitstring. Should be recognize labels. | &#9744; |
+| MS2		| G2: Dockable widget | To have a gui widget that can be docked and the state should be saved. | &#9744; |
+| 			| G3: Line Graph | A line graph with axis label should be implemented | &#9744; |
+| 			| G4: Light redraw | Save the intermediate values to not calculate them each redraw | &#9744; | 
+
+
+
+#### Future Features 
+These features are not in a milestone or a goal yet but can be in the future.
+
+| Feature | Comment |
+| ------- | ------- |
+| FS0: Log-file in UTF-8 to binary data type | Saves disk space |
+| FS1: Multiple run view | Simmulateasly showing 2 or multiple runs to compare them |
+| FS2: Free up memory | Free up memory thats not needed when the visualization |
 
 

+ 2 - 2
metavis/SettingDialog.cpp

@@ -1,7 +1,7 @@
 #include "SettingDialog.h"
 #include <qdebug.h>
-SettingDialog::SettingDialog(QWidget *parent)
-	: QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
+SettingDialog::SettingDialog(QSettings* settings, QWidget* parent)
+	: QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint), settings(settings)
 {
 	ui.setupUi(this);
 	//manuel connect all button with buttonHandler

+ 3 - 1
metavis/SettingDialog.h

@@ -1,6 +1,7 @@
 #pragma once
 
 #include <QDialog>
+#include <qsettings.h>
 #include "ui_SettingDialog.h"
 #include <qabstractbutton.h>
 
@@ -12,11 +13,12 @@ class SettingDialog : public QDialog
 	Q_OBJECT
 
 public:
-	SettingDialog(QWidget *parent = Q_NULLPTR);
+	SettingDialog(QSettings* settings, QWidget *parent = Q_NULLPTR);
 	~SettingDialog();
 
 private:
 	Ui::SettingDialog ui;
+	QSettings* settings;
 	/**
 	 *  Apply the settings and close the SettingDialog afterwords.
 	 */

+ 0 - 1
metavis/Test.cpp

@@ -1 +0,0 @@
-#include "Test.h"

+ 0 - 8
metavis/Test.h

@@ -1,8 +0,0 @@
-#pragma once
-class Test
-{
-public:
-	int a = 0;
-	int b = 666;
-};
-

+ 25 - 0
metavis/dataTest.cpp

@@ -0,0 +1,25 @@
+#include "dataTest.h"
+#include <qdebug.h>
+#include <sstream>
+dataTest::dataTest()
+{
+	for (int i = 0; i < 1000; i++) {
+		entrys->push_back(solution(2000, i));
+	}
+	entrys->at(0).bits[34] = true;
+	solution sol = entrys->at(0);
+	
+	qDebug() << sol.toQString();
+}
+
+dataTest::~dataTest()
+{
+	free(entrys);
+}
+
+QString dataTest::solution::toQString()
+{
+	std::ostringstream os;
+	copy(bits.begin(), bits.end(), std::ostream_iterator<bool>(os, ""));
+	return QString::fromStdString(os.str());
+}

+ 29 - 0
metavis/dataTest.h

@@ -0,0 +1,29 @@
+#pragma once
+#include <bitset>
+#include <vector>
+#include <qstring.h>
+
+class dataTest
+{
+private:
+	/* struct for storing a calculated solution*/
+	struct solution {
+	public:
+		solution(int n, double objectiveFunctionValue = 0.0): bits(n), objectiveFunctionValue(objectiveFunctionValue){}
+		std::vector<bool> bits;
+		double objectiveFunctionValue;
+		QString toQString();
+	};
+public:
+	std::vector<solution>* entrys =  new std::vector<solution>();
+	/* Contructor of this test class*/
+	dataTest();
+	~dataTest();
+
+
+
+
+
+
+};
+

+ 3 - 1
metavis/main.cpp

@@ -1,9 +1,11 @@
 #include "metavis.h"
 #include <QtWidgets/QApplication>
-#include <iostream>
+#include "dataTest.h"
 
+/* entrance of the program */
 int main(int argc, char *argv[])
 {
+	dataTest test;
 	QApplication a(argc, argv);
 	metavis w;
 	w.show();

+ 39 - 2
metavis/metavis.cpp

@@ -1,15 +1,52 @@
 #include "metavis.h"
 #include "SettingDialog.h"
+#include <qstandardpaths.h>
+#include <qdebug.h>
+
 
 metavis::metavis(QWidget *parent)
 	: QMainWindow(parent)
 {
 	ui.setupUi(this);
+	/* create settings object*/
+	settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, "TK", "metavis", this);
+	readMainWindowSettings();
 }
 
 
 void metavis::openSetting() {
-	SettingDialog settings(this);
+	SettingDialog settingDialog(settings, this);
 	/* Blocking operation */
-	settings.exec(); 
+	settingDialog.exec();
+}
+
+metavis::~metavis()
+{
+	writeActualMainWindowSettings();
+}
+
+void metavis::writeActualMainWindowSettings()
+{
+	settings->beginGroup("MainWindow");
+	settings->setValue("maximized", isMaximized());
+	if (!isMaximized()) {
+		/* position and size of the window if not maximized */
+		settings->setValue("pos", pos());
+		settings->setValue("size", size());
+	}
+	settings->endGroup();
+}
+
+void metavis::readMainWindowSettings()
+{
+	settings->beginGroup("MainWindow");
+	if (settings->value("maximized", false).toBool()) {
+		showMaximized();
+	}
+	else {
+		/* Position and size of the window if not maximized*/
+		resize(settings->value("size", QSize(600, 400)).toSize());
+		move(settings->value("pos", QPoint(200, 200)).toPoint());	
+	}
+	settings->endGroup();
 }

+ 8 - 0
metavis/metavis.h

@@ -2,6 +2,7 @@
 
 #include <QtWidgets/QMainWindow>
 #include "ui_metavis.h"
+#include <qsettings.h>
 /**
  * Main class of the GUI.
  */
@@ -11,9 +12,16 @@ class metavis : public QMainWindow
 
 public:
 	metavis(QWidget *parent = Q_NULLPTR);
+	~metavis();
 
 private:
 	Ui::metavisClass ui;
+	QSettings* settings;
+
+private:
+	void writeActualMainWindowSettings();
+	void readMainWindowSettings();
+
 
 public slots:
 	/**

+ 4 - 2
metavis/metavis.vcxproj

@@ -90,10 +90,10 @@
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <ClCompile Include="dataTest.cpp" />
     <ClCompile Include="main.cpp" />
     <ClCompile Include="metavis.cpp" />
     <ClCompile Include="SettingDialog.cpp" />
-    <ClCompile Include="Test.cpp" />
   </ItemGroup>
   <ItemGroup>
     <QtMoc Include="metavis.h" />
@@ -110,7 +110,9 @@
   </ItemGroup>
   <ItemGroup>
     <QtMoc Include="SettingDialog.h" />
-    <ClInclude Include="Test.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="dataTest.h" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">

+ 3 - 3
metavis/metavis.vcxproj.filters

@@ -31,10 +31,10 @@
     <ClCompile Include="metavis.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="Test.cpp">
+    <ClCompile Include="SettingDialog.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="SettingDialog.cpp">
+    <ClCompile Include="dataTest.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>
@@ -63,7 +63,7 @@
     <ResourceCompile Include="metavis.rc" />
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="Test.h">
+    <ClInclude Include="dataTest.h">
       <Filter>Header Files</Filter>
     </ClInclude>
   </ItemGroup>

+ 0 - 32
metavis/setting.ui

@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Dialog</class>
- <widget class="QDialog" name="Dialog">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>430</width>
-    <height>339</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Dialog</string>
-  </property>
-  <widget class="QDialogButtonBox" name="buttonBox_2">
-   <property name="geometry">
-    <rect>
-     <x>230</x>
-     <y>270</y>
-     <width>156</width>
-     <height>23</height>
-    </rect>
-   </property>
-   <property name="standardButtons">
-    <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
-   </property>
-  </widget>
- </widget>
- <resources/>
- <connections/>
-</ui>