A method for quickly locating a drawing element using an intermediate variable

By constructing an intermediate variable (grid) and associating it with the drawing elements, the problem of long modification time for drawing elements in existing technologies is solved, and the effect of quickly locating and modifying drawing elements is achieved.

CN116091642BActive Publication Date: 2026-03-20BEIJING DO GLOBAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-26
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

When users need to modify a large number of drawing elements, the existing technology results in a long modification process and a poor user experience because the number of elements in the data source is huge and they are not directly related to the closed path.

Method used

By constructing an intermediate variable (mesh), user-drawn elements are associated with closed paths. The relationship between the mesh and the elements is used to quickly obtain the unique identifier of the relevant elements, avoiding complete comparison and improving efficiency.

Benefits of technology

By using intermediate variables to quickly locate drawing elements, the time required for element comparison is reduced, improving the efficiency of the modification process and the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116091642B_ABST
    Figure CN116091642B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of drawing graphics, and discloses a method for quickly positioning drawing elements by using intermediate variables, constructing intermediate variables; a user draws elements, lets the elements be associated with corresponding intermediate variables, saves corresponding association information, inputs the information of a grid, obtains unique identifiers of corresponding relevant elements; connects the last point of a drawn graphic with the first point to form a closed path; lets the closed path be associated with the intermediate variables to obtain a plurality of elements associated with the closed path; compares the plurality of elements associated with the closed path with the closed path one by one to determine the elements that are truly intersected or contained; constructs an intermediate variable to convert the closed path randomly input by the user into a determined intermediate variable; and then uses the relationship between the intermediate variable and the elements constructed in advance to quickly obtain the unique identifiers of the relevant elements. The method avoids comparing completely irrelevant elements and improves efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of drawing graphics, in particular to a method for quickly positioning drawing elements by using intermediate variables. BACKGROUND

[0002] In real life, users write notes on a notebook to draw, and in software applications, the user's writing is converted into corresponding data. Each time the user touches the screen, the screen will collect a number of coordinates, and after processing and connecting these points, a curve is formed. All elements are collected in the data source, and adjustments such as adding, deleting, and modifying are made when needed. In this way, the user's writing can be recorded in data and displayed to the user at any time.

[0003] The data source is a memory space for storing elements, from which we can obtain the elements stored inside when needed.

[0004] When the user writes, a number of elements will be generated, which are added to the data source. When the user deletes elements, the elements are also deleted from the data source.

[0005] When modifying elements (such as modifying color or line width), the user draws a closed path on the screen to select the elements that the user wants to modify. Then all elements in the data source are compared with the closed path one by one. An element is considered to be selected if any of its points is contained in the closed path. Then the element is modified accordingly.

[0006] When modifying elements, all element data is obtained from the data source, and then compared with the closed path one by one to modify only the elements that intersect or contain the closed path.

[0007] Under the premise of a large amount of user writing, when modifying part of the elements, the number of elements in the data source is huge, and there is no direct correlation between the elements and the closed path. Each element needs to be compared, so the time consumption also increases. When the user needs to modify some elements, the experience is not good and a long wait is required. Therefore, we propose a method for quickly positioning drawing elements by using intermediate variables. SUMMARY

[0008] (I) Technical problems solved

[0009] In view of the deficiencies of the prior art, the present application provides a method for quickly positioning drawing elements by using intermediate variables, which solves the above problems.

[0010] (II) Technical solutions

[0011] To achieve the above-mentioned objectives, the present invention provides the following technical solution: a method for quickly locating drawing elements using intermediate variables, comprising the following steps:

[0012] Step 1: Construct intermediate variables;

[0013] Step 2: The user draws the elements, and the position and size of the elements are analyzed;

[0014] Step 3: Associate the elements with the corresponding intermediate variables, save the association information, input the grid information, and obtain the unique identifier of the corresponding related elements;

[0015] Step 4: Connect the last point of the drawn shape to the first point to form a closed path;

[0016] Step 5: Establish a connection between the closed path and the intermediate variables to obtain several elements associated with the closed path;

[0017] Step 6: Compare each element associated with the closed path with the closed path to determine the elements that actually intersect or are contained within it.

[0018] Preferably, the first step is as follows: simultaneously define several gwxgw grids, and lay them out along the upper left corner of the paper to obtain a flat grid plane, which is the intermediate variable.

[0019] Preferably, the third step is as follows:

[0020] S1: Compare the positions of all points, take the minimum value in the x-direction as min_x, the maximum value in the x-direction as max_x, the minimum value in the y-direction as min_y, and the maximum value in the y-direction as max_y.

[0021] The position and size of the minimum bounding rectangle of the element are (min_x, min_y);

[0022] (max_x-min_x, max_y-min_y)=(element_w, element_h);

[0023] S2: Compare the intermediate variables with the smallest bounding interval of the elements. The positions and sizes of the intermediate variables are known to be (square_x, square_y) and (square_w, square_h).

[0024] The smaller of element_x and square_x is taken as mix_x;

[0025] Take the smaller value between element_y and square_y as mix_y;

[0026] Take the larger value of element_maxx and square_x+square_w as mix_maxx;

[0027] Take the larger value of element_maxy and square_y+square_h as mix_maxy;

[0028] Get the position and size of the minimum enclosing rectangle of the closed path and the grid respectively: (mix_x, mix_y), (mix_maxx-min_x, min_maxy, min_y)=(minx_w, mix_h);

[0029] If (square_w+path_w)<=mix_w or (square_h+path_h)<=mix_h, consider that the grid intersects or contains the element, that is, the grid and the element have relevance.

[0030] Preferably, the user draws a closed path, compares all elements in the data source with the path, and if at least one point of the element's constituent points is contained in the closed path, considers that the element is the element that the user wants to modify.

[0031] Preferably, when the user draws a closed path, its position and size are determined, so the grid intersected or contained by the closed path can also be determined as the element that the user wants to modify.

[0032] Preferably, the specific content of the fifth step is:

[0033] S1: Knowing all points of the closed path, traverse each point, get the minimum value in the x direction as the position in the x direction path_minx; the maximum point in the x direction path_maxx, get the minimum point in the y direction path_miny;

[0034] the maximum point in the y direction path_maxy;

[0035] The position of the closed path is: (path_minx, path_miny)=(path_x, path_y);

[0036] The size of the closed path is: (path_maxx-path_minx, path_maxy-path_miny)=(path_w, path_h);

[0037] S2: Compare the intermediate variable with the closed path, knowing the position and size of the intermediate variable respectively: (square_x, square_y), (square_w, square_h);

[0038] Take the smaller value of path_x and square_x as mix_x;

[0039] Take the smaller value of path_y and square_y as mix_y;

[0040] Take the larger value of path_maxx and square_x+square_w as mix_maxx;

[0041] Take the larger value of path_maxy and square_y+square_h as mix_maxy;

[0042] Get the minimum enclosing rectangle position size of the closed path and the grid respectively: (mix_x, mix_y), (mix_maxx-min_x, min_maxy, min_y)=(minx_w, mix_h);

[0043] If (square_w+path_w)<=mix_w or (square_h+path_h)<=mix_h, consider that the grid intersects or contains the closed path.

[0044] (Three) beneficial effects

[0045] Compared with the prior art, the present application provides a method for quickly positioning drawing elements by using intermediate variables, which has the following beneficial effects:

[0046] 1. The method for quickly positioning drawing elements by using intermediate variables, by constructing an intermediate variable (grid), the user randomly inputted closed path is converted into a determined intermediate variable (grid). Then the relationship between the intermediate variable (grid) and the elements constructed in advance is used to quickly obtain the relevant element unique identifier. Avoids comparing completely irrelevant elements, and improves the efficiency. BRIEF DESCRIPTION OF DRAWINGS

[0047] Figure 1 The grid and element schematic diagram of the present application;

[0048] Figure 2 The completely contained element schematic diagram of the drawn closed path;

[0049] Figure 3 The drawn closed path contains any point in the element schematic diagram;

[0050] Figure 4 The grid associated with the closed path schematic diagram;

[0051] Figure 5 The element and closed path comparison schematic diagram;

[0052] Figure 6 Flowchart of the present application. DETAILED DESCRIPTION

[0053] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present application.

[0054] Please refer to Figures 1-6 A method for quickly positioning drawing elements by using intermediate variables, comprising the following steps:

[0055] S1: Definition of elements, the user touches the screen, and the screen can collect a plurality of coordinates. After processing and connecting these points, a stroke (hereinafter referred to as an element) is formed. Each element contains the following elements:

[0056] Position and size, the position of which is represented by the coordinates of the upper left corner of the element. A smallest rectangle is found, which contains all the points in the element. The size of the smallest rectangle is the size of the element, and the upper left corner of the smallest rectangle is the position of the element. The position is recorded as (min_x, min_y), and the size is recorded as (w, h);

[0057] Unique identifier, used to distinguish elements and ensure the uniqueness of elements.

[0058] S2: Storage of elements

[0059] After the user generates an element, the element is stored in a data source. The data source is a place for storing these elements, and provides the following functions:

[0060] Responsible for storing the elements after the user generates the elements;

[0061] The corresponding element data can be obtained according to the unique identifier of the element;

[0062] The existing element data can be replaced according to the unique identifier of the element.

[0063] S3: Description of paper

[0064] In order to synchronize the writing effect of the user, we consider the screen as a paper with a size of nxm. Wherein n represents the width, and m represents the height. The content written by the user in the screen is limited in this range, and the content written beyond this range will not be visible.

[0065] S4: Intermediate variable (grid)

[0066] At the same time, define several gwxgw grids, which are tiled along the upper left corner of the paper. In this way, we construct a tiled grid plane which is aligned with the upper left corner of the paper.

[0067] In the following process, the user-drawn element and the closed path will be associated with the intermediate variables respectively, and the user-drawn element and the closed path are artificially associated.

[0068] After the element is generated, its size and position are determined. The grid intersected or contained by the element can also be determined.

[0069] The specific process is as follows:

[0070] The element is composed of a series of points, so when the element is generated, all the points are determined. Compare the positions of all the points, and take the minimum value in the x direction as min_x; the maximum value in the x direction as max_x; the minimum value in the y direction as min_y; and the maximum value in the y direction as max_y.

[0071] The position and size of the minimum bounding rectangle of the element are (min_x, min_y) and (max_x-min_x, max_y-min_y) = (element_w, element_h) respectively.

[0072] Compare the grid with the minimum bounding box of the element. The position and size of the grid are (square_x, square_y) and (square_w, square_h) respectively.

[0073] Take the smaller value of element_x and square_x as mix_x.

[0074] Take the smaller value of element_y and square_y as mix_y.

[0075] Take the larger value of element_maxx and square_x+square_w as mix_maxx.

[0076] Take the larger value of element_maxy and square_y+square_h as mix_maxy.

[0077] The position and size of the minimum bounding rectangle of the closed path and the grid are (mix_x, mix_y) and (mix_maxx-min_x, min_maxy, min_y) = (minx_w, mix_h) respectively.

[0078] If (square_w + path_w) <= mix_w or (square_h + path_h) <= mix_h, the grid is considered to intersect or contain the element, i.e. the grid has a relationship with the element.

[0079] Where 01, 02, 03, 11, 12, 13 are the grid numbers, element_id_1 is the unique identifier of the user-drawn element, refer to Figure 1 .

[0080] In this way, the element has the following relationship with the grid we defined:

[0081] The unique identifier of the element related to the 01 grid: element_id_1

[0082] The unique identifier of the element related to the 02 grid: element_id_1

[0083] The unique identifier of the element related to the 03 grid: element_id_1

[0084] The unique identifier of the element related to the 11 grid: element_id_1

[0085] The unique identifier of the element related to the 12 grid: element_id_1

[0086] The unique identifier of the element related to the 13 grid: element_id_1

[0087] After conversion, the element has a relationship with the grid. Save this correspondence, and as long as the grid information is input, the unique identifier of the corresponding related element can be obtained. Next, only need to associate the user-drawn closed path with the grid.

[0088] S5: Closed path

[0089] Like the element, the closed path is also composed of points collected by the screen, the difference is that the closed path needs to connect the last point with the first point, so as to form a closed curve, i.e. the closed path.

[0090] The user draws a closed path, and compares all elements in the data source with the path. If at least one point of the element's constituent points is contained in the closed path, it is considered that this element is the element that the user wants to modify, refer to Figure 2 .

[0091] After the user draws a closed path, its position and size are determined. Therefore, the grid intersected or contained by the closed path can also be determined.

[0092] How a closed path relates to intermediate variables:

[0093] Given all points of a closed path, iterate through each point and obtain the minimum value in the x-direction as its position in the x-direction: path_minx; the maximum value in the x-direction: path_maxx; the minimum value in the y-direction: path_miny; and the maximum value in the y-direction: path_maxy.

[0094] The location of the closed path is: (path_minx, path_miny) = (path_x, path_y);

[0095] The size of the closed path is: (path_maxx-path_minx, path_maxy-path_miny) = (path_w, path_h).

[0096] Next, the grid is compared with the closed path. The known grid positions and sizes are (square_x, square_y) and (square_w, square_h).

[0097] The smaller of path_x and square_x is taken as mix_x;

[0098] Take the smaller value between path_y and square_y as mix_y;

[0099] The larger of path_maxx and square_x + square_w is taken as mix_maxx;

[0100] The larger of path_maxy and square_y + square_h is taken as mix_maxy;

[0101] The minimum bounding rectangle positions of the closed path and the grid are obtained as follows: (mix_x, mix_y), (mix_maxx-min_x, min_maxy, min_y) = (minx_w, mix_h);

[0102] If (square_w + path_w) <= mix_w or (square_h + path_h) <= mix_h, then the grid is considered to intersect or contain the closed path.

[0103] S6: Based on the closed path, the associated mesh can be determined. Then, based on the mesh information, a series of unique identifiers for the elements can be obtained. In this way, by constructing a mesh, we associate closed paths with unique element identifiers, thus obtaining the unique identifiers of several elements associated with a closed path. (See [link to relevant documentation]). Figure 4 .

[0104] S7: Obtain the elements associated with the closed path and then compare these elements one by one with the closed path to determine which elements are truly intersected or contained, see Figure 5 .

[0105] While embodiments of the application have been shown and described, it is to be understood that the application is not limited to the details of the embodiments described, since numerous changes, modifications, substitutions and alterations can be made thereto without departing from the spirit and scope of the application as defined by the appended claims and their equivalents.

Claims

1. A method for quickly locating drawing elements using intermediate variables, characterized in that, Includes the following steps: Step 1: Construct intermediate variables; Step 2: User draws the elements; Step 3: Associate the elements with the corresponding intermediate variables, save the association information, input the grid information, and obtain the unique identifier of the corresponding related elements; Step 4: Connect the last point of the drawn shape to the first point to form a closed path; Step 5: Establish a connection between the closed path and the intermediate variables to obtain several elements associated with the closed path; Step 6: Compare each element associated with the closed path with the closed path to determine the elements that actually intersect or are contained within it. The first step involves defining several gwxgw grids simultaneously, tiling them out along the top left corner of the paper to obtain a tiling grid plane, which serves as the intermediate variable. S1: Compare the positions of all points, take the minimum value in the x-direction as min_x, the maximum value in the x-direction as max_x, the minimum value in the y-direction as min_y, and the maximum value in the y-direction as max_y. The position and size of the minimum bounding rectangle of the element are (min_x, min_y); (max_x-min_x, max_y-min_y)=(element_w, element_h); S2: Compare the intermediate variables with the smallest bounding interval of the elements. The positions and sizes of the intermediate variables are known to be (square_x, square_y) and (square_w, square_h). The smaller of element_x and square_x is taken as mix_x; Take the smaller value between element_y and square_y as mix_y; The larger of element_maxx and square_x + square_w is taken as mix_maxx; The larger of element_maxy and square_y + square_h is taken as mix_maxy; The minimum bounding rectangle positions of the closed path and the grid are obtained as follows: (mix_x, mix_y), (mix_maxx-min_x, min_maxy, min_y)=(minx_w, mix_h); If (square_w + path_w) <= mix_w or (square_h + path_h) <= mix_h, then the grid is considered to intersect or contain the elements, that is, the grid and the elements are related. The specific details of step five are as follows: S1: Given all points of a closed path, traverse each point and obtain the minimum value in the x-direction as the position path_minx in the x-direction; the maximum point in the x-direction is path_maxx, and the minimum point in the y-direction is path_miny; The maximum value of path_maxy in the y-direction; The location of the closed path is: (path_minx, path_miny) = (path_x, path_y); The size of the closed path is: (path_maxx - path_minx, path_maxy - path_miny) = (path_w, path_h); S2: Compare the intermediate variables with the closed path. The positions and sizes of the intermediate variables are known to be (square_x, square_y) and (square_w, square_h). The smaller of path_x and square_x is taken as mix_x; Take the smaller value between path_y and square_y as mix_y; The larger of path_maxx and square_x + square_w is taken as mix_maxx; The larger of path_maxy and square_y + square_h is taken as mix_maxy; The minimum bounding rectangle positions of the closed path and the grid are obtained as follows: (mix_x, mix_y), (mix_maxx-min_x, min_maxy, min_y)=(minx_w, mix_h); If (square_w + path_w) <= mix_w or (square_h + path_h) <= mix_h, then the grid is considered to intersect or contain the closed path.

2. The method for quickly locating drawing elements using intermediate variables according to claim 1, characterized in that: The user draws a closed path, and all elements in the data source are compared with the path. If at least one of the constituent points of an element is contained in the closed path, then the element is considered to be the element that the user wants to modify.

3. The method for quickly locating drawing elements using intermediate variables according to claim 1, characterized in that: Once a user draws a closed path, its position and size are fixed. Therefore, the grids that intersect or contain the closed path can also be identified as the elements the user wants to modify.

Citation Information

Patent Citations

  • Data display method and device, computer equipment and storage medium

    CN112612989A

  • Point position schematic diagram drawing system based on android platform

    CN112799583A