Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

Vrml.h

Go to the documentation of this file.
00001 //     $Id: Vrml.h,v 1.1.1.1 2001/01/04 01:01:11 burnett Exp $
00002 //  Author: Toby Burnett
00003 //
00004 //
00005 // THis is a ViewPort subclass that writes 3-d information in VRML format to a file.
00006 // The file can then be viewed with various WWW browsers.
00007 //
00008 // sample usage:
00009 //
00010 //   Vrml scene("myscene.wrl"); // will write to the file
00011 //   DisplayList* detector;        //from somewhere
00012 //   detector->draw(&scene);
00013 //
00014 #ifndef VRML_H
00015 #define VRML_H
00016 
00017 #include "gui/ViewPort.h"
00018 
00019 
00020 #include <string>
00021 #include <iostream>
00022 
00023 namespace gui {
00024     class Vrml  : public ViewPort
00025     {
00026     public:
00027         Vrml(std::ostream& out);
00028         virtual ~Vrml();
00029         
00030         //  functions for setting drawing attributes
00031         
00032         void set_rgb( float red, float green, float blue );
00033         void set_line_width( float lwid );
00034         void set_line_style( int s );
00035         
00036         void set_col_index(int index);
00037         void set_cap_style(int style);
00038         void setJoinStyle(int style);
00039         void setBkColIndex(int index);
00040         void set_marker_size(float size);
00041         void set_enhanced(int);
00042         // set the selected attribute on or off
00043         
00044         // draw commands
00045         
00046         void set_quad(int quadrant, int highlighted);
00047         
00048         void drawPL(const GraphicsVector*,int);
00049         // draw a polyline 
00050         
00051         void drawText(const char *text, const GraphicsVector& pnt, int ht=0);
00052         void drawText(const char* text);
00053         // draw (horizontal) text at the given, or current point
00054         
00055         void draw_markers(const GraphicsVector*,int);
00056         // draw markers (points) at the specified points
00057         
00058         void beginSeparator();
00059         void endSeparator();
00060         // useful for VRML color, texture, etc.
00061         
00062         void coordinate3(const GraphicsVector *points, int n);
00063         // set the points to display
00064         
00065         void indexedLineSet(const int* a, int n);
00066         void indexedFaceSet(const int* a, int n);
00067         // create polylines or set of faces from coordinate3 list
00068         
00069         void flush();
00070         // flush accumulated drawing commands
00071         
00072         
00073     private:
00074         
00075         void lineSet(int n);
00076         // create a single polyline from all the coordinates
00077         
00078         std::ostream& _out;
00079         int _ncoord; 
00080         // number of valid coords
00081         
00082     };
00083     
00084 } //namespace gui
00085 
00086 #endif 
00087 

Generated at Mon Nov 26 18:18:11 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000