Skip to content

Commit

Permalink
Change the containsPoint detect rules.
Browse files Browse the repository at this point in the history
  • Loading branch information
Harinlen committed Jun 2, 2015
1 parent 97a7009 commit be650f0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion generateground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ GenerateGround::GenerateGround(QWidget *parent) :
{
//If there's one point which is not in the ground,
//Ask user to change the barracks.
if(!ground.containsPoint(point, Qt::OddEvenFill))
if(!ground.containsPoint(point, Qt::WindingFill))
{
//Set the tab to barracks editor.
m_tabManager->setCurrentWidget(m_barracksEditor);
Expand Down
8 changes: 4 additions & 4 deletions ground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ void Ground::onActionUpdateRobot()
//Detect if the robot is in the border, if the robot is out of the
//border.
if(!m_border.containsPoint(robot->nextStep(),
Qt::OddEvenFill))
Qt::WindingFill))
{
//Find the line of the robot should guard, the robot should
//guard the most recent line.
Expand Down Expand Up @@ -476,7 +476,7 @@ bool Ground::readGroundData(const QString &filePath)
//Check the point is vaild or not.
QPointF barracksPoint=QPointF(pointData.at(0).toDouble(),
pointData.at(1).toDouble());
if(!border.containsPoint(barracksPoint, Qt::OddEvenFill))
if(!border.containsPoint(barracksPoint, Qt::WindingFill))
{
return false;
}
Expand Down Expand Up @@ -635,7 +635,7 @@ bool Ground::addRobot(Robot *robot)
//Check the robot.
//If the position of the robot is outside barracks, or there's already have
//a robot, you can't add this robot.
if(!m_barracks.containsPoint(robot->pos(), Qt::OddEvenFill) ||
if(!m_barracks.containsPoint(robot->pos(), Qt::WindingFill) ||
m_robotInitialPosition.contains(robot->pos()))
{
//Delete the robot.
Expand Down Expand Up @@ -711,7 +711,7 @@ void Ground::setBarracks(const QPolygonF &barracks)
i!=barracks.end();
++i)
{
if(!m_border.containsPoint(*i, Qt::OddEvenFill))
if(!m_border.containsPoint(*i, Qt::WindingFill))
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion robotmanagewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ RobotManageWidget::RobotManageWidget(QWidget *parent) :
for(int i=0; i<positions.size(); i++)
{
if(!m_ground->barracks().containsPoint(positions.at(i),
Qt::OddEvenFill))
Qt::WindingFill))
{
QMessageBox::information(this,
tr("Invalid positions"),
Expand Down

0 comments on commit be650f0

Please sign in to comment.