Exemple #1
0
void Graph::createConvergentCorner(int from, int to, int weight) {

    vector<Vertex *> fromVertexes = searchVertex(from);
    vector<Vertex *> toVertexes = searchVertex(to);

    if (fromVertexes.empty() || toVertexes.empty()) {
        cout << "One or both vertexes not found, the corner cannot be created!" << endl;
        return;
    }

    if (fromVertexes.size() == 1 && toVertexes.size() == 1) {

        Vertex *fromVertex = fromVertexes.front();
        Vertex *toVertex = toVertexes.front();

        fromVertex->createConvergentAdjacency(toVertex, weight);
    } else {

        for (vector<Vertex *>::iterator it = fromVertexes.begin(); it != fromVertexes.end(); it++) {

            Vertex *fromVertex = *it;

            for (vector<Vertex *>::iterator secondIt = toVertexes.begin(); secondIt != toVertexes.end(); secondIt++) {

                Vertex *toVertex = *secondIt;

                fromVertex->createConvergentAdjacency(toVertex, weight);
            }
        }
    }
}
Exemple #2
0
void Graph::createCorner(int firstValue, int secondValue, int weight) {

    vector<Vertex *> firstVertexes = searchVertex(firstValue);
    vector<Vertex *> secondVertexes = searchVertex(secondValue);

    if (firstVertexes.empty() || secondVertexes.empty()) {
        cout << "One or both vertexes not found, the corner cannot be created!" << endl;
        return;
    }

    if (firstVertexes.size() == 1 && secondVertexes.size() == 1) {

        Vertex *firstVertex = firstVertexes.front();
        Vertex *secondVertex = secondVertexes.front();

        firstVertex->createAdjacency(secondVertex, weight);
        secondVertex->createAdjacency(firstVertex, weight);
    } else {

        for (vector<Vertex *>::iterator it = firstVertexes.begin(); it != firstVertexes.end(); it++) {

            Vertex *firstVertex = *it;

            for (vector<Vertex *>::iterator secondIt = secondVertexes.begin();
                 secondIt != secondVertexes.end(); secondIt++) {

                Vertex *secondVertex = *secondIt;

                firstVertex->createAdjacency(secondVertex, weight);
                secondVertex->createAdjacency(firstVertex, weight);
            }
        }
    }
}
PropertyWidget::PropertyWidget(MainWindow* mainWin) : QDockWidget("Property Widget", (QWidget*)mainWin) {
	this->mainWin = mainWin;

	// set up the UI
	ui.setupUi(this);
	ui.comboBoxParcelType->insertItem(0, "Park");
	ui.comboBoxParcelType->insertItem(1, "Building");

	// register the event handlers
	connect(ui.pushButtonVertexSearch, SIGNAL(clicked()), this, SLOT(searchVertex()));

	// register the event handlers
	hide();
}
Exemple #4
0
void Graph::createCycleCorner(int value, int weight) {

    vector<Vertex *> vertexes = searchVertex(value);

    if (vertexes.empty()) {
        cout << "Vertex not found, the cycle cannot be created!" << endl;
        return;
    }

    if (vertexes.size() == 1) {

        Vertex *vertex = vertexes.front();

        vertex->createCycleAdjacency(vertex, weight);
    } else {

        for (vector<Vertex *>::iterator it = vertexes.begin(); it != vertexes.end(); it++) {

            Vertex *vertex = *it;

            vertex->createCycleAdjacency(vertex, weight);
        }
    }
}