OK. Here is the incriminated part of the main :
void Main_MPP( void )
{
boost::shared_ptr<OGRRectangle> rect( new OGRRectangle(5.,TPoint2D <double>(50.,20.),0.1325) );
boost::shared_ptr< rectangle_with_profile<OGRRectangle> > r( new rectangle_with_profile<OGRRectangle> ( rect , 5 , 12 ,
1.5 , EXTREME) );
//OGRRectangle destructor is call here ...
r->DisplayConsole();
}
Here is the OGRRectangle class :
class OGRRectangle : public OGRPolygon
{
public:
OGRRectangle() {};
OGRRectangle( const double &width , const TPoint2D <double> ¢er , const double &angle=0. );
OGRRectangle( const TPoint2D <double> ¢er , const double &width , const double &height , const double &angle=0. );
OGRRectangle( const TPoint2D <double> &TopLeft , const TPoint2D <double> &BottomRight , const double &angle=0. );
~OGRRectangle() {SORTIEMESSAGE("Destruction OGRRectangle ..."<<std::endl);};
void Init( const TPoint2D <double> ¢er , const double &width , const double &height , const double &angle=0. );
inline void GetWidth( double &width ) {width=m_width;}
inline double GetWidth() {return m_width;}
inline void GetHeight( double &height ) {height=m_height;}
inline double GetHeight() {return m_height;}
void Translate( const TPoint2D <double> &trans );
void Translate( const double &x , const double &y );
void Rotate( const double &angle );
protected:
double m_width;
double m_height;
double m_angle;
};
// Implementation
void OGRRectangle::Init( const TPoint2D <double> ¢er , const double &width , const double &height , const double &angle )
{
m_width = width;
m_height = height;
m_angle = angle;
boost::shared_ptr<OGRPoint> pt( new OGRPoint );
boost::shared_ptr< OGRLinearRing > lr( new OGRLinearRing );
pt->setCoordinateDimension(2);
pt->setX( center.x-0.5*width
);
pt->setY( center.y-0.5*height );
pt->setZ( 0. );
lr->addPoint( pt.get() );
pt->setX( center.x+0.5*width );
pt->setY( center.y-0.5*height );
lr->addPoint( pt.get
() );
pt->setX( center.x+0.5*width );
pt->setY( center.y+0.5*height );
lr->addPoint( pt.get() );
pt->setX( center.x-0.5*width );
pt->setY( center.y+0.5*height );
lr->addPoint(
pt.get() );
this->addRing( lr.get() );
lr->setCoordinateDimension(2);
this->setCoordinateDimension(2);
this->closeRings();
if ( m_angle != 0. )
Rotate(m_angle);
}
OGRRectangle::OGRRectangle( const double &width , const TPoint2D <double> ¢er , const double &angle )
{
Init(center,width,width,angle);
setCoordinateDimension(2);
}
OGRRectangle::OGRRectangle( const TPoint2D <double> ¢er , const double &width , const double &height , const double &angle)
{
Init(center,width,height,angle);
setCoordinateDimension(2);
}
OGRRectangle::OGRRectangle( const TPoint2D <double> &TopLeft , const TPoint2D <double> &BottomRight , const double &angle)
{
double width = abs(BottomRight.x - TopLeft.x
);
double height = abs(BottomRight.y - TopLeft.y);
Init(0.5*(TopLeft+BottomRight),width,height,angle);
setCoordinateDimension(2);
}
Olivier Tournaire wrote:
> No one can help me ?
Can you post a complete program that shows the error? I see nothing wrong
with your code snippets.
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users