Add:Core:Implemented center attribute for navit_get_attr
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Wed, 18 Apr 2012 19:33:54 +0000 (19:33 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Wed, 18 Apr 2012 19:33:54 +0000 (19:33 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@5021 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/navit.c

index 694b00f..95ccc14 100644 (file)
@@ -164,6 +164,7 @@ struct navit {
        int border;
        int imperial;
        int waypoints_flag;
+       struct coord_geo center;
        struct attr **attr_list;
 };
 
@@ -2549,6 +2550,7 @@ int
 navit_get_attr(struct navit *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
 {
        struct message *msg;
+       struct coord *c;
        int len,offset;
        int ret=1;
 
@@ -2592,6 +2594,11 @@ navit_get_attr(struct navit *this_, enum attr_type type, struct attr *attr, stru
        case attr_callback_list:
                attr->u.callback_list=this_->attr_cbl;
                break;
+       case attr_center:
+               c=transform_get_center(this_->trans);
+               transform_to_geo(transform_get_projection(this_->trans), c, &this_->center);
+               attr->u.coord_geo=&this_->center;
+               break;
        case attr_destination:
                if (! this_->destination_valid)
                        return 0;