public ERDFormatterNode(SQLTable table, int index, ERDFormatter formatter) { Node = table; ID = -1; NumParents = 0; Index = index; ChildrenIndeces = new List <int>(); SiblingIndeces = new List <int>(); ParentIndeces = new List <int>(); Formatter = formatter; GroupNum = -1; ExclusivelyAdjacentChildren = new List <int>(); isOnlyConnectedToLeaves = null; isOnlyConnectedToRoots = null; }
private void generateDiagram(string catalog) { _root = new SDON.Model.Diagram(); _root.Version = "20"; _root.Template = "DatabaseERD"; _root.Shape = new SDON.Model.Shape(); _root.Shape.ShapeContainer = new SDON.Model.ShapeContainer(); _root.Shape.ShapeContainer.Arrangement = SDON.Model.ShapeArrangementTypes.Row; //double sqrtTables = Math.Sqrt((double)_tables.Count); //int numColumns = (int)Math.Ceiling(sqrtTables); //_root.Shape.ShapeContainer.Wrap = numColumns; if (catalog != null) { _root.Title = new SDON.Model.TitleShape(); _root.Title.Label = catalog; _root.Title.TextSize = 18; } //holy unused //_root.RootShape[0].Label = "ENTIRE DATABASE"; //SDON.Model.ShapeConnector connector; //SDON.Model.Shape shape; //SQLCSVLine line; //int i, j, destTable; //int tblX = 0, tblY = 0, dstX, dstY; //string startDirection, endDirection; // //for (i = 0; i < _tables.Count; i++) //{ // connector = new SDON.Model.ShapeConnector(); // shape = _tables[i].ExportAsShape(); // // // for (j = 0; j < _tables[i].GetEntryCount(); j++) // { // line = _tables[i].GetEntry(j); // // if (line.LINK_TABLE_NAME != "NULL") // { // destTable = findTable(line.LINK_TABLE_NAME); // dstY = destTable / numColumns; // dstX = destTable - (dstY * numColumns); // // startDirection = findStartDirection(tblX, tblY, dstX, dstY); // endDirection = returnOppositeDirection(startDirection); // // if (destTable >= 0) // { // //insertReturn(i, destTable, startDirection, endDirection); // } // } // } // // //connector.Shapes.Add(shape); // //_root.RootShape[0].ShapeConnector.Add(connector); // //_root.RootShape[0].ShapeContainer.Shapes.Add(shape); // tblX++; // if (tblX >= numColumns) // { // tblX = 0; // tblY++; // } //} ERDFormatter formatter = new ERDFormatter(); for (int i = 0; i < _tables.Count; i++) { formatter.InsertTable(_tables[i]); } formatter.Format(); _root.Shape = formatter.MakeDiagram(); _root.Returns = formatter.GetReturns(); }