void ForceDirectedGraphDrawing::computeIteration(std::shared_ptr<GraphClass>g, bool moveThisVertex)
{
    if(g == nullptr) return;

    clearForces(g);
    computeAttractiveForces(g);
    computeRepulsiveForces(g);
    computeGravityForces(g);
    moveVertices(g, moveThisVertex);

}
Ejemplo n.º 2
0
void SludgeFloorMaker::button1Release(int local_pointx, int local_pointy)
{
		int xx, yy;

		awaitButton1Release = FALSE;

		selx2 = xx = (local_pointx+x)*zmul;
		sely2 = yy = (local_pointy-y)*zmul;

		lit = snapToClosest(&xx, &yy, getFloor());
		litX = xx; 
		litY = yy;
						
		if (lit && (xx != selx1 || yy != sely1)) {
			selx2 = xx;
			sely2 = yy;
		}
												
		selection = 0;

		switch (mode) {
			case 1: // Move vertices
				if (moveVertices(selx1, sely1, selx2, sely2, getFloor())) {
					setFileChanged();
				} else {
					errorBox("Can't move vertex", "Sorry - that vertex is already contained in one or more of the polygons you're changing.");
					return;
				}
			
				break;

			case 4: // Split lines
				splitLine(selx1, sely1, selx2, sely2, getFloor());
				setFileChanged();
				break;
			case 5: // Split segments
				struct polyList * firstPoly = getFloor();
				splitPoly(selx1, sely1, selx2, sely2, &firstPoly);
				setFloor(firstPoly);
				setFileChanged();
				break;
		}
}