libgeda
|
#include <config.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include "libgeda_priv.h"
Go to the source code of this file.
Typedefs | |
typedef void(* | DRAW_FUNC )(TOPLEVEL *toplevel, FILE *fp, PATH *path, int line_width, int length, int space, int origin_x, int origin_y) |
typedef void(* | FILL_FUNC )(TOPLEVEL *toplevel, FILE *fp, PATH *path, int fill_width, int angle1, int pitch1, int angle2, int pitch2, int origin_x, int origin_y) |
Functions | |
OBJECT * | o_path_new (TOPLEVEL *toplevel, char type, int color, const char *path_string) |
Create and add path OBJECT to list. | |
OBJECT * | o_path_copy (TOPLEVEL *toplevel, OBJECT *o_current) |
Create a copy of a path. | |
OBJECT * | o_path_read (TOPLEVEL *toplevel, const char *first_line, TextBuffer *tb, unsigned int release_ver, unsigned int fileformat_ver, GError **err) |
Create path OBJECT from character string. | |
char * | o_path_save (TOPLEVEL *toplevel, OBJECT *object) |
Create a character string representation of a path OBJECT. | |
void | o_path_modify (TOPLEVEL *toplevel, OBJECT *object, int x, int y, int whichone) |
Modify controol point location. | |
void | o_path_translate_world (TOPLEVEL *toplevel, int dx, int dy, OBJECT *object) |
Translate a path position in WORLD coordinates by a delta. | |
void | o_path_rotate_world (TOPLEVEL *toplevel, int world_centerx, int world_centery, int angle, OBJECT *object) |
Rotate Line OBJECT using WORLD coordinates. | |
void | o_path_mirror_world (TOPLEVEL *toplevel, int world_centerx, int world_centery, OBJECT *object) |
Mirror a path using WORLD coordinates. | |
void | o_path_recalc (TOPLEVEL *toplevel, OBJECT *o_current) |
Recalculate path coordinates in SCREEN units. | |
void | world_get_path_bounds (TOPLEVEL *toplevel, OBJECT *object, int *left, int *top, int *right, int *bottom) |
Get path bounding rectangle in WORLD coordinates. | |
gboolean | o_path_get_position (TOPLEVEL *toplevel, gint *x, gint *y, OBJECT *object) |
get the position of the first path point | |
static void | o_path_print_solid (TOPLEVEL *toplevel, FILE *fp, PATH *path, int line_width, int length, int space, int origin_x, int origin_y) |
Print a solid PATH to Postscript document. | |
static void | o_path_print_dotted (TOPLEVEL *toplevel, FILE *fp, PATH *path, int line_width, int length, int space, int origin_x, int origin_y) |
Print a dotted PATH to Postscript document. | |
static void | o_path_print_dashed (TOPLEVEL *toplevel, FILE *fp, PATH *path, int line_width, int length, int space, int origin_x, int origin_y) |
Print a dashed PATH to Postscript document. | |
static void | o_path_print_center (TOPLEVEL *toplevel, FILE *fp, PATH *path, int line_width, int length, int space, int origin_x, int origin_y) |
Print centered line type PATH to Postscript document. | |
static void | o_path_print_phantom (TOPLEVEL *toplevel, FILE *fp, PATH *path, int line_width, int length, int space, int origin_x, int origin_y) |
Print phantom line type PATH to Postscript document. | |
static void | o_path_print_filled (TOPLEVEL *toplevel, FILE *fp, PATH *path, int fill_width, int angle1, int pitch1, int angle2, int pitch2, int origin_x, int origin_y) |
Print a solid pattern PATH to Postscript document. | |
static void | o_path_print_hatch (TOPLEVEL *toplevel, FILE *fp, PATH *path, int fill_width, int angle1, int pitch1, int angle2, int pitch2, int origin_x, int origin_y) |
Print a hatch pattern PATH to Postscript document. | |
static void | o_path_print_mesh (TOPLEVEL *toplevel, FILE *fp, PATH *path, int fill_width, int angle1, int pitch1, int angle2, int pitch2, int origin_x, int origin_y) |
Print a mesh pattern PATH to Postscript document. | |
void | o_path_print (TOPLEVEL *toplevel, FILE *fp, OBJECT *o_current, int origin_x, int origin_y) |
Print PATH to Postscript document. | |
double | o_path_shortest_distance (OBJECT *object, int x, int y, int force_solid) |
Calculates the distance between the given point and the closest point on the given path segment. |
typedef void(* DRAW_FUNC)(TOPLEVEL *toplevel, FILE *fp, PATH *path, int line_width, int length, int space, int origin_x, int origin_y) |
Definition at line 33 of file o_path_basic.c.
typedef void(* FILL_FUNC)(TOPLEVEL *toplevel, FILE *fp, PATH *path, int fill_width, int angle1, int pitch1, int angle2, int pitch2, int origin_x, int origin_y) |
Definition at line 38 of file o_path_basic.c.
The OBJECT structure is allocated with the s_basic_init_object() function. The structure describing the path is allocated and initialized with the parameters given to the function.
Both the path type and the filling type are set to default values : solid path type with a width of 0, and no filling. It can be changed after with the o_set_line_options() and o_set_fill_options().
The object is added to the end of the list described by the object_list parameter by the #s_basic_link_object().
[in] | toplevel | The TOPLEVEL object. |
[in] | type | Must be OBJ_PATH. |
[in] | color | The path color. |
[in] | path_string | The string representation of the path |
Definition at line 74 of file o_path_basic.c.
[in] | toplevel | The TOPLEVEL object. |
[in] | o_current | Line OBJECT to copy. |
Definition at line 109 of file o_path_basic.c.
OBJECT* o_path_read | ( | TOPLEVEL * | toplevel, |
const char * | first_line, | ||
TextBuffer * | tb, | ||
unsigned int | release_ver, | ||
unsigned int | fileformat_ver, | ||
GError ** | err | ||
) |
Depending on *version, the correct file format is considered. Currently two file format revisions are supported :
[in] | toplevel | The TOPLEVEL object. |
[in] | first_line | Character string with path description. |
[in] | tb | Text buffer containing the path string. |
[in] | release_ver | libgeda release version number. |
[in] | fileformat_ver | libgeda file format version number. |
Definition at line 155 of file o_path_basic.c.
[in] | toplevel | a TOPLEVEL structure |
[in] | object | path OBJECT to create string from. |
Definition at line 246 of file o_path_basic.c.
The new position is given by x and y.
[in] | toplevel | The TOPLEVEL object. |
[in,out] | object | The path OBJECT |
[in] | x | New x coordinate for the control point |
[in] | y | New y coordinate for the control point |
[in] | whichone | Which control point is being modified |
Definition at line 300 of file o_path_basic.c.
[in] | toplevel | The TOPLEVEL object. |
[in] | dx | x distance to move. |
[in] | dy | y distance to move. |
[in,out] | object | Line OBJECT to translate. |
Definition at line 354 of file o_path_basic.c.
void o_path_rotate_world | ( | TOPLEVEL * | toplevel, |
int | world_centerx, | ||
int | world_centery, | ||
int | angle, | ||
OBJECT * | object | ||
) |
[in] | toplevel | The TOPLEVEL object. |
[in] | world_centerx | Rotation center x coordinate in WORLD units. |
[in] | world_centery | Rotation center y coordinate in WORLD units. |
[in] | angle | Rotation angle in degrees (See note below). |
[in,out] | object | Line OBJECT to rotate. |
Definition at line 399 of file o_path_basic.c.
void o_path_mirror_world | ( | TOPLEVEL * | toplevel, |
int | world_centerx, | ||
int | world_centery, | ||
OBJECT * | object | ||
) |
[in] | toplevel | The TOPLEVEL object. |
[in] | world_centerx | Origin x coordinate in WORLD units. |
[in] | world_centery | Origin y coordinate in WORLD units. |
[in,out] | object | Line OBJECT to mirror. |
Definition at line 445 of file o_path_basic.c.
[in] | toplevel | The TOPLEVEL object. |
[in,out] | o_current | Line OBJECT to be recalculated. |
Definition at line 482 of file o_path_basic.c.
void world_get_path_bounds | ( | TOPLEVEL * | toplevel, |
OBJECT * | object, | ||
int * | left, | ||
int * | top, | ||
int * | right, | ||
int * | bottom | ||
) |
[in] | toplevel | The TOPLEVEL object. |
[in] | object | Line OBJECT to read coordinates from. |
[out] | left | Left path coordinate in WORLD units. |
[out] | top | Top path coordinate in WORLD units. |
[out] | right | Right path coordinate in WORLD units. |
[out] | bottom | Bottom path coordinate in WORLD units. |
Definition at line 518 of file o_path_basic.c.
[in] | toplevel | The toplevel environment. |
[out] | x | pointer to the x-position |
[out] | y | pointer to the y-position |
[in] | object | The object to get the position. |
Definition at line 577 of file o_path_basic.c.
static void o_path_print_solid | ( | TOPLEVEL * | toplevel, |
FILE * | fp, | ||
PATH * | path, | ||
int | line_width, | ||
int | length, | ||
int | space, | ||
int | origin_x, | ||
int | origin_y | ||
) | [static] |
All dimensions are in mils.
[in] | toplevel | The TOPLEVEL object. |
[in] | fp | FILE pointer to Postscript document. |
[in] | path | The PATH object ot print |
[in] | line_width | PATH Line width. |
[in] | length | Dashed line length. |
[in] | space | Amount of space between dashes. |
[in] | origin_x | Page x coordinate to place PATH OBJECT. |
[in] | origin_y | Page y coordinate to place PATH OBJECT. |
Definition at line 605 of file o_path_basic.c.
static void o_path_print_dotted | ( | TOPLEVEL * | toplevel, |
FILE * | fp, | ||
PATH * | path, | ||
int | line_width, | ||
int | length, | ||
int | space, | ||
int | origin_x, | ||
int | origin_y | ||
) | [static] |
All dimensions are in mils.
[in] | toplevel | The TOPLEVEL object |
[in] | fp | FILE pointer to Postscript document |
[in] | path | The PATH object to print |
[in] | line_width | PATH Line width |
[in] | length | Dashed line length |
[in] | space | Amount of space between dashes |
[in] | origin_x | Page x coordinate to place PATH OBJECT |
[in] | origin_y | Page y coordinate to place PATH OBJECT |
Definition at line 662 of file o_path_basic.c.
static void o_path_print_dashed | ( | TOPLEVEL * | toplevel, |
FILE * | fp, | ||
PATH * | path, | ||
int | line_width, | ||
int | length, | ||
int | space, | ||
int | origin_x, | ||
int | origin_y | ||
) | [static] |
All dimensions are in mils.
[in] | toplevel | The TOPLEVEL object. |
[in] | fp | FILE pointer to Postscript document. |
[in] | path | The PATH object to print. |
[in] | line_width | PATH Line width. |
[in] | length | Dashed line length. |
[in] | space | Amount of space between dashes. |
[in] | origin_x | Page x coordinate to place PATH OBJECT. |
[in] | origin_y | Page y coordinate to place PATH OBJECT. |
Definition at line 687 of file o_path_basic.c.
static void o_path_print_center | ( | TOPLEVEL * | toplevel, |
FILE * | fp, | ||
PATH * | path, | ||
int | line_width, | ||
int | length, | ||
int | space, | ||
int | origin_x, | ||
int | origin_y | ||
) | [static] |
All dimensions are in mils.
[in] | toplevel | The TOPLEVEL object |
[in] | fp | FILE pointer to Postscript document |
[in] | path | The PATH object to print |
[in] | line_width | PATH Line width |
[in] | length | Dashed line length |
[in] | space | Amount of space between dashes |
[in] | origin_x | Page x coordinate to place PATH OBJECT |
[in] | origin_y | Page y coordinate to place PATH OBJECT |
Definition at line 712 of file o_path_basic.c.
static void o_path_print_phantom | ( | TOPLEVEL * | toplevel, |
FILE * | fp, | ||
PATH * | path, | ||
int | line_width, | ||
int | length, | ||
int | space, | ||
int | origin_x, | ||
int | origin_y | ||
) | [static] |
All dimensions are in mils.
[in] | toplevel | The TOPLEVEL object |
[in] | fp | FILE pointer to Postscript document |
[in] | path | The PATH object to print |
[in] | line_width | PATH Line width |
[in] | length | Dashed line length |
[in] | space | Amount of space between dashes |
[in] | origin_x | Page x coordinate to place PATH OBJECT |
[in] | origin_y | Page y coordinate to place PATH OBJECT |
Definition at line 737 of file o_path_basic.c.
static void o_path_print_filled | ( | TOPLEVEL * | toplevel, |
FILE * | fp, | ||
PATH * | path, | ||
int | fill_width, | ||
int | angle1, | ||
int | pitch1, | ||
int | angle2, | ||
int | pitch2, | ||
int | origin_x, | ||
int | origin_y | ||
) | [static] |
All dimensions are in mils.
[in] | toplevel | The TOPLEVEL object |
[in] | fp | FILE pointer to Postscript document |
[in] | path | The PATH object to print |
[in] | fill_width | PATH fill width (unused) |
[in] | angle1 | (unused) |
[in] | pitch1 | (unused) |
[in] | angle2 | (unused) |
[in] | pitch2 | (unused) |
[in] | origin_x | Page x coordinate to place PATH OBJECT |
[in] | origin_y | Page y coordinate to place PATH OBJECT |
Definition at line 767 of file o_path_basic.c.
static void o_path_print_hatch | ( | TOPLEVEL * | toplevel, |
FILE * | fp, | ||
PATH * | path, | ||
int | fill_width, | ||
int | angle1, | ||
int | pitch1, | ||
int | angle2, | ||
int | pitch2, | ||
int | origin_x, | ||
int | origin_y | ||
) | [static] |
Negative or zero values for pitch1 are not allowed.
All dimensions are in mils.
[in] | toplevel | The TOPLEVEL object |
[in] | fp | FILE pointer to Postscript document |
[in] | path | The PATH object to print |
[in] | fill_width | PATH fill width |
[in] | angle1 | Angle of hatch pattern |
[in] | pitch1 | Pitch of hatch pattern |
[in] | angle2 | (unused) |
[in] | pitch2 | (unused) |
[in] | origin_x | Page x coordinate to place PATH OBJECT |
[in] | origin_y | Page y coordinate to place PATH OBJECT |
Definition at line 832 of file o_path_basic.c.
static void o_path_print_mesh | ( | TOPLEVEL * | toplevel, |
FILE * | fp, | ||
PATH * | path, | ||
int | fill_width, | ||
int | angle1, | ||
int | pitch1, | ||
int | angle2, | ||
int | pitch2, | ||
int | origin_x, | ||
int | origin_y | ||
) | [static] |
Negative or zero values for pitch1 and/or pitch2 are not allowed.
All dimensions are in mils.
[in] | toplevel | The TOPLEVEL object |
[in] | fp | FILE pointer to Postscript document |
[in] | path | The PATH object to print |
[in] | fill_width | PATH fill width |
[in] | angle1 | 1st angle for mesh pattern |
[in] | pitch1 | 1st pitch for mesh pattern |
[in] | angle2 | 2nd angle for mesh pattern |
[in] | pitch2 | 2nd pitch for mesh pattern |
[in] | origin_x | Page x coordinate to place PATH OBJECT |
[in] | origin_y | Page y coordinate to place PATH OBJECT |
Definition at line 882 of file o_path_basic.c.
void o_path_print | ( | TOPLEVEL * | toplevel, |
FILE * | fp, | ||
OBJECT * | o_current, | ||
int | origin_x, | ||
int | origin_y | ||
) |
[in] | toplevel | The TOPLEVEL object. |
[in] | fp | FILE pointer to Postscript document. |
[in] | o_current | PATH OBJECT to write to document. |
[in] | origin_x | Page x coordinate to place PATH OBJECT. |
[in] | origin_y | Page y coordinate to place PATH OBJECT. |
The needed parameters for each of these type is extracted from the o_current object. Depending on the type, unused parameters are set to -1.
In the eventuality of a length and/or space null, the line is printed solid to avoid and endless loop produced by other functions in such a case.
The case where pitch1 and pitch2 are null or negative is avoided as it leads to an endless loop in most of the called functions. In such a case, the path is printed filled. Unused parameters for each of these functions are set to -1 or any passive value.
Definition at line 907 of file o_path_basic.c.
double o_path_shortest_distance | ( | OBJECT * | object, |
int | x, | ||
int | y, | ||
int | force_solid | ||
) |
[in] | object | The path OBJECT. |
[in] | x | The x coordinate of the given point. |
[in] | y | The y coordinate of the given point. |
[in] | force_solid | If true, force treating the object as solid. |
Definition at line 1055 of file o_path_basic.c.