A vector capture method
Through the vector entity cache module and spatial index technology, the automation of vector capture in the GIS system is realized, which solves the problem of low vector capture efficiency and quality in the existing technology and improves the work efficiency and quality of mappers.
Patent Information
- Application Number
- CN202110950175.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-18
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-08-18
AI Technical Summary
The existing GIS vector data editing system requires human operation during the vector capture process, which affects the work efficiency and quality of mappers.
Using the vector entity cache module, it automatically determines and displays capture type icons by building layer cache units and spatial indexing technology, enabling vector capture to be completed with mouse clicks or keyboard operations, improving capture efficiency and quality.
It improves the work efficiency and quality of draftsmen in the vector drawing and editing process, simplifies the vector capture process, and reduces manual steps.
Smart Images

Figure CN113721802B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of surveying and mapping technology, and in particular to a vector capturing method. Background Art
[0002] One of the important functions of GIS mapping software is the drawing and database construction of vector elements. The collection of vector elements can be generated through 3D model data, key points (fragmentary points) marked by total station, orthophotos, etc., to generate DLG, i.e. digital line map. These vector elements usually need to meet certain topological relationships with each other, such as the vector elements of the main body of a farmhouse and the vector elements of the wall must be connected (i.e. one end of the wall must be close to the wall of the house). In order to meet these topological relationships, the vector capture function must be provided in the process of drawing or editing vector elements.
[0003] At present, the Chinese invention patent application with publication number CN112100296A specifically discloses a GIS system that is convenient for GIS vector data editing. The GIS system directly collects, draws and edits graphics based on GIS data standards, thereby saving time and process steps for data production while ensuring data quality. However, the system requires manual actual capture operations when performing vector capture, which greatly affects the work efficiency and quality of cartographers. Summary of the invention
[0004] In order to solve at least one of the above technical defects, the present invention provides a vector capture method to realize the vector capture function and improve the work efficiency and quality of the draftsman.
[0005] In order to solve the above technical problems, the technical solution of the present invention is as follows:
[0006] A vector capture method comprises the following steps:
[0007] S1: construct a vector entity cache module, including several layer cache units bound to the corresponding layers of the project;
[0008] S2: Get the vector capture range, vector capture point type and capture type;
[0009] S3: Calculate the rectangular geographic extent based on the vector capture extent;
[0010] S4: Select a layer in the project and determine the validity of the layer. If yes, execute step S5. Otherwise, reselect the next unprocessed layer in the project and re-execute step S4.
[0011] S5: Determine whether the range of the layer corresponding to the layer cache unit intersects with the rectangular geographic range. If so, execute step S6; otherwise, reselect the layer of the project and return to execute step S4;
[0012] S6: Obtain a set of all vector entities in the layer cache unit that intersect with the rectangular geographic range, process the entities in the vector entity set one by one according to the vector capture point type, and obtain the nearest vertex or the nearest edge;
[0013] S7: Determine the best capture point based on the capture type and complete the capture of the vector entity.
[0014] The above scheme is mainly used in GIS mapping software related to the surveying and mapping industry. When the user uses this method, during the vector drawing or editing process, when the operating mouse is close to the drawn vector entity, the corresponding capture type icon will be automatically displayed. Only by clicking the mouse or keyboard can the required type be captured, which effectively improves the work efficiency and quality of the draftsman.
[0015] In the above scheme, the implementation of the vector capture method depends on the captured vector entity cache module. Since conventional GIS software uses layers to manage and divide vector entities, the vector entity cache module contains multiple layer cache units, which are managed and divided based on the unique id of the layer as a keyword (this id can be the name of the layer, index number, etc.). Cartographers sometimes only want to capture vector entities of a specific layer. In this way, they only need to capture the vector entities in the cache unit of the specific layer, which can effectively speed up the capture efficiency.
[0016] Wherein, the step S1 specifically includes the following steps:
[0017] S11: Get a layer in the project;
[0018] S12: Initialize the layer cache unit, initialize the spatial index object of the layer cache unit (the structure of the R-tree algorithm), and bind the layer cache unit with the layer ID as the keyword;
[0019] S13: Obtain a drawn vector entity in the layer, obtain the geometric data therein (the vector entity of GIS usually includes geometric data and attribute data), calculate the size of the rectangular geographic range of the geometry, and add the rectangular range, geometry and FID of the vector entity to the spatial index object in the layer cache unit;
[0020] S14: reacquire another vector entity in the layer, and repeat step S13 until all vector entities in the layer are processed. After completion, the rectangular geographic range of the calculation layer cache unit is updated according to the rectangular range of each vector entity in the layer so as to include all vector entities in the layer, and then step S15 is executed;
[0021] S15: Get another layer in the project, return to step S12, and finish the construction until all layers in the project have completed the corresponding initialization and binding of layer cache units.
[0022] Among them, in step S6, the process of obtaining the vector entity set is specifically: using the rectangular geographic range as an index, using the spatial index object in the layer cache unit to obtain the set of all vector entities whose rectangular ranges of all cached vector entities intersect with the rectangular geographic range.
[0023] Wherein, in step S2, the vector capture point types include nodes, endpoints, intersection points, perpendicular feet, closest points and midpoints, wherein when the vector capture point type is a node or endpoint type, it belongs to the vertex category of the vector entity; when the vector capture point type is a midpoint, intersection point, perpendicular foot or closest point type, it belongs to the edge category of the vector entity.
[0024] Wherein, in step S6, the process of obtaining the nearest vertex is specifically as follows:
[0025] A1: Select a vector entity from the vector entity set;
[0026] A2: Based on the geometric data of the vector entity, find the geographic coordinates corresponding to the midpoint of the rectangular geographic range and the nearest vertex in the geometry, calculate the Euclidean distance between the vertex and the geographic coordinates and record it;
[0027] A3: Reselect another vector entity in the vector entity set and calculate its Euclidean distance; if the Euclidean distance is within the vector capture range and smaller than the recorded distance, record it as the nearest vertex;
[0028] A4: Repeat step A3 until all vector entities in the vector entity set are calculated and the nearest vertex is obtained.
[0029] Wherein, in step S6, the process of obtaining the nearest edge is specifically as follows:
[0030] B1: Select a vector entity from the vector entity set;
[0031] B2: Based on the geometric data of the vector entity, find the geographic coordinates corresponding to the midpoint of the rectangular geographic range and the closest edge among all the edges in the geometry, and calculate the Euclidean distance between this edge and the geographic coordinates;
[0032] B3: If the Euclidean distance is within the vector capture range, the capture point on this edge is obtained according to the vector capture point type, and the Euclidean distance between the capture point and the geographic coordinates corresponding to the midpoint of the rectangular geographic range is calculated and recorded;
[0033] B4: Reselect another vector entity in the vector entity set, calculate the Euclidean distance of the corresponding snap point, and if the distance is less than the recorded distance, take it as the nearest edge, and record the nearest edge and the snap point corresponding to the edge;
[0034] B5: Repeat step B4 until all vector entities in the vector entity set are calculated, and the nearest edge and the capture point corresponding to the nearest edge are obtained.
[0035] Wherein, in the step S2, the capture type includes a single capture type and multiple capture types;
[0036] In step S7, when a single capture type is selected, the capture point type is judged. If it belongs to the vector vertex category, the Euclidean distance between the geographical coordinates corresponding to the nearest vertex and the midpoint of the rectangular geographic range is calculated and compared. If it belongs to the vector edge category, the Euclidean distance between the capture point corresponding to the nearest edge and the geographical coordinates corresponding to the midpoint of the rectangular geographic range is calculated and compared.
[0037] In step S7, when multiple capture types are selected, the priorities of different vector capture point types are set, and the nearest vertex and the nearest edge are stored in the vector vertex category set and the vector edge category set respectively. According to the set priority, the best capture point is determined in the category set with a high priority; if the category set with a high priority is empty, the priority is degraded and the best capture point is determined in the corresponding category set.
[0038] When a vector entity is drawn in the project layer, you need to enter the process of adding a vector entity, which is as follows:
[0039] According to the id of the layer where the vector entity is located, the corresponding layer cache unit is obtained from the captured vector entity cache total module;
[0040] Calculate the size of the rectangular geographic extent of the geometry in the vector entity, and add the rectangular extent, geometry and FID of the vector entity to the spatial index object in the layer cache unit;
[0041] If the rectangular geographic extent of the layer cache unit does not completely contain the rectangular geographic extent of the vector entity, the rectangular geographic extent of the layer cache unit is updated to completely contain it.
[0042] When a vector entity is deleted in the project layer, it is necessary to enter the vector entity deletion operation process, specifically:
[0043] According to the id of the layer where the vector entity is located, the corresponding layer cache unit is obtained from the captured vector entity cache total module;
[0044] According to the FID of the vector entity, delete the corresponding data (rectangular extent and geometry) from the spatial index object in the layer cache unit.
[0045] When a vector entity is edited in the engineering layer, the geometry changes and you need to enter the vector entity modification process, which is as follows:
[0046] According to the id of the layer where the vector entity is located, the corresponding layer cache unit is obtained from the captured vector entity cache total module;
[0047] Calculate the size of the rectangular geographic extent of the geometry in the vector entity, and update the corresponding data (rectangular extent and geometry) from the spatial index object in the layer cache unit according to the FID of the vector entity;
[0048] If the rectangular geographic extent of the layer cache unit does not completely contain the rectangular geographic extent of the vector entity, the rectangular geographic extent of the layer cache unit is updated to completely contain it.
[0049] In the above scheme, the layer cache unit is the core of the capture function operation, which supports the addition, deletion and modification of vector entities. When capturing, the captured points (such as endpoints, perpendicular feet, etc.) must meet the set capture range to be valid. For example, if the capture range is set to 10 pixels, then the screen pixel position of the captured point and the current mouse position are within 10 pixels. In this case, the point is required and valid. Points outside the range will be ignored. The FID (general definition of GIS) of the vector entity is used as the keyword for the addition, deletion and modification operations in the layer cache unit.
[0050] According to the above method, secondary development can be carried out on GIS mapping software related to the surveying and mapping industry, and the vector capture method can be applied to related software, aiming to quickly and effectively realize the vector capture function, allowing users to turn on or off the capture function and set the specified capture type (such as perpendicular foot, intersection, etc.). When the user turns on the capture function, during the vector drawing or editing process, when the operating mouse is close to the drawn vector entity, the corresponding capture type icon will be automatically displayed. At this time, you only need to click the mouse or keyboard to capture the required type.
[0051] This method uses spatial indexing technology (using the R-tree algorithm). After the software is started, it will automatically build a total module of captured vector entity cache offline. When the user adds, deletes, or changes a vector entity, the layer buffer unit corresponding to the vector entity will be updated synchronously to achieve a quick and timely response to the user's capture operation and meet the requirements of correctness.
[0052] In the above scheme, two processing methods are adopted for capturing in different scene requirements: single capture type capture and mixed capture of multiple capture types. If a certain type of capture is specified, then the single capture type capture method will be used. If there are multiple points that meet the set capture range, the one closest to the current mouse point will be used as the best capture point. If the type of capture is not specified and the most suitable point is automatically obtained, then a mixed capture method of multiple capture types will be used. If multiple points of different capture types meet the capture range, the best capture point will be obtained based on the priority of the capture point type. If the same priority is used, the closest to the current mouse point will be used as the best capture point.
[0053] Compared with the prior art, the technical solution of the present invention has the following beneficial effects:
[0054] The present invention proposes a vector capture method, which is mainly used in GIS mapping software related to the mapping industry. When the user uses this method, during the vector drawing or editing process, when the operating mouse is close to the drawn vector entity, the corresponding capture type icon will be automatically displayed. The required type can be captured by simply clicking the mouse or keyboard, which effectively improves the work efficiency and quality of the draftsman. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 It is a schematic diagram of the process of the method of the present invention;
[0056] Figure 2 This is a flow chart of constructing the vector entity cache master module of the present invention;
[0057] Figure 3 It is a structural schematic diagram of the vector entity cache total module of the present invention;
[0058] Figure 4 Schematic diagram of the process of obtaining the nearest vertex according to the present invention;
[0059] Figure 5 The figure is a schematic diagram of the process of obtaining the nearest edge according to the present invention. DETAILED DESCRIPTION
[0060] The drawings are for illustrative purposes only and should not be construed as limiting the present patent;
[0061] In order to better illustrate the present embodiment, some parts in the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product;
[0062] It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.
[0063] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0064] Example 1
[0065] like Figure 1 As shown, a vector capture method comprises the following steps:
[0066] S1: construct a vector entity cache module, including several layer cache units bound to the corresponding layers of the project;
[0067] S2: Get the vector capture range, vector capture point type and capture type;
[0068] S3: Calculate the rectangular geographic extent based on the vector capture extent;
[0069] S4: Select a layer in the project and determine the validity of the layer. If yes, execute step S5. Otherwise, reselect the next unprocessed layer in the project and re-execute step S4.
[0070] S5: Determine whether the range of the layer corresponding to the layer cache unit intersects with the rectangular geographic range. If so, execute step S6; otherwise, reselect the layer of the project and return to execute step S4;
[0071] S6: Obtain a set of all vector entities in the layer cache unit that intersect with the rectangular geographic range, process the entities in the vector entity set one by one according to the vector capture point type, and obtain the nearest vertex or the nearest edge;
[0072] S7: Determine the best capture point based on the capture type and complete the capture of the vector entity.
[0073] The above scheme is mainly used in GIS mapping software related to the surveying and mapping industry. When the user uses this method, during the vector drawing or editing process, when the operating mouse is close to the drawn vector entity, the corresponding capture type icon will be automatically displayed. Only by clicking the mouse or keyboard can the required type be captured, which effectively improves the work efficiency and quality of the draftsman.
[0074] Example 2
[0075] More specifically, Figure 2 As shown, the step S1 specifically includes the following steps:
[0076] S11: Get a layer in the project;
[0077] S12: Initialize the layer cache unit, initialize the spatial index object of the layer cache unit (the structure of the R-tree algorithm), and bind the layer cache unit with the layer ID as the keyword;
[0078] S13: Obtain a drawn vector entity in the layer, obtain the geometric data therein (the vector entity of GIS usually includes geometric data and attribute data), calculate the size of the rectangular geographic range of the geometry, and add the rectangular range, geometry and FID of the vector entity to the spatial index object in the layer cache unit;
[0079] S14: reacquire another vector entity in the layer, and repeat step S13 until all vector entities in the layer are processed. After completion, the rectangular geographic range of the calculation layer cache unit is updated according to the rectangular range of each vector entity in the layer so as to include all vector entities in the layer, and then step S15 is executed;
[0080] S15: Get another layer in the project, return to step S12, and finish the construction until all layers in the project have completed the corresponding initialization and binding of layer cache units.
[0081] In the specific implementation process, Figure 3 As shown in the figure, the implementation of the vector capture method depends on the captured vector entity cache module. Since conventional GIS software uses layers to manage and divide vector entities, the vector entity cache module contains multiple layer cache units, which are managed and divided based on the unique id of the layer as a keyword (this id can be the name of the layer, index number, etc.). Cartographers sometimes only want to capture vector entities of a specific layer. In this way, they only need to capture the vector entities in the cache unit of the specific layer, which can effectively speed up the capture efficiency.
[0082] In the specific implementation process, the layer cache unit is the core of the capture function operation, which supports the addition, deletion and modification of vector entities. When capturing, the captured points (such as endpoints, perpendicular feet, etc.) must meet the set capture range to be valid. For example, if the capture range is set to 10 pixels, then the screen pixel position of the captured point and the current mouse position are within 10 pixels. In this case, the point is required and valid. If it exceeds the range, it will be ignored. The FID (general definition of GIS) of the vector entity is used as the keyword for the addition, deletion and modification operations in the layer cache unit.
[0083] More specifically, in step S6, the process of obtaining the vector entity set is as follows: using the rectangular geographic range as an index, using the spatial index object in the layer cache unit to obtain the set of all vector entities whose rectangular ranges of all cached vector entities intersect with the rectangular geographic range.
[0084] More specifically, in step S2, the vector capture point types include nodes, endpoints, intersection points, feet of perpendiculars, closest points and midpoints, wherein when the vector capture point type is a node or endpoint type, it belongs to the vertex category of the vector entity; when the vector capture point type is a midpoint, intersection point, feet of perpendiculars or closest point type, it belongs to the edge category of the vector entity.
[0085] More specifically, in step S6, the process of obtaining the nearest vertex is as follows: Figure 4 As shown, specifically:
[0086] A1: Select a vector entity from the vector entity set;
[0087] A2: Based on the geometric data of the vector entity, find the geographic coordinates corresponding to the midpoint of the rectangular geographic range and the nearest vertex in the geometry, calculate the Euclidean distance between the vertex and the geographic coordinates and record it;
[0088] A3: Reselect another vector entity in the vector entity set and calculate its Euclidean distance; if the Euclidean distance is within the vector capture range and smaller than the recorded distance, record it as the nearest vertex;
[0089] A4: Repeat step A3 until all vector entities in the vector entity set are calculated and the nearest vertex is obtained.
[0090] More specifically, in step S6, the process of obtaining the nearest edge is as follows: Figure 5 As shown, specifically:
[0091] B1: Select a vector entity from the vector entity set;
[0092] B2: Based on the geometric data of the vector entity, find the geographic coordinates corresponding to the midpoint of the rectangular geographic range and the closest edge among all the edges in the geometry, and calculate the Euclidean distance between this edge and the geographic coordinates;
[0093] B3: If the Euclidean distance is within the vector capture range, the capture point on this edge is obtained according to the vector capture point type, and the Euclidean distance between the capture point and the geographic coordinates corresponding to the midpoint of the rectangular geographic range is calculated and recorded;
[0094] B4: Reselect another vector entity in the vector entity set, calculate the Euclidean distance of the corresponding snap point, and if the distance is less than the recorded distance, take it as the nearest edge, and record the nearest edge and the snap point corresponding to the edge;
[0095] B5: Repeat step B4 until all vector entities in the vector entity set are calculated, and the nearest edge and the capture point corresponding to the nearest edge are obtained.
[0096] More specifically, in the step S2, the capture type includes a single capture type and multiple capture types;
[0097] In step S7, when a single capture type is selected, the capture point type is judged. If it belongs to the vector vertex category, the Euclidean distance between the geographical coordinates corresponding to the nearest vertex and the midpoint of the rectangular geographic range is calculated and compared. If it belongs to the vector edge category, the Euclidean distance between the capture point corresponding to the nearest edge and the geographical coordinates corresponding to the midpoint of the rectangular geographic range is calculated and compared.
[0098] In step S7, when multiple capture types are selected, the priorities of different vector capture point types are set, and the nearest vertex and the nearest edge are stored in the vector vertex category set and the vector edge category set respectively. According to the set priority, the best capture point is determined in the category set with a high priority; if the category set with a high priority is empty, the priority is degraded and the best capture point is determined in the corresponding category set.
[0099] In the specific implementation process, the process of the single capture type is specifically as follows:
[0100] Step 1: According to the set vector capture range, take the current mouse point as the center and calculate the size of its rectangular geographic range;
[0101] Step 2: Get a layer of the project and determine whether the layer is valid (such as setting to capture only certain specific layers, or the current layer is not displayed, etc.). If it is invalid, repeat step 2 and then proceed to step 3.
[0102] Step 3: According to the layer ID, obtain the corresponding layer cache unit from the captured vector entity cache total module, and determine whether the rectangular geographic range of the layer cache unit intersects with the rectangular geographic range centered on the current mouse point (this is a quick judgment, non-intersection means that the vector entities in this cache module will not intersect with the rectangular geographic range centered on the mouse point). If they intersect, proceed to step 4, otherwise repeat step 2.
[0103] Step 4: Based on the rectangular geographic range centered on the current mouse point as the index, use the spatial index object in the layer cache module to find the set of all vector entities that intersect with the rectangular range of all cached vector entities (the rectangular range of the vector entity is one-to-one corresponding to the vector entity during construction).
[0104] Step 5: Take a vector entity from the vector entity set, and then perform corresponding processing according to the implementation method of the capture point type (such as Table 1). Enter step 6 based on the vertex method of the vector entity, and enter step 7 based on the edge method of the vector entity.
[0105] Step 6: Based on the geometric data of the vector entity, find the geographic coordinates corresponding to the current mouse point and the vertex closest to all vertices in this geometry, and calculate the Euclidean distance between this vertex and the geographic coordinates corresponding to the current mouse point. If this distance is within the capture range and is smaller than the currently recorded shortest distance, it is recorded as the current best capture point. Go to step 8.
[0106] Step 7: Based on the geometric data of the vector entity, find the geographical coordinates corresponding to the current mouse point and the nearest edge among all the edges in this geometry, and calculate the Euclidean distance between this edge and the geographical coordinates corresponding to the current mouse point. If this distance is within the capture range, use the two vertices or vector entities of this edge (for the intersection point type, it is also necessary to find the vector entity that intersects with this vector entity to find the intersection point) to find the capture point of the corresponding capture point type, and calculate the Euclidean distance between this capture point and the geographical coordinates corresponding to the current mouse point. If it is smaller than the shortest distance currently recorded, it is recorded as the current best capture point. Go to step 8.
[0107] Step 8: After all vector entities in the vector entity set are processed, proceed to step 9, otherwise repeat step 5.
[0108] Step 9: When all layers in the project are processed, the process ends and the best capture point is obtained. Otherwise, repeat step 2 if the processing is not complete.
[0109] In the specific implementation process, the process of the multiple capture types is specifically as follows:
[0110] Step 1: Based on the set capture range, calculate the size of the rectangular geographic range with the current mouse point as the center.
[0111] Step 2: Get a layer of the project and determine whether the layer is valid (for example, if it is set to capture only certain specific layers, or the current layer is not displayed, etc.). If it is invalid, repeat step 2 and then proceed to step 3.
[0112] Step 3: According to the layer ID, obtain the corresponding layer cache module from the captured vector entity cache total module, and determine whether the rectangular geographic range of the layer cache module intersects with the rectangular geographic range centered on the current mouse point (this is a quick judgment, non-intersection means that the vector entities in this cache module will not intersect with the rectangular geographic range centered on the mouse point). If they intersect, proceed to step 4, otherwise repeat step 2.
[0113] Step 4: Based on the rectangular geographic range centered on the current mouse point as the index, use the spatial index object in the layer cache module to find the set of all vector entities that intersect with the rectangular range of all cached vector entities (the rectangular range of the vector entity is one-to-one corresponding to the vector entity during construction).
[0114] Step 5: Take a vector entity from the vector entity set, and then perform corresponding processing according to the implementation method of the capture point type (such as Table 1). Enter step 6 based on the vertex method of the vector entity, and enter step 7 based on the edge method of the vector entity.
[0115] Step 6: Based on the geometric data of the vector entity, find the geographic coordinates corresponding to the current mouse point and the vertex closest to all vertices in this geometry, and calculate the Euclidean distance between this vertex and the geographic coordinates corresponding to the current mouse point. If this distance is within the capture range, record this vertex and its calculated Euclidean distance in the vector vertex category set. Go to step 8.
[0116] Step 7: Based on the geometric data of the vector entity, find the closest edge among all the edges in the geometry to the geographic coordinates corresponding to the current mouse point, and calculate the Euclidean distance between this edge and the geographic coordinates corresponding to the current mouse point. If this distance is within the capture range, record this edge, the vector entity and its calculated Euclidean distance into the vector edge category set. Go to step 8.
[0117] Step 8: After all vector entities in the vector entity set are processed, proceed to step 9, otherwise repeat step 5.
[0118] Step 9: If all layers in the project have been processed, proceed to step 10. If not, repeat step 2.
[0119] Step 10: Because different snap point types have different priorities (as shown in Table 1), the vector vertex category has a higher priority than the vector edge category. Therefore, if the vector vertex category set is not empty, the vertex with the smallest Euclidean distance is taken from the vector vertex category set as the best snap point. If it is empty, the edge or vector entity with the smallest Euclidean distance is taken from the vector edge category set (for the intersection point type, the vector entity that intersects with this vector entity is also required to find the intersection point), and then find the snap points corresponding to each snap point type respectively, and then find the one with the smallest Euclidean distance to the geographic coordinates corresponding to the current mouse point from these snap points as the best snap point.
[0120] Table 1 Description of snap point types
[0121]
[0122] More specifically, after a vector entity is drawn in the project layer, it is necessary to enter the vector entity adding process, which is as follows:
[0123] According to the id of the layer where the vector entity is located, the corresponding layer cache unit is obtained from the captured vector entity cache total module;
[0124] Calculate the size of the rectangular geographic extent of the geometry in the vector entity, and add the rectangular extent, geometry and FID of the vector entity to the spatial index object in the layer cache unit;
[0125] If the rectangular geographic extent of the layer cache unit does not completely contain the rectangular geographic extent of the vector entity, the rectangular geographic extent of the layer cache unit is updated to completely contain it.
[0126] More specifically, when a vector entity is deleted in the project layer, it is necessary to enter the vector entity deletion operation process, which is as follows:
[0127] According to the id of the layer where the vector entity is located, the corresponding layer cache unit is obtained from the captured vector entity cache total module;
[0128] According to the FID of the vector entity, delete the corresponding data (rectangular extent and geometry) from the spatial index object in the layer cache unit.
[0129] More specifically, when a vector entity is edited in the engineering layer, the geometry changes and you need to enter the vector entity modification process, which is as follows:
[0130] According to the id of the layer where the vector entity is located, the corresponding layer cache unit is obtained from the captured vector entity cache total module;
[0131] Calculate the size of the rectangular geographic extent of the geometry in the vector entity, and update the corresponding data (rectangular extent and geometry) from the spatial index object in the layer cache unit according to the FID of the vector entity;
[0132] If the rectangular geographic extent of the layer cache unit does not completely contain the rectangular geographic extent of the vector entity, the rectangular geographic extent of the layer cache unit is updated to completely contain it.
[0133] In the specific implementation process, the GIS mapping software related to the surveying and mapping industry can be secondary developed according to the above method, and the vector capture method can be applied to the relevant software (not described here), aiming to quickly and effectively realize the vector capture function, allowing the user to turn on or off the capture function and set the specified capture type (such as perpendicular foot, intersection, etc.). When the user turns on the capture function, during the vector drawing or editing process, when the operating mouse is close to the drawn vector entity, the corresponding capture type icon will be automatically displayed. At this time, you only need to click the mouse or keyboard to capture the required type.
[0134] This method uses spatial indexing technology (using the R-tree algorithm). After the software is started, it will automatically build a total module of captured vector entity cache offline. When the user adds, deletes, or changes a vector entity, the layer buffer unit corresponding to the vector entity will be updated synchronously to achieve a quick and timely response to the user's capture operation and meet the requirements of correctness.
[0135] In the specific implementation process, in response to the different scene requirements of capture, two processing methods are adopted for capture: single capture type capture and mixed capture of multiple capture types. If a certain type of capture is specified, then the single capture type capture method will be used for processing. If there are multiple points that meet the set capture range, the one closest to the current mouse point will be used as the best capture point; if the type of capture is not specified, and the most suitable point is automatically obtained, then a mixed capture method of multiple capture types will be used for processing. If multiple points of different capture types meet the capture range, the priority of the capture point type will be used as a criterion to obtain the best capture point. If the same priority is used, the closest to the current mouse point will be used as the best capture point.
[0136] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the embodiments here. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the claims of the present invention.
Claims
1. A vector capture method, characterized in that: The following steps are involved: S1: construct a vector entity cache module, including several layer cache units bound to the corresponding layers of the project; S2: Get the vector capture range, vector capture point type and capture type; S3: Calculate the rectangular geographic extent based on the vector capture extent; S4: Select a layer in the project and determine the validity of the layer. If yes, execute step S5. Otherwise, reselect the next unprocessed layer in the project and re-execute step S4. S5: Determine whether the range of the layer corresponding to the layer cache unit intersects with the rectangular geographic range. If so, execute step S6; otherwise, reselect the layer of the project and return to execute step S4; S6: Obtain a set of all vector entities in the layer cache unit that intersect with the rectangular geographic range, process the entities in the vector entity set one by one according to the vector capture point type, and obtain the nearest vertex or the nearest edge; wherein the process of obtaining the nearest vertex is specifically as follows: A1: Select a vector entity from the vector entity set; A2: Based on the geometric data of the vector entity, find the geographic coordinates corresponding to the midpoint of the rectangular geographic range and the nearest vertex in the geometry, calculate the Euclidean distance between the vertex and the geographic coordinates and record it; A3: Reselect another vector entity in the vector entity set and calculate its Euclidean distance; if the Euclidean distance is within the vector capture range and smaller than the recorded distance, record it as the nearest vertex; A4: Repeat step A3 until all vector entities in the vector entity set are calculated and the nearest vertex is obtained; The specific process of obtaining the nearest edge is: B1: Select a vector entity from the vector entity set; B2: Based on the geometric data of the vector entity, find the geographic coordinates corresponding to the midpoint of the rectangular geographic range and the closest edge among all the edges in the geometry, and calculate the Euclidean distance between this edge and the geographic coordinates; B3: If the Euclidean distance is within the vector capture range, the capture point on this edge is obtained according to the vector capture point type, and the Euclidean distance between the capture point and the geographic coordinates corresponding to the midpoint of the rectangular geographic range is calculated and recorded; B4: Reselect another vector entity in the vector entity set and calculate the Euclidean distance of the corresponding snap point. If the Euclidean distance is less than the recorded distance, the closest edge among all the edges in the vector entity geometry and the geographic coordinates corresponding to the midpoint of the rectangular geographic range is taken as the closest edge, and the closest edge and the snap point corresponding to the edge are recorded; B5: Repeat step B4 until all vector entities in the vector entity set are calculated, and the nearest edge and the capture point corresponding to the nearest edge are obtained; S7: Determine the best capture point based on the capture type and complete the capture of the vector entity.
2. A vector capture method according to claim 1, characterized in that: The step S1 specifically includes the following steps: S11: Get a layer in the project; S12: Initialize the layer cache unit, initialize the spatial index object of the layer cache unit, and bind the layer cache unit with the layer ID as the keyword; S13: Obtain a drawn vector entity in the layer, obtain the geometric data therein, calculate the size of the rectangular geographic range of the geometry, and add the rectangular range, geometry and FID of the vector entity to the spatial index object in the layer cache unit; S14: reacquire another vector entity in the layer, and repeat step S13 until all vector entities in the layer are processed. After completion, the rectangular geographic range of the calculation layer cache unit is updated according to the rectangular range of each vector entity in the layer so as to include all vector entities in the layer, and then step S15 is executed; S15: Get another layer in the project, return to step S12, and finish the construction until all layers in the project have completed the corresponding initialization and binding of layer cache units.
3. A vector capture method according to claim 2, characterized in that: In step S6, the process of obtaining the vector entity set is specifically as follows: using the rectangular geographic range as an index, using the spatial index object in the layer cache unit to obtain the set of all vector entities whose rectangular ranges of all cached vector entities intersect with the rectangular geographic range.
4. A vector capture method according to claim 2, characterized in that: In step S2, the vector capture point types include nodes, endpoints, intersection points, perpendicular feet, closest points and midpoints, wherein when the vector capture point type is a node or endpoint type, it belongs to the vertex category of the vector entity; when the vector capture point type is a midpoint, intersection point, perpendicular foot or closest point type, it belongs to the edge category of the vector entity.
5. A vector capture method according to claim 4, characterized in that: In the step S2, the capture type includes a single capture type and multiple capture types; In step S7, when a single capture type is selected, the capture point type is judged. If it belongs to the vector vertex category, the Euclidean distance between the geographical coordinates corresponding to the nearest vertex and the midpoint of the rectangular geographic range is calculated and compared. If it belongs to the vector edge category, the Euclidean distance between the capture point corresponding to the nearest edge and the geographical coordinates corresponding to the midpoint of the rectangular geographic range is calculated and compared. In step S7, when multiple capture types are selected, the priorities of different vector capture point types are set, and the nearest vertex and the nearest edge are stored in the vector vertex category set and the vector edge category set respectively. According to the set priority, the best capture point is determined in the category set with a high priority; if the category set with a high priority is empty, the priority is degraded and the best capture point is determined in the corresponding category set.
6. A vector capture method according to any one of claims 2 to 5, characterized in that: After a vector entity is drawn in the project layer, you need to enter the process of adding a vector entity, which is as follows: According to the id of the layer where the vector entity is located, the corresponding layer cache unit is obtained from the captured vector entity cache total module; Calculate the size of the rectangular geographic extent of the geometry in the vector entity, and add the rectangular extent, geometry and FID of the vector entity to the spatial index object in the layer cache unit; If the rectangular geographic extent of the layer cache unit does not completely contain the rectangular geographic extent of the vector entity, the rectangular geographic extent of the layer cache unit is updated to completely contain it.
7. A vector capture method according to claim 6, characterized in that: When a vector entity is deleted in the project layer, you need to enter the vector entity deletion process, specifically: According to the id of the layer where the vector entity is located, the corresponding layer cache unit is obtained from the captured vector entity cache total module; According to the FID of the vector entity, the corresponding data is deleted from the spatial index object in the layer cache unit.
8. A vector capture method according to claim 6, characterized in that: When a vector entity is edited in the project layer, the geometry changes and you need to enter the vector entity modification process, which is as follows: According to the id of the layer where the vector entity is located, the corresponding layer cache unit is obtained from the captured vector entity cache total module; Calculate the size of the rectangular geographic extent of the geometry in the vector entity, and update the corresponding data from the spatial index object in the layer cache unit according to the FID of the vector entity; If the rectangular geographic extent of the layer cache unit does not completely contain the rectangular geographic extent of the vector entity, the rectangular geographic extent of the layer cache unit is updated to completely contain it.
