示例#1
0
void MainWindow::ConnectNewDomain(Domain *newDomain)
{
	if (testDomain)
	{
		disconnect(testDomain, SIGNAL(Message(QString)), this, SLOT(displayOutput(QString)));
		disconnect(testDomain, SIGNAL(Instructions(QString)), ui->statusBar, SLOT(showMessage(QString)));
		disconnect(testDomain, SIGNAL(ToolFinishedDrawing()), ui->statusBar, SLOT(clearMessage()));
		disconnect(testDomain, SIGNAL(MouseX(float)), this, SLOT(showMouseX(float)));
		disconnect(testDomain, SIGNAL(MouseY(float)), this, SLOT(showMouseY(float)));
		disconnect(testDomain, SIGNAL(CircleToolStatsSet(float,float,float)), this, SLOT(showCircleStats(float,float,float)));
		disconnect(testDomain, SIGNAL(NumNodesDomain(int)), this, SLOT(showNumNodes(int)));
		disconnect(testDomain, SIGNAL(NumElementsDomain(int)), this, SLOT(showNumElements(int)));
		disconnect(testDomain, SIGNAL(NumNodesSelected(int)), this, SLOT(showNumSelectedNodes(int)));
		disconnect(testDomain, SIGNAL(NumElementsSelected(int)), this, SLOT(showNumSelectedElements(int)));
		disconnect(testDomain, SIGNAL(ToolFinishedDrawing()), glStatusBar, SLOT(clearMessage()));
		disconnect(testDomain, SIGNAL(EmitMessage(QString)), this, SLOT(displayOutput(QString)));
		disconnect(testDomain, SIGNAL(UndoAvailable(bool)), ui->undoButton, SLOT(setEnabled(bool)));
		disconnect(testDomain, SIGNAL(RedoAvailable(bool)), ui->redoButton, SLOT(setEnabled(bool)));
	}

	connect(newDomain, SIGNAL(Message(QString)), this, SLOT(displayOutput(QString)));
	connect(newDomain, SIGNAL(Instructions(QString)), ui->statusBar, SLOT(showMessage(QString)));
	connect(newDomain, SIGNAL(ToolFinishedDrawing()), ui->statusBar, SLOT(clearMessage()));
	connect(newDomain, SIGNAL(MouseX(float)), this, SLOT(showMouseX(float)));
	connect(newDomain, SIGNAL(MouseY(float)), this, SLOT(showMouseY(float)));
	connect(newDomain, SIGNAL(CircleToolStatsSet(float,float,float)), this, SLOT(showCircleStats(float,float,float)));
	connect(newDomain, SIGNAL(NumNodesDomain(int)), this, SLOT(showNumNodes(int)));
	connect(newDomain, SIGNAL(NumElementsDomain(int)), this, SLOT(showNumElements(int)));
	connect(newDomain, SIGNAL(NumNodesSelected(int)), this, SLOT(showNumSelectedNodes(int)));
	connect(newDomain, SIGNAL(NumElementsSelected(int)), this, SLOT(showNumSelectedElements(int)));
	connect(newDomain, SIGNAL(ToolFinishedDrawing()), glStatusBar, SLOT(clearMessage()));
	connect(newDomain, SIGNAL(EmitMessage(QString)), this, SLOT(displayOutput(QString)));
	connect(newDomain, SIGNAL(UndoAvailable(bool)), ui->undoButton, SLOT(setEnabled(bool)));
	connect(newDomain, SIGNAL(RedoAvailable(bool)), ui->redoButton, SLOT(setEnabled(bool)));
}
示例#2
0
void CreationSelectionLayer::CreateClickTool()
{
	if (!clickTool)
		clickTool = new ClickTool();
	clickTool->SetTerrainLayer(terrainLayer);
	clickTool->SetCamera(camera);
	connect(clickTool, SIGNAL(Message(QString)), this, SIGNAL(Message(QString)));
	connect(clickTool, SIGNAL(Instructions(QString)), this, SIGNAL(Instructions(QString)));
	connect(clickTool, SIGNAL(ToolFinishedDrawing()), this, SLOT(GetSelectionFromTool()));
	connect(clickTool, SIGNAL(ToolFinishedDrawing()), this, SIGNAL(ToolFinishedDrawing()));
}
示例#3
0
void FullDomainSelectionLayer::CreatePolygonTool()
{
	if (!polygonTool)
		polygonTool = new PolygonTool();

	polygonTool->SetFort14(fort14);
	polygonTool->SetCamera(camera);
	connect(polygonTool, SIGNAL(Message(QString)), this, SIGNAL(Message(QString)));
	connect(polygonTool, SIGNAL(Instructions(QString)), this, SIGNAL(Instructions(QString)));
	connect(polygonTool, SIGNAL(ToolFinishedDrawing()), this, SLOT(GetSelectionFromTool()));
	connect(polygonTool, SIGNAL(ToolFinishedDrawing()), this, SIGNAL(ToolFinishedDrawing()));
}
示例#4
0
void CreationSelectionLayer::CreateRectangleTool()
{
	if (!rectangleTool)
		rectangleTool = new RectangleTool();

	rectangleTool->SetTerrainLayer(terrainLayer);
	rectangleTool->SetCamera(camera);
	connect(rectangleTool, SIGNAL(Message(QString)), this, SIGNAL(Message(QString)));
	connect(rectangleTool, SIGNAL(Instructions(QString)), this, SIGNAL(Instructions(QString)));
	connect(rectangleTool, SIGNAL(ToolFinishedDrawing()), this, SLOT(GetSelectionFromTool()));
	connect(rectangleTool, SIGNAL(ToolFinishedDrawing()), this, SIGNAL(ToolFinishedDrawing()));
	connect(rectangleTool, SIGNAL(RectangleStatsSet(float,float)), this, SIGNAL(RectangleToolStatsSet(float,float)));
}
示例#5
0
void FullDomainSelectionLayer::CreateCircleTool()
{
	if (!circleTool)
		circleTool = new CircleTool();

	circleTool->SetFort14(fort14);
	circleTool->SetCamera(camera);
	connect(circleTool, SIGNAL(Message(QString)), this, SIGNAL(Message(QString)));
	connect(circleTool, SIGNAL(Instructions(QString)), this, SIGNAL(Instructions(QString)));
	connect(circleTool, SIGNAL(ToolFinishedDrawing()), this, SLOT(GetSelectionFromTool()));
	connect(circleTool, SIGNAL(ToolFinishedDrawing()), this, SIGNAL(ToolFinishedDrawing()));
	connect(circleTool, SIGNAL(CircleStatsSet(float,float,float)), this, SIGNAL(CircleToolStatsSet(float,float,float)));
}
/**
 * @brief Actions performed when a key is pressed
 *
 * Actions performed when a key is pressed. In this case, if the Enter key
 * is pressed, the user is finished using the tool.
 *
 */
void PolygonTool::KeyPress(QKeyEvent *event)
{
	if (event->key() == Qt::Key_Enter)
	{
		emit ToolFinishedDrawing();
	}
}
/**
 * @brief Actions that are performed when the left mouse button is released
 *
 * Actions that are performed when the left mouse button is released. Makes
 * tool invisible and tells everyone we're finished drawing.
 *
 * @param event The QMouseEvent object created by the GUI on the button release
 */
void ClickTool::MouseRelease(QMouseEvent *)
{
	mousePressed = false;
	visible = false;
	if (!mouseMoved)
	{
		emit ToolFinishedDrawing();
	} else {
		emit Instructions(QString("Click on any Element to select/deselect it"));
	}
}
/**
 * @brief Actions that are performed when a mouse button is released
 *
 * Actions that are performed when a mouse button is released. In this case,
 * if the left mouse button was just released (meaning we've been drawing the
 * circle), tell everyone we've finished drawing the circle by emitting
 * ToolFinishedDrawing().
 *
 * @param event The QMouseEvent object created by the GUI on the button release
 */
void CircleTool::MouseRelease(QMouseEvent *event)
{
	if (event->button() == Qt::LeftButton)
	{
		mousePressed = false;
		emit Message(QString("Circle Tool:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Center: (<b>")
			     .append(QString::number(xDomain, 'g', 8))
			     .append("</b>, <b>")
			     .append(QString::number(yDomain, 'g', 8))
			     .append("</b>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Radius: <b>")
			     .append(QString::number(radDomain))
			     .append("</b>"));
		emit ToolFinishedDrawing();
	}
}
/**
 * @brief Called when the user is finished using the tool
 *
 * Called when the user is finished using the tool. Hides the tool
 * and emits the ToolFinishedDrawing() signal.
 *
 */
void PolygonTool::FinishDrawingTool()
{
	visible = false;
	emit ToolFinishedDrawing();
}