A graph drawing method and device based on primitive prediction, an electronic device, and a storage medium
By acquiring initial element information and user operation information, and combining element relationship and nearest neighbor relationship tables, the automatic prediction of the drawing process is realized, which solves the problem of low drawing efficiency in the existing technology and improves drawing efficiency and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-21
- Publication Date
- 2026-03-24
AI Technical Summary
Existing technologies have low drawing efficiency, especially in special scenarios where the number of graphic elements is large. Users need to select each graphic element one by one, resulting in low drawing efficiency.
By acquiring the initial element information, element relationship information, and user operation information, the system determines the relationship between the initial element and its position, calls the matching element group for prediction, uses the drawing engine to draw a two-dimensional drawing, and combines the element relationship table and the nearest neighbor relationship table to improve the prediction accuracy.
It improves the efficiency and accuracy of drawing, reduces the amount of operation required for users to select graphic elements, and enhances the automation of the drawing process.
Smart Images

Figure CN116309934B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer graphics technology, and in particular to a drawing method, apparatus, electronic device and storage medium based on primitive prediction. Background Technology
[0002] With the continuous development of science and technology, computer-aided design software has become an indispensable basic task in the industrial manufacturing field, especially in many professions such as architecture, electronics, electrical engineering, communications, and machinery.
[0003] In existing technologies, during the drawing process, most designs can usually be implemented by directly utilizing some modules of existing drawings or by modifying existing modules. However, in drawing for special scenarios, the number of graphic elements is large, so users need to select each graphic element individually.
[0004] It is evident that existing technologies suffer from low drawing efficiency. Summary of the Invention
[0005] This invention provides a drawing method, apparatus, electronic device, and storage medium based on primitive prediction to solve the problem of low drawing efficiency in the prior art.
[0006] In a first aspect, embodiments of the present invention provide a drawing method based on primitive prediction, comprising:
[0007] Acquire starting element information, element relationship information, and first user operation information. The starting element information includes the position information and size information of the starting element. The element relationship information indicates the hierarchical relationship between at least two elements. The first user operation information indicates the user's operation at a first position on the drawing. The first position can be any position on the drawing.
[0008] Based on the starting element information and the first user operation information, the positional relationship between the starting element and the first position is determined to generate a positional relationship result. The positional relationship result includes one of the following: the starting element contains the first position, or the starting element does not contain the first position.
[0009] Based on the positional relationship, the matching primitive group in the primitive relationship information is called to obtain prediction information, wherein the primitive group in the prediction information includes at least one primitive.
[0010] The second user operation information is obtained based on the prediction information, and a two-dimensional drawing engine with a graphical interface is called to draw a drawing based on the second user operation information and the prediction information. The second user operation information represents the user's selection operation of the graphic elements in the prediction information.
[0011] Optionally, the step of calling the matched primitive group in the primitive relationship information based on the positional relationship to obtain the prediction information includes:
[0012] If the starting primitive contains the first position and the starting primitive has sub-primitives, the sub-primitives belonging to the starting primitive in the primitive relationship information are called as the first prediction information.
[0013] If the starting primitive contains the first position and the starting primitive does not have any sub-primitives, the preset primitive group is used as the second prediction information.
[0014] Optionally, the step of calling the matched primitive group in the primitive relationship information based on the positional relationship to obtain the prediction information further includes:
[0015] If the starting element does not include the first position, a coordinate system is constructed with the center position of the starting element as the origin;
[0016] Generate the coordinates of the first position in the coordinate system based on the first position and the coordinate system;
[0017] Based on the coordinates of the first position in the coordinate system, the orientation information of the first position relative to the center position of the starting element is generated;
[0018] The third prediction information is obtained by calling the matching primitive group in the nearest neighbor table based on the orientation information. The nearest neighbor table represents the set of orientation and distance relationships between primitives. The third prediction information includes primitive groups that match the distance information and the orientation information.
[0019] Optionally, before obtaining the primitive relationship information and the first user operation information, the method further includes:
[0020] Obtain the component modules from the drawings and standardize the component modules to obtain the graphic elements that correspond one-to-one with the component modules;
[0021] Each element in the element group is classified to obtain the element relationship information.
[0022] Optionally, after obtaining the component modules in the drawing and standardizing the component modules to obtain a set of elements, the method further includes:
[0023] Obtain the user's identification information and third operation information, wherein the third operation information includes the order of insertion of graphic elements by the user and the operation frequency;
[0024] A timing relationship table is constructed based on the identification information and the third operation information. The timing relationship table represents the operation frequency of at least two graphic elements and the sequential relationship between at least two graphic elements.
[0025] Based on the initial primitive information, the primitive group associated with the initial primitive in the time series relation table is called to obtain prediction information. The primitive group in the prediction information includes at least one primitive.
[0026] Based on the prediction information, third user operation information is obtained, and based on the third user operation information and the prediction information, a drawing engine with a graphical interface is invoked to draw a two-dimensional drawing. The third user operation information represents the user's selection operation of the graphic elements in the prediction information.
[0027] Optionally, the method further includes, after determining the two-dimensional drawing based on the second user operation information and the prediction information:
[0028] Obtain basic information for each graphic element in the two-dimensional drawing. The basic information includes: graphic element size and graphic element insertion point attributes. The graphic element size represents the length, width, and height of the graphic element, and the graphic element insertion point attributes represent the coordinates of the insertion point, the insertion scale, and the insertion angle.
[0029] The two-dimensional drawing is constructed into a three-dimensional model based on the element size and the element insertion point attribute.
[0030] Secondly, embodiments of the present invention provide a drawing apparatus, comprising:
[0031] The first acquisition module is used to acquire starting element information, element relationship information and first user operation information. The starting element information includes the position information and size information of the starting element. The element relationship information represents the hierarchical relationship between at least two elements. The first user operation information represents the user's operation at a first position on the drawing. The first position is any position on the drawing.
[0032] The first generation module is used to determine the positional relationship between the starting graphic element and the first position based on the starting graphic element information and the first user operation information, so as to generate a positional relationship result. The positional relationship result includes one of the following: the starting graphic element contains the first position, or the starting graphic element does not contain the first position.
[0033] The first calling module is used to call the matching primitive group in the primitive relationship information according to the positional relationship to obtain prediction information. The primitive group in the prediction information includes at least one primitive.
[0034] The second calling module is used to obtain second user operation information based on the prediction information, and to call a drawing engine with a graphical interface to draw a two-dimensional drawing based on the second user operation information and the prediction information. The second user operation information represents the user's selection operation of the graphic elements in the prediction information.
[0035] Optionally, the first calling module includes:
[0036] The first calling unit is configured to, when the starting graphic element contains the first position and the starting graphic element has sub-graphic elements, call the sub-graphic element belonging to the starting graphic element in the graphic element relationship information as the first prediction information;
[0037] The second calling unit is used to use a preset primitive group as the second prediction information when the starting primitive contains the first position and the starting primitive does not have any sub-primitives.
[0038] Optionally, the first calling module further includes:
[0039] A construction unit is used to construct a coordinate system with the center position of the starting element as the origin when the starting element does not contain the first position.
[0040] The first generation unit is configured to generate the coordinates of the first position in the coordinate system based on the first position and the coordinate system;
[0041] The second generation unit is used to generate the orientation information of the first position relative to the center position of the starting element based on the coordinates of the first position in the coordinate system.
[0042] The third calling unit is used to call the matching primitive group in the nearest neighbor table as the third prediction information based on the orientation information. The nearest neighbor table represents a set of orientation and distance relationships between primitives. The third prediction information includes primitive groups that match the distance information and the orientation information.
[0043] Optionally, the drawing device further includes:
[0044] The second acquisition module is used to acquire component modules in the drawing and to standardize the component modules to obtain graphic elements that correspond one-to-one with the component modules.
[0045] The classification module is used to classify each element in the element group to obtain the element relationship information.
[0046] Optionally, the drawing device further includes:
[0047] The third acquisition module is used to acquire the user's identification information and third operation information, wherein the third operation information includes the order of the user inserting graphic elements and the operation frequency;
[0048] The first construction module is used to construct a timing relationship table based on the identification information and the third operation information, wherein the timing relationship table represents the operation frequency of at least two graphic elements and the sequential relationship between at least two graphic elements;
[0049] The third calling module is used to call the primitive group associated with the starting primitive in the time series relation table according to the starting primitive information to obtain prediction information. The primitive group in the prediction information includes at least one primitive.
[0050] The fourth calling module is used to obtain third user operation information based on the prediction information, and to call a drawing engine with a graphics interface to draw a two-dimensional drawing based on the third user operation information and the prediction information. The third user operation information represents the user's selection operation of graphic elements in the prediction information.
[0051] Optionally, the drawing device further includes:
[0052] The fourth acquisition module is used to acquire the basic information of each graphic element in the two-dimensional drawing. The basic information includes: graphic element size and graphic element insertion point attribute. The graphic element size represents the length, width and height of the graphic element, and the graphic element insertion point attribute represents the coordinates of the insertion point, the insertion scale and the insertion angle.
[0053] The second construction module is used to perform three-dimensional construction processing on the two-dimensional drawing based on the element size and the element insertion point attribute to obtain a three-dimensional model corresponding to the two-dimensional drawing.
[0054] Thirdly, embodiments of the present invention provide an electronic device, including:
[0055] At least one processor; and
[0056] A memory communicatively connected to the at least one processor; wherein,
[0057] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the primitive prediction-based drawing method described in the first aspect.
[0058] Fourthly, embodiments of the present invention provide a non-transitory computer-readable storage medium storing computer instructions, comprising:
[0059] The computer instructions are used to cause the computer to execute the drawing method based on primitive prediction as described in the first aspect.
[0060] In this embodiment of the invention, the initial graphic element information, graphic element relationship information, and first user operation information are first obtained. Then, the first position in the first user operation information is judged to determine whether the first position is within the initial graphic element, that is, whether the initial graphic element contains the first position, thereby obtaining the positional relationship structure. Based on the positional relationship result, the matching graphic element group is selected and called in the graphic element relationship information, that is, the prediction in the drawing process is completed, so that the user can select graphic elements in the prediction information. Finally, according to the user's selection operation, that is, according to the second user operation information, the drawing engine with a graphics interface is called to draw the two-dimensional drawing, thereby completing the drawing work and improving the efficiency of drawing.
[0061] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0062] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0063] Figure 1 This is one of the flowcharts of a drawing method based on primitive prediction provided by an embodiment of the present invention;
[0064] Figure 2 This is a second schematic flowchart of a drawing method based on primitive prediction provided by an embodiment of the present invention;
[0065] Figure 3 This is a directional diagram provided in an embodiment of the present invention;
[0066] Figure 4 This is the third flowchart of a drawing method based on primitive prediction provided by an embodiment of the present invention;
[0067] Figure 5 This is the fourth flowchart of a drawing method based on primitive prediction provided by an embodiment of the present invention;
[0068] Figure 6 This is the fifth flowchart of a drawing method based on primitive prediction provided by an embodiment of the present invention;
[0069] Figure 7This is a schematic diagram of the structure of a drawing device provided in an embodiment of the present invention;
[0070] Figure 8 This is a block diagram of an electronic device used to implement the drawing method based on primitive prediction in the embodiments of the present invention. Detailed Implementation
[0071] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0072] In the embodiments of this invention, the terms "first," "second," etc., are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or devices.
[0073] Please see Figure 1 , Figure 1 This is a flowchart illustrating a drawing method based on primitive prediction provided by an embodiment of the present invention, as shown below. Figure 1 As shown, it includes the following steps:
[0074] Step 101: Obtain starting element information, element relationship information and first user operation information. The starting element information includes the position information and size information of the starting element. The element relationship information indicates the hierarchical relationship between at least two elements. The first user operation information indicates the user's operation at the first position on the drawing. The first position is any position on the drawing.
[0075] Step 102: Determine the positional relationship between the starting graphic element and the first position based on the starting graphic element information and the first user operation information, so as to generate a positional relationship result. The positional relationship result includes one of the following: the starting graphic element contains the first position, or the starting graphic element does not contain the first position.
[0076] Step 103: Based on the positional relationship, call the matching primitive group in the primitive relationship information to obtain prediction information. The primitive group in the prediction information includes at least one primitive.
[0077] Step 104: Obtain second user operation information based on the prediction information, and call a drawing engine with a graphical interface to draw a two-dimensional drawing based on the second user operation information and the prediction information. The second user operation information represents the user's selection operation of the graphic elements in the prediction information.
[0078] In this embodiment of the invention, steps 101, 102, 103 and 104 of the above-mentioned drawing method based on primitive prediction can be executed by a computer or a virtual machine, etc.
[0079] Furthermore, the above-mentioned drawing method based on primitive prediction can be applied to computer-aided design software, such as CAD and other computer-aided design software, and the embodiments of the present invention do not limit this.
[0080] In step 101, the starting element in the above starting element information can be an element that originally exists on the drawing, and the starting element can be an element that was called by the user before step 101. The starting element has certain attributes, such as: the starting element is attached with boundary coordinates, center point coordinates, length, width, height or angle.
[0081] It should be noted that the number of the aforementioned starting primitives can be multiple, that is, it can be understood as predicting multiple starting primitives based on user operations. However, the embodiments of the present invention do not limit the number of the aforementioned starting primitives.
[0082] The aforementioned element relationship information can be a relationship table stored in the execution device, and it can also be a table representing the relationship between multiple elements. The creation of element relationship information can be understood as classifying multiple elements according to professional domain knowledge and objective reality. Elements that serve as parent nodes and child nodes in the tree relationship are respectively called parent elements and child elements. For example, the classification of a computer room can include components such as doors, windows, cabinets, cable trays, and air conditioners. In this case, the computer room can be called the parent element, while doors, windows, cabinets, cable trays, and air conditioners can be called child elements.
[0083] When the executing device is a computer, the aforementioned first user operation information can be understood as an operation performed by the user using a mouse. For example, the first position in the aforementioned first user operation information represents a click operation performed by the user using the mouse at the first position. Similarly, the user can also use other input devices to represent the operation at the first position, and this embodiment of the invention does not limit this.
[0084] It should be understood that in some auxiliary equipment software, drawings include some commonly used modules. Therefore, embodiments of the present invention can use commonly used modules as standardized graphic elements. For example, in the field of wireless communication, drawings can use commonly used modules such as iron towers, antennas, equipment rooms, cabinets, AC power distribution cabinets, air conditioners, power distribution boxes, and cable trays as graphic elements, which can be directly reused in subsequent drawing.
[0085] In step 102, since the starting element information mentioned above represents a starting element with certain coordinate and size attributes, and the first position can be understood as having coordinate attributes, it can be determined whether the first position is within the graphic represented by the starting element. For example, if the starting element is represented as a rectangle on the drawing, it can be determined whether the first position is within this rectangle, thereby obtaining the positional relationship result.
[0086] It should be understood that the above-mentioned starting graphic element containing the first position can be interpreted as the user calling the sub-graphic element of the above-mentioned starting graphic element, while the above-mentioned starting graphic element not containing the first position indicates that the user needs to call other graphic elements.
[0087] It should be noted that if the first position is on the boundary of the starting element, then it can also be understood that the starting element includes the first position.
[0088] In step 103, the matching primitive group in the primitive relationship information can be called according to the positional relationship to obtain the prediction information. For example, if the starting primitive contains the first position, the sub-primary corresponding to the starting primitive in the primitive relationship information needs to be called; if the starting primitive does not contain the first position, a user-preset primitive group can be called. The preset primitive group can be set and stored by the user in advance.
[0089] In cases where the starting element includes the first position, it is necessary to call the sub-element corresponding to the starting element in the element relationship information. For example, after the user inserts the element "computer room", that is, the computer room is the starting element, then clicking on the interior of the computer room can predict the most likely elements to be drawn next, such as doors, windows, cabinets, cable trays, air conditioners, etc., which belong to the interior of the computer room.
[0090] In step 104, the aforementioned second user operation information, when executed by a computer, can be understood as an operation performed by the user using a mouse. For example, the second position in the aforementioned second user operation information represents a click operation by the user using the mouse at the second position, thereby completing the selection of the graphic element. Similarly, the user can also use other input devices to represent the operation at the second position, and this embodiment of the invention does not limit this.
[0091] In this implementation scheme, the initial element information, element relationship information, and first user operation information are first obtained. Then, the first position in the first user operation information is judged to determine whether the first position is within the initial element, that is, whether the initial element contains the first position, thereby obtaining the positional relationship structure. Based on the positional relationship result, the matching element group is selected and called in the element relationship information, that is, the prediction in the drawing process is completed, so that the user can select elements in the prediction information. Finally, according to the user's selection operation, that is, according to the second user operation information, the drawing engine with a graphics interface is called to draw the two-dimensional drawing, thereby completing the drawing work and improving the efficiency of drawing.
[0092] Optionally, the step of calling the matched primitive group in the primitive relationship information based on the positional relationship to obtain the prediction information includes:
[0093] If the starting primitive contains the first position and the starting primitive has sub-primitives, the sub-primitives belonging to the starting primitive in the primitive relationship information are called as the first prediction information.
[0094] If the starting primitive contains the first position and the starting primitive does not have any sub-primitives, the preset primitive group is used as the second prediction information.
[0095] In this implementation scheme, it is first necessary to determine the positional relationship between the first position and the starting element. Secondly, it is necessary to determine whether the starting element has sub-elements. If the starting element contains the first position and the starting element has sub-elements, then the sub-elements belonging to the starting element in the element relationship information can be used as the first prediction information. If the starting element contains the first position and the starting element does not have sub-elements, then the preset element group needs to be used as the second prediction information. This method can increase the diversity of element prediction, select elements with higher prediction accuracy through multiple judgments, thereby improving the accuracy of element prediction and the efficiency of drawing.
[0096] It should be noted that whether the aforementioned starting element has sub-elements can be determined through the aforementioned element relationship information. For example, if the starting element is a computer room, and the aforementioned element relationship information records that the computer room includes components such as doors, windows, server racks, cable trays, and air conditioners, then it can be determined that the aforementioned starting element has sub-elements.
[0097] In addition, if the above-mentioned starting graphic element does not have any sub-graphic elements, then the above-mentioned preset graphic element group needs to be used as the above-mentioned second prediction information. The above-mentioned preset graphic element group can be a graphic element group preset by the user according to daily habits or component setting logic, or it can be understood as a graphic element group set according to actual needs. The embodiments of the present invention do not limit the type of graphic elements in the above-mentioned preset graphic element group.
[0098] Optionally, the step of calling the matched primitive group in the primitive relationship information based on the positional relationship to obtain the prediction information further includes:
[0099] If the starting element does not include the first position, a coordinate system is constructed with the center position of the starting element as the origin;
[0100] Generate the coordinates of the first position in the coordinate system based on the first position and the coordinate system;
[0101] Based on the coordinates of the first position in the coordinate system, the orientation information of the first position relative to the center position of the starting element is generated;
[0102] The third prediction information is obtained by calling the matching primitive group in the nearest neighbor table based on the orientation information. The nearest neighbor table represents the set of orientation and distance relationships between primitives. The third prediction information includes primitive groups that match the distance information and the orientation information.
[0103] In some alternative implementations, please refer to Figure 2 , Figure 2 This is a second flowchart of a drawing method based on primitive prediction provided by an embodiment of the present invention, as shown below. Figure 2 As shown, in this embodiment of the invention, a computer is used as the execution device and a mouse is used as the input device. The user clicks the first position in the drawing, i.e. the judgment point. In the first judgment, it is necessary to determine whether the judgment point belongs to one or more elements in the drawing, i.e. whether the judgment point is inside the element. If the judgment point is inside the element, it is then determined whether the element has a sub-element. If it does, the sub-element is used as the prediction result and the process ends.
[0104] If the judgment point does not belong to a primitive or the primitive to which the judgment point belongs does not have any sub-primitives, then the primitive most frequently used by the user will be used as the prediction result, and the process will end.
[0105] For some other alternative implementations, please refer to Figure 3 , Figure 3This is a coordinate orientation map in an embodiment of the present invention. In this embodiment, a completed drawing can be used as input. All graphic elements and their coordinates in the drawing are processed. Then, within each frame, the positional relationship and nearest neighbor distance between graphic elements are calculated based on the center point coordinates of each graphic element. Taking the center point coordinates of a certain graphic element as the origin, the positional relationship between other graphic elements and that graphic element is divided into left, right, top, bottom, upper left, upper right, lower left, and lower right. A certain angle range can be set as needed.
[0106] To avoid the influence of primitive size on the distance when calculating nearest neighbor distance, the nearest neighbor distance is obtained by dividing the distance between two center points by the square root of the primitive area. The primitive area can be calculated from the boundary coordinates of the primitive.
[0107] Assuming that the center point of primitive A is (x1, y1) and its area is s1, and the center point of primitive B is (x2, y2) and its area is s2, then the nearest neighbor distance between primitive A and primitive B is:
[0108]
[0109] Furthermore, in order to reduce the interference of parent and child primitives on the nearest neighbor relationship, when two primitives are in a parent-child relationship, the nearest neighbor relationship is no longer calculated, thus forming a nearest neighbor relationship table for a single drawing.
[0110] Then, the nearest neighbor relationship tables of all drawings are summarized. When two elements are at different distances on different drawings, they need to be merged. You can choose to use box plots, statistical analysis, clustering, or other methods to remove outliers and calculate the average value as the nearest neighbor distance to finally form the nearest neighbor relationship table.
[0111] Please see Figure 4 and Figure 5 When a user is drawing a drawing, this embodiment of the invention can calculate the positional relationship of a point relative to elements within the same drawing frame based on the user's click location. From the positional relationships and nearest distances in the nearest neighbor table, prioritizing elements with the shortest nearest distance for elements at the same location, it predicts the multiple elements most likely to be used next. The number of predicted elements can be flexibly set as needed. For example, based on the drawing analysis, the equipment list and material list are usually drawn on the left side of the outdoor integrated switching power supply cabinet layout plan. Therefore, after the user finishes drawing the outdoor integrated switching power supply cabinet layout plan, clicking on the left side will predict the most likely next elements to be drawn: the equipment list and material list.
[0112] It should be understood that as the number of input drawings increases, the element prediction will become richer and more accurate.
[0113] Optionally, before obtaining the primitive relationship information and the first user operation information, the method further includes:
[0114] Obtain the component modules from the drawings and standardize the component modules to obtain the graphic elements that correspond one-to-one with the component modules;
[0115] Each element in the element group is classified to obtain the element relationship information.
[0116] In this implementation scheme, the component modules built into the auxiliary design software can be standardized, so that in the subsequent steps of this embodiment of the invention, graphic elements are used as the operation unit. In addition, the standardized graphic elements are classified according to professional domain knowledge and objective reality. Through this method, the prediction accuracy of the above-mentioned drawing drawing method based on graphic element prediction can be improved, thereby improving the efficiency of drawing drawing.
[0117] Optionally, after obtaining the component modules in the drawing and standardizing the component modules to obtain a set of elements, the method further includes:
[0118] Obtain the user's identification information and third operation information, wherein the third operation information includes the order of insertion of graphic elements by the user and the operation frequency;
[0119] A timing relationship table is constructed based on the identification information and the third operation information. The timing relationship table represents the operation frequency of at least two graphic elements and the sequential relationship between at least two graphic elements.
[0120] Based on the initial primitive information, the primitive group associated with the initial primitive in the time series relation table is called to obtain prediction information. The primitive group in the prediction information includes at least one primitive.
[0121] Based on the prediction information, third user operation information is obtained, and based on the third user operation information and the prediction information, a drawing engine with a graphical interface is invoked to draw a two-dimensional drawing. The third user operation information represents the user's selection operation of the graphic elements in the prediction information.
[0122] In this implementation scheme, a time-series relation table can be created based on user habits. First, the aforementioned identification information and the aforementioned third operation information are obtained. The identification information can identify the user drawing the drawing, and the third operation information can be understood as the user's history of calling graphic elements. Thus, the aforementioned prediction information can be determined from the aforementioned starting graphic element information and the aforementioned time-series relation table. Finally, the user selects graphic elements from the aforementioned prediction information to complete the drawing. Through this method, graphic elements can be predicted based on user habits, which improves the user experience and increases the efficiency of drawing.
[0123] In some alternative implementations, see [link to relevant documentation]. Figure 6, Figure 6 This is the fifth flowchart of a drawing method based on primitive prediction provided by an embodiment of the present invention. First, the user performs a drawing operation. At this time, the execution device can record the user's operation history. Then, the primitive insertion order and operation frequency are extracted to generate a time sequence relationship table. Finally, the primitives are predicted based on the user information and the time sequence relationship table.
[0124] It should be understood that when a user is drawing a drawing, based on the user's actions and the sequence relationship and operation frequency in the time sequence table, prioritizing operations with the highest frequency and order of operations in the same sequence, one or more graphic elements most likely to be used next can be predicted. The number of predicted elements can be flexibly set as needed. For example, if user A usually draws the title block and then the title label, it can be predicted that the user will insert the title label after user A inserts the title block.
[0125] Optionally, the method further includes, after determining the two-dimensional drawing based on the second user operation information and the prediction information:
[0126] Obtain basic information for each graphic element in the two-dimensional drawing. The basic information includes: graphic element size and graphic element insertion point attributes. The graphic element size represents the length, width, and height of the graphic element, and the graphic element insertion point attributes represent the coordinates of the insertion point, the insertion scale, and the insertion angle.
[0127] The two-dimensional drawing is constructed into a three-dimensional model based on the element size and the element insertion point attribute.
[0128] In this implementation scheme, a three-dimensional model is constructed from a completed two-dimensional drawing. During the user's drawing process, the execution device can record the length, width, height, and attributes of each element, such as the coordinates of the insertion point, the insertion scale, and the insertion angle. After the user completes the drawing, the corresponding three-dimensional model is matched according to the elements, and the three-dimensional model is set according to the attribute data. Finally, the three-dimensional model of the entire drawing is completed and displayed. This method can improve the display effect of the drawing.
[0129] Please see Figure 7 , Figure 7 This is a schematic diagram of the structure of a drawing device provided in an embodiment of the present invention, such as... Figure 7 As shown, the drawing device 700 includes:
[0130] The first acquisition module 701 is used to acquire starting element information, element relationship information and first user operation information. The starting element information includes the position information and size information of the starting element. The element relationship information represents the hierarchical relationship between at least two elements. The first user operation information represents the user's operation at a first position on the drawing. The first position is any position on the drawing.
[0131] The first generation module 702 is used to determine the positional relationship between the starting graphic element and the first position based on the starting graphic element information and the first user operation information, so as to generate a positional relationship result. The positional relationship result includes one of the following: the starting graphic element contains the first position, or the starting graphic element does not contain the first position.
[0132] The first calling module 703 is used to call the matching primitive group in the primitive relationship information according to the positional relationship to obtain prediction information. The primitive group in the prediction information includes at least one primitive.
[0133] The second calling module 704 is used to obtain second user operation information based on the prediction information, and to call a drawing engine with a graphical interface to draw a two-dimensional drawing based on the second user operation information and the prediction information. The second user operation information represents the user's selection operation of the graphic elements in the prediction information.
[0134] Optionally, the first calling module 703 includes:
[0135] The first calling unit is configured to, when the starting graphic element contains the first position and the starting graphic element has sub-graphic elements, call the sub-graphic element belonging to the starting graphic element in the graphic element relationship information as the first prediction information;
[0136] The second calling unit is used to use a preset primitive group as the second prediction information when the starting primitive contains the first position and the starting primitive does not have any sub-primitives.
[0137] Optionally, the first calling module 703 further includes:
[0138] A construction unit is used to construct a coordinate system with the center position of the starting element as the origin when the starting element does not contain the first position.
[0139] The first generation unit is configured to generate the coordinates of the first position in the coordinate system based on the first position and the coordinate system;
[0140] The second generation unit is used to generate the orientation information of the first position relative to the center position of the starting element based on the coordinates of the first position in the coordinate system.
[0141] The third calling unit is used to call the matching primitive group in the nearest neighbor table as the third prediction information based on the orientation information. The nearest neighbor table represents a set of orientation and distance relationships between primitives. The third prediction information includes primitive groups that match the distance information and the orientation information.
[0142] Optionally, the drawing apparatus 700 also includes:
[0143] The second acquisition module is used to acquire component modules in the drawing and to standardize the component modules to obtain graphic elements that correspond one-to-one with the component modules.
[0144] The classification module is used to classify each element in the element group to obtain the element relationship information.
[0145] Optionally, the drawing apparatus 700 also includes:
[0146] The third acquisition module is used to acquire the user's identification information and third operation information, wherein the third operation information includes the order of the user inserting graphic elements and the operation frequency;
[0147] The first construction module is used to construct a timing relationship table based on the identification information and the third operation information, wherein the timing relationship table represents the operation frequency of at least two graphic elements and the sequential relationship between at least two graphic elements;
[0148] The third calling module is used to call the primitive group associated with the starting primitive in the time series relation table according to the starting primitive information to obtain prediction information. The primitive group in the prediction information includes at least one primitive.
[0149] The fourth calling module is used to obtain third user operation information based on the prediction information, and to call a drawing engine with a graphics interface to draw a two-dimensional drawing based on the third user operation information and the prediction information. The third user operation information represents the user's selection operation of graphic elements in the prediction information.
[0150] Optionally, the drawing apparatus 700 also includes:
[0151] The fourth acquisition module is used to acquire the basic information of each graphic element in the two-dimensional drawing. The basic information includes: graphic element size and graphic element insertion point attribute. The graphic element size represents the length, width and height of the graphic element, and the graphic element insertion point attribute represents the coordinates of the insertion point, the insertion scale and the insertion angle.
[0152] The second construction module is used to perform three-dimensional construction processing on the two-dimensional drawing based on the element size and the element insertion point attribute to obtain a three-dimensional model corresponding to the two-dimensional drawing.
[0153] According to embodiments of the present invention, the present invention also provides an electronic device and a readable storage medium.
[0154] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0155] like Figure 8 As shown, device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 802 or a computer program loaded from storage unit 808 into random access memory (RAM) 803. RAM 803 may also store various programs and data required for the operation of device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via bus 804. Input / output (I / O) interface 805 is also connected to bus 804.
[0156] Multiple components in device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of monitors, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0157] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as drawing methods based on primitive prediction.
[0158] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard parts (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0159] The program code used to implement the methods of the present invention can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0160] In the context of this invention, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0161] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including voice input, speech input, or tactile input).
[0162] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0163] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0164] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and no limitation is imposed herein.
[0165] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method of drawing a graph based on a primitive prediction, characterized by, The method comprises: obtaining starting graphic element information, graphic element relationship information and first user operation information, the starting graphic element information comprising position information and size information of a starting graphic element, the graphic element relationship information representing a hierarchical relationship between at least two graphic elements, and the first user operation information representing a user operation at a first position on a drawing sheet, the first position being an arbitrary position on the drawing sheet; judging a position relationship between the starting graphic element and the first position according to the starting graphic element information and the first user operation information to generate a position relationship result, the position relationship result comprising one of the following: the starting graphic element containing the first position, and the starting graphic element not containing the first position; calling a matching graphic element group in the graphic element relationship information according to the position relationship to obtain prediction information, the graphic element group in the prediction information comprising at least one graphic element; obtaining second user operation information according to the prediction information, and calling a drawing engine with a graphic interface to draw a two-dimensional drawing sheet according to the second user operation information and the prediction information, the second user operation information representing a selection operation of the user on the graphic element in the prediction information; the calling of the matching graphic element group in the graphic element relationship information according to the position relationship to obtain the prediction information comprises: in a case where the starting graphic element contains the first position and the starting graphic element has a sub-graphic element, calling the sub-graphic element belonging to the starting graphic element in the graphic element relationship information as first prediction information; in a case where the starting graphic element contains the first position and the starting graphic element has no sub-graphic element, calling a preset graphic element group as second prediction information; the calling of the matching graphic element group in the graphic element relationship information according to the position relationship to obtain the prediction information further comprises: in a case where the starting graphic element does not contain the first position, constructing a coordinate system with a center position of the starting graphic element as an origin; generating a coordinate of the first position in the coordinate system according to the first position and the coordinate system; generating bearing information of the first position with respect to the center position of the starting graphic element according to the coordinate of the first position in the coordinate system; calling a matching graphic element group in a near-neighbor relationship table as third prediction information according to the bearing information, the near-neighbor relationship table representing a set of bearing and distance relationships between graphic elements, and the third prediction information comprising a graphic element group matching the distance information and the bearing information.
2. The patch-based prediction based figure drawing method according to claim 1, wherein, Before the obtaining of the graphic element relationship information and the first user operation information, the method further comprises: obtaining a component module in a drawing sheet, and performing standardization processing on the component module to obtain a graphic element corresponding to the component module; performing classification processing on each graphic element in the graphic element group to obtain the graphic element relationship information.
3. The patch-based prediction based line drawing rendering method of claim 2, wherein, After the obtaining of the component module in the drawing sheet and the standardization processing on the component module to obtain the graphic element group, the method further comprises: obtaining identification information and third operation information of a user, the third operation information comprising a sequence relationship and an operation frequency of the user in inserting the graphic element; constructing a time sequence relation table according to the identification information and the third operation information, the time sequence relation table representing operation frequencies of the at least two graph elements and a sequence relation between the at least two graph elements; calling a graph element group associated with the starting graph element in the time sequence relation table according to the starting graph element information to obtain prediction information, the graph element group in the prediction information comprising at least one graph element; obtaining third user operation information according to the prediction information, and calling a drawing engine with a graphic interface to draw a two-dimensional drawing according to the third user operation information and the prediction information, the third user operation information representing a selection operation of a user on a graph element in the prediction information.
4. The patch-based prediction based figure drawing method according to any one of claims 1 to 3, characterized in that, After the two-dimensional drawing is determined according to the second user operation information and the prediction information, the method further comprises: obtaining basic information of each graph element in the two-dimensional drawing, the basic information comprising: a graph element size representing a length, a width and a height of the graph element, and a graph element insertion point attribute representing a coordinate, a proportion and an angle of an insertion point; performing a three-dimensional construction process on the two-dimensional drawing according to the graph element size and the graph element insertion point attribute to obtain a three-dimensional model corresponding to the two-dimensional drawing.
5. A drawing paper drawing device characterized by comprising: comprises: a first obtaining module, configured to obtain starting graph element information, graph element relation information and first user operation information, the starting graph element information comprising position information and size information of a starting graph element, the graph element relation information representing a hierarchical relation between at least two graph elements, and the first user operation information representing an operation of a user at a first position on a drawing, the first position being an arbitrary position on the drawing; a first generating module, configured to determine a position relation between the starting graph element and the first position according to the starting graph element information and the first user operation information, to generate a position relation result, the position relation result comprising one of: the starting graph element containing the first position, and the starting graph element not containing the first position; a first calling module, configured to call a matching graph element group in the graph element relation information according to the position relation to obtain prediction information, the graph element group in the prediction information comprising at least one graph element; a second calling module, configured to obtain second user operation information according to the prediction information, and to call a drawing engine with a graphic interface to draw a two-dimensional drawing according to the second user operation information and the prediction information, the second user operation information representing a selection operation of a user on a graph element in the prediction information; the first calling module comprises: a first calling unit, configured to, in a case where the starting graph element contains the first position and the starting graph element has a sub-graph element, call the sub-graph element belonging to the starting graph element in the graph element relation information as first prediction information; a second calling unit, configured to, in a case where the starting graph element contains the first position and the starting graph element has no sub-graph element, call a preset graph element group as second prediction information; the first calling module further comprises: a construction unit, configured to, in a case where the starting graph element does not contain the first position, construct a coordinate system with a center position of the starting graph element as an origin. The first generating unit is configured to generate coordinates of the first position in the coordinate system according to the first position and the coordinate system. The second generating unit is configured to generate orientation information of the first position relative to the center position of the starting primitive according to the coordinates of the first position in the coordinate system. The third calling unit is configured to call a matched primitive group in a neighbor relation table as third prediction information according to the orientation information, the neighbor relation table representing a set of orientation and distance relations between primitives, and the third prediction information including a primitive group matched with distance information and the orientation information.
6. An electronic device, comprising: The computer program product comprises: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the graph drawing method based on primitive prediction according to any one of claims 1 to 4.
7. A non-transitory computer-readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to perform the graph drawing method based on primitive prediction according to any one of claims 1 to 4.
Citation Information
Patent Citations
Pixel data processing method and device and electronic equipment
CN113553454A
Graph splitting method and system, terminal equipment and storage medium
CN114254407A