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