यह आलेख चर्चा करता है कि जावा में फ़्लोचार्ट कैसे बनाएं। इसमें जावा में फ़्लोचार्ट निर्माता विकसित करने के लिए चरण-दर-चरण एल्गोरिदम और एक चलाने योग्य कोड स्निपेट शामिल है। इसके अलावा, आप अपनी आवश्यकताओं के अनुसार flowchart बनाने के लिए स्कीमा, आकृतियों की संख्या, कनेक्शन और अन्य गुणों में हेरफेर करके प्रक्रिया को बढ़ा सकते हैं।
जावा में फ़्लोचार्ट बनाने के चरण
- फ़्लोचार्ट बनाने के लिए Aspose.Diagram API इंस्टॉल करके वातावरण तैयार करें
- फ़्लोचार्ट के लिए स्कीमा विकसित करें
- Diagram वर्ग का एक ऑब्जेक्ट बनाएं और आकृतियाँ सम्मिलित करने के लिए मास्टर आकृतियाँ लोड करें
- फ़्लोचार्ट का लेआउट सेट करें और सेव Save विधि का उपयोग करके जेनरेट किए गए फ़्लोचार्ट को निर्यात करें
ये चरण जावा में फ्लोचार्ट जनरेटर विकसित करने की प्रक्रिया को प्रदर्शित करते हैं। सबसे पहले, विभिन्न भूमिकाएँ, पदनाम और अन्य गुण निर्धारित करने के लिए एक स्कीमा बनाएं। इसके बाद, लेआउट सेट करने और आउटपुट फ़्लोचार्ट को सहेजने से पहले विभिन्न आकृतियों जैसे आयत, कनेक्टर आदि को जोड़ने के लिए मास्टर आकृतियों का उपयोग करें।
जावा में फ़्लोचार्ट जेनरेटर बनाने के लिए कोड
import com.aspose.diagram.*; | |
public class Main | |
{ | |
public static void main(String[] args) throws Exception // Create flowchart in Java | |
{ | |
// Set the licenses | |
new License().setLicense("License.lic"); | |
// Create a new diagram | |
int pageNumber = 0; | |
String MasterRectangle = "Process", decisionMaster = "Decision", connectorMaster = "Dynamic connector"; | |
com.aspose.diagram.Diagram diagram = new com.aspose.diagram.Diagram("XANFLOWCHARTNEW.vss"); | |
double widthparam = 1, heightparam = 1, pinX = 4, pinY = 10; | |
long process1 = diagram.addShape(pinX, pinY, widthparam, heightparam, MasterRectangle, 0); | |
Shape processShape1 = diagram.getPages().getPage(pageNumber).getShapes().getShape(process1); | |
processShape1.getText().getValue().add(new Txt("PROCESS")); | |
processShape1.setName("PROCESS"); | |
processShape1.getXForm().getLocPinX().getUfe().setF("Width*0.5"); | |
processShape1.getXForm().getLocPinY().getUfe().setF("Height*0.5"); | |
pinY = pinY - 2; | |
long decision1 = diagram.addShape(pinX, pinY, widthparam, heightparam, decisionMaster, 0); | |
Shape decisionShape1 = diagram.getPages().getPage(pageNumber).getShapes().getShape(decision1); | |
decisionShape1.getText().getValue().add(new Txt("DECISION")); | |
decisionShape1.setName("DECISION"); | |
decisionShape1.getXForm().getLocPinX().getUfe().setF("Width*0.5"); | |
decisionShape1.getXForm().getLocPinY().getUfe().setF("Height*0.5"); | |
pinY = pinY - 2; | |
long process2 = diagram.addShape(pinX, pinY, widthparam, heightparam, MasterRectangle, 0); | |
Shape processShape2 = diagram.getPages().getPage(pageNumber).getShapes().getShape(process2); | |
processShape2.getText().getValue().add(new Txt("PROCESS")); | |
processShape2.setName("PROCESS"); | |
processShape2.getXForm().getLocPinX().getUfe().setF("Width*0.5"); | |
processShape2.getXForm().getLocPinY().getUfe().setF("Height*0.5"); | |
pinY = pinY - 2; | |
long process3 = diagram.addShape(pinX, pinY, widthparam, heightparam, MasterRectangle, 0); | |
Shape processShape3 = diagram.getPages().getPage(pageNumber).getShapes().getShape(process3); | |
processShape3.getText().getValue().add(new Txt("PROCESS")); | |
processShape3.setName("PROCESS"); | |
processShape3.getXForm().getLocPinX().getUfe().setF("Width*0.5"); | |
processShape3.getXForm().getLocPinY().getUfe().setF("Height*0.5"); | |
pinY = pinY - 2; | |
long process4 = diagram.addShape(pinX, pinY, widthparam, heightparam, MasterRectangle, 0); | |
Shape processShape4 = diagram.getPages().getPage(pageNumber).getShapes().getShape(process4); | |
processShape4.getText().getValue().add(new Txt("PROCESS")); | |
processShape4.setName("PROCESS"); | |
processShape4.getXForm().getLocPinX().getUfe().setF("Width*0.5"); | |
processShape4.getXForm().getLocPinY().getUfe().setF("Height*0.5"); | |
long connecterId = diagram.addShape(new Shape(), connectorMaster, 0); | |
diagram.getPages().getPage(pageNumber).connectShapesViaConnector(process1, ConnectionPointPlace.BOTTOM, | |
decision1, ConnectionPointPlace.TOP, connecterId); | |
long connecterId1 = diagram.addShape(new Shape(), connectorMaster, 0); | |
diagram.getPages().getPage(pageNumber).connectShapesViaConnector(decision1, ConnectionPointPlace.BOTTOM, | |
process2, ConnectionPointPlace.TOP, connecterId1); | |
long connecterId2 = diagram.addShape(new Shape(), connectorMaster, 0); | |
diagram.getPages().getPage(pageNumber).connectShapesViaConnector(process2, ConnectionPointPlace.BOTTOM, | |
process3, ConnectionPointPlace.TOP, connecterId2); | |
long connecterId3 = diagram.addShape(new Shape(), connectorMaster, 0); | |
diagram.getPages().getPage(pageNumber).connectShapesViaConnector(process3, ConnectionPointPlace.BOTTOM, | |
process4, ConnectionPointPlace.TOP, connecterId3); | |
long connecterId4 = diagram.addShape(new Shape(), connectorMaster, 0); | |
diagram.getPages().getPage(pageNumber).connectShapesViaConnector(decision1, ConnectionPointPlace.RIGHT, | |
process4, ConnectionPointPlace.TOP, connecterId4); | |
// Set automatic layout options | |
com.aspose.diagram.LayoutOptions layoutOptions = new com.aspose.diagram.LayoutOptions(); | |
layoutOptions.setLayoutStyle(com.aspose.diagram.LayoutStyle.FLOW_CHART); | |
layoutOptions.setDirection(com.aspose.diagram.LayoutDirection.BOTTOM_TO_TOP); diagram.layout(layoutOptions); | |
com.aspose.diagram.DiagramSaveOptions options = new com.aspose.diagram.DiagramSaveOptions(com.aspose.diagram.SaveFileFormat.VSDX); | |
diagram.save( "flowchart.vsdx", options); | |
System.out.println("Done"); | |
} | |
} |
यह कोड स्निपेट जावा में फ़्लोचार्ट बनाने के लिए एक मूल संस्करण है। आरेख वर्ग का उपयोग कुछ मास्टर आकृतियों को लोड करने, लेआउट निर्दिष्ट करने और आउटपुट फ़्लोचार्ट को निर्यात करने के लिए किया जाता है। हालाँकि, कुछ कस्टम कक्षाओं का उपयोग विभिन्न कनेक्टर और विभिन्न आकार बनाने के लिए भी किया जाता है, जिन्हें आप अपनी आवश्यकताओं को पूरा करने के लिए और सुधार सकते हैं।
इस ट्यूटोरियल में जावा में फ्लो चार्ट बिल्डर बनाने के लिए जानकारी संकलित की गई है। इसके अलावा, यदि आपको छवियों को विज़ियो आरेख में परिवर्तित करने की आवश्यकता है तो जावा में इमेज को Visio में कैसे परिवर्तित करें पर लेख पर जाएं।