homog2d library
Public Member Functions | Friends | List of all members
h2d::rtp::Root Class Referenceabstract

Non-templated root class, to achieve dynamic (runtime) polymorphism. More...

#include <homog2d.hpp>

Inheritance diagram for h2d::rtp::Root:
Inheritance graph
[legend]

Public Member Functions

virtual HOMOG2D_INUMTYPE area () const =0
 
virtual void draw (img::Image< img::SvgImage > &, img::DrawParams dp=img::DrawParams()) const =0
 
virtual void draw (img::Image< cv::Mat > &, img::DrawParams dp=img::DrawParams()) const =0
 
virtual HOMOG2D_INUMTYPE length () const =0
 
virtual size_t size () const =0
 
virtual Type type () const =0
 
virtual ~Root ()
 

Friends

std::ostream & operator<< (std::ostream &f, const Root &p)
 Stream operator for Root type. More...
 

Detailed Description

Non-templated root class, to achieve dynamic (runtime) polymorphism.

Only exists if symbol HOMOG2D_ENABLE_PRTP is defined, see build options.

Constructor & Destructor Documentation

◆ ~Root()

virtual h2d::rtp::Root::~Root ( )
inlinevirtual
1441 {}

Member Function Documentation

◆ area()

virtual HOMOG2D_INUMTYPE h2d::rtp::Root::area ( ) const
pure virtual

◆ draw() [1/2]

virtual void h2d::rtp::Root::draw ( img::Image< img::SvgImage > &  ,
img::DrawParams  dp = img::DrawParams() 
) const
pure virtual

◆ draw() [2/2]

virtual void h2d::rtp::Root::draw ( img::Image< cv::Mat > &  ,
img::DrawParams  dp = img::DrawParams() 
) const
pure virtual

◆ length()

virtual HOMOG2D_INUMTYPE h2d::rtp::Root::length ( ) const
pure virtual

◆ size()

virtual size_t h2d::rtp::Root::size ( ) const
pure virtual

◆ type()

virtual Type h2d::rtp::Root::type ( ) const
pure virtual

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  f,
const Root p 
)
friend

Stream operator for Root type.

Todo:
replace this by a call to a virtual function print() (that needs to be defined in all the child classes as:
void print( std::ostream& f )
{
f << *this;
}
12231 {
12232  f << "type="<< getString( p.type() ) << std::endl;
12233  switch( p.type() )
12234  {
12235  case Type::Circle:
12236  {
12237  const Circle_<double>* p2 = static_cast<const Circle_<double>*>( &p );
12238  f << *p2;
12239  }
12240  break;
12241  case Type::Ellipse:
12242  {
12243  const Ellipse_<double>* p2 = static_cast<const Ellipse_<double>*>( &p );
12244  f << *p2;
12245  }
12246  break;
12247  case Type::FRect:
12248  {
12249  const FRect_<double>* p2 = static_cast<const FRect_<double>*>( &p );
12250  f << *p2;
12251  }
12252  break;
12253  case Type::Line2d:
12254  {
12255  const Line2d_<double>* p2 = static_cast<const Line2d_<double>*>( &p );
12256  f << *p2;
12257  }
12258  break;
12259  case Type::Point2d:
12260  {
12261  const Point2d_<double>* p2 = static_cast<const Point2d_<double>*>( &p );
12262  f << *p2;
12263  }
12264  break;
12265  case Type::Segment:
12266  {
12267  const Segment_<double>* p2 = static_cast<const Segment_<double>*>( &p );
12268  f << *p2;
12269  }
12270  break;
12271  case Type::OSegment:
12272  {
12273  const OSegment_<double>* p2 = static_cast<const OSegment_<double>*>( &p );
12274  f << *p2;
12275  }
12276  break;
12277  case Type::OPolyline:
12278  {
12279  const OPolyline_<double>* p2 = static_cast<const OPolyline_<double>*>( &p );
12280  f << *p2;
12281  }
12282  break;
12283  case Type::CPolyline:
12284  {
12285  const CPolyline_<double>* p2 = static_cast<const CPolyline_<double>*>( &p );
12286  f << *p2;
12287  }
12288  break;
12289  default: assert(0);
12290  }
12291  return f;
12292 }
const char * getString(Type t)
Returns stringified version of type()
Definition: homog2d.hpp:948

The documentation for this class was generated from the following file: