Hi,
I am trying to reverse database ddl to VP canvas and then export a result to pdf or svg format through command-line.
I have 73 tables and 173 connectors and exporting these takes huge amount of time.
But exporting same diagram through UI just takes few seconds.
Here is the code summary that I’ve implemented for exporting diagrams on command line.
(I also tested with ExportDiagramImage.bat, and the result is same… it takes too long time and requires high memory consumption.)
// Create ERD
ProjectManager projectManager = ApplicationManager.instance().getProjectManager(); DiagramManager diagramManager = ApplicationManager.instance().getDiagramManager(); // Load project IProject project = projectManager.getProject(); // Create ER Diagram IERDiagramUIModel erd = (IERDiagramUIModel) diagramManager .createDiagram(IDiagramTypeConstants.DIAGRAM_TYPE_ER_DIAGRAM); String projectName = project.getName(); erd.setName(projectName + "_ERD"); erd.setAutoFitShapesSize(true); erd.setPointForeignKeyEndToColumn(true); erd.setShowColumnUserType(true); erd.setConnectorLabelOrientation(0); erd.setShowConnectorName(IDiagramUIModel.SHOW_CONNECTOR_NAME_YES); erd.setConnectorStyle(IConnectorUIModel.CS_ROUND_RECTILINEAR); erd.setConnectorLineJumps(IConnectorUIModel.CLJ_ARC);
// Change connection caption and arrow type
// Save
diagramManager.layout(erd, DiagramManager.LAYOUT_AUTO); diagramManager.openDiagram(erd); diagramManager.layout(erd, DiagramManager.LAYOUT_ROUTE_CONNECTORS_ORTHOGONAL); projectManager.saveProject();
// Export
ExportDiagramAsImageOption option = new ExportDiagramAsImageOption(type); ApplicationManager.instance().getModelConvertionManager().exportDiagramAsImage(erd, new File(exportDirectory.getPath() + "/" + fileName), option);
Not only time but also memory consumption is a problem.
It reaches 1GB and then retains that level. (maybe… memory swapping once reach memory max limit)
When the number of tables and connections is small, it is possible to create within a few minutes without any problems.
Do you have any idea of this…?