|
From: <dhu...@us...> - 2007-01-21 18:17:53
|
Revision: 221
http://svn.sourceforge.net/qcell/?rev=221&view=rev
Author: dhubleizh
Date: 2007-01-21 10:17:50 -0800 (Sun, 21 Jan 2007)
Log Message:
-----------
- occurances adding
Modified Paths:
--------------
trunk/qcell/baseheaders/ElementalRules.h
trunk/qcell/basesources/ElementalRules.cpp
trunk/qcell/visgui/ElementalRulesWidget.cpp
trunk/qcell/visgui/ElementalRulesWidget.h
trunk/qcell/visgui/MainWindow.cpp
Modified: trunk/qcell/baseheaders/ElementalRules.h
===================================================================
--- trunk/qcell/baseheaders/ElementalRules.h 2007-01-21 17:23:50 UTC (rev 220)
+++ trunk/qcell/baseheaders/ElementalRules.h 2007-01-21 18:17:50 UTC (rev 221)
@@ -32,7 +32,7 @@
typedef QPair<int*, QVector<int>*> rulePair;
// Rule maps a rule number to a rule.
// A rule is really a pair of return value and neighbours
- QMultiHash<int, QPair<int*, QVector<int>*> > rules;
+ QMultiHash<int, rulePair > rules;
// This hash holds coordinates, that have a certain rule
QMultiHash<int, QVector<int> > rules_mask;
Modified: trunk/qcell/basesources/ElementalRules.cpp
===================================================================
--- trunk/qcell/basesources/ElementalRules.cpp 2007-01-21 17:23:50 UTC (rev 220)
+++ trunk/qcell/basesources/ElementalRules.cpp 2007-01-21 18:17:50 UTC (rev 221)
@@ -46,7 +46,7 @@
if (isNewRule)
{
// bumb the index
- rule_index = ++index;
+ rule_index = index++;
// and insert a new rule
rules.insert(rule_index, rulePair(&return_values[value_index], &this->neighbours[neighbour_index]));
@@ -56,10 +56,11 @@
// If both were present
else
{
+ /// @todo This needs a redo. Adding new occurances is more common then adding new rules
// Find indexes, take out pointers and make a new rule
rule_index = rules.key(rulePair(
- &return_values[return_values.indexOf(return_value)],
- &this->neighbours[this->neighbours.indexOf(neighbours)]
+ &return_values[value_index],
+ &this->neighbours[neighbour_index]
)
);
@@ -69,7 +70,6 @@
// At the end we note the coordinates
rules_mask.insert(rule_index, coordinates);
- emit
}
void ElementalRules::possibleRule(QVector<int> coordinates, QVector<int> neighbours, int result)
Modified: trunk/qcell/visgui/ElementalRulesWidget.cpp
===================================================================
--- trunk/qcell/visgui/ElementalRulesWidget.cpp 2007-01-21 17:23:50 UTC (rev 220)
+++ trunk/qcell/visgui/ElementalRulesWidget.cpp 2007-01-21 18:17:50 UTC (rev 221)
@@ -21,9 +21,9 @@
// Values to be added
QStringList values;
- values << "";
+ values << "-";
// Add coordinates
- values << parserCoordinates(coordinates);
+ values << parseCoordinates(coordinates);
// Add top-level id
QTreeWidgetItem* item = new QTreeWidgetItem(QStringList(QString::number(id)));
@@ -38,10 +38,12 @@
Qt::MatchExactly)
.first();
- item->addChild(new QTreeWidgetItem(QStringList(parserCoordinates(coordinates))));
+ QStringList values("-");
+ values << parseCoordinates(coordinates);
+ item->addChild(new QTreeWidgetItem(values));
}
-QString ElementalRulesWidget::parserCoordinates(QVector<int> coordinates)
+QString ElementalRulesWidget::parseCoordinates(QVector<int> coordinates)
{
// Construct a string with coordinates
// (x, y, z, t)
Modified: trunk/qcell/visgui/ElementalRulesWidget.h
===================================================================
--- trunk/qcell/visgui/ElementalRulesWidget.h 2007-01-21 17:23:50 UTC (rev 220)
+++ trunk/qcell/visgui/ElementalRulesWidget.h 2007-01-21 18:17:50 UTC (rev 221)
@@ -17,7 +17,7 @@
{
Q_OBJECT
protected:
- QString parserCoordinates(QVector<int> coordinates);
+ QString parseCoordinates(QVector<int> coordinates);
public slots:
void addRule(int id, QVector<int> coordinates);
void addOccurance(int id, QVector<int> coordinates);
Modified: trunk/qcell/visgui/MainWindow.cpp
===================================================================
--- trunk/qcell/visgui/MainWindow.cpp 2007-01-21 17:23:50 UTC (rev 220)
+++ trunk/qcell/visgui/MainWindow.cpp 2007-01-21 18:17:50 UTC (rev 221)
@@ -398,10 +398,10 @@
connect(elemental_rules, SIGNAL(newRule(int, QVector<int>)),
((ElementalRulesWidget*)elemental_dock->widget()), SLOT(addRule(int, QVector<int>))
);
-
+ connect(elemental_rules, SIGNAL(newOccurance(int, QVector<int>)),
+ ((ElementalRulesWidget*)elemental_dock->widget()), SLOT(addOccurance(int, QVector<int>))
+ );
-// void newOccurance(int id, QVector<int> coordinates);
-
iteration=0;
// visualization update
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|