From 5d3bd639f4c942857985e5de8142d82296c131ba Mon Sep 17 00:00:00 2001 From: Jonny007-MKD <1-23-4-5@web.de> Date: Fri, 29 Nov 2013 01:53:30 +0100 Subject: [PATCH] Definition of class KV --- GDE_3_2008/res/listParser.txt | 20 +++++++++++ Hazard/Hazard/KV.h | 65 +++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 Hazard/Hazard/KV.h diff --git a/GDE_3_2008/res/listParser.txt b/GDE_3_2008/res/listParser.txt index e69de29..3726901 100644 --- a/GDE_3_2008/res/listParser.txt +++ b/GDE_3_2008/res/listParser.txt @@ -0,0 +1,20 @@ +Variable a +Variable bar +Variable char +Variable d + +Term Key 0010 +Term Value 1 + +Term Key 7 +Term Value 1 + +Term Key 14 +Term Value 1 + +Term Key 01xx +Term Value 1 + +Term Key x000 +Term Value 1 + diff --git a/Hazard/Hazard/KV.h b/Hazard/Hazard/KV.h new file mode 100644 index 0000000..45caab9 --- /dev/null +++ b/Hazard/Hazard/KV.h @@ -0,0 +1,65 @@ +#include "stdafx.h" +#include +#include +#include +#include "Cell.h" +#include "PrimImplikantCollection.h" + +extern uint dimension; +extern uint numElements; +extern bool KNF; + +class KV +{ +public: + void Print(uint offset); // Ausgabe-Methode, KV-Diagramm an der Position [offset | offset] + void Print(uint offsetX, uint offsetY); // Ausgabe-Methode, KV-Diagramm an der Position [offsetX | offsetY] + uint width(); // Gibt die Breite eines KV-Diagramms zurück (widthPx) + uint height(); // Gibt die Höhe eines KV-Diagramms zurück (heightPx) + + // Konstruktor + KV(PrimImplikantCollection * globalPic, vector allCells, uint size) + : edgeLength(size), + numVarX(((uint)floor(dimension/2.0f))), numVarY(((uint)ceil(dimension/2.0f))), + numFieldX((uint)pow(2,(float)numVarX)), numFieldY((uint)pow(2,(float)numVarY)), + widthPx((numFieldX + 1) * (this->edgeLength + 1)), heightPx((numFieldY + 1) * (this->edgeLength + 1)) + { + this->globalPic = globalPic; + this->allCells = allCells; + this->Clear(); + } + +private: + PrimImplikantCollection* globalPic; + vector allCells; + + uint offsetX; // Der freie Platz nach links in Pixeln + uint offsetY; // Der freie Platz nach rechts in Pixeln + const uint edgeLength; // Die Kantenlänge der einzelnen Felder + + const uint numVarX; // Wieviele Variablen in X-Richtung gezeichnet werden + const uint numVarY; // Wieviele Variablen in Y-Richtung gezeichnet werden + const uint numFieldX; // Wieviele Felder in X-Richtung gezeichnet werden = pow(2, numVarX) + const uint numFieldY; // Wieviele Felder in Y-Richtung gezeichnet werden = pow(2, numVarY) + const uint widthPx; // Breite des KV-Diagramms in Pixeln + const uint heightPx; // Höhe des KV-Diagramms in Pixeln + + void PrintRaster(); // Erstellt die Felder + void PrintVariables(); // Erstellt die Werte der Variablen in der ersten X- und Y-Spalte + void PrintCellValues(); // Erstellt die Werte der jeweiligen Zellen + void PrintPrimImplikanten(); // Erstellt die einzelnen Primimplikanten + + void Clear(); + void Line(uint x1, uint y1, uint x2, uint y2, int color); // Zeichnet eine Linie mit Offset + void Text(uint x, uint y, uint size, int color, int bkcolor, int angle, int align, char* theText); // Zeichnet einen Text mit Offset + void KV::TextBox(uint x1, uint y1, uint x2, uint y2, uint size, int ctext, int cframe, int cfill, int flags, char* theText); // Zeichnet eine TextBox mit Offset + void KV::TextBoxBold(uint x1, uint y1, uint x2, uint y2, uint size, int ctext, int cframe, int cfill, int flags, char* theText); // Zeichnet eine TextBox mit Offset und fetter Schrift + + char* Binary(uint x, char length); // Wie itoa(x, char[], 2), allerdings mit fester Breite +}; + + +#ifndef _KV_H +#define _KV_H +#define CENTER SINGLE_LINE|CENTER_ALIGN|VCENTER_ALIGN +#endif \ No newline at end of file