A graphic layout method, device, electronic device and storage medium
By determining the custom module size data and the coordinates to be laid out in the graphics layout tool, and automatically laying the logical structure diagram, the problems of strong limitations of graphics layout and poor user experience in the existing technology are solved, and more efficient graphics layout and user experience improvement are achieved.
Patent Information
- Application Number
- CN202111395065.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-23
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2041-11-23
AI Technical Summary
When editing and running logical structure diagrams in the existing technology, the graph layout tool has strong limitations and cannot achieve reasonable graphical layout of the running logical structure diagrams, resulting in poor user experience.
By determining the custom module size data of the custom to-layout module of the object to be laid out, the to-layout coordinates of the custom to-layout module and the basic to-layout module in the object to be laid out are determined based on the module basic data and the custom to-layout module size data, and then the logical structure diagram is automatically laid out.
It improves the scalability of graphics, realizes automatic and reasonable graphics layout, and improves user experience.
Smart Images

Figure CN114047912B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of computer application technologies, and in particular, to a graphic layout method, apparatus, electronic device, and storage medium. Background Art
[0002] With the development of computer technologies, the programming languages for editing application programs have been continuously enriched. Among them, graphic programming languages stand out from numerous programming languages with the characteristics of being vivid, intuitive, and highly practical. An important application direction of graphic editing languages is to edit an operation logic structure diagram composed of multiple graphics and the connections between the graphics according to the operation logic of a device, so as to intuitively reflect the operation logic of the device through the operation logic structure diagram, thereby facilitating technicians to maintain the device. For example, the device can be a PLC, and the operation logic structure diagram can be a ladder diagram.
[0003] Currently, when editing an operation logic structure diagram, mainly use the drag-and-drop method to select graphics in the interface of a graphic layout tool and layout the selected graphics. However, the dragged graphics depend on the graphic library of the graphic layout tool, that is, only the graphics in the graphic library of the graphic layout tool can be dragged, resulting in strong limitations in laying out graphics in the existing operation logic structure diagram, and the drag-and-drop method cannot achieve a reasonable layout of the graphics in the operation logic structure diagram, resulting in a poor user experience. Summary of the Invention
[0004] Embodiments of the present invention provide a graphic layout method, apparatus, electronic device, and storage medium, which can improve the scalability of graphics, automatically and reasonably layout the graphics, and enhance the user experience.
[0005] In a first aspect, an embodiment of the present invention provides a graphic layout method, including:
[0006] Determine the custom module size data of the custom to-be-layout module of the to-be-layout object;
[0007] Determine the to-be-layout coordinates of the custom to-be-layout module and the basic to-be-layout module in the to-be-layout object according to the module basic data of the to-be-layout object and the custom module size data of the custom to-be-layout module;
[0008] Automatically layout the operation logic structure diagram of the to-be-layout object according to the to-be-layout coordinates, the custom to-be-layout module, and the basic to-be-layout module.
[0009] In a second aspect, an embodiment of the present invention further provides a graphic layout apparatus, including:
[0010] A custom module size data determination module, configured to determine the custom module size data of the custom to-be-layout module of the to-be-layout object;
[0011] A to-be-layout coordinate determination module, configured to determine the to-be-layout coordinates of a custom to-be-layout module and a basic to-be-layout module in a to-be-layout object according to the module basic data of the to-be-layout object and the custom module size data of the custom to-be-layout module;
[0012] An automatic layout module, configured to automatically layout the operation logic structure diagram of the to-be-layout object according to the to-be-layout coordinates, the custom to-be-layout module, and the basic to-be-layout module.
[0013] Thirdly, an embodiment of the present invention further provides an electronic device, where the electronic device includes:
[0014] One or more processors;
[0015] A storage device, configured to store one or more programs;
[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the graphic layout method provided in any embodiment of the present invention.
[0017] Fourthly, an embodiment of the present invention further provides a computer storage medium, on which a computer program is stored, and when the program is executed by a processor, the graphic layout method provided in any embodiment of the present invention is implemented.
[0018] The technical solution of this embodiment determines the custom module size data of the custom to-be-layout module of the to-be-layout object, and thus determines the to-be-layout coordinates of the custom to-be-layout module and the basic to-be-layout module in the to-be-layout object according to the module basic data of the to-be-layout object and the custom module size data of the custom to-be-layout module, and then layouts the operation logic structure diagram of the to-be-automatically-layout object according to the to-be-layout coordinates, the custom to-be-layout module, and the basic to-be-layout module. The custom to-be-layout module in this solution can be independently edited, which can improve the scalability of the graphic. Since the custom module size data can represent the size of the custom to-be-layout module, considering the custom module size data when determining the to-be-layout coordinates of the custom to-be-layout module and the basic to-be-layout module can ensure the rationality of the automatic module layout and avoid the situation of module layout disorder caused by not considering the custom module size data, solving the problems of strong limitations of layoutable graphics and unreasonable graphic layout in the prior art when drawing the operation logic structure diagram, improving the scalability of the graphic, automatically and reasonably laying out the graphic, and enhancing the user experience. Description of the Drawings
[0019] Figure 1 is a flowchart of a graphic layout method provided in Embodiment 1 of the present invention;
[0020] Figure 2 is a flowchart of a graphic layout method provided in Embodiment 2 of the present invention;
[0021] Figure 3 It is a schematic diagram of a custom to-be-layout module provided in the second embodiment of the present invention;
[0022] Figure 4 It is a running logic structure diagram of a PLC provided in the second embodiment of the present invention;
[0023] Figure 5 It is a schematic diagram of a graphic layout device provided in the third embodiment of the present invention;
[0024] Figure 6 It is a schematic structural diagram of an electronic device provided in the fourth embodiment of the present invention. Detailed implementation manners
[0025] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the present invention, rather than limiting the present invention.
[0026] In addition, it should be noted that for the sake of convenience of description, only parts related to the present invention rather than all contents are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the operations (or steps) as sequential processes, many of the operations can be implemented in parallel, concurrently, or simultaneously. In addition, the order of the operations can be rearranged. When the operations are completed, the process can be terminated, but there can also be additional steps not included in the drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0027] Embodiment 1
[0028] Figure 1 It is a flowchart of a graphic layout method provided in the first embodiment of the present invention. This embodiment is applicable to the situation of automatically and reasonably laying out the running logic structure diagram including a custom to-be-layout module. This method can be executed by a graphic layout device, which can be implemented in a software and / or hardware manner and is generally integrated in an electronic device. Correspondingly, as Figure 1 shown, this method includes the following operations:
[0029] S110. Determine the custom module size data of the custom to-be-layout module of the to-be-layout object.
[0030] Among them, the object to be laid out can be an object with a running logic. For example, the object to be laid out can include, but is not limited to, a controller and a service processing flow, etc. The custom layout module can be a custom module that can be independently edited and meets the application requirements. The object to be laid out can implement the layout of the running logic structure diagram through the custom layout module and the basic layout module, or can also implement the layout of the running logic structure diagram only through the basic layout module. Among them, the running logic structure diagram can be a structure diagram composed of multiple modules and the connections between the modules, and is used to represent the running logic of the object to be laid out. The so-called running logic can be the logic of the data processing flow between the modules, and the embodiments of the present invention do not limit this. Optionally, the custom layout module can be a module obtained by re-editing on the basis of the original modules that need to be laid out of the object to be laid out, or can be a module obtained by independently editing without relying on the original modules that need to be laid out of the object to be laid out. The embodiments of the present invention do not limit the specific acquisition method of the custom layout module. The custom module size data can include data for measuring the size of the module, such as the length data and width data of the custom layout module.
[0031] In the prior art, the graphical layout tool for generally laying out the running logic structure diagram can only provide the user with the graphics existing in its own graphics library, and cannot provide the graphics outside its own graphics library. In a specific example, when the object to be laid out is a PLC (Programmable Logic Controller), the running structure logic diagram can be a ladder diagram. Generally, the existing software for drawing ladder diagrams will provide the user with some basic layout modules, and technicians can select the basic layout modules from the graphics library of the ladder diagram drawing software according to the running logic of the PLC, but cannot flexibly customize the modules.
[0032] In the embodiments of the present invention, if it is determined that the object to be laid out needs to use the custom layout module to layout the running logic structure diagram, the custom layout module can be first determined according to the application requirements of the object to be laid out (such as the functions to be implemented, etc.), and then the custom module size data can be obtained by measuring the custom layout module. This solution can determine the custom layout module outside the basic layout module according to the application requirements of the object to be laid out, and solves the problem of strong limitations in the module layout of the existing running logic structure diagram.
[0033] S120. Determine the coordinates to be laid out of the custom layout module and the basic layout module in the object to be laid out according to the module basic data of the object to be laid out and the custom module size data of the custom layout module.
[0034] Among them, the module basic data may be the data required for module layout in the object to be laid out. Optionally, the module basic data may include, but is not limited to, the connection relationship between modules of the object to be laid out, the size data of non-customizable modules to be laid out in the object to be laid out, and the spacing between modules, etc. The basic module to be laid out may be a module that originally needs to be laid out in the object to be laid out and does not need to be edited again, that is, the basic module to be laid out may be a non-customizable module to be laid out. The coordinates to be laid out can be used to layout the customizable modules to be laid out and the basic modules to be laid out of the object to be laid out in the image interface.
[0035] In the embodiment of the present invention, after obtaining the customizable module size data, the module basic data of the object to be laid out can be further determined according to the application requirements of the object to be laid out, and then the coordinates to be laid out that prevent the customizable module to be laid out and the basic module to be laid out from overlapping can be calculated based on the module basic data of the object to be laid out and the customizable module size data of the customizable module to be laid out.
[0036] S130. Automatically layout the operation logic structure diagram of the object to be laid out according to the coordinates to be laid out, the customizable module to be laid out, and the basic module to be laid out.
[0037] In the embodiment of the present invention, the customizable module to be laid out and the basic module to be laid out can be automatically laid out according to the coordinates to be laid out. After the automatic layout of the customizable module to be laid out and the basic module to be laid out is completed, the connection lines between the modules with connection relationships can be automatically generated, so as to obtain the operation logic structure diagram of the object to be laid out.
[0038] The technical solution of this embodiment determines the customizable module size data of the customizable module to be laid out in the object to be laid out, so as to determine the coordinates to be laid out of the customizable module to be laid out and the basic module to be laid out in the object to be laid out according to the module basic data of the object to be laid out and the customizable module size data of the customizable module to be laid out, and then layout the operation logic structure diagram of the object to be automatically laid out according to the coordinates to be laid out, the customizable module to be laid out, and the basic module to be laid out. The customizable module to be laid out in this solution can be edited independently, which can improve the scalability of the graph. Since the customizable module size data can represent the size of the customizable module to be laid out, considering the customizable module size data when determining the coordinates to be laid out of the customizable module to be laid out and the basic module to be laid out can ensure the rationality of the automatic layout of the module and avoid the situation of module layout disorder caused by not considering the customizable module size data, solving the problems of strong limitations of layoutable graphics and unreasonable graphic layout in the prior art when drawing the operation logic structure diagram, improving the scalability of the graph, automatically and reasonably laying out the graph, and enhancing the user experience.
[0039] Embodiment 2
[0040] At present, when PLC manufacturers develop products based on different hardware and system operation platforms, they have defined five programming languages (instruction list language, structured text language, function block diagram language, ladder diagram language, and sequential function block diagram language). The standardization of programming languages has played a crucial role in the development of PLC software technology and even the entire industrial control software technology. Due to the strong intuitiveness and easy learning characteristics of the ladder diagram, hardware manufacturers will provide users with a ladder diagram editing software when providing PLCs. After the ladder diagram language written in the ladder diagram editing software is compiled, corresponding codes are generated, and then the generated codes are downloaded to the PLC to realize the operation of devices such as PLC-driven motor controllers.
[0041] However, the various modules that make up the ladder diagram are relatively fixed, and the hardware of different manufacturers is different, resulting in the inability to flexibly customize modules when constructing the existing ladder diagram. Due to the inability to flexibly customize modules in the existing technology, it is even more impossible to use the customized modules to assist in laying out the operation logic structure diagram.
[0042] Figure 2 It is a flowchart of a graphic layout method provided in the second embodiment of the present invention. This embodiment is specific based on the above embodiment. In this embodiment, specific optional implementation manners for determining the custom module size data of the custom to-be-layout module of the to-be-layout object and determining the to-be-layout coordinates of the custom to-be-layout module and the basic to-be-layout module in the to-be-layout object according to the module basic data of the to-be-layout object and the custom module size data of the custom to-be-layout module are given. Correspondingly, as Figure 2 shown, the method includes the following operations:
[0043] S210. Obtain the variable unit of the custom to-be-layout module.
[0044] Among them, the variable unit can be a component of the custom to-be-layout module for enabling the custom to-be-layout module to communicate with the outside. Optionally, the variable unit can include an input variable unit and an output variable unit, etc. The custom to-be-layout module can include at least one input variable unit and at least one output variable unit, etc. Exemplarily, the custom to-be-layout module can receive external data that needs to be sent to this module through the input variable unit, and can also send the data that this module needs to send to the outside through the output variable unit.
[0045] In the embodiment of the present invention, the logical function to be implemented by the custom to-be-layout module can be determined according to the application requirements of the to-be-layout object, and then the variable unit required by the custom to-be-layout module can be determined according to the logical function to be implemented by the custom to-be-layout module, so that the custom to-be-layout module can receive external data through the variable unit and send data to the outside.
[0046] In an alternative embodiment of the present invention, the object to be laid out may include a PLC, the basic module to be laid out may include a contact module, a coil module, and a ladder pin module; the custom module to be laid out may include a custom logic function module.
[0047] Among them, the contact module may be a module representing the contact function. Optionally, the contact module may include a normally open contact module and a normally closed contact module. The coil module may be used to represent a module with the functions of coil energization and de-energization. The ladder pin module may be a pin representing the connection to the bus bar when the object to be laid out is a PLC. The custom logic function module may be a module with custom logic functions. For example, the custom logic function module may include, but is not limited to, a summation function module and a logical operation function module, etc.
[0048] S220. Determine the custom module size data of the custom module to be laid out according to the variable unit association data of the variable units of the custom module to be laid out.
[0049] Among them, the variable unit association data may be data associated with the variable units of the custom module to be laid out, and is used to represent the graphical features of the variable units.
[0050] In the embodiments of the present invention, the variable unit association data may be determined according to the characteristics of all the variable units of the custom module to be laid out (such as size, quantity, and the position connected to the custom module to be laid out, etc.), and then the custom module size data of the custom module to be laid out including the variable units may be determined according to the variable unit association data.
[0051] Exemplarily, when the object to be laid out is a PLC, assuming that the custom module to be laid out is a module with a summation function, before calculating the layout coordinates of the custom module to be laid out with a summation function, it is first necessary to determine the data related to the input variable units and output variable units of the custom module to be laid out with a summation function, and then calculate the custom module size data of the custom module to be laid out with a summation function according to the data related to the input variable units and output variable units.
[0052] In an alternative embodiment of the present invention, the variable unit association data may include the quantity of the variable units and the length of the target variable unit; determining the custom module size data of the custom module to be laid out according to the variable unit association data of the variable units of the custom module to be laid out may include: determining the height of the custom module to be laid out according to the quantity of the variable units; determining the width of the custom module to be laid out according to the length of the target variable unit.
[0053] Among them, the target variable unit may be the variable unit with the largest length on one side of the custom module to be laid out, and is used to determine the width of the custom module to be laid out.
[0054] In an embodiment of the present invention, variable unit association data may be obtained first, and then the number of variable units of the custom to-be-layout module and the length of the target variable unit may be determined according to the variable unit association data. After obtaining the number of variable units and the length of the target variable unit, the height of the custom to-be-layout module may be calculated according to the number of variable units and the height data of the variable units. It is also possible to determine the target variable unit with the largest length on each side among the horizontal two sides of the custom to-be-layout module according to the variable unit association data, and then determine the width of the custom to-be-layout module according to the lengths of the two target variable units with the largest length on each side among the horizontal two sides of the custom to-be-layout module, the preset spacing between the variable unit and the custom original module before the variable unit is connected to the custom to-be-layout module, and the length of the custom original module before the variable unit is connected to the custom to-be-layout module. Among them, the custom original module of the custom to-be-layout module may be the original component of the custom to-be-layout module that has not been self-edited and does not include variable units.
[0055] Figure 3 is a schematic diagram of a custom to-be-layout module provided in the second embodiment of the present invention, as Figure 3As shown in the figure, the custom module to be laid out includes a custom original module, two input variable units, and an output variable unit. The input variable units are arranged on the left side of the custom original module, and the output variable unit is arranged on the right side of the custom original module. Assume that the length of the custom original module before connecting the variable units is 3 cm, the length of input variable unit A is 1 cm, the length of input variable unit B is 0.5 cm, the length of output variable unit C is 0.5 cm, and the preset spacing between the variable unit and the custom original module before connecting the variable units of the custom module to be laid out is 0.2. Then the width of the custom module to be laid out is 4.9 cm (3 cm + 1 cm + 0.5 cm + 0.2 + 0.2). If the height of the custom original module before connecting the variable units of the custom module to be laid out is 5 cm, the height of the input variable unit and the output variable unit is 0.2 cm, and the spacing between two adjacent variable units in the vertical direction is 1 cm. Assume that input variable unit A is arranged at half of the height of the custom original module before connecting the variable units of the custom module to be laid out (the upper boundary of input variable unit A is at the same height as half of the base height). Then the height of input variable unit B is arranged 1.2 cm downward from the upper boundary of input variable unit A. Since the lower boundary of input variable unit B does not go below the lower boundary of the custom original module before connecting the variable units of the custom module to be laid out, the custom module to be laid out does not need to increase the height of the custom original module. In the case where the lower boundary of the input variable unit and / or the output variable unit is lower than the custom original module, the custom module to be laid out needs to increase the height of the custom original module so that the height of the custom original module of the custom module to be laid out is the same as the lower boundary of the output variable unit, or the height of the custom original module of the custom module to be laid out is lower than the lower boundary of the output variable unit to ensure the aesthetics of the custom module to be laid out.
[0056] S230. Determine the layout coordinates of the custom module to be laid out and the basic module to be laid out in the object to be laid out according to the module basic data of the object to be laid out and the custom module size data of the custom module to be laid out.
[0057] In an alternative embodiment of the present invention, the operation logic structure diagram may include multiple local sub-models; determining the layout coordinates of the custom layout module and the basic layout module in the object to be laid out according to the module basic data of the object to be laid out and the custom module size data of the custom layout module to be laid out may include: determining the reference layout coordinates of the reference basic layout module in the current local sub-model; determining the connection relationship data of the basic layout module and / or the custom layout module in the current local sub-model according to the module basic data; and determining the layout coordinates of the basic layout module and / or the custom layout module in the current local sub-model according to the reference layout coordinates, the connection relationship data, the fixed module size data of the basic layout module, and the custom module size data of the custom layout module.
[0058] Among them, the local sub-model may be a part of the operation logic structure diagram. Exemplarily, when the object to be laid out is a PLC, the local sub-model may be a rung of a ladder diagram. When the object to be laid out is a business processing flow, the local sub-model may be a business processing sub-flow. The current local sub-model may be the local sub-model for which the layout coordinates of each module need to be determined currently. The reference basic layout module may be the basic layout module for which the layout coordinates need to be determined first in the current local sub-model. The reference layout coordinates may be the layout coordinates of the basic layout module that needs to be determined first in the current local sub-model. The connection relationship data may be used to represent the connection relationship between modules. The fixed module size data may be the module size data of the basic layout module.
[0059] In an embodiment of the present invention, when the operation logic structure diagram includes multiple local sub-models, it is possible to first determine the reference basic layout module that needs to determine the layout coordinates first in the current local sub-model and calculate the reference layout coordinates of the reference basic layout module. After obtaining the reference layout coordinates, the module basic data may be further parsed to determine the connection relationship data of the basic layout module and / or the custom layout module in the current local sub-model, so as to determine the layout coordinates of the basic layout module or the custom layout module connected to the reference basic layout module according to the reference layout coordinates, the connection relationship data, the fixed module size data of the basic layout module, and the custom module size data of the custom layout module, and so on to obtain the layout coordinates of the basic layout module and / or the custom layout module in the current local sub-model.
[0060] In the embodiment of the present invention, when the object to be laid out is a PLC, a point can be selected as the coordinate origin in the graphical layout interface of the graphical layout of the operation logic result diagram, and a coordinate system of the coordinate origin can be established. For example, the center of the graphical layout interface can be used as the origin, and the horizontal and vertical perpendicular bisectors of the graphical layout interface can be used as the horizontal and vertical coordinate axes respectively to establish a coordinate system. After the coordinate system is established, the left busbar can be further determined randomly or according to the layout strategy in the established coordinate system, and a point on the left busbar can be selected to connect the trapezoidal pin module of the first ladder. At this time, the trapezoidal pin module can be used as the reference basic module to be laid out, and the intersection coordinate of the trapezoidal pin module connected to the left busbar can be used as the reference layout coordinate of the reference basic module to be laid out. When the current ladder is not the first ladder, the first module to be laid out in this ladder (trapezoidal pin module or basic module to be laid out) can be used as the reference basic module to be laid out, and the coordinate of the first module to be laid out can be used as the reference layout coordinate.
[0061] For a PLC, the operation logic structure diagram can also be called a ladder diagram. The operation logic structure diagram can include multiple ladders, and each ladder represents an independent logic unit. Figure 4 It is an operation logic structure diagram of a PLC provided in the second embodiment of the present invention. Assume that the operation logic structure diagram to be laid out is as Figure 4 shown. In the first ladder, it includes a ring parallel structure, a serial structure, and a non-ring parallel structure. Among them, contact modules A, B, C, and D are connected in a ring parallel manner, and trapezoidal pin module P1, contact module A, contact module B, and coil module a are connected in series. Contact modules E, F, and G are connected in series with coil module b, which belongs to the non-ring parallel structure of the first ladder. In the second ladder, trapezoidal pin module P2, contact module H, custom module A to be laid out, contact module I, and coil module c are connected in series in sequence to form a serial structure. In the third ladder, trapezoidal pin module P3, custom module B to be laid out, custom module C to be laid out, and coil module d are connected in series in sequence to form a serial structure. After determining the connection relationship of each module in the operation logic structure diagram of the PLC, the left busbar can be further set in the graphical interface of the graphical layout, such as Figure 4 the leftmost vertical line in the figure, and the layout coordinates of each module in the ladder diagram can be calculated in sequence. After obtaining the coordinates of each module, each module can be further connected.
[0062] Optionally, if other modules need to be connected to both sides of the current basic module to be arranged, pin modules with a fixed length are arranged on the left and right sides at half the height of the current basic module to be arranged. If the current basic module to be arranged is not a trapezoidal pin module and other modules need to be connected to one side of the current basic module to be arranged, a pin module with a fixed length is arranged at half the height of the current basic module to be arranged on the side where other modules need to be connected. The specific arrangement height of the pin module in the current module is not limited in the embodiments of the present invention. Among them, the pin module can be a module where each module in the ladder diagram of the PLC is connected to the connection line, and both the trapezoidal pin module and it are composed of straight lines and circles. After the layout of the pin module is completed, the trapezoidal pin module can be connected to the left pin module of the module having a connection relationship with the trapezoidal pin module through a straight line or a broken line, and the coil module can be connected to the right pin module of the module having a connection relationship through the left pin module. When other modules need to be connected to both sides of the current module, the left pin module of the current module is connected to the right pin module of the module that is arranged prior to the current module and has a series connection relationship with the current module through a straight line. The right pin module of the current module is connected to the left pin module of the module that is arranged after the current module and has a series connection relationship with the current module through a straight line.
[0063] In the embodiments of the present invention, the coordinates of the basic module to be arranged in series with the trapezoidal pin module in the current ladder can be calculated based on the following formula:
[0064] x b = x p + ΔW
[0065] y b = y p
[0066] Based on the following formula, the coordinates of the basic module to be arranged in parallel connection with the trapezoidal pin module in the current ladder can be calculated:
[0067] x b = x p + ΔW
[0068] y b = y p + Δh
[0069] Among them, x b can represent the abscissa of the contact module or the coil module connected to the trapezoidal pin module in the current ladder. y b can represent the ordinate of the contact module or the coil module connected to the trapezoidal pin module in the current ladder. ΔW can represent the horizontal distance between the starting ends of two adjacent modules set in advance. x p can represent the abscissa of the trapezoidal pin module in the current ladder, y pIt can represent the ordinate of the trapezoidal pin module of the current step. Δh can represent the vertical distance between the upper boundaries of two adjacent modules set in advance.
[0070] Exemplarily, taking half of the module to be laid out based on the layout height of the pin module as an example, when the coordinates of the trapezoidal pin module P1 of the first step are (20, 20), ΔW = 100, and Δh = 100, the abscissa of the contact module A connecting the trapezoidal pin module of the first step is 120 (100 + 20), and the ordinate of the contact module A is 20.
[0071] In the embodiment of the present invention, if the module to be laid out based on the current basis in series is the module to be laid out based on the current basis, the coordinates of the module to be laid out based on the current basis in series can be calculated according to the following formula:
[0072] x b = x + ΔW
[0073] y b = y
[0074] If the module to be laid out based on the current basis in parallel is the module to be laid out based on the current basis, the coordinates of the module to be laid out based on the current basis in parallel can be calculated according to the following formula:
[0075] x b = x + ΔW
[0076] y b = y + Δh
[0077] Wherein, x can represent the abscissa of the module to be laid out based on the current basis. y can represent the ordinate of the module to be laid out based on the current basis. ΔW can be the horizontal distance between the starting ends of two adjacent modules set in advance. x b can represent the abscissa of the module to be laid out based on the current basis connected to the current module to be laid out based on the current basis. y b can represent the ordinate of the module to be laid out based on the current basis connected to the current module to be laid out based on the current basis. Δh can represent the vertical distance between the upper boundaries of two adjacent modules set in advance.
[0078] Exemplarily, when the coordinates of the contact module A are (120, 20), the maximum allowable height of the interval (the maximum allowable height between the lower boundary of the upper module and the lower boundary of the lower module among two adjacent upper and lower modules) is set to 100, the heights of the coil module and the contact module are the same, both being 40, ΔW = 100, and Δh = 100, the abscissa of the contact module B connected to the contact module A is 220 (120 + 100), the ordinate of the contact module B is 20, the abscissa of the coil module a connected to the contact module B is 320 (220 + 100), and the ordinate of the coil module a is 20. Since the height difference between the maximum lower boundary height of the module that has completed the calculation of the coordinates to be laid out and the height of its own pin module is 20, and the height difference does not exceed the maximum allowable height of the interval, the abscissa of the contact module C is obtained as 120 (20 + 100), the ordinate of the contact module C is 120 (20 + 100), or the abscissa of the contact module A is used as the abscissa of the contact module C, and the sum value of the ordinate value of the contact module A and Δh is used as the ordinate value of the contact module C. The abscissa of the contact module D connected to the contact module C is 220 (120 + 100), and the ordinate of the contact module D is 120. Similarly, the coordinates of the contact module D can be determined according to the coordinates of the contact module B. If the height difference between the maximum lower boundary height of the module that has completed the calculation of the coordinates to be laid out and the height of its own pin module is 125, then the height difference exceeds the maximum allowable height of the interval. At this time, the ordinate of the contact module C is the sum value of the maximum lower boundary height of the module that has completed the calculation of the coordinates to be laid out and the preset vertical spacing.
[0079] Since the height difference between the height of the contact module with the maximum height in the parallel connection part of the first stage and the height of its own pin module is 20, which does not exceed 100, similarly, the coordinates of the contact module E (120, 220), the coordinates of the contact module F (220, 220), the coordinates of the contact module G (320, 220), and the coordinates of the coil module b are (420, 220) can be obtained. Since there is a difference between the ordinate of the contact module C and the ordinate of the trapezoidal pin module of the first stage, the two modules can be connected by a broken line starting from the midpoint of the line connecting the trapezoidal pin module and the contact module A and ending at the left pin module of the contact module C. Similarly, the two modules can be connected by a broken line starting from the midpoint of the line connecting the trapezoidal pin module and the contact module A and ending at the left pin module of the contact module E. Since the height difference between the module with the maximum height in the first stage and the height of its own pin module is 20, which is less than the maximum allowable height of the interval, the abscissa of the contact module H in the second stage is 120 (20 + 100), the ordinate of the contact module H is 320 (20 + 100 + 100 + 100), and the coordinates to be laid out of the trapezoidal pin module P2 in the second stage connected in series with the contact module H are (20, 320).
[0080] In an embodiment of the present invention, if a custom to-be-layout module is in series with the current basic to-be-layout module, the coordinates of the custom to-be-layout module in series with the current to-be-layout module can be calculated according to the following formula:
[0081] x f = x + ΔW + W v1
[0082] y f = y
[0083] If a custom to-be-layout module is in parallel with the current basic to-be-layout module, the coordinates of the custom to-be-layout module in parallel with the current to-be-layout module can be calculated according to the following formula:
[0084] x f = x + ΔW + W v1
[0085] y f = y + Δh
[0086] Among them, x can represent the abscissa of the current basic to-be-layout module. y can represent the ordinate of the current basic to-be-layout module. ΔW can be the horizontal spacing preset between the starting ends of two adjacent modules. x f can represent the abscissa of the custom to-be-layout module connected to the current to-be-layout module. y f can represent the ordinate of the custom to-be-layout module connected to the current to-be-layout module. Δh can represent the vertical spacing preset between the upper boundaries of two adjacent modules above and below. W v1 is the length of the left target variable unit of the custom to-be-layout module having a connection relationship with the current basic to-be-layout module.
[0087] Exemplarily, taking the abscissa of the contact module H as 120 and the ordinate as 320 as an example, and assuming that W v1 is 40 and ΔW is 100, the abscissa of the custom to-be-layout module A is 260 (120 + 100 + 40), and the ordinate of the custom to-be-layout module A is 320.
[0088] In an embodiment of the present invention, if a basic to-be-layout module is in series with the current custom to-be-layout module, the coordinates of the basic to-be-layout module in series with the current custom to-be-layout module can be calculated according to the following formula:
[0089] x b = x + W f + ΔW - W v1
[0090] y b = y
[0091] If the module to be arranged customarily currently in parallel is the module to be arranged based, the coordinates of the module to be arranged based in parallel with the module to be arranged customarily currently can be calculated according to the following formula:
[0092] x b = x + W f + ΔW - W v1
[0093] y b = y + Δh
[0094] Wherein, x can represent the abscissa of the module to be arranged customarily currently. y can represent the ordinate of the module to be arranged customarily currently. ΔW can be the horizontal spacing between the starting ends of two adjacent modules set in advance. W f can represent the width of the module to be arranged currently. W v1 is the length of the target variable unit on the left side of the module to be arranged currently. x b can represent the abscissa of the module to be arranged based connected to the module to be arranged customarily currently. y b can represent the ordinate of the module to be arranged based connected to the module to be arranged customarily currently. Δh can represent the vertical spacing between the upper boundaries of two adjacent modules above and below set in advance.
[0095] Exemplarily, when the abscissa of the customarily arranged module A is 260, the ordinate is 320, W f is 100, and W v1 is 40, the abscissa of the contact module I is 420 (260 + 100 + 100 - 40), and the ordinate of the contact module I is 320. The abscissa of the coil module C connected to the contact module I is 520 (420 + 100), and the ordinate of the coil module C is 320.
[0096] In the embodiment of the present invention, the coordinates of the customarily arranged module in series with the trapezoidal pin module of the current ladder can be calculated based on the following formula:
[0097] x f = x p + ΔW + W v1
[0098] y f = y p
[0099] Based on the following formula, the coordinates of the customarily arranged module in parallel with the trapezoidal pin module of the current ladder can be calculated:
[0100] x f = x p + ΔW + W v1
[0101] y f = y p + Δh
[0102] where x f can represent the abscissa of a custom module to be laid out connected to the current stepped trapezoidal pin module. y f can represent the ordinate of a custom module to be laid out connected to the current stepped trapezoidal pin module. ΔW can be the horizontal spacing preset between the starting ends of two adjacent modules. x p can represent the abscissa of the stepped trapezoidal pin module of the current step, and y p can represent the ordinate of the stepped trapezoidal pin module of the current step. W v1 can represent the length of the target variable unit on the left side of the custom module to be laid out. Δh can represent the vertical spacing preset between the upper boundaries of two adjacent modules above and below.
[0103] Exemplarily, when the custom module A to be laid out is the module with the largest height in the second step, if the difference between the height of the lower boundary of the custom module A and the height of the pin module of the custom module A is less than 100, the ordinate of the custom module B is 420. If the difference between the height of the lower boundary of the custom module A and the height of the pin module of the custom module A is greater than or equal to 100, the sum of the height of the lower boundary of the custom module A and 100 is used as the ordinate of the custom module B. When the difference between the height of the lower boundary of the custom module A and the height of the pin module of the custom module A is less than 100, the abscissa of the custom module B is 160 (20 + 100 + 40), and the ordinate of the custom module B is 420. The coordinates of the trapezoidal pin module P3 are (20, 420).
[0104] In the embodiments of the present invention, if the custom module to be laid out in series with the current custom module to be laid out is a custom module to be laid out, the coordinates of the custom module to be laid out in series with the current module to be laid out can be calculated according to the following formula:
[0105] x f = x + W f - W v1 + W v2
[0106] y f = y, or
[0107] x f = x + W f - W v1 + W v2 + ΔW 1
[0108] yf = y
[0109] If the module to be custom - layout connected in parallel with the current module to be custom - layout is a module to be custom - layout, the coordinates of the module to be custom - layout connected in parallel with the current module to be custom - layout can be calculated according to the following formula:
[0110] x f = x + W f - W v1 + W v2
[0111] y f = y + Δh, or
[0112] x f = x + W f - W v1 + W v2 + ΔW 1
[0113] y f = y + Δh
[0114] Among them, x can represent the abscissa of the current module to be custom - layout. y can represent the ordinate of the current module to be custom - layout. W f can represent the width of the current module to be custom - layout. W v2 can represent the length of the left target variable unit of the module to be custom - layout connected to the current module to be custom - layout. W v1 can represent the length of the left target variable unit of the current module to be custom - layout. x f can represent the abscissa of the module to be custom - layout connected to the current module to be custom - layout. y f can represent the ordinate of the module to be custom - layout connected to the current module to be custom - layout. ΔW 1 can represent the preset growth spacing. When the module to be custom - layout connected to the current module to be custom - layout overlaps with the current module to be custom - layout, the abscissa of the module to be custom - layout connected to the current module to be custom - layout can be calculated according to x f = x + W f - W v1 + W v2 + ΔW 1 Δh can represent the vertical spacing between the upper boundaries of two adjacent modules arranged vertically and set in advance.
[0115] Exemplarily, taking the coordinates to be layout of the module to be custom - layout B as (160, 420) as an example, assuming W v1 is 40, W v2 is 40, the W of the module to be custom - layout B fis 100, and the width of the custom module C to be laid out f is 100. The abscissa of the custom module C to be laid out is 260 (160 + 100 - 40 + 40), and the ordinate of the custom module C to be laid out is 420. The abscissa of the coil module D is 420 (260 + 100 + 100 - 40), and the ordinate of the coil module D is 420.
[0116] In an optional embodiment of the present invention, if the current local sub-model includes a custom module to be laid out, then according to the reference coordinates to be laid out, the connection relationship data, the fixed module size data of the basic module to be laid out, and the custom module size data of the custom module to be laid out, the coordinates to be laid out of the basic module to be laid out and / or the custom module to be laid out in the current local sub-model can be determined, which may include: determining the first associated local module and the second associated local module of the custom module to be laid out in the current local sub-model; according to the reference coordinates to be laid out, the connection relationship data, the fixed module size data of the first associated local module, the preset horizontal spacing data, and the custom module size data of the custom module to be laid out, determining the coordinates to be laid out of the first associated local module and the custom module to be laid out in the current local sub-model; determining the horizontal padding spacing of the custom module to be laid out; determining the module alignment adjustment spacing between the first associated local module and the second associated local module according to the custom module size data of the custom module to be laid out, the horizontal padding spacing of the custom module to be laid out, and the preset horizontal spacing; and determining the coordinates to be laid out of the second associated local module according to the module alignment adjustment spacing.
[0117] Among them, the first associated local module may be a custom module to be laid out or a basic module to be laid out that has a connection relationship with the custom module to be laid out and needs to be laid out before the custom module to be laid out. The second associated local module may be a custom module to be laid out or a basic module to be laid out that has a connection relationship with the custom module to be laid out and needs to be laid out after the custom module to be laid out. The preset horizontal spacing data may be the spacing between the end of the previous module and the start of the next module among two adjacent modules set in advance. The horizontal padding spacing can be used to adjust the spacing between the custom module to be laid out and the second associated local module so that the second associated local module is aligned with the basic module to be laid out in other layout sub-models.
[0118] Correspondingly, in the case where there is a custom module to be laid out in the current local sub-model, the first associated local module and the second associated local module connected to the custom module to be laid out can be determined according to the connection relationship data. After obtaining the first associated local module and the second associated local module, the coordinates of the first associated local module to be laid out can be determined according to the reference coordinates of the module to be laid out, the connection relationship data, and the preset horizontal spacing data. After obtaining the coordinates of the first associated local module to be laid out, the coordinates of the custom module to be laid out in the current local sub-model can be determined according to the coordinates of the first associated local module to be laid out, the fixed module size data of the first associated local module, the preset horizontal spacing data, and the custom module size data of the custom module to be laid out. Furthermore, the horizontal padding spacing of the custom module to be laid out can be determined according to the fixed module size data of the first associated local module, the custom module size data, and the preset horizontal spacing data. After obtaining the horizontal padding spacing of the custom module to be laid out, the sum of the custom module size data of the custom module to be laid out, the horizontal padding spacing of the custom module to be laid out, and the preset horizontal spacing can be used as the module alignment adjustment spacing between the first associated local module and the second associated local module. Thus, the coordinates of the second associated local module can be determined according to the module alignment adjustment spacing, the coordinates of the first associated local module to be laid out, and the fixed module size data of the first associated local module.
[0119] Exemplarily, such as Figure 4As shown, if the current step is the second step, there is a custom module to be laid out, module A, in the current step. The first associated local module connected to the custom module to be laid out, module A, is the contact module H, and the second associated local module connected to the custom module to be laid out, module A, is the contact module I. Furthermore, the coordinates of the module to be laid out of the trapezoidal pin module P2 can be used as the reference coordinates for layout. The distance between the end of the previous module and the start of the next module among the two adjacent preset contact modules is used as the preset horizontal distance data. Then, based on the coordinates of the module to be laid out of the trapezoidal pin module P2 and the distance between the end of the previous module and the start of the next module among the two adjacent preset contact modules, the coordinates of the module to be laid out of the contact module H are determined. Based on the coordinates of the module to be laid out of the contact module H, the distance between the end of the previous module and the start of the next module among the two adjacent preset contact modules, the fixed module size data of the contact module H, and the custom module size data of the custom module to be laid out, module A, the coordinates of the module to be laid out of the custom module to be laid out, module A, are determined. After obtaining the coordinates of the contact module H and the custom module to be laid out, module A, the horizontal padding distance of the custom module to be laid out, module A, can be further determined. Thus, based on the custom module size data of the custom module to be laid out, module A, the horizontal padding distance of the custom module to be laid out, module A, and the distance between the end of the previous module and the start of the next module among the two adjacent preset contact modules, the module alignment adjustment distance between the contact module H and the contact module I is determined, so as to determine the coordinates of the module to be laid out of the contact module I according to the module alignment adjustment distance.
[0120] In an alternative embodiment of the present invention, determining the horizontal padding distance of the custom module to be laid out may include: determining the first sum data of the fixed horizontal distance between adjacent target basic modules to be laid out and the fixed module size data of the target basic module to be laid out; calculating the second sum data of the fixed module size data of the first associated local module, the preset horizontal distance, and the custom module size data of the custom module to be laid out in the current local sub-model; determining the target integer multiple data of the first sum data according to the second sum data; and determining the horizontal padding distance of the custom module to be laid out according to the difference between the target integer multiple data of the first sum data and the second sum data.
[0121] Among them, the target basic module to be laid out can be a pre-selected basic module to be laid out. The fixed horizontal spacing can be a pre-set spacing between the end of the previous target basic module to be laid out and the start end of the next target basic module among two adjacent target basic modules to be laid out. The first sum data can be the sum of the fixed horizontal spacing between adjacent target basic modules to be laid out and the fixed module size data of the target basic module to be laid out. The second sum data can be the sum of the fixed module size data of the first associated partial module, the preset horizontal spacing, and the custom module size data of the custom module to be laid out in the current partial sub-model. The target integer multiple data can be the integer multiple data of the sum of the fixed horizontal spacing between adjacent target basic modules to be laid out and the fixed module size data of the target basic module to be laid out, and the target integer multiple data is greater than the second sum data. For example, the target integer multiple data can be the smallest integer multiple data of the sum of the fixed horizontal spacing between adjacent target basic modules to be laid out and the fixed module size data of the target basic module to be laid out.
[0122] In the embodiment of the present invention, the target basic module to be laid out can be selected from the basic modules to be laid out according to the layout requirement, and the fixed horizontal spacing between adjacent target basic modules to be laid out can be determined, so as to use the sum of the fixed horizontal spacing between adjacent target basic modules to be laid out and the fixed module size data of the target basic module to be laid out as the first sum data, and then calculate the second sum data of the fixed module size data of the first associated partial module, the preset horizontal spacing, and the custom module size data of the custom module to be laid out in the current partial sub-model. After obtaining the second sum data, the target integer multiple data of the first sum data can be determined according to the least common multiple of the second sum data and the first sum data, so as to use the spacing corresponding to the difference between the target integer multiple data of the first sum data and the second sum data as the horizontal filling spacing of the custom module to be laid out.
[0123] Exemplarily, the fixed horizontal spacing between adjacent contact modules can be determined first, and then the sum value of the fixed horizontal spacing between adjacent contact modules and the fixed module size data of the contact module can be used as the first sum value data. In the case where the first associated local module of the to-be-layout module to be customized is a non-trapezoidal pin module as the base to-be-layout module, the second sum value data can be further calculated, and then the target integer multiple data of the first sum value data that is greater than the second sum value data and closest to the second sum value data can be determined (for example, if the second sum value data is 3, the first sum value data is 2, and the target integer multiple data of the first sum value data is 4), so that the difference between the target integer multiple data of the first sum value data and the second sum value data can be used as the horizontal padding spacing. In the case where the first associated local module of the to-be-layout module to be customized is the to-be-layout module to be customized, the base to-be-layout module with the smallest horizontal offset distance from other steps to the first associated local module can be determined first, and then the horizontal offset distance between the first associated local module and the base to-be-layout module can be calculated, and the difference between the fixed module size data of the first associated local module and the calculated horizontal offset distance can be determined. Then, the sum value of the difference between the fixed module size data of the first associated local module and the calculated horizontal offset distance, the preset horizontal spacing, and the customized module size data of the to-be-layout module to be customized in the current local sub-model can be used as the second sum value data, and then the target integer multiple data of the first sum value data that is greater than the second sum value data and closest to the second sum value data can be determined, and the difference between the target integer multiple data of the first sum value data and the second sum value data can be used as the horizontal padding spacing.
[0124] In the above specific example, the coordinates of the to-be-layout module A to be customized are (260, 320), and the first sum value data is equivalent to ΔW being 100. The coordinates of the contact module H are (120, 320), the second sum value data is 200 (260 - 120 - 40 + 100), and the target integer multiple data of the first sum value data closest to the second sum value data is 300. Therefore, the horizontal padding spacing is 100 (equal to ΔW), and the abscissa of the contact module I is 420 (260 - 40 + 100 + 100). As Figure 4 shown, when laying out according to the calculated to-be-layout coordinates, it can be ensured that the coil module b is aligned with the contact module I.
[0125] S240. The operation logic structure diagram for automatically laying out the to-be-layout object according to the to-be-layout coordinates, the to-be-layout module to be customized, and the base to-be-layout module.
[0126] The technical solution of this embodiment determines the custom module size data of the custom to-be-layout module of the to-be-layout object, and then determines the to-be-layout coordinates of the custom to-be-layout module and the basic to-be-layout module in the to-be-layout object according to the module basic data of the to-be-layout object and the custom module size data of the custom to-be-layout module. Furthermore, according to the to-be-layout coordinates, the custom to-be-layout module and the basic to-be-layout module, it layouts the operation logic structure diagram of the to-be-automatically-layout object. The custom to-be-layout module in this solution can be edited independently, which can improve the scalability of the graph. Since the custom module size data can represent the size of the custom to-be-layout module, considering the custom module size data when determining the to-be-layout coordinates of the custom to-be-layout module and the basic to-be-layout module can ensure the rationality of the module automatic layout, and avoid the situation of module layout disorder caused by not considering the custom module size data. It solves the problems of strong limitations of layoutable graphs and unreasonable graph layout existing in the prior art when drawing the operation logic structure diagram, can improve the scalability of the graph, automatically and reasonably layout the graph, and improve the user experience.
[0127] It should be noted that any permutation and combination of the technical features in the above embodiments also belong to the protection scope of the present invention.
[0128] Embodiment III
[0129] Figure 5 is a schematic diagram of a graphic layout device provided in Embodiment III of the present invention. As Figure 5 shown, the device includes: a custom module size data determination module 310, a to-be-layout coordinate determination module 320, and an automatic layout module 330, where:
[0130] The custom module size data determination module 310 is used to determine the custom module size data of the custom to-be-layout module of the to-be-layout object;
[0131] The to-be-layout coordinate determination module 320 is used to determine the to-be-layout coordinates of the custom to-be-layout module and the basic to-be-layout module in the to-be-layout object according to the module basic data of the to-be-layout object and the custom module size data of the custom to-be-layout module;
[0132] The automatic layout module 330 is used to automatically layout the operation logic structure diagram of the to-be-layout object according to the to-be-layout coordinates, the custom to-be-layout module, and the basic to-be-layout module.
[0133] The technical solution of this embodiment determines the custom module size data of the custom to-be-layout module of the to-be-layout object, and thus determines the to-be-layout coordinates of the custom to-be-layout module and the basic to-be-layout module in the to-be-layout object according to the module basic data of the to-be-layout object and the custom module size data of the custom to-be-layout module. Furthermore, according to the to-be-layout coordinates, the custom to-be-layout module and the basic to-be-layout module, the operation logic structure diagram of the to-be-automatically-layout object is laid out. The custom to-be-layout module in this solution can be edited independently, which can improve the scalability of the graph. Since the custom module size data can represent the size of the custom to-be-layout module, considering the custom module size data when determining the to-be-layout coordinates of the custom to-be-layout module and the basic to-be-layout module can ensure the rationality of module automatic layout, and avoid the situation of module layout disorder caused by not considering the custom module size data. This solves the problems of strong limitations of layoutable graphs and unreasonable graph layout existing in the prior art when drawing the operation logic structure diagram, can improve the scalability of the graph, automatically and reasonably layout the graph, and enhance the user experience.
[0134] Optionally, the custom module size data determination module 310 is specifically configured to: obtain the variable unit of the custom to-be-layout module; determine the custom module size data of the custom to-be-layout module according to the variable unit association data of the variable unit of the custom to-be-layout module.
[0135] Optionally, the variable unit association data includes the number of variable units and the length of the target variable unit. The custom module size data determination module 310 is specifically configured to: determine the height of the custom to-be-layout module according to the number of variable units; determine the width of the custom to-be-layout module according to the length of the target variable unit.
[0136] Optionally, the operation logic structure diagram includes multiple local sub-models; the to-be-layout coordinate determination module 320 is specifically configured to: determine the reference to-be-layout coordinates of the reference basic to-be-layout module in the current local sub-model; determine the connection relationship data of the basic to-be-layout module and / or the custom to-be-layout module in the current local sub-model according to the module basic data; determine the to-be-layout coordinates of the basic to-be-layout module and / or the custom to-be-layout module in the current local sub-model according to the reference to-be-layout coordinates, the connection relationship data, the fixed module size data of the basic to-be-layout module, and the custom module size data of the custom to-be-layout module.
[0137] Optionally, if the current local sub-model includes the custom module to be laid out, the module coordinate determination module 320 is specifically configured to: determine the first associated local module and the second associated local module of the custom module to be laid out in the current local sub-model; according to the reference module coordinates to be laid out, the connection relationship data, the fixed module size data of the first associated local module, the preset horizontal spacing data, and the custom module size data of the custom module to be laid out in the current local sub-model, determine the module coordinates to be laid out of the first associated local module and the custom module to be laid out in the current local sub-model; determine the horizontal padding spacing of the custom module to be laid out; according to the custom module size data of the custom module to be laid out, the horizontal padding spacing of the custom module to be laid out, and the preset horizontal spacing, determine the module alignment adjustment spacing between the first associated local module and the second associated local module; and determine the module coordinates to be laid out of the second associated local module according to the module alignment adjustment spacing.
[0138] Optionally, the module coordinate determination module 320 is specifically configured to: determine the first sum value data of the fixed horizontal spacing between adjacent target basic modules to be laid out and the fixed module size data of the target basic modules to be laid out; calculate the second sum value data of the fixed module size data of the first associated local module, the preset horizontal spacing, and the custom module size data of the custom module to be laid out in the current local sub-model; determine the target integer multiple data of the first sum value data according to the second sum value data; and determine the horizontal padding spacing of the custom module to be laid out according to the difference between the target integer multiple data of the first sum value data and the second sum value data.
[0139] Optionally, the object to be laid out includes a programmable logic controller (PLC), the basic module to be laid out includes a contact module, a coil module, and a ladder pin module; and the custom module to be laid out includes a custom function module.
[0140] The above graphic layout device can execute the graphic layout method provided in any embodiment of the present invention, and has the corresponding function modules and beneficial effects for executing the method. For technical details not described in detail in this embodiment, reference can be made to the graphic layout method provided in any embodiment of the present invention.
[0141] Since the above-introduced graphic layout device is a device that can execute the graphic layout method in the embodiments of the present invention, based on the graphic layout method introduced in the embodiments of the present invention, those skilled in the art can understand the specific implementation manners and various variations of the graphic layout device in this embodiment. Therefore, the implementation of how the graphic layout device realizes the graphic layout method in the embodiments of the present invention will not be described in detail here. As long as the device adopted by those skilled in the art to implement the graphic layout method in the embodiments of the present invention falls within the scope of protection of this application.
[0142] Example 4
[0143] Figure 6 FIG. 6 is a schematic structural diagram of an electronic device provided in Example 4 of the present invention. Figure 6 FIG. 7 shows a block diagram of an electronic device 412 suitable for implementing the embodiments of the present invention. Figure 6 The electronic device 412 shown is merely an example and should not impose any limitation on the functions and scope of use of the embodiments of the present invention.
[0144] As Figure 6 shown, the electronic device 412 is presented in the form of a general-purpose computing device. The components of the electronic device 412 may include, but are not limited to: one or more processors 416, a storage device 428, and a bus 418 connecting different system components (including the storage device 428 and the processor 416).
[0145] The bus 418 represents one or more of several types of bus architectures, including a memory bus or a memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the multiple bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MCA) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0146] The electronic device 412 typically includes a variety of computer system-readable media. These media can be any available media that can be accessed by the electronic device 412, including volatile and non-volatile media, removable and non-removable media.
[0147] The storage device 428 may include computer system-readable media in the form of volatile memory, such as a Random Access Memory (RAM) 430 and / or a cache memory 432. The electronic device 412 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, a storage system 434 may be used for reading and writing non-removable, non-volatile magnetic media ( Figure 6 not shown, commonly referred to as a "hard disk drive"). Although Figure 6Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., Compact Disc-Read Only Memory (CD-ROM), Digital Video Disc-Read Only Memory (DVD-ROM), or other optical media) can be provided. In these cases, each drive can be connected to the bus 418 through one or more data medium interfaces. The storage device 428 can include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0148] The program 436 having a set (at least one) of program modules 426 can be stored, for example, in the storage device 428. Such program modules 426 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. The implementation of a network environment may be included in each or some combination of these examples. The program modules 426 generally perform the functions and / or methods in the embodiments described in the present invention.
[0149] The electronic device 412 can also communicate with one or more external devices 414 (e.g., a keyboard, a pointing device, a camera, a display 424, etc.), and can also communicate with one or more devices that enable a user to interact with the electronic device 412, and / or communicate with any device that enables the electronic device 412 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication can be carried out through an Input / Output (I / O) interface 422. Also, the electronic device 412 can communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and / or a public network, such as the Internet) through a network adapter 420. As shown in the figure, the network adapter 420 communicates with other modules of the electronic device 412 through the bus 418. It should be understood that although not shown in the figure, other hardware and / or software modules can be used in combination with the electronic device 412, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, Redundant Arrays of Independent Disks (RAID) systems, tape drives, and data backup storage systems, etc.
[0150] The processor 416 executes various functional applications and data processing by running programs stored in the storage device 428, such as implementing the graphic layout method provided in the above embodiments of the present invention: determining the custom module size data of the custom to-be-layout module of the to-be-layout object; determining the to-be-layout coordinates of the custom to-be-layout module and the basic to-be-layout module in the to-be-layout object according to the module basic data of the to-be-layout object and the custom module size data of the custom to-be-layout module; automatically laying out the operation logic structure diagram of the to-be-layout object according to the to-be-layout coordinates, the custom to-be-layout module, and the basic to-be-layout module.
[0151] In the technical solution of this embodiment, by determining the custom module size data of the custom to-be-layout module of the to-be-layout object, the to-be-layout coordinates of the custom to-be-layout module and the basic to-be-layout module in the to-be-layout object are determined according to the module basic data of the to-be-layout object and the custom module size data of the custom to-be-layout module, and then the operation logic structure diagram of the to-be-automatically-layout object is laid out according to the to-be-layout coordinates, the custom to-be-layout module, and the basic to-be-layout module. The custom to-be-layout module in this solution can be edited independently, which can improve the scalability of the graphic. Since the custom module size data can represent the size of the custom to-be-layout module, considering the custom module size data when determining the to-be-layout coordinates of the custom to-be-layout module and the basic to-be-layout module can ensure the rationality of the automatic module layout and avoid the situation of module layout disorder caused by not considering the custom module size data, solving the problems of strong limitations of layoutable graphics and unreasonable graphic layout existing in the prior art when drawing the operation logic structure diagram, improving the scalability of the graphic, automatically and reasonably laying out the graphic, and enhancing the user experience.
[0152] Embodiment 5
[0153] The fifth embodiment of the present invention further provides a computer storage medium storing a computer program, and the computer program is used to execute the graphic layout method according to any one of the above embodiments of the present invention when executed by a computer processor: determining the custom module size data of the custom to-be-layout module of the to-be-layout object; determining the to-be-layout coordinates of the custom to-be-layout module and the basic to-be-layout module in the to-be-layout object according to the module basic data of the to-be-layout object and the custom module size data of the custom to-be-layout module; automatically laying out the operation logic structure diagram of the to-be-layout object according to the to-be-layout coordinates, the custom to-be-layout module, and the basic to-be-layout module.
[0154] The computer storage medium of the embodiments of the present invention may adopt any combination of one or more computer-readable media. The computer-readable media may be computer-readable signal media or computer-readable storage media. The computer-readable storage media may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM) or a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, the computer-readable storage media may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0155] The computer-readable signal media may include a data signal propagated in a baseband or as part of a carrier wave, which carries the computer-readable program code. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal media may also be any computer-readable media other than the computer-readable storage media, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0156] The program code contained on the computer-readable media may be transmitted by any appropriate medium, including but not limited to wireless, wire, optical cable, radio frequency (RF), etc., or any suitable combination of the above.
[0157] Computer program code for performing the operations of the present invention may be written in one or more programming languages or combinations thereof, including object-oriented programming languages such as Java, Smalltalk, C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0158] Note that the above is only the preferred embodiment of the present invention and the technical principles applied. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, re-adjustments, and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments. Without departing from the concept of the present invention, more other equivalent embodiments may be included, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A graphic layout method, characterized in that, comprising: determining custom module size data of a custom to-be-layout module of an object to be laid out; determining to-be-layout coordinates of the custom to-be-layout module and a basic to-be-layout module in the object to be laid out according to the module basic data of the object to be laid out and the custom module size data of the custom to-be-layout module; automatically laying out a running logic structure diagram of the object to be laid out according to the to-be-layout coordinates, the custom to-be-layout module and the basic to-be-layout module; the running logic structure diagram includes a plurality of local sub-models; the determining to-be-layout coordinates of the custom to-be-layout module and the basic to-be-layout module in the object to be laid out according to the module basic data of the object to be laid out and the custom module size data of the custom to-be-layout module includes: determining reference to-be-layout coordinates of a reference basic to-be-layout module in the current local sub-model; determining connection relationship data of the basic to-be-layout module and / or the custom to-be-layout module in the current local sub-model according to the module basic data; determining to-be-layout coordinates of the basic to-be-layout module and / or the custom to-be-layout module in the current local sub-model according to the reference to-be-layout coordinates, the connection relationship data, fixed module size data of the basic to-be-layout module and the custom module size data of the custom to-be-layout module; if the current local sub-model includes the custom to-be-layout module, the determining to-be-layout coordinates of the basic to-be-layout module and / or the custom to-be-layout module in the current local sub-model according to the reference to-be-layout coordinates, the connection relationship data, fixed module size data of the basic to-be-layout module and the custom module size data of the custom to-be-layout module includes: determining a first associated local module and a second associated local module of the custom to-be-layout module in the current local sub-model; determining to-be-layout coordinates of the first associated local module and the custom to-be-layout module in the current local sub-model according to the reference to-be-layout coordinates, the connection relationship data, fixed module size data of the first associated local module, preset horizontal spacing data and the custom module size data of the custom to-be-layout module; wherein, the first associated local module refers to a basic to-be-layout module that has a connection relationship with the custom to-be-layout module and needs to be laid out before the custom to-be-layout module; determining a horizontal padding spacing of the custom to-be-layout module; determining a module alignment adjustment spacing between the first associated local module and the second associated local module according to the custom module size data of the custom to-be-layout module, the horizontal padding spacing of the custom to-be-layout module and the preset horizontal spacing; determining to-be-layout coordinates of the second associated local module according to the module alignment adjustment spacing.
2. The method according to claim 1, characterized in that, the determining custom module size data of a custom to-be-layout module of an object to be laid out includes: obtaining variable units of the custom to-be-layout module; Determine the custom module size data of the custom to-be-layout module according to the variable unit association data of the variable units of the custom to-be-layout module.
3. The method according to claim 2, wherein, the variable unit association data includes the number of variable units and the length of the target variable unit; the determining the custom module size data of the custom to-be-layout module according to the variable unit association data of the variable units of the custom to-be-layout module includes: determining the height of the custom to-be-layout module according to the number of the variable units; determining the width of the custom to-be-layout module according to the length of the target variable unit.
4. The method according to claim 1, wherein, the determining the horizontal padding distance of the custom to-be-layout module includes: determining the fixed horizontal distance between adjacent target basic to-be-layout modules and the first sum data of the fixed module size data of the target basic to-be-layout modules; calculating the second sum data of the fixed module size data of the first associated partial module, the preset horizontal distance, and the custom module size data of the custom to-be-layout module in the current partial sub-model; determining the target integer multiple data of the first sum data according to the second sum data; determining the horizontal padding distance of the custom to-be-layout module according to the difference between the target integer multiple data of the first sum data and the second sum data.
5. The method according to any one of claims 1-4, wherein, the to-be-layout object includes a programmable logic controller (PLC), the basic to-be-layout modules include a contact module, a coil module, and a ladder pin module; the custom to-be-layout module includes a custom logic function module.
6. A graphic layout device, wherein, comprises: a custom module size data determination module, configured to determine the custom module size data of the custom to-be-layout module of the to-be-layout object; a to-be-layout coordinate determination module, configured to determine the to-be-layout coordinates of the custom to-be-layout module and the basic to-be-layout module in the to-be-layout object according to the module basic data of the to-be-layout object and the custom module size data of the custom to-be-layout module; an automatic layout module, configured to automatically layout the operation logic structure diagram of the to-be-layout object according to the to-be-layout coordinates, the custom to-be-layout module, and the basic to-be-layout module; the operation logic structure diagram includes a plurality of partial sub-models; the to-be-layout coordinate determination module is specifically configured to: determine the reference to-be-layout coordinates of the reference basic to-be-layout module in the current partial sub-model; determine the connection relationship data of the basic to-be-layout module and / or the custom to-be-layout module in the current partial sub-model according to the module basic data; and determine the to-be-layout coordinates of the basic to-be-layout module and / or the custom to-be-layout module in the current partial sub-model according to the reference to-be-layout coordinates, the connection relationship data, the fixed module size data of the basic to-be-layout module, and the custom module size data of the custom to-be-layout module. If the current local sub-model includes the custom module to be laid out, the module coordinate determination module is specifically configured to: determine the first associated local module and the second associated local module of the custom module to be laid out in the current local sub-model; determine the layout coordinates of the first associated local module and the custom module to be laid out in the current local sub-model according to the reference layout coordinates, the connection relationship data, the fixed module size data of the first associated local module, the preset horizontal spacing data, and the custom module size data of the custom module to be laid out; wherein, the first associated local module refers to a basic module to be laid out that has a connection relationship with the custom module to be laid out and needs to be laid out before the custom module to be laid out; determine the horizontal compensation spacing of the custom module to be laid out; determine the module alignment adjustment spacing between the first associated local module and the second associated local module according to the custom module size data of the custom module to be laid out, the horizontal compensation spacing of the custom module to be laid out, and the preset horizontal spacing; determine the layout coordinates of the second associated local module according to the module alignment adjustment spacing.
7. An electronic device, characterized in that, the electronic device includes: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the graphic layout method according to any one of claims 1-5.
8. A computer storage medium, on which a computer program is stored, characterized in that, when the program is executed by a processor, it implements the graphic layout method according to any one of claims 1-5.
Citation Information
Patent Citations
Node layout method and device, storage medium and electronic device
CN110515690A
Graphical programming interaction system and interaction method of compilation type PLC
CN113515084A