예제 #1
0
GoogleMapChart::GoogleMapChart(QWidget *parent) : QWebView(parent), pendingRequests(0)
{
    this->setWindowState(Qt::WindowFullScreen);

    manager = new QNetworkAccessManager(this);
    connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
    connect(this,SIGNAL(reloadMap()), this,SLOT(loadCoordinates()));
    timer = new QTimer(this);
    timer->setInterval(400);
    connect(timer, SIGNAL(timeout()), this, SLOT(moveBoat()));
    connect(timer, SIGNAL(timeout()), this, SLOT(loadCoordinates()));
    setCoordinates(65.019442,25.402193 );
}
예제 #2
0
Map::Map(QWidget *parent) : QWebView(parent), pendingRequests(0)
{
    manager = new QNetworkAccessManager(this);
    connect(manager, SIGNAL(finished(QNetworkReply*)),this, SLOT(replyFinished(QNetworkReply*)));
    connect(this,SIGNAL(reloadMap()),this,SLOT(loadCoordinates()));

   //load(QUrl("qrc:/www/html/index.html"));
   load(QUrl("file:///C:/Users/Antonio/Documents/Faculdade/TCC/Sw/MissionGroundStation/GroundStation/index.html"));

}
예제 #3
0
void Loop::handleMouseEvents(const SDL_Event& e)
{
	//Mouse events
	if (e.type == SDL_MOUSEBUTTONDOWN)
	{
		switch (e.button.button)
		{
		case SDL_BUTTON_LEFT:
			mIsLeftClickPressed = true;
			break;
		case SDL_BUTTON_RIGHT:
			mIsRightClickPressed = true;
			break;
		default:
			break;
		}
	}

	if (e.type == SDL_MOUSEBUTTONUP)
	{
		switch (e.button.button)
		{
		case SDL_BUTTON_LEFT:
			mIsLeftClickPressed = false;
			break;
		case SDL_BUTTON_RIGHT:
			mIsRightClickPressed = false;
			break;
		default:
			break;
		}
	}

	int x, y;
	SDL_GetMouseState(&x, &y);
	SDL_Point clickLocation = { x, y };

	//Left click
	if (mIsLeftClickPressed)
	{
		if (mGui.isBrowserActive())
		{
			if (SDL_PointInRect(&clickLocation, &mGui.getBrowserRect()))
			{
				std::string filename = mGui.notifyBrowser(clickLocation);
				if (filename != "")
				{
					mBlocks = loadCoordinates(filename);
					mIsDelaunayUpToDate = false;
					mGui.print("Loaded: " + filename);
				}
			}
		}
		else
		{
			if (SDL_PointInRect(&clickLocation, &mGui.mRect))
			{
				mIsLeftClickPressed = false;
				mGui.notify(clickLocation);
			}
			else
			{
				mDataStructure.createBoid(x, y);
				updateBoidCounter();
			}
		}
	}

	//Right click
	if (mIsRightClickPressed)
	{
		if (!mGui.isBrowserActive() && !SDL_PointInRect(&clickLocation, &mGui.mRect))
		{
			switch (mObjectPlacement)
			{
			case 0:
				mFood.setPosition(x, y);
				break;
			case 1:
				createBlock(x, y);
				mIsDelaunayUpToDate = false;
				break;
			case 2:
				if (!isInBlockProximity(x, y))
				{
					mPathFinish = Vector2(x, y);
				}
				break;
			}
		}
	}
}