• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ wt::WRectF类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中wt::WRectF的典型用法代码示例。如果您正苦于以下问题:C++ WRectF类的具体用法?C++ WRectF怎么用?C++ WRectF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了WRectF类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: queue_corridor_rect

	Wt::WRectF elevator_system_drawer::queue_corridor_rect(Direction dir, Wt::WRectF const& rc_floor)
	{
		auto const q_height = get_queue_height(SizeFormat::Pixels);
		return Wt::WRectF(
			rc_floor.left(),
			dir == Direction::Up ? rc_floor.top() : (rc_floor.bottom() - q_height),
			rc_floor.width(),
			q_height
			);
	}
开发者ID:kamrann,项目名称:workbase,代码行数:10,代码来源:rtp_elevator_system_drawer.cpp


示例2: floor_rect

	Wt::WRectF elevator_system_drawer::floor_rect(floor_t floor, Wt::WRectF const& rc_side)
	{
		auto const floor_height = get_floor_height(SizeFormat::Pixels);
		return{
			rc_side.left(),
			rc_side.bottom() - (floor + 1) * floor_height,
			rc_side.width(),
			floor_height
		};
	}
开发者ID:kamrann,项目名称:workbase,代码行数:10,代码来源:rtp_elevator_system_drawer.cpp


示例3: draw_queue

	void elevator_system_drawer::draw_queue(size_t length, Wt::WPainter& painter, Wt::WRectF rc)
	{
		auto const person_height = get_person_height(SizeFormat::Pixels);
		auto const person_width = get_person_width(SizeFormat::Pixels);
		auto const gap_width = get_queue_gap_width(SizeFormat::Pixels);

		auto const margin = (rc.height() - person_height) * 0.5;

		rc = Wt::WRectF(
			rc.left(),
			rc.top() + margin,
			person_width,
			person_height
			);
		double offset = person_width + gap_width;
		for(size_t i = 0; i < length; ++i)
		{
			draw_person(painter, rc);
			rc = Wt::WRectF(
				rc.left() + offset,
				rc.top(),
				rc.width(),
				rc.height()
				);
		}
	}
开发者ID:kamrann,项目名称:workbase,代码行数:26,代码来源:rtp_elevator_system_drawer.cpp


示例4: queue_rect

	Wt::WRectF elevator_system_drawer::queue_rect(size_t length, QueueSide side, Wt::WRectF const& rc_bounds)
	{
		auto const person_width = get_person_width(SizeFormat::Pixels);
		auto const queue_gap = get_queue_gap_width(SizeFormat::Pixels);

		switch(side)
		{
			case QueueSide::Left:
			return Wt::WRectF(
				rc_bounds.left(),
				rc_bounds.top(),
				person_width * length + queue_gap * (length - 1),
				rc_bounds.height()
				);

			case QueueSide::Right:
			return Wt::WRectF(
				rc_bounds.right() - (person_width * length + queue_gap * (length - 1)),
				rc_bounds.top(),
				person_width * length + queue_gap * (length - 1),
				rc_bounds.height()
				);
		}
	}
开发者ID:kamrann,项目名称:workbase,代码行数:24,代码来源:rtp_elevator_system_drawer.cpp


示例5: draw_elevator

	void elevator_system_drawer::draw_elevator(Wt::WPainter& painter, Wt::WRectF const& rc)
	{
		const auto floor_height = get_floor_height(SizeFormat::Pixels);
		const auto elevator_height = get_elevator_height(SizeFormat::Pixels);

		painter.save();

		Wt::WRectF rc_elevator(
			rc.left(),
			rc.bottom() - get_current_floor() * floor_height - elevator_height,
			rc.width(),
			elevator_height
			);

		if(m_stage == AnimationStage::Moving)
		{
			auto travelled = m_stage_step * ElevatorSpeed * m_pix_multiplier;
			travelled = std::min(travelled, floor_height);
			auto sign = m_sys.m_state.direction == Direction::Up ? 1.0 : -1.0;
			rc_elevator = Wt::WRectF(
				rc_elevator.left(),
				rc_elevator.top() - sign * travelled,
				rc_elevator.width(),
				rc_elevator.height()
				);
		}

		double exit_door_openness = 0.0;
		switch(m_stage)
		{
			case AnimationStage::ExitDoorsOpening:
			exit_door_openness = m_stage_step * DoorSpeed * m_pix_multiplier / elevator_height;
			exit_door_openness = std::min(exit_door_openness, 1.0);
			break;
			case AnimationStage::ExitDoorsClosing:
			exit_door_openness = 1.0 - m_stage_step * DoorSpeed * m_pix_multiplier / elevator_height;
			exit_door_openness = std::max(exit_door_openness, 0.0);
			break;
			case AnimationStage::GettingOff:
			exit_door_openness = 1.0;
			break;
		}

		double entry_door_openness = 0.0;
		switch(m_stage)
		{
			case AnimationStage::EntryDoorsOpening:
			entry_door_openness = m_stage_step * DoorSpeed * m_pix_multiplier / elevator_height;
			entry_door_openness = std::min(entry_door_openness, 1.0);
			break;
			case AnimationStage::EntryDoorsClosing:
			entry_door_openness = 1.0 - m_stage_step * DoorSpeed * m_pix_multiplier / elevator_height;
			entry_door_openness = std::max(entry_door_openness, 0.0);
			break;
			case AnimationStage::GettingOn:
			entry_door_openness = 1.0;
			break;
		}

		painter.drawLine(rc_elevator.topLeft(), rc_elevator.topRight());
		painter.drawLine(rc_elevator.bottomLeft(), rc_elevator.bottomRight());

		painter.drawLine(
			rc_elevator.left(),
			rc_elevator.top(),
			rc_elevator.left(),
			rc_elevator.top() + (1.0 - entry_door_openness) * elevator_height
			);
		painter.drawLine(
			rc_elevator.right(),
			rc_elevator.top(),
			rc_elevator.right(),
			rc_elevator.top() + (1.0 - exit_door_openness) * elevator_height
			);

		if(m_sys.is_moving(m_sys.m_state.direction))
		{
			painter.save();
			painter.translate(rc_elevator.left(), rc_elevator.top());
			if(m_sys.m_state.direction == elevator_system::Direction::Down)
			{
				painter.translate(0.0, rc_elevator.height() * 0.5);
				painter.scale(1.0, -1.0);
			}
			painter.scale(rc_elevator.width(), rc_elevator.height());
			std::array< Wt::WPointF, 3 > points{ {
					{ 0.5, 0.1 },
					{ 0.2, 0.4 },
					{ 0.8, 0.4 },
					} };
			painter.setPen(Wt::WPen(Wt::green));
			painter.setBrush(Wt::WBrush(Wt::green));
			painter.drawPolygon(&points[0], 3);
			painter.restore();
		}

		Wt::WFont font = painter.font();
		//font.setFamily(Wt::WFont::Default);
		font.setSize(20);
		painter.setFont(font);
//.........这里部分代码省略.........
开发者ID:kamrann,项目名称:workbase,代码行数:101,代码来源:rtp_elevator_system_drawer.cpp


示例6: draw_floor

	void elevator_system_drawer::draw_floor(Wt::WPainter& painter, Wt::WRectF const& rc)
	{
		painter.drawLine(rc.left(), rc.bottom(), rc.right(), rc.bottom());
	}
开发者ID:kamrann,项目名称:workbase,代码行数:4,代码来源:rtp_elevator_system_drawer.cpp



注:本文中的wt::WRectF类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WSlider类代码示例发布时间:2022-05-31
下一篇:
C++ WPushButton类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap