Go to the documentation of this file.00001 #include "bgui_vtol2D_rubberband_client.h"
00002
00003
00004
00005 #include <vtol/vtol_face_2d.h>
00006 #include <vtol/vtol_vertex_2d.h>
00007 #include <bgui/bgui_vtol2D_tableau.h>
00008
00009 void
00010 bgui_vtol2D_rubberband_client::
00011 add_point(float x, float y)
00012 {
00013 vtol2D_->add_point(x,y);
00014 }
00015
00016 void
00017 bgui_vtol2D_rubberband_client::
00018 add_line(float x0, float y0, float x1, float y1)
00019 {
00020 vtol2D_->add_line(x0, y0, x1, y1);
00021 }
00022
00023 void
00024 bgui_vtol2D_rubberband_client::
00025 add_infinite_line(float a, float b, float c)
00026 {
00027 vtol2D_->add_infinite_line(a, b, c);
00028 }
00029
00030 void
00031 bgui_vtol2D_rubberband_client::
00032 add_circle(float x, float y, float r)
00033 {
00034 vtol2D_->add_circle(x, y, r);
00035 }
00036
00037 void
00038 bgui_vtol2D_rubberband_client::
00039 add_linestrip(int n, float const* x, float const* y)
00040 {
00041 vtol2D_->add_linestrip(n, x, y);
00042 }
00043
00044 void
00045 bgui_vtol2D_rubberband_client::
00046 add_polygon(int n, float const* x, float const* y)
00047 {
00048 vcl_vector<vtol_vertex_sptr> verts;
00049 for (int i=0; i+1<n; ++i)
00050 verts.push_back(new vtol_vertex_2d(x[i], y[i]));
00051 vtol_face_2d_sptr f2d = new vtol_face_2d(verts);
00052 vtol2D_->add_face(f2d);
00053 vtol2D_->set_temp(f2d->cast_to_face());
00054 }
00055
00056 void
00057 bgui_vtol2D_rubberband_client::
00058 add_box(float x0, float y0, float x1, float y1)
00059 {
00060 vtol_vertex_sptr v0 = new vtol_vertex_2d(x0, y0);
00061 vtol_vertex_sptr v1 = new vtol_vertex_2d(x1, y0);
00062 vtol_vertex_sptr v2 = new vtol_vertex_2d(x1, y1);
00063 vtol_vertex_sptr v3 = new vtol_vertex_2d(x0, y1);
00064 vcl_vector<vtol_vertex_sptr> verts;
00065 verts.push_back(v0); verts.push_back(v1);
00066 verts.push_back(v2); verts.push_back(v3);
00067 vtol_face_2d_sptr box = new vtol_face_2d(verts);
00068 vtol2D_->add_face(box);
00069 vtol2D_->set_temp(box->cast_to_face());
00070 }
00071
00072 void
00073 bgui_vtol2D_rubberband_client::
00074 clear_highlight()
00075 {
00076 vtol2D_->highlight(0);
00077 }