1#ifndef NAVIT_GUI_QML_POINT_H
2#define NAVIT_GUI_QML_POINT_H
8 sprintf(
buffer,
"%d", angle);
11 if (angle < 69 || angle > 291)
13 if (angle > 111 && angle < 249)
15 if (angle > 22 && angle < 158)
17 if (angle > 202 && angle < 338)
22 angle = (angle + 15) / 30;
25 sprintf(
buffer,
"%d H", angle);
118 QStringList coordSplit =
coord.split(
" ", QString::SkipEmptyParts);
119 this->
co.
x = coordSplit[0].toInt();
120 this->
co.
y = coordSplit[1].toInt();
123 this->
c.
x = coordSplit[0].toInt();
124 this->
c.
y = coordSplit[1].toInt();
137 switch (this->
type) {
139 return QString(
"MapPoint");
141 return QString(
"Bookmark");
143 return QString(
"Position");
145 return QString(
"Destination");
147 return QString(
"PointOfInterest");
161 entries = retDoc.createElement(
"point");
176 return retDoc.toString();
199 center.
y = this->
c.
y;
202 entries = retDoc.createElement(
attr_name);
219 rs = rs.remove(QString(
"poi_"));
220 rs += QString(
" ") + QString::fromLocal8Bit(
label);
224 rs = rs.remove(QString(
"poly_"));
225 rs += QString(
" ") + QString::fromLocal8Bit(
label);
229 rs += QString::fromLocal8Bit(
label);
235 if (rs.length() > 0) {
236 QDomElement entry = retDoc.createElement(
"point");
237 QDomElement nameTag = retDoc.createElement(
"name");
238 QDomElement typeTag = retDoc.createElement(
"type");
239 QDomElement distTag = retDoc.createElement(
"distance");
240 QDomElement directTag = retDoc.createElement(
"direction");
241 QDomElement coordsTag = retDoc.createElement(
"coords");
242 QDomText nameT = retDoc.createTextNode(rs);
244 QDomText distT = retDoc.createTextNode(QString::number(idist / 1000));
245 QDomText directT = retDoc.createTextNode(dirbuf);
246 QDomText coordsT = retDoc.createTextNode(QString(
"%1 %2").arg(
c.
x).arg(
c.
y));
247 nameTag.appendChild(nameT);
248 typeTag.appendChild(typeT);
249 distTag.appendChild(distT);
250 directTag.appendChild(directT);
251 coordsTag.appendChild(coordsT);
252 entry.appendChild(nameTag);
253 entry.appendChild(typeTag);
254 entry.appendChild(distTag);
255 entry.appendChild(directTag);
256 entry.appendChild(coordsTag);
266 dbg(
lvl_info,
"%s", retDoc.toString().toLocal8Bit().constData());
267 return retDoc.toString();
272 QDomElement fieldTag = doc.createElement(field);
273 QDomText valueText = doc.createTextNode(
value);
274 fieldTag.appendChild(valueText);
278 char latc =
'N', lngc =
'E';
279 int lat_deg, lat_min, lat_sec;
280 int lng_deg, lng_min, lng_sec;
292 lat_min = fmod(
g.
lat * 60, 60);
293 lat_sec = fmod(
g.
lat * 3600, 60);
295 lng_min = fmod(
g.
lng * 60, 60);
296 lng_sec = fmod(
g.
lng * 3600, 60);
297 return QString(QString::fromLocal8Bit(
"%1°%2'%3\" %4%5%6°%7'%8\" %9"))
348 ret = ret.remove(QString(
"poi_"));
349 ret += QString(
" ") + QString::fromLocal8Bit(
label);
353 ret = ret.remove(QString(
"poly_"));
354 ret += QString(
" ") + QString::fromLocal8Bit(
label);
358 ret += QString::fromLocal8Bit(
label);
380 url.setUrl(QString(
"http://www.openstreetmap.org/browse/node/%1").arg(*
attr.
u.
num64));
382 url.setUrl(QString(
"http://www.openstreetmap.org/browse/way/%1").arg(*
attr.
u.
num64));
384 url.setUrl(QString(
"http://www.openstreetmap.org/browse/relation/%1").arg(*
attr.
u.
num64));
406#include "ngqpoint.moc"
char * attr_to_text(struct attr *attr, struct map *map, int pretty)
Converts an attribute to a string that can be displayed.
Definition attr.c:490
char * attr_to_name(enum attr_type attr)
Converts an attr_type to a string.
Definition attr.c:117
QString coordString()
Definition ngqpoint.h:133
QString _coordName()
Definition ngqpoint.h:308
QString name
Definition ngqpoint.h:401
NGQPoint(struct gui_priv *this_, struct coord *c, NGQPointTypes type=Bookmark, QObject *parent=NULL)
Definition ngqpoint.h:63
void _setUrl(struct item *item)
Definition ngqpoint.h:377
QString coord
Definition ngqpoint.h:402
struct point p
Definition ngqpoint.h:397
QString pointType()
Definition ngqpoint.h:136
NGQPoint(struct gui_priv *this_, struct point *p, NGQPointTypes type=MapPoint, QObject *parent=NULL)
Definition ngqpoint.h:47
struct pcoord * pc()
Definition ngqpoint.h:112
struct item item
Definition ngqpoint.h:399
NGQPoint(struct gui_priv *this_, struct pcoord *pc, NGQPointTypes type=Bookmark, QObject *parent=NULL)
Definition ngqpoint.h:79
QString pointName
Definition ngqpoint.h:42
QDomElement _fieldValueHelper(QDomDocument doc, QString field, QString value)
Definition ngqpoint.h:271
struct coord_geo g
Definition ngqpoint.h:394
QString pointType
Definition ngqpoint.h:43
QUrl pointUrl()
Definition ngqpoint.h:151
QString _coordString()
Definition ngqpoint.h:277
QString getInformation()
Definition ngqpoint.h:154
NGQPointTypes type
Definition ngqpoint.h:393
void setNewPoint(QString coord, NGQPointTypes type=PointOfInterest)
Definition ngqpoint.h:116
QUrl url
Definition ngqpoint.h:403
NGQPoint(struct gui_priv *this_, struct coord *c, QString name, NGQPointTypes type=Bookmark, QObject *parent=NULL)
Definition ngqpoint.h:95
struct pcoord c
Definition ngqpoint.h:396
struct gui_priv * object
Definition ngqpoint.h:391
QString coordString
Definition ngqpoint.h:41
QUrl pointUrl
Definition ngqpoint.h:44
QString getPOI(const QString &attr_name)
Definition ngqpoint.h:178
QString pointName()
Definition ngqpoint.h:130
struct coord co
Definition ngqpoint.h:395
static GValue value
Definition datawindow.c:42
@ lvl_info
Definition debug.h:50
#define dbg(level,...)
Definition debug.h:59
struct tcoord center
Definition garmin_img.c:2
char data
Definition garmin_img.c:2
struct label_data_offset label
Definition garmin_img.c:1
int coord_rect_contains(struct coord_rect *r, struct coord *c)
Definition coord.c:106
struct transformation * navit_get_trans(struct navit *this_)
Definition navit.c:3524
struct mapset * navit_get_mapset(struct navit *this_)
Get the current mapset.
Definition navit.c:226
int gui_get_attr(struct gui *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
Definition gui.c:60
static GtkActionEntry entries[]
Definition gui_gtk_action.c:196
int item_coord_get_pro(struct item *it, struct coord *c, int count, enum projection to)
Gets the next coordinates from an item and reprojects them.
Definition item.c:347
int item_attr_get(struct item *it, enum attr_type attr_type, struct attr *attr)
Gets the next matching attribute from an item.
Definition item.c:414
char * item_to_name(enum item_type item)
Definition item.c:483
struct item_range item_range_all
Definition item.c:34
struct map_selection * map_selection_dup_pro(struct map_selection *sel, enum projection from, enum projection to)
Duplicates a map selection, transforming coordinates.
Definition map.c:506
void map_convert_free(char *str)
Frees the memory allocated for a converted string.
Definition map.c:238
void map_selection_destroy(struct map_selection *sel)
Destroys a map selection.
Definition map.c:540
struct item * map_rect_get_item(struct map_rect *mr)
Gets the next item from a map rect.
Definition map.c:317
char * map_convert_string(struct map *this_, char *str)
Converts a string from a map.
Definition map.c:220
struct map_rect * map_rect_new(struct map *m, struct map_selection *sel)
Creates a new map rect.
Definition map.c:290
struct item * map_rect_get_item_byid(struct map_rect *mr, int id_hi, int id_lo)
Returns the item specified by the ID.
Definition map.c:345
enum projection map_projection(struct map *this_)
Returns the projection of a map.
Definition map.c:248
struct map_selection * map_selection_rect_new(struct pcoord *center, int distance, int order)
Creates a new rectangular map selection.
Definition map.c:483
void map_rect_destroy(struct map_rect *mr)
Destroys a map rect.
Definition map.c:361
struct mapset_handle * mapset_open(struct mapset *ms)
Returns a new handle for a mapset.
Definition mapset.c:164
struct map * mapset_next(struct mapset_handle *msh, int active)
Gets the next map from a mapset handle.
Definition mapset.c:192
void mapset_close(struct mapset_handle *msh)
Closes a mapset handle after it is no longer used.
Definition mapset.c:255
static void get_direction(char *buffer, int angle, int mode)
Definition ngqpoint.h:4
NGQPointTypes
Definition ngqpoint.h:30
@ Position
Definition ngqpoint.h:33
@ Bookmark
Definition ngqpoint.h:32
@ Destination
Definition ngqpoint.h:34
@ MapPoint
Definition ngqpoint.h:31
@ PointOfInterest
Definition ngqpoint.h:35
projection
Definition projection.h:23
void street_data_free(struct street_data *sd)
Frees street data.
Definition route.c:3345
static void street_get_data(struct street_priv *street, unsigned char **p)
Definition street.c:355
long long * num64
Definition attr.h:193
char * str
Definition attr.h:141
enum attr_type type
Definition attr.h:139
long num
Definition attr.h:143
A WGS84 coordinate.
Definition coord.h:94
navit_float lat
Definition coord.h:96
navit_float lng
Definition coord.h:95
struct coord rl
Definition coord.h:59
struct coord lu
Definition coord.h:58
int y
Definition coord.h:35
int x
Definition coord.h:34
Definition graphics_win32.h:50
struct navit * nav
Definition graphics_win32.h:51
struct gui * gui
Definition gui_qml.cpp:40
Represents an object on a map.
Definition item.h:122
int id_hi
Definition item.h:124
enum item_type type
Definition item.h:123
struct map * map
Definition item.h:126
Used to select data from a map.
Definition map.h:63
int order
Definition map.h:69
struct map_selection * next
Definition map.h:64
union map_selection::@4 u
struct item_range range
Definition map.h:70
struct coord_rect c_rect
Definition map.h:66
Handle for a mapset in use.
Definition mapset.c:150
Definition gpx2navit_txt.h:50
int y
Definition coord.h:54
enum projection pro
Definition coord.h:52
int x
Definition coord.h:53
int y
Definition point.h:25
int x
Definition point.h:24
Information about a street.
Definition route.h:70