示例#1
0
static int roadmap_locator_allocate (int **fips) {

   int count;

   roadmap_locator_configure();

   if (roadmap_config_get_integer(&RoadMapConfigStaticCounty) != 0) {
      count = 1;
   } else {
      count = roadmap_county_count();
   }

   if (*fips == NULL) {
      *fips = calloc (count, sizeof(int));
      roadmap_check_allocated(*fips);
   }

   return count;
}
示例#2
0
static void roadmap_layer_reload_internal (void) {

    int i;
    int j;
    int k;
    RoadMapConfigDescriptor descriptor = ROADMAP_CONFIG_ITEM_EMPTY;
    static BOOL initialized = FALSE;
    const char *global_label_color, *global_label_bg_color;
    global_label_color = roadmap_config_get (&RoadMapConfigLabelsColor);
    global_label_bg_color = roadmap_config_get (&RoadMapConfigLabelsBgColor);
    use_new_pens = FALSE;
    for (i = 1; i <= RoadMapCategoryCount; ++i) {
		int max_pens;
        struct roadmap_canvas_category *category = RoadMapCategory + i;
        const char *name = RoadMapDefaultCategoryTable[i-1];
        const char *class_name;
        const char *color[ROADMAP_LAYER_PENS];
        const char *label_color;
		int bg_color;
        int  thickness;
        int  other_pens_length = strlen(name) + 64;
        char *other_pens = malloc(other_pens_length);
        RoadMapClass *p;

        descriptor.category = name;
        descriptor.age = 0;

        /* Retrieve the class of the category. */
        if (!initialized) {
           category->name = name;
           category->visible = 1;
           category->label_visible = 1;
           category->label_pen = NULL;

           descriptor.name = "Class";
           descriptor.reference = NULL;
           roadmap_config_declare ("schema", &descriptor, "", NULL);
           class_name = roadmap_config_get (&descriptor);
           for (p = RoadMapClasses; p->name != NULL; ++p) {
               if (strcasecmp (class_name, p->name) == 0) {
                   p->category[p->count++] = i;
                   category->class_index = (int) (p - RoadMapClasses);
                   break;
               }
           }
        }


        /* Retrieve the category thickness & declutter. */

        descriptor.name     = "Thickness";
        descriptor.reference = NULL;
        if (!initialized)
           roadmap_config_declare ("schema", &descriptor, "1", NULL);
        thickness = category->thickness = roadmap_config_get_integer (&descriptor);
#if !defined (ANDROID) && !defined(J2ME)
        if ( roadmap_screen_is_hd_screen() )
        {
         category->thickness = (int)(category->thickness * roadmap_screen_get_screen_scale() /100);
         thickness = (int)(thickness * roadmap_screen_get_screen_scale() /100);
        }
#endif
        if (!initialized) {
           descriptor.name     = "Declutter";
           descriptor.reference = NULL;
           roadmap_config_declare
                  ("schema", &descriptor, "2024800000", NULL);

           category->declutter = roadmap_config_get_integer (&descriptor);

           descriptor.name     = "LabelDeclutter";
                   descriptor.reference = NULL;
                   roadmap_config_declare
                          ("schema", &descriptor, "-1", NULL);

           category->label_declutter = roadmap_config_get_integer (&descriptor);
           if (category->label_declutter == -1)
              category->label_declutter = category->declutter;
        }

        /* Retrieve the first pen's color (mandatory). */

        descriptor.name = "Color";
        descriptor.reference = NULL;

        if (!initialized)
           roadmap_config_declare ("schema", &descriptor, "black", NULL);
        color[0] = roadmap_config_get (&descriptor);

        /* Retrieve label color (optional) */
        descriptor.name = "LabelColor";
        descriptor.reference = NULL;

        roadmap_config_declare ("schema", &descriptor, "", NULL);
        label_color = roadmap_config_get (&descriptor);


        /* Retrieve the category's other colors (optional). */
        if (!editor_screen_gray_scale())
           max_pens = 2;
        else
           max_pens = ROADMAP_LAYER_PENS;

        for (j = 1; j < max_pens; ++j) {
           int is_new = 0;

           snprintf (other_pens, other_pens_length, "Delta%d", j);

           descriptor.name = strdup(other_pens);
           descriptor.reference = NULL;

           if (!initialized)
              roadmap_config_declare ("schema", &descriptor, "0", &is_new);

           category->delta_thickness[j] =
              roadmap_config_get_integer (&descriptor);
#if !defined (ANDROID) && !defined(J2ME)
           if ( roadmap_screen_is_hd_screen() )
           {
            category->delta_thickness[j] = (int)(category->delta_thickness[j] * roadmap_screen_get_screen_scale() /100);
           }
#endif

           if ((j == 2) && !editor_screen_gray_scale()) break;
           if (!is_new) free ((void *)descriptor.name);

           if (category->delta_thickness[j] == 0) break;

           snprintf (other_pens, other_pens_length, "Color%d", j);

           descriptor.name = strdup(other_pens);
           descriptor.reference = NULL;

           if (!initialized)
              roadmap_config_declare ("schema", &descriptor, "", &is_new);
           color[j] = roadmap_config_get (&descriptor);
           if (!is_new) free ((void *)descriptor.name);

           if (*color[j] == 0) break;
        }
        category->pen_count = j;
        if (j > RoadMapMaxUsedPen) RoadMapMaxUsedPen = j;


        /* Create all necessary pens. */

        for (j=0; j<LAYER_PROJ_AREAS; j++) {
           snprintf (other_pens, other_pens_length, "%d%s", j, name);

           category->pen[j][0] = roadmap_canvas_create_pen(other_pens,use_new_pens);

           roadmap_canvas_set_thickness (category->thickness);

           if (color[0] != NULL && *(color[0]) > ' ') {
              roadmap_canvas_set_foreground (color[0]);
           }
        }

        for (k=0; k<LAYER_PROJ_AREAS; k++)
           for (j = 1; j < category->pen_count; ++j) {

              snprintf (other_pens, other_pens_length, "%d%s%d", k, name, j);
              category->pen[k][j] = roadmap_canvas_create_pen (other_pens, use_new_pens);

              if (category->delta_thickness[j] < 0) {
                 thickness = category->thickness + category->delta_thickness[j];
              } else {
                 thickness = category->delta_thickness[j];
              }

              roadmap_canvas_set_foreground (color[j]);
              if (thickness > 0) {
                 roadmap_canvas_set_thickness (thickness);
              }
           }

        snprintf (other_pens, other_pens_length, "%s_label_pen", name);
        category->label_pen = roadmap_canvas_create_pen (other_pens,use_new_pens);

        if (strlen(label_color) != 0) {
           roadmap_canvas_set_foreground (label_color);
        } else {
           roadmap_canvas_set_foreground (global_label_color);
        }
#ifdef OPENGL
        bg_color = (category->pen_count > 2 ? 1 : 0);
        if (color[bg_color] != NULL && *(color[bg_color]) > ' ') {
				roadmap_canvas_set_background (global_label_bg_color);
        }
#endif //OPENGL

        free (other_pens);
    }

    initialized = TRUE;
}
示例#3
0
int roadmap_splash_get_last_check_time(void){
 return roadmap_config_get_integer(&RoadMapConfigLastCheckTime);
}
示例#4
0
static int get_custom_bonus_last_shown_id(void){
   return roadmap_config_get_integer(&RoadMapConfigCustomBonusLastID);
}
示例#5
0
static int get_custom_bonus_radius(void){
   return roadmap_config_get_integer(&RoadMapConfigCustomBonusRadius);
}
示例#6
0
int roadmap_skin_get_scheme(void){
   return roadmap_config_get_integer(&RoadMapConfigMapScheme);
}
示例#7
0
int  config_alerts_min_speed (void) {
    return roadmap_config_get_integer (&MinSpeedToAlertCfg);
}
示例#8
0
int roadmap_display_pop_up
        (const char *title,
         const char *image,
         const RoadMapPosition *position,
         const char *format, ...) {

    char text[1024];
    va_list parameters;
    RoadMapSign *sign;

    roadmap_log_push ("roadmap_display_pop_up");

    sign = roadmap_display_search_sign (title);
    if (sign == NULL) {
        roadmap_log_pop ();
        return -1;
    }

    if (sign->format_descriptor.category == NULL) {
       roadmap_log_pop ();
       return -1; /* This is not a sign: this is a text. */
    }

   va_start(parameters, format);
   vsnprintf (text, sizeof(text), format, parameters);
   va_end(parameters);

   if (sign->content != NULL) {
      free (sign->content);
   }

   if (sign->image != NULL) {
      free (sign->image);
   }

   sign->content = strdup(text);
   sign->has_position = 1;
   if (position != NULL)
   		sign->position = *position;
   else{
   		sign->position.latitude = -1;
   		sign->position.longitude = -1;
   }

   sign->was_visible=0;
   if (roadmap_config_get_integer (&RoadMapConfigDisplayDuration) == -1) {
      sign->deadline = -1;

   } else {

      sign->deadline =
          time(NULL)
              + roadmap_config_get_integer (&RoadMapConfigDisplayDuration);
   }
   if (image != NULL)
	   sign->image = strdup(image);
   else
   	   sign->image = NULL;

    roadmap_log_pop ();
    return 0;
}
示例#9
0
int roadmap_display_activate
        (const char *title,
         const PluginLine *line,
         const RoadMapPosition *position,
         PluginStreet *street) {

    int   street_has_changed;
    int   message_has_changed;
    const char *format;
    char  text[256];
    RoadMapSign *sign;
    PluginStreetProperties properties;

    roadmap_log_push ("roadmap_display_activate");

    sign = roadmap_display_search_sign (title);
    if (sign == NULL) {
        roadmap_log_pop ();
        return -1;
    }

    if (sign->format_descriptor.category == NULL) {
       return -1; /* This is not a sign: this is a text. */
    }
    format = roadmap_config_get (&sign->format_descriptor);

    street_has_changed = 0;

    if (!roadmap_plugin_same_line (&sign->line, line)) {

       roadmap_plugin_get_street (line, street);

        if (sign->id != NULL) {
            free (sign->id);
        }

        sign->id =
            strdup (roadmap_plugin_street_full_name (line));

        sign->line = *line;
        sign->was_visible = 0;

        if (!roadmap_plugin_same_street (street, &sign->street)) {
           sign->street = *street;
           street_has_changed = 1;
        }
    }


    roadmap_message_set ('F', sign->id);

    roadmap_plugin_get_street_properties (line, &properties, 0);

    roadmap_message_set ('#', properties.address);
    roadmap_message_set ('N', properties.street);
    //roadmap_message_set ('T', properties.street_t2s);
    roadmap_message_set ('C', properties.city);

    if (!strcmp(title, "Current Street")){
    	roadmap_message_set ('Y', properties.street);
    	roadmap_message_set ('Z', properties.city);
    }

    if (! roadmap_message_format (text, sizeof(text), roadmap_lang_get(format))) {
        roadmap_log_pop ();
        *street = sign->street;
        return 0;
    }
    message_has_changed =
        (sign->content == NULL || strcmp (sign->content, text) != 0);

    if (roadmap_config_get_integer (&RoadMapConfigDisplayDuration) == -1) {
       sign->deadline = -1;

    } else {

       sign->deadline =
           time(NULL)
               + roadmap_config_get_integer (&RoadMapConfigDisplayDuration);
    }


    if (street_has_changed) {
        roadmap_voice_announce (sign->title);
    }

    if (message_has_changed) {

        if (sign->content != NULL) {
            free (sign->content);
        }
        if (text[0] == 0) {
            sign->content = strdup("(this street has no name)");
        } else {
            sign->content = strdup (text);
        }
    }

	roadmap_plugin_line_from (line, &sign->endpoint[0]);
    roadmap_plugin_line_to (line, &sign->endpoint[1]);

    if (position == NULL) {
        sign->has_position = 0;
    } else {
        sign->has_position = 1;
        sign->position = *position;
    }

    roadmap_log_pop ();
    *street = sign->street;
    return 0;
}
示例#10
0
static void on_recieved_completed (void) {
   char updateText[] = "We've made a few infrastructural changes that require re-start. Please exit and re-start waze.";
   const char *user_lang = roadmap_lang_get_user_lang();//"heb";//todomt 
   const char *force_lang = roadmap_config_get( &RoadMapConfigForceLanguage);
   // compare the old and new server id's - if different, user needs to restart
   int oldServerId = roadmap_config_get_integer(&RoadMapConfigSystemServerId);
   int newServerId = GeoConfigContext.id;

   // Save the RT server ID.
   roadmap_config_set_integer (&RoadMapConfigSystemServerId,
            GeoConfigContext.id);

#ifndef J2ME // in J2ME don't download the language until user chooses it manually // TODODAN
   //set the language
   if (!strcmp(force_lang, "")){
	   roadmap_lang_set_system_lang (GeoConfigContext.lang, NULL);
   }else{
	   roadmap_lang_set_system_lang (force_lang, NULL);
   }
#endif

   // Save version
   roadmap_config_set_integer (&RoadMapConfigGeoConfigVersion,
            GeoConfigContext.version);

   //Save new configuration
   roadmap_config_save (0);

   //Remove timer
   roadmap_main_remove_periodic (GeoConfigTimer);

   roadmap_log (ROADMAP_DEBUG,"GeoServerConfig Completed setting all parameters!!" );
   roadmap_log (ROADMAP_INFO, "GeoServerConfig: user_lang='%s' newServerId=%d", user_lang, newServerId );

   if ((user_lang[0] == 0) && (newServerId != 2)){
      roadmap_lang_download_conf_file(on_lang_conf_downloaded);
      return;
   }

   if ((user_lang[0] == 0) && (newServerId == 2)){
      roadmap_lang_set_system_lang(GeoConfigContext.lang, NULL);
   }

   if ((oldServerId==-1)){
      ssd_progress_msg_dialog_show("Downloading language");
	  roadmap_lang_download_lang_file(roadmap_lang_get_system_lang(), on_user_lang_downloaded); //on_user_lang_downloaded();//todomt 
      return;
   }

#ifndef J2ME
   roadmap_lang_download_lang_file(GeoConfigContext.lang, NULL);
#endif


   ssd_progress_msg_dialog_hide();

   clean_up();

   roadmap_screen_refresh();

   if (GeoConfigContext.callback)
      (*GeoConfigContext.callback)();

   GeoConfigContext.callback = NULL;

//   if ((oldServerId!=newServerId)&&(oldServerId!=-1)){
//
//      roadmap_lang_set_update_time("");
//#ifndef J2ME
//      roadmap_lang_set_lang_file_update_time("heb","");
//      roadmap_lang_set_lang_file_update_time("eng","");
//#endif
//      roadmap_prompts_set_update_time ("");
//      roadmap_splash_set_update_time ("");
//      roadmap_splash_reset_check_time();
//      roadmap_config_save(FALSE);
//#if (defined (IPHONE) || defined (ANDROID))
//      roadmap_tile_remove_all(roadmap_locator_active());
//#endif
//      roadmap_messagebox_cb(roadmap_lang_get("Please restart Waze"), roadmap_lang_get(updateText), restart_msg_cb);
//   }

}
示例#11
0
int roadmap_locator_static_county (void) {

   return roadmap_config_get_integer(&RoadMapConfigStaticCounty);
}