Method, apparatus, computer device, and storage medium for moving graphic elements across drawings
By determining the coordinate mapping relationship of reference objects in different drawings and moving the primitives across the drawings, the problem of inconsistent correspondence of the drawings is solved, and the efficiency and accuracy of calculation work are improved.
Patent Information
- Application Number
- CN202111489997.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-08
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2041-12-08
AI Technical Summary
In the prior art, it is impossible to move the primitives in different drawings, resulting in the coordinates of the primitives in the road drawings and drainage drawings that are not one by one, causing trouble to the calculation work.
By determining the coordinates of the target element and the reference object in the first drawing, using the coordinate mapping relationship, the element is moved from the first drawing to the second drawing, and the method of cache operation status and data is used to ensure that the movement process is not interrupted.
The movement of the element between different drawings is realized, the efficiency and accuracy of calculation work is improved, and the problem of inconsistent correspondence between element coordinates is solved.
Smart Images

Figure CN114154208B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer-aided design, and particularly to a method, device, computer device and computer-readable storage medium for moving graphic elements across drawings. Background Art
[0002] Based on the characteristic that drawings can truly reflect the size of actual objects, in the quantity calculation industry, drawings are often used for quantity calculation. However, sometimes the drawings may not be ideal. For example, in quantity calculation, there is a deduction relationship between roads and drainage. If the road drawing and the drainage drawing are not on the same drawing, it will cause the graphic element coordinates in the road drawing and the drainage drawing not to correspond one by one, thus causing trouble to the cost estimators who perform quantity calculation. Therefore, there is an urgent need to provide a solution for moving graphic elements in different drawings.
[0003] However, the inventor found that there is currently no solution for moving graphic elements in different drawings. Summary of the Invention
[0004] The purpose of the present invention is to provide a method, device, computer device and computer-readable storage medium for moving graphic elements across drawings, which can solve the technical problem that graphic elements cannot be moved in different drawings in the prior art.
[0005] One aspect of the present invention provides a method for moving graphic elements across drawings, the method comprising: determining a target graphic element to be moved from a first drawing to a second drawing in the first drawing; determining a target reference object that exists in both the first drawing and the second drawing; determining a first coordinate of the target reference object in the first drawing; determining a second coordinate of the target reference object in the second drawing; and moving the target graphic element from the first drawing to the second drawing according to the mapping relationship between the first coordinate and the second coordinate of the target reference object.
[0006] Optionally, determining the target primitive in the first drawing that needs to be moved to the second drawing includes: receiving a first movement instruction for the first drawing and determining the target primitive to be moved in the first drawing; determining the second coordinate of the target reference object in the second drawing includes: receiving a switching instruction to switch from the first drawing to the second drawing, determining the operation state of the first movement instruction, and determining the third coordinate of the target primitive in the first drawing; caching the operation state of the first movement instruction, the first coordinate of the target reference object, and the third coordinate of the target primitive; starting a second movement instruction for the second drawing, setting the operation state of the second movement instruction to the cached operation state of the first movement instruction, and setting the operation data of the second movement instruction to the cached first coordinate of the target reference object and the third coordinate of the target primitive; and determining the second coordinate of the target reference object according to the set second movement instruction.
[0007] Optionally, caching the operation state of the first movement instruction, the first coordinate of the target reference object, and the third coordinate of the target primitive includes: caching the operation state of the first movement instruction, the first coordinate of the target reference object, and the third coordinate of the target primitive into a global variable; starting the second movement instruction for the second drawing, setting the operation state of the second movement instruction to the cached operation state of the first movement instruction, and setting the operation data of the second movement instruction to the cached first coordinate of the target reference object and the third coordinate of the target primitive includes: controlling the second movement instruction to call the global variable to set the operation state of the second movement instruction to the operation state of the first movement instruction in the global variable and set the operation data of the second movement instruction to the first coordinate of the target reference object and the third coordinate of the target primitive in the global variable.
[0008] Optionally, moving the target primitive from the first drawing to the second drawing according to the mapping relationship between the first coordinate and the second coordinate of the target reference object includes: determining the offset of the second coordinate of the target reference object relative to the first coordinate; calculating the fourth coordinate of the target primitive in the second drawing according to the third coordinate of the target primitive and the offset; and moving the target primitive in the first drawing to the fourth coordinate in the second drawing.
[0009] Optionally, moving the target primitive in the first drawing to the fourth coordinate in the second drawing includes: constructing a copy primitive of the target primitive; and setting the copy primitive of the target primitive at the fourth coordinate in the second drawing.
[0010] Optionally, after moving the target primitive from the first drawing to the second drawing according to the mapping relationship between the first coordinate and the second coordinate of the target reference object, the method further includes: determining whether the target primitive needs to be rotated; if rotation is required, determining a rotation start line and a rotation end line in the second drawing; determining a target orientation of the rotation end line relative to the rotation start line and a target angle between the rotation end line and the rotation start line; and rotating the target primitive by the target angle in the second drawing in the target orientation.
[0011] Another aspect of the present invention provides a device for moving a primitive across drawings, the device including: a first determination module for determining a target primitive to be moved to a second drawing in a first drawing; a second determination module for determining a target reference object that exists in both the first drawing and the second drawing; a third determination module for determining a first coordinate of the target reference object in the first drawing; a fourth determination module for determining a second coordinate of the target reference object in the second drawing; and a movement module for moving the target primitive from the first drawing to the second drawing according to the mapping relationship between the first coordinate and the second coordinate of the target reference object.
[0012] Optionally, the first determination module is specifically configured to: receive a first movement instruction for the first drawing and determine a target primitive to be moved in the first drawing; the fourth determination module is specifically configured to: receive a switching instruction for switching from the first drawing to the second drawing, determine an operation state of the first movement instruction, and determine a third coordinate of the target primitive in the first drawing; cache the operation state of the first movement instruction, the first coordinate of the target reference object, and the third coordinate of the target primitive; start a second movement instruction for the second drawing, set the operation state of the second movement instruction to the cached operation state of the first movement instruction, and set the operation data of the second movement instruction to the cached first coordinate of the target reference object and the third coordinate of the target primitive; and determine the second coordinate of the target reference object according to the set second movement instruction.
[0013] Another aspect of the present invention provides a computer device, the computer device including: a memory, a processor, and a computer program stored on the memory and executable on the processor, where when the processor executes the computer program, the method for moving a primitive across drawings according to any of the above embodiments is implemented.
[0014] Another aspect of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method for moving a primitive across drawings according to any of the above embodiments is implemented.
[0015] In the present invention, when it is necessary to move a target primitive in a first drawing to a second drawing, a target reference object that exists in both the first drawing and the second drawing will be determined. Then, the first coordinate of the target reference object in the first drawing and the second coordinate in the second drawing will be determined. Furthermore, based on the mapping relationship between the first coordinate and the second coordinate, the target primitive will be moved from the first drawing to the second drawing. The present invention provides a method for moving primitives across drawings, which solves the technical problem in the prior art that primitives cannot be moved between different drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] By reading the following detailed description of the preferred embodiments, various other advantages and benefits will become clear to those of ordinary skill in the art. The drawings are only for the purpose of showing the preferred embodiments and are not considered to be a limitation of the present invention. Moreover, throughout the drawings, the same reference numerals are used to represent the same components. In the drawings:
[0017] Figure 1 shows the flowchart of the method for moving primitives across drawings in the first embodiment;
[0018] Figure 2 shows the schematic diagram of the first drawing in the first embodiment;
[0019] Figure 3 shows the schematic diagram of moving a primitive within a drawing in the first embodiment;
[0020] Figure 4 shows the schematic diagram of moving a primitive across drawings in the first embodiment;
[0021] Figure 5 shows the block diagram of the device for moving primitives across drawings in the second embodiment;
[0022] Figure 6 shows the block diagram of a computer device suitable for implementing the method for moving primitives across drawings provided in the third embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0023] In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0024] It should be noted that in this article, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the existence of additional identical elements in the process, method, article or device comprising such element.
[0025] Embodiment 1
[0026] Considering that in the prior art, sometimes the drawings may not be ideal. For example, the drainage drawing and the road drawing are not on the same drawing. This may be because the road drawing and the drainage drawing are respectively drawn by two designers; it may also be that at the beginning of the design, Party A wants to hand over the road drawing and the drainage drawing to different contractors for completion. But this will cause trouble to the cost estimators using the quantity calculation software. For example, when calculating quantities, there is a deduction relationship between the road and the drainage. If the road drawing and the drainage drawing are not on the same drawing, the graphic element coordinates in the road drawing and the drainage drawing will not correspond one by one. Therefore, there is an urgent need to provide a solution for moving graphic elements between different drawings. Based on the urgent needs in the prior art, the present invention provides a method for moving graphic elements across drawings, which can be applied to quantity calculation software. For example, two drawings are imported into the quantity calculation software: the first drawing and the second drawing. Moving across drawings means moving from the first drawing to the second drawing or from the second drawing to the first drawing; a graphic element (or target graphic element) means the smallest independent display unit in the quantity calculation software, including CAD graphic elements and / or model graphic elements. Among them, there are multiple CAD graphic elements in the CAD drawing. After importing the CAD drawing into the software, each display object that can be independently selected / captured by the software is a CAD graphic element; after converting the CAD drawing into a model drawing through the software, the obtained model drawing contains multiple model graphic elements, and a display object generated by the user through software drawing / recognition is a model graphic element. Specifically, Figure 1 The flowchart of the method for moving graphic elements across drawings in Embodiment 1 is shown, as Figure 1 shown, this method includes steps S1 to S5, where:
[0027] Step S1, determine the target graphic element to be moved to the second drawing in the first drawing.
[0028] Both the first drawing and the second drawing contain multiple graphic elements. The target graphic element can be all the graphic elements in the first drawing or part of the graphic elements in the first drawing.
[0029] Optionally, step S1 can specifically be:
[0030] Receive a first movement instruction for the first drawing, and determine a target primitive to be moved in the first drawing.
[0031] The first movement instruction is essentially an instruction that allows preparation work to be performed on the first drawing before moving primitives. As Figure 2 shown, the first movement instruction can be Figure 2 the positioning drawing command in []. After the software receives the first movement instruction, first, it initializes the first drawing, that is, eliminates other commands in the first drawing except the first movement instruction; second, it can also display operation prompt information in the bottom bar of the form, and the operation prompt information is used to prompt the operation steps during the movement, where each operation step corresponds to an operation state; finally, it prepares the data required during the movement, such as adding primitives to the movement container, etc.
[0032] Furthermore, after receiving the first movement instruction, which represents permission to perform preparatory work on the first drawing before moving primitives, at this time, the target primitive to be moved can be selected in the first drawing. As Figure 2 shown, if the "move primitives with the drawing" box is checked, it represents moving all primitives; if the "partial movement" box is checked, it represents moving some primitives. It should be noted that after checking the "partial movement" box, the user can determine which primitives in the first drawing need to be moved and which do not need to be moved in the display interface; if the "rotation" box is checked, the target primitive can also be rotated after the movement is completed.
[0033] Step S2, determine a target reference object that exists in both the first drawing and the second drawing.
[0034] When moving the target primitive, it needs to be moved based on a reference object. Therefore, first, a target reference object that exists in both the first drawing and the second drawing needs to be determined. Among them, the target reference object is the reference point for coordinate conversion between the position of the target primitive before and after the movement. When determining the target reference object, it can be determined based on the following characteristics:
[0035] 1. It has distinctiveness, such as the starting stake number K0+000 of the road center line;
[0036] 2. It has commonality and exists in both the first drawing and the second drawing;
[0037] 3. It has easy selectability, and there are no interfering points around its position in the drawing, which is not only convenient for operation but also can improve the accuracy after the movement.
[0038] Step S3, determine the first coordinate of the target reference object in the first drawing.
[0039] Specifically, it is possible to receive a click operation of the user on the target reference object in the first drawing, and in response to the click operation, the first coordinates of the target reference object can be determined.
[0040] Step S4: Determine the second coordinates of the target reference object in the second drawing.
[0041] Specifically, it is possible to receive a click operation of the user on the target reference object in the second drawing, and in response to the click operation, the second coordinates of the target reference object can be determined.
[0042] Optionally, when the first drawing and the second drawing do not exist in the same view, the following technical problem will be faced: the underlying platform will cancel all command states in the first drawing when switching the drawing, so the operation of moving the graphic element will be interrupted. Based on this, in this embodiment, when switching the drawing, the operation state and operation data of the first moving instruction of the first drawing will be cached, and the cached data will be assigned to the second moving instruction of the second drawing, so that the second moving instruction can inherit the operation process of the first moving instruction and continue the subsequent moving steps, that is, the command is not interrupted. Specifically, step S4 may include steps S41 to S44, where:
[0043] Step S41: Receive a switching instruction to switch from the first drawing to the second drawing, determine the operation state of the first moving instruction, and determine the third coordinates of the target graphic element in the first drawing;
[0044] Step S42: Cache the operation state of the first moving instruction, the first coordinates of the target reference object, and the third coordinates of the target graphic element;
[0045] Step S43: Start the second moving instruction for the second drawing, set the operation state of the second moving instruction to the cached operation state of the first moving instruction, and set the operation data of the second moving instruction to the cached first coordinates of the target reference object and the third coordinates of the target graphic element;
[0046] Step S44: Determine the second coordinates of the target reference object according to the set second moving instruction.
[0047] When moving a graphic element across views, the principle of uninterrupted command implementation is as follows: First step, cache the operation status and operation data of the first movement instruction. The operation status corresponds to the current operation step, and the operation data includes the first coordinate of the target reference object and the third coordinate of the target graphic element. It should be noted that the first movement instruction can move the target graphic element within the first drawing or across drawings. If moving the graphic element within the first drawing, there is no need to cache the operation status and operation data of the first movement instruction; if moving the graphic element across drawings, to ensure the command is not interrupted, it is necessary to cache the operation status and operation data of the first movement instruction. However, if only the target reference object is selected in the first drawing (i.e., the first coordinate of the target reference object is determined), the software cannot determine whether this movement will cross drawings. Only when switching drawings can the software determine that this is a cross-drawing movement of the graphic element. Therefore, after clicking to switch drawings, the software knows that this cross-drawing movement of the graphic element is required, and the software will first cache the above data. Second step, trigger the positioning drawing command in the second drawing again, that is, the second movement instruction, and then initialize the second drawing, that is, eliminate other commands in the second drawing except the second movement instruction, and then assign the cached data to the second movement instruction.
[0048] Further, after completing the setting of the second movement instruction, determine the next operation step based on the current operation status of the second movement instruction, that is, determine the second coordinate of the target reference object.
[0049] Optionally, to improve the movement speed, step S42 can specifically be: cache the operation status of the first movement instruction, the first coordinate of the target reference object, and the third coordinate of the target graphic element into a global variable; step S43 can specifically be: control the second movement instruction to call the global variable to set the operation status of the second movement instruction to the operation status of the first movement instruction in the global variable, and set the operation data of the second movement instruction to the first coordinate of the target reference object and the third coordinate of the target graphic element in the global variable.
[0050] Step S5, move the target graphic element from the first drawing to the second drawing according to the mapping relationship between the first coordinate and the second coordinate of the target reference object.
[0051] In this embodiment, the first drawing and the second drawing can share the same coordinate system, and the mapping relationship between the first coordinate and the second coordinate of the target reference object can be the offset between the two. Specifically, step S5 can include steps S51 to S53, where:
[0052] Step S51, determine the offset of the second coordinate of the target reference object relative to the first coordinate;
[0053] Step S52: Calculate the fourth coordinate of the target primitive in the second drawing based on the third coordinate of the target primitive and the offset.
[0054] Step S53: Move the target primitive in the first drawing to the fourth coordinate in the second drawing.
[0055] For example, if the first coordinate is (x1, y1, z1) and the second coordinate is (x2, y2, z2), then the offset of the second coordinate relative to the first coordinate is (x2 - x1, y2 - y1, z2 - z1). Assuming the third coordinate is (x3, y3, z3), then the fourth coordinate is (x2 - x1 + x3, y2 - y1 + y3, z2 - z1 + z3).
[0056] Optionally, in this implementation, moving the primitive actually places a copy primitive of the target primitive (the copy primitive is essentially no different from the target primitive) in the second drawing, but the target primitive itself still exists in the first drawing. Specifically, step S53 can be: construct a copy primitive of the target primitive; set the copy primitive of the target primitive at the fourth coordinate in the second drawing.
[0057] Optionally, after step S5, the method may further include steps A1 to A4, where:
[0058] Step A1: Determine whether the target primitive needs to be rotated.
[0059] Step A2: If rotation is required, determine the rotation start line and the rotation end line in the second drawing.
[0060] Step A3: Determine the target orientation of the rotation end line relative to the rotation start line and the target angle between the rotation end line and the rotation start line.
[0061] Step A4: Rotate the target primitive by the target angle in the second drawing towards the target orientation.
[0062] As described above, after moving the target primitive to the second drawing, the target primitive in the second drawing can also be rotated. If the user checks the rotation box in the first drawing, the software will cache the checked data when switching the drawing, and then the operation data of the set second movement instruction will include this checked data. When the software executes step A1, it will determine that a rotation operation is required. Further, the user can determine a rotation start line and a rotation end line in the second drawing, and then the software rotates the target primitive based on the target orientation and the target angle between the rotation start line and the rotation end line. This rotation operation does not require restarting other commands and still directly depends on the second movement instruction, which is convenient, fast, time-saving and labor-saving.
[0063] Refer to the following Figure 3 and Figure 4 to explain in detail the main differences and technical difficulties between moving a graphic element within a drawing and moving a graphic element across drawings. Among them, when moving a graphic element within a drawing, the reference point is the position of a reference object before movement, and the positioning point is the position of the reference object after movement; when moving a graphic element across drawings, the reference point is the position of the target reference object in the first drawing, that is, the first coordinate, and the positioning point is the position of the target reference object in the second drawing, that is, the second coordinate. As Figure 3 shown, when moving a graphic element in a drawing, directly determining the reference point and the positioning point can complete the movement operation. As Figure 4 shown, when moving a graphic element across drawings, the underlying platform will cancel all command states in the first drawing when switching drawings, so the operation of moving the graphic element will be interrupted. To solve this problem, after clicking to switch drawings, it is necessary to first cache the operations in the first drawing, then automatically start the second movement instruction in the second drawing, and assign the cached data to the second movement instruction to ensure that the command is not interrupted. Further, a temporary display node of the target graphic element, that is, a copy graphic element, is constructed, and then the positioning point is selected to complete the movement operation.
[0064] Embodiment 2
[0065] Embodiment 2 of the present invention provides a device for moving a graphic element across drawings. This device corresponds to the method provided in Embodiment 1 above. The corresponding technical features and technical effects will not be elaborated in detail in this embodiment, and the relevant parts can refer to Embodiment 1 above. Specifically, Figure 5 shows a block diagram of the device for moving a graphic element across drawings in Embodiment 2. As Figure 5 shown, the device 500 for moving a graphic element across drawings may include a first determination module 501, a second determination module 502, a third determination module 503, a fourth determination module 504, and a movement module 505, where:
[0066] The first determination module 501 is used to determine a target graphic element to be moved from the first drawing to the second drawing;
[0067] The second determination module 502 is used to determine a target reference object that exists in both the first drawing and the second drawing;
[0068] The third determination module 503 is used to determine the first coordinate of the target reference object in the first drawing;
[0069] The fourth determination module 504 is used to determine the second coordinate of the target reference object in the second drawing;
[0070] The moving module 505 is configured to move the target primitive from the first drawing to the second drawing according to the mapping relationship between the first coordinate and the second coordinate of the target reference object.
[0071] Optionally, the first determination module is specifically configured to: receive a first moving instruction for the first drawing, and determine a target primitive to be moved in the first drawing; the fourth determination module is specifically configured to: receive a switching instruction for switching from the first drawing to the second drawing, determine the operation state of the first moving instruction, and determine the third coordinate of the target primitive in the first drawing; cache the operation state of the first moving instruction, the first coordinate of the target reference object, and the third coordinate of the target primitive; start a second moving instruction for the second drawing, set the operation state of the second moving instruction to the cached operation state of the first moving instruction, and set the operation data of the second moving instruction to the cached first coordinate of the target reference object and the third coordinate of the target primitive; and determine the second coordinate of the target reference object according to the set second moving instruction.
[0072] Optionally, when caching the operation state of the first moving instruction, the first coordinate of the target reference object, and the third coordinate of the target primitive, the fourth determination module is specifically configured to: cache the operation state of the first moving instruction, the first coordinate of the target reference object, and the third coordinate of the target primitive into a global variable; when starting the second moving instruction for the second drawing, setting the operation state of the second moving instruction to the cached operation state of the first moving instruction, and setting the operation data of the second moving instruction to the cached first coordinate of the target reference object and the third coordinate of the target primitive, the fourth determination module is specifically configured to: control the second moving instruction to call the global variable, so as to set the operation state of the second moving instruction to the operation state of the first moving instruction in the global variable, and set the operation data of the second moving instruction to the first coordinate of the target reference object and the third coordinate of the target primitive in the global variable.
[0073] Optionally, the moving module is specifically configured to: determine the offset of the second coordinate of the target reference object relative to the first coordinate; calculate the fourth coordinate of the target primitive in the second drawing according to the third coordinate of the target primitive and the offset; and move the target primitive in the first drawing to the fourth coordinate in the second drawing.
[0074] Optionally, when moving the target primitive in the first drawing to the fourth coordinate in the second drawing, the moving module is specifically configured to: construct a copy primitive of the target primitive; and set the copy primitive of the target primitive at the fourth coordinate in the second drawing.
[0075] Optionally, the device further includes: a judgment module, configured to judge whether the target primitive needs to be rotated after moving the target primitive from the first drawing to the second drawing according to the mapping relationship between the first coordinate and the second coordinate of the target reference object; a fifth determination module, configured to determine a rotation start line and a rotation end line in the second drawing when rotation is required; a sixth determination module, configured to determine a target orientation of the rotation end line relative to the rotation start line and a target included angle between the rotation end line and the rotation start line; and a rotation module, configured to rotate the target primitive by the target included angle in the second drawing in the target orientation.
[0076] Embodiment III
[0077] Figure 6 FIG. shows a block diagram of a computer device suitable for implementing a method for moving a primitive across drawings according to Embodiment IV. In this embodiment, the computer device 600 may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a cabinet server (including an independent server or a server cluster composed of multiple servers) that executes a program. As Figure 6 shown, the computer device 600 of this embodiment at least includes, but is not limited to: a memory 601, a processor 602, and a network interface 603 that can communicate with each other through a system bus. It should be noted that Figure 6 only the computer device 600 with components 601-603 is shown, but it should be understood that it is not required to implement all the shown components, and more or fewer components can be alternatively implemented.
[0078] In this embodiment, the memory 603 includes at least one type of computer-readable storage medium. The readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 601 may be an internal storage unit of the computer device 600, such as the hard disk or memory of the computer device 600. In other embodiments, the memory 601 may also be an external storage device of the computer device 600, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc. equipped on the computer device 600. Of course, the memory 601 may also include both the internal storage unit and the external storage device of the computer device 600. In this embodiment, the memory 601 is generally used to store the operating system installed on the computer device 600 and various application software, such as the program code of the method for moving graphic elements across drawings. Among them, the method for moving graphic elements across drawings includes: determining a target graphic element to be moved to a second drawing in a first drawing; determining a target reference object that exists in both the first drawing and the second drawing; determining a first coordinate of the target reference object in the first drawing; determining a second coordinate of the target reference object in the second drawing; and moving the target graphic element from the first drawing to the second drawing according to the mapping relationship between the first coordinate and the second coordinate of the target reference object.
[0079] In some embodiments, the processor 602 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 602 is generally used to control the overall operation of the computer device 600. For example, it performs control and processing related to data interaction or communication with the computer device 600. In this embodiment, the processor 602 is used to run the program code of the method for moving graphic elements across drawings stored in the memory 601.
[0080] In this embodiment, the method for moving graphic elements across drawings stored in the memory 601 may also be divided into one or more program modules and executed by one or more processors (in this embodiment, the processor 602) to complete the present invention.
[0081] The network interface 603 may include a wireless network interface or a wired network interface, which is generally used to establish a communication link between the computer device 600 and other computer devices. For example, the network interface 603 is used to connect the computer device 600 to an external terminal through a network, and establish a data transmission channel and a communication link between the computer device 600 and the external terminal. The network may be a wireless or wired network such as an enterprise intranet (Intranet), the Internet, Global System of Mobile communication (GSM for short), Wideband Code Division Multiple Access (WCDMA for short), 4G network, 5G network, Bluetooth, Wi-Fi, etc.
[0082] Embodiment 4
[0083] This embodiment also provides a computer-readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disc, server, App application mall, etc., on which a computer program is stored. When the computer program is executed by a processor, it implements the steps of the method for moving a graphic element across drawings. Among them, the method for moving a graphic element across drawings includes: determining a target graphic element to be moved to a second drawing in a first drawing; determining a target reference object that exists in both the first drawing and the second drawing; determining a first coordinate of the target reference object in the first drawing; determining a second coordinate of the target reference object in the second drawing; and moving the target graphic element from the first drawing to the second drawing according to the mapping relationship between the first coordinate and the second coordinate of the target reference object.
[0084] Obviously, those skilled in the art should understand that the above-mentioned modules or steps of the embodiments of the present invention can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. Optionally, they can be implemented by program codes executable by the computing device. Thus, they can be stored in a storage device and executed by the computing device. And in some cases, the steps shown or described can be executed in a different order from here, or they can be separately fabricated into individual integrated circuit modules, or multiple modules or steps among them can be fabricated into a single integrated circuit module to implement. In this way, the embodiments of the present invention are not limited to any specific combination of hardware and software.
[0085] It should be noted that the serial numbers of the embodiments of the present invention are only for description and do not represent the superiority or inferiority of the embodiments.
[0086] Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.
[0087] The above are only the preferred embodiments of the present invention, and do not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, shall be equally included in the patent protection scope of the present invention.
Claims
1. A method for moving a graphic element across drawings, characterized in that, The method includes: Receiving a first movement instruction for a first drawing, and determining a target primitive in the first drawing that needs to be moved to a second drawing; Determining a target reference object that exists in both the first drawing and the second drawing; Determining a first coordinate of the target reference object in the first drawing; Receiving a switching instruction to switch from the first drawing to the second drawing, determining an operation state of the first movement instruction, and determining a third coordinate of the target primitive in the first drawing; Caching the operation state of the first movement instruction, the first coordinate of the target reference object, and the third coordinate of the target primitive; Starting a second movement instruction for the second drawing, setting the operation state of the second movement instruction to the cached operation state of the first movement instruction, and setting the operation data of the second movement instruction to the cached first coordinate of the target reference object and the third coordinate of the target primitive; Determining a second coordinate of the target reference object in the second drawing according to the set second movement instruction; Moving the target primitive from the first drawing to the second drawing according to the mapping relationship between the first coordinate and the second coordinate of the target reference object.
2. The method according to claim 1, wherein: The caching the operation state of the first movement instruction, the first coordinate of the target reference object, and the third coordinate of the target primitive includes: Caching the operation state of the first movement instruction, the first coordinate of the target reference object, and the third coordinate of the target primitive into a global variable; The starting the second movement instruction for the second drawing, setting the operation state of the second movement instruction to the cached operation state of the first movement instruction, and setting the operation data of the second movement instruction to the cached first coordinate of the target reference object and the third coordinate of the target primitive includes: Controlling the second movement instruction to call the global variable, so as to set the operation state of the second movement instruction to the operation state of the first movement instruction in the global variable, and setting the operation data of the second movement instruction to the first coordinate of the target reference object and the third coordinate of the target primitive in the global variable.
3. The method according to claim 1, wherein The moving the target primitive from the first drawing to the second drawing according to the mapping relationship between the first coordinate and the second coordinate of the target reference object includes: Determining an offset of the second coordinate of the target reference object relative to the first coordinate; Calculating a fourth coordinate of the target primitive in the second drawing according to the third coordinate of the target primitive and the offset; Moving the target primitive in the first drawing to the fourth coordinate in the second drawing.
4. The method according to claim 3, wherein The moving the target primitive in the first drawing to the fourth coordinate in the second drawing includes: Constructing a copy primitive of the target primitive; Setting the copy primitive of the target primitive at the fourth coordinate in the second drawing.
5. The method according to claim 1, characterized in that, After moving the target primitive from the first drawing to the second drawing according to the mapping relationship between the first coordinate and the second coordinate of the target reference object, the method further includes: Determine whether the target primitive needs to be rotated; If rotation is required, determine the rotation start line and the rotation end line in the second drawing; Determine the target orientation of the rotation end line relative to the rotation start line and the target angle between the rotation end line and the rotation start line; Rotate the target primitive by the target angle in the second drawing in the target orientation.
6. A device for moving graphic elements across drawings, characterized in that, The apparatus includes: A first determination module, configured to receive a first movement instruction for a first drawing, and determine a target primitive to be moved to a second drawing in the first drawing; A second determination module, configured to determine a target reference object that exists in both the first drawing and the second drawing; A third determination module, configured to determine a first coordinate of the target reference object in the first drawing; A fourth determination module, configured to receive a switching instruction to switch from the first drawing to the second drawing, determine the operation state of the first movement instruction, and determine a third coordinate of the target primitive in the first drawing; cache the operation state of the first movement instruction, the first coordinate of the target reference object, and the third coordinate of the target primitive; start a second movement instruction for the second drawing, set the operation state of the second movement instruction to the cached operation state of the first movement instruction, and set the operation data of the second movement instruction to the cached first coordinate of the target reference object and the third coordinate of the target primitive; determine a second coordinate of the target reference object in the second drawing according to the set second movement instruction; A movement module, configured to move the target primitive from the first drawing to the second drawing according to the mapping relationship between the first coordinate and the second coordinate of the target reference object.
7. A computer device, the computer device comprising: A memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, The computer program, when executed by the processor, implements the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Architectural drawing preprocessing system and method, electronic equipment and storage medium
CN111782584A
Mark language and object model of vector graps
CN1534476A