Implementation of map tagging

Source: Internet
Author: User

Map annotation, also known as map annotation, It is one of the main contents of the electronic map display. The choice of the location of the note is appropriate and the arrangement is beautiful, which will directly affect the clarity and ease of use of the electronic map. Therefore, in a mobile note, how to control the position and layout of the note, and solve the conflicts and pressure issues between the notes is the focus and key to solving the automatic configuration problem of the note. In traditional map creation, the overall effect of the map needs to be taken into account in the drawing personnel's configuration annotation. The selection of the location of a certain element annotation takes into account the selection of images and locations of other elements around the map, this process is a highly intelligent activity of the human brain. Therefore, you must use a computer to complete automatic configuration of Electronic Map annotations. , The software must adopt a certain mechanism to achieve satisfactory results. Currently, Electronics Automatic Configuration of map annotation most use local search ,Algorithm A large number of interactive methods are needed to make up for their shortcomings, thus reducing the configuration efficiency. To overcome the disadvantages of Local Search , In recent years, many scholars have made many attempts to apply the composite optimization theory to the automatic configuration of map annotation. Well-known algorithms include physical relaxation, integer planning, and continuous gradient descent. This article introduces a grid-based automatic tagging algorithm to detect conflicts and compress the cover, so as to improve the speed and Effect of mobile note configuration in electronic maps. This algorithm requires a small amount of computing and can automatically configure the annotation of various elements in the electronic map.

Note the need to pay attention to automatic labeling. First, it is required that there should be no overlapping situations (the labeling cannot be squashed, but the labeling cannot be squashed to point elements). Then, it is required to make full use of the screen space for labeling, the last step is to conform to the reader's reading habits, that is, labeling from top to bottom and from left to right.

Map elements can be divided into three types: points, lines, and surfaces. According to the differences of the main elements to be displayed on a map, there are some differences in the tagging strategy. For example, for a navigation-Based Map, line labeling is the first step, followed by points and faces. Readers can design their own tagging policies. The following describes how to add a line first.

Map tagging steps:

①We use a similar method of Grid index to calculate a grid size based on the text size (to ensure that the number of grids occupied by a text is a fixed value ), create a screen mesh index (using screen coordinates ).

②Coordinates the coordinates of all map elements from the actual coordinates to the screen coordinates.

③Because the annotation cannot compress the dot-like elements, the grids occupied by all the dot-like elements are calculated and marked as ununlabeled.

④Mark all elements on all vertices. The position of the annotation can be on the right, left, or top of the vertex. After labeling, you need to set the grid occupied by the labeling as not labeled.

⑤Mark all elements on the wired layer, and label the elements based on the average grid occupied by the line. The same distance label is used. After labeling, you need to set the grid occupied by the labeling as not labeled.

⑥Mark all elements on all surface layers, and mark the center of the grid occupied by the surface. After labeling, you need to set the grid occupied by the labeling as not labeled.

Raster tagging algorithm Data Structure: uses a two-dimensional array consistent with the screen mesh to mark whether its corresponding mesh can be labeled. Set the two-dimensional dataFlag, IfFlag [2] [3] = false, Indicating that the grid in the third column of the second row can be labeled.

The following sections describe the differences between points, lines, and surface labels.

5.1Point Annotation

The position of the vertex annotation can be on the right, left, or top of the vertex. First, determine whether the position on the right can be labeled (whether the annotation needs to occupy the grid or not). If not, determine the grid on the left, similarly, judge the above grid.

Algorithm: DesignPtindexThe function can calculate the grid occupied by points, and the grid row number.= (INT )(Vertex'sYCoordinate grid height), Grid column number= (INT )(Vertex'sXCoordinate worker grid width).

For example, 1 As shown in, the screen is divided into several grids, each grid can accommodate the next Chinese character, and each point element is labeled as the grid to be occupied. Hypothesis 1 Of Name For "Nanjing University", four grids are required for labeling, and the grid from column 6 to column 9 of the fifth line is required for labeling. The four grids can be labeled, so the words "Nanjing University" are drawn in the grid, and the four grids correspond Flag Set True . 2 There is a grid on the right of the vertex that is occupied by the vertex. Therefore, mark it to the left and Flag Set True .

 

 

5.2Line labeling

Line labeling first calculates the grid occupied by the line, and then marks the line in the order from left to right and from top to bottom.

Algorithm:

①Determine the line direction. According to the minimum outsourcing rectangle of the line (MBR) To determine the general direction of the qualifying line. WiredMBRThe abscissaXminAndXmaxAnd the ordinate values areYminAndYmax.2, Line in the left GraphMBRQualified(Ymax-ymin)> (xmax-xmin)It indicates that this line is North-South (from top to bottom when marking), and vice versa (from left to right when marking ).

 

 

①DesignPlindexThe function can calculate the grid occupied by lines. here we can useBresenhamInteger raster algorithm.

②Design the labeling policy. This document uses the equals labeling policy, that is, the number of equal grids for each blank text. If a grid cannot be marked, move the Grid forward or backward and try again. If the grid cannot be marked, the entire line is not marked.

 

For example,3As shown in, the shadow part is the grid occupied by lines. The four words "Zhongshan East Road" are marked in four grids. Determine whether the line is east-west, mark it from left to right, and calculate the public grid occupied by the outlet.18In3Number, number7Number, number11Number, number15Grid. There is a problem with this annotation. The annotation may deviate from the line. To solve this problem, you can use the mesh encryption method to make a Chinese character occupy four or even nine grids, this can reduce the distance between Chinese characters.

 

5.3Area labeling

Steps:

①Grid occupied by computing surface elements.

②Based on the ratio of the length and width of the smallest outsourcing rectangle of the surface element, the orientation of the surface annotation is determined.

③Based on the grid data in the horizontal direction and vertical direction, perform horizontal and vertical segmentation to determine the location of the annotation.

④Determine whether the selected grid can be labeled.

⑤Write annotation.

 

For example,4According to the length-width ratio of the polygon, it is determined that the surface annotation is east-west. Calculate the grid occupied by the polygon, and use the horizontal and vertical separation policies to determine the note position. Labels are respectively on the grid.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.