A Reconstruction Method for Broken Contour Lines Based on Similar Contours

: The reconstruction of a broken contour line is a prerequisite for the automated processing of contour lines. When the situation with broken contour lines is severe or the terrain is more complex, incorrect and missing connections are most likely to occur using traditional methods. In this paper, a reconstruction method for broken contour lines based on similar and completely closed contours is proposed. First, node densiﬁcation is conducted on broken contour lines to improve the identiﬁcation accuracy of the reference line. Second, the discrete Fr é chet distance is used to select a reference line and perform reconstruction. Finally, the actual data of Yunnan Province are utilized for veriﬁcation. The results show that the method proposed in this paper can achieve better reconstruction of broken contour lines, especially for severe broken contour situations or complex terrains; the reconstruction accuracy is signiﬁcantly improved over that of the traditional method, indicating good feasibility.


Introduction
Contour lines are an important element in topographic maps and one of the main data sources for constructing digital elevation models (DEMs), which are 3D models.When extracting contour lines from topographic maps, inevitably, gaps may occur because other features in topographic maps can overlay and cross the contour lines.Gaps cause problems for the generation of DEMs and the construction of 3D simulations [1].The reconstruction of broken contour lines can be realized to form a complete contour line by identifying the degree of matching among broken lines in terms of geometry (e.g., angles and directions), which is known as breakpoint connection.In recent years, scholars have conducted a large number of studies on the reconstruction of broken contour lines.According to the reconstruction form for connecting breaking points, the reconstruction of broken contour lines can be divided into three categories: adjacency-relationship-based [2,3], continuity-based [1,4,5], and gradient-vector-flow-based [6][7][8] reconstruction.This paper focuses on the continuity-based reconstruction of broken contour lines.
The continuity-based reconstruction method, which includes both the geometric and topological characteristics of a contour line, is concise and easy to implement, making it the most commonly used reconstruction method; it completes breakpoint matching and curve reconstruction by identifying the continuity of contour breakpoints via geometric and topological characteristics.Among the various methods, Arrighi et al. [9] proposed the minimum point pair method, which realizes breakpoint connection based on the principle of the minimum breakpoint distance or the minimum directional difference.Samet et al. [4,5] optimized the minimum point pair method to refine the constraint criterion for breakpoint matching and used Newton's difference interpolation algorithm to complete the matching connection of a breakpoint.Gul et al. [3] proposed a breakpoint extension and intersection identification matching method that determines the directions of all broken lines in a region using the distances and direction angles of breakpoints and completes the breakpoint connection where the broken lines intersect.Most reconstruction methods for broken contour lines based on continuity only consider the characteristics of broken contour lines for connection using the Euclidean distance of the interbreakpoint to assist in the reconstruction of breakpoints or azimuthal lines.In the case of a small breakpoint distance and small curvature changes, the reconstruction effect is better.In the case of a large breakpoint distance or large curvature changes, such as saddle-shaped terrain, existing methods have difficulty effectively judging the original trends of broken lines and are prone to incorrect and missing breakpoint connections.Therefore, a reconstruction method for broken contour lines based on a reference line is proposed using similarity to measure the Fréchet distance, and two contour lines with high similarity around the broken contour line are selected as fixed reference lines to assist in the reconstruction of broken contour lines.
This paper is organized as follows.Section 1 analyzes the shortcomings of the existing continuity-based reconstruction method for broken contour lines and proposes an improved idea of a similarity measurement based on the Fréchet distance.Section 2 elaborates on the reconstruction method for broken contour lines based on a reference line.Section 3 describes the actual data experiment and analysis.Section 4 presents the discussion and research conclusions of this work.

Continuity-Based Reconstruction Method of Contour Lines
For the continuity-based method, the Euclidean distance is typically directly used to identify the minimum distance between the breakpoints of a connection to realize the reconstruction of the broken contour line.The Euclidean distance is one of the most commonly used methods for spatial measurements and is applied to describe the real distance between two points in m-dimensional space.If there are two points on the two-dimensional plane (i.e., p i (x i , y i ) and p j x j , y j ), then the Euclidean distance between these two points is calculated as follows: The Euclidean distance can be used to calculate the distance relationship between two breakpoints for the reconstruction of a contour line, and a classic method to accomplish this is the minimum point pair method.As shown in Figure 1, breakpoints A, B, C, and D belong to four broken contour lines (1, 2, 3, and 4, respectively), where the Euclidean distance is used to measure and calculate the minimum distances between each breakpoint and its adjacent contour line.Among them, the minimum distance between breakpoint A and the other breakpoints is calculated as Dmin (A, X) to yield X = B for the connection of breakpoints A and B for the reconstruction of broken contour lines 1 and 2 into a complete contour line.Similarly, breakpoints C and D are connected to reconstruct broken contour lines 3 and 4 into a complete contour line.However, the reconstructed line created with this method is usually a straight line, and when the contour line is complex, the reconstructed line is prone to cross dislocation.For this reason, some scholars have put forward a method to add direction for auxiliary identification (based on the extraction of the interbreakpoint Euclidean distance) and a direction angle [3]; the search window is set to calculate the directions of all breakpoints in the window, which allows the appointed breakpoint and alternative breakpoint in the neighborhood search window to extend in each direction.If the extension lines intersect, the breakpoints are matched and connected; the effect is shown in Figure 2.

Limitations in Existing Methods
The method for the reconstruction of broken contour lines is easy to implement by using the Euclidean distance with an auxiliary direction, making it suitable for the reconstruction of contour lines with a better surface effect, smaller breakpoint distance, and flatter terrain, as shown in Figure 3 A.However, when the following cases occur due to only considering the individual characteristics of a broken contour line for connection, it is difficult to accurately determine the original trend of the broken contour line, making it prone to incorrect and missing connections.
(1) The overall breaking of a contour line is severe, and only a small part of the break remains, as shown in Figure 3 B; (2) The topography of the broken contour line area is complex (e.g., ridges, valleys, and saddles), as shown in Figure 3 C.According to the above two cases, some scholars have put forward the strategy of using breakpoint classification and directional differences for the reconstruction of broken contour lines [10] to enhance the connection effect of a long, broken contour line on flat terrain.However, with the increase in complex breaks, cross dislocation and the number of missing connections greatly increase However, the reconstructed line created with this method is usually a straight line, and when the contour line is complex, the reconstructed line is prone to cross dislocation.For this reason, some scholars have put forward a method to add direction for auxiliary identification (based on the extraction of the interbreakpoint Euclidean distance) and a direction angle [3]; the search window is set to calculate the directions of all breakpoints in the window, which allows the appointed breakpoint and alternative breakpoint in the neighborhood search window to extend in each direction.If the extension lines intersect, the breakpoints are matched and connected; the effect is shown in Figure 2.However, the reconstructed line created with this method is usually a straight line, and when the contour line is complex, the reconstructed line is prone to cross dislocation.For this reason, some scholars have put forward a method to add direction for auxiliary identification (based on the extraction of the interbreakpoint Euclidean distance) and a direction angle [3]; the search window is set to calculate the directions of all breakpoints in the window, which allows the appointed breakpoint and alternative breakpoint in the neighborhood search window to extend in each direction.If the extension lines intersect, the breakpoints are matched and connected; the effect is shown in Figure 2.

Limitations in Existing Methods
The method for the reconstruction of broken contour lines is easy to implement by using the Euclidean distance with an auxiliary direction, making it suitable for the reconstruction of contour lines with a better surface effect, smaller breakpoint distance, and flatter terrain, as shown in Figure 3 A.However, when the following cases occur due to only considering the individual characteristics of a broken contour line for connection, it is difficult to accurately determine the original trend of the broken contour line, making it prone to incorrect and missing connections.
(1) The overall breaking of a contour line is severe, and only a small part of the break remains, as shown in Figure 3 B; (2) The topography of the broken contour line area is complex (e.g., ridges, valleys, and saddles), as shown in Figure 3 C.According to the above two cases, some scholars have put forward the strategy of using breakpoint classification and directional differences for the reconstruction of broken contour lines [10] to enhance the connection effect of a long, broken contour line on flat terrain.However, with the increase in complex breaks, cross dislocation and the number of missing connections greatly increase

Limitations in Existing Methods
The method for the reconstruction of broken contour lines is easy to implement by using the Euclidean distance with an auxiliary direction, making it suitable for the reconstruction of contour lines with a better surface effect, smaller breakpoint distance, and flatter terrain, as shown in Figure 3 A.However, when the following cases occur due to only considering the individual characteristics of a broken contour line for connection, it is difficult to accurately determine the original trend of the broken contour line, making it prone to incorrect and missing connections.
(1) The overall breaking of a contour line is severe, and only a small part of the break remains, as shown in Figure 3 B; (2) The topography of the broken contour line area is complex (e.g., ridges, valleys, and saddles), as shown in Figure 3 C.
According to the above two cases, some scholars have put forward the strategy of using breakpoint classification and directional differences for the reconstruction of broken contour lines [10] to enhance the connection effect of a long, broken contour line on flat terrain.However, with the increase in complex breaks, cross dislocation and the number of missing connections greatly increase [11], which leads to a large workload, including artificial checks and corrections, and the practicality of the method decreases rapidly.ISPRS Int.J. Geo-Inf.2019, 8, x FOR PEER REVIEW 4 of 15 [11], which leads to a large workload, including artificial checks and corrections, and the practicality of the method decreases rapidly.

Improved Idea via the Introduction of Fréchet Distance
According to the above problem, a reconstruction method for broken contour lines based on a reference line is proposed using similarity to measure the Fréchet distance.Two contour lines with high similarity around a broken contour line are selected as the reconstruction reference to realize the node densification of the breakpoint and the reconstruction of the contour line under longdistance breaks and complex terrain environments.
Linear elements, such as contour lines, can be regarded as a set of spatial points, where the geometric similarity is regarded as the similarity of the spatial point set [12].The Hausdorff distance [13] and Fréchet distance [14] are commonly used to measure the similarity of a spatial point set, where the Fréchet distance is typically used to judge the similarity between two consecutive curves [15][16][17].The Fréchet distance includes a continuous Fréchet distance and a discrete Fréchet distance.
Because the points in the actual contour line are discretized, the similarity between contour lines is determined by using the discrete Fréchet distance.The discrete Fréchet distance dF is defined as follows [18]: with n vertices and a k step along P, the vertices of P are segmented into k nonintersecting, nonempty subsets, { } ( ) , where ③ The calculation of a combination step along chains A and B, , is shown below.

Improved Idea via the Introduction of Fréchet Distance
According to the above problem, a reconstruction method for broken contour lines based on a reference line is proposed using similarity to measure the Fréchet distance.Two contour lines with high similarity around a broken contour line are selected as the reconstruction reference to realize the node densification of the breakpoint and the reconstruction of the contour line under long-distance breaks and complex terrain environments.
Linear elements, such as contour lines, can be regarded as a set of spatial points, where the geometric similarity is regarded as the similarity of the spatial point set [12].The Hausdorff distance [13] and Fréchet distance [14] are commonly used to measure the similarity of a spatial point set, where the Fréchet distance is typically used to judge the similarity between two consecutive curves [15][16][17].The Fréchet distance includes a continuous Fréchet distance and a discrete Fréchet distance.Because the points in the actual contour line are discretized, the similarity between contour lines is determined by using the discrete Fréchet distance.The discrete Fréchet distance d F is defined as follows [18]: 1 Given a polygonal chain P = p 1 , p 2 , . . ., p n with n vertices and a k step along P, the vertices of P are segmented into k nonintersecting, nonempty subsets, 3 The calculation of a combination step along chains A and B, W = { (A i , B i )} , is shown below.
Thus, the discrete Fréchet distance between chains A and B is shown below.

The Reconstruction of Broken Contour Lines Based on a Reference Line
In this paper, the foundation for the proposed reconstruction method for broken contour lines based on a reference line consists of three parts: (1) contour line node densification (to improve the identification accuracy of the reference line similarity), (2) the Fréchet distance (for the selection of a reference line), and (3) the interpolation and connection of a broken contour line based on the selected reference line (to complete the reconstruction of a contour line).

Contour Line Node Densification
When using the discrete Fréchet distance to measure contour similarity, if the distance between some contour nodes is too large, the points are relatively sparse and the difference compared to the continuous Fréchet distance is large during the calculation, which makes it difficult to accurately measure the similarity.As shown in Figure 4a, there are two lines (line abcd and line ef), and the continuous Fréchet distance between them should be d(b,v), which is the distance from point b to line ef (i.e., the distance represented by the dashed line in Figure 4a).
Thus, the discrete Fréchet distance between chains A and B is shown below.

The Reconstruction of Broken Contour Lines Based on a Reference Line
In this paper, the foundation for the proposed reconstruction method for broken contour lines based on a reference line consists of three parts: (1) contour line node densification (to improve the identification accuracy of the reference line similarity), (2) the Fréchet distance (for the selection of a reference line), and (3) the interpolation and connection of a broken contour line based on the selected reference line (to complete the reconstruction of a contour line).

Contour Line Node Densification
When using the discrete Fréchet distance to measure contour similarity, if the distance between some contour nodes is too large, the points are relatively sparse and the difference compared to the continuous Fréchet distance is large during the calculation, which makes it difficult to accurately measure the similarity.As shown in Figure 4  Step 1: The distance between two adjacent nodes is calculated from the first node of a contour line.
Step 2: If the distance d does not exceed the threshold, no processing is required.If the threshold is exceeded, m points are uniformly inserted, where the formula for m is as follows: Due to the sparse nodes in line ef, the calculated discrete Fréchet distance is d(b, e) (i.e., the length of the dotted line in Figure 4a), which is much greater than the real continuous Fréchet distance.Therefore, to make the discrete Fréchet distance closer to the continuous Fréchet distance, node densification is required for line ef in Figure 4a to obtain line eghijf in Figure 4b.Then, the densified, discrete Fréchet distance d(b, h), which is the length of the dotted line in Figure 4b, is closer to the continuous Fréchet distance than the original discrete Fréchet distance d(b, e), resulting in accurate similarity identification between the two lines.The densification algorithm is performed as follows: Step 1: The distance between two adjacent nodes is calculated from the first node of a contour line.
Step 2: If the distance d does not exceed the threshold, no processing is required.If the threshold is exceeded, m points are uniformly inserted, where the formula for m is as follows: In Equation ( 4), d represents the distance between two nodes, and t represents the threshold, which is usually the median of all distances for any two connective nodes in the original contour lines.The symbol denotes the floor function, which rounds down integers.

Reference Line Selection Based on the Fréchet Distance
The reference line refers to a complete contour line which is located around the broken contour line and has a consistent trend.In the case of broken contour lines with a small distance between them and simple topography, it is easy to identify the reference line using the discrete Fréchet distance.However, when the situation of the broken contour lines is complicated or the terrain is complex, it is easy to use all of the broken contour lines to identify the similarity and misjudge the reference line.Therefore, in this paper, points along the broken contour line are gradually selected first; then, the Fréchet distance between the points and closed contours surrounding the contour lines is calculated.Finally, the reference line can be identified by similarity identification.During the selection process, to avoid inaccurate similarity identification caused by the short length of the selected points, the length between the selected points can be restricted by the empirical threshold; if the length is excessively short, points can be added to reach the length for similarity identification.Figure 6 illustrates the specific steps for selecting the reference line: Step 1: According to the spatial inclusion relation, the adjacent closed contour which can be used as the reference line of the broken contour line is selected.As shown in Figure 5

Broken Contour Line Interpolation and Connection Based on the Reference Line
According to the reference contour line obtained in Section 2.2, the broken contour line can be interpolated and connected.The basic idea is to determine the projected position of the broken contour line in the reference contour line to identify the extended direction of the reference contour line.Then, according to the projected position, extended direction, and elevation information, the interpolated points and connection order of the broken contour line are determined and, eventually, all interpolation points are connected to reconstruct the broken contour lines.Figure 6 is shown as an example to illustrate the specific steps.
Step 1: The projected position of a reference contour line is determined.In Figure 6, suppose that the points on the broken contour line L2 and its two reference lines (L1 and L3) all have serial numbers.
Broken contour line L2 has two breakpoints, P1 and P2, which correspond to the first and last nodes of the broken line, respectively.Two points, Q1 and Q2, are projected onto the reference contour line on the reference contour line L1 are equal to those of Qi1 and Qi2, respectively.In Figure 6, the serial numbers for Qi1 and Qi2 are 5 and 11, respectively.Similarly, the serial number of the projected point Step 2: Taking the breakpoints of the fracture contour as a starting point, some points on the broken contour line are selected, and the similarity between the points and adjacent contours is judged.As shown in Figure 5, the breakpoint on one side of L 4 is d 1 ; first, the nearest points (b 1 and c 1 ) are calculated from d 1 to the adjacent closed contour lines (L 2 and L 3 ).By picking the point d 2 on L 4 by using an empirical length threshold l, the nearest points b 2 and c 2 are also calculated from d 2 to L 2 and L 3 .If the length between b 1 and b 2 or c 1 and c 2 is smaller than the empirical threshold, then b 2 or c 2 is removed; then, the point d 3 on L 4 is used to capture the nearest point from d 3 to L 2 and L 3 until the nearest points along L 2 and L 3 satisfy the empirical threshold.As shown in Figure 6, when d 5 is obtained on L 4 , the point c 2 that satisfies the empirical threshold is captured on L 3 .
As shown in Figure 6, according to the above equation, the x and y coordinates of the interpolated point Fra1 at the corresponding points 10 and 7 on the reference lines L1 and L3, respectively, are calculated based on the interpolation sequence at the breakpoint.After successive calculations, the positions of the interpolation points (Fra1 to Fra5) on all contour lines are obtained via sequential connection for contour line reconstruction.

Experimental Data and Environment
Based on the WJ-III map workstation developed by the Chinese Academy of Surveying and Mapping, the reconstruction method for broken contour lines based on a reference line was embedded using OpenMP into the C++ environment for the reconstruction of broken contour lines.
The universality and accuracy of this method is verified in this paper.In this experiment, broken contour line data within a certain area of Yunnan (with a total area of 29.1 km 2 ) were taken as examples, as shown in Figure 8(a).This area has terrain that is mainly mountainous and hilly, with a total of 5948 contour lines and a basic contour line interval of 5 m, including 3277 broken contour lines; the number of breaks accounts for 55% of the total, and the total reconstruction time was 328 s.
According to the situation of the broken contour line, the broken contour line can be divided into two cases connecting the breakpoint directly: if the connecting line intersects with other contour lines, the broken contour line is called a complex fracture; otherwise, it is called a general fracture.The Step 3: The discrete Fréchet distances between the broken contour line and the completely closed surrounding contour lines are each calculated.The contour line with the minimum Fréchet distance is taken as the reference line.As shown in Figure 5, by using Equations ( 2) and ( 3

Broken Contour Line Interpolation and Connection Based on the Reference Line
According to the reference contour line obtained in Section 2.2, the broken contour line can be interpolated and connected.The basic idea is to determine the projected position of the broken contour line in the reference contour line to identify the extended direction of the reference contour line.Then, according to the projected position, extended direction, and elevation information, the interpolated points and connection order of the broken contour line are determined and, eventually, all interpolation points are connected to reconstruct the broken contour lines.Figure 6 is shown as an example to illustrate the specific steps.
Step 1: The projected position of a reference contour line is determined.In Figure 6, suppose that the points on the broken contour line L 2 and its two reference lines (L 1 and L 3 ) all have serial numbers.Broken contour line L 2 has two breakpoints, P 1 and P 2 , which correspond to the first and last nodes of the broken line, respectively.Two points, Q 1 and Q 2 , are projected onto the reference contour line L 1 .If Q 1 and Q 2 already exist on the reference contour line L 1 , the serial numbers of Q 1 and Q 2 on the completely external contour line are directly calculated.If either Q 1 or Q 2 (or neither) is on the reference contour line L 1 , the point is inserted into the corresponding position to calculate the serial number of the inserted point on the contour line L 1 .Thus, the projected serial numbers for P 1 and P 2 on the reference contour line L 1 are equal to those of Q i1 and Q i2 , respectively.In Figure 6, the serial numbers for Q i1 and Q i2 are 5 and 11, respectively.Similarly, the serial number of the projected point on the reference contour line L 3 is obtained.
Step 2: The interpolation sequence at the breakpoint is determined.The adjacent points (P 3 and P 4 ) of the breakpoints (P 1 and P 2 ) on the broken contour line L 2 are used to calculate the projected points (Q i3 and Q i4 ) on the reference contour line which indicates that the serial number 0 of the projection points from L 2 to L 1 do not exist, then L 2 has the same serial sequence as L 1 .The values on L 1 projected by the subsequently densified interpolation values of L 2 are sequenced as Q i2 , Q i2+1 , ..., Q i1-1 , and then the serial number 0 of the projection points from L 2 to L 1 exist, and L 2 has the opposite serial sequence to L 1 .The values on L 1 projected by the subsequently densified interpolation values of L 2 are sequenced as Q i2 , Q i2+1 , ..., Q i1-1 , and Q i1 .As shown in Figure 6, Q i1 is equal to 5, Q i2 is equal to 11, Q i3 is equal to 4, and Q i4 is equal to 12, which conforms to the reverse order rule; therefore, the interpolation sequence is identified as Q i2 , Q i2-1 , . . ., Q i1+1 , and Q i1 , which is equal to 11, 10, 9, 8, 7, 6, and 5 on L 1 .Likewise, the corresponding interpolation sequence on L 3 can be derived.
Step 3: According to the interpolation order in the breakpoint location, the nodes are successively densified at the breakpoint location, and the densified points are connected to achieve contour line reconstruction.According to Step 1, the projected points of breakpoints P 1 and P 2 on the broken contour line L 2 using the reference contour lines L 1 and L 3 , respectively, are obtained (i.e., Q 1 and Q 2 for R 1 and R 2 , respectively).According to Step 2, the interpolated values of the densified points on the broken contour line are obtained in the sequence as 11, 10, 6, 5. Starting from Q 2 and R 2 , the next nodes on the reference contour lines L 1 and L 3 are calculated in the order corresponding to the interpolated point coordinates for the broken contour line L 2 .The calculation formula is shown below: where T represents the proportion of contour line interpolation; H L2 represents the elevation value of the current broken contour line; and H L1 and H L3 represent the elevation values of the reference contour lines L 1 and L 3 , respectively.X Pn and Y Pn represent the x and y coordinates of the interpolated point P n at the breakpoint, respectively; these values translate into (X Qn, Y Qn ) and (X Rn, Y Rn ), which represent the x and y coordinates of the corresponding sequence points on the reference contour lines L 1 and L 3 , respectively.As shown in Figure 6, according to the above equation, the x and y coordinates of the interpolated point Fra 1 at the corresponding points 10 and 7 on the reference lines L 1 and L 3 , respectively, are calculated based on the interpolation sequence at the breakpoint.After successive calculations, the positions of the interpolation points (Fra 1 to Fra 5 ) on all contour lines are obtained via sequential connection for contour line reconstruction.

Experimental Data and Environment
Based on the WJ-III map workstation developed by the Chinese Academy of Surveying and Mapping, the reconstruction method for broken contour lines based on a reference line was embedded using OpenMP into the C++ environment for the reconstruction of broken contour lines.The universality and accuracy of this method is verified in this paper.In this experiment, broken contour line data within a certain area of Yunnan (with a total area of 29.1 km 2 ) were taken as examples, as shown in Figure 8a.This area has terrain that is mainly mountainous and hilly, with a total of 5948 contour lines and a basic contour line interval of 5 m, including 3277 broken contour lines; the number of breaks accounts for 55% of the total, and the total reconstruction time was 328 s.According to the situation of the broken contour line, the broken contour line can be divided into two cases connecting the breakpoint directly: if the connecting line intersects with other contour lines, the broken contour line is called a complex fracture; otherwise, it is called a general fracture.The experiment environment was a Microsoft Windows 7 64-bit operating system, the central processing unit (CPU) was an Intel Core 7-6700, the main frequency was 3.40 GHz, and the memory (RAM) was 4 GB in size.

Reference Line Selection
Due to the dense contour line in the experimental area, which is the most intensive and broken line in the experimental area, to reduce the number of calculations and improve the calculation accuracy, the index curve around the broken contour line was taken first as the reference line for reconstruction.Based on the Fréchet distance, the reference line for the broken contour line can be directly calculated.However, due to the surroundings of some broken contour lines lacking two complete index curves as reference lines, the original closed contour line and the adjacent contour line were taken as the reference lines for supplementary reconstruction in this experiment.Figure 7a shows that for the contour line break in the black box, because there is only a complete index curve externally, no reconstruction was performed in the first step; in the second step, the original closed contour line and the adjacent contour line were taken as the reference lines for reconstruction.Here, reference lines exist on both sides of the broken contour line to achieve a complete connection, and the result is shown in Figure 7b.
experiment environment was a Microsoft Windows 7 64-bit operating system, the central processing unit (CPU) was an Intel Core 7-6700, the main frequency was 3.40 GHz, and the memory (RAM) was 4 GB in size.

Reference Line Selection
Due to the dense contour line in the experimental area, which is the most intensive and broken line in the experimental area, to reduce the number of calculations and improve the calculation accuracy, the index curve around the broken contour line was taken first as the reference line for reconstruction.Based on the Fréchet distance, the reference line for the broken contour line can be directly calculated.However, due to the surroundings of some broken contour lines lacking two complete index curves as reference lines, the original closed contour line and the adjacent contour line were taken as the reference lines for supplementary reconstruction in this experiment.Figure 7(a) shows that for the contour line break in the black box, because there is only a complete index curve externally, no reconstruction was performed in the first step; in the second step, the original closed contour line and the adjacent contour line were taken as the reference lines for reconstruction.
Here, reference lines exist on both sides of the broken contour line to achieve a complete connection, and the result is shown in Figure 7 1.The correct criterion is that the broken contours are closed and do not intersect with the other contours.The results show that the method in this paper can effectively reconstruct both general and complex broken contour lines.The reconstruction accuracy of the broken contour lines was 93.5%, with an overall favorable effect for the reconstruction of broken contour lines.

Contour Line Reconstruction
Figure 8a shows the overall result after the reconstruction of broken contour lines in the experimental area by using the method in this paper, where the red line represents the reference line, the blue line represents the broken contour line, and the purple line represents the reconstructed contour line.Statistics on the reconstructed contour lines are shown in Table 1.The correct criterion is that the broken contours are closed and do not intersect with the other contours.The results show that the method in this paper can effectively reconstruct both general and complex broken contour lines.The reconstruction accuracy of the broken contour lines was 93.5%, with an overall favorable effect for the reconstruction of broken contour lines.To further verify the effect of the reconstruction of complex broken contour lines, the corresponding typical areas were selected for local amplification in this paper.In severe cases of broken contour lines, only a small number of breaks (before reconstruction in Figure 8(b) and after reconstruction in Figure 8(c) and Figure 9) and complex terrain with broken contour lines (before reconstruction in Figure 8(d) and after reconstruction in Figure 8(e) and Figure 10) remain; the proposed method in this paper can better realize the reconstruction of broken contour lines.To further verify the effect of the reconstruction of complex broken contour lines, the corresponding typical areas were selected for local amplification in this paper.In severe cases of broken contour lines, only a small number of breaks (before reconstruction in Figure 8b and after reconstruction in Figures 8c and 9) and complex terrain with broken contour lines (before reconstruction in Figure 8d and after reconstruction in Figures 8e and 10) remain; the proposed method in this paper can better realize the reconstruction of broken contour lines.

317
To further illustrate the superiority of the method in this paper, the minimum point pair method 318 and the method presented in this paper were used to carry out an experiment on reconstructed 319 broken contour lines under the same conditions.The results are shown in Figure 11.

Superiority Analysis
To further illustrate the superiority of the method in this paper, the minimum point pair method and the method presented in this paper were used to carry out an experiment on reconstructed broken contour lines under the same conditions.The results are shown in Figure 11.
(1) General Broken Contour Lines By using the Delaunay triangulation method [19] and Equation (8), the distance between contours that were reconstructed is statistically significant.The results are shown in Table 2. Figures 11(a) and (b) show the reconstruction results.

Superiority Analysis
To further illustrate the superiority of the method in this paper, the minimum point pair method and the method presented in this paper were used to carry out an experiment on reconstructed broken contour lines under the same conditions.The results are shown in Figure 11.
(1) General Broken Contour Lines By using the Delaunay triangulation method [19] and Equation ( 8), the distance between contours that were reconstructed is statistically significant.The results are shown in Table 2. Figure 11a,b show the reconstruction results.
In the equation above, n represents the total number of Delaunay triangles between two adjacent planes, h i represents the height of each triangle, and the adjacent plane is formed by the closure of each reconstruction line.
The distance between contour lines after reconstruction by the minimum point pair method was quite different from the distance determined by the method presented in this paper, which only calculates the direct connection between breakpoints.Although most of the contour lines can be reconstructed correctly, the reconstruction lines are not smooth, and some reconstruction lines intersect with each other (Numbers 10 and 11).By using the proposed method, the contour line distance is more uniform, and the reconstruction lines are smoother and nonintersecting.
(2) Complex Broken Contour Lines Figure 11c,d illustrate the results of reconstruction and show that only 4 of the 24 broken contours were correctly reconstructed, and the other 20 all intersected with other contours with incorrect reconstruction; however, all 24 broken contours were all correctly connected by our method.

Discussion and Conclusions
When the original method for the reconstruction of broken contour lines, which uses the Euclidean distance with the auxiliary direction, is applied in the case of a larger broken contour line area with complex broken terrain resulting from the incomplete consideration of geometric and spatial features, the reconstruction is prone to incorrect and missing breakpoint connections.For this reason, a reconstruction method for broken contour lines based on a reference line was proposed in this paper, which is not only suitable for general broken contour zones but is also more effective than traditional methods in complex broken contour zones.After using actual contour line data for verification, the main conclusions are as follows.
(1) In terms of general analysis, the experimental results show that the proposed method is applicable for the reconstruction of both complex broken contours and general broken contours, with good universality.

Discussion and Conclusions
When the original method for the reconstruction of broken contour lines, which uses the Euclidean distance with the auxiliary direction, is applied in the case of a larger broken contour line area with complex broken terrain resulting from the incomplete consideration of geometric and spatial features, the reconstruction is prone to incorrect and missing breakpoint connections.For this reason, a reconstruction method for broken contour lines based on a reference line was proposed in this paper, which is not only suitable for general broken contour zones but is also more effective than traditional methods in complex broken contour zones.After using actual contour line data for verification, the main conclusions are as follows.
(1) In terms of general analysis, the experimental results show that the proposed method is applicable for the reconstruction of both complex broken contours and general broken contours, with good universality.(2) In terms of reconstruction accuracy, the reconstruction results were compared with results from the minimum point pair method under the same conditions.The method in this paper had better results for connection and reconstruction in a simple broken contour zone, and the reconstruction accuracy in a complex broken contour zone was significantly improved.
A leakage connection may occur by using our method when the similarity between the broken contour and the reference contour is low.In future research, more attention will be paid to the selection and optimization of reference contours to further improve the accuracy of the reconstruction of broken contour lines.

Figure 1 .
Figure 1.Schematic diagram of the minimum point pair method for reconstruction.

Figure 2 .
Figure 2. Schematic diagram of the breakpoint extension intersection identification matching method for reconstruction.

Figure 1 .
Figure 1.Schematic diagram of the minimum point pair method for reconstruction.

Figure 1 .
Figure 1.Schematic diagram of the minimum point pair method for reconstruction.

Figure 2 .
Figure 2. Schematic diagram of the breakpoint extension intersection identification matching method for reconstruction.

Figure 2 .
Figure 2. Schematic diagram of the breakpoint extension intersection identification matching method for reconstruction.

Figure 3 .
Figure 3. Connection mistakes: severely broken contour lines (area B) and the broken terrain of a contour line with a saddle shape (area C).

Figure 3 .
Figure 3. Connection mistakes: severely broken contour lines (area B) and the broken terrain of a contour line with a saddle shape (area C).
(a), there are two lines (line abcd and line ef), and the continuous Fréchet distance between them should be d(b,v), which is the distance from point b to line ef (i.e., the distance represented by the dashed line in Figure 4(a)).

Figure 4 .
Figure 4. Diagram of the Fréchet distance between curves: (a) Fréchet distance between sparse nodes and (b) Fréchet distance between dense nodes.Due to the sparse nodes in line ef, the calculated discrete Fréchet distance is d(b, e) (i.e., the length of the dotted line in Figure 4(a)), which is much greater than the real continuous Fréchet distance.Therefore, to make the discrete Fréchet distance closer to the continuous Fréchet distance, node densification is required for line ef in Figure 4(a) to obtain line eghijf in Figure 4(b).Then, the densified, discrete Fréchet distance d(b, h), which is the length of the dotted line in Figure 4(b), is closer to the continuous Fréchet distance than the original discrete Fréchet distance d(b, e), resulting in accurate similarity identification between the two lines.The densification algorithm is performed as follows:

Figure 4 .
Figure 4. Diagram of the Fréchet distance between curves: (a) Fréchet distance between sparse nodes and (b) Fréchet distance between dense nodes.
, there are three contour lines (L 1 , L 2 , and L 3 ) surrounding the broken contour line L 4 .Since L 1 contains L 4 , L 1 is regarded as the reference line of L 4 .ISPRS Int.J. Geo-Inf.2019, 8, x FOR PEER REVIEW 7 of 15

L1.
If Q1 and Q2 already exist on the reference contour line L1, the serial numbers of Q1 and Q2 on the completely external contour line are directly calculated.If either Q1 or Q2 (or neither) is on the reference contour line L1, the point is inserted into the corresponding position to calculate the serial number of the inserted point on the contour line L1.Thus, the projected serial numbers for P1 and P2

Figure 6 .
Figure 6.Diagram of broken contour line interpolation and connection.

Figure 6 .
Figure 6.Diagram of broken contour line interpolation and connection.
), the discrete Fréchet distances d F (d 1 ,b 1 ) and d F (d 1 ,c 1 ), which are from d 1 d 5 to b 1 b 4 and c 1 c 2 , respectively, are each calculated, and the discrete Fréchet distances d F (d 6 ,b 5 ) and d F (d 10 ,c 4 ) that are from d 6 d 10 to b 5 b 8 and c 3 c 4 , respectively, are also calculated.Since d F (d 1 ,b 1 ) < d F (d 1 ,c 1 ) and d F (d 6 ,b 5 ) < d F (d 10 ,c 4 ), d 1 d 5 to b 1 b 4 and d 6 d 10 to b 5 b 8 are more similar.Additionally, because b 1 b 4 and b 5 b 8 both belong to L 2 , L 2 is chosen as the reference line for L 4 .If the selection line in this step does not belong to the same completely closed contour line, then Steps 2 and 3 should be repeated until the closed reference line is found. (b).

4. 2 . 2 .
Figure 8(a) shows the overall result after the reconstruction of broken contour lines in the experimental area by using the method in this paper, where the red line represents the reference line, the blue line represents the broken contour line, and the purple line represents the reconstructed contour line.Statistics on the reconstructed contour lines are shown in Table1.The correct criterion

Figure 8 .
Figure 8.The results and local amplification of the reconstructed broken contour lines in the experimental area: (a) overall results after reconstruction, (b) before reconstruction (severe cases of broken contour lines), (c) after reconstruction (severe cases of broken contour lines), (d) before reconstruction (complex terrain with broken contour lines), and (e) after reconstruction (complex terrain with broken contour lines).

Figure 8 .
Figure 8.The results and local amplification of the reconstructed broken contour lines in the experimental area: (a) overall results after reconstruction, (b) before reconstruction (severe cases of broken contour lines), (c) after reconstruction (severe cases of broken contour lines), (d) before reconstruction (complex terrain with broken contour lines), and (e) after reconstruction (complex terrain with broken contour lines).

Figure 9 .Figure 10 .
Figure 9.The results and local amplification of the reconstructed broken contour lines in severe cases

Figure 9 .
Figure 9.The results and local amplification of the reconstructed broken contour lines in severe cases of broken contour lines.

Figure 9 .
Figure 9.The results and local amplification of the reconstructed broken contour lines in severe cases of broken contour lines.

Figure 10 .
Figure 10.The results and local amplification of the reconstructed broken contour lines in saddleshaped terrain.

Figure 10 .
Figure 10.The results and local amplification of the reconstructed broken contour lines in saddle-shaped terrain.

Figure 11 .
Figure 11.Comparison diagram of the reconstruction results betwee

Figure 11 .
Figure 11.Comparison diagram of the reconstruction results between the minimum point pair method and the method in this paper: (a) the minimum point pair method (simple broken contour zone); (b) the method in this paper (simple broken contour zone); (c) the minimum point pair method (complex broken contour zone); (d) the method in this paper (complex broken contour zone).

Table 1 .
Statistics on the reconstructed broken contour lines in the experimental area.

Table 2 .
Statistics of the distances of the reconstructed contours (unit: meter), where SD indicates the standard deviation.