// Path: src/java/org/stathissideris/ascii2image/core/DebugUtils.java
// public class DebugUtils {
// 	public static int getLineNumber() {
// 		return Thread.currentThread().getStackTrace()[2].getLineNumber();
// 	}
// }


import java.util.ArrayList;
import java.util.List;
import java.util.Iterator;
import org.stathissideris.ascii2image.core.DebugUtils;
import org.stathissideris.ascii2image.text.*;
			}
		}
		
		return result;
	}

	public void connectEndsToAnchors(TextGrid grid, Diagram diagram){
		Iterator it = shapes.iterator();
		while (it.hasNext()) {
			DiagramShape shape = (DiagramShape) it.next();
			if(!shape.isClosed()){
				shape.connectEndsToAnchors(grid, diagram);
			}
		}
	}

	private static DiagramShape makeLine(TextGrid grid, TextGrid.Cell start, TextGrid.Cell end, int cellWidth, int cellHeight){
		DiagramShape line = new DiagramShape();
		
		if(grid.isHorizontalLine(start)){
			if(start.isWestOf(end)){
				line.addToPoints(new ShapePoint(
							Diagram.getCellMinX(start, cellWidth),
							Diagram.getCellMidY(start, cellHeight)));
			} else {
				line.addToPoints(new ShapePoint(
							Diagram.getCellMaxX(start, cellWidth),
							Diagram.getCellMidY(start, cellHeight)));
			}
		} else if(grid.isVerticalLine(start)){
// Path: src/java/org/stathissideris/ascii2image/core/DebugUtils.java
// public class DebugUtils {
// 	public static int getLineNumber() {
// 		return Thread.currentThread().getStackTrace()[2].getLineNumber();
// 	}
// }


// Path: src/java/org/stathissideris/ascii2image/graphics/CompositeDiagramShape.java
import java.util.ArrayList;
import java.util.List;
import java.util.Iterator;
import org.stathissideris.ascii2image.core.DebugUtils;
import org.stathissideris.ascii2image.text.*;

			}
		}
		
		return result;
	}

	public void connectEndsToAnchors(TextGrid grid, Diagram diagram){
		Iterator it = shapes.iterator();
		while (it.hasNext()) {
			DiagramShape shape = (DiagramShape) it.next();
			if(!shape.isClosed()){
				shape.connectEndsToAnchors(grid, diagram);
			}
		}
	}

	private static DiagramShape makeLine(TextGrid grid, TextGrid.Cell start, TextGrid.Cell end, int cellWidth, int cellHeight){
		DiagramShape line = new DiagramShape();
		
		if(grid.isHorizontalLine(start)){
			if(start.isWestOf(end)){
				line.addToPoints(new ShapePoint(
							Diagram.getCellMinX(start, cellWidth),
							Diagram.getCellMidY(start, cellHeight)));
			} else {
				line.addToPoints(new ShapePoint(
							Diagram.getCellMaxX(start, cellWidth),
							Diagram.getCellMidY(start, cellHeight)));
			}
		} else if(grid.isVerticalLine(start)){
			if(start.isNorthOf(end)){