navit
0.5.3-trunk
|
#include <stdlib.h>
#include <glib.h>
#include <assert.h>
#include <string.h>
#include <signal.h>
#include <stdio.h>
#include <math.h>
#include <getopt.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <zlib.h>
#include "file.h"
#include "item.h"
#include "map.h"
#include "zipfile.h"
#include "main.h"
#include "config.h"
#include "linguistics.h"
#include "plugin.h"
#include "maptool.h"
Data Structures | |
struct | slice_result |
data structure to eas up slicing More... | |
struct | itembin_loop_combiner_context |
data structure to transfer data between this and the multipolygon code in osm.c More... | |
struct | slicerpolygon |
data structure to make partd of an item easily avalable for the slicer code More... | |
Macros | |
#define | _FILE_OFFSET_BITS 64 |
#define | _LARGEFILE_SOURCE |
#define | _LARGEFILE64_SOURCE |
Functions | |
static void | next_tile (char *buffer) |
advance tile number on same tile level More... | |
static int | itembin_bbox_intersects (struct rect *b1, struct rect *b2) |
check if rectangles overlap More... | |
static void | itembin_poly_intersection (struct coord *p1, struct coord *p2, struct rect *r, int edge, struct coord *ret) |
calculate intersection point of line with one side of an rectangle More... | |
static int | itembin_line_intersect_x (struct coord *p1, struct coord *p2, int x, int *y) |
calculate intersection point of line with x axis More... | |
static int | itembin_poly_is_in (struct coord *pt, struct coord *poly, int ccount) |
calculate if a point is inside a polygon More... | |
static void | clear_loop_combiner_context (struct itembin_loop_combiner_context *c) |
free all possibly allocated members of a itembin_loop_combiner_context More... | |
static void | clear_slice_result (struct slice_result *r) |
free all possibly allocated members of a slice_result More... | |
static void | itembin_slice_add_part (struct slice_result *r, struct coord *part, int ccount) |
add a part to a slice result structure More... | |
static void | itembin_loop_combiner (struct slice_result *r) |
combine the parts of a slice result to closed loops More... | |
static int | itembin_sort_coordinates_xy (const void *a, const void *b, int axis) |
sort functions for qsort to sort coordinates along x or y axis More... | |
static int | itembin_sort_coordinates_x (const void *a, const void *b) |
sort functions for qsort to sort coordinates along x axis More... | |
static int | itembin_sort_coordinates_y (const void *a, const void *b) |
sort functions for qsort to sort coordinates along y axis More... | |
static void | itembin_sort_coordinates (struct coord *coord, int ccount, int edge) |
srt coordinates along cut edge More... | |
static void | itembin_slice_part_direction (struct coord *p_in, int p_in_ccount, struct slice_result *p_out, int edge, struct rect *box, struct coord **cutpoints, int *cutpoint_ccount) |
static void | itembin_slice_direction (struct slice_result *p_in_outer, struct slice_result *p_in_inner, struct slice_result *p_out_outer, struct slice_result *p_out_inner, int edge, struct rect *box) |
static void | itembin_write_slice_result (struct slicerpolygon *sp, struct slice_result *outer, struct slice_result *inner) |
static void | itembin_slice (struct slicerpolygon *sp, struct rect *box) |
static int | itembin_filter_attr (struct attr_bin *in, int size, struct attr_bin *out, enum attr_type remove) |
copy item_bin attrs filtering out one kind More... | |
static void | itembin_slicerpolygon_free (struct slicerpolygon *sp) |
free structure filled by itembin_disassemble More... | |
static void | itembin_disassemble (struct item_bin *ib, struct slicerpolygon *out) |
parse an item_bin and make it's contents accessable. More... | |
void | itembin_nicer_slicer (struct tile_info *info, struct item_bin *ib, FILE *reference, char *buffer, int min) |
#define _FILE_OFFSET_BITS 64 |
#define _LARGEFILE64_SOURCE |
#define _LARGEFILE_SOURCE |
|
static |
free all possibly allocated members of a itembin_loop_combiner_context
c | - context to clear |
References c.
Referenced by itembin_loop_combiner().
|
static |
free all possibly allocated members of a slice_result
r | - context to clear |
References slice_result::ccount, slice_result::coord, and slice_result::count.
Referenced by itembin_loop_combiner(), itembin_slice(), and itembin_slice_direction().
check if rectangles overlap
Ths function calculates if two rectangles overlap
[in] | b1 | - one rectangle |
[in] | b2 | - another rectangle |
References rect::h, coord::x, and coord::y.
Referenced by itembin_nicer_slicer(), and itembin_slice().
|
static |
parse an item_bin and make it's contents accessable.
This method parses the contents of a item_bin and makes it accessable via direct pointers. Additionally it filters out holes if any from attr. This allows easy reassembly of the sliced parts to item_bins.
[in] | ib | item to disassemble |
{out] | out structure containing the parsing result. |
References slicerpolygon::attr_len, slicerpolygon::attrs, slicerpolygon::bbox, bbox(), slicerpolygon::ccount, item_bin::clen, slicerpolygon::count, slicerpolygon::f_attr_len, slicerpolygon::f_attrs, slicerpolygon::hole_count, slicerpolygon::holes, slicerpolygon::holes_bbox, slicerpolygon::ib, item_bin_get_attr_bin(), itembin_filter_attr(), item_bin::len, and slicerpolygon::poly.
Referenced by itembin_nicer_slicer().
|
static |
copy item_bin attrs filtering out one kind
[in] | in | - attrs to filter |
[in] | size | - attrs total size in bytes |
[out] | out | - space for filtered attr. At least size long. |
[in] | remove | - type of item to remove from attr |
References attr_bin::len, size, and type.
Referenced by itembin_disassemble().
calculate intersection point of line with x axis
[in] | p1 | - one point of the line |
[in] | p2 | - another point of the line |
[in] | x | - x coordinate to check against |
[out | y - returns y coordinate of intersection of line with x if intersecting |
References itembin_poly_intersection(), coord::x, and coord::y.
Referenced by itembin_poly_is_in().
|
static |
combine the parts of a slice result to closed loops
This function uses the osm.c multipolygon code to combine the given parts of a slice resutl structure to closed loops,
[in,out] | r | - slice result to reassign to loops. |
References c, slice_result::ccount, clear_loop_combiner_context(), clear_slice_result(), item_bin::clen, slice_result::coord, slice_result::count, itembin_slice_add_part(), loop, part, process_multipolygons_find_loops(), process_multipolygons_loop_count(), and process_multipolygons_loop_dump().
Referenced by itembin_slice_direction().
void itembin_nicer_slicer | ( | struct tile_info * | info, |
struct item_bin * | ib, | ||
FILE * | reference, | ||
char * | buffer, | ||
int | min | ||
) |
References slicerpolygon::bbox, bbox(), slicerpolygon::buffer, slicerpolygon::ib, info, slicerpolygon::info, item_bin_get_attr(), itembin_bbox_intersects(), itembin_disassemble(), itembin_slice(), itembin_slicerpolygon_free(), next_tile(), slicerpolygon::number, osm_info(), overlap, slicerpolygon::reference, tile_bbox(), tile_len(), tile_write_item_to_tile(), and item_bin::type.
Referenced by tile_write_item_minmax().
|
static |
calculate intersection point of line with one side of an rectangle
WARNING; Check if the line actually crosses the border before using this function
[in] | p1 | - one point of the line |
[in] | p2 | - another point of the line |
[in] | rect | - rectangle to use as cuttinng data |
[in] | edge | - edge of rectangle to use. 0 left, 1 right, 2 bottom, 3 top |
[out] | ret | - resulting intersection point |
References rect::h, coord::x, and coord::y.
Referenced by itembin_line_intersect_x(), and itembin_slice_part_direction().
calculate if a point is inside a polygon
This function calculates if a point is inside a polygon. To do this, it casts a ray along the points x axis through the polygon and counts the intersections. If the count is even the point is outside, if odd inside
[in] | pt | - point to check |
[in] | poly | - polygon to check |
[in] | ccount | - number of coordinates in poly |
References itembin_line_intersect_x(), p, coord::x, and coord::y.
Referenced by itembin_write_slice_result().
|
static |
References slice_result::ccount, slicerpolygon::ccount, clear_slice_result(), slice_result::coord, slice_result::count, slicerpolygon::count, slicerpolygon::hole_count, slicerpolygon::holes, slicerpolygon::holes_bbox, itembin_bbox_intersects(), itembin_slice_direction(), itembin_write_slice_result(), and slicerpolygon::poly.
Referenced by itembin_nicer_slicer().
|
static |
add a part to a slice result structure
This function adds a given line part to a slice result. It allocates the required space for pointers, but keeps the memory of the parts coordinate array. the coordinate should not be freed outside
[in] | r | - slice result structure |
[in] | part | - new part coordinate array to add |
[in] | ccount | - number of coordinates in new part array. |
References slice_result::ccount, slice_result::coord, slice_result::count, and part.
Referenced by itembin_loop_combiner(), itembin_slice_direction(), and itembin_slice_part_direction().
|
static |
|
static |
References geom_is_inside(), itembin_poly_intersection(), itembin_slice_add_part(), p, and part.
Referenced by itembin_slice_direction().
|
static |
free structure filled by itembin_disassemble
sp | structure to free |
References slicerpolygon::ccount, slicerpolygon::f_attrs, slicerpolygon::holes, and slicerpolygon::holes_bbox.
Referenced by itembin_nicer_slicer().
|
static |
srt coordinates along cut edge
[in,out] | coord | - array of points on one axis. Sorted on return. |
[in] | ccpunt | - number of coords in coord |
[in] | edge | - 0 or 1, sort along y axis, 2 or 3 sort along x axis |
References itembin_sort_coordinates_x(), and itembin_sort_coordinates_y().
Referenced by itembin_slice_direction().
|
static |
sort functions for qsort to sort coordinates along x axis
[in] | a | - coordinate a |
[in] | b | - coordinate b |
References itembin_sort_coordinates_xy().
Referenced by itembin_sort_coordinates().
|
inlinestatic |
sort functions for qsort to sort coordinates along x or y axis
[in] | a | - coordinate a |
[in] | b | - coordinate b |
[in] | axis | - 1 if x axis, 0 if y axis |
Referenced by itembin_sort_coordinates_x(), and itembin_sort_coordinates_y().
|
static |
sort functions for qsort to sort coordinates along y axis
[in] | a | - coordinate a |
[in] | b | - coordinate b |
References itembin_sort_coordinates_xy().
Referenced by itembin_sort_coordinates().
|
static |
References slice_result::ccount, item_bin::clen, slice_result::coord, slice_result::count, slicerpolygon::f_attr_len, slicerpolygon::f_attrs, slicerpolygon::ib, item_bin_add_attr_string(), item_bin_add_hole(), itembin_poly_is_in(), item_bin::len, slicerpolygon::number, tile_write_item_to_tile(), and item_bin::type.
Referenced by itembin_slice().
|
static |
advance tile number on same tile level
[in,out] | buffer | current tile number, after call next tile number |
Referenced by itembin_nicer_slicer().