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
1407 {}

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;
}
12227 {
12228  f << "type="<< getString( p.type() ) << std::endl;
12229  switch( p.type() )
12230  {
12231  case Type::Circle:
12232  {
12233  const Circle_<double>* p2 = static_cast<const Circle_<double>*>( &p );
12234  f << *p2;
12235  }
12236  break;
12237  case Type::Ellipse:
12238  {
12239  const Ellipse_<double>* p2 = static_cast<const Ellipse_<double>*>( &p );
12240  f << *p2;
12241  }
12242  break;
12243  case Type::FRect:
12244  {
12245  const FRect_<double>* p2 = static_cast<const FRect_<double>*>( &p );
12246  f << *p2;
12247  }
12248  break;
12249  case Type::Line2d:
12250  {
12251  const Line2d_<double>* p2 = static_cast<const Line2d_<double>*>( &p );
12252  f << *p2;
12253  }
12254  break;
12255  case Type::Point2d:
12256  {
12257  const Point2d_<double>* p2 = static_cast<const Point2d_<double>*>( &p );
12258  f << *p2;
12259  }
12260  break;
12261  case Type::Segment:
12262  {
12263  const Segment_<double>* p2 = static_cast<const Segment_<double>*>( &p );
12264  f << *p2;
12265  }
12266  break;
12267  case Type::OSegment:
12268  {
12269  const OSegment_<double>* p2 = static_cast<const OSegment_<double>*>( &p );
12270  f << *p2;
12271  }
12272  break;
12273  case Type::OPolyline:
12274  {
12275  const OPolyline_<double>* p2 = static_cast<const OPolyline_<double>*>( &p );
12276  f << *p2;
12277  }
12278  break;
12279  case Type::CPolyline:
12280  {
12281  const CPolyline_<double>* p2 = static_cast<const CPolyline_<double>*>( &p );
12282  f << *p2;
12283  }
12284  break;
12285  default: assert(0);
12286  }
12287  return f;
12288 }
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: