// OiBSurfZPlane.cpp #include "OiBSurfZPlane.h" #include #include "trfzp/BSurfZPlane.h" #include "Inventor/nodes/SoSeparator.h" #include "Inventor/nodes/SoTranslation.h" #include "oiext/SoPolygon.hpp" //********************************************************************** // Class initialization. void OiBSurfZPlane::init_class() const { SoPolygon::initClass(); } //********************************************************************** // Generate OI representation. SoNode* OiBSurfZPlane:: generate_representation(const Surface& srf, const OiSurfaceTraits traits) const { assert( srf.get_type() == BSurfZPlane::get_static_type() ); const BSurfZPlane& rsrf = dynamic_cast(srf); double zpos = rsrf.get_parameter(SurfZPlane::ZPOS); double x1 = rsrf.get_xmin(); double x2 = rsrf.get_xmax(); double y1 = rsrf.get_ymin(); double y2 = rsrf.get_ymax(); SoPolygon::PointList points; points.push_back( CartesianTwoPoint(x1,y1) ); points.push_back( CartesianTwoPoint(x2,y1) ); points.push_back( CartesianTwoPoint(x2,y2) ); points.push_back( CartesianTwoPoint(x1,y2) ); int ispace = traits.ispace; SoSeparator* psep = new SoSeparator; SoTranslation* ptrans = new SoTranslation; ptrans->translation.setValue(0.0,0.0,zpos); psep->addChild(ptrans); SoPolygon* psobj = new SoPolygon(points,ispace); psep->addChild(psobj); return psep; } //**********************************************************************