Example #1
0
void Waypoints::addWaypoint(Waypoint* wp)
{
	removeWaypoint(wp->name);
	if(wp->pos != Position()) {
		Tile* t = map.getTile(wp->pos);
		if(!t)
			map.setTile(wp->pos, t = map.allocator(map.createTileL(wp->pos)));
		t->getLocation()->increaseWaypointCount();
	}
	waypoints.insert(std::make_pair(as_lower_str(wp->name), wp));
}
void PathDesignScreen::processReleaseEvent( QMouseEvent* e)
{
    mouseUpPnt_ = e->pos();
    int button =  e->button();

    QPointF waypoint = wmInv_.map( mouseUpPnt_ );
    //cout << "mouseUpPnt_,waypoint: (" << mouseUpPnt_.x() << "," << mouseUpPnt_.y() <<")  (" << waypoint.x() << ","<< waypoint.y() << ")" << endl;
    
    if (button == Qt::LeftButton) 
    {         
        addWaypoint( waypoint );
    }
    else if (button == Qt::RightButton)
    {      
        removeWaypoint( waypoint );
    }
    else if (button == Qt::MidButton)
    {
        changeWpParameters( waypoint );    
    }
}
void ExperimentalTrajectory::removeYoungestWaypoint()
{
    removeWaypoint(youngestWaypointIndex);
}