std::wstring Meter::ToString() { std::wstringstream ss; ss << L"Geometry: (" << _rect.X << L", " << _rect.Y << "); "; ss << _rect.Width << L"x" << _rect.Height << std::endl; ss << L"Units: " << Units() << std::endl; ss << L"Current Value: " << Value() << L" (" << CalcUnits() << L" units)"; return ss.str(); }
static floatish WidthInPoints(char *wstr) { floatish result; result = (floatish) atof(wstr); switch (Units(wstr)) { case INCHES: result *= 72.0; break; case MILLIMETRES: result *= 2.834646; break; case POINTS: default: ; } if (result <= 144) /* Minimum of 2in wide ! */ Usage(wstr); return result; }
const std::string CModelParameter::getUnit(const Framework & framework) const { std::string Unit; switch (mType) { case Model: return getModel()->getTimeUnitsDisplayString(); break; case Compartment: { const CCompartment * pCompartment = static_cast< const CCompartment * >(mpObject); if (pCompartment == NULL) { return ""; } return pCompartment->getChildObjectUnits(pCompartment->getInitialValueReference()); } break; case Species: { const CMetab * pSpecies = static_cast< const CMetab * >(mpObject); if (pSpecies == NULL) { return ""; } if (framework == Concentration) { return pSpecies->getChildObjectUnits(pSpecies->getInitialConcentrationReference()); } return pSpecies->getChildObjectUnits(pSpecies->getInitialValueReference()); } break; case ModelValue: break; case ReactionParameter: { const CReaction * pReaction = static_cast< const CModelParameterReactionParameter * >(this)->getReaction(); if (pReaction == NULL) { return ""; } const CModel * pModel = getModel(); CFindDimensions Units(pReaction->getFunction(), pModel->getQuantityUnit()->isDimensionless(), pModel->getVolumeUnit()->isDimensionless(), pModel->getTimeUnit()->isDimensionless(), pModel->getAreaUnit()->isDimensionless(), pModel->getLengthUnit()->isDimensionless()); Units.setUseHeuristics(true); Units.setChemicalEquation(&pReaction->getChemEq()); Units.findDimensions(pReaction->getCompartmentNumber() > 1); return Units.getDimensions()[pReaction->getParameterIndex(getName())].getDisplayString(pModel); } break; default: break; } return ""; }
Db_Field (string name, Field_Type type, int offset = 0, double size = 0, Units_Type units = NO_UNITS, Nest_Type nest = NO_NEST) { Name (name); Type (type); Offset (offset); Size (size); Units (units); Nest (nest); }
//!Returns a Units for mass static inline Units Mass() { return Units(0,0,1); }
//!Returns a Units for time static inline Units Time() { return Units(0,1,0); }
//!Returns a Units for length static inline Units Length() { return Units(1,0,0); }
//!Returns a handy no-units Units static inline Units Dimensionless() { return Units(0,0,0); }
enum Units pp_units_get_unit(pp_Units *ob) { int u=gtk_option_menu_get_history(GTK_OPTION_MENU(ob->unitselector)); return(Units(u)); }
double CNCPoint::Z(const bool in_drawing_units /* = false */) const { if (in_drawing_units == false) return(gp_Pnt::Z()); else return(gp_Pnt::Z() / Units()); }
char internal_buffer[256]; }; // end::rtdata-impl[] struct osc_t osc; struct sequencer_t seq; struct lfo_t lfo; struct lpf_t filter; // tag::ports[] #define Units(x) rMap(units, x) #define UnitLess rProp(unitless) #define rObject sequencer_t rtosc::Ports seq_ports = { rArrayF(freq, 8, rLog(0.1, 10e3), Units(Hz), "Frequency"), rParamF(noise_level, rLinear(0, 3), UnitLess, "White Noise Peak Gain"), rParamF(noise_decay, rLinear(1e-4,1), UnitLess, "Noise Decay Over Step"), rParamF(bpm, rLinear(0,1000), Units(bpm), "Beats Per Minute"), }; #undef rObject #define rObject lfo_t rtosc::Ports lfo_ports = { rParamF(freq, rLog(0.1, 1e3), Units(Hz), "Frequency"), rParamF(amount, rLinear(0,8), UnitLess, "LFO Strength"), }; #undef rObject #define rObject lpf_t rtosc::Ports filter_ports = {