Industrial configuration graphic editing method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202610868020.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-16
- Publication Date
- 2026-08-18
AI Technical Summary
传统技术在处理吸附时,一般直接在视口空间或舞台物理绝对空间进行距离计算,这导致画布一旦被放大或平移,底层的真实几何距离在屏幕上就会产生像素级的视觉放大或位移畸变,使用户在拖拽图元时产生吸附点错位、对不齐或来回抖动跳跃的漂移现象,无法达成准确的像素级对齐
[0016]The industrial configuration graphic editing method, apparatus, electronic device, and storage medium proposed in this application acquire operation events of the graphic editing area and the current viewport translation and scaling of the graphic editing area; in response to an operation event indicating that a target graphic element is dragged, the viewport coordinates of the mouse are acquired, and the absolute coordinates of the target graphic element in the graphic editing area are determined based on the viewport coordinates, viewport translation, and scaling; a global relative coordinate system is constructed based on the absolute coordinates of the target graphic element and the position information of a preset snap-in reference point in the graphic editing area to obtain the relative coordinates of the corresponding target graphic element; the absolute coordinates of the target graphic element are corrected based on the relative coordinates to obtain the absolute coordinate correction value; in response to an operation event indicating that the target graphic element is no longer dragged, the target position of the target graphic element is determined based on the absolute coordinate correction value. Therefore, this application collects the mouse viewport coordinates in real time during each frame of user dragging and converts them into the absolute coordinates of the target primitive. Then, it projects the absolute coordinates and the positions of the reference points of each layer onto the global relative coordinate system for geometric distance comparison, avoiding the influence of spatial distortion caused by translation and scaling. After determining the relative offset, it returns to correct the position of the target primitive. Since the final position of the target primitive is obtained through relative coordinates, it can avoid the influence of misalignment and drift caused by translation and scaling, thus achieving higher accuracy of snap-in alignment.
Smart Images

Figure CN122593679A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of industrial drawing technology, and in particular to an industrial configuration graphic editing method, apparatus, electronic device and storage medium. Background Technology
[0002] Industrial configuration software is a core scheduling and monitoring tool in modern industrial automation control systems. Through its graphical editor, engineers can create real-time monitoring interfaces and process flow diagrams that intuitively reflect the production process, equipment status, and pipeline layout in an industrial setting. Because industrial monitoring scenarios often involve extremely large and complex processes, the configuration graphical editor typically needs to provide unlimited panning and zooming of the canvas, allowing users to flexibly switch between macroscopic control of the overall architecture and microscopic adjustment of local elements.
[0003] In graphic editing interactions, snapping and alignment is a key mechanism for improving the efficiency of primitive layout and ensuring the standardization of drawing. Traditional configuration software graphic editors typically only provide basic drag-and-drop and simple background grid alignment functions. When processing snapping, traditional techniques generally calculate distances directly in viewport space or stage physical absolute space. This results in pixel-level visual magnification or displacement distortion of the underlying geometric distances on the screen once the canvas is magnified or translated. This causes users to experience snapping point misalignment, misalignment, or back-and-forth jittering and jumping drift when dragging primitives, making it impossible to achieve accurate pixel-level alignment.
[0004] Therefore, how to achieve accurate snap-in and alignment of layouts in industrial configuration software under arbitrary translation and scaling of the canvas has become an urgent technical problem to be solved. Summary of the Invention
[0005] The main objective of this application is to provide an industrial configuration graphic editing method, apparatus, electronic device, and storage medium, which aims to improve the accuracy of primitive snapping and alignment when the canvas is arbitrarily translated and scaled.
[0006] To achieve the above objectives, a first aspect of this application proposes an industrial configuration graphic editing method, the method comprising: Obtain the operation events of the graphics editing area and the current viewport translation and scaling of the graphics editing area; In response to the operation event indicating that the target graphic element is dragged, the viewport coordinates of the mouse are obtained, and the absolute coordinates of the target graphic element in the graphics editing area are determined based on the viewport coordinates, the viewport translation amount, and the scaling ratio. A global relative coordinate system is constructed based on the absolute coordinates of the target graphic element and the position information of the preset adsorption reference point in the graphic editing area to obtain the relative coordinates of the target graphic element. The absolute coordinates of the target graphic element are corrected based on the relative coordinates to obtain the absolute coordinate correction value; In response to the operation event indicating that the target element is no longer being dragged, the target position of the target element is determined based on the absolute coordinate correction value.
[0007] In some embodiments, the graphics editing area is provided with multiple management levels, including a work area snapping layer, a primitive snapping layer, a pipeline node snapping layer, and a grid snapping layer. Each management level is provided with a cache pool to store the position information of the snapping reference point of the corresponding management level in the relative coordinate system. The step of constructing a global relative coordinate system based on the absolute coordinates of the target graphic element and the position information of a preset snap-in reference point within the graphic editing area to obtain the relative coordinates corresponding to the target graphic element includes: Based on the event type of the operation event, the buffer pools corresponding to the work area adsorption layer, the primitive adsorption layer, the pipeline node adsorption layer and the grid adsorption layer are subjected to dirty marking status evaluation processing. In response to the cache pool being marked as invalid, the corresponding cache pool is repositioned according to relative coordinates, and the position information of the corresponding adsorption reference point in the relative coordinate system is updated. In response to the cache pool being marked as not invalid, a global relative coordinate system is constructed based on the position information of the adsorption reference point in the cache pool and the absolute coordinates of the target primitive, thereby obtaining the relative coordinates of the target primitive.
[0008] In some embodiments, in response to the operation event indicating that a target primitive is dragged, dirty marking status assessment processing is performed on the buffer pools corresponding to the work area snap-in layer, the primitive snap-in layer, the pipeline node snap-in layer, and the mesh snap-in layer, respectively, based on the event type of the operation event, including: In response to a change in the size of the work area of the graphics editing area, the cache pool corresponding to the work area adsorption layer is marked as invalid. In response to the addition, deletion or movement of other graphic elements in the graphic editing area, the cache pool corresponding to the graphic element snapping layer is marked as invalid. In response to the canvas scaling action of the graphics editing area, the cache pools corresponding to all management levels are marked as invalid.
[0009] In some embodiments, correcting the absolute coordinates of the target primitive based on the relative coordinates to obtain an absolute coordinate correction value includes: In the global relative coordinate system, the first geometric distance from the target primitive to the adsorption reference point of each management level and the second geometric distance from the adsorption reference point to the selected primitive are calculated bidirectionally. Adsorption points are confirmed based on the pre-set adsorption weight level of the management level, the first geometric distance, and the second geometric distance, and the target adsorption point is confirmed from multiple adsorption reference points; The relative coordinates of the target primitive are corrected based on the target adsorption point to obtain the relative coordinate correction amount; The absolute coordinates of the target primitive are corrected based on the relative coordinate correction amount to obtain the absolute coordinate correction value.
[0010] In some embodiments, the step of responding to the operation event indicating that the target feature is no longer being dragged, and determining the target position of the target feature based on the absolute coordinate correction value, includes: Based on the absolute coordinate correction value and the absolute coordinates of the target graphic element, a dashed auxiliary line is displayed on the graphics editing area; wherein the dashed auxiliary line points from the absolute coordinates of the target graphic element to the position represented by the absolute coordinate correction value, and the dashed auxiliary line is set with different styles, the styles of the dashed auxiliary line corresponding to different management levels; In response to the operation event indicating that the target graphic element is no longer being dragged, the position of the target graphic element is determined based on the absolute coordinate correction value.
[0011] In some embodiments, the response to the operation event indicating that the target graphic element is dragged involves obtaining the viewport coordinates of the mouse and determining the absolute coordinates of the target graphic element in the graphics editing area based on the viewport coordinates, the viewport translation amount, and the scaling ratio. Specifically, this includes: The horizontal component of the absolute coordinates of the target primitive is determined based on the horizontal component of the viewport coordinates, the horizontal translation amount in the viewport translation, and the scaling ratio. The vertical component of the absolute coordinates of the target primitive is determined based on the vertical component of the viewport coordinates, the vertical translation amount in the viewport translation amount, and the scaling ratio.
[0012] In some embodiments, the step of constructing a global relative coordinate system based on the absolute coordinates of the target graphic element and the position information of a preset snap-in reference point within the graphic editing area to obtain the relative coordinates corresponding to the target graphic element further includes: The horizontal component of the relative coordinates is obtained by subtracting and reducing the horizontal component of the absolute coordinates from the horizontal translation of the viewport translation. The vertical component of the relative coordinates is obtained by subtracting and reducing the vertical component of the absolute coordinates from the vertical translation of the viewport translation.
[0013] To achieve the above objectives, a second aspect of this application provides an industrial configuration graphic editing device, the device comprising: The editing response module is used to obtain operation events in the graphics editing area and the current viewport translation and scaling of the graphics editing area; The coordinate correction module is used to respond to the operation event indicating that the target graphic element is dragged, obtain the viewport coordinates of the mouse, and determine the absolute coordinates of the target graphic element in the graphics editing area based on the viewport coordinates, the viewport translation amount, and the scaling ratio; construct a global relative coordinate system based on the absolute coordinates of the target graphic element and the position information of a preset snapping reference point in the graphics editing area to obtain the relative coordinates of the target graphic element; and correct the absolute coordinates of the target graphic element based on the relative coordinates to obtain an absolute coordinate correction value. The position determination module is used to determine the target position of the target graphic element based on the absolute coordinate correction value in response to the operation event indicating that the target graphic element is no longer being dragged.
[0014] To achieve the above objectives, a third aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the industrial configuration graphic editing method described in the first aspect.
[0015] To achieve the above objectives, a fourth aspect of the present application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the industrial configuration graphic editing method described in the first aspect.
[0016] The industrial configuration graphic editing method, apparatus, electronic device, and storage medium proposed in this application acquire operation events of the graphic editing area and the current viewport translation and scaling of the graphic editing area; in response to an operation event indicating that a target graphic element is dragged, the viewport coordinates of the mouse are acquired, and the absolute coordinates of the target graphic element in the graphic editing area are determined based on the viewport coordinates, viewport translation, and scaling; a global relative coordinate system is constructed based on the absolute coordinates of the target graphic element and the position information of a preset snap-in reference point in the graphic editing area to obtain the relative coordinates of the corresponding target graphic element; the absolute coordinates of the target graphic element are corrected based on the relative coordinates to obtain the absolute coordinate correction value; in response to an operation event indicating that the target graphic element is no longer dragged, the target position of the target graphic element is determined based on the absolute coordinate correction value. Therefore, this application collects the mouse viewport coordinates in real time during each frame of user dragging and converts them into the absolute coordinates of the target primitive. Then, it projects the absolute coordinates and the positions of the reference points of each layer onto the global relative coordinate system for geometric distance comparison, avoiding the influence of spatial distortion caused by translation and scaling. After determining the relative offset, it returns to correct the position of the target primitive. Since the final position of the target primitive is obtained through relative coordinates, it can avoid the influence of misalignment and drift caused by translation and scaling, thus achieving higher accuracy of snap-in alignment. Attached Figure Description
[0017] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which: Figure 1 This is a schematic flowchart of an industrial configuration graphic editing method according to an embodiment of this application; Figure 2 This is another flowchart illustrating the industrial configuration graphic editing method according to an embodiment of this application; Figure 3 This is another flowchart illustrating the industrial configuration graphic editing method according to an embodiment of this application; Figure 4 This is another flowchart illustrating the industrial configuration graphic editing method according to an embodiment of this application; Figure 5 This is another flowchart illustrating the industrial configuration graphic editing method according to an embodiment of this application; Figure 6 This is another flowchart illustrating the industrial configuration graphic editing method according to an embodiment of this application; Figure 7 This is another flowchart illustrating the industrial configuration graphic editing method according to an embodiment of this application; Figure 8 This is a schematic diagram of the structure of an industrial configuration graphic editing device according to an embodiment of this application; Figure 9This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0019] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0020] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0021] Industrial configuration software is a core scheduling and monitoring tool in modern industrial automation control systems. Through its graphical editor, engineers can create real-time monitoring interfaces and process flow diagrams that intuitively reflect the production process, equipment status, and pipeline layout in an industrial setting. Because industrial monitoring scenarios often involve extremely large and complex processes, the configuration graphical editor typically needs to provide unlimited panning and zooming of the canvas, allowing users to flexibly switch between macroscopic control of the overall architecture and microscopic adjustment of local elements.
[0022] In graphic editing interactions, snapping and alignment is a key mechanism for improving the efficiency of primitive layout and ensuring the standardization of drawing. Traditional configuration software graphic editors typically only provide basic drag-and-drop and simple background grid alignment functions. When processing snapping, traditional techniques generally calculate distances directly in viewport space or stage physical absolute space. This results in pixel-level visual magnification or displacement distortion of the underlying geometric distances on the screen once the canvas is magnified or translated. This causes users to experience snapping point misalignment, misalignment, or back-and-forth jittering and jumping drift when dragging primitives, making it impossible to achieve accurate pixel-level alignment.
[0023] Therefore, how to achieve accurate snap-in and alignment of layouts in industrial configuration software under arbitrary translation and scaling of the canvas has become an urgent technical problem to be solved.
[0024] Based on this, embodiments of this application provide an industrial configuration graphic editing method, apparatus, electronic device, and storage medium, aiming to improve the accuracy of primitive snapping and alignment when the canvas is arbitrarily translated and scaled.
[0025] The industrial configuration graphic editing method, apparatus, electronic device, and storage medium provided in this application are specifically described through the following embodiments. First, the industrial configuration graphic editing method in this application embodiment is described.
[0026] The industrial configuration graphic editing method provided in this application relates to the field of industrial drafting technology. This method can be applied to a terminal, a server, or software running on either a terminal or a server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, etc.; the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application implementing the industrial configuration graphic editing method, but is not limited to the above forms.
[0027] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0028] Figure 1 This is an optional flowchart illustrating the industrial configuration graphic editing method provided in this application embodiment. Figure 1 The method may include, but is not limited to, steps S101 to S105.
[0029] Step S101: Obtain the operation events of the graphics editing area and the current viewport translation and scaling of the graphics editing area; Step S102: In response to an operation event indicating that the target graphic element is dragged, obtain the viewport coordinates of the mouse, and determine the absolute coordinates of the target graphic element in the graphics editing area based on the viewport coordinates, viewport translation amount, and scaling ratio. Step S103: Construct a global relative coordinate system based on the absolute coordinates of the target graphic element and the position information of the preset snap-in reference point in the graphic editing area to obtain the relative coordinates of the corresponding target graphic element; Step S104: Correct the absolute coordinates of the target primitives based on the relative coordinates to obtain the absolute coordinate correction value; Step S105: In response to the operation event indicating that the target element is no longer being dragged, the target position of the target element is determined based on the absolute coordinate correction value.
[0030] Steps S101 to S105 as illustrated in this embodiment involve acquiring operation events in the graphics editing area and the current viewport translation and scaling of the graphics editing area; responding to an operation event indicating that a target graphic element is being dragged, acquiring the viewport coordinates of the mouse, and determining the absolute coordinates of the target graphic element in the graphics editing area based on the viewport coordinates, viewport translation, and scaling; constructing a global relative coordinate system based on the absolute coordinates of the target graphic element and the position information of a preset snapping reference point in the graphics editing area to obtain the relative coordinates of the corresponding target graphic element; correcting the absolute coordinates of the target graphic element based on the relative coordinates to obtain an absolute coordinate correction value; and responding to an operation event indicating that the target graphic element is no longer being dragged, determining the target position of the target graphic element based on the absolute coordinate correction value. Therefore, this application collects the mouse viewport coordinates in real time during each frame of user dragging and converts them into the absolute coordinates of the target primitive. Then, it projects the absolute coordinates and the positions of the reference points of each layer onto the global relative coordinate system for geometric distance comparison, avoiding the influence of spatial distortion caused by translation and scaling. After determining the relative offset, it returns to correct the position of the target primitive. Since the final position of the target primitive is obtained through relative coordinates, it can avoid the influence of misalignment and drift caused by translation and scaling, thus achieving higher accuracy of snap-in alignment.
[0031] In step S101 of some embodiments, the operation events of the graphics editing area and the current viewport translation and zoom level of the graphics editing area are obtained. Specifically, the graphics editing area is the main visual operation interface of the industrial configuration software. The operation events represent various operations performed by the user in the graphics editing area, such as creating or deleting elements, dragging elements, editing element attributes, etc.
[0032] This function retrieves the current viewport translation and scaling of the graphics editing area. The viewport translation is a geometric control parameter describing the relative displacement between the screen window and the underlying infinitely large canvas of the graphics editing area; it represents the position of the user's viewing area within the graphics editing area. A two-dimensional coordinate system can be constructed based on the graphics editing area, with the top-left corner of the area as the origin. The viewport translation can be expressed as the displacement of the user's viewing area relative to the origin, and the scaling represents the zoom level of the graphics editing area.
[0033] In step S102 of some embodiments, in response to an operation event indicating that a target graphic element is dragged, the viewport coordinates of the current mouse, which are collected in real time, are processed for absolute position conversion to obtain the absolute coordinates of the target graphic element in the graphics editing area. Specifically, when the operation event in the graphics editing area is interpreted as the left mouse button being pressed and the target graphic element being moved, the original pixel coordinates of the mouse in the browser screen pixel space can be read in real time to obtain the corresponding viewport coordinates. Then, based on the viewport coordinates, viewport translation amount, and scaling ratio, the absolute coordinates of the target graphic element in the graphics editing area can be determined.
[0034] Please see Figure 2 In some embodiments, step S102 may include, but is not limited to, steps S201 to S202: Step S201: Determine the horizontal component of the absolute coordinates of the target primitive based on the horizontal component of the viewport coordinates, the horizontal translation amount in the viewport translation amount, and the scaling ratio. Step S202: Determine the vertical component of the absolute coordinates of the target primitive based on the vertical component of the viewport coordinates, the vertical translation amount in the viewport translation amount, and the scaling ratio.
[0035] In step S201 of some embodiments, the horizontal offset pixel value of the viewport coordinates, the horizontal translation amount in the viewport translation, and the scaling ratio are used to perform absolute position conversion processing to obtain the horizontal component of the absolute coordinates of the target primitive. Specifically, a difference calculation is performed based on the horizontal component in the viewport coordinates and the horizontal translation amount of the viewport translation to obtain a first difference result. Then, a division mapping process is performed based on the first difference result and the scaling ratio to obtain the horizontal component of the absolute coordinates.
[0036] In step S202 of some embodiments, the vertical offset pixel value of the viewport coordinates, the vertical translation amount in the viewport translation, and the scaling ratio are used to perform absolute position conversion processing to obtain the vertical component of the absolute coordinates of the target primitive. Specifically, a difference calculation is performed based on the vertical component in the viewport coordinates and the vertical translation amount of the viewport translation to obtain a second difference result. Then, a division mapping process is performed based on the second difference result and the scaling ratio to obtain the vertical component of the absolute coordinates, thereby obtaining the absolute coordinates.
[0037] Through steps S201 to S202, difference calculation and division mapping are performed based on the real-time viewport translation and scaling ratio, respectively, to convert the viewport motion trajectory at the screen pixel level into the real geometric displacement on the underlying canvas stage, and to quantize and output the absolute coordinate horizontal and vertical components without visual drift error.
[0038] In step S103 of some embodiments, the absolute coordinates and the obtained position information of the adsorption reference points are transformed and stripped to obtain relative coordinates in a global relative coordinate system. Specifically, the position information of the adsorption reference points includes pre-configured coordinates of the work area boundary line, coordinates of the static primitive edge, coordinates of the background grid intersection, and coordinates of the start, end, and turning points of the industrial pipeline. A global relative coordinate system is constructed based on these adsorption reference points, and the relative positions of these adsorption reference points and the target primitive are calculated to obtain the relative coordinates.
[0039] In some embodiments, the graphics editing area is provided with several management levels, including a work area snapping layer, a primitive snapping layer, a pipeline node snapping layer, and a mesh snapping layer. Each management level is provided with a cache pool to store the position information of the snapping reference point of the corresponding management level in the relative coordinate system.
[0040] Please see Figure 3 In some embodiments, step S103 may include, but is not limited to, steps S301 to S303: Step S301: Based on the event type of the operation event, perform dirty marking status evaluation on the buffer pools corresponding to the work area snapping layer, primitive snapping layer, pipeline node snapping layer and mesh snapping layer respectively. Step S302: In response to the cache pool being marked as invalid, the corresponding cache pool is repositioned according to relative coordinates, and the position information of the corresponding adsorption reference point in the relative coordinate system is updated. In step S303, in response to the cache pool being marked as not expired, a global relative coordinate system is constructed based on the position information of the snapped reference point in the cache pool and the absolute coordinates of the target primitive, and the relative coordinates of the corresponding target primitive are obtained.
[0041] As industrial monitoring interfaces become increasingly complex, the number of primitives and pipelines contained in the canvas often reaches hundreds or even thousands. During user interaction by dragging primitives, it is necessary to traverse and calculate the distance between the selected primitive and all other primitives, meshes, and pipelines in the scene in real time within extremely short frame intervals. Existing full-scale calculation methods result in a linear increase in computational complexity with the number of primitives, causing severe screen stuttering and mouse lag, significantly deteriorating the human-computer interaction experience. To address this, this application proposes a dirty-marking state evaluation method to selectively update the distances and states of primitives and pipelines in the canvas.
[0042] In step S301 of some embodiments, the independent buffer pools corresponding to the working area adsorption layer, primitive adsorption layer, pipeline node adsorption layer and mesh adsorption layer can be subjected to dirty marking status evaluation based on the event type of the operation event to obtain the failure status of the buffer pools at each management level.
[0043] Specifically, operation events can be monitored. In some cases, users may perform operation events before dragging the target graphic element, or they may perform other types of operation events while dragging the target graphic element. Event types include canvas overall scaling events, editing area size change events, and non-selected graphic element data change events. Based on the event types of these operation events, the cache pools at each management level can be marked.
[0044] In step S302 of some embodiments, in response to the cache pool being marked as invalid, it indicates that objects such as primitives or pipelines within the cache pool need to undergo relative coordinate repositioning to update the position information of the corresponding snapping reference points in the relative coordinate system. Specifically, when the status flag of the corresponding cache pool is in the invalid state, it is necessary to retrieve the physical absolute coordinates of each reference object in the corresponding snapping level, then recalculate the latest relative coordinates of the snapping reference points of this management level in the current rendering frame, and then write back the latest relative coordinates to overwrite the cache pool of the corresponding management level, thereby resetting the status flag to the non-invalid state.
[0045] In step S303 of some embodiments, in response to the cache pool being marked as not invalid, it indicates that objects such as primitives or pipelines within this cache pool do not require relative coordinate relocation processing, and the relative coordinates remain valid. Therefore, the position information of the snapped reference points in the cache pool can be directly reused, and a global relative coordinate system can be constructed based on this position information and the absolute coordinates of the target primitive to obtain the relative coordinates of the corresponding target primitive.
[0046] Specifically, when the status flag of the corresponding cache pool is in the non-expired state, the relative coordinate data of the previous frame stored in the cache pool can be read directly. Simultaneously, the absolute coordinates of the target graphic element can be read, and the relative coordinates of the target graphic element can be further calculated.
[0047] Through steps S301 to S303, the dirty marking state evaluation process is used to accurately evaluate the failure state of the cached data in the high-frequency interaction process. When a failure state is detected, local relative coordinate relocation processing is performed. When a failure state is detected, the historical frame position information is directly reused, thereby greatly reducing the computational complexity of coordinate transformation during the dragging process.
[0048] Please see Figure 4In some embodiments, step S301 may include, but is not limited to, steps S401 to S403: Step S401: In response to the change in the size of the work area in the graphics editing area, the buffer pool corresponding to the work area snapping layer is marked as invalid. In step S402, in response to the addition, deletion or movement of other graphic elements in the graphic editing area, the cache pool corresponding to the graphic element snapping layer is marked as invalid. In step S403, in response to the canvas scaling action in the graphics editing area, the cache pools corresponding to all management levels are marked as invalid.
[0049] In step S401 of some embodiments, in response to a change in the size of the work area of the graphics editing area, the cache pool corresponding to the work area snapping layer can be marked as invalid. Specifically, when a size change code caused by browser window stretching, display panel resolution switching, or change in the reference boundary of the editing area is captured, the position information of the snapping reference points contained in the work area snapping layer changes, and the cache pool corresponding to the work area snapping layer is marked as invalid. The work area snapping layer contains the left, center, and right vertical lines and the top, center, and bottom horizontal lines of the graphics editing area. These snapping reference points can help target primitives quickly align to the center or boundary of the canvas.
[0050] In step S402 of some embodiments, in response to the addition, deletion, or movement of other graphic elements in the graphics editing area, the buffer pool corresponding to the graphic element snapping layer and the pipeline node snapping layer can be marked as invalid. Specifically, when a non-selected graphic element is added, deleted, or its static relative position changes in the graphics editing area, the buffer pool corresponding to the graphic element snapping layer can be marked and rewritten as invalid. The graphic element snapping layer contains other graphic elements in the graphics editing area, and these other graphic elements are provided with snapping reference points, which can help the target graphic element to quickly align, for example, to the center point or starting point of other graphic elements.
[0051] In step S403 of some embodiments, in response to the canvas scaling action in the graphics editing area, all cache pools corresponding to all management levels can be uniformly marked as invalid. Specifically, when the transformation event listens for a scroll wheel event or a canvas scaling action triggered by the scaling button, it is determined that the reference of the global relative coordinate system has changed, thus requiring the initiation of a global reset marking process. This marks all independent cache pool status flags, including the work area snapping layer, primitive snapping layer, pipeline node snapping layer, and mesh snapping layer, as invalid. The pipeline node snapping layer contains pipeline objects with snapping reference points, which help target primitives quickly snap to the start or end point of the pipeline. The mesh snapping layer contains regularly distributed lines generated according to the canvas background mesh parameters, serving as basic alignment aids.
[0052] Through steps S401 to S403, by subdividing and classifying various interactive actions in the graphics editing area, the state of the cache pool at each management level is calibrated using the dirty marking state evaluation process, and the snapping reference points in the cache pool can be reused.
[0053] Please see Figure 5 In some embodiments, step S103 may include, but is not limited to, steps S501 to S502: Step S501: Based on the difference reduction process between the horizontal component of the absolute coordinates and the horizontal translation amount of the viewport translation, the horizontal component of the relative coordinates is obtained. Step S502: Based on the difference reduction process between the vertical component of the absolute coordinates and the vertical translation amount of the viewport translation, the vertical component of the relative coordinates is obtained.
[0054] In step S501 of some embodiments, the horizontal component of the absolute coordinates is transformed and stripped using the horizontal translation amount of the viewport translation to obtain the horizontal component of the relative coordinates in the global relative coordinate system. Specifically, the horizontal component of the relative coordinates is obtained by subtracting and reducing the horizontal component of the absolute coordinates from the horizontal translation amount.
[0055] In step S502 of some embodiments, the vertical component of the absolute coordinates is transformed and stripped using the vertical translation amount of the viewport translation to obtain the vertical component of the relative coordinates in the global relative coordinate system. Specifically, the vertical component of the relative coordinates is obtained by subtracting and reducing the vertical component of the absolute coordinates from the vertical translation amount.
[0056] Simultaneously, the coordinates of the adsorption reference points at each management level can be subjected to the same subtraction reduction process to eliminate the spatial displacement error caused by canvas translation, thereby obtaining the relative coordinates of the target primitive and the relative coordinates of each adsorption reference point in relative space.
[0057] In step S104 of some embodiments, the absolute coordinates of the target graphic element are corrected based on the relative coordinates to obtain an absolute coordinate correction value.
[0058] Please see Figure 6 In some embodiments, step S104 may include, but is not limited to, steps S601 to S604: Step S601: In the global relative coordinate system, calculate the first geometric distance from the target primitive to the adsorption reference point of each management level, and the second geometric distance from the adsorption reference point to the selected primitive in both directions. Step S602: Based on the pre-set adsorption weight level, first geometric distance and second geometric distance of the management level, the adsorption point is confirmed, and the target adsorption point is confirmed from multiple adsorption reference points. Step S603: Correct the relative coordinates of the target primitive based on the target adsorption point to obtain the relative coordinate correction amount; Step S604: Correct the absolute coordinates of the target primitive based on the relative coordinate correction amount to obtain the absolute coordinate correction value.
[0059] In step S601 of some embodiments, under the constructed global relative coordinate system, the first geometric distance from the target primitive to the adsorption reference points of each management level, and the second geometric distance from the adsorption reference points of each management level to the target primitive can be calculated bidirectionally. Specifically, based on the relative coordinates of the target primitive in the current interaction frame, the Euclidean distance from the relative coordinates to each adsorption reference point in the working area adsorption layer, primitive adsorption layer, pipeline node adsorption layer, and grid adsorption layer can be calculated to generate the first geometric distance. Simultaneously, based on the relative coordinates of each adsorption reference point in each management level as the center, the Euclidean distance from each adsorption reference point to the current relative coordinates of the target primitive can be calculated in reverse to generate the second geometric distance, thereby constructing a geometric detection field for peer-to-peer inspection.
[0060] This is to address the issues of unidirectional adsorption dead zones and movement direction blind spots that arise when multiple reference objects are intertwined in industrial configuration drawing scenarios. When large and small primitives coexist in the graphic editing area, if probing is performed outward from the edge of the large primitive, the detection boundary of the small primitive may be difficult to match and successfully adsorb due to the transformer's size potentially being much larger than the adsorption threshold. On the other hand, industrial drawing often requires precise movement. When a dragged primitive moves relative to a pipeline reference object, unidirectional detection can only capture the moment the moving object collides with the stationary object. If the two objects are mutually referenced and overlap in certain complex editing frames, the unidirectional detection line is prone to skipping certain key nodes, causing the adsorption function to frequently miss targets or fail during fine-tuning. By using bidirectional calculation, dragged primitives and static pipeline nodes can simultaneously probe each other, thus completely eliminating adsorption dead zones and enabling more stable adsorption.
[0061] In step S602 of some embodiments, adsorption point confirmation processing is performed based on the pre-set adsorption weight level of the management level, the first geometric distance, and the second geometric distance, and the target adsorption point is confirmed from multiple adsorption reference points. Specifically, the decreasing weight coefficients of the pre-configured working area adsorption layer, primitive adsorption layer, pipeline node adsorption layer, and grid adsorption layer can be retrieved. Generally, the adsorption reference point of the working area adsorption layer can be set to the highest adsorption weight, the adsorption reference point of the primitive adsorption layer can be set to a high adsorption weight, the adsorption reference point of the pipeline node adsorption layer can be set to a medium adsorption weight, and the adsorption reference point of the grid adsorption layer can be set to a low adsorption weight.
[0062] Then, using a scoring function, the weight coefficient of the corresponding adsorption level can be used as the numerator, and the sum of the corresponding first geometric distance, the second geometric distance, and the preset zero-prevention adjustment constant can be used as the denominator. The comprehensive score of each adsorption reference point can then be calculated through division scalar mapping. Subsequently, multiple comprehensive scores can be sorted in descending order and filtered, and the adsorption reference point with the highest comprehensive score can be identified as the target adsorption point.
[0063] This approach allows users to more accurately snap to and align target primitives with objects. In some embodiments, keyboard shortcuts or other triggering methods are also provided, allowing users to switch between different snapping reference points based on the target primitive's current position. This ensures that the target primitive snaps to the ideal snapping reference point at the desired management level.
[0064] In step S603 of some embodiments, the multidimensional coordinate space transformation model is used to correct the relative coordinates of the target primitive based on the target adsorption point, thereby obtaining the relative coordinate correction amount. Specifically, once the target adsorption point is determined, it can be assumed that the position of the target primitive will be adsorbed onto the target adsorption point. Therefore, the relative coordinates of the target primitive can be corrected based on the position of the target adsorption point to obtain the relative coordinate correction amount.
[0065] In step S604 of some embodiments, the absolute coordinates of the target graphic element are corrected based on the relative coordinate correction amount to obtain the absolute coordinate correction value. Specifically, based on the relative coordinate correction amount, the absolute coordinates of the target graphic element can be corrected in reverse to obtain the position of the target graphic element in the graphics editing area and obtain the absolute coordinate correction value. This can smooth out the physical errors caused by mouse hand tremors and avoid the effects of misalignment and drift caused by translation and scaling.
[0066] In step S105 of some embodiments, in response to an operation event indicating that the target graphic element is no longer being dragged, the target position of the target graphic element is determined based on the absolute coordinate correction value, thereby determining the position of the target graphic element in the graphics editing area.
[0067] Please see Figure 7 In some embodiments, step 105 may include, but is not limited to, steps S701 to S702: Step S701: Based on the absolute coordinate correction value and the absolute coordinates of the target graphic element, display dashed auxiliary lines on the graphic editing area; wherein, the dashed auxiliary lines point from the absolute coordinates of the target graphic element to the position represented by the absolute coordinate correction value, and the dashed auxiliary lines are set with different styles, the styles of the dashed auxiliary lines corresponding to different management levels; Step S702: In response to the operation event indicating that the target graphic element is no longer being dragged, the position of the target graphic element is determined based on the absolute coordinate correction value.
[0068] In step S701 of some embodiments, a viewport space reverse mapping process is performed based on the absolute coordinate correction value and the absolute coordinates of the target primitive, and a dashed auxiliary line is rendered and displayed on the graphics editing area. Specifically, the dashed auxiliary line points from the absolute coordinates of the target primitive to the position represented by the absolute coordinate correction value, and the dashed auxiliary line has various preset line styles and specific level color styles.
[0069] By reading the management level code of the target adsorption point, the work area adsorption layer, primitive adsorption layer, pipeline node adsorption layer and mesh adsorption layer are mapped to the corresponding specific level color and line type, and dashed auxiliary lines representing the style of the management level are rendered in the viewport coordinate system, thereby providing operators with intuitive and quantifiable dynamic alignment visual feedback.
[0070] In step S702 of some embodiments, in response to an operation event indicating that the target graphic element is no longer being dragged, the target position of the target graphic element is determined and fixed based on the absolute coordinate correction value, and the absolute coordinate correction value is sent to the underlying canvas as the final physical storage data, thereby determining the position of the target graphic element in the graphic editing area, and simultaneously hiding and clearing the dashed auxiliary line displayed on the graphic editing area.
[0071] Through steps S701 to S702, this solution utilizes preset dotted auxiliary line styles for different management levels to provide intuitive visual feedback on the microscopic adsorption status on the display panel.
[0072] This application embodiment acquires operation events in the graphics editing area and the current viewport translation and scaling of the graphics editing area; in response to an operation event indicating that a target graphic element is dragged, it acquires the viewport coordinates of the mouse and determines the absolute coordinates of the target graphic element in the graphics editing area based on the viewport coordinates, viewport translation, and scaling; it constructs a global relative coordinate system based on the absolute coordinates of the target graphic element and the position information of a preset snapping reference point in the graphics editing area to obtain the relative coordinates of the corresponding target graphic element; it corrects the absolute coordinates of the target graphic element based on the relative coordinates to obtain the absolute coordinate correction value; in response to an operation event indicating that the target graphic element is no longer dragged, it determines the target position of the target graphic element based on the absolute coordinate correction value. Therefore, this application collects the mouse viewport coordinates in real time during each frame of user dragging and converts them into the absolute coordinates of the target primitive. Then, it projects the absolute coordinates and the positions of the reference points of each layer onto the global relative coordinate system for geometric distance comparison, avoiding the influence of spatial distortion caused by translation and scaling. After determining the relative offset, it returns to correct the position of the target primitive. Since the final position of the target primitive is obtained through relative coordinates, it can avoid the influence of misalignment and drift caused by translation and scaling, thus achieving higher accuracy of snap-in alignment.
[0073] Please see Figure 8 This application also provides an industrial configuration graphic editing device that can implement the above-described industrial configuration graphic editing method. The device includes: The editing response module is used to obtain operation events in the graphics editing area and the current viewport translation and zoom level of the graphics editing area. The coordinate correction module is used to respond to operation events indicating that a target graphic element is dragged, obtain the viewport coordinates of the mouse, and determine the absolute coordinates of the target graphic element in the graphics editing area based on the viewport coordinates, viewport translation amount, and zoom ratio; construct a global relative coordinate system based on the absolute coordinates of the target graphic element and the position information of the preset snapping reference point in the graphics editing area to obtain the relative coordinates of the corresponding target graphic element; and correct the absolute coordinates of the target graphic element based on the relative coordinates to obtain the absolute coordinate correction value. The position determination module is used to determine the target position of the target graphic element based on the absolute coordinate correction value in response to an operation event indicating that the target graphic element is no longer being dragged.
[0074] The specific implementation of this industrial configuration graphic editing device is basically the same as the specific embodiment of the above-described industrial configuration graphic editing method, and will not be repeated here.
[0075] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described industrial configuration graphics editing method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0076] Please see Figure 9 , Figure 9 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes: The processor 901 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application. The memory 902 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 902 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 902 and is called and executed by the processor 901 using the industrial configuration graphics editing method of the embodiments of this application. The 903 input / output interface is used to implement information input and output. The communication interface 904 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.). Bus 905 transmits information between various components of the device (e.g., processor 901, memory 902, input / output interface 903, and communication interface 904); The processor 901, memory 902, input / output interface 903, and communication interface 904 are connected to each other within the device via bus 905.
[0077] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described industrial configuration graphic editing method.
[0078] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0079] The industrial configuration graphic editing method, apparatus, electronic device, and storage medium provided in this application embodiment acquire operation events of the graphic editing area and the current viewport translation and scaling of the graphic editing area; in response to an operation event indicating that a target graphic element is dragged, the viewport coordinates of the mouse are acquired, and the absolute coordinates of the target graphic element in the graphic editing area are determined based on the viewport coordinates, viewport translation, and scaling; a global relative coordinate system is constructed based on the absolute coordinates of the target graphic element and the position information of a preset snap-in reference point in the graphic editing area to obtain the relative coordinates of the corresponding target graphic element; the absolute coordinates of the target graphic element are corrected based on the relative coordinates to obtain an absolute coordinate correction value; in response to an operation event indicating that the target graphic element is no longer dragged, the target position of the target graphic element is determined based on the absolute coordinate correction value. Therefore, this application collects the mouse viewport coordinates in real time during each frame of user dragging and converts them into the absolute coordinates of the target primitive. Then, it projects the absolute coordinates and the positions of the reference points of each layer onto the global relative coordinate system for geometric distance comparison, avoiding the influence of spatial distortion caused by translation and scaling. After determining the relative offset, it returns to correct the position of the target primitive. Since the final position of the target primitive is obtained through relative coordinates, it can avoid the influence of misalignment and drift caused by translation and scaling, thus achieving higher accuracy of snap-in alignment.
[0080] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0081] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0082] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0083] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0084] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. 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 apparatus that comprises 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 such processes, methods, products, or apparatus.
[0085] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0086] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. The coupling or direct coupling or communication connection between the shown or discussed units may be through some interfaces, or indirect coupling or communication connection between the apparatus or units, and may be electrical, mechanical, or other forms.
[0087] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0088] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0089] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0090] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. An industrial configuration graphic editing method, characterized in that, The method includes: Obtain the operation events of the graphics editing area and the current viewport translation and scaling of the graphics editing area; In response to the operation event indicating that the target graphic element is dragged, the viewport coordinates of the mouse are obtained, and the absolute coordinates of the target graphic element in the graphics editing area are determined based on the viewport coordinates, the viewport translation amount, and the scaling ratio. A global relative coordinate system is constructed based on the absolute coordinates of the target graphic element and the position information of the preset adsorption reference point in the graphic editing area to obtain the relative coordinates of the target graphic element. The absolute coordinates of the target graphic element are corrected based on the relative coordinates to obtain the absolute coordinate correction value; In response to the operation event indicating that the target element is no longer being dragged, the target position of the target element is determined based on the absolute coordinate correction value.
2. The method according to claim 1, characterized in that, The graphic editing area is provided with several management levels, including a work area snapping layer, a primitive snapping layer, a pipeline node snapping layer and a grid snapping layer. Each management level is provided with a cache pool to store the position information of the snapping reference point of the corresponding management level in the relative coordinate system. The step of constructing a global relative coordinate system based on the absolute coordinates of the target graphic element and the position information of a preset snap-in reference point within the graphic editing area to obtain the relative coordinates corresponding to the target graphic element includes: Based on the event type of the operation event, the buffer pools corresponding to the work area adsorption layer, the primitive adsorption layer, the pipeline node adsorption layer and the grid adsorption layer are subjected to dirty marking status evaluation processing. In response to the cache pool being marked as invalid, the corresponding cache pool is repositioned according to relative coordinates, and the position information of the corresponding adsorption reference point in the relative coordinate system is updated. In response to the cache pool being marked as not invalid, a global relative coordinate system is constructed based on the position information of the adsorption reference point in the cache pool and the absolute coordinates of the target primitive, thereby obtaining the relative coordinates of the target primitive.
3. The method according to claim 2, characterized in that, The response to the operation event indicating that the target primitive is dragged, based on the event type of the operation event, performs dirty marking status assessment processing on the buffer pools corresponding to the work area snapping layer, the primitive snapping layer, the pipeline node snapping layer, and the mesh snapping layer, respectively, including: In response to a change in the size of the work area of the graphics editing area, the cache pool corresponding to the work area adsorption layer is marked as invalid. In response to the addition, deletion or movement of other graphic elements in the graphic editing area, the cache pool corresponding to the graphic element snapping layer is marked as invalid. In response to the canvas scaling action of the graphics editing area, the cache pools corresponding to all management levels are marked as invalid.
4. The method according to claim 2, characterized in that, The step of correcting the absolute coordinates of the target primitive based on the relative coordinates to obtain an absolute coordinate correction value includes: In the global relative coordinate system, the first geometric distance from the target primitive to the adsorption reference point of each management level and the second geometric distance from the adsorption reference point to the selected primitive are calculated bidirectionally. Adsorption points are confirmed based on the pre-set adsorption weight level of the management level, the first geometric distance, and the second geometric distance, and the target adsorption point is confirmed from multiple adsorption reference points; The relative coordinates of the target primitive are corrected based on the target adsorption point to obtain the relative coordinate correction amount; The absolute coordinates of the target primitive are corrected based on the relative coordinate correction amount to obtain the absolute coordinate correction value.
5. The method according to claim 4, characterized in that, The response to the operation event indicating that the target feature is no longer being dragged, and the determination of the target position of the target feature based on the absolute coordinate correction value, includes: Based on the absolute coordinate correction value and the absolute coordinates of the target graphic element, a dashed auxiliary line is displayed on the graphics editing area; wherein the dashed auxiliary line points from the absolute coordinates of the target graphic element to the position represented by the absolute coordinate correction value, and the dashed auxiliary line is set with different styles, the styles of the dashed auxiliary line corresponding to different management levels; In response to the operation event indicating that the target graphic element is no longer being dragged, the position of the target graphic element is determined based on the absolute coordinate correction value.
6. The method according to claim 1, characterized in that, The response to the operation event indicating that the target graphic element is dragged involves obtaining the viewport coordinates of the mouse and determining the absolute coordinates of the target graphic element in the graphics editing area based on the viewport coordinates, the viewport translation amount, and the scaling ratio. Specifically, this includes: The horizontal component of the absolute coordinates of the target primitive is determined based on the horizontal component of the viewport coordinates, the horizontal translation amount in the viewport translation, and the scaling ratio. The vertical component of the absolute coordinates of the target primitive is determined based on the vertical component of the viewport coordinates, the vertical translation amount in the viewport translation amount, and the scaling ratio.
7. The method according to claim 1, characterized in that, The step of constructing a global relative coordinate system based on the absolute coordinates of the target graphic element and the position information of a preset snap-in reference point within the graphic editing area to obtain the relative coordinates corresponding to the target graphic element further includes: The horizontal component of the relative coordinates is obtained by subtracting and reducing the horizontal component of the absolute coordinates from the horizontal translation of the viewport translation. The vertical component of the relative coordinates is obtained by subtracting and reducing the vertical component of the absolute coordinates from the vertical translation of the viewport translation.
8. An industrial configuration graphic editing device, characterized in that, The device includes: The editing response module is used to obtain operation events in the graphics editing area and the current viewport translation and scaling of the graphics editing area; The coordinate correction module is used to respond to the operation event indicating that the target graphic element is dragged, obtain the viewport coordinates of the mouse, and determine the absolute coordinates of the target graphic element in the graphics editing area based on the viewport coordinates, the viewport translation amount, and the scaling ratio; construct a global relative coordinate system based on the absolute coordinates of the target graphic element and the position information of a preset snapping reference point in the graphics editing area to obtain the relative coordinates of the target graphic element; and correct the absolute coordinates of the target graphic element based on the relative coordinates to obtain an absolute coordinate correction value. The position determination module is used to determine the target position of the target graphic element based on the absolute coordinate correction value in response to the operation event indicating that the target graphic element is no longer being dragged.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the industrial configuration graphic editing method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the industrial configuration graphic editing method according to any one of claims 1 to 7.