cgma
|
#include <GfxPreview.hpp>
Public Member Functions | |
GfxPreview () | |
virtual | ~GfxPreview () |
Static Public Member Functions | |
static void | clear () |
static void | flush () |
static void | draw_ref_entity (RefEntity *entity, int color=CUBIT_DEFAULT_COLOR_INDEX, CubitTransformMatrix *trans_mat=0) |
static void | draw_ref_vertex (RefVertex *entity, int color=CUBIT_DEFAULT_COLOR_INDEX) |
static void | draw_ref_edge (RefEdge *entity, int color=CUBIT_DEFAULT_COLOR_INDEX) |
static void | draw_ref_face (RefFace *entity, int color=CUBIT_DEFAULT_COLOR_INDEX) |
static void | draw_ref_face_edges (RefFace *entity, int color=CUBIT_DEFAULT_COLOR_INDEX) |
static void | draw_ref_volume (RefVolume *entity, int color=CUBIT_DEFAULT_COLOR_INDEX, int mode=CUBIT_SMOOTH_SHADING) |
static void | draw_ref_volume_edges (RefVolume *entity, int color=CUBIT_DEFAULT_COLOR_INDEX) |
static void | draw_ref_body (Body *entity, int color=CUBIT_DEFAULT_COLOR_INDEX, int mode=CUBIT_SMOOTH_SHADING) |
static void | draw_point (TBPoint *pt, int color) |
static void | draw_curve (Curve *curve, int color) |
static void | draw_surface (Surface *surf, int color) |
static void | draw_surface_facets_shaded (Surface *surf, int color) |
static void | draw_box (CubitBox &box, int color) |
static void | draw_point (float x, float y, float z, int color) |
static void | draw_point (const CubitVector &vector, int color) |
static void | draw_point (CubitVector *vector, int color) |
static void | draw_line (float x1, float y1, float z1, float x2, float y2, float z2, int color) |
static void | draw_line (const CubitVector &x, const CubitVector &y, int color) |
static void | draw_polyline (const GPoint *points, int num_points, int color) |
static void | draw_polygon (const GPoint *points, int num_points, int color, int border_color, bool filled=true) |
static void | draw_polygons (int num_points, const double *xyzs, int num_face_points, const int *face_list, int color, int mode) |
static void | draw_cylinder (const CubitVector &axis, const CubitVector &origin, CubitBox &bounding_box, float radius, int color) |
draw a cylinder for previewing | |
static void | draw_frustum (const CubitVector axis, const CubitVector origin1, const CubitVector origin2, double dRad1, double dRad2, CubitBox &bounding_box, int color) |
static void | draw_quad (const GPoint *points, int color) |
static void | draw_tri (const GPoint *points, int color) |
static void | draw_vector (const GPoint *tail, const GPoint *head, int color) |
static void | draw_vector (const CubitVector &tail, const CubitVector &head, int color) |
static void | draw_label (const char *label, float x, float y, float z, int color) |
static void | draw_label (int label, float x, float y, float z, int color) |
Protected Member Functions | |
virtual void | p_clear ()=0 |
virtual void | p_flush ()=0 |
virtual void | p_draw_ref_entity (RefEntity *entity, int color, CubitTransformMatrix *mat)=0 |
virtual void | p_draw_ref_vertex (RefVertex *entity, int color)=0 |
virtual void | p_draw_ref_edge (RefEdge *entity, int color)=0 |
virtual void | p_draw_ref_face (RefFace *entity, int color)=0 |
virtual void | p_draw_ref_face_edges (RefFace *entity, int color)=0 |
virtual void | p_draw_ref_volume (RefVolume *entity, int color, int mode)=0 |
virtual void | p_draw_ref_volume_edges (RefVolume *entity, int color)=0 |
virtual void | p_draw_ref_body (Body *entity, int color, int mode)=0 |
virtual void | p_draw_box (CubitBox &box, int color)=0 |
virtual void | p_draw_point (float, float, float, int)=0 |
virtual void | p_draw_point (const CubitVector &vector, int color)=0 |
virtual void | p_draw_line (float, float, float, float, float, float, int)=0 |
virtual void | p_draw_line (const CubitVector &x, const CubitVector &y, int color)=0 |
virtual void | p_draw_polyline (const GPoint *, int, int)=0 |
virtual void | p_draw_polygon (const GPoint *points, int num_points, int color, int border_color, bool filled)=0 |
virtual void | p_draw_polygons (int num_points, const double *xyzs, int num_face_points, const int *face_list, int color, int mode)=0 |
virtual void | p_draw_cylinder (const CubitVector &axis, const CubitVector &origin, CubitBox &bounding_box, float radius, int color)=0 |
virtual void | p_draw_frustum (const CubitVector axis, const CubitVector origin1, const CubitVector origin2, double radius1, double radius2, CubitBox bounding_box, int color)=0 |
virtual void | p_draw_quad (const GPoint *, int)=0 |
virtual void | p_draw_tri (const GPoint *, int)=0 |
virtual void | p_draw_vector (const CubitVector &, const CubitVector &, int)=0 |
virtual void | p_draw_label (const char *, float, float, float, int)=0 |
virtual void | p_draw_label (int, float, float, float, int)=0 |
Static Private Attributes | |
static GfxPreview * | mInstance = 0 |
Definition at line 44 of file GfxPreview.hpp.
Definition at line 15 of file GfxPreview.cpp.
GfxPreview::~GfxPreview | ( | ) | [virtual] |
Definition at line 26 of file GfxPreview.cpp.
{ mInstance = 0; }
void GfxPreview::clear | ( | ) | [static] |
Definition at line 33 of file GfxPreview.cpp.
void GfxPreview::draw_box | ( | CubitBox & | box, |
int | color | ||
) | [static] |
Definition at line 98 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_box(box, color); }
void GfxPreview::draw_curve | ( | Curve * | curve, |
int | color | ||
) | [static] |
Definition at line 222 of file GfxPreview.cpp.
{ int num_divs = 20; double lo, hi; curve->get_param_range(lo, hi); double dv = (hi-lo)/(double)num_divs; int i; double param = lo; for(i=0; i<num_divs; i++) { CubitVector p1, p2; curve->position_from_u(param, p1); param += dv; curve->position_from_u(param, p2); draw_line(p1.x(), p1.y(), p1.z(), p2.x(), p2.y(), p2.z(), color); } flush(); DLIList<TBPoint*> pts; curve->points(pts); for(i=pts.size(); i>0; i--) { TBPoint *cur_pt = pts.get_and_step(); draw_point(cur_pt, color); } }
void GfxPreview::draw_cylinder | ( | const CubitVector & | axis, |
const CubitVector & | origin, | ||
CubitBox & | bounding_box, | ||
float | radius, | ||
int | color | ||
) | [static] |
draw a cylinder for previewing
axis | - orientation of the length of the cylinder |
origin | - the center of the cylinder in x, y, and z |
bounding_box | - the bounding box of the cylinder |
radius | - radius of the cylinder |
color | - color of the cylinder |
Definition at line 201 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_cylinder(axis, origin, bounding_box, radius, color); }
void GfxPreview::draw_frustum | ( | const CubitVector | axis, |
const CubitVector | origin1, | ||
const CubitVector | origin2, | ||
double | dRad1, | ||
double | dRad2, | ||
CubitBox & | bounding_box, | ||
int | color | ||
) | [static] |
Definition at line 208 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_frustum( axis , origin1, origin2, dRad1 , dRad2 , bounding_box, color); }
void GfxPreview::draw_label | ( | const char * | label, |
float | x, | ||
float | y, | ||
float | z, | ||
int | color | ||
) | [static] |
Definition at line 190 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_label(label, x, y, z, color); }
void GfxPreview::draw_label | ( | int | label, |
float | x, | ||
float | y, | ||
float | z, | ||
int | color | ||
) | [static] |
Definition at line 195 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_label(label, x, y, z, color); }
void GfxPreview::draw_line | ( | float | x1, |
float | y1, | ||
float | z1, | ||
float | x2, | ||
float | y2, | ||
float | z2, | ||
int | color | ||
) | [static] |
Definition at line 124 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_line(x1, y1, z1, x2, y2, z2, color); }
void GfxPreview::draw_line | ( | const CubitVector & | x, |
const CubitVector & | y, | ||
int | color | ||
) | [static] |
Definition at line 130 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_line(x, y, color); }
void GfxPreview::draw_point | ( | TBPoint * | pt, |
int | color | ||
) | [static] |
Definition at line 215 of file GfxPreview.cpp.
{ CubitVector v = pt->coordinates(); draw_point(v, color); flush(); }
void GfxPreview::draw_point | ( | float | x, |
float | y, | ||
float | z, | ||
int | color | ||
) | [static] |
Definition at line 105 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_point(x, y, z, color); }
void GfxPreview::draw_point | ( | const CubitVector & | vector, |
int | color | ||
) | [static] |
Definition at line 111 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_point(vector, color); }
void GfxPreview::draw_point | ( | CubitVector * | vector, |
int | color | ||
) | [static] |
Definition at line 117 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_point(*vector, color); }
void GfxPreview::draw_polygon | ( | const GPoint * | points, |
int | num_points, | ||
int | color, | ||
int | border_color, | ||
bool | filled = true |
||
) | [static] |
Definition at line 157 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_polygon(points, num_points, color, border_color, filled); }
void GfxPreview::draw_polygons | ( | int | num_points, |
const double * | xyzs, | ||
int | num_face_points, | ||
const int * | face_list, | ||
int | color, | ||
int | mode | ||
) | [static] |
Definition at line 148 of file GfxPreview.cpp.
{ if (!mInstance) return; mInstance->p_draw_polygons( num_points, xyzs, num_face_points, face_list, color, mode); }
void GfxPreview::draw_polyline | ( | const GPoint * | points, |
int | num_points, | ||
int | color | ||
) | [static] |
Definition at line 137 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_polyline(points, num_points, color); }
void GfxPreview::draw_quad | ( | const GPoint * | points, |
int | color | ||
) | [static] |
Definition at line 164 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_quad(points, color); }
void GfxPreview::draw_ref_body | ( | Body * | entity, |
int | color = CUBIT_DEFAULT_COLOR_INDEX , |
||
int | mode = CUBIT_SMOOTH_SHADING |
||
) | [static] |
Definition at line 90 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_ref_body(entity, color, mode); }
void GfxPreview::draw_ref_edge | ( | RefEdge * | entity, |
int | color = CUBIT_DEFAULT_COLOR_INDEX |
||
) | [static] |
Definition at line 60 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_ref_edge(entity, color); }
void GfxPreview::draw_ref_entity | ( | RefEntity * | entity, |
int | color = CUBIT_DEFAULT_COLOR_INDEX , |
||
CubitTransformMatrix * | trans_mat = 0 |
||
) | [static] |
Definition at line 48 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_ref_entity(entity, color, mat); }
void GfxPreview::draw_ref_face | ( | RefFace * | entity, |
int | color = CUBIT_DEFAULT_COLOR_INDEX |
||
) | [static] |
Definition at line 66 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_ref_face(entity, color); }
void GfxPreview::draw_ref_face_edges | ( | RefFace * | entity, |
int | color = CUBIT_DEFAULT_COLOR_INDEX |
||
) | [static] |
Definition at line 72 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_ref_face_edges(entity, color); }
void GfxPreview::draw_ref_vertex | ( | RefVertex * | entity, |
int | color = CUBIT_DEFAULT_COLOR_INDEX |
||
) | [static] |
Definition at line 54 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_ref_vertex(entity, color); }
void GfxPreview::draw_ref_volume | ( | RefVolume * | entity, |
int | color = CUBIT_DEFAULT_COLOR_INDEX , |
||
int | mode = CUBIT_SMOOTH_SHADING |
||
) | [static] |
Definition at line 78 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_ref_volume(entity, color, mode); }
void GfxPreview::draw_ref_volume_edges | ( | RefVolume * | entity, |
int | color = CUBIT_DEFAULT_COLOR_INDEX |
||
) | [static] |
Definition at line 84 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_ref_volume_edges(entity, color); }
void GfxPreview::draw_surface | ( | Surface * | surf, |
int | color | ||
) | [static] |
Definition at line 248 of file GfxPreview.cpp.
{ int num_divs = 20; double ulo, uhi, vlo, vhi; surf->get_param_range_U(ulo, uhi); surf->get_param_range_V(vlo, vhi); double du = (uhi-ulo)/(double)num_divs; double dv = (vhi-vlo)/(double)num_divs; int i, j; double uparam, vparam; uparam = ulo; for(i=0; i<num_divs; i++) { vparam = vlo; for(j=0; j<num_divs; j++) { CubitVector p1, p2; p1 = surf->position_from_u_v(uparam, vparam); vparam += dv; p2 = surf->position_from_u_v(uparam, vparam); draw_line(p1.x(), p1.y(), p1.z(), p2.x(), p2.y(), p2.z(), color); } uparam += du; } vparam = vlo; for(i=0; i<num_divs; i++) { uparam = ulo; for(j=0; j<num_divs; j++) { CubitVector p1, p2; p1 = surf->position_from_u_v(uparam, vparam); uparam += du; p2 = surf->position_from_u_v(uparam, vparam); draw_line(p1.x(), p1.y(), p1.z(), p2.x(), p2.y(), p2.z(), color); } vparam += dv; } flush(); }
void GfxPreview::draw_surface_facets_shaded | ( | Surface * | surf, |
int | color | ||
) | [static] |
Definition at line 289 of file GfxPreview.cpp.
{ GMem g_mem; surf->get_geometry_query_engine()->get_graphics(surf, &g_mem); const float* xyzs = reinterpret_cast<const float*>(g_mem.point_list()); std::vector<double> dcoords(xyzs, xyzs+g_mem.pointListCount*3); GfxPreview::draw_polygons(g_mem.pointListCount, &dcoords[0], g_mem.fListCount, g_mem.facet_list(), color, CUBIT_SMOOTH_SHADING); flush(); }
void GfxPreview::draw_tri | ( | const GPoint * | points, |
int | color | ||
) | [static] |
Definition at line 171 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_tri(points, color); }
void GfxPreview::draw_vector | ( | const GPoint * | tail, |
const GPoint * | head, | ||
int | color | ||
) | [static] |
Definition at line 183 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_vector(CubitVector(tail->x, tail->y, tail->z), CubitVector(head->x, head->y, head->z), color); }
void GfxPreview::draw_vector | ( | const CubitVector & | tail, |
const CubitVector & | head, | ||
int | color | ||
) | [static] |
Definition at line 177 of file GfxPreview.cpp.
{ if(!mInstance) return; mInstance->p_draw_vector(tail, head, color); }
void GfxPreview::flush | ( | ) | [static] |
Definition at line 40 of file GfxPreview.cpp.
virtual void GfxPreview::p_clear | ( | ) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_box | ( | CubitBox & | box, |
int | color | ||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_cylinder | ( | const CubitVector & | axis, |
const CubitVector & | origin, | ||
CubitBox & | bounding_box, | ||
float | radius, | ||
int | color | ||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_frustum | ( | const CubitVector | axis, |
const CubitVector | origin1, | ||
const CubitVector | origin2, | ||
double | radius1, | ||
double | radius2, | ||
CubitBox | bounding_box, | ||
int | color | ||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_label | ( | const char * | , |
float | , | ||
float | , | ||
float | , | ||
int | |||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_label | ( | int | , |
float | , | ||
float | , | ||
float | , | ||
int | |||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_line | ( | float | , |
float | , | ||
float | , | ||
float | , | ||
float | , | ||
float | , | ||
int | |||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_line | ( | const CubitVector & | x, |
const CubitVector & | y, | ||
int | color | ||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_point | ( | float | , |
float | , | ||
float | , | ||
int | |||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_point | ( | const CubitVector & | vector, |
int | color | ||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_polygon | ( | const GPoint * | points, |
int | num_points, | ||
int | color, | ||
int | border_color, | ||
bool | filled | ||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_polygons | ( | int | num_points, |
const double * | xyzs, | ||
int | num_face_points, | ||
const int * | face_list, | ||
int | color, | ||
int | mode | ||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_polyline | ( | const GPoint * | , |
int | , | ||
int | |||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_quad | ( | const GPoint * | , |
int | |||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_ref_body | ( | Body * | entity, |
int | color, | ||
int | mode | ||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_ref_edge | ( | RefEdge * | entity, |
int | color | ||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_ref_entity | ( | RefEntity * | entity, |
int | color, | ||
CubitTransformMatrix * | mat | ||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_ref_face | ( | RefFace * | entity, |
int | color | ||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_ref_face_edges | ( | RefFace * | entity, |
int | color | ||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_ref_vertex | ( | RefVertex * | entity, |
int | color | ||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_ref_volume | ( | RefVolume * | entity, |
int | color, | ||
int | mode | ||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_ref_volume_edges | ( | RefVolume * | entity, |
int | color | ||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_tri | ( | const GPoint * | , |
int | |||
) | [protected, pure virtual] |
virtual void GfxPreview::p_draw_vector | ( | const CubitVector & | , |
const CubitVector & | , | ||
int | |||
) | [protected, pure virtual] |
virtual void GfxPreview::p_flush | ( | ) | [protected, pure virtual] |
GfxPreview * GfxPreview::mInstance = 0 [static, private] |
Definition at line 48 of file GfxPreview.hpp.