Short Description: SCT "Adjust Values" Operation: Bake 0 Bug Number: n/a Release notes (y/n): no, not yet. For Release Nums: 5.3 SCT "Adjust Values" Operation: Bake 0: Basic operation with hard-coded parameters: (1) Hard coded to "Scale" with a factor of the square root of 2. (2) Doesn't yet filter out redundantly selected Slot/timestep "cells" (i.e. when a Slot is represented in, and has cell selections in the SCT more than once). Feature exposed (menu item shown) using this SYMBOL in SctDialog.cpp static const bool ENA_ADJUST_VALUES (false); // New Development SEE: http://cadswes2.colorado.edu/~philw/2010/SCT/AdjustValues/ ------------------- QtSCT/SctDialog.hpp QtSCT/SctDialog.cpp ------------------- STUB HOOK coded in method: okstat SctDialog::adjustValuesInSelection (bool testOnly); ... HARD CODED for "Scale" (not "Adjust") mode, with a factor of ... the square root of 2. (So, performing the operation TWICE doubles ... the selected values). New method: // Adjust all values within the current cell selection void adjustValuesOnSlotTstepSet ( SctSlotTstepSet* stSet, bool doScale, // or absolute adjustment? unit_type unitType, // unit type, for absolute adj. double refVal); // _doScale: factor; else: offset New FUNCTOR (SCT cell visitor) class (declared in the .cpp file): class ValueAdjuster : public SctSlotTstepSet::ForEachFunction { private: SctModelData& _mdat; bool _doScale; // or absolute adjustment? unit_type _unitType; // unit type, for absolute adjustment double _refVal; // _doScale: factor; else: offset (std value) public: int _wrongUnitCnt; int _successCnt; int _nanCnt; int _readOnlyCnt; int _errorCnt; public: ValueAdjuster (SctModelData& mdat, bool doScale, unit_type utyp, double refVal); virtual okstat processItem (int slotInx, int tstepInx); ... ... ... }; --------------------------- QtSCT/SctModelData.hpp QtSCT/SctModelData.Sim.cpp --------------------------- New utility method: okstat adjustSingleTstepValue ( int slotInx, int tinx, bool doScale, // or absolute adjustment? double adjustStdVal, // if (doScale): scaler char& resultCodeChar); // s-success, n-NaN, r-readOnly, e-error Detail: const double adjustedValue = doScale ? (origStdVal * adjustStdVal) : (origStdVal + adjustStdVal); This method does not "adjust" NaN values. (NaNs remain unchanged). ----------------- QtSCT/SctView.hpp QtSCT/SctView.cpp ----------------- In order to force the recomputation of the Selection Stats and the Main Cell Line Editor after the adjustment operation is applied, these two methods were created from the implemenation of the "current cell changed" signal handler. Added methods: void SctView::processCurrentCell(); void SctView::processCurrentCell (int row, int col); ... implementation broken out from method: void SctView::sctTable_CurrentChanged (int row, int col) ------------------- QtSCT/SctConfig.hpp ------------------- Minor change to SctSlotColRefData default constructor: Initialize QString _rwSlotName to the empty string instead of to NULL. (This was probably a hold-over from the earlier Qt QString design which distinguished the NULL string from the empty string). ---