All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.plantuml.graph.Galaxy4 Maven / Gradle / Ivy

Go to download

PlantUML is a component that allows to quickly write : * sequence diagram, * use case diagram, * class diagram, * activity diagram, * component diagram, * state diagram * object diagram

There is a newer version: 8059
Show newest version
/* ========================================================================
 * PlantUML : a free UML diagram generator
 * ========================================================================
 *
 * (C) Copyright 2009-2013, Arnaud Roques
 *
 * Project Info:  http://plantuml.sourceforge.net
 * 
 * This file is part of PlantUML.
 *
 * PlantUML is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * PlantUML distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
 * License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
 * USA.
 *
 * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
 * in the United States and other countries.]
 *
 * Original Author:  Arnaud Roques
 * 
 * Revision $Revision: 9786 $
 *
 */
package net.sourceforge.plantuml.graph;

import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;

import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.geom.Point2DInt;
import net.sourceforge.plantuml.geom.PolylineBreakeable;
import net.sourceforge.plantuml.geom.SpiderWeb;

public class Galaxy4 {

	final private Board board;

	final private Map lines = new LinkedHashMap();
	final private SpiderWeb spiderWeb;

	public Galaxy4(Board board, int widthCell, int heightCell) {
		this.spiderWeb = new SpiderWeb(widthCell, heightCell);
		this.board = board;
	}

	public Point2DInt getMainPoint(int row, int col) {
		return spiderWeb.getMainPoint(row, col);
	}

	public PolylineBreakeable getPolyline(ALink link) {
		return lines.get(link);

	}

	public void addLink(ALink link) {
		final int rowStart = link.getNode1().getRow();
		final int rowEnd = link.getNode2().getRow();
		final int colStart = board.getCol(link.getNode1());
		final int colEnd = board.getCol(link.getNode2());

		final PolylineBreakeable polyline = spiderWeb.addPolyline(rowStart, colStart, rowEnd, colEnd);

		Log.info("link=" + link + " polyline=" + polyline);

		if (polyline == null) {
			Log.info("PENDING " + link + " " + polyline);
		} else {
			lines.put(link, polyline);
		}

	}

	public final Board getBoard() {
		return board;
	}

	public final Map getLines() {
		return Collections.unmodifiableMap(lines);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy