Site image drawing method and electronic equipment

By generating the intersection of contour lines and scan lines on low-configuration devices to draw site images, the problem of large device memory usage is solved, fast drawing is achieved, lag is avoided, and hardware costs are saved.

CN120599078APending Publication Date: 2025-09-05SHENZHEN YANXIANG QIANDONG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510543153.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-28
Publication Date
2025-09-05

AI Technical Summary

Technical Problem

On low-spec electronic devices, such as smart watches and fitness trackers, displaying, rotating, moving, or zooming a golf course map can easily cause lag issues because the course map occupies a large amount of memory resources.

Method used

By acquiring the contour point data of the target site to generate contour lines, and using the intersection of the scan line and the contour line to generate line segment data, the site image can be quickly drawn to reduce memory usage.

Benefits of technology

Quickly draw site images on low-configuration devices, avoiding lag issues and saving hardware costs. Fast drawing can be achieved without high-configuration hardware.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120599078A_ABST
    Figure CN120599078A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image generation, and discloses a site image drawing method and electronic equipment, and the method comprises the steps: obtaining a plurality of contour point data corresponding to each region on a target site, generating a plurality of contour lines corresponding to each region according to the contour point data corresponding to each region, and scanning the contour lines according to a preset step length, acquiring a plurality of pieces of intersection point data between the scanning line and the contour line, sequentially traversing the plurality of pieces of intersection point data according to the sequence of intersection point coordinates, determining two adjacent pieces of intersection point data with unpaired pairing marks and the same area type as target intersection point data, setting pairing marks of the target intersection point data as paired, and setting the pairing marks of the target intersection point data as paired matching marks; and generating line segment data according to the target intersection point data until the pairing marks of the plurality of intersection point data are set to be paired, and drawing an image of the target site according to the line segment data. Through the mode, memory resources occupied by the target site image are reduced, and the problem of lagging when the target site image is displayed is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of image generation technology, and more particularly to a method for drawing a site image and an electronic device. Background Art

[0002] Field images can help users understand the regional information of the target field. For example, in golf, golfers can judge the teeing distance and avoid obstacles by viewing the images of the golf course, thereby improving their performance.

[0003] However, due to the complex and diverse areas of a golf course, such as greens, bunkers, ponds, and fairways, displaying a golf course map requires a significant amount of memory on the device. Low-performance devices with limited memory, such as smartwatches and fitness trackers, can easily experience lag when displaying, rotating, moving, or zooming the golf course map. Summary of the Invention

[0004] In view of the above problems, embodiments of the present application provide a method for drawing a venue image and an electronic device, which are used to solve the problem in the prior art that a large amount of memory resources are required when displaying a venue map.

[0005] According to one aspect of an embodiment of the present application, a method for drawing a site image is provided, the method comprising: acquiring a plurality of contour point data corresponding to each area on a target site, wherein the plurality of areas constitute the target site and the plurality of contour point data constitute the contour of the area; generating a plurality of contour lines corresponding to each area according to the contour point data corresponding to each area, wherein the contour line includes an area type; scanning the contour line according to a preset step size to acquire a plurality of intersection point data between the scan line and the contour line, wherein the intersection point data includes intersection point coordinates, an area type and a pairing flag, and an initial value of the pairing flag is unpaired; traversing the plurality of intersection point data in sequence according to the order of the intersection point coordinates, determining two adjacent intersection point data with unpaired pairing flags and the same area type as target intersection point data, setting the pairing flag of the target intersection point data to paired, and generating line segment data according to the target intersection point data until the pairing flags of the plurality of intersection point data are all set to paired; and drawing an image of the target site according to the line segment data.

[0006] In an optional manner, line segment data is generated based on target intersection data, specifically including: if there is no intersection data between the target intersection data, the intersection coordinates of the previous intersection data in the target intersection data are determined as the line segment starting point coordinates, and the intersection coordinates of the next intersection data in the target intersection data are determined as the line segment end point coordinates; and line segment data is generated based on the line segment starting point coordinates, the line segment end point coordinates and the area type of the target intersection data.

[0007] In an optional manner, line segment data is generated based on target intersection data, specifically including: if there is intersection data between target intersection data, determining the previous intersection data in the target intersection data as the starting point data; judging whether there is line segment data with the intersection coordinates of the starting point data as the starting point coordinates of the line segment; if so, determining the next intersection data of the starting point data as the new starting point data, and jumping to the step of judging whether there is line segment data with the intersection coordinates of the starting point data as the starting point coordinates of the line segment, until all the intersection data between the target intersection data are traversed; otherwise, determining the intersection coordinates of the starting point data as the starting point coordinates of the line segment, determining the intersection coordinates of the next intersection data of the starting point data as the end point coordinates of the line segment, generating line segment data based on the starting point coordinates of the line segment, the end point coordinates of the line segment and the area type of the target intersection data, and determining the next intersection data of the starting point data as the new starting point data, and jumping to the step of judging whether there is line segment data with the intersection coordinates of the starting point data as the starting point coordinates of the line segment, until all the intersection data between the target intersection data are traversed.

[0008] In an optional manner, multiple contour lines corresponding to each area are generated based on the contour point data corresponding to each area, specifically including: traversing the contour point data corresponding to each area respectively, obtaining adjacent first contour point data and second contour point data, wherein the contour point data include first coordinate data and second coordinate data; judging whether the first coordinate data of the first contour point data is less than the first coordinate data of the second contour point data; if the first coordinate data of the first contour point data is less than the first coordinate data of the second contour point data, determining the first coordinate data of the first contour point data as the preset scanning data, determining the starting point coordinates based on the first coordinate data and the second coordinate data of the first contour point data, and determining the end point based on the first coordinate data and the second coordinate data of the second contour point data. Coordinates; if the first coordinate data of the first contour point data is greater than the first coordinate data of the second contour point data, the first coordinate data of the second contour point data is determined as the preset scan data, the starting point coordinates are determined according to the first coordinate data and the second coordinate data of the second contour point data, and the end point coordinates are determined according to the first coordinate data and the second coordinate data of the first contour point data; the preset scan data, the starting point coordinates, the end point coordinates and the area type corresponding to the area are matched to generate a contour line; the second contour point data is determined as the new first contour point data, and the next contour point data is obtained as the new second contour point data, and the step of judging whether the first coordinate data of the first contour point data is less than the first coordinate data of the second contour point data is jumped to, until all contour point data are traversed.

[0009] In an optional manner, multiple intersection data between the scan line and the contour line are obtained, specifically including: if the value of the scan line is equal to the preset scan data of the contour line, the starting point coordinates of the contour line are determined as the intersection coordinates; if the value of the scan line is greater than the preset scan data of the contour line, and the value of the scan line is less than the first coordinate data in the end point coordinates of the contour line, the slope and intercept of the contour line are calculated according to the starting point coordinates and the end point coordinates of the contour line, and the intersection coordinates are determined according to the value of the scan line, the slope and the intercept of the contour line; if the value of the scan line is greater than the scan line data, and the value of the scan line is equal to the first coordinate data in the end point coordinates of the contour line, the end point coordinates of the contour line are determined as the intersection coordinates; and the intersection data are generated according to the pairing mark, the intersection coordinates and the area type of the contour line.

[0010] In an optional manner, the intersection data also includes the slope of the contour line, and the intersection coordinates include second coordinate data; after obtaining multiple intersection data between the scan line and the contour line, the method also includes: sorting the multiple intersection data according to the second coordinate data of the intersection coordinates; if the second coordinate data of the intersection coordinates of multiple intersection data are equal, then sorting the multiple intersection data with equal second coordinate data according to the slope of the contour line in the intersection data.

[0011] In an optional manner, a plurality of intersection data are sequentially traversed in the order of intersection coordinates, two adjacent intersection data with unpaired pairing marks and the same area type are determined as target intersection data, the pairing flag of the target intersection data is set to paired, and line segment data are generated according to the target intersection data until the pairing flags of the plurality of intersection data are all set to paired, specifically including: traversing a plurality of intersection data in the order of intersection coordinates, and performing the following steps: obtaining two adjacent intersection data with unpaired pairing marks to obtain first intersection data and second intersection data; determining whether the area type of the first intersection data and the area type of the second intersection data are the same; if the same, determining the first intersection data and the second intersection data as target intersection data, and setting the pairing flag of the target intersection data to Already paired, generate line segment data according to the target intersection data, obtain the last two intersection data with unpaired pairing marks in sequence, obtain new first intersection data and second intersection data, and jump to the step of judging whether the area type of the first intersection data and the area type of the second intersection data are the same, until all the intersection data are traversed; otherwise, determine the second intersection data as the new first intersection data, and obtain the last intersection data with unpaired pairing marks to obtain new second intersection data, and jump to the step of judging whether the area type of the first intersection data and the area type of the second intersection data are the same, until all the intersection data are traversed; jump to the step of obtaining two adjacent intersection data with unpaired pairing marks to obtain the first intersection data and the second intersection data, until the pairing marks of the intersection data are all set to paired.

[0012] In an optional embodiment, after obtaining multiple contour point data corresponding to each area on the target site, the method further includes: obtaining the display screen size of the electronic device and the preset display size of the target site; determining a scaling ratio based on the ratio between the display screen size and the preset display size; and correcting the contour point data based on the scaling ratio to draw an image of the target site according to the corrected contour point data, and displaying the image on the display screen of the electronic device.

[0013] In an optional embodiment, the method further includes: in response to an image rotation instruction, obtaining rotation data of the target site; transforming the contour point data according to the rotation data; and redrawing the image of the target site according to the transformed contour point data; and / or, the method further includes: in response to an image translation instruction, obtaining translation data of the target site; transforming the contour point data according to the translation data; filtering the transformed contour point data according to the display screen size of the electronic device; and redrawing the image of the target site according to the filtered contour point data; and / or, the method further includes: in response to an image zoom instruction, obtaining the zoom factor of the target site, and determining the center of the display screen of the electronic device as a new coordinate origin; transforming the contour point data according to the new coordinate origin and the zoom factor; filtering the transformed contour point data according to the display screen size of the electronic device; and redrawing the image of the target site according to the filtered contour point data.

[0014] According to another aspect of an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement any of the above-mentioned methods for drawing a site image.

[0015] In the embodiment of the present application, a contour line is first generated using contour point data, and then when drawing the image of the target site, the contour line is scanned by moving a scanning line to draw the image of the target site. Specifically, the intersection of the contour line and the scanning line is determined, and line segment data is generated based on the intersection. Finally, a line segment is drawn between the intersection of the contour line and the scanning line based on the line segment data, and only one drawing is required between each two adjacent intersection points. The image of the target site can be quickly drawn, effectively reducing the memory resources occupied by the target site image, and meeting the operating requirements of low-configuration electronic devices.

[0016] The above description is only an overview of the technical solutions of the embodiments of the present application. In order to more clearly understand the technical means of the embodiments of the present application, they can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiments of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The accompanying drawings are only used to illustrate the embodiments and are not to be considered as limiting the present application. In addition, the same reference symbols are used to represent the same components throughout the drawings. In the drawings:

[0018] Figure 1 A schematic diagram showing a flow chart of a method for drawing a site image provided by an embodiment of the present application is shown;

[0019] Figure 2 A schematic diagram showing the structure of contour lines in the method for drawing a site image provided by an embodiment of the present application is shown;

[0020] Figure 3 A schematic diagram showing the position structure of scan lines and contour lines in the site image drawing method provided by an embodiment of the present application is shown;

[0021] Figure 4 A schematic diagram of the structure of the target site image provided in an embodiment of the present application is shown;

[0022] Figure 5 A schematic diagram of the structure of the intersection data provided in an embodiment of the present application is shown;

[0023] Figure 6 A flowchart of generating line segment data in a method for drawing a site image provided by an embodiment of the present application is shown;

[0024] Figure 7 A schematic diagram of the structure of a site image drawing device provided in an embodiment of the present application is shown;

[0025] Figure 8 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0026] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited to the embodiments set forth herein.

[0027] With the development of technology, wearable devices such as smartwatches and fitness trackers are widely used in various fields due to their portability, interactivity, and intelligence. In sports such as golf, players can use their smartwatches to view a map of the course at any time to determine the distance of their shots and avoid obstacles, thereby improving their performance.

[0028] Currently, there are two main ways to display a course map. This application uses a golf course as an example. One method is to display, rotate, move, and scale a pre-prepared image of a golf course map. However, using an image to move, rotate, or scale is slow, and image distortion may occur during scaling. Another method is to draw a multi-layer filled polygon, first drawing the entire golf course area, and then sequentially overlaying and drawing the fairways, bunkers, pools, greens, and other areas. However, this will result in multiple drawing operations for overlapping areas of the golf course. For example, when drawing a bunker on the fairway, it is necessary to draw the fairway first, and then overlay the bunker on the fairway. Not only is the drawing speed slow, but the drawn image also requires a large amount of memory resources.

[0029] Based on this, in order to quickly draw, rotate, move or scale the image of the site on a low-configuration device, the present application provides a site image drawing method, which traverses the contour data of each area on the target site through a scan line while drawing the image of the target site. Specifically, first generate multiple contour lines corresponding to each area based on the contour point data of each area, and scan the contour line according to a preset step size to obtain multiple intersection point data between the scan line and the contour line, and then determine the starting point, end point and type of the line segment based on the multiple intersection point data. Finally, draw a line segment of corresponding color or style between the intersection point of the scan line and the contour line according to the starting point, end point and type of the line segment, and the drawing of the target site image can be completed.

[0030] In this way, not only can the image be drawn while the scan line is moved, but only one drawing is required between the intersection of the scan line and the contour line to quickly draw the image of the target site, reducing the memory resources occupied by the image of the target site. On the one hand, it can avoid the problem of lag when displaying, rotating, moving or scaling the target site on low-configuration devices. On the other hand, high-configuration hardware is not required to quickly draw the image of the target site, saving hardware costs.

[0031] The target site rendering method provided in the embodiments of the present application can be applied not only to rendering golf course images, but also to sites with various types of areas, such as floor distribution images, scenic area images, etc. For the sake of convenience, the present embodiment of the application only uses the rendering of a golf course image as an example.

[0032] According to one aspect of the embodiments of the present application, a method for drawing a site image is provided, which can be executed by electronic devices such as smart watches, mobile phones, and tablets. Figure 1 As shown, Figure 1 A flow chart of a method for drawing a site image according to an embodiment of the present application is shown, and the method includes the following steps:

[0033] Step S100: Acquire a plurality of contour point data corresponding to each area on the target site, wherein the plurality of areas constitute the target site, and the plurality of contour point data constitute the contour of the area.

[0034] The target site can be a golf course, a floor, a scenic area map, etc. Taking a golf course as an example, the target site can be a complete golf course or a sub-golf course in the golf course. For example, a complete golf course includes 18 holes, each hole corresponds to a sub-golf course, and a sub-golf course includes multiple areas, including a green, a fairway, a rough area, several sand traps and several pools.

[0035] The contour points of each area are connected to form the contour of the area. The coordinate data of each area in the target field can be read from the storage or memory. Specifically, the coordinate data of each area in the golf course can be expressed as follows:

[0036] The coordinate sequence for the golf course area outline is:

[0037] sub_golf=[(x s1 ,y s1 ), (x s2 ,y s2 ), (x s3 ,y s3 ),…,(x sm ,y sm )]

[0038] The coordinate sequence of the fairway area outline in a golf course is:

[0039] fairway=[(x f1 ,y f1 ), (x f2 ,y f2 ), (x f3 ,y f3 ),…,(x fn ,y fn )]

[0040] The coordinate sequence for the outline of the green area in a golf course is:

[0041] green=[(x g1 ,y g1 ), (x g2 ,y g2 ), (x g3 ,y g3 ),…,(x gj ,y gj )]

[0042] The coordinate sequence for the outline of a bunker area on a golf course is:

[0043] bunker=[(x b1 ,y b1 ), (x b2 ,y b2 ), (x b3 ,y b3 ),…,(x bk ,y bk )]

[0044] The coordinate sequence for the outline of the pool area in the golf course is:

[0045] water=[(x w1 ,y w1 ), (x w2 ,y w2 ), (x w3 ,y w3 ),…,(x wp ,y wp )]

[0046] Where x refers to the X-axis coordinate of the contour point of each region in the coordinate system, y refers to the Y-axis coordinate of the contour point of each region in the coordinate system, and m, n, j, k, and p are the number of contour points in each region.

[0047] Step S200: generating a plurality of contour lines corresponding to each region according to the contour point data corresponding to each region, wherein the contour lines include region types.

[0048] Among them, the contour lines are the lines that enclose the outlines of each area. Specifically, the contour points can be connected in the order of the coordinate sequence to generate multiple contour lines corresponding to each area, or the coordinate sequence can be divided into multiple groups according to a preset number, and the contour point data of each group can be fitted to generate contour lines.

[0049] Furthermore, in order to speed up the drawing of the target site image, step S200 may include the following steps (steps S210 to S260):

[0050] Step S210: traverse the contour point data corresponding to each area respectively, and obtain adjacent first contour point data and second contour point data, wherein the contour point data includes first coordinate data and second coordinate data.

[0051] Among them, the contour point data corresponding to each area is traversed in the order of the coordinate sequence, and two adjacent contour point data are converted into a contour line. Take the coordinate sequence of the ball lane area contour as an example, Figure 2 As shown, Figure 2 The structural diagram of the contour line is shown. The contour point data of the fairway area are traversed in sequence.f1 ,y f1 ) and (x f2 ,y f2 ) between the contour lines, and (x f2 ,y f2 ) and (x f3 ,y f3 ) and so on until all contour point data are traversed.

[0052] Step S220: Determine whether the first coordinate data of the first contour point data is smaller than the first coordinate data of the second contour point data.

[0053] If the first coordinate data of the first contour point data is smaller than the first coordinate data of the second contour point data, it means that when traversing the contour line, the first contour point data will be traversed first, and then the second contour point data will be traversed, and step S230 will be executed;

[0054] If the first coordinate data of the first contour point data is equal to the first coordinate data of the second contour point data, it means that when traversing the contour line, the first contour point data and the second contour point data will be traversed at the same time, so there is no need to form a contour line between the first contour point data and the second contour point data;

[0055] If the first coordinate data of the first contour point data is greater than the first coordinate data of the second contour point data, it means that when traversing the contour line, the second contour point data will be traversed first, and then the first contour point data will be traversed, and step S240 is executed.

[0056] Step S230: Determine the first coordinate data of the first contour point data as the preset scanning data, determine the starting point coordinates according to the first coordinate data and the second coordinate data of the first contour point data, and determine the end point coordinates according to the first coordinate data and the second coordinate data of the second contour point data.

[0057] Step S240: Determine the first coordinate data of the second contour point data as the preset scanning data, determine the starting point coordinates according to the first coordinate data and the second coordinate data of the second contour point data, and determine the end point coordinates according to the first coordinate data and the second coordinate data of the first contour point data.

[0058] Step S250: Matching the preset scanning data, the starting point coordinates, the ending point coordinates and the area type corresponding to the area to generate a contour line.

[0059] Among them, the data members of the contour line include preset scanning data, starting point coordinates, end point coordinates and area type. The scanning line scans all contour lines in order from the minimum value to the maximum value according to the preset step size. The preset scanning data in the data member of the contour line refers to the smaller value of the two contour point data located at the endpoints. The starting point coordinates in the data member of the contour line are the coordinates of the contour point with the smaller value among the two contour point data located at the endpoints. The end point coordinates in the data member of the contour line are the coordinates of the contour point with the larger value among the two contour point data located at the endpoints. The area type in the data member of the contour line is the area type of the area to which the contour point data belongs in the golf course map, specifically including the golf course area contour background, fairway, green, sand trap and pool.

[0060] As an example, assuming that the horizontal direction is the direction indicated by the X axis and the vertical direction is the direction indicated by the Y axis, if the scanning line is moved along the vertical direction to scan the contour line, the minimum value of the preset scanning data is the minimum value of the Y axis coordinate in the contour point data, and the maximum value of the preset scanning data is the maximum value of the Y axis coordinate in the contour point data. f1 ,y f1 ) and (x f2 ,y f2 ) when generating contour lines between f1 Less than y f2 , then (x f1 ,y f1 ) is determined as the starting point coordinate, (x f2 ,y f2 ) is determined as the end point coordinate and the preset scanning data is set to y f1 , if y fn-1 Greater than y fn , then (x fn ,y fn ) is determined as the end point coordinate, (x fn-1 ,y fn-1 ) is determined as the starting point coordinate and the preset scanning data is set to y fn .

[0061] Of course, the contour line can also be scanned by moving the scanning line in the horizontal direction. The minimum value of the preset scanning data is the minimum value of the X-axis coordinate in the contour point data, and the maximum value of the preset scanning data is the maximum value of the X-axis coordinate in the contour point data. f1 ,y f1 ) and (x f2 ,y f2 ) when generating contour lines between f1 Less than x f2 , then (x f1 ,y f1 ) is determined as the starting point coordinate, (x f2 ,yf2 ) is determined as the end point coordinate and the preset scan data is set to x f1 , if x f1 Greater than x f2 , then (x f1 ,y f1 ) is determined as the end point coordinate, (x f2 ,y f2 ) is determined as the starting point coordinate and the preset scanning data is set to x f2 .

[0062] Step S260: Determine the second contour point data as new first contour point data, obtain the next contour point data as new second contour point data, and jump to step S220 until all contour point data are traversed.

[0063] Through steps S210 to S260, by comparing the sizes of the data coordinates of two adjacent contour points, the starting coordinates and the end coordinates of the contour line are determined, and the contour line is further generated. Through simple comparison, the contour line can be quickly generated according to the contour point data, which is conducive to speeding up the drawing of the target site image.

[0064] In addition, to facilitate subsequent traversal of the contour lines, contour lines with the same preset scan line data can also be stored using a linked list. The number of linked lists is equal to the maximum value minus the minimum value in the contour point data. For example, assuming that the scan line scans the contour line in the vertical direction, the number of linked lists is equal to the maximum value of the Y-axis coordinate in the contour point data minus the minimum value of the Y-axis coordinate in the contour point data. Then, all linked lists are stored in an array in the order of the size of the preset scan data. The length of the array is equal to the maximum value of the preset scan data minus the minimum value of the preset scan data. In this way, when traversing the contour lines, it is only necessary to traverse the contour lines whose preset scan data is less than or equal to the value of the scan line, rather than traversing all contour lines, which is conducive to improving the speed of traversing the contour lines.

[0065] After step S200 , step S300 is executed: the contour line is scanned according to a preset step length to obtain a plurality of intersection data between the scan line and the contour line, wherein the intersection data includes intersection coordinates, region type and pairing flag, and the initial value of the pairing flag is unpaired.

[0066] When scanning the contour lines, the preset step size can be set to 1. If the scan line is moved vertically, all contour lines are traversed in order from the minimum Y-axis coordinate value in the target site to the maximum Y-axis coordinate value in the target site according to the preset step size. The Y-axis coordinate value of the scan line's location in the target site is the value of the scan line. In addition, steps S300 to S500 are executed for each scan line in each step. After the image is drawn at the scan line's location based on the intersection data, the scan line is moved and the next drawing step is entered. This allows the image of the target site to be drawn while the scan line is moved, thereby improving image drawing efficiency.

[0067] During the process of scanning the contour line, the coordinates of the intersection of the scan line and the contour line can be determined by the starting point coordinates and the ending point coordinates of the contour line. Specifically, step S300 may include the following steps (steps S310 to S340):

[0068] Step S310 : If the value of the scan line is equal to the preset scan data of the contour line, the starting point coordinates of the contour line are determined as the intersection coordinates.

[0069] Among them, Figure 3 As shown, Figure 3 The positional relationship between the scan line and the contour line is shown in FIG. L1 is the scan line, and L2, L3, and L4 are the contour lines. The scan line L1 moves along the direction indicated by the arrow S from the minimum value to the maximum value to scan the contour line. At this time, the positional relationship between the scan line and the contour line can be determined by the size relationship between the scan line value and the preset scan data of the contour line, as shown in FIG. Figure 3 As shown in the contour line L2, when the value of the scan line L1 is equal to the preset scan data of the contour line L2, it means that the contour line L2 intersects with the scan line L1 for the first time, that is, the starting point of the contour line L2 is the intersection between the contour line L2 and the scan line L1, and the starting point coordinates of the contour line L2 need to be determined as the intersection coordinates.

[0070] Step S320: If the value of the scan line is greater than the preset scan data of the contour line, and the value of the scan line is less than the first coordinate data in the end point coordinates of the contour line, the slope and intercept of the contour line are calculated according to the starting point coordinates and the end point coordinates of the contour line, and the intersection coordinates are determined according to the value of the scan line, the slope and the intercept of the contour line.

[0071] Among them, Figure 3As shown in the figure, when the value of scan line L1 is greater than the preset scan data of contour line L3, it means that contour line L3 and scan line L1 are not intersecting for the first time, and the value of scan line L1 is less than the first coordinate data in the coordinates of the end point of contour line L3, indicating that the intersection between contour line L3 and scan line L1 is not the end point of contour line L3, but is located between the starting point and the end point of contour line L3. In this case, the coordinates of the intersection between contour line L3 and scan line L1 can be determined by the slope and intercept of contour line L3.

[0072] Specifically, the coordinate data of each position on the contour line L3 can be expressed by the function y=ax+b, where a is the slope of the contour line L3 and b is the intercept of the contour line L3. Assuming that the starting coordinates of the contour line L3 are (start_x, start_y) and the end coordinates of the contour line L3 are (end_x, end_y), where start_x is the X-axis coordinate of the starting point of the contour line L3, start_y is the Y-axis coordinate of the starting point of the contour line L3, end_x is the X-axis coordinate of the end point of the contour line L3, and end_y is the Y-axis coordinate of the end point of the contour line L3, the slope of the contour line L3 can be calculated by the following formula:

[0073]

[0074] The intercept of the contour line L3 can be calculated by the following formula:

[0075] b=end_y-k×end_x

[0076] If the horizontal direction is the direction indicated by the X-axis and the vertical direction is the direction indicated by the Y-axis, then the scan line L1 moves in the direction indicated by the arrow S, that is, it moves in the direction indicated by the Y-axis. The value of the scan line L1 is the Y-axis coordinate of the intersection coordinate, and then the X-axis coordinate of the intersection coordinate can be calculated by the following formula:

[0077]

[0078] Among them, scanline_value refers to the value of the scan line L1, and the coordinates of the intersection of the scan line L1 and the contour line L3 are (cross_x, scanline_value).

[0079] If the horizontal direction is the direction indicated by the Y axis and the vertical direction is the direction indicated by the X axis, then the scan line L1 moves in the direction indicated by the arrow S, that is, it moves in the direction indicated by the X axis. The value of the scan line L1 is the X axis coordinate of the intersection coordinate, and the Y axis coordinate of the intersection coordinate can be calculated by the following formula:

[0080] cross_y=k×scanline_value+b

[0081] The coordinates of the intersection of the scan line L1 and the contour line L3 are calculated to be (scanline_value, cross_y).

[0082] Step S330: If the scan line value is greater than the scan line data, and the scan line value is equal to the first coordinate data in the end point coordinates of the contour line, the end point coordinates of the contour line are determined as the intersection coordinates.

[0083] Among them, Figure 3 As shown in the contour line L4, when the value of the scan line L1 is equal to the first coordinate data in the end point coordinates of the contour line L4, it means that the contour line L4 and the scan line L1 intersect for the last time, that is, the end point of the contour line L4 is the intersection between the contour line L4 and the scan line L1, and the end point coordinates of the contour line need to be determined as the intersection coordinates.

[0084] Step S340: Generate intersection data according to the pairing flag, the intersection coordinates and the area type of the contour line.

[0085] Among them, the data members of the intersection data include intersection coordinates, pairing flags and area types, among which the intersection coordinates in the data member are the coordinates of the intersection between the contour line and the scan line; the pairing mark in the data member is used to indicate whether the intersection data has been paired. For the convenience of calculation, the pairing flag can be set to "0" or "1", "0" means unpaired, and "1" means paired; the area type in the data member refers to one of the screen background of the electronic device, the area contour background of the golf course, the fairway, the green, the sand trap, and the pool.

[0086] The calculation process of determining the intersection coordinates through steps S310 to S340 is simple and convenient, and can quickly calculate the intersection coordinates between the contour line and the scan line, and then quickly generate the intersection data, which is conducive to accelerating the drawing speed of the target site image.

[0087] Furthermore, to facilitate the subsequent traversal process, after the intersection data is generated, the intersection data may be sorted according to the intersection coordinates. Specifically, the intersection data also includes the slope of the contour line, and the intersection coordinates include the second coordinate data. After step S340, the method further includes the following steps (steps S350 to S360):

[0088] Step S350: sorting the plurality of intersection point data according to the second coordinate data of the intersection point coordinates.

[0089] The intersection data is used to represent the information of the intersection between the contour line and the scan line. Assuming that the horizontal direction is the direction indicated by the X-axis and the vertical direction is the direction indicated by the Y-axis, if the scan line is set along the horizontal direction, that is, the scan line is parallel to the X-axis, then the Y-axis coordinates (i.e., the first coordinate data) in the intersection coordinates of all intersection data are equal. At this time, the intersection data can be sorted in the horizontal direction according to the X-axis coordinates (i.e., the second coordinate data) in the intersection coordinates to facilitate subsequent traversal of the intersection data in the horizontal direction, that is, traversing the intersection data from left to right or traversing the intersection data from right to left.

[0090] If the scan line is set along the vertical direction, that is, the scan line is parallel to the Y-axis, then the X-axis coordinates (that is, the first coordinate data) in the intersection coordinates of all intersection data are equal. At this time, the intersection data can be sorted along the vertical direction according to the Y-axis coordinates (that is, the second coordinate data) in the intersection coordinates, so as to facilitate the subsequent traversal of the intersection data along the vertical direction, that is, traversing the intersection data in order from top to bottom, or traversing the intersection data in order from bottom to top.

[0091] Step S360: If there are multiple intersection data with the same second coordinate data, the multiple intersection data with the same second coordinate data are sorted according to the slope of the contour line in the intersection data.

[0092] Among them, when the second coordinate data of the intersection coordinates of multiple intersection data are equal, it means that there are tangent or intersecting areas in the target site. The intersection data can be sorted according to the reciprocal of the slope of the contour line, and the smaller the reciprocal of the slope of the contour line, the higher the order.

[0093] Sorting the intersection data through steps S350 to S360 facilitates subsequent sequential traversal of multiple intersection data, which helps to speed up the traversal of the intersection data and further speed up the drawing speed of the target site image.

[0094] After step S300, execute step S400: traverse multiple intersection data in sequence according to the order of intersection coordinates, determine two adjacent intersection data with unpaired pairing marks and the same area type as target intersection data, set the pairing mark of the target intersection data to paired, and generate line segment data based on the target intersection data until the pairing marks of multiple intersection data are all set to paired.

[0095] Among them, the line segment data is used to guide the drawing of the image of the target site. Specifically, the data members of the line segment data may include the line segment starting point coordinates, the line segment ending point coordinates and the area type. The area type in the line segment data refers to the screen background of the electronic device, the area outline of the golf course, the fairway, the green, the sand trap, and the pool.

[0096] As an example, Figure 4and Figure 5 As shown, Figure 4 shows a schematic diagram of the structure of the target site image, Figure 5 shows a schematic diagram of the structure of intersection data, Figure 4 The dotted line in is the scan line. At this time, there are ten intersection points A, B, C, D, E, F, G, H, I, and J between the scan line and the contour line. The intersection data corresponding to each intersection point is as follows: Figure 5 As shown, the intersection data are traversed in order from A to J. The intersection data corresponding to point B and the intersection data corresponding to point C are two adjacent intersection data with unpaired pairing flags and the same region type. The intersection data corresponding to point B and the intersection data corresponding to point C can be determined as the target intersection data, and line segment data can be generated based on the target intersection data. Of course, when traversing the intersection data, the intersection data can also be traversed in order from J to A.

[0097] Specifically, if Figure 6 As shown, Figure 6 The flowchart of generating line segment data in the site image drawing method is shown. The step of generating line segment data according to target intersection data in step S400 specifically includes the following steps (steps S410a to S420a):

[0098] Step S410a: If the intersection data does not exist between the target intersection data, the intersection coordinates of the previous intersection data in the target intersection data are determined as the starting coordinates of the line segment, and the intersection coordinates of the next intersection data in the target intersection data are determined as the ending coordinates of the line segment.

[0099] Step S420a: Generate line segment data according to the line segment start point coordinates, the line segment end point coordinates and the area type of the target intersection data.

[0100] As an example, when traversing the intersection data in order from A to J, the intersection data corresponding to point B is the previous intersection data of the target intersection data, and the intersection data corresponding to point C is the next intersection data in the target intersection data. The intersection coordinates in the intersection data corresponding to point B can be determined as the starting point coordinates of the line segment, and the intersection coordinates in the intersection data corresponding to point C can be determined as the end point coordinates of the line segment, and the line segment data R1 can be generated in combination with the area type of the intersection data corresponding to point B (or the area type of the intersection data corresponding to point C).

[0101] Of course, you can also traverse the intersection data in the order from J to A. At this time, the intersection data corresponding to point C is the previous intersection data in the target intersection data, and the intersection data corresponding to point B is the next intersection data in the target intersection data. The intersection coordinates in the intersection data corresponding to point C can be determined as the starting point coordinates of the line segment, and the intersection coordinates in the intersection data corresponding to point B can be determined as the end point coordinates of the line segment, and the line segment data can be generated in combination with the intersection data area type corresponding to point B (or the area type of the intersection data corresponding to point C).

[0102] Through steps S410a to S420a, line segment data can be quickly generated according to the target intersection data, which helps to speed up the drawing speed of the target site image.

[0103] Furthermore, if Figure 6 As shown, in step T1, although the intersection data corresponding to point D and the intersection data corresponding to point I have the pairing marks of unpaired and the area types are the same, there are other points between point D and point I whose pairing marks are unpaired (i.e., point E, point F, point G, and point H). Therefore, in step T1, the intersection data corresponding to point D and the intersection data corresponding to point I are not two adjacent intersection data with the pairing marks of unpaired.

[0104] However, in step T2, the pairing marks of the intersection data corresponding to points E, F, G, and H are all paired. At this time, there are no other points between points D and I with unpaired pairing marks. Therefore, the intersection data corresponding to point D and the intersection data corresponding to point I can be regarded as two adjacent intersection data with unpaired pairing marks. At this time, the intersection data corresponding to point D and the intersection data corresponding to point I can be determined as the target intersection data.

[0105] Since other intersection data exist between the intersection data corresponding to point D and the intersection data corresponding to point I, if the intersection coordinates of the intersection data corresponding to point D and the intersection coordinates of the intersection data corresponding to point I are directly determined as the line segment start coordinates and line segment end coordinates, when drawing the line segment between points D and I, the line segment between points E and F, and the line segment between points G and H will be overwritten. Therefore, to ensure the accuracy of the line segment data, the step of generating line segment data based on the target intersection data in step S400 specifically includes the following steps (steps S410b to S440b):

[0106] Step S410b: If there is intersection data between the target intersection data, the previous intersection data in the target intersection data is determined as the starting point data.

[0107] Among them, Figure 6As shown in step T2 in , if the intersection data is traversed in order from A to J, the intersection data corresponding to point D is the previous intersection data in the target intersection data, and the intersection data corresponding to point D can be determined as the starting point data; if the intersection data is traversed in order from J to A, the intersection data corresponding to point I is the previous intersection data in the target intersection data, and the intersection data corresponding to point I can be determined as the starting point data. For the convenience of subsequent explanation, in the embodiment of the present application, only the case of traversing the intersection data in order from A to J is described. The process of traversing the intersection data in order from J to A is similar to the process of traversing the intersection data in order from A to J, and can be inferred by analogy based on the process of traversing the intersection data in order from A to J.

[0108] Step S420b: Determine whether there is line segment data with the intersection coordinates of the starting point data as the starting point coordinates of the line segment.

[0109] Step S430b: If it exists, the next intersection data after the starting point data is determined as the new starting point data, and the process jumps to step S420b until all the intersection data between the target intersection data are traversed.

[0110] Step S440b: Otherwise, the intersection coordinates of the starting point data are determined as the starting point coordinates of the line segment, and the intersection coordinates of the next intersection data of the starting point data are determined as the end point coordinates of the line segment. The line segment data is generated according to the starting point coordinates, the end point coordinates of the line segment and the area type of the target intersection data, and the next intersection data of the starting point data is determined as the new starting point data. Jump to step S420b until the intersection data between the target intersection data are traversed.

[0111] Specifically, if Figure 6 As shown in step T2 in , R1, R2, and R3 are the line segment data generated in step T1, while R4, R5, and R6 are the line segment data generated in step T2. First, the intersection data corresponding to point D is used as the starting point data. At this time, the intersection coordinates of the starting point data (i.e., the intersection data corresponding to point D) are (x4, y4). There is no line segment data with the intersection coordinates (x4, y4) as the starting point coordinates of the line segment in the line segment data R1, R2, and R3. Therefore, the intersection coordinates of the intersection data corresponding to point D are determined as the starting point coordinates of the line segment, and the intersection coordinates of the next intersection data after the starting point data (i.e., the intersection data corresponding to point D) (i.e., the intersection data corresponding to point E) are determined as the end point coordinates of the line segment. In combination with the area type of the target intersection data (i.e., the intersection data corresponding to point D or the intersection data corresponding to point I), the line segment data R4 is generated.

[0112] Then, the next intersection data of the starting point data (i.e., the intersection data corresponding to point E) is determined as the new starting point data. The intersection coordinates of the starting point data (i.e., the intersection data corresponding to point E) are (x5, y5). Since the starting point coordinates of the line segment data R2 are also (x5, y5), that is, there is line segment data in the existing line segment data with the intersection coordinates of the starting point data as the starting point coordinates of the line segment, there is no need to generate new line segment data. Therefore, the starting point data (i.e., the intersection data corresponding to point E) is skipped, and the next intersection data (i.e., the intersection data corresponding to point F) of the starting point data (i.e., the intersection data corresponding to point E) is determined as the new starting point data.

[0113] At this time, the intersection coordinates of the starting point data (i.e., the intersection data corresponding to point F) are (x6, y6), and there is no line segment data with the intersection coordinates (x6, y6) as the starting point coordinates of the line segment in the line segment data R1, R2, R3 and R4. Therefore, the intersection coordinates of the intersection data corresponding to point F are determined as the starting point coordinates of the line segment, and the intersection coordinates of the next intersection data (i.e., the intersection data corresponding to point G) after the starting point data (i.e., the intersection data corresponding to point F) are determined as the end point coordinates of the line segment, and the line segment data R5 is generated in combination with the area type of the target intersection data (i.e., the intersection data corresponding to point D or the intersection data corresponding to point I).

[0114] By analogy, the intersection data (intersection data corresponding to point E, point F, point G, and point H) between the target intersection data (intersection data corresponding to point D and point I) are traversed in order until all the intersection data between the target intersection data are traversed, and line segment data R6 can be generated again. In addition, Figure 6 The traversal process of step T3 in is similar to that of step T2, and will not be repeated here. When the pairing flags of all intersection data are paired, line segment data R1, R2, R3, R4, R5, R6, R7, R8 and R9 can be generated. These line segment data are respectively Figure 4 The line segments between the points in the .

[0115] By traversing all the intersection data between the target intersection data one by one through steps S410b to S440b, not only can the mutual overlap between the line segment data and thus overlapping drawing be avoided, but omissions can also be avoided, thereby ensuring the accuracy of the line segment data.

[0116] After step S400 , step S500 is executed: drawing an image of the target site according to the line segment data.

[0117] Specifically, the corresponding color or texture is selected according to the area type in the line segment data, and a line segment of the corresponding color and texture is drawn between the line segment start point coordinates and the line segment end point coordinates in the line segment data, so as to complete the drawing of the image of the target site. If the electronic device uses the LVGL embedded graphics framework (LVGL is a lightweight embedded graphics library that can be used in electronic devices such as smart watches and provides functions for drawing line segments), the line drawing function lv_canvas_draw_line can be used to draw line segments.

[0118] As an example, Figure 4 and Figure 6 As shown, if the screen background is off-white, the golf course area outline background is dark green, the fairway is green, the green is light green, the bunker is khaki, and the pool is blue, then according to Figure 6 For the line segment data R1, R2, R3, R4, R5, R6, R7, R8, and R9, a blue line segment is drawn between points B and C, a khaki line segment is drawn between points E and F, a green line segment is drawn between points G and H, a dark green line segment is drawn between points D and E, between points F and G, and between points H and I, and a grayish-white line segment is drawn between points A and B, between points C and D, and between points I and J.

[0119] In the above embodiment, a contour line is first generated using the contour point data, and then when drawing the image of the target site, the contour line is scanned by moving the scan line to draw the image of the target site. Specifically, the intersection of the contour line and the scan line is determined, and line segment data is generated based on the intersection. Finally, a line segment is drawn between the intersection of the contour line and the scan line based on the line segment data, and only one drawing is required between each two adjacent intersections. This allows the image of the target site to be quickly drawn, effectively reducing the memory resources occupied by the target site image, and meeting the operating requirements of low-configuration electronic devices.

[0120] Furthermore, in order to speed up the traversal of intersection data, in some embodiments, as Figure 6 As shown, step S400 specifically includes the following steps:

[0121] Traverse multiple intersection data in the order of intersection coordinates and perform the following steps:

[0122] Step S401: acquiring two adjacent intersection data with pairing marks as unpaired, and obtaining first intersection data and second intersection data.

[0123] Among them, Figure 5Taking the intersection data shown as an example, the intersection data can be traversed in order from A to J, first determining the intersection data corresponding to point A as the first intersection data, and then determining the intersection data corresponding to point B as the second intersection data; or the intersection data can be traversed in order from J to A, first determining the intersection data corresponding to point J as the first intersection data, and then determining the intersection data corresponding to point I as the second intersection data. For ease of explanation, the embodiments of the present application only illustrate the case of traversing the intersection data in order from A to J. The process of traversing the intersection data in order from J to A is similar to the process of traversing the intersection data in order from A to J, and can be inferred from the process of traversing the intersection data in order from A to J.

[0124] Step S402: Determine whether the area type of the first intersection data is the same as the area type of the second intersection data.

[0125] Step S403: If they are the same, the first intersection data and the second intersection data are determined as the target intersection data, and the pairing flag of the target intersection data is set to paired, and the line segment data is generated according to the target intersection data. The last two intersection data with pairing flags as unpaired are obtained in sequence to obtain the new first intersection data and second intersection data, and jump to step S402 until the intersection data is traversed.

[0126] Step S404: Otherwise, the second intersection data is determined as the new first intersection data, and the next intersection data with the pairing mark as unpaired is obtained to obtain the new second intersection data, and jump to step S402 until all the intersection data are traversed.

[0127] Step S405: Jump to step S401 until the pairing flags of the intersection data are all set to paired.

[0128] Specifically, if Figure 6 As shown, step T1 is the first round of traversal. First, the first intersection data (i.e., the intersection data corresponding to point A) and the second intersection data (i.e., the intersection data corresponding to point B) of two adjacent pairing marks that are unpaired are obtained, and step S402 is executed. Since the area type of the intersection data corresponding to point A is the screen background, and the area type of the intersection data corresponding to point B is the pool, the area types of the two are different, and there is no need to generate line segment data. Instead, the traversal continues backward, that is, the intersection data corresponding to point B is determined as the new first intersection data, and the next intersection data (i.e., the intersection data corresponding to point C) with a pairing mark as unpaired is obtained as the new second intersection data.

[0129] Then continue to execute step S402. At this time, the area type of the first intersection data (i.e., the intersection data corresponding to point B) is a pool, and the area type of the second intersection data (i.e., the intersection data corresponding to point C) is also a pool. The area types of the two are the same, and pairing can be completed. The intersection data corresponding to point B and the intersection data corresponding to point C are determined as target intersection data, and the pairing flags of the intersection data corresponding to point B and the intersection data corresponding to point C are both set to paired, and line segment data is generated according to the target intersection data.

[0130] Then, continue to traverse backward, that is, determine the intersection data corresponding to point D as the new first intersection data, determine the intersection data corresponding to point E as the new second intersection data, and execute step S402, repeat the above process until all intersection data are traversed, that is, traverse to the intersection data corresponding to point J. After a round of traversal of step T1, the three line segment data R1, R2 and R3 can be generated.

[0131] Then execute step S405 to enter the second round of traversal. Figure 6 In step T2, the three line segment data of R4, R5 and R6 are generated. The specific traversal process of step T2 is similar to the traversal process of step T1, which will not be repeated here. Then, step S405 is executed to enter the third round of traversal, that is, Figure 6 In step T3, three line segment data sets (R7, R8, and R9) are generated. At this point, the pairing flags for all intersection data points are set to "paired." Step S500 can then be executed to draw an image of the target site based on the line segment data. The specific traversal process in step T3 is similar to that in step T1 and will not be further described here.

[0132] In the above embodiment, during each round of traversal, all intersection data that meet the condition that two adjacent pairing marks are unpaired and have the same area type can be paired, which is beneficial for reducing the number of traversal rounds, speeding up the traversal of intersection data, and improving the efficiency of drawing the target site image.

[0133] Furthermore, since the display screen sizes of different electronic devices vary, and the contour point data of the target site is typically pre-stored on a server or electronic device, in order to ensure that a complete image of the target site can be displayed on the display screen of the electronic device, the contour point data needs to be modified according to the display screen size of the electronic device when drawing the image of the target site. In some embodiments, after step S100, the method further includes the following steps:

[0134] Step S110: Acquire the display screen size of the electronic device and the preset display size of the target site.

[0135] Specifically, the contour point data of the target site can be obtained by annotating a satellite image of the target site and then performing coordinate conversion, and the display size of the target site is the size of a display screen used to display the satellite image during the annotation process.

[0136] Step S120: determining a zoom ratio according to a ratio between the display screen size and a preset display size.

[0137] Step S130: Correcting the contour point data according to the scaling ratio, so as to draw an image of the target site on the display screen of the electronic device according to the corrected contour point data.

[0138] The contour point data is scaled according to the scaling ratio so that the coordinates in the contour point data can all fall within the coordinate system of the display screen of the electronic device and do not exceed the display range of the display screen. If the display screen size is larger than the preset display size, the coordinates in the contour point data need to be enlarged to display the largest image of the target site on the electronic device. If the display screen size is smaller than the preset display size, the coordinates in the contour point data need to be reduced to display the complete image of the target site on the display screen of the electronic device. Specifically, the contour point data can be corrected using the following formula:

[0139] scale_x i =watch_x i ×scale_rate (1)

[0140] scale_y i =watch_y i ×scale_rate (2)

[0141] Among them, scale_rate refers to the scaling ratio, watch_x i Refers to the original X-axis coordinate in the contour point data, scale_x i Refers to the corrected X-axis coordinate, watch_y i Refers to the original Y-axis coordinate in the contour point data, scale_y i Refers to the corrected Y-axis coordinate.

[0142] In the above embodiment, by determining the scaling ratio between the display screen size of the electronic device and the preset display size of the target site, the contour point data is corrected so that the size of the target site image is compatible with the display screen size of the electronic device. This can prevent the rendered target site image from being too small or incomplete, thereby improving the applicability of the site image rendering method.

[0143] Furthermore, when viewing the image of the target site, the user may rotate the image in order to view it more carefully. In order to quickly display the rotated image of the target site, in some embodiments, the method further includes the following steps:

[0144] Step S610: In response to the image rotation instruction, obtain rotation data of the target site.

[0145] Step S620: transform the contour point data according to the rotation data.

[0146] Step S630: redrawing the image of the target site according to the transformed contour point data.

[0147] Specifically, when the user needs to rotate the image, in response to the image rotation instruction, the rotation data of the target site is obtained, including but not limited to the angle or radian of the counterclockwise rotation of the image, and the contour line data is transformed using the rotation data. As an example, the data can be transformed using the following formula:

[0148] rotate_x i =watch_x i ×cos(radian)-watch_y i ×sin(radian)

[0149] rotate_y i =watch_x i ×sin(radian)-watch_y i ×cos(radian)

[0150] Among them, radian refers to the rotation data (that is, the arc of the target site's counterclockwise rotation), watch_x i Refers to the original X-axis coordinate in the contour point data, rotate_x i Refers to the transformed X-axis coordinate, watch_y i Refers to the original Y-axis coordinate in the contour point data, rotate_y i refers to the transformed Y-axis coordinate, sin refers to the sine function, and cos refers to the cosine function.

[0151] Finally, the rotated image of the target site is redrawn on the display screen of the electronic device through the target site image drawing process described in any of the above embodiments, and the drawing of the rotated image is quickly completed.

[0152] Furthermore, when viewing the image of the target site, the user may perform a translation operation on the image in order to view the image carefully. In order to quickly display the translated image of the target site, in some embodiments, the method further includes the following steps:

[0153] Step S710: In response to the image translation instruction, obtaining translation data of the target site.

[0154] Step S720: transform the contour point data according to the translation data.

[0155] Step S730: Filter the transformed contour point data according to the display screen size of the electronic device.

[0156] Step S740: redrawing the image of the target site according to the filtered contour point data.

[0157] Specifically, when the user moves the image of the target site, in response to the image translation instruction, the translation data of the target site is obtained, including but not limited to the offset of the X-axis coordinate (i.e., the distance moved in the direction indicated by the X-axis), the offset of the Y-axis coordinate (i.e., the distance moved in the direction indicated by the Y-axis), etc. Then, the contour point data is transformed using the translation data, and the transformation can be performed specifically using the following formula:

[0158] move_x i =watch_x i +x_offest

[0159] move_y i =watch_y i +y_offest

[0160] Among them, x_offest refers to the offset of the X-axis coordinate, y_offest refers to the offset of the Y-axis coordinate, watch_x i Refers to the original X-axis coordinate in the contour point data, move_x i Refers to the transformed X-axis coordinate, watch_y i Refers to the original Y-axis coordinate in the contour point data, move_y i Refers to the transformed Y-axis coordinate.

[0161] Due to the limitations of the display screen of the electronic device, when the image moves a large distance, part of the content on the image will be moved outside the display screen, and this part of the content will not be able to be displayed on the display screen of the electronic device. In order to reduce the amount of calculation, the transformed contour point data can be filtered according to the display screen size of the electronic device, and the data that exceeds the display screen range can be filtered out, and the image of the target site can be redrawn based on only the data within the display screen range.

[0162] Finally, the target site image after translation is redrawn on the display screen of the electronic device through the target site image drawing process described in any of the above embodiments, and the drawing of the translated image is quickly completed. By filtering the contour point data, only the contour point data that can be displayed on the display screen of the electronic device is retained, thereby effectively reducing the amount of calculation.

[0163] Furthermore, when viewing the image of the target site, the user may zoom in or out of the image in order to view the image carefully. In order to quickly display the zoomed in or out image of the target site, in some embodiments, the method further includes the following steps:

[0164] Step S810: In response to the image zoom instruction, the zoom factor of the target site is obtained, and the center of the display screen of the electronic device is determined as a new coordinate origin.

[0165] Step S820: transform the contour point data according to the new coordinate origin and scaling factor.

[0166] Step S830: Filter the transformed contour point data according to the display screen size of the electronic device.

[0167] Step S840: redrawing the image of the target site according to the filtered contour point data.

[0168] Specifically, when the user zooms in or out of the image of the target site, the zoom factor of the target site can be obtained in response to the image zoom instruction, so that the contour point data can be transformed according to the zoom factor. In addition, since the image zoom process is usually performed based on the center position of the image, the coordinates of the contour point data need to be based on the center of the display screen of the electronic device as the coordinate origin. Specifically, the coordinates of the contour point data can be scaled and transformed using formulas (1) and (2), and the coordinate system of the contour point data can be converted based on the new coordinate origin.

[0169] Due to the limitations of the display screen of electronic devices, when the image magnification is large, part of the content on the image will exceed the display range of the display screen, and this part of the content will not be able to be displayed on the display screen of the electronic device. In order to reduce the amount of calculation, the transformed contour point data can be filtered according to the display screen size of the electronic device, and the data that exceeds the display screen range can be filtered out, and the image of the target site can be redrawn based on only the data within the display screen range.

[0170] Finally, the scaled target site image is redrawn on the display screen of the electronic device through the target site image drawing process described in any of the above embodiments, and the drawing of the scaled image is quickly completed. By filtering the contour point data, only the contour point data that can be displayed on the display screen of the electronic device is retained, effectively reducing the amount of calculation.

[0171] It should be noted that the aforementioned rotation, translation, and scaling operations can be combined. For example, to zoom in on a specific area of ​​the target site, the area can be first translated to the center of the display screen, and then the image displayed on the display screen can be zoomed in. Alternatively, the image displayed on the display screen can be zoomed in first, and then the corresponding area can be translated to the center of the display screen. Furthermore, while the image can be drawn based solely on the filtered contour point data to reduce computational complexity, in order to ensure the integrity of the target site image, all contour point data must be transformed when transforming the contour point data to avoid data loss when combining multiple operations.

[0172] According to another aspect of the embodiment of the present application, a venue image drawing device is also provided. Figure 7 FIG. 1 shows a schematic diagram of the structure of a site image drawing device provided by an embodiment of the present application. Figure 7 As shown, the device 1 includes: an acquisition module 11, a contour line generation module 12, a scanning module 13, a line segment data generation module 14 and a drawing module 15.

[0173] The acquisition module 11 is configured to acquire multiple contour point data corresponding to each region of the target site, wherein the multiple regions comprise the target site, and the multiple contour point data comprise the contours of the regions. The contour line generation module 12 is configured to generate multiple contour lines corresponding to each region based on the contour point data corresponding to each region, wherein the contour lines include region types. The scanning module 13 is configured to scan the contour lines at a preset step size and acquire multiple intersection data between the scanned lines and the contour lines, wherein the intersection data includes intersection coordinates, region types, and a pairing flag, with the pairing flag initially set to unpaired. The line segment data generation module 14 is configured to sequentially traverse the multiple intersection data in the order of intersection coordinates, identify two adjacent intersection data with the same pairing flag set to unpaired and the same region type as target intersection data, set the pairing flag of the target intersection data to paired, and generate line segment data based on the target intersection data until the pairing flags of all the multiple intersection data are set to paired. The drawing module 15 is configured to draw an image of the target site based on the line segment data.

[0174] In the above embodiment, a contour line is first generated using contour point data, and then when drawing the image of the target site, the contour line is scanned by moving the scan line while drawing the image of the target site. Specifically, the intersection of the contour line and the scan line is determined, and line segment data is generated based on the intersection. Finally, a line segment is drawn between the intersection of the contour line and the scan line based on the line segment data, and only one drawing is required between each two adjacent intersections. In this way, the image of the target site can be quickly drawn, the memory resources occupied by the target site image can be reduced, and the operating requirements of low-configuration electronic devices can be met.

[0175] According to another aspect of the embodiments of the present application, an electronic device is provided. Figure 8 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown. The specific embodiment of the present application does not limit the specific implementation of the electronic device.

[0176] like Figure 8 As shown, the electronic device 2 may include: a processor 21 and a memory 22 .

[0177] The memory 22 is used to store a computer program 23. The memory 22 may include a high-speed RAM memory, or may also include a non-volatile memory, such as at least one disk memory. The computer program 23 may include computer-executable instructions.

[0178] The processor 21 is configured to execute the computer program 23 to implement the above-mentioned method embodiment for rendering a site image.

[0179] The processor 21 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the electronic device may be processors of the same type, such as one or more CPUs, or may be processors of different types, such as one or more CPUs and one or more ASICs.

[0180] An embodiment of the present application provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned embodiment of the method for drawing a site image is implemented.

[0181] An embodiment of the present application provides a computer program, which can be executed by a processor to implement the above-mentioned embodiment of the site image rendering method.

[0182] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the above-mentioned venue image method embodiment is implemented.

[0183] In the several embodiments provided in this application, if any function is implemented in the form of a software function module / unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, part or all of the technical solution of this application can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, server or other electronic device) to execute all or part of the steps of the method described in each embodiment of this application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, and other media that can store computer program code.

[0184] The algorithm or demonstration provided here are not inherently relevant to any particular computer, virtual system or other equipment. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious that the structure required for constructing this type of system. In addition, the present application embodiment is not directed to any specific programming language yet. It should be understood that various programming languages ​​can be utilized to realize the content of the present application described here, and the above description of specific languages ​​is for the purpose of disclosing the best mode of implementation of the present application.

[0185] It should be noted that the above embodiments illustrate rather than limit the present application, and that a person skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between brackets should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application may be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In claims that list several means, several units or modules of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments should not be understood as limiting the order of execution unless otherwise specified.

[0186] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A method for drawing a site image, characterized in that: The method comprises: Acquire a plurality of contour point data corresponding to each area on the target site, wherein the plurality of areas constitute the target site, and the plurality of contour point data constitute the contour of the area; generating a plurality of contour lines corresponding to each of the regions according to the contour point data corresponding to each of the regions, wherein the contour lines include region types; Scanning the contour line according to a preset step length to obtain a plurality of intersection data between the scan line and the contour line, wherein the intersection data includes intersection coordinates, area type, and a pairing flag, and the initial value of the pairing flag is unpaired; Sequentially traversing the plurality of intersection data in the order of the intersection coordinates, determining two adjacent intersection data with pairing flags set to unpaired and with the same area type as target intersection data, setting the pairing flags of the target intersection data to paired, and generating line segment data based on the target intersection data until the pairing flags of the plurality of intersection data are all set to paired; An image of the target site is drawn according to the line segment data.

2. The method for drawing a site image according to claim 1, wherein: Generating line segment data according to the target intersection data specifically includes: If the intersection data does not exist between the target intersection data, the intersection coordinates of the previous intersection data in the target intersection data are determined as the starting coordinates of the line segment, and the intersection coordinates of the next intersection data in the target intersection data are determined as the ending coordinates of the line segment; The line segment data is generated according to the line segment start point coordinates, the line segment end point coordinates and the area type of the target intersection point data.

3. The method for drawing a site image according to claim 2, wherein: Generating line segment data according to the target intersection data specifically includes: If the intersection data exists between the target intersection data, determining the previous intersection data in the target intersection data as the starting point data; Determine whether there is line segment data with the intersection coordinates of the starting point data as the starting point coordinates of the line segment; If so, the next intersection data after the starting point data is determined as the new starting point data, and the process jumps to the step of determining whether there is line segment data with the intersection coordinates of the starting point data as the starting point coordinates of the line segment, until all the intersection data between the target intersection data are traversed; Otherwise, the intersection coordinates of the starting point data are determined as the starting point coordinates of the line segment, and the intersection coordinates of the intersection data after the starting point data are determined as the end point coordinates of the line segment, the line segment data is generated according to the line segment starting point coordinates, the line segment end point coordinates and the area type of the target intersection data, and the intersection data after the starting point data is determined as the new starting point data, and the process jumps to the step of determining whether there is line segment data with the intersection coordinates of the starting point data as the starting point coordinates of the line segment, until the intersection data between the target intersection data are traversed.

4. The method for drawing a site image according to claim 1, wherein: Generating a plurality of contour lines corresponding to each of the regions according to the contour point data corresponding to each of the regions specifically includes: Traversing the contour point data corresponding to each of the regions respectively to obtain adjacent first contour point data and second contour point data, wherein the contour point data includes first coordinate data and second coordinate data; determining whether the first coordinate data of the first contour point data is smaller than the first coordinate data of the second contour point data; If the first coordinate data of the first contour point data is less than the first coordinate data of the second contour point data, determining the first coordinate data of the first contour point data as the preset scanning data, determining the starting point coordinates according to the first coordinate data and the second coordinate data of the first contour point data, and determining the ending point coordinates according to the first coordinate data and the second coordinate data of the second contour point data; If the first coordinate data of the first contour point data is greater than the first coordinate data of the second contour point data, determining the first coordinate data of the second contour point data as the preset scanning data, determining the starting point coordinates according to the first coordinate data and the second coordinate data of the second contour point data, and determining the ending point coordinates according to the first coordinate data and the second coordinate data of the first contour point data; Matching the preset scanning data, the starting point coordinates, the end point coordinates, and the area type corresponding to the area to generate the contour line; Determine the second contour point data as the new first contour point data, obtain the next contour point data as the new second contour point data, and jump to the step of determining whether the first coordinate data of the first contour point data is less than the first coordinate data of the second contour point data until the contour point data is traversed.

5. The method for drawing a site image according to claim 4, wherein: The acquiring of a plurality of intersection data between the scan line and the contour line specifically includes: If the value of the scan line is equal to the preset scan data of the contour line, determining the starting point coordinates of the contour line as the intersection coordinates; If the value of the scan line is greater than the preset scan data of the contour line, and the value of the scan line is less than the first coordinate data of the end point coordinates of the contour line, calculating the slope and intercept of the contour line according to the start point coordinates and the end point coordinates of the contour line, and determining the intersection coordinates according to the value of the scan line, the slope and the intercept of the contour line; If the scan line value is greater than the scan line data, and the scan line value is equal to the first coordinate data in the end point coordinates of the contour line, determining the end point coordinates of the contour line as the intersection coordinates; The intersection data is generated according to the pairing flag, the intersection coordinates, and the area type of the contour line.

6. The method for drawing a site image according to claim 1, wherein: The intersection point data further includes the slope of the contour line, and the intersection point coordinates include second coordinate data; After acquiring a plurality of intersection data between the scan line and the contour line, the method further includes: sorting the plurality of intersection point data according to the second coordinate data of the intersection point coordinates; If there are a plurality of intersection data whose second coordinate data of the intersection coordinates are equal, the plurality of intersection data whose second coordinate data are equal are sorted according to the slope of the contour line in the intersection data.

7. The method for drawing a site image according to claim 1, wherein: The step of sequentially traversing the plurality of intersection data in the order of the intersection coordinates, determining two adjacent intersection data with unpaired pairing flags and the same area type as target intersection data, setting the pairing flags of the target intersection data to paired, and generating line segment data according to the target intersection data until the pairing flags of the plurality of intersection data are all set to paired, specifically includes: Traverse the plurality of intersection point data sequentially according to the order of the intersection point coordinates, and perform the following steps: Obtaining the intersection data of two adjacent pairing marks as unpaired to obtain the first intersection data and the second intersection data; determining whether the region type of the first intersection data and the region type of the second intersection data are the same; If they are the same, the first intersection data and the second intersection data are determined as target intersection data, and the pairing flag of the target intersection data is set to paired, line segment data is generated according to the target intersection data, and the next two intersection data with the pairing flags being unpaired are sequentially obtained to obtain new first intersection data and second intersection data, and the process jumps to the step of determining whether the area type of the first intersection data and the area type of the second intersection data are the same, until all the intersection data are traversed; Otherwise, the second intersection data is determined as the new first intersection data, and the next intersection data whose pairing flag is unpaired is obtained to obtain the new second intersection data, and the process jumps to the step of determining whether the area type of the first intersection data and the area type of the second intersection data are the same, until all the intersection data are traversed; Jump to the step of obtaining two adjacent intersection data with pairing flags indicating unpaired, and obtain first intersection data and second intersection data, until the pairing flags of the intersection data are all set to paired.

8. The method for drawing a site image according to claim 1, wherein: After obtaining the plurality of contour point data corresponding to each area on the target site, the method further includes: Obtaining the display screen size of the electronic device and the preset display size of the target site; determining a zoom ratio according to a ratio between the display screen size and the preset display size; The contour point data is corrected according to the scaling ratio, so as to draw the image of the target site on the display screen of the electronic device according to the corrected contour point data.

9. The method for drawing a site image according to claim 1, wherein: The method further comprises: In response to the image rotation instruction, obtaining rotation data of the target site; transforming the contour point data according to the rotation data; Redraw the image of the target site according to the transformed contour point data; and / or, The method further comprises: In response to the image translation instruction, acquiring translation data of the target site; transforming the contour point data according to the translation data; screening the transformed contour point data according to the display screen size of the electronic device; Redraw the image of the target site according to the filtered contour point data; and / or, The method further comprises: In response to the image zoom instruction, obtaining a zoom factor of the target site, and determining the center of the display screen of the electronic device as a new coordinate origin; transforming the contour point data according to the new coordinate origin and the scaling factor; screening the transformed contour point data according to the display screen size of the electronic device; The image of the target site is redrawn according to the filtered contour point data.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory, wherein: The processor executes the computer program to implement the site image drawing method according to any one of claims 1 to 9.