//-------------------------------------------------------------- void ofxMuiNumberData::setRightOrLeftRangeLimit(float norm) { if(norm > getNormalizedValue()) { setNormalizedRangeMax(norm); } else { setNormalizedRangeMin(norm); } }
void ofxBKDoubleSlider::draw() { ofSetColor(isOver?overColor:bgColor,(isEnabled())?255:100); ofDrawRectangle(0,0,width,height); ofSetColor(barColor,(isEnabled())?255:100); float tx1 = getNormalizedValue(value)*(width-4); float tx2 = getNormalizedValue(value2)*(width-4); ofDrawRectangle(2+tx1,2,tx2-tx1,height-4); if(isDragging) { float tx = currentDraggingValue == 1?tx1:tx2; ofSetLineWidth(3); ofSetColor(ofColor(200,10,0)); ofDrawLine(tx+2,2,tx+2,height-2); } }
//-------------------------------------------------------------- void ofxMuiKnob::update() { // tooltip = toString(); // valueLabel->setText(tooltip); // valueLabel->setTooltip(tooltip); // if(needsRedraw) { // dial shape needs update due to data change cout << "here" << endl; if(getBounds().isBounded()) { innerRadiusW = getHitBoxHalfWidth() * innerRadiusPct; outerRadiusW = getHitBoxHalfWidth() * outerRadiusPct; innerRadiusH = getHitBoxHalfHeight() * innerRadiusPct; outerRadiusH = getHitBoxHalfHeight() * outerRadiusPct; angleBounds0 = ofRadToDeg(normalizedValueToAngle(0.0f)); angleBounds1 = ofRadToDeg(normalizedValueToAngle(1.0f)); angleValue0 = angleBounds0; angleValue1 = ofRadToDeg(normalizedValueToAngle(getNormalizedValue())); dialShape.clear(); dialShape.arc(0,0,outerRadiusW,outerRadiusH,angleBounds0,angleBounds1); dialShape.arcNegative(0,0,innerRadiusW,innerRadiusH,angleBounds1,angleBounds0); dialShape.close(); if(getRange().isBounded()) { angleRange0 = ofRadToDeg(normalizedValueToAngle(getNormalizedRangeMin())); angleRange1 = ofRadToDeg(normalizedValueToAngle(getNormalizedRangeMax())); angleValue0 = angleRange0; // reset it if this is active dialRangeShape.clear(); dialRangeShape.arc(0,0,outerRadiusW,outerRadiusH,angleRange0,angleRange1); dialRangeShape.arcNegative(0,0,innerRadiusW,innerRadiusH,angleRange1,angleRange0); dialRangeShape.close(); } // dialValueShape.clear(); dialValueShape.arc(0,0,outerRadiusW,outerRadiusH,angleValue0,angleValue1); dialValueShape.arcNegative(0,0,innerRadiusW,innerRadiusH,angleValue1,angleValue0); dialValueShape.close(); } else { // nothing to draw } needsRedraw = false; } }
std::string Axis::toString() const { std::stringstream stream; stream << Component::toString(); stream << std::fixed; stream.precision(3); stream << " "; stream << "normalizedValue: " << getNormalizedValue() << " "; stream << "restValue: " << getRestValue() << " "; stream << "(value: " << getValue() << ")"; return stream.str(); }
Combo::Combo(const parameters::ParameterInfo& inParamInfo, juce::AudioProcessor* inProcessor) : Control(inParamInfo, inProcessor) { const int numValues = static_cast<int>(getPlainValue(1.f)) + 1; for (int i = 0; i < numValues; ++i) { addItem(getControlValueText(getNormalizedValue(float(i))), i + 1); } setJustificationType(juce::Justification::centred); setSelectedItemIndex(static_cast<int>(getPlainValue(getControlValue())), juce::dontSendNotification); addListener(this); }
ofVec2f ofxBKDoubleSlider::getNormalizedValues() { return ofVec2f(getNormalizedValue(value),getNormalizedValue(value2)); }
void Combo::comboBoxChanged(juce::ComboBox*) { setControlValue(getNormalizedValue(float(getSelectedItemIndex()))); }
static OGRErr importGeogCSFromXML(OGRSpatialReference *poSRS, CPLXMLNode *psCRS) { const char *pszGeogName, *pszDatumName, *pszEllipsoidName, *pszPMName; double dfSemiMajor, dfInvFlattening, dfPMOffset = 0.0; /* -------------------------------------------------------------------- */ /* Set the GEOGCS name from the srsName. */ /* -------------------------------------------------------------------- */ pszGeogName = CPLGetXMLValue(psCRS, "srsName", "Unnamed GeogCS"); /* -------------------------------------------------------------------- */ /* If we don't seem to have a detailed coordinate system */ /* definition, check if we can define based on an EPSG code. */ /* -------------------------------------------------------------------- */ CPLXMLNode *psDatum; psDatum = CPLGetXMLNode(psCRS, "usesGeodeticDatum.GeodeticDatum"); if (psDatum == NULL) { OGRSpatialReference oIdSRS; oIdSRS.SetLocalCS("dummy"); importXMLAuthority(psCRS, &oIdSRS, "srsID", "LOCAL_CS"); if (oIdSRS.GetAuthorityCode("LOCAL_CS") != NULL && oIdSRS.GetAuthorityName("LOCAL_CS") != NULL && EQUAL(oIdSRS.GetAuthorityName("LOCAL_CS"), "EPSG")) { return poSRS->importFromEPSG( atoi(oIdSRS.GetAuthorityCode("LOCAL_CS"))); } } /* -------------------------------------------------------------------- */ /* Get datum name. */ /* -------------------------------------------------------------------- */ pszDatumName = CPLGetXMLValue(psDatum, "datumName", "Unnamed Datum"); /* -------------------------------------------------------------------- */ /* Get ellipsoid information. */ /* -------------------------------------------------------------------- */ CPLXMLNode *psE; psE = CPLGetXMLNode(psDatum, "usesEllipsoid.Ellipsoid"); pszEllipsoidName = CPLGetXMLValue(psE, "ellipsoidName", "Unnamed Ellipsoid"); dfSemiMajor = getNormalizedValue(psE, "semiMajorAxis", "Linear", SRS_WGS84_SEMIMAJOR); dfInvFlattening = getNormalizedValue(psE, "secondDefiningParameter.inverseFlattening", "Unitless", 0.0); if (dfInvFlattening == 0.0) { CPLError(CE_Failure, CPLE_AppDefined, "Ellipsoid inverseFlattening corrupt or missing."); return OGRERR_CORRUPT_DATA; } /* -------------------------------------------------------------------- */ /* Get the prime meridian. */ /* -------------------------------------------------------------------- */ CPLXMLNode *psPM; psPM = CPLGetXMLNode(psDatum, "usesPrimeMeridian.PrimeMeridian"); if (psPM == NULL) { pszPMName = "Greenwich"; dfPMOffset = 0.0; } else { pszPMName = CPLGetXMLValue(psPM, "meridianName", "Unnamed Prime Meridian"); dfPMOffset = getNormalizedValue(psPM, "greenwichLongitude.angle", "Angular", 0.0); } /* -------------------------------------------------------------------- */ /* Set the geographic definition. */ /* -------------------------------------------------------------------- */ poSRS->SetGeogCS(pszGeogName, pszDatumName, pszEllipsoidName, dfSemiMajor, dfInvFlattening, pszPMName, dfPMOffset); /* -------------------------------------------------------------------- */ /* Look for angular units. We don't check that all axes match */ /* at this time. */ /* -------------------------------------------------------------------- */ #ifdef notdef CPLXMLNode *psAxis; psAxis = CPLGetXMLNode(psGeo2DCRS, "EllipsoidalCoordinateSystem.CoordinateAxis"); importXMLUnits(psAxis, "AngularUnit", poSRS, "GEOGCS"); #endif /* -------------------------------------------------------------------- */ /* Can we set authorities for any of the levels? */ /* -------------------------------------------------------------------- */ importXMLAuthority(psCRS, poSRS, "srsID", "GEOGCS"); importXMLAuthority(psDatum, poSRS, "datumID", "GEOGCS|DATUM"); importXMLAuthority(psE, poSRS, "ellipsoidID", "GEOGCS|DATUM|SPHEROID"); importXMLAuthority(psDatum, poSRS, "usesPrimeMeridian.PrimeMeridian.meridianID", "GEOGCS|PRIMEM"); poSRS->Fixup(); return OGRERR_NONE; }