1 #ifndef NAVIT_GUI_QML_POINT_H
2 #define NAVIT_GUI_QML_POINT_H
10 sprintf(buffer,
"%d",angle);
13 if (angle < 69 || angle > 291)
15 if (angle > 111 && angle < 249)
17 if (angle > 22 && angle < 158)
19 if (angle > 202 && angle < 338)
27 sprintf(buffer,
"%d H", angle);
106 QStringList coordSplit=coord.split(
" ",QString::SkipEmptyParts);
107 this->
co.
x=coordSplit[0].toInt();
108 this->
co.
y=coordSplit[1].toInt();
111 this->
c.
x = coordSplit[0].toInt();
112 this->
c.
y = coordSplit[1].toInt();
127 return QString(
"MapPoint");
129 return QString(
"Bookmark");
131 return QString(
"Position");
133 return QString(
"Destination");
135 return QString(
"PointOfInterest");
149 entries=retDoc.createElement(
"point");
150 retDoc.appendChild(entries);
162 return retDoc.toString();
173 QDomDocument retDoc(attr_name);
181 dist=attr.
u.
num*1000;
188 entries=retDoc.createElement(attr_name);
189 retDoc.appendChild(entries);
204 rs=rs.remove(QString(
"poi_"));
205 rs+=QString(
" ")+QString::fromLocal8Bit(label);
207 }
else if (QString(
item_to_name(item->
type)).startsWith(QString(
"poly_"))) {
209 rs=rs.remove(QString(
"poly_"));
210 rs+=QString(
" ")+QString::fromLocal8Bit(label);
212 }
else if (QString(
item_to_name(item->
type)).startsWith(QString(
"street_"))) {
214 rs+=QString::fromLocal8Bit(label);
221 QDomElement entry=retDoc.createElement(
"point");
222 QDomElement nameTag=retDoc.createElement(
"name");
223 QDomElement typeTag=retDoc.createElement(
"type");
224 QDomElement distTag=retDoc.createElement(
"distance");
225 QDomElement directTag=retDoc.createElement(
"direction");
226 QDomElement coordsTag=retDoc.createElement(
"coords");
227 QDomText nameT=retDoc.createTextNode(rs);
229 QDomText distT=retDoc.createTextNode(QString::number(idist/1000));
230 QDomText directT=retDoc.createTextNode(dirbuf);
231 QDomText coordsT=retDoc.createTextNode(QString(
"%1 %2").arg(c.
x).arg(c.
y));
232 nameTag.appendChild(nameT);
233 typeTag.appendChild(typeT);
234 distTag.appendChild(distT);
235 directTag.appendChild(directT);
236 coordsTag.appendChild(coordsT);
237 entry.appendChild(nameTag);
238 entry.appendChild(typeTag);
239 entry.appendChild(distTag);
240 entry.appendChild(directTag);
241 entry.appendChild(coordsTag);
242 entries.appendChild(entry);
251 dbg(
lvl_info,
"%s",retDoc.toString().toLocal8Bit().constData());
252 return retDoc.toString();
256 QDomElement fieldTag=doc.createElement(field);
257 QDomText valueText=doc.createTextNode(value);
258 fieldTag.appendChild(valueText);
262 char latc=
'N',lngc=
'E';
263 int lat_deg,lat_min,lat_sec;
264 int lng_deg,lng_min,lng_sec;
276 lat_min=fmod(g.
lat*60,60);
277 lat_sec=fmod(g.
lat*3600,60);
279 lng_min=fmod(g.
lng*60,60);
280 lng_sec=fmod(g.
lng*3600,60);
281 return QString(QString::fromLocal8Bit(
"%1°%2'%3\" %4%5%6°%7'%8\" %9")).arg(lat_deg).arg(lat_min).arg(lat_sec).arg(latc).arg(
' ').arg(lng_deg).arg(lng_min).arg(lng_sec).arg(lngc);
323 ret=ret.remove(QString(
"poi_"));
324 ret+=QString(
" ")+QString::fromLocal8Bit(label);
328 ret=ret.remove(QString(
"poly_"));
329 ret+=QString(
" ")+QString::fromLocal8Bit(label);
333 ret+=QString::fromLocal8Bit(label);
355 url.setUrl(QString(
"http://www.openstreetmap.org/browse/node/%1").arg(*attr.
u.
num64));
357 url.setUrl(QString(
"http://www.openstreetmap.org/browse/way/%1").arg(*attr.
u.
num64));
359 url.setUrl(QString(
"http://www.openstreetmap.org/browse/relation/%1").arg(*attr.
u.
num64));
380 #include "ngqpoint.moc"
void map_convert_free(char *str)
Frees the memory allocated for a converted string.
Definition: map.c:266
QString coord
Definition: ngqpoint.h:376
QString getInformation()
Definition: ngqpoint.h:142
struct gui * gui
Definition: gui_qml.cpp:40
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:327
struct coord co
Definition: ngqpoint.h:369
struct map * map
Definition: item.h:103
static void get_direction(char *buffer, int angle, int mode)
Definition: ngqpoint.h:5
Definition: gpx2navit_txt.h:51
Definition: ngqpoint.h:32
int y
Definition: coord.h:36
void _setUrl(struct item *item)
Definition: ngqpoint.h:352
QString getPOI(const QString &attr_name)
Definition: ngqpoint.h:164
void map_selection_destroy(struct map_selection *sel)
Destroys a map selection.
Definition: map.c:584
struct coord_rect c_rect
Definition: map.h:60
enum projection pro
Definition: coord.h:41
NGQPoint(struct gui_priv *this_, struct point *p, NGQPointTypes type=MapPoint, QObject *parent=NULL)
Definition: ngqpoint.h:42
struct map * mapset_next(struct mapset_handle *msh, int active)
Gets the next map from a mapset handle.
Definition: mapset.c:203
A mapset.
Definition: mapset.c:44
int y
Definition: coord.h:43
QString name
Definition: ngqpoint.h:375
navit_float lng
Definition: coord.h:86
struct point p
Definition: ngqpoint.h:371
int gui_get_attr(struct gui *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
Definition: gui.c:63
QString pointType()
Definition: ngqpoint.h:124
enum projection map_projection(struct map *this_)
Returns the projection of a map.
Definition: map.c:278
union map_selection::@8 u
char * map_convert_string(struct map *this_, char *str)
Converts a string from a map.
Definition: map.c:244
struct item_range range
Definition: map.h:64
enum item_type type
Definition: item.h:100
void street_data_free(struct street_data *sd)
Frees street data.
Definition: route.c:3169
static GValue value
Definition: datawindow.c:42
int x
Definition: point.h:24
Definition: ngqpoint.h:32
int x
Definition: coord.h:42
char * item_to_name(enum item_type item)
Definition: item.c:405
struct mapset * navit_get_mapset(struct navit *this_)
Definition: navit.c:216
Definition: graphics_win32.h:52
int mode
Definition: graphics_win32.c:59
NGQPoint(struct gui_priv *this_, struct coord *c, QString name, NGQPointTypes type=Bookmark, QObject *parent=NULL)
Definition: ngqpoint.h:87
struct coord lu
Definition: coord.h:47
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:374
Handle for a mapset in use.
Definition: mapset.c:167
#define dbg(level,...)
Definition: debug.h:59
NGQPoint(struct gui_priv *this_, struct pcoord *pc, NGQPointTypes type=Bookmark, QObject *parent=NULL)
Definition: ngqpoint.h:72
QString pointName()
Definition: ngqpoint.h:118
QString _coordName()
Definition: ngqpoint.h:283
void mapset_close(struct mapset_handle *msh)
Closes a mapset handle after it is no longer used.
Definition: mapset.c:269
projection
Definition: projection.h:23
struct gui_priv * object
Definition: ngqpoint.h:365
struct coord c[0]
Definition: route.h:71
struct map_selection * next
Definition: map.h:58
struct pcoord c
Definition: ngqpoint.h:370
Describes a rectangular extract of a map.
Definition: map.c:72
Information about a street.
Definition: route.h:66
NGQPoint(struct gui_priv *this_, struct coord *c, NGQPointTypes type=Bookmark, QObject *parent=NULL)
Definition: ngqpoint.h:57
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:498
long num
Definition: attr.h:161
void map_rect_destroy(struct map_rect *mr)
Destroys a map rect.
Definition: map.c:392
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:261
struct item item
Definition: ngqpoint.h:373
struct navit * nav
Definition: graphics_win32.h:53
struct item * map_rect_get_item(struct map_rect *mr)
Gets the next item from a map rect.
Definition: map.c:353
struct pcoord * pc()
Definition: ngqpoint.h:102
char data
Definition: garmin_img.c:354
struct mapset_handle * mapset_open(struct mapset *ms)
Returns a new handle for a mapset.
Definition: mapset.c:181
Used to select data from a map.
Definition: map.h:57
enum attr_type type
Definition: attr.h:157
struct map_rect * map_rect_new(struct map *m, struct map_selection *sel)
Creates a new map rect.
Definition: map.c:325
struct map_selection * map_selection_rect_new(struct pcoord *center, int distance, int order)
Creates a new rectangular map selection.
Definition: map.c:523
void setNewPoint(QString coord, NGQPointTypes type=PointOfInterest)
Definition: ngqpoint.h:104
Definition: ngqpoint.h:32
QUrl pointUrl()
Definition: ngqpoint.h:139
QDomElement _fieldValueHelper(QDomDocument doc, QString field, QString value)
Definition: ngqpoint.h:255
struct transformation * navit_get_trans(struct navit *this_)
Definition: navit.c:3387
int order
Definition: map.h:63
struct coord_geo g
Definition: ngqpoint.h:368
char * str
Definition: attr.h:159
Holds information about a map.
Definition: map.c:60
long long * num64
Definition: attr.h:209
Definition: ngqpoint.h:32
NGQPointTypes
Definition: ngqpoint.h:32
Definition: ngqpoint.h:32
NGQPointTypes type
Definition: ngqpoint.h:367
navit_float lat
Definition: coord.h:87
Definition: maptool.h:168
int coord_rect_contains(struct coord_rect *r, struct coord *c)
Definition: coord.c:120
int count
Definition: route.h:68
struct item_range item_range_all
Definition: item.c:34
Definition: ngqpoint.h:34
static GtkActionEntry entries[]
Definition: gui_gtk_action.c:224
struct coord rl
Definition: coord.h:48
struct label_data_offset label
Definition: garmin_img.c:409
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:547
QString _coordString()
Definition: ngqpoint.h:261
QUrl url
Definition: ngqpoint.h:377
A WGS84 coordinate.
Definition: coord.h:85
int y
Definition: point.h:25
QString coordString()
Definition: ngqpoint.h:121
static void street_get_data(struct street_priv *street, unsigned char **p)
Definition: street.c:379
char * attr_to_name(enum attr_type attr)
Converts an attr_type to a string.
Definition: attr.c:123
int id_hi
Definition: item.h:101
int x
Definition: coord.h:35