From: <le...@us...> - 2007-01-24 20:54:52
|
Revision: 253 http://svn.sourceforge.net/qcell/?rev=253&view=rev Author: lessm Date: 2007-01-24 12:54:46 -0800 (Wed, 24 Jan 2007) Log Message: ----------- - LocalFunction save bug resolved Modified Paths: -------------- trunk/qcell/basesources/LocalFunction.cpp trunk/qcell/visgui/MainWindow.cpp Modified: trunk/qcell/basesources/LocalFunction.cpp =================================================================== --- trunk/qcell/basesources/LocalFunction.cpp 2007-01-24 18:34:40 UTC (rev 252) +++ trunk/qcell/basesources/LocalFunction.cpp 2007-01-24 20:54:46 UTC (rev 253) @@ -35,14 +35,18 @@ if(functionMode==LocalFunction::SCRIPT) return -1; - temp.resize(maxArgVal); + temp.resize(maxArgVal+1); for(i=0;i<numElements;++i) { - remapValue = valueTable[i]; - if(remapValue>=maxArgVal) - remapValue = maxArgVal - 1; + remapValue = valueTable[i] + 1; + if(remapValue>=maxArgVal + 1) + remapValue = maxArgVal; + + if(remapValue<0) + remapValue = 0; + if(temp[remapValue]>numElements/2) - return remapValue; + return remapValue - 1; else temp[remapValue]++; } @@ -55,7 +59,7 @@ if(t<temp[i]) { t = temp[i]; - out = i; + out = i - 1; } } return out; @@ -151,15 +155,23 @@ { int count=0; int mod; - QVector<int> output; + QVector<int> output, trueOutput; count = sumArguments.size() + freeArguments.size(); output.resize(count); + trueOutput.resize(count); count--; + //count = 0; for(int i=0;i<freeArguments.size();++i) + { + trueOutput[sumArguments.size() + i] = count; output[count--] = getAlphabetSize(); + } for(int i=0;i<sumArguments.size();++i) + { + trueOutput[i] = count; output[count--] = sumArguments[i].size() * getAlphabetSize(); + } for(int i=sumArguments.size() + freeArguments.size() - 1;i>=0;--i) { @@ -182,7 +194,14 @@ output[i] = 0; } } - return output; + + // back to front order + + for(int i=0;i<trueOutput.size();++i) + trueOutput[i] = output[trueOutput[i]]; + //return output; + + return trueOutput; } QString LocalFunction::valueFormTableToString(int index) @@ -455,8 +474,8 @@ { if(valueTable.empty()) resizeValueTable(); - if(val < 0) - val = 0; + if(val < -1) + val = -1; if(val > maxArgVal - 1) val = maxArgVal - 1; Modified: trunk/qcell/visgui/MainWindow.cpp =================================================================== --- trunk/qcell/visgui/MainWindow.cpp 2007-01-24 18:34:40 UTC (rev 252) +++ trunk/qcell/visgui/MainWindow.cpp 2007-01-24 20:54:46 UTC (rev 253) @@ -1097,6 +1097,7 @@ qDebug(tr("Error parsing Neighbourhood element") .toAscii() ); + return; } root->removeChild(root->firstChild()); @@ -1225,7 +1226,7 @@ // Setup Neighbourhood editor //*************************************************** - // *sw->getNeighbourhoodEditor()->getStorage() = neighbourhood->toCalculationData(); + *(sw->getNeighbourhoodEditor()->getStorage()) = neighbourhood->toCalculationData(); sw->getNeighbourhoodEditor()->setTranslation(0.0f, 0.0f, -10.0f); sw->getNeighbourhoodEditor()->setSymbolColor(1, QColor(128, 128, 128)); //*************************************************** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |