CN114661729B - Method and device for generating pipeline auxiliary line - Google Patents
Method and device for generating pipeline auxiliary line Download PDFInfo
- Publication number
- CN114661729B CN114661729B CN202210402545.XA CN202210402545A CN114661729B CN 114661729 B CN114661729 B CN 114661729B CN 202210402545 A CN202210402545 A CN 202210402545A CN 114661729 B CN114661729 B CN 114661729B
- Authority
- CN
- China
- Prior art keywords
- pipeline
- auxiliary line
- line
- point
- index
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2291—User-Defined Types; Storage management thereof
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/24569—Query processing with adaptation to specific hardware, e.g. adapted for using GPUs or SSDs
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/29—Geographical information databases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/20—Drawing from basic elements, e.g. lines or circles
- G06T11/203—Drawing of straight lines or curves
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- Computational Linguistics (AREA)
- Remote Sensing (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to a method and a device for generating a pipeline auxiliary line, wherein the method comprises the following steps: performing space query on the pipeline data according to preset conditions, and determining the space coordinates of the pipeline according to a space reference coordinate system; creating a pipeline class and adding an element class index, calculating characteristic points of pipeline auxiliary lines according to the spatial coordinates of the pipeline and the element class index, generating first pipeline auxiliary lines, and adding pipeline marks to the corresponding first pipeline auxiliary lines. The beneficial effects of the invention include: screening pipeline data meeting preset conditions, acquiring space coordinates of pipelines in corresponding areas according to actual requirements, calculating characteristic points of pipeline auxiliary lines according to the space coordinates and the element class indexes, and generating first pipeline auxiliary lines, so that the calculation amount of generating the pipeline auxiliary lines in the topological structure is simplified, and the efficiency of generating the pipeline auxiliary lines is improved.
Description
Technical Field
The present invention relates to the field of pipeline data processing technologies, and in particular, to a method and an apparatus for generating a pipeline auxiliary line.
Background
With the development of society and the continuous improvement of the current urbanization level, the infrastructure development is rapid, the underground pipe network system is larger and larger, and besides the original water supply and drainage network, the power grid, the heating power network and the communication line, the natural gas pipe network, the internet and the like are added, so that the underground pipe network becomes more and more complex. Due to the violent increase of the infrastructure, the effective management of the underground pipe network is lacked, so that the repeated construction and the resource waste are caused. During construction, because the condition of an underground pipe network is not known, the underground pipe network is opened blindly, and events such as gas leakage, water pipe breaking, communication interruption and the like which damage the underground pipe network occur occasionally.
In the process of updating an old pipe network and designing and planning a new pipe network, processing and designing are required to be carried out according to corresponding pipeline conditions on the basis of a large amount of formed pipe network data, and the traditional manual drawing, management by manual memory and management modes of manual statistics and analysis are low in efficiency, so that the requirements of rapidly developing mass data of urbanization are difficult to adapt.
Disclosure of Invention
The technical problem to be solved by the present invention is to provide a method and a device for generating a pipeline auxiliary line, which overcome the above problems or at least partially solve the above problems.
The technical scheme for solving the technical problems is as follows: in one aspect, an embodiment of the present invention discloses a method for generating a pipeline auxiliary line, including:
acquiring a pipeline name of pipeline data according to a first preset condition, wherein the pipeline data comprises a plurality of sections of pipelines and pipeline marks;
according to a second preset condition, carrying out spatial query on the pipeline data, and determining the spatial coordinates of the pipeline according to a spatial reference coordinate system;
creating a pipeline class and adding an element class index according to the pipeline class, wherein the pipeline class is created according to the type of the pipeline data and the information of the spatial coordinates;
calculating the characteristic points of the pipeline auxiliary line according to the spatial coordinates of the pipeline and the element class indexes;
and generating a first pipeline auxiliary line according to the characteristic points of the pipeline auxiliary line, and adding the pipeline mark to the corresponding first pipeline auxiliary line.
Optionally, the adding element class indexes according to the pipeline class includes:
adding element class database indexes, creating pipeline point element class database indexes and pipeline line element class database indexes, and storing database index information;
and/or adding element space indexes, determining a space index starting point and a grid value according to the geometric range of the pipeline element layer, respectively creating space indexes for the pipeline point element class and the pipeline element class, calculating the grid range of the pipeline element, and storing grid codes.
Optionally, each segment of the pipeline comprises a first endpoint and a second endpoint;
the calculating the characteristic point of the pipeline auxiliary line according to the spatial coordinate of the pipeline and the element class index comprises the following steps:
calculating a first feature point of the pipeline auxiliary line according to the first endpoint and the element class index, wherein the first feature point is obtained by translating the first endpoint towards the normal direction of the pipeline, and the translation distance is the radius of the pipeline;
and calculating a second feature point of the pipeline auxiliary line according to the second endpoint and the element class index, wherein the second feature point is obtained by translating the second endpoint towards the normal direction of the pipeline, and the translation distance is the radius of the pipeline.
Optionally, after obtaining the pipeline name of the pipeline data according to the first preset condition, the method further includes:
searching a second pipeline auxiliary line corresponding to the pipeline data according to the pipeline name;
and deleting the second pipeline auxiliary line and initializing the layer of the pipeline data.
Optionally, the first preset condition includes at least one of the following:
a geographic location of the pipeline;
and/or, the material of the pipeline;
and/or, the size of the pipeline.
Optionally, the second preset condition includes at least one of the following:
the use of the pipeline;
and/or, the range of use of the line.
In another aspect, an embodiment of the present invention further provides an apparatus for generating a pipeline auxiliary line, including:
the pipeline data acquisition module is used for acquiring the pipeline name of pipeline data according to a first preset condition, wherein the pipeline data comprises a plurality of sections of pipelines and pipeline marks;
the pipeline coordinate acquisition module is used for carrying out space query on the pipeline data according to a second preset condition and determining the space coordinate of the pipeline according to a space reference coordinate system;
the index creating module is used for creating a pipeline class and adding an element class index according to the pipeline class, wherein the pipeline class is created according to the type of the pipeline data and the information of the spatial coordinates;
the characteristic point calculating module is used for calculating the characteristic points of the pipeline auxiliary line according to the spatial coordinates of the pipeline and the element class indexes;
and the first auxiliary line generating module is used for generating a first pipeline auxiliary line according to the characteristic points of the pipeline auxiliary line and adding the pipeline mark to the corresponding first pipeline auxiliary line.
Optionally, the index creating module includes:
the first index creating submodule is used for adding element class database indexes, creating pipeline point element class database indexes and pipeline line element class database indexes and storing database index information;
and/or the second index creating submodule is used for adding element class spatial indexes, determining a spatial index starting point and a grid value according to the geometric range of the pipeline element layer, respectively creating spatial indexes for the pipeline point element class and the pipeline element class, calculating the grid range of the pipeline element, and storing the grid codes.
Optionally, each section of the pipeline in the device comprises a first endpoint and a second endpoint;
the feature point calculation module includes:
a first feature point calculation submodule, configured to calculate a first feature point of the pipeline auxiliary line according to the first endpoint and the element class index, where the first feature point is obtained by translating the first endpoint toward a normal direction of the pipeline, and a distance of translation is a radius of the pipeline;
and the second feature point calculation submodule is used for calculating a second feature point of the pipeline auxiliary line according to the second endpoint and the element class index, wherein the second feature point is obtained by translating the second endpoint towards the normal direction of the pipeline, and the translation distance is the radius of the pipeline.
Optionally, after obtaining the pipeline name of the pipeline data according to the first preset condition, the apparatus further includes:
the searching module is used for searching a second pipeline auxiliary line corresponding to the pipeline data according to the pipeline name;
and the initialization module is used for deleting the second pipeline auxiliary line and initializing the layer of the pipeline data.
Optionally, the first preset condition includes at least one of the following:
a geographic location of the pipeline;
and/or, the material of the pipeline;
and/or, the size of the pipeline.
Optionally, the second preset condition includes at least one of the following:
the use of said pipeline;
and/or, the extent of use of the pipeline.
In another aspect, an embodiment of the present invention further provides an electronic device, which includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and when executed by the processor, the computer program implements the steps of the pipeline auxiliary line generating method.
In another aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the method for generating a pipeline auxiliary line.
The embodiment of the invention has the following advantages: according to the method, the pipeline data are subjected to spatial query according to the preset conditions, the spatial coordinates of the pipeline are determined according to the spatial reference coordinate system, the pipeline data meeting the preset conditions are screened, the spatial coordinates of the pipelines in the corresponding area are obtained according to actual requirements, the characteristic points of the pipeline auxiliary lines are calculated according to the spatial coordinates and the element class indexes, the first pipeline auxiliary lines are generated, the calculated amount of the pipeline auxiliary lines generated in the topological structure is simplified, and the pipeline auxiliary line generating efficiency is improved.
Drawings
FIG. 1 is a flowchart illustrating steps for generating auxiliary pipeline according to an embodiment of the present invention;
fig. 2 is a block diagram of a structure of an auxiliary line of a pipeline according to an embodiment of the present invention.
Detailed Description
The principles and features of this invention are described below in conjunction with the following drawings, which are set forth by way of illustration only and are not intended to limit the scope of the invention.
As shown in fig. 1, fig. 1 is a flowchart illustrating steps of generating a pipeline auxiliary line according to an embodiment of the present invention, where the method includes the following steps:
in the process of updating the old pipe network or designing and planning the new pipe network, processing can be carried out on the basis of the formed pipe network data, and because the topological structure information in the existing pipe network data is complicated, a user can extract part of pipe network data and carry out primary processing on the part of pipe network data.
In an optional embodiment, after obtaining the pipeline name of the pipeline data according to the first preset condition, the method further comprises: and searching a second pipeline auxiliary line corresponding to the pipeline data according to the pipeline name, deleting the second pipeline auxiliary line, and initializing the layer of the pipeline data.
Wherein, the first preset condition may include a geographical location of the pipeline, such as the summer and river areas of wuhan city, northHubei province; the first preset condition may also include the material of the pipeline, for example, the pipeline is made of copper, plastic or cement; the first predetermined condition may include the size of the pipeline, such as a pipeline diameter of 20cm.
102, performing spatial query on the pipeline data according to a second preset condition, and determining a spatial coordinate of the pipeline according to a spatial reference coordinate system;
wherein the second predetermined condition may comprise the use of the pipeline or the range of use of the pipeline. For example, the pipeline may be used in transportation facilities including urban underpasses, urban subways, tunnels; the pipeline can be used in commercial facilities such as underground malls, underwater amusement parks; the pipeline can be used for municipal public service pipeline facilities, improves the utilization of urban roads, protects stable operation of underground facilities, and provides a reserved space for adding facilities later.
In an optional embodiment, the name (id) of a pipeline in a specific area or specific attribute is found out according to a second preset condition, a corresponding auxiliary line is queried and deleted according to the pipeline id, a layer of pipeline data is initialized to obtain a set of pipeline data, the set is set to be L1, the set L1 is traversed to obtain a combined spatial range, the spatial range is expanded appropriately according to actual requirements to obtain a set L2, the set L2 is subjected to spatial query to find out the id of the pipeline data needing to generate the auxiliary line, and spatial coordinates of the pipeline are determined according to a spatial reference coordinate system. Let dSizeX = (extent. Xmax-extent. Xmin)/GridSizeX, dSizeY = (extent. Ymax-extent. Ymin)/GridSizeY, assuming that the extended spatial range is extent, the grid sizes dSizeX and dSizeY are obtained. Traverse vecConnectPnts, and set the current ConnectPnt object pointer to p. From p, line and idx can be found, so that a line space object corresponding to the line can be found, and the coordinates (x, y) of the current p can be determined. Then the grid index (i, j) where p is located should be ((int) ((x-extension. Xmin)/dSizeX), (int) ((y-extension. Ymin)/dSizeY)), so that the grid object vecvecvecvecvec connectpnts [ j + GridSizeX + i ] corresponding to p can be determined. It is called vec ConnectPnts _ ij. P may be added to vec connectictpnts _ ij.
103, creating a pipeline class and adding an element class index according to the pipeline class, wherein the pipeline class is created according to the type of the pipeline data and the information of the spatial coordinates;
the set L2 is traversed, and spatial data corresponding to the pipeline data L2, a pipeline id, a flag (flag) indicating whether to participate in generation and a pipeline flag are stored in the array _ lines and array _ ids and array _ flags and array _ attrs, respectively. Each element of the array _ attrs is an attribute array, and stores the attributes of the predicted fields, including the pipe diameter size corresponding to the pipeline data, the project number, the field of the pipeline type (including the starting point elevation and the ending point elevation if the drainage pipeline), or the field needing to be written into the auxiliary line of the pipeline, and element class indexes are added according to pipeline classes array _ lines, array _ ids, array _ flags and array _ attrs, respectively, including:
adding element class database indexes, establishing pipeline point element class-related database indexes for accelerating the query rate of pipeline point elements, establishing pipeline line element class database indexes for accelerating the query rate of pipeline line elements, and storing database index information;
and/or adding element class space index and storing: determining a space index starting point and a grid value according to the geometric range of the pipeline element map layer, and respectively creating space indexes for pipeline point element classes and pipeline line element classes; calculating the grid range of the pipeline element and storing the grid codes;
and/or adding element class paging indexes and storing: determining a paging index starting point and a grid value according to the geometric ranges of the pipeline point element layers and the pipeline line element layers, and creating paging indexes for pipeline point element types and pipeline line element types; and calculating the grid position of the pipeline element, and storing the grid code, the grid geometric information and the grid attribute information.
Pipeline data is a type of vector data having a particular topology. It includes pipeline points, pipeline lines, pipeline surfaces, pipeline auxiliary lines and pipeline markers. The pipeline line data is line data connected end to end, the pipeline line data is a line segment with a starting point and a stopping point, and the starting point and the stopping point are always completely coincided and correspond to certain pipeline point data. The pipeline data does not have the suspension and intersection condition, namely the end point of the pipeline data is necessarily coincident with the end point of another pipeline data, or the pipeline data exists independently and does not have the relation with other line segments. Therefore, the pipeline data has a specific topological structure, namely the end points of the pipeline data are connected one by one, and when the auxiliary line is generated, the topological relation does not need to be calculated by intersecting line segments, and the auxiliary line can be obtained according to the superposition relation of the points.
In this embodiment, each pipeline segment includes a first end point and a second end point, and the process of calculating the feature point of the pipeline auxiliary line according to the spatial coordinate of the pipeline and the element class index includes: and calculating a first characteristic point of the pipeline auxiliary line according to the first endpoint and the element class index, and calculating a second characteristic point of the pipeline auxiliary line according to the second endpoint and the element class index, wherein the first characteristic point and the second characteristic point are obtained by translating the endpoints towards the normal direction of the pipeline, and the translation distance is the radius of the pipeline.
For convenience of description, we will refer to the first endpoint as the head point and the second endpoint as the tail point.
A structural body ConnectLine is defined to represent the topological connection condition of a line segment, and all connecting lines listfirstlink line (stored by pointer arrays of the ConnectLine type) of the head point of the line segment, all connecting lines listnextLine of the tail point, id of the line segment, spatial data of the line segment, a flag indicating whether the line segment participates in generation, a left feature point flp of the head point, a right feature point frp, a left feature point nlp of the tail point, a right feature point nrp, and a feature point connecting line array extLine are respectively stored. The characteristic points flp, frp, nlp and nrp are all characteristic points obtained after the end point of each line segment is translated towards the normal direction of the line segment, and the translation distance is the radius of the pipeline.
A structure ConnectPnt is defined, which represents the topological connection of the head point or the tail point of a line segment. Which respectively store a pointer line (type is connectifly) of its corresponding topological segment and an index value idx (representing whether it is a head point or a tail point, and having a value of 0 or 1).
A pointer array vecconnectilines of the connectinline type and a pointer array vecconnectipnts of the connectipnt type are defined.
And circularly traversing the array _ lines, and setting the current index as i. A ConnectLine object cl is newly created, and array _ ids [ i ], array _ lines [ i ] and array _ flags [ i ] are respectively assigned to corresponding items of cl. Cl is then added to the array vecconnectilines.
In the process of creating a pipeline class, vecConnectlines is traversed, and the current ConnectLine object pointer is set to cl. Newly building a ConnectPnt object p0, assigning cl to line of p0, assigning idx of p0 to 0, and adding p0 into vecConnectPnts; and creating a ConnectPnt object p1, assigning cl to the line of p1, assigning idx of p1 to 1, and adding p1 into vecConnectPnts.
In the process of creating the spatial index, a grid G with a size GridSizeX ×, gridSizeY is defined by a predefined grid size GridSizeX, gridSizeY (generally determined according to the size of the data set or set to a fixed value). The grid type is pointer array of ConnectPnt type, i.e. defining an array of vector < ConnectPnts > of size GridSizeX and GridSizeY, which is vecvecvecConnectPnts.
After the traversal completes vecConnectPnts, connectPnt in vecConnectPnts is actually added to the grid index. However, in order to improve the efficiency of the algorithm and speed up the searching of the adjacent point, the above process can be modified. Specifically, the storage in the grid is changed to vecvecvecveccconnectpntssortedbyx and vecvecveccconnectpntssortedbyy, and the object pointers of ConnectPnt are stored in the two arrays in the grid, respectively. Then after the above process is completed, there will actually be two arrays of ConnectPnt pointers of the same size in each grid and the contents of their stores will be the same. While SortedByX and SortedByY are the meanings, connectPnt is to be sorted according to X and Y coordinates, and the concrete method is as follows:
traversing grid G, if the current index is i, then vecvecvecvecConnectPntsSortedByX [ i ] and vecvecConnectPntsSortedByY [ i ] are the arrays storing the ConnectPnt pointer, respectively. Quick sorting is performed on vecvecvecConcnectPntsSortedByX [ i ], and the objects of two ConnectPnt are respectively p1 and p2, and the comparison condition is that p1- > line- > line [ p1- > idx ]. X < p2- > line- > line [ p2- > idx. (the first line is the ConnectLine, the second is its spatial object, and the index can access the point object). Fast sorting was performed on vecvecvecConcnectPntsSortedByY [ i ], with the comparison condition being p1- > line- > line [ p1- > idx ]. Y < p2- > line- > line [ p2- > idx ]. Y. After the grid G is traversed, the establishment of the grid index and the ordering of the connection points are completed.
In the process of creating the pipeline class, if the current pipeline type is a drain, before traversing vecconnectilines, a drainage direction auxiliary line flow needs to be generated, and the flow of generating the drainage direction auxiliary line is as follows:
and circularly traversing the array _ lines, and setting the current index as i. And (3) taking the starting point elevation and the stopping point elevation corresponding to the current line data from array _ attrs [ i ], calculating the center point coordinates centrX and centrY of the current line segment, and calculating the length of the current line segment. Let dX be 0.5/length (p1. X-p0. X) and dY be 0.5/length (p1. Y-p0. Y) (p 0, p1 are the start and stop points of the line segment, respectively). If the height of the starting point is greater than that of the stopping point, the water flow direction is taken as the starting point and flows to the stopping point, the coordinates otherX of the stopping point at the other end of the arrow head of the auxiliary line in the drainage direction are centrX + dX, and otherY is centrY + dY; otherwise, otherX is cenerX-dX and otherY is cenerY-dY. Thus, two points of the arrow shaft of the drainage direction auxiliary line are found.
Two segments of the arrows of the auxiliary drainage direction line are searched below. Wherein the coordinates of the tip of this arrow are otherX, otherY. In addition, the coordinates of the waist part of the left arrow need to be searched. The azimuth of the arrow shaft, i.e. the azimuth of the line connecting the center point and the other point, is first calculated. Let the azimuth angle from the left waist to the arrow be lazimuth, the azimuth angle from the right waist to the arrow be razimuth, and the angle of the arrow to be expressed be 30 degrees (which may be any angle, and is set to be 30 degrees for convenience), then lazimuth = azimuth-30/2; razimuth = azimuth +30/2. Let lx = arrowength sin (lazimuth) and ly = arrowength cos (lazimuth) if the length of the arrow is arrowength and arrowength is 1 (any desired length is acceptable); rx = arrowtength sin (razimuth), ry = arrowtength cos (razimuth). Then point lp (otherX + lx, otherY + ly) is the coordinate of the left waist of the arrow and point rp (otherX + rx, otherY + ry) is the coordinate of the right waist of the arrow. After the corresponding coordinates are combined into auxiliary line segments and corresponding attribute values are added, auxiliary lines in the drainage direction are generated.
104, calculating the characteristic points of the pipeline auxiliary line according to the spatial coordinates of the pipeline and the element class indexes;
wherein, the characteristic point of the auxiliary line of the pipeline is calculated by the following substeps:
step 104.1, traversing vecConnectlines, and setting the current ConnectLine pointer to be cl. Let p be cl- > line [0], that is, p be the head end point of the line segment corresponding to cl, and perform a spatial query on all connectictpnts around p according to a certain tolerance size r (which may be set by the user or may be set as a fixed value, for example, 0.01), and store the space query into an object listconnectictpnts of the type vector < connectictpnt >.
The specific method for the space query comprises the following steps:
the coordinates of the query point p (x, y) plus the tolerance size r are used to generate a query rectangle whose xmin, ymin, xmax, ymax are x-r, y-r, x + r, y + r, respectively. The grid index values of the grid G in which the coordinates of the four vertices of the query rectangle are located are respectively calculated, and all the grids covered by the grid in which the four vertices are located are found (xmin _ idx, ymin _ idx), (xmax _ idx, ymin _ idx), (xmin _ idx, ymax _ idx), (xmax _ idx, ymax _ idx), so that all the covered grids are all the grids whose row numbers are ymin _ idx to ymax _ idx and column numbers are xmin _ idx to xmax _ idx). Since in this application it is the end points to be found that are connected together, the value of the margin r is set very small, and therefore at most four grids.
For each found lattice, find its corresponding sorted array of vecConnectPntsSortedByX. For vecConnectPntsSortedByX, the point value of (X-r, y-r) is used for searching the lower limit index value, the point value of (X + r, y + r) is used for searching the upper limit index value, and the comparison condition is the comparison condition of the X value in the previous sorting method. After the index values of the upper bound and the lower bound are found, if the index value minus the index value of the lower bound is less than 10, namely the number of elements meeting the interval condition is less than 10, all ConnectPnt from the index value of the lower bound to the index value of the upper bound is directly traversed, if the y value of the ConnectPnt is in the range from y-r to y + r, the requirement of a result is met, and a ConnectPnt pointer of the ConnectPnt is added into a result set setResult of each grid.
If the difference between the upper bound index value and the lower bound index value is greater than or equal to 10, the temporary result is considered to be more, and further query is necessary, then, if the method is processed, vecConnectPntSortedByY, the lower bound index value is searched by the point value of (x-r, Y-r), the upper bound index value is searched by the point value of (x + r, Y + r), and the comparison condition is the comparison condition of the Y value in the foregoing sorting method. In this case, the values of the upper and lower bounds of the result for vecConnectPntsSortedByX may result in a set setResultX, and for vecConnectPntsSortedByY a set setResultY. And traversing setResultY at this time, if the element of the setResultY exists in setResultX, adding the result into setResult, and finally obtaining a result set setResult of the single grid.
For setresults found for each grid, the results are merged. The specific method comprises the following steps: and building an empty setResultAll, traversing the setResult elements of each grid, and if no current element exists in the setResultAll, adding the current element into the setResultAll to finally obtain a union of all the results.
This completes the above-described spatial query operation.
Step 104.2, define an array listfont connectictpnts. It is a ConnectPnt type pointer array. Traversing an array listConnectPnts, and for a current ConnectPnt object cp, if cp- > line = = cl, continuing; (encounter itself), otherwise find cp corresponding point space object p1 (cp- > line- > line [ cp- > idx ]). If p is less than r away from p1, then the current cp is added to the listFoundConnectPnts. This step is to ensure that the queried ConnectPnt is within tolerance.
Next, the listFoundConnectPnts is traversed. For the current ConnectPnt object cp, if the listfirstLine of cl does not contain cp- > line, cp- > line is added to the listfirstLine of cl. If the cp- > idx is 0, judging that the listfirstlink of the cp- > line does not contain cl, and adding cl into the listfirstlink of the cp- > line. Otherwise, if the cp- > idx is 1, judging that the listnextLine of the cp- > line does not contain cl, and adding cl into the listnextLine of the cp- > line.
Similarly, let p be cl- > line [1], that is, p be the end point of the line segment corresponding to cl, perform a spatial query on all connectictpnt around p according to a certain tolerance r, and store the space query into the object listconnectictpnts of vector < connectictpnt > -type. And then the listFoundConnectPnts are obtained through distance filtering. Traverse listFoundConnectPnts. For the current ConnectPnt object cp, if the listnextLine of cl does not contain cp- > line, cp- > line is added to the listnextLine of cl. If the cp- > idx is 0, judging that the listfirstLine of the cp- > line does not contain cl, and adding cl into the listfirstLine of the cp- > line. Otherwise, if the cp- > idx is 1, judging that the listnextLine of the cp- > line does not contain cl, and adding cl into the listnextLine of the cp- > line.
Therefore, the index building work of the head and tail end point connection pipeline of each pipeline is completed, namely for each pipeline, the pipeline connected with the pipeline can be found out through the listfirstLine and listnextLine of the pipeline.
104.3, after the index of the head and tail end points of the pipeline is established to be connected with the pipeline, calculating the characteristic points of the auxiliary line according to the space coordinates of the head and tail end points, and specifically comprising the following substeps:
and step 104.3.1, let r be the radius of the pipeline, and firstly determine the index of the left connecting line.
Specifically, findLeft, i.e., find the index of the connecting line whose azimuth angle azimuth is first to its left in azimuths. Let max be-10000, actmax be-10000, maxidx be-1, and actmaxidx be-1. Traversing azimuths, setting the current index as i, if azimuths [ i ] is less than azimuth and azimuths [ i ] is greater than actmax, then actmax is assigned as azimuths [ i ], and actmaxidx is assigned as i. If azimuths [ i ] is greater than max, max is assigned azimuths [ i ] and maxidx is assigned i. After traversing, if the actmaxidx is greater than or equal to 0, returning to the actmaxidx; otherwise, maxidx is returned.
And step 104.3.2, determining the index of the right connecting line.
FindRight, i.e., find the index of the connecting line whose azimuth angle azimuth is first to its right in azimuths. Let min be 10000, actmin be 10000, minidx be-1, actminidx be-1. Traversing azimuths, setting the current index as i, if azimuths [ i ] is greater than azimuth and azimuths [ i ] is less than actmin, then actmin is assigned as azimuths [ i ], and actminidx is assigned as i. If azimuths [ i ] is less than min, then min is assigned azimuths [ i ] and minidx is assigned i. After traversing, if actminidx is more than or equal to 0, returning to actminidx; otherwise, minidx is returned.
Step 104.3.3,
And calculating a coordinate increment calcDeltaXY function, and setting a parameter list of the calcDeltaXY function as X0, Y0, X1, Y1, r, deltaX and deltaY. Let dy = Y1-Y0, dx = X1-X0.dy1 has an initial value of 0 and dx1 has an initial value of 0.
If dx is equal to 0, then dx1 is-r and dy1 is 0 if dy is greater than 0. Otherwise, dx1 is r and dy1 is 0.
Otherwise, let k = dy/dx. Let val = r sqrt (k/(1 + k)); valy = r sqrt (1/(1 + k). If dy is greater than 0, dx1 is-val; otherwise dx1 is val. If dx is greater than 0, dy1 is valy; otherwise dy1 is-valy.
deltaX is dx1 and deltaY is dy1.
This concludes the calcdeltaXY function.
Step 104.3.4,
The parameter list of the K function is (x 0, y0, x1, y 1). Returning (y 1-y 0)/(x 1-x 0).
Step 104.3.5,
The parameter list of the b function is (x 0, y0, x1, y 1). Return (x 1 x y0-x0 x y 1)/(x 1-x 0).
Step 104.3.6,
calcCrossXY, which is the intersection point of the pipelines corresponding to the calculated pipeline cl and the calculated pipeline lindex or the intersection point of the extension lines thereof, is set as the parameter list x0, y0, x1, y1, x2, y2, r1, r2, bValidL, xL and yL. bValidL, xL, yL are output parameters. The algorithm is as follows:
deltaXf and deltaYf are defined representing the x, y coordinate increment of the left side of the first line ((x 0, y 0), (x 1, y 1)) by a distance r1 along the normal; deltaXn, deltaYn represents the x, y coordinate increment of the left side of the second line ((x 1, y 1), (x 2, y 2)) by a distance r2 along the normal. The calculation method is that a calcDeltaXY method is called: transmitting parameters x0, y0, x1, y1, r1, deltaXf and deltaYf into deltaXf and deltaYf; parameters x1, y1, x2, y2, r2, deltaXn, deltaYn are imported to get deltaXn, deltaYn.
Let dxf = x1-x0, dxn = x2-x1, dyf = y1-y0, dyn = y2-y1.
If dxf equals 0 and dxn equals 0, i.e. both lines are vertical and on the same line, xL is x1+ detalXf and yL is y1. If r1 and r2 are not equal, then bValidL is false and the routine returns.
If dxf is equal to 0 but dxn is not equal to 0, let kn = K (x 1, y1, x2, y 2), bn = b (x 1+ deltaXn, y1+ deltaYn, x2+ deltaXn, y2+ deltaYn). Where K is the slope function and b is the intercept function, corresponding to K and b in the linear expression y = Kx + b. Then xL is x1+ deltaXf and yL is kn × xL + bn.
If dxf is not equal to 0 but dxn is equal to 0, let kf = K (x 0, y0, x1, y 1), bf = b (x 0+ deltaXf, y0+ deltaYf, x1+ deltaXf, y1+ deltaYf). Then xL is x1+ deltaXn and yL is kf × xL + bf.
If dxf is not equal to 0 and dxn is not equal to 0, let kn = K (x 1, y1, x2, y 2), bn = b (x 1+ deltaXn, y1+ deltaYn, x2+ deltaXn, y2+ + deltaYn), kf = K (x 0, y0, x1, y 1), bf = b (x 0+ deltaXf, y0+ deltaYf, x1+ deltaXf, y1+ deltaYf). If kf equals kn: if r1 is equal to r2, xL is x1+ deltaXf, yL is y1+ deltaYf, bValidL is true, and the procedure returns; otherwise, bValidL is false and the routine returns. If kf is not equal to kn, xL is (bn-bf)/(kf-kn) and yL is (kf x bn-kn x bf)/(kf-kn).
Finally, let dLf = yL- (y 0+ deltaYf), dLn = yL- (y 2+ deltaYn). If dLf dyf <0 or dLn dyn >0, then bValidL is false, otherwise bValidL is true and the program returns. This step is to determine the positional relationship between the final intersection and the line segments ((x 0, y 0), (x 1, y 1)) and ((x 1, y 1), (x 2, y 2)). If the intersection point is beyond the normal radiation range of the line segment, the intersection point is considered invalid.
This time the calcocrossxy function ends.
104.3.7, calculating characteristic points of the auxiliary lines;
calculating the feature points on the left side of the auxiliary line: if cl- > flp = = NULL or cl- > frp = = NULL, the following steps are performed: let (x 1, y 1) be cl- > line [0], i.e., the head of the pipeline corresponding to cl, and (x 2, y 2) be the tail of the pipeline corresponding to cl. If cl- > listfirstLine is not 0 in length, a lindex and rindex are defined, representing the index of the left-referenced connecting line and the index of the right-referenced connecting line, respectively. If cl- > listfirstLine has a length of 1, then there is only one connecting line at this time, and the values of lindex and rindex are 0. Otherwise, the azimuth of the ray of the current connecting line cl from the head point to the tail point is calculated. And traversing cl- > listfirstLine, and calculating the azimuth angle of each corresponding connecting line. At this time, attention is paid to the direction of the calculated azimuth. The azimuth direction should be calculated from the point corresponding to (x 1, y 1). Therefore, let the currently traversed ConnectLine be a line, if line- > listfirstlLine contains cl, it means that the line's head is the corresponding (x 1, y 1), and its azimuth is computed from line [0] to line [1] of the line; if not, it is (x 1, y 1) corresponding to the end point, and its azimuth is calculated from line [1] to line [0] of the line. After the azimuth angle is calculated, the azimuth angle is stored in an array azimuths. And then finding the corresponding lindex by using a FindLeft method, and finding the corresponding rindex by using a FindRight method. Unless otherwise specified, the line corresponding to the lindex refers to a line cl- > listfirstLine [ lindex ]; the line corresponding to rundex refers to the line cl- > listfirstLine [ rundex ].
The point (x 3l, y3 l) is defined to indicate the end of the line corresponding to lindex which is not connected to (x 1, y 1). Defining a point (x 3r, y3 r) which represents the end point of the pipeline corresponding to the rindex which is not connected with (x 1, y 1). Definition (rx 3, ry 3) represents the auxiliary line characteristic point of the connecting line to be found. Let rl be the radius of the pipeline to which the lindex corresponds. rr is the radius of the pipe corresponding to rindex.
If cl- > flp is NULL, the feature points on the left need to be calculated. The calculation method comprises the following steps: if the listfirstLine of the pipeline corresponding to the lindex contains cl, namely the listfirstLine of the pipeline corresponding to the linedex corresponds to (x 1, y 1), then (x 3l, y3 l) is the tail end point of the pipeline corresponding to the lindex; otherwise, (x 3l, y3 l) is the head end of the pipeline corresponding to the linedex. The function calcCrossXY is called with the incoming parameters x3l, y3l, x1, y1, x2, y2, rl, r and the outgoing parameters bValidL, lx, ly. Wherein bValidL represents whether the calculated intersection coordinates are valid; (lx, ly) represents the calculated coordinates of the intersection point.
Returning to the previous step, if bValidL is false, the calculation of the intersection point lx, ly fails, and at this time, the normal offset points of the two line segments should be taken respectively and the line is re-connected between the two offset points. The method comprises the following steps: deltaX, deltaY is defined, and DeltaX, deltaY is obtained by transferring (x 1, y1, x2, y2, r, deltaX, deltaY) using calDeltaXY. Lx = x1+ deltaX, ly = y1+ deltaY. Flp for cl is (lx, ly). Let this point be A.
DeltaX3, deltaY3 are defined, and DeltaX3, deltaY3 are obtained by transferring (x 1, y1, x3l, y3l, rl, deltaX3, deltaY 3) using calcDeltaXY. Rx3= x1-deltaX3, ry3= y1-deltaY3.
If listfirstlink line of the corresponding pipeline of the lindex contains cl, namely the head end of the corresponding pipeline of the lindex corresponds to (x 1, y 1), frp of the corresponding pipeline of the lindex is (rx 3, ry 3), otherwise nlp of the corresponding pipeline of the lindex is (rx 3, ry 3). Let this point be B. Finally, line segment AB is generated and added to extLine of cl.
If bValidL is true, the calculation of the intersection lx, ly is successful. Then the flp of cl is (lx, ly). If listfirstlink line of the line corresponding to lindex contains cl, i.e. the head end of the line corresponding to lindex corresponds to (x 1, y 1), frp of the line corresponding to lindex is flp of cl. Otherwise, nlp of the pipeline corresponding to the lindex is flp of cl.
Until now, the calculation of the feature point on the left side is completed, and the feature point on the left side of the auxiliary line is calculated below.
If the listfirstLine of cl has a length of 1, i.e., lindex and lindex are equal to the same line, then the symmetry feature can be used to find rx = x1 × 2-lx and ry = y1 × 2-ly. The frp of cl is (rx, ry). Let it be point a. If bValidL is false, let lx3= x1 × 2-rx3, ly3= y1 × 2-ry3. If listfirstLine of the corresponding pipeline of redex contains cl, i.e. the head end of the corresponding pipeline of redex corresponds to (x 1, y 1), flp of the corresponding pipeline of redex is (lx 3, ly 3). Otherwise, nrp of the line corresponding to rindex is (lx 3, ly 3). Let it be point B. Finally, a segment AB is generated and added to the extLine of cl. If bValidL is true, if the listfirstLine of the pipeline corresponding to the rindex contains cl, the flp of the pipeline corresponding to the rindex is the frp of cl; otherwise, nrp for the line corresponding to rindex is frp for cl.
If the length of the listfirstLine of cl is not 1, it is similar to the left-hand feature point. The calculation method comprises the following steps:
if the listfirstLine of the pipeline corresponding to the rindex contains cl, namely the listfirstLine of the pipeline corresponding to the rindex corresponds to (x 1, y 1), then (x 3r, y3 r) is the tail end point of the pipeline corresponding to the rindex; otherwise, (x 3r, y3 r) is the head end of the pipeline corresponding to rindex. The function calcCrossXY is called with the incoming parameters x2, y2, x1, y1, x3r, y3r, r, rr and the outgoing parameters bValidR, rx, ry. Wherein bValidR represents whether the calculated intersection point coordinates are valid; (rx, ry) represents the calculated intersection coordinates.
If the bValidR is false, that is, the intersection point rx, ry is calculated to fail, at this time, the normal offset points of the two line segments should be taken respectively, and the line is re-connected between the two offset points. The specific method comprises the following steps: deltaX, deltaY is defined, and DeltaX, deltaY is obtained by transferring (x 1, y1, x2, y2, r, deltaX, deltaY) using calcDeltaXY. Rx = x1-deltaX, ry = y1-deltaY. Frp for cl is (rx, ry). Let this point be A.
deltaX3, deltaY3 are defined, and deltaX3, deltaY3 are obtained by transferring (x 1, y1, x3r, y3r, rr, deltaX3, deltaY 3) using calcdaxy. Rx3= x1+ deltaX3, ry3= y1+ deltaY3.
If the listfirstLine of the pipeline corresponding to the rindex contains cl, namely the head end of the pipeline corresponding to the rindex corresponds to (x 1, y 1), the flp of the pipeline corresponding to the rindex is (rx 3, ry 3), otherwise, the nrp of the pipeline corresponding to the rindex is (rx 3, ry 3). Let this point be B. Finally, a segment AB is generated and added to the extLine of cl.
If bValidR is true, then the intersection rx is calculated, ry is successful. Then frp of cl is (rx, ry). If listfirstLine of the corresponding pipeline of rindex contains cl, i.e. the head end of the corresponding pipeline of rindex corresponds to (x 1, y 1), flp of the corresponding pipeline of rindex is frp of cl. Otherwise, nrp for the line corresponding to rindex is frp for cl.
So far, the discussion is finished on the condition that the length of the listfirstLine of cl is not zero.
Next, the case where the listfirstLine of cl has a length of zero is discussed. In this case, since there is no connecting line, the method of generating the auxiliary line is relatively simple, that is, the normal line offset points on both sides of the head point may be calculated. However, the auxiliary line needs to be extended a little at the end of the line to close the auxiliary line, and the length R that needs to be extended is not provided. First, deltaX, deltaY are defined. deltaX, deltaY are calculated by calcdaxy with parameters x1, y1, x2, y2, r, deltaX, deltaY. Let lx = x1+ deltaX, ly = y1+ deltaY, rx = x1-deltaX, ry = y1-deltaY. Then flp of cl is (lx, ly) and frp is (rx, ry). Ixe, lye, rxe, rye are defined. And calling GetPennparallel with the parameters of x1, y1, x2, y2, lx, ly, -R, lxe and lye to obtain lxe and lye. And calling GetPtnParalline with the parameters of x1, y1, x2, y2, rx, ry, -R, rxe and rye to obtain rxe and rye. The frp of cl, (rxe, rye), (lxe, lye), the flp of cl are sequentially connected into a line segment, and added to the extLine of cl.
Step 104.3.8,
The GetPtOnparallel function is implemented as follows:
list of parameters: x1, y1, x2, y2, xp, yp, length, x, y. x, y are outgoing parameters.
Let len1 be equal to the length of the line segment ((x 1, y 1), (x 2, y 2)), dx = x2-x1, dy = y2-y1.
Let rate = length/len1. Then x = xp + dx rate, y = yp + dy rate. And obtaining parallel line points to be solved.
The above calculation is completed when flp of cl is empty or frp is empty.
Step 104.3.9, the calculation of either nlp or nrp for cl being empty is completed.
Let (x 1, y 1) be cl- > line [1], i.e., the tail end of the pipeline corresponding to cl, and (x 2, y 2) be the head end of the pipeline corresponding to cl. If the length of cl- > listnextLine is not 0, a lindex and rindex are defined, representing the index of the connection line referenced on the left and the index of the connection line referenced on the right, respectively.
If cl- > listnextLine has a length of 1, then there is only one connecting line at this time, and the values of lindex and rindex are 0. Otherwise, the azimuth of the ray of the current connecting line cl from the end point to the head point is calculated. And go through cl- > listnextLine, calculate the azimuth angle of each corresponding connecting line. At this time, attention is paid to the direction of the calculated azimuth. The azimuth direction should be calculated from the point corresponding to (x 1, y 1). Therefore, let the currently traversed ConnectLine be a line, if line- > listfirstlLine contains cl, it means that the line's head is the corresponding (x 1, y 1), and its azimuth is computed from line [0] to line [1] of the line; if not, it is (x 1, y 1) corresponding to the end point, and its azimuth is calculated from line [1] to line [0] of the line. After the azimuth angle is calculated, the azimuth angle is stored in an array azimuths. And then finding the corresponding lindex by using a FindLeft method, and finding the corresponding lindex by using a FindRight method. Unless otherwise specified, the line corresponding to lindex refers to the line cl- > listnextLine [ lindex ]; the corresponding line for rindex refers to the line cl- > listnextLine [ rindex ].
The point (x 3l, y3 l) is defined to indicate the end of the line corresponding to lindex that is not connected to (x 1, y 1). Defining a point (x 3r, y3 r) which represents the end point of the pipeline corresponding to the rindex which is not connected with (x 1, y 1). (rx 3, ry 3) is defined to indicate the auxiliary line characteristic point of the connecting line to be found. Let rl be the radius of the pipeline to which the lindex corresponds. rr is the radius of the pipeline for rindex.
If cl- > nrp is NULL, the feature point on the right needs to be calculated. The calculation method comprises the following steps: if the listfirstLine of the pipeline corresponding to the lindex contains cl, namely the listfirstLine of the pipeline corresponding to the linedex corresponds to (x 1, y 1), then (x 3l, y3 l) is the tail end point of the pipeline corresponding to the lindex; otherwise, (x 3l, y3 l) is the head end of the pipeline corresponding to the lindex. The function calcCrossXY is called with the incoming parameters x3l, y3l, x1, y1, x2, y2, rl, r and the outgoing parameters bValidR, rx, ry. Wherein bValidR represents whether the calculated intersection point coordinates are valid; (rx, ry) represents the calculated intersection coordinates.
If the bValidR is false, that is, the intersection point rx, ry is calculated to fail, at this time, the normal offset points of the two line segments should be taken respectively, and the line is re-connected between the two offset points. The method comprises the following steps: deltaX, deltaY is defined, and DeltaX, deltaY is obtained by transferring (x 1, y1, x2, y2, r, deltaX, deltaY) using calcDeltaXY. Rx = x1+ deltaX, ry = y1+ deltaY. Nrp of cl is (rx, ry). Let this point be A.
DeltaX3, deltaY3 are defined, and DeltaX3, deltaY3 are obtained by transferring (x 1, y1, x3l, y3l, rl, deltaX3, deltaY 3) using calcDeltaXY. Rx3= x1-deltaX3, ry3= y1-deltaY3.
If listfirstlink line of the corresponding pipeline of the lindex contains cl, namely the head end of the corresponding pipeline of the lindex corresponds to (x 1, y 1), frp of the corresponding pipeline of the lindex is (rx 3, ry 3), otherwise nlp of the corresponding pipeline of the lindex is (rx 3, ry 3). Let this point be B. Finally, a segment AB is generated and added to the extLine of cl.
If bValidR is true, then the intersection rx is calculated, ry is successful. Then nrp of cl is (rx, ry). If the listfirstLine of the line corresponding to the lindex contains cl, i.e. the head end of the line corresponding to the lindex corresponds to (x 1, y 1), the frp of the line corresponding to the lindex is nrp of cl. Otherwise, nlp of the line corresponding to lindex is nrp of cl.
So far, the right feature point is completely calculated, and then the left feature point is calculated.
If the listnextLine of cl has a length of 1, i.e., lindex and lindex are equal to the same line, then the symmetry feature can be used to find lx = x1 × 2-rx and ly = y1 × 2-ry. Nlp of cl is (lx, ly). Let it be point a. If bValidR is false, let lx3= x1 × 2-rx3, ly3= y1 × 2-ry3. If the listfirstLine of the pipeline corresponding to the rindex contains cl, namely the head end of the pipeline corresponding to the rindex corresponds to (x 1, y 1), the flp of the pipeline corresponding to the rindex is (lx 3, ly 3). Otherwise, nrp of the line corresponding to rindex is (lx 3, ly 3). Let it be point B. Finally, line segment AB is generated and added to extLine of cl. If bValidR is true, if the listfirstLine of the pipeline corresponding to the rindex contains cl, the flp of the pipeline corresponding to the rindex is nlp of cl; otherwise, nrp of the line corresponding to rindex is nlp of cl.
If the length of the listnextLine of cl is not 1, it is similar to the feature point to the right. The calculation method comprises the following steps:
if listfirstLine of the corresponding pipeline of redex contains cl, i.e. it is the corresponding (x 1, y 1) of its head-end point, (x 3r, y3 r) is the corresponding tail-end point of the corresponding pipeline of redex; otherwise, (x 3r, y3 r) is the head end of the pipeline corresponding to the rindex. The function calcCrossXY is called with the incoming parameters x2, y2, x1, y1, x3r, y3r, r, rr and the outgoing parameters bValidL, lx, ly. Wherein bValidL represents whether the calculated intersection coordinates are valid; (lx, ly) represents the calculated coordinates of the intersection.
If bValidL is false, i.e. the calculation of the intersection point lx, ly fails, then the normal deviation points of the two line segments should be taken separately, and the line is re-connected between the two deviation points. The specific method comprises the following steps: deltaX, deltaY is defined, and DeltaX, deltaY is obtained by transferring (x 1, y1, x2, y2, r, deltaX, deltaY) using calcDeltaXY. Lx = x1-deltaX, ly = y1-deltaY. Nlp of cl is (lx, ly). Let this point be A.
deltaX3, deltaY3 are defined, and deltaX3, deltaY3 are determined using calcdaxy, afferent (x 1, y1, x3r, y3r, rr, deltaX3, deltaY 3). Rx3= x1+ deltaX3 and ry3= y1+ deltaY3.
If the listfirstLine of the pipeline corresponding to the rindex contains cl, namely the head end of the pipeline corresponding to the rindex corresponds to (x 1, y 1), the flp of the pipeline corresponding to the rindex is (rx 3, ry 3), otherwise, the nrp of the pipeline corresponding to the rindex is (rx 3, ry 3). Let this point be B. Finally, a segment AB is generated and added to the extLine of cl.
If bValidL is true, then the calculation of the intersection point lx, ly is successful. Then nlp of cl is (lx, ly). If the listfirstLine of the pipeline corresponding to the rindex contains cl, namely the head end of the pipeline corresponding to the rindex corresponds to (x 1, y 1), the flp of the pipeline corresponding to the rindex is nlp of cl. Otherwise, nrp of the line corresponding to rindex is nlp of cl.
So far, the case that the length of the listnextLine of cl is not zero is discussed.
Next, the case where the length of the listnextLine of cl is zero is discussed. In this case, since there is no connecting line, the method of generating the auxiliary line is relatively simple, that is, the normal line offset points on both sides of the head point may be calculated. However, the auxiliary line needs to be extended a little at the end of the line to close the auxiliary line, and the length R that needs to be extended is not provided. First, deltaX, deltaY is defined. DeltaX, deltaY are calculated by calcDeltaXY with parameters x1, y1, x2, y2, r, deltaX, deltaY. Let lx = x1-deltaX, ly = y1-deltaY, rx = x1+ deltaX, ry = y1+ deltaY. Then nlp of cl is (lx, ly) and nrp is (rx, ry). Ixe, lye, rxe, rye are defined. And calling GetPennparallel with the parameters of x1, y1, x2, y2, lx, ly, -R, lxe and lye to obtain lxe and lye. And calling GetPtOnParalleline with the parameters of x1, y1, x2, y2, rx, ry, -R, rxe and rye to obtain rxe and rye. Nrp of cl, (rxe, rye), (lxe, lye), nlp of cl are sequentially connected into a line segment, and added to extLine of cl.
And 105, generating a first pipeline auxiliary line according to the characteristic points of the pipeline auxiliary line, and adding the pipeline mark to the corresponding first pipeline auxiliary line.
The first feature point and the second feature point generated in step 104 are connected. Specifically, vecConnectlines are traversed, and flp and nlp of each connecting line object cl are connected to obtain a left auxiliary line; the frp and nrp were connected to obtain the right auxiliary line. The extLine of cl is traversed and each additional connected line segment is generated. And adding a pipeline mark to each auxiliary line generated, and assigning a corresponding attribute to each auxiliary line by utilizing the attribute value in the array _ attrs recorded previously. So far, the algorithm for generating all the auxiliary lines of the pipeline is completed.
According to the embodiment of the invention, the pipeline data meeting the preset conditions are screened, the space coordinates of the pipelines in the corresponding area are obtained according to the actual requirements, the characteristic points of the pipeline auxiliary lines are calculated according to the space coordinates and the element index, and the first pipeline auxiliary line is generated, so that the calculation amount for generating the pipeline auxiliary lines in the topological structure can be simplified, and the efficiency for generating the pipeline auxiliary lines is improved.
It should be noted that for simplicity of description, the method embodiments are shown as a series of combinations of acts, but those skilled in the art will recognize that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those of skill in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the embodiments of the invention.
In order to implement the foregoing method, an embodiment of the present invention further provides an apparatus for generating a pipeline auxiliary line, and fig. 2 is a block diagram of a structure of the apparatus for generating a pipeline auxiliary line according to the embodiment of the present invention, where the apparatus includes:
the pipeline data acquiring module 201 is configured to acquire a pipeline name of pipeline data according to a first preset condition, where the pipeline data includes a plurality of pipeline segments and a pipeline flag;
the pipeline coordinate acquisition module 202 is configured to perform spatial query on the pipeline data according to a second preset condition, and determine a spatial coordinate of the pipeline according to a spatial reference coordinate system;
an index creating module 203, configured to create a pipeline class and add an element class index according to the pipeline class, where the pipeline class is created according to the type of the pipeline data and the information of the spatial coordinates;
a feature point calculating module 204, configured to calculate feature points of the pipeline auxiliary line according to the spatial coordinates of the pipeline and the element class index;
a first auxiliary line generating module 205, configured to generate a first pipeline auxiliary line according to the feature points of the pipeline auxiliary line, and add the pipeline marker to the corresponding first pipeline auxiliary line.
In an alternative embodiment, the index creation module 203 may comprise:
the first index creating submodule is used for adding element class database indexes, creating pipeline point element class database indexes and pipeline line element class database indexes and storing database index information;
and/or the second index creating submodule is used for adding element class spatial indexes, determining a spatial index starting point and a grid value according to the geometric range of the pipeline element layer, respectively creating spatial indexes for the pipeline point element class and the pipeline element class, calculating the grid range of the pipeline element, and storing the grid codes.
In an alternative embodiment, each of the sections of the pipeline in the apparatus includes a first end point and a second end point; the feature point calculation module 204 may include:
a first feature point calculation submodule, configured to calculate a first feature point of the pipeline auxiliary line according to the first endpoint and the element class index, where the first feature point is obtained by translating the first endpoint toward a normal direction of the pipeline, and a distance of translation is a radius of the pipeline;
and the second feature point calculation submodule is used for calculating a second feature point of the pipeline auxiliary line according to the second endpoint and the element class index, the second feature point is obtained by translating the second endpoint towards the normal direction of the pipeline, and the translation distance is the radius of the pipeline.
In an alternative embodiment, after obtaining the pipeline name of the pipeline data according to the first preset condition, the apparatus further includes:
the searching module is used for searching a second pipeline auxiliary line corresponding to the pipeline data according to the pipeline name;
and the initialization module is used for deleting the second pipeline auxiliary line and initializing the layer of the pipeline data.
In an alternative embodiment, the first preset condition includes at least one of:
a geographic location of the pipeline;
and/or, the material of the pipeline;
and/or, the size of the pipeline.
In an alternative embodiment, the second preset condition includes at least one of:
the use of the pipeline;
and/or, the extent of use of the pipeline.
The embodiment of the invention has the following advantages: according to the embodiment of the invention, the pipeline data meeting the preset conditions are screened, the space coordinates of the pipelines in the corresponding area are obtained according to the actual requirements, the characteristic points of the pipeline auxiliary lines are calculated according to the space coordinates and the element index, and the first pipeline auxiliary line is generated, so that the calculation amount for generating the pipeline auxiliary lines in the topological structure can be simplified, and the efficiency for generating the pipeline auxiliary lines is improved.
The embodiment of the present invention further provides an electronic device, which includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and when being executed by the processor, the computer program implements each process of the above method for generating a pipeline auxiliary line, and can achieve the same technical effect, and is not described herein again to avoid repetition.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the above-mentioned method for generating an auxiliary pipeline, and can achieve the same technical effect, and in order to avoid repetition, the details are not repeated here.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should also be noted that, in this document, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or terminal device that comprises the element.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.
Claims (8)
1. A method of generating a pipeline assist line, comprising:
acquiring a pipeline name of pipeline data according to a first preset condition, wherein the pipeline data comprises a plurality of sections of pipelines and pipeline marks;
according to a second preset condition, carrying out spatial query on the pipeline data, and determining the spatial coordinates of the pipeline according to a spatial reference coordinate system;
creating a pipeline class and adding an element class index according to the pipeline class, wherein the pipeline class is created according to the type of the pipeline data and the information of the spatial coordinates;
calculating the characteristic points of the pipeline auxiliary line according to the spatial coordinates of the pipeline and the element class indexes;
generating a first pipeline auxiliary line according to the characteristic points of the pipeline auxiliary line, and adding the pipeline mark to the corresponding first pipeline auxiliary line;
wherein each section of the pipeline comprises a first endpoint and a second endpoint;
the calculating the characteristic point of the pipeline auxiliary line according to the spatial coordinate of the pipeline and the element class index comprises the following steps:
calculating a first feature point of the pipeline auxiliary line according to the first endpoint and the element class index, wherein the first feature point is obtained by translating the first endpoint towards the normal direction of the pipeline, and the translation distance is the radius of the pipeline;
calculating a second feature point of the pipeline auxiliary line according to the second endpoint and the element class index, wherein the second feature point is obtained by translating the second endpoint towards the normal direction of the pipeline, and the translation distance is the radius of the pipeline;
the generating of the first auxiliary pipeline line according to the feature points of the auxiliary pipeline line specifically includes: and connecting the generated first characteristic point and the second characteristic point.
2. The method of claim 1, wherein adding the element class index according to the pipeline class comprises:
adding element class database indexes, creating pipeline point element class database indexes and pipeline line element class database indexes, and storing database index information;
and/or adding element class spatial indexes, determining a spatial index starting point and a grid value according to the geometric range of the pipeline element layer, respectively creating spatial indexes for the pipeline point element class and the pipeline element class, calculating the grid range of the pipeline element, and storing grid codes.
3. The method of claim 1, wherein after obtaining the pipeline name of the pipeline data according to the first preset condition, the method further comprises:
searching a second pipeline auxiliary line corresponding to the pipeline data according to the pipeline name;
and deleting the second pipeline auxiliary line and initializing the layer of the pipeline data.
4. The method of claim 1, wherein the first preset condition comprises at least one of:
a geographic location of the pipeline;
and/or, the material of the pipeline;
and/or, the size of the pipeline.
5. The method of claim 1, wherein the second preset condition comprises at least one of:
the use of the pipeline;
and/or, the extent of use of the pipeline.
6. An apparatus for generating a pipeline auxiliary line, comprising:
the pipeline data acquisition module is used for acquiring the pipeline name of pipeline data according to a first preset condition, wherein the pipeline data comprises a plurality of sections of pipelines and pipeline marks;
the pipeline coordinate acquisition module is used for carrying out space query on the pipeline data according to a second preset condition and determining the space coordinate of the pipeline according to a space reference coordinate system;
the index creating module is used for creating a pipeline class and adding an element class index according to the pipeline class, wherein the pipeline class is created according to the type of the pipeline data and the information of the spatial coordinates;
the characteristic point calculation module is used for calculating the characteristic points of the pipeline auxiliary line according to the space coordinates of the pipeline and the element class indexes;
a first auxiliary line generating module, configured to generate a first pipeline auxiliary line according to the feature points of the pipeline auxiliary line, and add the pipeline marker to the corresponding first pipeline auxiliary line;
each section of the pipeline comprises a first endpoint and a second endpoint;
the feature point calculation module includes:
a first feature point calculation submodule, configured to calculate a first feature point of the pipeline auxiliary line according to the first endpoint and the element class index, where the first feature point is obtained by translating the first endpoint toward a normal direction of the pipeline, and a distance of translation is a radius of the pipeline;
a second feature point calculation sub-module, configured to calculate a second feature point of the pipeline auxiliary line according to the second endpoint and the element class index, where the second feature point is obtained by translating the second endpoint toward a normal direction of the pipeline, and a distance of translation is a radius of the pipeline;
the generating of the first auxiliary line according to the feature points of the pipeline auxiliary line by the first auxiliary line generating module specifically includes: and connecting the generated first characteristic point and the second characteristic point.
7. An electronic device, comprising: processor, memory and a computer program stored on the memory and being executable on the processor, the computer program realizing the steps of the method according to any of the claims 1-5 when executed by the processor.
8. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210402545.XA CN114661729B (en) | 2022-04-18 | 2022-04-18 | Method and device for generating pipeline auxiliary line |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210402545.XA CN114661729B (en) | 2022-04-18 | 2022-04-18 | Method and device for generating pipeline auxiliary line |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114661729A CN114661729A (en) | 2022-06-24 |
CN114661729B true CN114661729B (en) | 2023-01-17 |
Family
ID=82034839
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210402545.XA Active CN114661729B (en) | 2022-04-18 | 2022-04-18 | Method and device for generating pipeline auxiliary line |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114661729B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106600468A (en) * | 2015-10-20 | 2017-04-26 | 星际空间(天津)科技发展有限公司 | Geographic-information-based comprehensive pipeline data two-dimensional and three-dimensional integrated organization method |
CN108446488A (en) * | 2018-03-16 | 2018-08-24 | 杭州市建筑设计研究院有限公司 | A kind of intelligentized design quality analysis system based on BIM technology |
WO2021207199A1 (en) * | 2020-04-06 | 2021-10-14 | Saudi Arabian Oil Company | Augmented reality visualization of underground pipelines using geospatial databases and km markers |
-
2022
- 2022-04-18 CN CN202210402545.XA patent/CN114661729B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106600468A (en) * | 2015-10-20 | 2017-04-26 | 星际空间(天津)科技发展有限公司 | Geographic-information-based comprehensive pipeline data two-dimensional and three-dimensional integrated organization method |
CN108446488A (en) * | 2018-03-16 | 2018-08-24 | 杭州市建筑设计研究院有限公司 | A kind of intelligentized design quality analysis system based on BIM technology |
WO2021207199A1 (en) * | 2020-04-06 | 2021-10-14 | Saudi Arabian Oil Company | Augmented reality visualization of underground pipelines using geospatial databases and km markers |
Non-Patent Citations (1)
Title |
---|
基于ArcEngine 的地下管线信息管理系统的设计与应用;崔磊等;《城市勘测》;20181031(第5期);45-48 * |
Also Published As
Publication number | Publication date |
---|---|
CN114661729A (en) | 2022-06-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103177577B (en) | Dynamic traffic information service providing method based on map layer overlapping | |
CN103679804A (en) | System and method for automatically building three-dimensional model of data of underground pipeline | |
CN110321443B (en) | Three-dimensional live-action model database construction method and device and data service system | |
CN106600468A (en) | Geographic-information-based comprehensive pipeline data two-dimensional and three-dimensional integrated organization method | |
CN111540051B (en) | CIM-based full-element mass data lightweight and topology analysis application platform | |
CN106373188B (en) | A kind of generation method and system of underground pipe network threedimensional model | |
CN110929363B (en) | Communication line investigation design method and system | |
CN104700453A (en) | Method for generating three-dimensional model of cable pipe network based on GIS | |
CN112347215A (en) | Method for building three-dimensional railway construction organization design management system | |
CN115641407A (en) | Three-dimensional pipe network incremental updating modeling method and device, storage medium and electronic equipment | |
CN109558643B (en) | Traffic scene modeling and model unitization method | |
CN114661729B (en) | Method and device for generating pipeline auxiliary line | |
CN110189391A (en) | A kind of Electromagnetic Survey of Underground Pipelines drawing formation system | |
CN105447132A (en) | Four-layer geographic data storage system oriented to Internet of Things application | |
CN116737851A (en) | Storage and updating method of node type point cloud map | |
CN116127656A (en) | Bus stop information determining method and device, network equipment and storage medium | |
CN114818064A (en) | Medium-voltage distribution network bank planning method based on multi-project optimization | |
CN111738624B (en) | Region division method and system for solving supply and demand relation balance | |
CN108731688A (en) | Air navigation aid and device | |
CN113609691A (en) | Intersection modeling processing method for intelligent traffic simulation | |
Penninga et al. | Construction of the planar partition postal code map based on cadastral registration | |
CN117853669A (en) | Topology analysis and three-dimensional road network automatic generation method based on low-precision road network | |
Liu et al. | Line simplification algorithm implementation and error analysis | |
CN114281915B (en) | Method, device and equipment for generating geometric road network and storage medium | |
CN113066151B (en) | Map data processing method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |