void add_connection_link(CrItem *group, struct point p1, struct point p2, struct point p3, struct point p4, gboolean has_end_point) { CrItem *link1, *link2; CrItem *upper_line; guint color; /* printf("Add connection link \n"); printf("[%d %d]\n",p1.x, p1.y); printf("[%d %d]\n",p2.x, p2.y); printf("[%d %d]\n",p3.x, p3.y); printf("[%d %d]\n",p4.x, p4.y); */ /* Draw connection link 1 */ if(has_end_point){ link1 = cr_vector_new(group, p1.x , p1.y, p3.x - p1.x, p3.y - p1.y, "outline_color_rgba", LINK_CONNECTION_COLOR, "end_scaleable", FALSE, "line_scaleable", FALSE, "line_width", 1.5, NULL); } /* Draw connection link 2 */ link2 = cr_vector_new(group, p2.x , p2.y, p4.x - p2.x, p4.y - p4.y, "outline_color_rgba", LINK_CONNECTION_COLOR, "end_scaleable", FALSE, "line_scaleable", FALSE, "line_width", 1.5, NULL); /* Draw line up timeline */ upper_line = cr_vector_new(group, p3.x , p3.y, p4.x - p3.x, p4.y - p3.y, "outline_color_rgba", LINK_CONNECTION_UPPER_COLOR, "end_scaleable", FALSE, "line_scaleable", FALSE, "line_width", 1.5, NULL); /* Draw circles */ add_circle(group, p3); add_circle(group, p4); }
static void add_vector(CrItem *group) { double x, y, x2, y2; GArray *array; CrItem *item; guint color; x = g_random_double_range(0, 360); y = g_random_double_range(0, 360); x2 = g_random_double_range(10, 100); y2 = g_random_double_range(10, 100); item = cr_vector_new(group, x, y, x2, y2, "outline_color_rgba", 0x000000ff, "end_scaleable", FALSE, "line_scaleable", FALSE, "line_width", 2.0, NULL); cr_arrow_new(item, -1, NULL); cr_arrow_new(item, 0, NULL); g_signal_connect(item, "event", (GCallback) item_event, NULL); }
void add_comunication_link(CrItem *group, struct point p1, struct point p2, int comunication_type) { CrItem *link; unsigned long long int color; if(comunication_type == EVENT_CONNECTION) color = LINK_CONNECTION_COLOR; else if(comunication_type == EVENT_INPUT) color = LINK_RIGHT_COLOR; else if(comunication_type == EVENT_OUTPUT) color = LINK_LEFT_COLOR; link = cr_vector_new(group, p1.x , p2.y, p2.x - p1.x, p2.y - p1.y, "outline_color_rgba", color, "fill_color_rgba", color, "end_scaleable", FALSE, "line_scaleable", FALSE, "line_width", 1.5, NULL); /*add_circle(link, p1);*/ if(comunication_type == EVENT_CONNECTION) add_circle(group, p2); else cr_arrow_new(link, 0, NULL); }