# 动态地图标注算法

Dynamic maps that allow continuous map rotations, e.g., on mobile devices, encounter new issues unseen in static map labeling before. We study the following dynamic map labeling problem: The input is a static, labeled map, i.e., a set P of points in the plane with attached nonoverlapping horizontal rectangular labels. The goal is to find a consistent labeling of P under rotation that maximizes the number of visible labels for all rotation angles such that the labels remain horizontal while the map is rotated. A labeling is consistent if a single active interval of angles is selected for each label such that labels neither intersect each other nor occlude points in P at any rotation angle. We first introduce a general model for labeling rotating maps and derive basic geometric properties of consistent solutions. We show NP completeness of the active interval maximization problem even for unitsquare labels. We then present a constant-factor approximation for this problem based on line stabbing, and refine it further into an efficient polynomial-time approximation scheme (EPTAS). Finally, we extend the EPTAS to the more general setting of rectangular labels of bounded size and aspect ratio.

1 Introduction

Dynamic maps, in which the user can navigate continuously through space, are becoming increasingly important in scientiﬁc and commercial GIS applications as well as in personal mapping applications. In particular GPS-equipped mobile devices oﬀer various new possibilities for interactive, location-aware maps. A common principle in dynamic maps is that users can pan, rotate, and zoom the map view. Despite the popularity of several commercial and free applications, relatively little attention has been paid to provably good labeling algorithms for dynamic maps.

Been et al. [2] identified a set of consistency desiderata for dynamic map labeling. Labels should neither "jump" (suddenly change position or size) nor "pop" (appear and disappear more than once) during monotonous map navigation; moreover, the labeling should be a function of the selected map viewport and not depend on the user's navigation history. Previous work on the topic has focused solely on supporting zooming and/or panning of the map [2,3,11],whereas consistent labeling under map rotations has not been considered prior to this paper.

Most maps come with a natural orientation (usually the northern direction facing upward), but applications such as car or pedestrian navigation often rotate the map view dynamically to be always forward facing [5]. Still, the labels must remain horizontally aligned for best readability regardless of the actual rotation angle of the map. A basic requirement in static and dynamic label placement is that labels are pairwise disjoint, i.e., in general not all labels can be placed simultaneously. For labeling point features, it is further required that each label, usually modeled as a rectangle, touches the labeled point on its boundary. It is often not allowed that labels occlude the input point of another label. Figure 1 shows an example of a map that is rotated and labeled. The objective in map labeling is usually to place as many labels as possible. Translating this into the context of rotating maps means that, integrated over one full rotation from 0 to 2π, we want to maximize the number of visible labels. The consistency requirements of Been et al. [2] can immediately be applied for rotating maps.

Our Results. Initially, we define a model for rotating maps and show some basic properties of the different types of conflicts that may arise during rotation. Next, we prove that consistently labeling rotating maps is NP-complete, for the maximization of the total number of visible labels in one full rotation and NP hard for the maximization of the visibility range of the least visible label. Finally, we present a new 1/4-approximation algorithm and an efficient polynomial-time approximation scheme (EPTAS) for unit-height rectangles. A PTAS is called efficient if its running time is O(f(ε)·poly(n)). Both algorithms can be extended to the case of rectangular labels with the property that the ratio of the smallest and largest width, the ratio of the smallest and largest height, as well as the aspect ratio of every label is bounded by a constant, even if we allow the anchor point of each label to be an arbitrary point of the label. This applies to most practical scenarios where labels typically consist of few and relatively short lines of text.

Related Work. Most previous algorithmic research efforts on automated label placement cover static labeling models for point, line, or area features. For static point labeling, fixed-position models and slider models have been introduced [4, 8], in which the label, represented by its bounding box, needs to touch the labeled point along its boundary. The label number maximization problem is NP-hard even for the simplest labeling models, whereas there are efficient algorithms for the decision problem that asks whether all points can be labeled in some of the simpler models (see the discussion by Klau and Mutzel [7] or the comprehensive map labeling bibliography [14]). Approximation results [1,8], heuristics [13], and exact approaches [7] are known for many variants of the static label number maximization problem.

In recent years, dynamic map labeling has emerged as a new research topic that gives rise to many unsolved algorithmic problems. Petzold et al. [12] used a preprocessing step to generate a reactive conflict graph that represents possible label overlaps for maps of all scales. For any fixed scale and map region, their method computes a conflict-free labeling using heuristics. Mote [10] presents another fast heuristic method for dynamic conflict resolution in label placement that does not require preprocessing. The consistency desiderata of Been et al. [2] for dynamic labeling (no popping and jumping effects when panning and zooming), however, are not satisﬁed by either of the methods. Been et al. [3] showed NP-hardness of the label number maximization problem in the consistent labeling model and presented several approximation algorithms for the problem. N¨ollenburg et al. [11] recently studied a dynamic version of the alternative boundary labeling model, in which labels are placed at the sides of the map and connected to their points by leaders. They presented an algorithm to precompute a data structure that represents an optimal one-sided labeling for all possible scales and thus allows continuous zooming and panning. None of the existing dynamic map labeling approaches supports map rotation.

（大意是近年来有一些解决方法，但都不解决地图旋转时的动态持续性标注问题）近年来，动态地图标注作为一个新的研究课题，产生了许多尚未解决的算法问题。Petzold等人。[12]使用预处理步骤生成反应冲突图，该图表示所有比例尺地图可能的标签重叠。对于任何固定的比例尺和地图区域，他们的方法使用启发式计算无冲突标记.。Mote[10]提出了另一种不需要预处理的快速启发式方法来解决标签放置中的动态冲突。等的一致性要求。[2]对于动态标记(在平移和缩放时没有弹出和跳跃效果)，这两种方法中的任何一种都不能满足ﬁ的要求。被等人。[3]证明了一致标号模型中标签数最大化问题的NP-困难性，并给出了几种近似算法。Ollenburg等人。[11]最近研究了一种动态的替代边界标注模型，其中标签放置在地图的两侧，并由领导将标签连接到它们的点上。他们提出了一种预先计算数据结构的算法，该结构表示所有可能的尺度的最优单边标记，从而允许连续缩放和平移。现有的动态地图标注方法都不支持地图旋转。

2 Model

In this section we describe a general model for rotating maps with axis-aligned rectangular labels. Let M be a labeled input map, i.e., a set P = {p1,...,pn} of points in the plane together with a set L = {1,...,n} of pairwise disjoint, closed, and axis-aligned rectangular labels, where each point pi is a point on the boundary ∂i of its label i. We say i is anchored at pi. As M is rotated, each label i in L remains horizontally aligned and anchored at pi. Thus, label intersections form and disappear during rotation of M. We take the following alternative perspective on the rotation of M. Rather than rotating the points, say clockwise, and keeping labels horizontal we may instead rotate each label around its anchor point counterclockwise and keep the set of points ﬁxed. It is easy to see that both rotations are equivalent and yield exactly the same results.

A rotation of L is defined by a rotation angle α ∈ [0,2π); a rotation labeling of M is a function φ: L×[0,2π) →{0,1}such that φ(,α) = 1 if label  is visibleor active in the rotation of L by α, and φ(,α) = 0 otherwise. We call a labeling φ valid if, for any rotation α, the set of labels L(α) = { ∈ L | φ(,α) = 1} consists of pairwise disjoint labels and no label in L(α) contains any point in P (other than its anchor point). We note that a valid labeling is not yet consistent in terms of the definition of Been et al. [2,3]: given fixed anchor points, labels clearly do not jump and the labeling is independent of the rotation history, but labels may still pop during a full rotation from 0 to 2π, i.e., appear and disappear more than once. In order to avoid popping effects, each label may be active only in a single contiguous range of [0,2π), where ranges are circular ranges modulo 2π so that they may span the input rotation α = 0. A valid labeling φ, in which for every label  the set Aφ() = {α ∈ [0,2π) | φ(,α) = 1} is a contiguous range modulo 2π, is called a consistent labeling. For a consistent labeling φ the set Aφ() is called the active range of . The length |Aφ()| of an active range Aφ() is defined as the length of the circular arc {(cosα,sinα) | α ∈ Aφ()} on the unit circle.

L的旋转定义为旋转角α∈[0，2π)；M的旋转标注是函数φ：l×[0，2π)→{0，1}使φ(l，α)=1，如果标签l在α的旋转中可见或活跃，否则的话φ(l，α)=0.。我们称一个标注函数φ为有效的，如果对于任何旋转α，标记集L(α)={l∈L | (φ(l，α)=1}由两两不相交的标记组成，且L(α)中的任何标记都不包含P中的任何点(除了它的锚点之外)。我们注意到，有效的标记在定义等方面与参考文献[2，3]还不一致：给定固定的锚点，标签明显不跳，标签独立于旋转历史，但标签仍然可能在0到2π的全旋转期间弹出，即出现和消失不止一次。为了避免弹出效果，每个标签只能在[0，2π)的单个连续范围内活动，其中范围是模2π的圆形范围，因此它们可以跨越输入旋转α=0。一个有效的标记函数φ称为持续性标注，其中对每一个标签 l 集合 Aφ(l)={α∈[0，2π)|φ(，α)=1}是一个连续的模2π.。对于持续性标注函数φ，集合Aφ(l)称为标注l的活动范围。有效范围Aφ(l)的长度length|Aφ(l)|`定义为单位圆上的圆弧{(cosα，sinα)|α∈Aφ(l)}的长度。

3 Properties of consistent labelings