Пример #1
0
void roadmap_plugin_get_street_properties (const PluginLine *line,
                                           PluginStreetProperties *props,
                                           int type) {
   
   if (line->plugin_id == ROADMAP_PLUGIN_ID) {

      RoadMapStreetProperties rm_properties;

	   roadmap_square_set_current (line->square);

      if (type == PLUGIN_STREET_ONLY) {
         roadmap_street_get_street (line->line_id, &rm_properties);
         props->street = roadmap_street_get_street_name (&rm_properties);
         props->shield_text = roadmap_street_get_street_shield_text (&rm_properties);
         props->shield_type = roadmap_street_get_street_shield_type (&rm_properties);
         props->plugin_street.plugin_id = ROADMAP_PLUGIN_ID;
         props->plugin_street.street_id = rm_properties.street;
         return;
      }

      roadmap_street_get_properties (line->line_id, &rm_properties);

      props->address = roadmap_street_get_street_address (&rm_properties);
      props->street = roadmap_street_get_street_name (&rm_properties);
      props->street_t2s = roadmap_street_get_street_t2s (&rm_properties);
      props->city = roadmap_street_get_city_name (&rm_properties);
      props->shield_text = roadmap_street_get_street_shield_text (&rm_properties);
      props->shield_type = roadmap_street_get_street_shield_type (&rm_properties);
      props->plugin_street.plugin_id = ROADMAP_PLUGIN_ID;
      props->plugin_street.street_id = rm_properties.street;
      return;

   } else {
      RoadMapPluginHooks *hooks = get_hooks (line->plugin_id);

      props->address = "";
      props->street = "";
      props->street_t2s = "";
      props->city = "";
      props->shield_text = "";
      props->shield_type = "";

      if (hooks == NULL) {
         roadmap_log (ROADMAP_ERROR, "plugin id:%d is missing.",
               line->plugin_id);

         return;
      }

      if (hooks->get_street_properties != NULL) {
         (*hooks->get_street_properties) (line, props, type);
      }

      return;
   }
}
Пример #2
0
void editor_segments_fill_dialog (SelectedLine *lines, int lines_count) {

   char street_name[512];
   const char *street_type = "";
   const char *t2s = "";
   const char *city = "";
   int cfcc = ROADMAP_ROAD_LAST;
   int same_street = 1;
   int same_city = 1;
   int i;

   strcpy (street_name, "");
   for (i=0; i<lines_count; i++) {
      
      const char *this_name = "";
      const char *this_type = "";
      const char *this_t2s = "";
      const char *this_city = "";

      if (lines[i].line.plugin_id == EditorPluginID) {
         if (editor_db_activate (lines[i].line.fips) != -1) {

            int street_id = -1;
            
            editor_line_get_street (lines[i].line.line_id, &street_id);

            this_name = editor_street_get_street_fename (street_id);
            this_type = editor_street_get_street_fetype (street_id);
            this_t2s = editor_street_get_street_t2s (street_id);
            this_city = editor_street_get_street_city (street_id);
				//editor_line_get_direction (lines[i].line.line_id, &this_direction);
         }
      } else { 

         RoadMapStreetProperties properties;

         if (roadmap_locator_activate (lines[i].line.fips) < 0) {
            continue;
         }

         roadmap_square_set_current (lines[i].line.square);
         roadmap_street_get_properties (lines[i].line.line_id, &properties);
    
         this_name = roadmap_street_get_street_name (&properties);
         this_type = roadmap_street_get_street_fetype (&properties);
         this_t2s = roadmap_street_get_street_t2s (&properties);

         this_city = roadmap_street_get_street_city
               (&properties, ROADMAP_STREET_LEFT_SIDE);
/*
			if (!editor_override_line_get_direction (lines[0].line.line_id, &this_direction)) {

            this_direction =
               roadmap_line_route_get_direction
                  (lines[i].line.line_id, ROUTE_CAR_ALLOWED);
            roadmap_line_route_get_speed_limit
                  (lines[i].line.line_id,
                   &this_speed_limit, &this_speed_limit);
         }
*/         
      }

      if (same_street) {
         if (!strlen(street_type)) {
            street_type = this_type;
         }

         if (!strlen(t2s)) {
            t2s = this_t2s;
         }

         if (!strlen(street_name)) {
            strncpy_safe (street_name, this_name, 512);
         } else {
            if (strlen(this_name) && strcmp(this_name, street_name)) {
               strcpy (street_name, "");
               street_type = "";
               t2s = "";
               same_street = 0;
            }
         }
       }

      if (same_city) {
         if (!strlen(city)) {
            city = this_city;
         } else {
            if (strlen(this_city) && strcmp(this_city, city)) {
               same_city = 0;
               city = "";
            }
         }
      } 
      
      if (lines[i].line.cfcc < cfcc) {
         cfcc = lines[i].line.cfcc;
      }
   }

   if (same_city && !strlen(city)) {
      
      city = editor_segments_find_city
             (lines[0].line.line_id, lines[0].line.plugin_id, lines[0].line.square);
   }

#ifdef SSD
   ssd_dialog_set_data ("Road type", (void *) (long)(cfcc - ROADMAP_ROAD_FIRST));
   ssd_dialog_set_value ("Name", street_name);
   ssd_dialog_set_value ("Text to Speech", t2s);

   ssd_dialog_set_value ("City", city);

   def_values[0] = ssd_dialog_get_value ("City");

#else
   roadmap_dialog_set_data
      ("General", "Road type", (void *) (cfcc - ROADMAP_ROAD_FIRST));
   roadmap_dialog_set_data ("General", "Street type", street_type);
   roadmap_dialog_set_data ("General", "Name", street_name);
   roadmap_dialog_set_data ("General", "Text to Speech", t2s);

   roadmap_dialog_set_data ("General", "City", city);

#endif


}