コード例 #1
0
void ViewportsSplitter::split2Up1Down(ViewportPanel * vp) 
{
	setOrientation(Qt::Vertical);

	top.setParent(this);
	first->setParent(&top);
	second->setParent(&top);

	bottom.setParent(this);
	if (vp == fourth)
	{
		third->setParent(0);
		fourth->setParent(&bottom);
	} else {
		third->setParent(&bottom);
		fourth->setParent(0);
	}
}
コード例 #2
0
void BasicScreenObject::doRotate() {

  rotationspeed *= rotationdrag;

  if (rotationspeed.length() > 0) {
    addRotation(rotationspeed.x, rotationspeed.y, rotationspeed.z);
  }

  if (rotationattractionforce > 0) {
    ofQuaternion betweenquat = rotationattractionquat - getOrientationQuat();
    float betweenangle;
    ofVec3f dirvec(1, 0, 0);
    betweenquat.getRotate(betweenangle, dirvec);
    ofQuaternion nowquat = getOrientationQuat();
    nowquat.slerp(rotationattractionforce, nowquat, rotationattractionquat);
    setOrientation(nowquat);
  }
}
コード例 #3
0
int GraphicsLinearLayoutObject::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 3)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 3;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QDeclarativeListProperty<QGraphicsLayoutItem>*>(_v) = children(); break;
        case 1: *reinterpret_cast< Qt::Orientation*>(_v) = orientation(); break;
        case 2: *reinterpret_cast< qreal*>(_v) = spacing(); break;
        case 3: *reinterpret_cast< qreal*>(_v) = contentsMargin(); break;
        }
        _id -= 4;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 1: setOrientation(*reinterpret_cast< Qt::Orientation*>(_v)); break;
        case 2: setSpacing(*reinterpret_cast< qreal*>(_v)); break;
        case 3: setContentsMargin(*reinterpret_cast< qreal*>(_v)); break;
        }
        _id -= 4;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 4;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
コード例 #4
0
// updateObject
// update object by frame...
void CGameCamera::updateObject()
{
	CGameObject::updateObject();

	if ( m_enable && m_targetObject )
	{
		// look target
		setTarget( m_targetObject->getPosition() );
	}
#ifdef GSEDITOR
	else
	{
		if ( getIView()->getActiveCamera() == this )
			m_targetPos = m_camera->getTarget();
	}

	// maybe modify by free animator
	core::vector3df pos = m_camera->getPosition();
	setPosition( pos );	

	if ( getIView()->getActiveCamera() == this )
		m_cameraMesh->setVisible( false );
	else
	{
		m_cameraMesh->setVisible( true );
		m_node = m_cameraMesh;

		core::vector3df rot = m_targetPos - m_position;
		setOrientation( rot );

		m_node = m_camera;
	}
#endif

#ifdef GSGAMEPLAY
	if ( m_camera->getAnimators().size() > 0 )
	{
		m_position = m_camera->getPosition();
		if ( m_targetObject == NULL )
			m_targetPos = m_camera->getTarget();
	}
#endif

}
コード例 #5
0
/**
 * Constructs the window.
 */
LibraryWindow::LibraryWindow(Place p, QWidget* parent, const char* name,
                             WFlags f)
    : QDockWindow(p, parent, name, f)
{
    modified_ = false;

    setCloseMode(Never);
    setMovingEnabled(TRUE);
    setResizeEnabled(TRUE);

    splitter_ = new QSplitter(Qt::Vertical, this);
    setWidget(splitter_);

    modelListView_ = new LibraryListView(splitter_);
    modelListView_->addColumn(tr("Module"));
    modelListView_->setDefaultRenameAction(QListView::Accept);

    descriptionTextBrowser_ = new QTextBrowser(splitter_);
    QPalette palette = QApplication::palette();
    descriptionTextBrowser_->setFrameStyle(QFrame::NoFrame);
    descriptionTextBrowser_->setPaper
            (palette.brush(QPalette::Normal, QColorGroup::Background));

    popupMenu_ = new QPopupMenu();
    popupMenu_->insertItem(tr("Rename"), this, SLOT(renameSelected()));
    popupMenu_->insertItem(tr("Change Type"),
                           this, SLOT(changeTypeOfSelected()));
    popupMenu_->insertSeparator();
    popupMenu_->insertItem(QPixmap(Util::findIcon("editdelete.png")),
                           tr("Remove"), this, SLOT(removeSelected()));

    connect(modelListView_, SIGNAL(selectionChanged(QListViewItem *)),
            this, SLOT(setDescription(QListViewItem *)));
    connect(this, SIGNAL(orientationChanged(Orientation)),
            this, SLOT(setOrientation(Orientation)));
    connect(modelListView_,
            SIGNAL(contextMenuRequested(QListViewItem *, const QPoint &, int)),
            this, SLOT(showPopup(QListViewItem *, const QPoint &, int)));
    connect(modelListView_, SIGNAL(selectionChanged(QListViewItem *)),
            this, SLOT(selectionChanged(QListViewItem *)));

    // load items
    initialize();
}
コード例 #6
0
QSlidingFrame::QSlidingFrame(QWidget *parent) : QWidget(parent)
{
    setAutoFillBackground(true);
    LayoutWidget=new QWidget(this);
    setOrientation(Qt::Horizontal);
    ImgWidget=0;
    animation=new QPropertyAnimation(this);
    animation->setDuration(800);
    animation->setEasingCurve(QEasingCurve::OutQuint);
    animation->setPropertyName("pos");
    connect(animation,SIGNAL(finished()),this,SLOT(animationFinished()));
    m_ActiveWidget=-1;
    QHBoxLayout* l=new QHBoxLayout(this);
    l->setMargin(0);
    l->setSpacing(0);
    l->addWidget(LayoutWidget);
    this->setLayout(l);
    LayoutWidget->show();
}
コード例 #7
0
Arrow::Arrow( Ogre::SceneManager* scene_manager, Ogre::SceneNode* parent_node, float shaft_length, float shaft_radius,
              float head_length, float head_radius )
: Object( scene_manager )
{
  if ( !parent_node )
  {
    parent_node = scene_manager_->getRootSceneNode();
  }

  scene_node_ = parent_node->createChildSceneNode();

  shaft_ = new Shape( Shape::Cylinder, scene_manager_, scene_node_ );
  head_ = new Shape( Shape::Cone, scene_manager_, scene_node_ );
  head_->setOffset(Ogre::Vector3(0.0f, 0.5f, 0.0f));

  set( shaft_length, shaft_radius, head_length, head_radius );

  setOrientation( Ogre::Quaternion::IDENTITY );
}
コード例 #8
0
ファイル: ofEasyCam.cpp プロジェクト: K0j0/openFrameworks
//----------------------------------------
void ofEasyCam::updateRotation(){
	if (bApplyInertia) {
		xRot *=drag; 
		yRot *=drag;
		zRot *=drag;
		
		if (ABS(xRot) <= minDifference && ABS(yRot) <= minDifference && ABS(zRot) <= minDifference) {
			bApplyInertia = false;
			bDoRotate = false;
		}
		curRot = ofQuaternion(xRot, getXAxis(), yRot, getYAxis(), zRot, getZAxis());
		setPosition((getGlobalPosition()-target.getGlobalPosition())*curRot +target.getGlobalPosition());
		rotate(curRot);
	}else{
		curRot = ofQuaternion(xRot, prevAxisX, yRot, prevAxisY, zRot, prevAxisZ);
		setPosition((prevPosition-target.getGlobalPosition())*curRot +target.getGlobalPosition());
		setOrientation(prevOrientation * curRot);
	}
}
コード例 #9
0
            void Opcode80A9::_run()
            {
                Logger::debug("SCRIPT") << "[80A9] [+] void override_map_start(int x, int y, int elevation, int orientation)" << std::endl;
                auto dataStack = _script->dataStack();

                auto orientation = dataStack->popInteger();
                auto elevation = dataStack->popInteger();
                auto y = dataStack->popInteger();
                auto x = dataStack->popInteger();
                auto position = y*200 + x;
                auto game = Game::Game::getInstance();
                auto player = game->player();
                auto hexagon = game->locationState()->hexagonGrid()->at(position);
                Game::getInstance()->locationState()->moveObjectToHexagon(player, hexagon);
                            //player->setPosition(position);
                player->setOrientation(orientation);
                player->setElevation(elevation);
                Game::Game::getInstance()->locationState()->centerCameraAtHexagon(player->hexagon());
            }
コード例 #10
0
ファイル: situated.cpp プロジェクト: Glyth/xoreos
void Situated::load(const Aurora::GFF3Struct &instance, const Aurora::GFF3Struct *blueprint) {
    // General properties

    if (blueprint)
        loadProperties(*blueprint); // Blueprint
    loadProperties(instance);    // Instance


    // Specialized object properties

    if (blueprint)
        loadObject(*blueprint); // Blueprint
    loadObject(instance);    // Instance


    // Sounds

    loadSounds();

    // Position

    setPosition(instance.getDouble("X"),
                instance.getDouble("Y"),
                instance.getDouble("Z"));

    // Orientation

    float bearing = instance.getDouble("Bearing");

    float rotX = 0.0f;
    float rotY = 0.0f;
    float rotZ = 1.0f;
    float rotW = Common::rad2deg(bearing);

    if (instance.hasField("OrientationW")) {
        rotX = instance.getDouble("OrientationX");
        rotY = instance.getDouble("OrientationY");
        rotZ = instance.getDouble("OrientationZ");
        rotW = Common::rad2deg(acos(instance.getDouble("OrientationW")) * 2.0);
    }

    setOrientation(rotX, rotY, rotZ, rotW);
}
コード例 #11
0
  void Camera::orientate(float xRel, float yRel)
  {
    spdlog::get("console")->debug() << "Orientate: xRel = " << xRel << ", yRel = " << yRel;

    phi_ += - yRel * sensibility_;
    theta_ += - xRel * sensibility_;

    phi_ = Utils::clamp(phi_);

    float phiRad = Utils::degreeToRad(phi_);
    float thetaRad = Utils::degreeToRad(theta_);

    setOrientation(phiRad, thetaRad);

    lateralMove_ = glm::cross(verticalAxis_, orientation_);
    lateralMove_ = glm::normalize(lateralMove_);

    updateEyeTarget();
  }
コード例 #12
0
ファイル: friend2.cpp プロジェクト: rfen347/swarm-robotics
// This function makes the robot rotate to a specific angle. The input is the angle measured in radians, where 0 is East/right and positive values are anticlockwise.
void rotateToAngle(double angle){
	//Calculate the angle to rotate
	double difference = theta - angle;
	//Don't rotate if we are at the correct angle
	if (difference == 0.0){
		return;
	}

	//Check for overflow
	if(difference>M_PI){ 
		difference = (difference-(M_PI*2));
	}else if(difference<(M_PI*-1)){
		difference = difference + (M_PI*2);
	}

	// Infrastructure
	ros::Rate loop_rate(loopRate);
	ros::NodeHandle n;
	geometry_msgs::Twist RobotNode_cmdvel;
	ros::Publisher RobotNode_stage_pub = n.advertise<geometry_msgs::Twist>("robot_11/cmd_vel",1000);
	
	//Calculate the shortest angle velocity to rotate
	if(difference>0){
		angular_z = -M_PI/2;
		
	}else{
		angular_z = M_PI/2;
		
	}

	//Rotate to the specified angle
	while(theta!=angle){

		// Infrastructure
		RobotNode_cmdvel.linear.x = linear_x;
		RobotNode_cmdvel.angular.z = angular_z;
		RobotNode_stage_pub.publish(RobotNode_cmdvel);
		setOrientation();
		ros::spinOnce();
		loop_rate.sleep();
	}
	angular_z = 0;
}
コード例 #13
0
ファイル: waypoint.cpp プロジェクト: Siltala/xoreos
void Waypoint::load(const Aurora::GFF3Struct &waypoint) {
	// Tag
	_tag = waypoint.getString("Tag");

	// Group
	_group = waypoint.getSint("Group", -1);

	// Map Note
	_hasMapNote     = waypoint.getBool("HasMapNote");
	_enabledMapNote = waypoint.getBool("MapNoteEnabled");

	waypoint.getLocString("MapNote", _mapNote);

	// Type
	_type = (uint32) ((int32) waypoint.getSint("MapNoteType", -1));

	// Position
	const float position[3] = {
		(float) waypoint.getDouble("XPosition"),
		(float) waypoint.getDouble("YPosition"),
		(float) waypoint.getDouble("ZPosition")
	};

	setPosition(position[0], position[1], position[2]);

	// Orientation
	const float orientation[4] = {
		(float) waypoint.getDouble("XOrientation"),
		(float) waypoint.getDouble("YOrientation"),
		(float) waypoint.getDouble("ZOrientation"),
		(float) Common::rad2deg(acos(waypoint.getDouble("WOrientation")) * 2.0)
	};

	setOrientation(orientation[0], orientation[1], orientation[2], orientation[3]);

	const Aurora::GDAFile &gda = getMGDA(kWorksheetWaypoints);

	// Icon
	_icon = gda.getString(_type, "Icon");

	// Variables
	readVarTable(waypoint);
}
コード例 #14
0
int QDialogButtonBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 6)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 6;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< Qt::Orientation*>(_v) = orientation(); break;
        case 1: *reinterpret_cast<int*>(_v) = QFlag(standardButtons()); break;
        case 2: *reinterpret_cast< bool*>(_v) = centerButtons(); break;
        }
        _id -= 3;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setOrientation(*reinterpret_cast< Qt::Orientation*>(_v)); break;
        case 1: setStandardButtons(QFlag(*reinterpret_cast<int*>(_v))); break;
        case 2: setCenterButtons(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 3;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 3;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 3;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
コード例 #15
0
ファイル: EnergyMeter.cpp プロジェクト: Faianca/hikari
    EnergyMeter::EnergyMeter(const sf::Sprite &overlay, const float &maximumValue)
        : value(maximumValue)
        , maximumValue(maximumValue)
        , orientation(-1)
        , overlay(overlay)
        , primaryColor(DEFAULT_PRIMARY_COLOR)
        , secondaryColor(DEFAULT_SECONDARY_COLOR)
        , fillColor(DEFAULT_FILL_COLOR)
    {
        setVisible(true);

        foreground.setSize(
            sf::Vector2f(
                overlay.getLocalBounds().width,
                overlay.getLocalBounds().height
            )
        );

        primaryBackground.setSize(foreground.getSize());

        secondaryBackground.setSize(
            sf::Vector2f(
                2.0f,
                foreground.getSize().y
            )
        );

        setFillColor(fillColor);
        setPrimaryColor(primaryColor);
        setSecondaryColor(secondaryColor);

        setPosition(
            sf::Vector2i(
                static_cast<int>(overlay.getPosition().x),
                static_cast<int>(overlay.getPosition().y)
            )
        );

        setOrientation(VERTICAL_ORIENTATION);

        updateFill();
    }
コード例 #16
0
void ofMatrixStack::popView(){
	pair<ofOrientation,bool> orientationFlip = orientationStack.top();
	setOrientation(orientationFlip.first,orientationFlip.second);
	orientationStack.pop();

	if( viewportHistory.size() ){
		currentViewport = viewportHistory.top();
		viewportHistory.pop();
	}

	ofMatrixMode currentMode = currentMatrixMode;

	matrixMode(OF_MATRIX_PROJECTION);
	popMatrix();

	matrixMode(OF_MATRIX_MODELVIEW);
	popMatrix();

	matrixMode(currentMode);
}
コード例 #17
0
void LibFile::setProperty(fwk::PropertyIndex idx, int32_t v)
{
    switch(idx) {
    case NpTiffOrientationProp:
        setOrientation(v);
        break;
    case NpXmpRatingProp:
        setRating(v);
        break;
    case NpXmpLabelProp:
        setLabel(v);
        break;
    case NpNiepceFlagProp:
        setFlag(v);
        break;
    default:
        ERR_OUT("set property %u not handled", idx);
        break;
    }
}
コード例 #18
0
ファイル: run.cpp プロジェクト: globox1/toaster
    /**
     * CallBack creating markers based on received toaster_msgs and adding then to obj_list
     * @param msg			reference to receive toaster_msgs::ObjectList
     * @return 			void
     */
    void chatterCallbackObjList(const toaster_msgs::ObjectList::ConstPtr& msg) //toaster object list reception
    {
        obj_list.markers.clear();

        for (int i = 0; i < msg->objectList.size(); i++) {
            visualization_msgs::Marker m = defineObj(msg->objectList[i].meEntity.positionX, msg->objectList[i].meEntity.positionY, msg->objectList[i].meEntity.positionZ,
                    1, msg->objectList[i].meEntity.name);

            m = setOrientation(m, msg->objectList[i].meEntity.orientationRoll, msg->objectList[i].meEntity.orientationPitch, msg->objectList[i].meEntity.orientationYaw);

            visualization_msgs::Marker mn = defineName(m);
            mn = setColor(mn, 1.0, 1.0, 1.0);
            mn = setSize(mn, 0, 0, 0.2);

            obj_list.markers.push_back(mn);
            obj_list.markers.push_back(m);

            ROS_DEBUG("obj %d", m.id);
        }
    }
コード例 #19
0
ファイル: thumbnailbarview.cpp プロジェクト: KDE/gwenview
ThumbnailBarView::ThumbnailBarView(QWidget* parent)
: ThumbnailView(parent)
, d(new ThumbnailBarViewPrivate)
{
    d->q = this;
    d->mTimeLine = new QTimeLine(SMOOTH_SCROLL_DURATION, this);
    connect(d->mTimeLine, &QTimeLine::frameChanged, this, &ThumbnailBarView::slotFrameChanged);

    d->mRowCount = 1;
    d->mOrientation = Qt::Vertical; // To pass value-has-changed check in setOrientation()
    setOrientation(Qt::Horizontal);

    setObjectName(QLatin1String("thumbnailBarView"));
    setWrapping(true);

    #ifdef WINDOWS_PROXY_STYLE
    d->mStyle = new ProxyStyle;
    setStyle(d->mStyle);
    #endif
}
コード例 #20
0
ファイル: ofNode.cpp プロジェクト: Catchoom/openFrameworks
//----------------------------------------
void ofNode::setParent(ofNode& parent, bool bMaintainGlobalTransform) {
	if (this->parent)
	{
		// we need to make sure to clear before
		// re-assigning parenthood.
		clearParent(bMaintainGlobalTransform);
	}
	if(bMaintainGlobalTransform) {
		auto postParentPosition = position - parent.getGlobalPosition();
		auto postParentOrientation = orientation.get() * glm::inverse(parent.getGlobalOrientation());
		auto postParentScale = scale / parent.getGlobalScale();
		parent.addListener(*this);
		setOrientation(postParentOrientation);
		setPosition(postParentPosition);
		setScale(postParentScale);
	} else {
		parent.addListener(*this);
	}
	this->parent = &parent;
}
コード例 #21
0
ファイル: creature.cpp プロジェクト: clone2727/xoreos
void Creature::load(const Aurora::GFF3Struct &instance, const Aurora::GFF3Struct *blueprint) {
	// General properties

	if (blueprint)
		loadProperties(*blueprint); // Blueprint
	loadProperties(instance);    // Instance

	// Position

	setPosition(instance.getDouble("XPosition"),
	            instance.getDouble("YPosition"),
	            instance.getDouble("ZPosition"));

	// Orientation

	float bearingX = instance.getDouble("XOrientation");
	float bearingY = instance.getDouble("YOrientation");

	setOrientation(0.0f, 0.0f, 1.0f, -Common::rad2deg(atan2(bearingX, bearingY)));
}
コード例 #22
0
ファイル: TilemapComponent.cpp プロジェクト: lriki/Lumino
void TilemapComponent::init()
{
    VisualComponent::init();

    auto tileset = newObject<Tileset>();
    auto layer = newObject<TilemapLayer>();
    layer->resize(5, 5);
    layer->setTileSize(Size(1, 1));
    layer->setOrientation(TilemapOrientation::UpFlow);
    layer->setTileId(0, 0, 1);
    layer->setTileId(1, 1, 1);
    layer->setTileId(0, 4, 1);
    layer->setTileId(1, 4, 1);
    layer->setTileId(2, 4, 1);
    layer->setTileId(3, 4, 1);
    layer->setTileId(4, 4, 1);
    m_tilemap = newObject<TilemapModel>();
    m_tilemap->addTileset(tileset);
    m_tilemap->addLayer(layer);
}
コード例 #23
0
void BasicScreenObject::_update(ofEventArgs &e) {
  if (!isupdating)
    return;
  if (age == 1)
    firstUpdate();

  // TODO: use Animation elements equal to Positioners Animator.h

  // Update Animations based on Tweening
  if (isMoveTweening)
    setPosition(tweenx, tweeny, tweenz);
  if (isScaleTweening)
    setScale(tweenscalex, tweenscaley, tweenscalez);
  if (isColorTweening)
    setColor(tweenr, tweeng, tweenb);
  if (isSizeTweening)
    setSize(tweenWidth, tweenHeight);
  if (isRotationTweening) {
    ofQuaternion nowquat = getOrientationQuat();
    nowquat.slerp(tweenrotslerp, startquat, endquat);
    setOrientation(nowquat);
  }

  // Animations based on Forces and Attractionpoints
  doRotate();
  doMove();

  if (isorderbyz)
    doOrderChildrenByZ();

  update();

  if (positioners.size() > 0) {
    for (positioner = positioners.begin(); positioner != positioners.end(); positioner++) {
      IPositioner *p = positioner->second;
      p->restrict(this);
    }
  }

  age++;
}
コード例 #24
0
ファイル: thinslider.cpp プロジェクト: falkTX/muse
ThinSlider::ThinSlider(QWidget *parent, const char *name,
	       Qt::Orientation orient, ScalePos scalePos, QColor fillColor)
      : SliderBase(parent,name)
      {
      d_thumbLength = 16;
      d_thumbHalf = 8;
      d_thumbWidth = 16;
        

      d_scaleDist   = 4;
      d_scaleStep   = 0.0;
      d_scalePos    = scalePos;
      d_xMargin     = 0;
      d_yMargin     = 0;
      d_mMargin    = 1;

      d_fillColor = fillColor;

      d_sliderRect.setRect(0, 0, 8, 8);
      setOrientation(orient);
      }
コード例 #25
0
ファイル: pane.cpp プロジェクト: Makoto-Sasahara/opentoonz
TPanel::TPanel(QWidget *parent, Qt::WindowFlags flags,
               TDockWidget::Orientation orientation)
    : TDockWidget(parent, flags)
    , m_panelType("")
    , m_isMaximizable(true)
    , m_isMaximized(false)
    , m_isActive(true)
    , m_panelTitleBar(0)
    , m_multipleInstancesAllowed(true) {
  // setFeatures(QDockWidget::DockWidgetMovable |
  // QDockWidget::DockWidgetFloatable);
  // setFloating(false);
  m_panelTitleBar = new TPanelTitleBar(this, orientation);
  setTitleBarWidget(m_panelTitleBar);
  // connect(m_panelTitleBar,SIGNAL(doubleClick()),this,SLOT(onDoubleClick()));
  connect(m_panelTitleBar, SIGNAL(doubleClick(QMouseEvent *)), this,
          SIGNAL(doubleClick(QMouseEvent *)));
  connect(m_panelTitleBar, SIGNAL(closeButtonPressed()), this,
          SLOT(onCloseButtonPressed()));
  setOrientation(orientation);
}
コード例 #26
0
//----------------------------------------
void ofxViewportCam::setTargetPosition(const ofVec3f &pos)
{
	this->target.setPosition(pos);
	this->isTargetSet = true;

    // Move to tumble point.
    const ofVec3f targetPos(target.getGlobalPosition());
    setPosition(targetPos);

    // Reset orientation to identity.
    setOrientation(ofQuaternion(0, 0, 0, 1));

    // Apply tumble.
    pan(this->panAmount);
    tilt(this->tiltAmount);

    // Re-apply pre-existing track and zoom.
    dolly(this->distance);
    truck(this->truckAmount);
    boom(this->boomAmount);
}
コード例 #27
0
ファイル: WaypointCamera.cpp プロジェクト: KoolJBlack/twspp
void WaypointCamera::updateCam(){
    
    // If the camera is in free mode, do not update its position
    if(camState == WAYPOINT_CAM_STATE_FREE){
        return;
    }
    
    // Calculate deltas between current position and target positoin
    ofVec3f posDelta = curTarNode.getPosition() - getPosition();
    ofVec3f oriDelta = curTarNode.getOrientationEuler() - getOrientationEuler();
    
    // Update pos if camera is too far from target
    if(posDelta.length() > CAM_VEL_RATE){
        isMoving = true;
        
        // Update positoin
        ofVec3f vel = posDelta.normalize();
        vel *= CAM_VEL_RATE;
        setPosition(getPosition() + vel);
        
        // Calculate fraction of distance from previous node
        float fromPreNodeDistFrac = (getPosition() - preTarNode.getPosition()).length()/(curTarNode.getPosition() - preTarNode.getPosition()).length();
        
        // Lerp between old and new orientations
        ofQuaternion newOri = quaternionLerp(preTarNode.getOrientationQuat(),
                                             curTarNode.getOrientationQuat(),
                                             fromPreNodeDistFrac);
        setOrientation(newOri);
        
        // Rotate 180 on Y axis so camera faces pos Z direction
        pan(180);
    }else{
        // Free the cam once we have reached our target
        camState =  WAYPOINT_CAM_STATE_FREE;
        isMoving = false;
        
        // We have arrived at target
        arrivedAtTarget = true; 
    }
}
コード例 #28
0
/**
 * \brief The constructor
 */
UBLeftPalette::UBLeftPalette(QWidget *parent, const char *name):
    UBDockPalette(eUBDockPaletteType_LEFT, parent)
{
    setObjectName(name);
    setOrientation(eUBDockOrientation_Left);
    mCollapseWidth = 150;

    bool isCollapsed = false;
    if(mCurrentMode == eUBDockPaletteWidget_BOARD){
    	mLastWidth = UBSettings::settings()->leftLibPaletteBoardModeWidth->get().toInt();
    	isCollapsed = UBSettings::settings()->leftLibPaletteBoardModeIsCollapsed->get().toBool();
    }
    else{
    	mLastWidth = UBSettings::settings()->leftLibPaletteDesktopModeWidth->get().toInt();
    	isCollapsed = UBSettings::settings()->leftLibPaletteDesktopModeIsCollapsed->get().toBool();
    }

    if(isCollapsed)
    	resize(0,parentWidget()->height());
    else
    	resize(mLastWidth, parentWidget()->height());
}
コード例 #29
0
ファイル: TouchScreen.cpp プロジェクト: radhoo/ILI9341_LCD
// init the GPIO pins and set the orientation (default portrait)
void TouchScreen::init(DigitalPin *clk, DigitalPin *cs, DigitalPin *din, DigitalPin *dout, DigitalPin *irq, Precision precision, Orientation orientation) {
	// save pins
	m_clk = clk;
	m_cs = cs;
	m_din = din;
	m_dout = dout;
	m_irq = irq;
	// config IO pins
	m_clk->config(DigitalPin::OUTPUT);
	m_cs->config(DigitalPin::OUTPUT);
	m_din->config(DigitalPin::OUTPUT);
	m_dout->config(DigitalPin::INPUT);
	m_irq->config(DigitalPin::OUTPUT);
	// set default states
	*m_cs = 1;
	*m_clk = 1;
	*m_din = 1;
	*m_clk = 1;
	// set other parameters
	setPrecision(precision);
	setOrientation(orientation);
}
コード例 #30
0
ファイル: timeslider.cpp プロジェクト: nelkana/PurePlayer_As
TimeSlider::TimeSlider(QWidget* parent) : QSlider(parent)
{
    setLength(100);
    setOrientation(Qt::Horizontal);
    setPageStep(0); // 0に設定するとwheelイベントはそのまま親へ伝搬される

    connect(this, SIGNAL(sliderPressed()),  this, SLOT(timeSliderPressed()));
    connect(this, SIGNAL(sliderReleased()), this, SLOT(timeSliderReleased()));
    connect(this, SIGNAL(sliderMoved(int)), this, SLOT(timeSliderMoved(int)));

    _movedPos = -1;
    _unableSetPosition = false;

    connect(&_timerRequestSeek, SIGNAL(timeout()),
            this,               SLOT(timerRequestSeekTimeout()));

    _timerUnableSetPosition.setSingleShot(true);
    connect(&_timerUnableSetPosition, SIGNAL(timeout()),
            this,                     SLOT(timerUnableSetPositionTimeout()));

    _reverseWheelSeek = false;
}