ITG3200::ITG3200() { setOffsets(0,0,0); setScaleFactor(1.0, 1.0, 1.0, false); // true to change readGyro output to radians //Wire.begin(); //Normally this code is called from setup() at user code //but some people reported that joining I2C bus earlier //apparently solved problems with master/slave conditions. //Uncomment if needed. }
ImageConverter::ImageConverter(LameImage image) { // set defaults _range = 55; _offset = 0; setColorTable(); setTransparentColor(); setScaleFactor(); loadImage(image); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void ScaleVolume::readFilterParameters(AbstractFilterParametersReader* reader, int index) { reader->openFilterGroup(this, index); setApplyToVoxelVolume( reader->readValue("ApplyToVoxelVolume", getApplyToVoxelVolume()) ); setApplyToSurfaceMesh( reader->readValue("ApplyToSurfaceMesh", getApplyToSurfaceMesh()) ); setScaleFactor( reader->readFloatVec3("ScaleFactor", getScaleFactor() ) ); setDataContainerName(reader->readString("DataContainerName", getDataContainerName())); setSurfaceDataContainerName(reader->readString("SurfaceDataContainerName", getSurfaceDataContainerName())); reader->closeFilterGroup(); }
void IntersectActor::reset(void) { setHitDistance (TypeTraits<Real32>::getMax()); setHitObject (NullFC ); setHitTriangleIndex(-1 ); setHitNormal (Vec3f(0.0, 0.0, 0.0) ); setScaleFactor (1.0 ); Inherited::setHit (false ); }
void Transform::setToDefaults( void ) { GeometricalTransformation::setToDefaults(); setCenter ( vgm::Vec3f(0.f, 0.f, 0.f) ); setScaleOrientation ( vgm::Rotation::getIdentity() ); setScaleFactor ( vgm::Vec3f(1.f, 1.f, 1.f) ); setRotation ( vgm::Rotation::getIdentity() ); setTranslation ( vgm::Vec3f(0.f, 0.f, 0.f) ); }
int QPinchGesture::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QGesture::qt_metacall(_c, _id, _a); if (_id < 0) return _id; #ifndef QT_NO_PROPERTIES if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast<int*>(_v) = QFlag(totalChangeFlags()); break; case 1: *reinterpret_cast<int*>(_v) = QFlag(changeFlags()); break; case 2: *reinterpret_cast< qreal*>(_v) = totalScaleFactor(); break; case 3: *reinterpret_cast< qreal*>(_v) = lastScaleFactor(); break; case 4: *reinterpret_cast< qreal*>(_v) = scaleFactor(); break; case 5: *reinterpret_cast< qreal*>(_v) = totalRotationAngle(); break; case 6: *reinterpret_cast< qreal*>(_v) = lastRotationAngle(); break; case 7: *reinterpret_cast< qreal*>(_v) = rotationAngle(); break; case 8: *reinterpret_cast< QPointF*>(_v) = startCenterPoint(); break; case 9: *reinterpret_cast< QPointF*>(_v) = lastCenterPoint(); break; case 10: *reinterpret_cast< QPointF*>(_v) = centerPoint(); break; } _id -= 11; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setTotalChangeFlags(QFlag(*reinterpret_cast<int*>(_v))); break; case 1: setChangeFlags(QFlag(*reinterpret_cast<int*>(_v))); break; case 2: setTotalScaleFactor(*reinterpret_cast< qreal*>(_v)); break; case 3: setLastScaleFactor(*reinterpret_cast< qreal*>(_v)); break; case 4: setScaleFactor(*reinterpret_cast< qreal*>(_v)); break; case 5: setTotalRotationAngle(*reinterpret_cast< qreal*>(_v)); break; case 6: setLastRotationAngle(*reinterpret_cast< qreal*>(_v)); break; case 7: setRotationAngle(*reinterpret_cast< qreal*>(_v)); break; case 8: setStartCenterPoint(*reinterpret_cast< QPointF*>(_v)); break; case 9: setLastCenterPoint(*reinterpret_cast< QPointF*>(_v)); break; case 10: setCenterPoint(*reinterpret_cast< QPointF*>(_v)); break; } _id -= 11; } else if (_c == QMetaObject::ResetProperty) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 11; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 11; } #endif // QT_NO_PROPERTIES return _id; }
//============================================================================== MagnifierComponent::MagnifierComponent (Component* const content_, const bool deleteContentCompWhenNoLongerNeeded) : content (content_), scaleFactor (0.0), peer (0), deleteContent (deleteContentCompWhenNoLongerNeeded), quality (Graphics::lowResamplingQuality), mouseSource (0, true) { holderComp = new PeerHolderComp (this); setScaleFactor (1.0); }
void CanvasContainer::wheelEvent(QWheelEvent *event) { if (!event->modifiers().testFlag(Qt::ControlModifier) || !proxy) { QGraphicsView::wheelEvent(event); return; } QPointF position = proxy->mapFromScene(mapToScene(event->pos())); if (!proxy->rect().contains(position)) return; proxy->setTransformOriginPoint(position); setScaleFactor(calculateFactor(proxy->scale(), event->delta() > 0)); }
void Transform::sethMatrix( const vgm::MatrixR& matrix, const vgm::Vec3f& center ) { vgm::Vec3f translation; vgm::Rotation rotation; vgm::Vec3f scaleFactor; vgm::Rotation scaleOrientation; matrix.getTransform( translation, rotation, scaleFactor, scaleOrientation, center ); setTranslation( translation ); setRotation( rotation ); setScaleFactor( scaleFactor ); setScaleOrientation(scaleOrientation ); setCenter( center ); }
ofxArtool5::ofxArtool5(){ curArtMode = NULL; nullArtPointers(); bPattFound=false; selectedId=-1; setScaleFactor(1.0); setMinDistance(40.0); setMaxDistance(10000.0); gPatt_width = 80.0; threshNames.resize(6); threshNames[0] = "MANUAL"; threshNames[1] = "AUTO MEDIAN"; threshNames[2] = "AUTO OTSU"; threshNames[3] = "AUTO ADAPTIVE"; threshNames[4] = "AUTO BRACKETING"; threshNames[5] = "UNKNOWN"; artMode = ART_PATTERN; markersNFTCount = 0; surfaceSetCount = 0; }
void TransverseMercator::_loadFromParams() { Projection::_loadFromParams(); setScaleFactor(m_gctpParams[2]); }
bool GameScene::init() { if (!BaseLayer::init()) { return false; } MapUtil::getInstance()->dispose(); auto config = GameConfig::getInstance(); m_fScaleFactor = m_winSize.width/DESIGN_WIDTH; auto scaleH = m_winSize.height/DESIGN_HEIGHT; auto manager = GameManager::getInstance(); if(scaleH>m_fScaleFactor) { manager->setScaleFactor(scaleH); }else{ manager->setScaleFactor(m_fScaleFactor); } /* 加载音频资源 */ soundFiles.push_back(SOUND_SCENE_BG); effectFiles.push_back(SOUND_ITEM_GET_BIG_COIN); effectFiles.push_back(SOUND_ITEM_GET_BOMB); effectFiles.push_back(SOUND_ITEM_GET_LITTLE_COIN); effectFiles.push_back(SOUND_ITEM_GET_POWER); effectFiles.push_back(SOUND_ITEM_GET_SHOE); effectFiles.push_back(SOUND_ITEM_PUT_BOMB); effectFiles.push_back(SOUND_ITEM_USE_HP); effectFiles.push_back(SOUND_MONSTER_BOMBED_DEAD); effectFiles.push_back(SOUND_PLAYER_LOW_HP); effectFiles.push_back(SOUND_INGAME_WIN); effectFiles.push_back(SOUND_INGAME_FAILED); effectFiles.push_back(SOUND_ITEM_BOMB_EXPLODE); effectFiles.push_back(SOUND_ENTER_TONGGUANDIAN); effectFiles.push_back(SOUND_PLAYER_ATTACKED); effectFiles.push_back(SOUND_PLAYER_BIRTH); effectFiles.push_back(SOUND_PLAYER_DEATH); effectFiles.push_back(SOUND_PLAYER_RANDOM); /* 预加载资源 */ textureFiles.push_back("textures/default-hd"); textureFiles.push_back("textures/medium-hd"); textureFiles.push_back("textures/monster_1-hd"); textureFiles.push_back("textures/monster_2-hd"); textureFiles.push_back("textures/scenetex_small-hd"); textureFiles.push_back("textures/scenetex_medium-hd"); textureFiles.push_back("textures/scenetex_big-hd"); textureFiles.push_back("textures/scenetex_big1-hd"); textureFiles.push_back("textures/player_huxi-hd"); textureFiles.push_back("textures/ingame-hd"); textureFiles.push_back("textures/other_1-hd"); textureFiles.push_back("textures/other-hd"); textureFiles.push_back("textures/button-hd"); textureFiles.push_back("textures/item-hd"); textureFiles.push_back("textures/zh_cn/locale_3-hd"); textureFiles.push_back("textures/zh_cn/locale_4-hd"); setMapName(MapUtil::getInstance()->getMapName()); if(isShowTip()) { std::string mapTip = "textures/zh_cn/"+getMapName()+"-hd"; textureFiles.push_back(mapTip); } if (config->getSelectLevel()==12) { textureFiles.push_back(__String::createWithFormat("textures/monster_%s_boss-hd",config->getSelectSceneName().c_str())->getCString()); textureFiles.push_back("textures/monster_bomb-hd"); } char playerTextureName[50]; sprintf(playerTextureName, "textures/player_%s-hd",GameConfig::getInstance()->getSelectRoleName().c_str()); textureFiles.push_back(playerTextureName); manager->setBombNum(1); manager->setBombPower(1); manager->setLvDaiSpeed(Point::ZERO); return true; }
QWidget* CanvasContainer::scaleSlider() { if (!scaleSliderWidget) { scaleSliderWidget = new QWidget(this); QHBoxLayout *layout = new QHBoxLayout(scaleSliderWidget); QSlider *slider = new QSlider(Qt::Horizontal, scaleSliderWidget); QLabel *label = new QLabel("100%", scaleSliderWidget); label->setFixedWidth(label->fontMetrics().width("100.%")); label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); //label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); //not working? scaleSliderWidget->setLayout(layout); layout->addWidget(slider); layout->addWidget(label); layout->setContentsMargins(0, 0, 0, 0); qreal internalFactor = -100 * qLn(MIN_SCALE_FACTOR) / MIN_SCALE_FACTOR / qLn(2); slider->setRange(-qCeil(MIN_SCALE_FACTOR * internalFactor), qCeil(MAX_SCALE_FACTOR - 1) * 100); slider->setPageStep(100); slider->setTickPosition(QSlider::TicksBelow); auto setScaleOrigin = [=]() { if (proxy) { QPointF position = proxy->mapFromScene(mapToScene(viewport()->rect().center())); if (proxy->rect().contains(position)) proxy->setTransformOriginPoint(position); } }; auto calculateScale = [=](int sliderValue) { if (sliderValue >= 0) { qreal newScale = 1.0 + 0.01 * sliderValue; if (!qFuzzyCompare(newScale, currentScaleFactor())) { setScaleOrigin(); setScaleFactor(1.0 + 0.01 * sliderValue); label->setText(QString("%1%").arg(100 + sliderValue)); } } else { qreal newScale = qPow(MIN_SCALE_FACTOR, -sliderValue / internalFactor / MIN_SCALE_FACTOR); if (!qFuzzyCompare(newScale, currentScaleFactor())) { setScaleOrigin(); setScaleFactor(newScale); label->setText(QString("%1%").arg(newScale * 100, 0, 'f', 1)); } } }; auto calculateValue = [=](qreal scaleFactor) { slider->blockSignals(true); if (scaleFactor >= 1.0) { int newValue = 100 * scaleFactor - 100; if (newValue != slider->value()) { slider->setValue(newValue); label->setText(QString("%1%").arg(qFloor(100 * scaleFactor))); } } else { int newValue = -internalFactor * MIN_SCALE_FACTOR / qLn(MIN_SCALE_FACTOR) * qLn(scaleFactor); if (newValue != slider->value()) { slider->setValue(newValue); label->setText(QString("%1%").arg(100 * scaleFactor, 0, 'f', 1)); } } slider->blockSignals(false); }; connect(slider, &QSlider::valueChanged, calculateScale); connect(this, &CanvasContainer::scaled, calculateValue); } return scaleSliderWidget; }
void UIScaleFactorEditor::sltScaleSliderValueChanged(int value) { setSpinBoxValue(value); if (m_pMonitorComboBox) setScaleFactor(m_pMonitorComboBox->currentIndex(), value); }