A polygonal cutting method, device and product for distribution network design
By pre -processing the interstitial polygon geometry, the complex type polygon is decomposed into a simple type of sub -shaped, which solves the problem of low polygon cutting efficiency in the existing technology, and realizes the efficient cutting of complex type polygons.
Patent Information
- Application Number
- CN202411554563.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-11-04
AI Technical Summary
Existing polygon cropping algorithms (such as Greiner–Hormann, Sutherland–Hodgman, Weiler-Atherton, Vatti) are inefficient or unable to deal with complex type polygons (such as concave polygons, convex polygons, inner ring polygons, self-intersecting polygons). Effectively handled.
By receiving polygonal cutting instructions with a specified scales geometric data, obtain intersecting polygon geometry data, and prepro processing according to its type, decompose complex types of polygon into simple types of sub -shapes, thereby simplify the subsequent cutting process.
It improves the efficiency of polygonal cutting, can effectively handle complex types of polygons, and apply to business needs in distribution network design.
Smart Images

Figure CN119066823B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of distribution network design graphics processing, and specifically relates to a polygon clipping method, equipment and product for distribution network design. Background Art
[0002] Polygon clipping refers to a method of using a polygon (also called clipping polygon) to clip a polygon (also called clipped polygon) to clip the part of the clipped polygon outside the clipping polygon. A rectangle is usually used to clip the polygon.
[0003] Due to business needs, in the distribution network design software, it is necessary to clip complex types of polygons (such as concave polygons, convex polygons, polygons with inner rings or self-intersecting polygons). The current mainstream polygon clipping methods include Greiner-Hormann clipping algorithm, Sutherland-Hodgman clipping algorithm, Weiler-Atherton clipping algorithm and Vatti clipping algorithm. In the process of using the existing technology, the inventor found that the mainstream polygon clipping methods cannot directly meet the current distribution network design requirements. Specifically, there are at least the following problems in the existing technology:
[0004] Greiner-Hormann clipping algorithm: can handle complex polygons such as concave polygons, convex polygons, polygons with inner rings, and self-intersecting polygons, but the algorithm is relatively complex and the clipping efficiency is low; Sutherland-Hodgman clipping algorithm: can quickly clip convex polygons, but cannot handle concave polygons, polygons with inner rings, and self-intersecting polygons. Weiler-Atherton clipping algorithm: has good average efficiency and can clip concave polygons and convex polygons, but has low efficiency for clipping polygons with inner rings and cannot handle self-intersection of polygons; Vatti clipping algorithm: same as Greiner-Hormann algorithm, can handle complex types of polygons, but the efficiency is lower than Greiner-Hormann. Summary of the invention
[0005] The present invention aims to solve the above technical problems at least to a certain extent. The present invention provides a polygon clipping method, device and product for distribution network design.
[0006] In order to achieve the above object, the present invention adopts the following technical solutions:
[0007] In a first aspect, the present invention provides a polygon clipping method for distribution network design, comprising:
[0008] Receive a polygon clipping instruction bound with the framing frame geometry data corresponding to the specified framing frame, obtain the polygon geometry data corresponding to the polygon elements intersecting with the specified framing frame in the specified distribution network map data according to the framing frame geometry data, and define the polygon geometry data corresponding to the polygon elements intersecting with the specified framing frame as the intersection polygon geometry data;
[0009] Using the framing frame geometric data as clipping polygon geometric data;
[0010] Obtaining the polygon type of the intersecting polygon geometric data, if the polygon type of the intersecting polygon geometric data is the first type, obtaining the sub-polygon geometric data corresponding to the intersecting polygon geometric data, and using the sub-polygon geometric data as the clipped polygon geometric data, if the polygon type of the intersecting polygon geometric data is the second type, using the intersecting polygon geometric data as the clipped polygon geometric data; wherein the polygon type of the intersecting polygon geometric data is the first type or the second type, and when the polygon type of the intersecting polygon geometric data is the first type, the polygon type of the sub-polygon geometric data corresponding to the intersecting polygon geometric data is the second type;
[0011] The clipped polygon geometric data in the designated distribution network map data is obtained according to the clipping polygon geometric data and the clipped polygon geometric data.
[0012] In a possible design, before receiving the polygon clipping instruction bound with the framing frame geometric data corresponding to the designated framing frame, the method further includes:
[0013] Obtain a first-type polygon database and a second-type polygon database of specified distribution network map data, so as to obtain the polygon type of the intersecting polygon geometric data according to the first-type polygon database and the second-type polygon database, and when the polygon type of the intersecting polygon geometric data is of the first type, obtain the sub-polygon geometric data corresponding to the intersecting polygon geometric data through the second-type polygon database; wherein the first-type polygon database includes all polygon geometric data of the first type in the specified distribution network map data, and the second-type polygon database includes all polygon geometric data of the second type in the specified distribution network map data and the sub-polygon geometric data corresponding to each polygon geometric data of the first type.
[0014] In one possible design, obtaining a first type polygon database and a second type polygon database of specified distribution network map data includes:
[0015] Receiving a graphic creation instruction carrying polygonal elements, so as to create polygonal geometric data in the specified distribution network map data according to the graphic creation instruction;
[0016] Perform polygon detection processing on all polygonal geometric data in the specified distribution network map data to obtain the polygon type of each polygonal geometric data; wherein the polygon type of any polygonal geometric data is the first type or the second type;
[0017] Splitting the polygonal geometric data of the first type respectively to obtain sub-polygonal geometric data corresponding to each polygonal geometric data, and storing each polygonal geometric data in a first type polygon database; wherein the number of sub-polygonal geometric data corresponding to any polygonal geometric data is multiple;
[0018] The polygon geometry data of the second type and the sub-polygon geometry data corresponding to each polygon geometry data of the first type are stored in a second type polygon database.
[0019] In a possible design, obtaining the clipped polygon geometry data in the specified distribution network map data according to the clipping polygon geometry data and the clipped polygon geometry data includes:
[0020] Taking a random vertex of the clipped polygonal geometric data as a starting point, sequentially selecting the border line segment geometric data of the clipped polygonal geometric data in accordance with the specified direction of the clipped polygonal geometric data, and respectively calculating the intersection position information of each border line segment geometric data and the clipping polygonal geometric data, to obtain all the intersection position information between the border line segment geometric data of the clipped polygonal geometric data and the clipping polygonal geometric data;
[0021] Create a clipping point set and a clipped point set, and store all intersection position information and all vertex position information in the clipping polygon geometry data into the clipping point set in sequence according to the specified direction of the clipped polygon geometry data, and store all intersection position information and all vertex position information in the clipped polygon geometry data into the clipped point set in sequence according to the specified direction of the clipped polygon geometry data;
[0022] According to the position information of all the intersection points, all the associated points of the clipping point set and the clipped point set are acquired;
[0023] The clipped polygonal geometric data in the designated distribution network map data is obtained according to all the associated points.
[0024] In a possible design, all the intersection position information between the border line segment geometric data of the clipped polygon geometric data and the clipping polygon geometric data includes the intersection position information between any border line segment geometric data and the clipping polygon geometric data; correspondingly, the intersection position information is calculated for any border line segment geometric data and the clipping polygon geometric data to obtain the intersection position information between any border line segment geometric data and the clipping polygon geometric data, including:
[0025] Calculate the vector data of any frame line segment geometric data and the normal vector data of each edge in the clipping polygon geometric data;
[0026] Obtaining the starting point position information and the end point position information of any border line segment geometric data, and calculating, based on the starting point position information, the end point position information and the normal vector data of each edge, a first distance between the starting point corresponding to any border line segment geometric data and the normal vector data of each edge and a second distance between the end point corresponding to any border line segment geometric data and the normal vector data of each edge;
[0027] The distance signs of the first distance and the second distance are judged. If the distance signs of the first distance and the second distance are both negative numbers, it is determined that any border line segment geometric data is located outside the clipping polygon geometric data and does not need to be clipped; if the distance signs of the first distance and the second distance are both positive numbers, it is determined that any border line segment geometric data is located inside the clipping polygon geometric data and does not need to be clipped; if the distance signs of the first distance and the second distance are opposite, it is determined that any border line segment geometric data intersects with at least one edge of the clipping polygon geometric data. At this time, according to the starting point position information, the end point position information and the geometric data of each edge in the clipping polygon geometric data, the intersection position information between any border line segment geometric data and the clipping polygon geometric data is calculated, and the starting point position information or the end point position information of any border line segment geometric data is updated to the intersection position information, until all the intersection position information between any border line segment geometric data and the clipping polygon geometric data is obtained.
[0028] In a possible design, any intersection position information is bound to an intersection type, and the intersection type is an entry point type or an exit point type; correspondingly, according to all the intersection position information, all associated points of the clipping point set and the clipped point set are obtained, including:
[0029] Obtaining the intersection position information of any intersection type in the clipped point set, and taking the point corresponding to the intersection position information as the starting point;
[0030] defining the starting point as an in-point;
[0031] sequentially accessing the position information of a point after the entry point in the clipped point set until the intersection position information of which the intersection type is the exit point type is found, and taking the point corresponding to the intersection position information as the middle point;
[0032] Find the intersection position information of the middle point in the cropping point set, and sequentially access the position information of a point after the middle point in the cropping point set. If the position information of a point after the middle point in the cropping point set is the same as the intersection position information of the starting point, use the position information of the starting point and the intersection position information of all the middle points as all the associated points of the cropping point set and the cropped point set, otherwise proceed to the next step.
[0033] The entry point is updated to a point after the middle point in the cropping point set, and the position information of a point after the entry point in the cropped point set is accessed in sequence until the position information of a point after the middle point in the cropping point set is the intersection position information of the starting point.
[0034] In a possible design, after obtaining the clipped polygonal geometric data in the specified distribution network map data, the method further includes:
[0035] Create frame map data matching the specified distribution network map data according to the clipped polygonal geometric data.
[0036] In a possible design, the segmented map data is created using secondary development controls of CAD software.
[0037] In a second aspect, the present invention provides an electronic device, comprising:
[0038] a memory for storing computer program instructions; and,
[0039] A processor is used to execute the computer program instructions to complete the operation of the polygon clipping method for distribution network design as described in any one of the above.
[0040] In a third aspect, the present invention provides a computer program product, including a computer program or instructions, which, when executed by a computer, implements the polygon clipping method for distribution network design as described in any one of the above.
[0041] The beneficial effects of the present invention are:
[0042] The present invention discloses a polygon clipping method, device and product for distribution network design, which can realize the clipping of complex polygon types in the distribution network design business, and the clipping efficiency is high. Specifically, in the implementation process of the present invention, before polygon clipping, the intersecting polygon geometric data is pre-processed according to the polygon type of the intersecting polygon geometric data, so as to decompose the intersecting polygon geometric data of the first type (that is, the complex type) into sub-polygon geometric data of the second type (that is, the simple type), thereby converting the clipped polygon geometric data into the second type of polygon geometric data, which can simplify the subsequent polygon clipping, that is, the workload of obtaining the clipped polygon geometric data in the specified distribution network map data, thereby effectively improving the polygon clipping efficiency, and can be applied to the clipping of complex polygon types.
[0043] Other beneficial effects of the present invention will be further described in the specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 is a flow chart of the polygon clipping method for distribution network design in Example 1;
[0045] Figure 2 is a schematic diagram of the clipping polygon geometry data and the clipped polygon geometry data exemplified in Embodiment 1;
[0046] Figure 3 This is a schematic diagram of obtaining a clipping point set and all associated points of a clipped point set as exemplified in Embodiment 1. DETAILED DESCRIPTION
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be briefly introduced below in combination with the drawings and the description of the embodiments or the prior art. Obviously, the following description of the structure of the drawings is only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention.
[0048] Embodiment 1:
[0049] This embodiment discloses a polygon clipping method for distribution network design, which can be executed by, but is not limited to, a computer device or a virtual machine with certain computing resources, such as a personal computer, a smart phone, a personal digital assistant, or a wearable device, or by a virtual machine.
[0050] like Figure 1 As shown, a polygon clipping method for distribution network design may include but is not limited to the following steps:
[0051] S1. Receive a polygon clipping instruction bound to the framing frame geometry data corresponding to the specified framing frame, obtain the polygon geometry data corresponding to the polygon elements intersecting with the specified framing frame in the specified distribution network map data according to the framing frame geometry data, and define the polygon geometry data corresponding to the polygon elements intersecting with the specified framing frame as intersecting polygon geometry data; as an example, in this embodiment, the specified framing frame adopts a rectangular frame.
[0052] Step S1, before receiving a polygon clipping instruction bound with the framing frame geometry data corresponding to the designated framing frame, the method further comprises:
[0053] A1. Obtain a first-type polygon database and a second-type polygon database of the specified distribution network map data, so that in step S3, the polygon type of the intersecting polygon geometric data is obtained according to the first-type polygon database and the second-type polygon database, and when the polygon type of the intersecting polygon geometric data is the first type, obtain the sub-polygon geometric data corresponding to the intersecting polygon geometric data through the second-type polygon database; wherein the first-type polygon database includes all polygon geometric data of the first type in the specified distribution network map data, and the second-type polygon database includes all polygon geometric data of the second type in the specified distribution network map data and sub-polygon geometric data corresponding to each polygon geometric data of the first type.
[0054] Specifically, in step A1, obtaining a first type polygon database and a second type polygon database of designated distribution network map data includes:
[0055] A101. Receive a graphic creation instruction carrying polygonal elements so as to create polygonal geometric data in the specified distribution network map data according to the graphic creation instruction; it should be noted that, in this embodiment, the polygonal elements can be drawn by the user on the map control of the distribution network design software, or can be obtained by importing the map control through the polygonal element point coordinates, which is not limited here, and the polygonal geometric data can be created based on the GDAL library (a converter library for raster and vector geospatial data formats).
[0056] A102. Perform polygon detection processing on all polygonal geometric data in the specified distribution network map data to obtain the polygon type of each polygonal geometric data; wherein the polygon type of any polygonal geometric data is the first type or the second type; specifically, in this embodiment, the polygon detection algorithm in the GDAL library can be used but is not limited to implement polygon detection processing on polygonal geometric data, which is not limited here.
[0057] A103. Split the polygonal geometric data of the first type respectively to obtain sub-polygonal geometric data corresponding to each polygonal geometric data, and store each polygonal geometric data in the first type polygon database; wherein the number of sub-polygonal geometric data corresponding to any polygonal geometric data is multiple;
[0058] A104. Store the polygon geometry data of the second type and the sub-polygon geometry data corresponding to each polygon geometry data of the first type into the second type polygon database.
[0059] It should be noted that, in this embodiment, before receiving the polygon clipping instruction bound to the geometric data of the sub-frame corresponding to the specified sub-frame, the first type polygon database and the second type polygon database of the specified distribution network map data are pre-acquired, which can facilitate further improving the clipping efficiency of the polygons in the specified distribution network map data.
[0060] S2. Using the frame geometry data as clipping polygon geometry data.
[0061] S3. Obtain the polygon type of the intersecting polygon geometric data. If the polygon type of the intersecting polygon geometric data is the first type, obtain the sub-polygon geometric data corresponding to the intersecting polygon geometric data, and use the sub-polygon geometric data as the clipped polygon geometric data. If the polygon type of the intersecting polygon geometric data is the second type, use the intersecting polygon geometric data as the clipped polygon geometric data. The polygon type of the intersecting polygon geometric data is the first type or the second type, and when the polygon type of the intersecting polygon geometric data is the first type, the polygon type of the sub-polygon geometric data corresponding to the intersecting polygon geometric data is the second type. Specifically, in this embodiment, the first type may also be referred to as a complex type, and the second type may also be referred to as a simple type. Correspondingly, the polygon geometric data of the first type is the geometric data of complex polygons, which includes the geometric data of inner ring polygons and self-intersecting polygons, and the polygon geometric data of the second type is the geometric data of simple polygons, which includes the geometric data of concave polygons and convex polygons.
[0062] As an example, Figure 2 A schematic diagram of the clipping polygon geometry data and the clipped polygon geometry data is given.
[0063] S4. Obtain the clipped polygon geometry data in the designated distribution network map data according to the clipping polygon geometry data and the clipped polygon geometry data.
[0064] Specifically, in step S4, obtaining the clipped polygon geometry data in the specified distribution network map data according to the clipping polygon geometry data and the clipped polygon geometry data includes:
[0065] S401. Taking a random vertex of the clipped polygonal geometric data as the starting point, sequentially select the border line segment geometric data of the clipped polygonal geometric data according to the specified direction of the clipped polygonal geometric data, and respectively calculate the intersection position information of each border line segment geometric data and the clipping polygonal geometric data, and obtain all the intersection position information between the border line segment geometric data of the clipped polygonal geometric data and the clipping polygonal geometric data; specifically, in this embodiment, the specified direction can be the clockwise direction or the counterclockwise direction of the clipped polygonal geometric data, so as to sequentially select the border line segment geometric data of the clipped polygonal geometric data and calculate the intersection position information, and the obtained intersection position information can be sorted and stored based on the specified direction. In this embodiment, the specified direction is the clockwise direction.
[0066] In step S401, all the intersection position information between the border line segment geometric data of the clipped polygon geometric data and the clipping polygon geometric data includes the intersection position information between any border line segment geometric data and the clipping polygon geometric data; correspondingly, the intersection position information is calculated for any border line segment geometric data and the clipping polygon geometric data to obtain the intersection position information between any border line segment geometric data and the clipping polygon geometric data, including:
[0067] S4011. Calculate the vector data of any border line segment geometric data and the normal vector data of each edge in the clipping polygon geometric data; it should be understood that, in this embodiment, the direction of the vector data of any border line segment geometric data is the direction from the starting point to the end point of any border line segment geometric data, and this direction is the specified direction of the clipped polygon geometric data; the normal vector data of any edge in the clipping polygon geometric data is a unit vector perpendicular to any edge and pointing to the inside of the specified partition frame.
[0068] S4012. Obtain the starting point position information and the end point position information of any border line segment geometric data, and calculate the first distance between the starting point corresponding to any border line segment geometric data and the normal vector data of each edge and the second distance between the end point corresponding to any border line segment geometric data and the normal vector data of each edge according to the starting point position information, the end point position information and the normal vector data of each edge;
[0069] S4013. Determine the distance signs of the first distance and the second distance. If the distance signs of the first distance and the second distance are both negative numbers, that is, the distances from the start point and the end point of the border line segment corresponding to any border line segment geometric data to all boundaries of the specified framing frame are negative numbers, then determine that any border line segment geometric data is located outside the clipping polygon geometric data and does not need to be clipped; if the distance signs of the first distance and the second distance are both positive numbers, that is, the distances from the start point and the end point of the border line segment corresponding to any border line segment geometric data to all boundaries of the specified framing frame are positive numbers, then determine that any border line segment geometric data is located inside the clipping polygon geometric data and does not need to be clipped; If the signs of the first distance and the second distance are opposite, it is determined that any of the border line segment geometric data intersects with at least one edge of the clipping polygon geometric data. At this time, the intersection position information between any of the border line segment geometric data and the clipping polygon geometric data is calculated based on the starting point position information, the ending point position information and the geometric data of each edge in the clipping polygon geometric data, and the starting point position information or the ending point position information of any of the border line segment geometric data is updated to the intersection position information, that is, the starting point position information or the ending point position information of any of the border line segment geometric data is replaced with the intersection position information, until all the intersection position information between any of the border line segment geometric data and the clipping polygon geometric data is obtained.
[0070] It should be noted that, in the present embodiment, after the intersection position information between any border line segment geometric data and the clipping polygon geometric data is calculated, the focus corresponding to the intersection position information is replaced with the new endpoint of any border line segment geometric data, and the above steps S4011-S4013 are repeated until any border line segment corresponding to any border line segment geometric data is completely located inside or outside the clipping polygon geometric data, thereby obtaining all the intersection position information between any border line segment geometric data and the clipping polygon geometric data.
[0071] Based on the above steps S4011-S4013, a vector projection calculation method is used to determine the positional relationship between any border line segment geometric data and the specified dividing frame, i.e., inside, outside or intersection, and based on this, it is determined whether to crop the border line segment corresponding to any border line segment geometric data. The process of obtaining the intersection position information is simple to calculate and easy to implement.
[0072] S402. Create a clipping point set and a clipped point set, and store all intersection position information and all vertex position information in the clipping polygon geometry data into the clipping point set in sequence according to the specified direction of the clipped polygon geometry data, and store all intersection position information and all vertex position information in the clipped polygon geometry data into the clipped point set in sequence according to the specified direction of the clipped polygon geometry data.
[0073] S403. According to the position information of all the intersection points, obtain all the associated points of the clipping point set and the clipped point set; it should be understood that, in this embodiment, the associated points are the position information of the points of the clipped polygon obtained after clipping the clipping polygon geometric data in the clipped polygon geometric data.
[0074] In step S401, any intersection position information is bound to an intersection type, and the intersection type is an entry point type or an exit point type; correspondingly, in step S403, all associated points of the clipping point set and the clipped point set are obtained according to all the intersection position information, including:
[0075] S4031. Obtain the intersection position information of any intersection type in the clipped point set, and use the point corresponding to the intersection position information as the starting point;
[0076] S4032. defining the starting point as an entry point;
[0077] S4033. Access the position information of the point after the entry point in the clipped point set in sequence until the intersection position information of the exit point type is found, and take the point corresponding to the intersection position information as the middle point; it should be understood that the point after the entry point in the clipped point set is the intersection or the vertex, that is, the position information of the point after the entry point is the corresponding intersection position information or the corresponding vertex position information, which is not limited here.
[0078] S4034. Find the intersection position information of the middle point in the cropping point set, and sequentially access the position information of a point after the middle point in the cropping point set. If the position information of a point after the middle point in the cropping point set is the same as the intersection position information of the starting point, use the position information of the starting point and the intersection position information of all the middle points as all the associated points of the cropping point set and the cropped point set, otherwise proceed to the next step.
[0079] S4035. Update the entry point to a point after the middle point in the cropping point set, i.e. replace the entry point with a point after the middle point in the cropping point set, and sequentially access the position information of the point after the entry point in the cropped point set, i.e. return to step S4033, until the position information of the point after the middle point in the cropping point set is the intersection position information of the starting point.
[0080] As an example, in step S403 of this embodiment, Figure 3 As shown in the figure, the solid circle represents the intersection of the intersection type of the entry point type, and the hollow circle represents the intersection of the intersection type of the exit point type. If the intersection I1 of the entry point type is taken as the starting point, the intersection I1 is first defined as the entry point; then, the position information of the point after the entry point in the clipped point set is accessed in sequence, and the intersection I2 of the exit point type is found, and the intersection I2 is used as the middle point; then, the intersection position information of the middle point is found in the clipped point set, that is, the intersection position information of the intersection I2, and the position information of the intersection I3 is accessed. At this time, it can be known that the intersection I3 is located after the opening point. If the position information of the starting point I1 is different, the entry point is updated to the intersection point I3, and then the position information of the point after the entry point in the clipped point set is revisited. At this time, the vertex S3 and the intersection point I4 are accessed, and so on, until the position information of the point after the middle point in the clipping point set is the intersection position information of the starting point, that is, the intersection position information of the intersection point I1 is accessed in the clipping point set. At this time, the process ends, and the position information of the starting point and the intersection position information of all the middle points are used as all the associated points of the clipping point set and the clipped point set. In this example, the associated points obtained include I1, I2, I3, S3, I4, I5, I6, I7, S6, I8 and I1.
[0081] S404. Obtain clipped polygonal geometric data in the designated distribution network map data according to all the associated points.
[0082] Step S4, after obtaining the clipped polygonal geometric data in the specified distribution network map data, the method further includes:
[0083] S5. Creating frame map data matching the designated distribution network map data according to the clipped polygonal geometric data.
[0084] As an example, in this embodiment, the secondary development control Teigha.net of the CAD (Computer Aided Design) software is used to create dwg format segmented map data, and a cropped polygon block table can be further created in the segmented map data to enable users to view the detailed information such as the direction of a specified line in the specified distribution network map data in a targeted manner.
[0085] This embodiment can realize the clipping of complex polygons in the distribution network design business, and the clipping efficiency is high. Specifically, during the implementation of this embodiment, before polygon clipping, the intersecting polygon geometry data is pre-processed according to the polygon type of the intersecting polygon geometry data, so as to decompose the first type (that is, the complex type) of the intersecting polygon geometry data into the second type (that is, the simple type) of sub-polygon geometry data, thereby converting the clipped polygon geometry data into the second type of polygon geometry data, which can simplify the subsequent polygon clipping, that is, the workload of obtaining the clipped polygon geometry data in the specified distribution network map data, thereby effectively improving the polygon clipping efficiency, and can also be applied to the clipping of complex polygons.
[0086] Embodiment 2:
[0087] Based on Embodiment 1, this embodiment discloses an electronic device, which may be a smart phone, a tablet computer, a laptop computer, or a desktop computer, etc. The electronic device may be called a user terminal, a portable terminal, a desktop terminal, etc. The electronic device includes:
[0088] a memory for storing computer program instructions; and,
[0089] A processor is used to execute the computer program instructions to complete the operation of the polygon clipping method for distribution network design as described in any one of Example 1.
[0090] Embodiment 3:
[0091] Based on any one of Examples 1 to 2, this embodiment discloses a computer program product, including a computer program or instructions, which, when executed by a computer, implements the polygon clipping method for distribution network design as described in any one of Example 1.
[0092] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0093] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the above embodiments, a person skilled in the art should understand that the technical solutions described in the above embodiments can still be modified, or some of the technical features can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A polygon clipping method for distribution network design, characterized in that: include: Receive a polygon clipping instruction bound with the framing frame geometry data corresponding to the specified framing frame, obtain the polygon geometry data corresponding to the polygon elements intersecting with the specified framing frame in the specified distribution network map data according to the framing frame geometry data, and define the polygon geometry data corresponding to the polygon elements intersecting with the specified framing frame as the intersection polygon geometry data; Using the framing frame geometric data as clipping polygon geometric data; Obtain the polygon type of the intersecting polygon geometric data. If the polygon type of the intersecting polygon geometric data is the first type, obtain the sub-polygon geometric data corresponding to the intersecting polygon geometric data, and use the sub-polygon geometric data as the clipped polygon geometric data. If the polygon type of the intersecting polygon geometric data is the second type, use the intersecting polygon geometric data as the clipped polygon geometric data. Wherein, the polygon type of the intersecting polygon geometric data is the first type or the second type, and when the polygon type of the intersecting polygon geometric data is the first type, the polygon type of the sub-polygon geometric data corresponding to the intersecting polygon geometric data is the second type. The first type includes polygons with inner rings and self-intersecting polygons, and the second type includes concave polygons and convex polygons. The first type of intersecting polygon geometric data can be decomposed into a plurality of sub-polygon geometric data of the second type. Obtaining the clipped polygon geometry data in the designated distribution network map data according to the clipping polygon geometry data and the clipped polygon geometry data; Obtaining the clipped polygon geometry data in the specified distribution network map data according to the clipping polygon geometry data and the clipped polygon geometry data, including: Taking a random vertex of the clipped polygonal geometric data as a starting point, sequentially selecting the border line segment geometric data of the clipped polygonal geometric data in accordance with the specified direction of the clipped polygonal geometric data, and respectively calculating the intersection position information of each border line segment geometric data and the clipping polygonal geometric data, to obtain all the intersection position information between the border line segment geometric data of the clipped polygonal geometric data and the clipping polygonal geometric data; Create a clipping point set and a clipped point set, and store all intersection position information and all vertex position information in the clipping polygon geometry data into the clipping point set in sequence according to the specified direction of the clipped polygon geometry data, and store all intersection position information and all vertex position information in the clipped polygon geometry data into the clipped point set in sequence according to the specified direction of the clipped polygon geometry data; According to the position information of all the intersection points, all the associated points of the clipping point set and the clipped point set are acquired; Obtaining clipped polygonal geometric data in the designated distribution network map data according to all the associated points; All the intersection position information between the border line segment geometric data of the clipped polygon geometric data and the clipping polygon geometric data includes the intersection position information between any border line segment geometric data and the clipping polygon geometric data; correspondingly, the intersection position information is calculated for any border line segment geometric data and the clipping polygon geometric data to obtain the intersection position information between any border line segment geometric data and the clipping polygon geometric data, including: Calculate the vector data of any border line segment geometric data and the normal vector data of each edge in the clipping polygon geometric data; Obtaining the starting point position information and the end point position information of any border line segment geometric data, and calculating, based on the starting point position information, the end point position information and the normal vector data of each edge, a first distance between the starting point corresponding to any border line segment geometric data and the normal vector data of each edge and a second distance between the end point corresponding to any border line segment geometric data and the normal vector data of each edge; The distance signs of the first distance and the second distance are judged. If the distance signs of the first distance and the second distance are both negative numbers, it is determined that any border line segment geometric data is located outside the clipping polygon geometric data and does not need to be clipped; if the distance signs of the first distance and the second distance are both positive numbers, it is determined that any border line segment geometric data is located inside the clipping polygon geometric data and does not need to be clipped; if the distance signs of the first distance and the second distance are opposite, it is determined that any border line segment geometric data intersects with at least one edge of the clipping polygon geometric data. At this time, according to the starting point position information, the end point position information and the geometric data of each edge in the clipping polygon geometric data, the intersection position information between any border line segment geometric data and the clipping polygon geometric data is calculated, and the starting point position information or the end point position information of any border line segment geometric data is updated to the intersection position information, until all the intersection position information between any border line segment geometric data and the clipping polygon geometric data is obtained; Any intersection position information is bound to an intersection type, and the intersection type is an entry point type or an exit point type; correspondingly, according to all the intersection position information, all associated points of the clipping point set and the clipped point set are obtained, including: Obtaining the intersection position information of any intersection type of the clipped point set, and taking the point corresponding to the intersection position information as the starting point; defining the starting point as an in-point; sequentially accessing the position information of a point after the entry point in the clipped point set until the intersection position information of which the intersection type is the exit point type is found, and taking the point corresponding to the intersection position information as the middle point; Find the intersection position information of the middle point in the cropping point set, and sequentially access the position information of a point after the middle point in the cropping point set. If the position information of a point after the middle point in the cropping point set is the same as the intersection position information of the starting point, use the position information of the starting point and the intersection position information of all the middle points as all the associated points of the cropping point set and the cropped point set, otherwise proceed to the next step. The entry point is updated to a point after the middle point in the cropping point set, and the position information of a point after the entry point in the cropped point set is accessed in sequence until the position information of a point after the middle point in the cropping point set is the intersection position information of the starting point.
2. A polygon clipping method for distribution network design according to claim 1, characterized in that: Before receiving the polygon clipping instruction bound with the framing frame geometric data corresponding to the designated framing frame, the method further includes: Obtain a first-type polygon database and a second-type polygon database of specified distribution network map data, so as to obtain the polygon type of the intersecting polygon geometric data according to the first-type polygon database and the second-type polygon database, and when the polygon type of the intersecting polygon geometric data is of the first type, obtain the sub-polygon geometric data corresponding to the intersecting polygon geometric data through the second-type polygon database; wherein the first-type polygon database includes all polygon geometric data of the first type in the specified distribution network map data, and the second-type polygon database includes all polygon geometric data of the second type in the specified distribution network map data and the sub-polygon geometric data corresponding to each polygon geometric data of the first type.
3. A polygon clipping method for distribution network design according to claim 2, characterized in that: Obtaining the first type polygon database and the second type polygon database of the specified distribution network map data includes: Receiving a graphic creation instruction carrying polygonal elements, so as to create polygonal geometric data in the specified distribution network map data according to the graphic creation instruction; Perform polygon detection processing on all polygonal geometric data in the specified distribution network map data to obtain the polygon type of each polygonal geometric data; wherein the polygon type of any polygonal geometric data is the first type or the second type; Splitting the polygonal geometric data of the first type respectively to obtain sub-polygonal geometric data corresponding to each polygonal geometric data, and storing each polygonal geometric data in a first type polygon database; wherein the number of sub-polygonal geometric data corresponding to any polygonal geometric data is multiple; The polygon geometry data of the second type and the sub-polygon geometry data corresponding to each polygon geometry data of the first type are stored in a second type polygon database.
4. The polygon clipping method for distribution network design according to claim 1, characterized in that: After obtaining the clipped polygonal geometric data in the specified distribution network map data, the method further includes: Create frame map data matching the specified distribution network map data according to the clipped polygonal geometric data.
5. A polygon clipping method for distribution network design according to claim 4, characterized in that: The sectional map data is created by using secondary development controls of CAD software.
6. An electronic device, characterized in that: include: a memory for storing computer program instructions; as well as, A processor is used to execute the computer program instructions to complete the operation of the polygon clipping method for distribution network design as described in any one of claims 1 to 4.
7. A computer program product comprising a computer program or instructions, characterized in that: The computer program or the instruction, when executed by a computer, implements the polygon clipping method for distribution network design as claimed in any one of claims 1 to 4.
Citation Information
Patent Citations
Polygon clipping method based on intersection point sorting
CN102360507A
Complex polygon cutting method for solving intersection degradation problem
CN107038731A