// Path: src/main/java/com/jpaulmorrison/graphics/DrawFBP.java
// public class Lang {
// 	// this class refers the language used for notation
// 	String label;
// 	String ext; // extension - without period
// 	FileFilter filter;
// 	String propertyName;
// 		
// 	// list of "languages"
// 	public static final int JAVA = 0;
// 	public static final int CSHARP = 1;
// 	public static final int GO = 2;
// 	public static final int JS = 3;
// 	public static final int FBP = 4;
// 	public static final int DIAGRAM = 5;
// 	public static final int IMAGE = 6;
// 	public static final int JARFILE = 7;
// 	public static final int FBP_JSON = 8;
// 	public static final int CLASS = 9;
// 	public static final int DLL = 10;
// 	public static final int EXE = 11;
// 	public static final int PRINT = 12;
// 
// 	Lang(String lab, String extn, FileFilter filt, String dir) {
// 		label = lab;
// 		ext = extn;
// 		filter = filt;
// 		propertyName = dir;
// 	}
// }
// 
// Path: src/main/java/com/jpaulmorrison/graphics/DrawFBP.java
// static enum Side {
// 	LEFT, TOP, RIGHT, BOTTOM
// }


import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Point;
import math.geom2d.line.Line2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.LinkedList;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JPopupMenu;
import com.jpaulmorrison.graphics.DrawFBP.Lang;
import com.jpaulmorrison.graphics.DrawFBP.Side;
			var.y = subnetBlock.cy - subnetBlock.height / 2;
		}
		else {
			Line2D line = new Line2D(fix.x, fix.y, subnetBlock.cx, subnetBlock.cy);
			DrawFBP.Side s = null;
			double left = subnetBlock.cx - subnetBlock.width / 2;			
			double right = subnetBlock.cx + subnetBlock.width / 2;
			double top = subnetBlock.cy - subnetBlock.height / 2;
			double bottom = subnetBlock.cy + subnetBlock.height / 2;
			if (Line2D.intersects(line, new Line2D(left, top, left, bottom))) 
				s = Side.LEFT;
			else if (Line2D.intersects(line, new Line2D(right, top, right, bottom)))
				s = Side.RIGHT;
			else if (Line2D.intersects(line, new Line2D(left, top, right, top)))
				s = Side.TOP;
			else if (Line2D.intersects(line, new Line2D(left, bottom, right, bottom)))
				s = Side.BOTTOM;
			
			float slope = (float) (subnetBlock.cy - fix.y) / (subnetBlock.cx - fix.x);  
			
			if (s == Side.LEFT) {				
				int yDiff = (int) ((subnetBlock.cx - subnetBlock.width / 2 - fix.x) * slope + .5);    // with rounding 			 
				var.y = (int) (fix.y + yDiff );
				var.x = subnetBlock.cx - subnetBlock.width / 2;
			}
			else if (s == Side.RIGHT) {				
				int yDiff = (int) ((fix.x - (subnetBlock.cx + subnetBlock.width / 2)) * slope + .5);    // with rounding 				 
				var.y = (int) (fix.y - yDiff );
				var.x = subnetBlock.cx + subnetBlock.width / 2;
			}
// Path: src/main/java/com/jpaulmorrison/graphics/DrawFBP.java
// public class Lang {
// 	// this class refers the language used for notation
// 	String label;
// 	String ext; // extension - without period
// 	FileFilter filter;
// 	String propertyName;
// 		
// 	// list of "languages"
// 	public static final int JAVA = 0;
// 	public static final int CSHARP = 1;
// 	public static final int GO = 2;
// 	public static final int JS = 3;
// 	public static final int FBP = 4;
// 	public static final int DIAGRAM = 5;
// 	public static final int IMAGE = 6;
// 	public static final int JARFILE = 7;
// 	public static final int FBP_JSON = 8;
// 	public static final int CLASS = 9;
// 	public static final int DLL = 10;
// 	public static final int EXE = 11;
// 	public static final int PRINT = 12;
// 
// 	Lang(String lab, String extn, FileFilter filt, String dir) {
// 		label = lab;
// 		ext = extn;
// 		filter = filt;
// 		propertyName = dir;
// 	}
// }
// 
// Path: src/main/java/com/jpaulmorrison/graphics/DrawFBP.java
// static enum Side {
// 	LEFT, TOP, RIGHT, BOTTOM
// }


// Path: src/main/java/com/jpaulmorrison/graphics/Diagram.java
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Point;
import math.geom2d.line.Line2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.LinkedList;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JPopupMenu;
import com.jpaulmorrison.graphics.DrawFBP.Lang;
import com.jpaulmorrison.graphics.DrawFBP.Side;

			var.y = subnetBlock.cy - subnetBlock.height / 2;
		}
		else {
			Line2D line = new Line2D(fix.x, fix.y, subnetBlock.cx, subnetBlock.cy);
			DrawFBP.Side s = null;
			double left = subnetBlock.cx - subnetBlock.width / 2;			
			double right = subnetBlock.cx + subnetBlock.width / 2;
			double top = subnetBlock.cy - subnetBlock.height / 2;
			double bottom = subnetBlock.cy + subnetBlock.height / 2;
			if (Line2D.intersects(line, new Line2D(left, top, left, bottom))) 
				s = Side.LEFT;
			else if (Line2D.intersects(line, new Line2D(right, top, right, bottom)))
				s = Side.RIGHT;
			else if (Line2D.intersects(line, new Line2D(left, top, right, top)))
				s = Side.TOP;
			else if (Line2D.intersects(line, new Line2D(left, bottom, right, bottom)))
				s = Side.BOTTOM;
			
			float slope = (float) (subnetBlock.cy - fix.y) / (subnetBlock.cx - fix.x);  
			
			if (s == Side.LEFT) {				
				int yDiff = (int) ((subnetBlock.cx - subnetBlock.width / 2 - fix.x) * slope + .5);    // with rounding 			 
				var.y = (int) (fix.y + yDiff );
				var.x = subnetBlock.cx - subnetBlock.width / 2;
			}
			else if (s == Side.RIGHT) {				
				int yDiff = (int) ((fix.x - (subnetBlock.cx + subnetBlock.width / 2)) * slope + .5);    // with rounding 				 
				var.y = (int) (fix.y - yDiff );
				var.x = subnetBlock.cx + subnetBlock.width / 2;
			}
			else if (s == Side.TOP) {				