Smrender
 All Data Structures Files Functions Variables Macros
Data Structures | Macros | Functions
smfunc.c File Reference
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <inttypes.h>
#include "smrender_dev.h"
#include "smcore.h"
#include "smloadosm.h"
Include dependency graph for smfunc.c:

Data Structures

struct  out_handle
 
struct  io_handle
 
struct  fmt_info
 
struct  sub_handler
 
struct  inherit_data
 
struct  trans_data
 
struct  node_list_t
 

Macros

#define DIR_CW   0
 
#define DIR_CCW   1
 
#define UP   0
 
#define DOWN   1
 
#define NODE_MIN_DIST   (1.0 / 60)
 
#define MASK_NODE   -1.0
 
#define INC_MAX_NL   64
 
#define DEFAULT_DISTANCE   (2.0/60)
 
#define EFMT_FMT   -1
 
#define EFMT_LESSPARM   -2
 
#define UNITS_MM   1
 
#define UNITS_CM   10
 

Functions

int act_out_ini (smrule_t *r)
 
int out0 (struct out_handle *oh, osm_obj_t *o)
 
int act_out_main (smrule_t *r, osm_obj_t *o)
 
int act_out_fini (smrule_t *r)
 
int poly_area (const osm_way_t *w, struct coord *center, double *area)
 
int act_poly_area_ini (smrule_t *r)
 
int act_poly_area_main (smrule_t *UNUSED(r), osm_way_t *w)
 
int act_poly_centroid_ini (smrule_t *r)
 
int act_poly_centroid_main (smrule_t *UNUSED(r), osm_way_t *w)
 
int act_reverse_way_ini (smrule_t *r)
 
int act_reverse_way_fini (smrule_t *UNUSED(r))
 
int act_reverse_way_main (smrule_t *UNUSED(r), osm_obj_t *o)
 
int set_way_direction (osm_way_t *w, int dir)
 
int act_set_ccw_main (smrule_t *UNUSED(r), osm_way_t *w)
 
int act_set_cw_main (smrule_t *UNUSED(r), osm_way_t *w)
 
int act_set_tags_ini (smrule_t *r)
 
int act_set_tags_main (smrule_t *r, osm_obj_t *o)
 
int act_shape_ini (smrule_t *r)
 
int attr_tod (const osm_obj_t *o, const char *attr, double *val)
 
void shape_node (const struct act_shape *as, const osm_node_t *n)
 
void shape_way (struct act_shape *as, osm_way_t *w)
 
int act_shape_main (smrule_t *r, osm_obj_t *o)
 
int act_shape_fini (smrule_t *r)
 
int act_ins_eqdist_ini (smrule_t *r)
 
int ins_eqdist (osm_way_t *w, double dist)
 
int act_ins_eqdist_main (smrule_t *r, osm_way_t *w)
 
int act_ins_eqdist_fini (smrule_t *r)
 
int cmp_double (const void *a, const void *b)
 
int dist_median (const osm_way_t *w, double *median)
 
int act_dist_median_main (smrule_t *UNUSED(r), osm_way_t *w)
 
hpx_ctrl_tget_ofile_ctl (const char *filename)
 
int act_diff_ini (smrule_t *r)
 
int obj_exists (osm_obj_t *o, struct out_handle *oh)
 
int act_diff_fini (smrule_t *r)
 
int act_poly_len_ini (smrule_t *r)
 
int poly_len (const osm_way_t *w, double *dist)
 
int act_poly_len_main (smrule_t *UNUSED(r), osm_way_t *w)
 
int act_sync_threads_ini (smrule_t *UNUSED(r))
 
int act_disable_main (smrule_t *UNUSED(r), osm_obj_t *o)
 
int act_enable_main (smrule_t *UNUSED(r), osm_obj_t *o)
 
int act_enable_rule_ini (smrule_t *r)
 
int act_enable_rule_main (smrule_t *r, osm_obj_t *UNUSED(o))
 
int act_disable_rule_ini (smrule_t *r)
 
int act_disable_rule_main (smrule_t *r, osm_obj_t *UNUSED(o))
 
void bbox_way (const osm_way_t *w, struct bbox *bb)
 
int act_exit_main (smrule_t *UNUSED(r), osm_obj_t *UNUSED(o))
 
int act_strfmt_ini (smrule_t *r)
 
int act_strfmt_main (smrule_t *r, osm_obj_t *o)
 
int act_strfmt_fini (smrule_t *r)
 
int act_sub_ini (smrule_t *r)
 
int act_sub_main (smrule_t *r, osm_obj_t *o)
 
int act_sub_fini (smrule_t *r)
 
int act_inherit_tags_ini (smrule_t *r)
 
int act_inherit_tags_main (smrule_t *r, osm_obj_t *o)
 
int act_inherit_tags_fini (smrule_t *r)
 
int act_zeroway_ini (smrule_t *r)
 
int act_zeroway_fini (smrule_t *r)
 
int act_zeroway_main (smrule_t *r, osm_node_t *n)
 
int act_split_ini (smrule_t *r)
 
int act_split_main (smrule_t *r, osm_node_t *n)
 
int act_split_fini (smrule_t *r)
 
int act_incomplete_ini (smrule_t *r)
 
int act_incomplete_main (smrule_t *r, osm_rel_t *rel)
 
int act_incomplete_fini (smrule_t *r)
 
int act_add_ini (smrule_t *r)
 
int act_add_main (smrule_t *UNUSED(r), osm_obj_t *UNUSED(o))
 
int act_add_fini (smrule_t *r)
 
int act_translate_ini (smrule_t *r)
 
int act_translate_main (smrule_t *r, osm_obj_t *o)
 
int act_translate_fini (smrule_t *r)
 
int act_mask_ini (smrule_t *r)
 
int act_mask_main (smrule_t *r, osm_obj_t *o)
 
void output_nmx (const struct pcoord *nmx, int n)
 
int act_mask_fini (smrule_t *r)
 
int act_del_match_tags_ini (smrule_t *r)
 
int act_del_match_tags_main (smrule_t *r, osm_obj_t *o)
 
int act_del_match_tags_fini (smrule_t *r)
 

Detailed Description

This file contains all rule functions which do not create graphics output.

Author
Bernhard R. Fischer

Function Documentation

int act_diff_ini ( smrule_t *  r)

Action parameters: file=*, infile=*.

int act_disable_main ( smrule_t *  UNUSEDr,
osm_obj_t o 
)

Disable object, i.e. set visibility to 0.

int act_enable_main ( smrule_t *  UNUSEDr,
osm_obj_t o 
)

Enable object, i.e. set visibility to 1.

int act_sync_threads_ini ( smrule_t *  UNUSEDr)

Unthreaded action, simple does nothing. Smrender automatically syncs threads before calling this function. Because this does nothing, the following action is also called "thread-synced" (without any other thread running). With this one can force previous _main functions to have finished before the next action is executed.

int act_zeroway_main ( smrule_t *  r,
osm_node_t n 
)

This function insert a way of length zero between two ways at the node which connects those two ways. The new way will inherit all tags from the node. This operation is carried out only if the node which was matched in advance for this function to be called is an intermediate node as explained before.

int poly_area ( const osm_way_t w,
struct coord center,
double *  area 
)

Calculate the area and the centroid of a closed polygon. The function implements Gauss's area formula aka shoelace formula.

Parameters
wPointer to closed polygon.
centerPointer to struct coord which will receive the coordinates of the centroid. It may be NULL.
areaPointer to variable which will receive the area of the polygon. If area is positive, the nodes of the polygon are order counterclockwise, if area is negative they are ordered clockwise. The result is the area measured in nautical square miles.
Returns
Returns 0 on success, -1 on error.