DGtal  0.9.3beta
Public Member Functions | Protected Attributes | Static Private Attributes
LibBoard::Ellipse Struct Reference

#include <Board/Shapes.h>

Inheritance diagram for LibBoard::Ellipse:
[legend]
Collaboration diagram for LibBoard::Ellipse:
[legend]

Public Member Functions

 Ellipse (double x, double y, double xRadius, double yRadius, DGtal::Color pen, DGtal::Color fill, double lineWidth, const LineStyle lineStyle=SolidStyle, int depthValue=-1)
 
const std::string & name () const
 
Point center () const
 
Ellipserotate (double angle, const Point &center)
 
Ellipse rotated (double angle, const Point &center) const
 
Ellipserotate (double angle)
 
Ellipse rotated (double angle) const
 
Ellipsetranslate (double dx, double dy)
 
Ellipse translated (double dx, double dy) const
 
Shapescale (double sx, double sy)
 
Shapescale (double s)
 
Ellipse scaled (double sx, double sy) const
 
Ellipse scaled (double s) const
 
void scaleAll (double s)
 
void flushPostscript (std::ostream &stream, const TransformEPS &transform) const
 
void flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const
 
void flushSVG (std::ostream &stream, const TransformSVG &transform) const
 
void flushCairo (cairo_t *cr, const TransformCairo &transform) const
 
void flushTikZ (std::ostream &stream, const TransformTikZ &transform) const
 
Rect boundingBox () const
 
Ellipseclone () const
 
- Public Member Functions inherited from LibBoard::Shape
 Shape (DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, LineStyle style, const LineCap cap, const LineJoin join, int depth)
 
virtual ~Shape ()
 
bool filled () const
 
ShaperotateDeg (double angle, const Point &center)
 
ShaperotateDeg (double angle)
 
Rect bbox ()
 
Shapeoperator-- ()
 
Shapeoperator++ ()
 
int depth () const
 
virtual void depth (int)
 
virtual void shiftDepth (int shift)
 
const DGtal::ColorpenColor () const
 
const DGtal::ColorfillColor () const
 

Protected Attributes

Point _center
 
double _xRadius
 
double _yRadius
 
double _angle
 
bool _circle
 
- Protected Attributes inherited from LibBoard::Shape
int _depth
 
DGtal::Color _penColor
 
DGtal::Color _fillColor
 
double _lineWidth
 
LineStyle _lineStyle
 
LineCap _lineCap
 
LineJoin _lineJoin
 

Static Private Attributes

static const std::string _name
 

Additional Inherited Members

- Public Types inherited from LibBoard::Shape
enum  LineCap { ButtCap = 0, RoundCap, SquareCap }
 
enum  LineJoin { MiterJoin = 0, RoundJoin, BevelJoin }
 
enum  LineStyle {
  SolidStyle = 0, DashStyle, DotStyle, DashDotStyle,
  DashDotDotStyle, DashDotDotDotStyle
}
 
- Protected Member Functions inherited from LibBoard::Shape
std::string svgProperties (const TransformSVG &transform) const
 
std::string postscriptProperties () const
 
void setCairoDashStyle (cairo_t *cr, LineStyle type) const
 
std::string tikzProperties (const TransformTikZ &transform) const
 

Detailed Description

An ellipse.

The ellipse structure.

Definition at line 1338 of file Board/Shapes.h.

Constructor & Destructor Documentation

LibBoard::Ellipse::Ellipse ( double  x,
double  y,
double  xRadius,
double  yRadius,
DGtal::Color  pen,
DGtal::Color  fill,
double  lineWidth,
const LineStyle  lineStyle = SolidStyle,
int  depthValue = -1 
)
inline

Definition at line 1340 of file Board/Shapes.h.

References _angle.

Referenced by clone(), rotated(), scaled(), and translated().

1346  : Shape( pen, fill,
1347  lineWidth, lineStyle, ButtCap, MiterJoin, depthValue ),
1348  _center( x, y ), _xRadius( xRadius ), _yRadius( yRadius ),
1349  _angle( 0.0 ),
1350  _circle( false ) {
1351  while ( _angle > M_PI_2 ) _angle -= M_PI;
1352  while ( _angle < -M_PI_2 ) _angle += M_PI;
1353  }
Shape(DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, LineStyle style, const LineCap cap, const LineJoin join, int depth)

Member Function Documentation

Rect LibBoard::Ellipse::boundingBox ( ) const
virtual

Returns the bounding box of the figure.

Returns
The rectangle of the bounding box.

Implements LibBoard::Shape.

Definition at line 1292 of file Shapes.cpp.

References _angle, _center, _xRadius, _yRadius, LibBoard::Point::x, and LibBoard::Point::y.

1293 {
1294  if ( _angle == 0.0 )
1295  return Rect( _center.x - _xRadius, _center.y + _yRadius,
1296  2 * _xRadius, 2 * _yRadius );
1297 
1298  double angleXmax = -atan( (_yRadius/_xRadius)*(tan(_angle) ) );
1299  double angleXmin = -atan( (_yRadius/_xRadius)*(tan(_angle) ) ) + M_PI;
1300  double angleYmax = atan( (_yRadius/_xRadius)*(1/tan(_angle) ) );
1301  double angleYmin = M_PI + atan( (_yRadius/_xRadius)*(1/tan(_angle) ) );
1302 
1303  if ( _angle < 0.0 ) {
1304  angleYmax += M_PI;
1305  angleYmin -= M_PI;
1306  }
1307 
1308  return Rect( _center.x + _xRadius*cos(angleXmin)*cos(_angle) - _yRadius*sin(angleXmin)*sin(_angle),
1309  _center.y + _xRadius*cos(angleYmax)*sin(_angle) + _yRadius*sin(angleYmax)*cos(_angle),
1310  ( _xRadius*cos(angleXmax)*cos(_angle) - _yRadius*sin(angleXmax)*sin(_angle) ) -
1311  ( _xRadius*cos(angleXmin)*cos(_angle) - _yRadius*sin(angleXmin)*sin(_angle) ),
1312  ( _xRadius*cos(angleYmax)*sin(_angle) + _yRadius*sin(angleYmax)*cos(_angle) ) -
1313  ( _xRadius*cos(angleYmin)*sin(_angle) + _yRadius*sin(angleYmin)*cos(_angle) ) );
1314 }
double x
Definition: Point.h:29
double y
Definition: Point.h:30
Point LibBoard::Ellipse::center ( ) const
virtual

Returns the gravity center of the shape.

Returns
The center of the shape.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle.

Definition at line 1027 of file Shapes.cpp.

References _center.

Referenced by rotate(), and rotated().

1027  {
1028  return _center;
1029 }
Ellipse * LibBoard::Ellipse::clone ( ) const
virtual

Return a copy of the shape.

Returns
copye of the shape.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle.

Definition at line 1152 of file Shapes.cpp.

References Ellipse().

1152  {
1153  return new Ellipse(*this);
1154 }
Ellipse(double x, double y, double xRadius, double yRadius, DGtal::Color pen, DGtal::Color fill, double lineWidth, const LineStyle lineStyle=SolidStyle, int depthValue=-1)
void LibBoard::Ellipse::flushCairo ( cairo_t *  cr,
const TransformCairo transform 
) const
virtual

Writes the cairo code of the shape in a cairo drawing context according to a transform.

Parameters
crThe cairo drawing context.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Arc, and LibBoard::Circle.

Definition at line 1233 of file Shapes.cpp.

References _angle, _center, LibBoard::Shape::_fillColor, LibBoard::Shape::_lineCap, LibBoard::Shape::_lineJoin, LibBoard::Shape::_lineStyle, LibBoard::Shape::_lineWidth, LibBoard::Shape::_penColor, _xRadius, _yRadius, DGtal::Color::blue(), LibBoard::Shape::filled(), DGtal::Color::green(), LibBoard::Transform::mapX(), LibBoard::TransformCairo::mapY(), DGtal::Color::None, DGtal::Color::red(), LibBoard::Transform::scale(), LibBoard::Shape::setCairoDashStyle(), LibBoard::Point::x, and LibBoard::Point::y.

Referenced by LibBoard::Circle::flushCairo().

1235 {
1236  cairo_save (cr);
1237 
1238  cairo_set_source_rgba (cr, _fillColor.red()/255.0, _fillColor.green()/255.0, _fillColor.blue()/255.0, 1.);
1239 
1240  // tr
1241  cairo_translate (cr, transform.mapX( _center.x ), transform.mapY( _center.y ));
1242  if ( _angle != 0.0 )
1243  cairo_rotate (cr, _angle);
1244  cairo_scale (cr, transform.scale( _xRadius ), transform.scale( _yRadius ));
1245  // tr
1246 
1247  cairo_arc (cr, 0, 0, 1, 0, 2*M_PI);
1248 
1249  if ( filled() )
1250  {
1251  if ( _penColor != DGtal::Color::None )
1252  cairo_fill_preserve (cr);
1253  else
1254  cairo_fill (cr);
1255  }
1256 
1257  //
1258 
1259  if ( _penColor != DGtal::Color::None )
1260  {
1261  cairo_set_source_rgba (cr, _penColor.red()/255.0, _penColor.green()/255.0, _penColor.blue()/255.0, 1.);
1262 
1263  cairo_set_line_width (cr, _lineWidth);
1264  cairo_set_line_cap (cr, cairoLineCap[_lineCap]);
1265  cairo_set_line_join (cr, cairoLineJoin[_lineJoin]);
1267 
1268  cairo_stroke (cr);
1269  }
1270 
1271  cairo_restore (cr);
1272 }
static const Color None
Definition: Color.h:387
double x
Definition: Point.h:29
LineJoin _lineJoin
Definition: Board/Shapes.h:301
bool filled() const
Definition: Board/Shapes.h:111
void green(const unsigned char aGreenValue)
double y
Definition: Point.h:30
DGtal::Color _penColor
Definition: Board/Shapes.h:296
void red(const unsigned char aRedValue)
void setCairoDashStyle(cairo_t *cr, LineStyle type) const
Definition: Shapes.cpp:154
LineStyle _lineStyle
Definition: Board/Shapes.h:299
DGtal::Color _fillColor
Definition: Board/Shapes.h:297
void blue(const unsigned char aBlueValue)
void LibBoard::Ellipse::flushFIG ( std::ostream &  stream,
const TransformFIG transform,
std::map< DGtal::Color, int > &  colormap 
) const
virtual

Writes the FIG code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.
colormapA colormap.

Implements LibBoard::Shape.

Definition at line 1186 of file Shapes.cpp.

References _angle, _center, _circle, LibBoard::Shape::_depth, LibBoard::Shape::_fillColor, LibBoard::Shape::_lineStyle, LibBoard::Shape::_lineWidth, LibBoard::Shape::_penColor, _xRadius, _yRadius, LibBoard::Shape::filled(), LibBoard::TransformFIG::mapDepth(), LibBoard::TransformFIG::mapWidth(), LibBoard::Transform::mapX(), LibBoard::TransformFIG::mapY(), LibBoard::Transform::scale(), DGtal::Color::valid(), LibBoard::Point::x, and LibBoard::Point::y.

1189 {
1190  // Ellipse, Sub type, Line style, Thickness
1191  if ( _circle )
1192  stream << "1 3 " << _lineStyle << " ";
1193  else
1194  stream << "1 1 " << _lineStyle << " ";
1195  stream << ( _penColor.valid()?transform.mapWidth( _lineWidth ):0 ) << " ";
1196  // Pen color, Fill color
1197  stream << colormap[ _penColor ] << " " << colormap[ _fillColor ] << " ";
1198  // Depth, Pen style, Area fill, Style val, Direction, angle
1199  if ( filled() )
1200  stream << transform.mapDepth( _depth ) << " -1 20 " << (_lineStyle?"4.000 ":"0.000 ") << " 1 " << _angle << " ";
1201  else
1202  stream << transform.mapDepth( _depth ) << " -1 -1 " << (_lineStyle?"4.000 ":"0.000 ") << " 1 " << _angle << " ";
1203  stream << static_cast<int>( transform.mapX( _center.x ) ) << " "
1204  << static_cast<int>( transform.mapY( _center.y ) ) << " "
1205  << static_cast<int>( transform.scale( _xRadius ) ) << " "
1206  << static_cast<int>( transform.scale( _yRadius ) ) << " "
1207  << static_cast<int>( transform.mapX( _center.x ) ) << " "
1208  << static_cast<int>( transform.mapY( _center.y ) ) << " "
1209  << static_cast<int>( transform.mapX( _center.x ) + transform.scale( _xRadius ) ) << " "
1210  << static_cast<int>( transform.mapY( _center.y ) ) << "\n";
1211 }
bool valid() const
double x
Definition: Point.h:29
bool filled() const
Definition: Board/Shapes.h:111
double y
Definition: Point.h:30
DGtal::Color _penColor
Definition: Board/Shapes.h:296
LineStyle _lineStyle
Definition: Board/Shapes.h:299
DGtal::Color _fillColor
Definition: Board/Shapes.h:297
void LibBoard::Ellipse::flushPostscript ( std::ostream &  stream,
const TransformEPS transform 
) const
virtual

Writes the EPS code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Arc.

Definition at line 1157 of file Shapes.cpp.

References _angle, _center, _circle, LibBoard::Shape::_fillColor, LibBoard::Shape::_penColor, _xRadius, _yRadius, LibBoard::Shape::filled(), LibBoard::Transform::mapX(), LibBoard::TransformEPS::mapY(), DGtal::Color::None, DGtal::Color::postscript(), LibBoard::Shape::postscriptProperties(), LibBoard::Transform::scale(), LibBoard::Point::x, and LibBoard::Point::y.

1159 {
1160  double yScale = _yRadius / _xRadius;
1161  stream << "\n% Ellipse\n";
1162  if ( filled() ) {
1163  stream << "gs "
1164  << transform.mapX( _center.x ) << " " << transform.mapY( _center.y ) << " tr";
1165  if ( _angle != 0.0 ) stream << " " << (_angle*180/M_PI) << " rot ";
1166  if ( ! _circle ) stream << " " << 1.0 << " " << yScale << " sc";
1167  stream << " n " << transform.scale( _xRadius ) << " 0 m "
1168  << " 0 0 " << transform.scale( _xRadius ) << " 0.0 360.0 arc ";
1169  stream << " " << _fillColor.postscript() << " srgb";
1170  stream << " fill gr" << std::endl;
1171  }
1172 
1173  if ( _penColor != DGtal::Color::None ) {
1174  stream << postscriptProperties() << "\n";
1175  stream << "gs " << transform.mapX( _center.x ) << " " << transform.mapY( _center.y ) << " tr";
1176  if ( _angle != 0.0 ) stream << " " << (_angle*180/M_PI) << " rot ";
1177  if ( ! _circle ) stream << " " << 1.0 << " " << yScale << " sc";
1178  stream << " n " << transform.scale( _xRadius ) << " 0 m "
1179  << " 0 0 " << transform.scale( _xRadius ) << " 0.0 360.0 arc ";
1180  stream << " " << _penColor.postscript() << " srgb";
1181  stream << " stroke gr" << std::endl;
1182  }
1183 }
std::string postscriptProperties() const
Definition: Shapes.cpp:141
static const Color None
Definition: Color.h:387
double x
Definition: Point.h:29
std::string postscript() const
Definition: Color.cpp:132
bool filled() const
Definition: Board/Shapes.h:111
double y
Definition: Point.h:30
DGtal::Color _penColor
Definition: Board/Shapes.h:296
DGtal::Color _fillColor
Definition: Board/Shapes.h:297
void LibBoard::Ellipse::flushSVG ( std::ostream &  stream,
const TransformSVG transform 
) const
virtual

Writes the SVG code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Arc, and LibBoard::Circle.

Definition at line 1214 of file Shapes.cpp.

References _angle, _center, _xRadius, _yRadius, LibBoard::Transform::mapX(), LibBoard::TransformSVG::mapY(), LibBoard::Transform::scale(), LibBoard::Shape::svgProperties(), LibBoard::Point::x, and LibBoard::Point::y.

Referenced by LibBoard::Circle::flushSVG().

1216 {
1217  stream << "<ellipse cx=\"" << transform.mapX( _center.x ) << '"'
1218  << " cy=\"" << transform.mapY( _center.y ) << '"'
1219  << " rx=\"" << transform.scale( _xRadius ) << '"'
1220  << " ry=\"" << transform.scale( _yRadius ) << '"'
1221  << svgProperties( transform ) ;
1222  if ( _angle != 0.0 ) {
1223  stream << " transform=\"rotate( "
1224  << -(_angle*180/M_PI) << ", "
1225  << transform.mapX( _center.x ) << ", "
1226  << transform.mapY( _center.y ) << " )\" ";
1227  }
1228  stream << " />" << std::endl;
1229 }
double x
Definition: Point.h:29
std::string svgProperties(const TransformSVG &transform) const
Definition: Shapes.cpp:110
double y
Definition: Point.h:30
void LibBoard::Ellipse::flushTikZ ( std::ostream &  stream,
const TransformTikZ transform 
) const
virtual

Writes the TikZ code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Arc, and LibBoard::Circle.

Definition at line 1276 of file Shapes.cpp.

References _angle, _center, _xRadius, _yRadius, LibBoard::Transform::mapX(), LibBoard::TransformSVG::mapY(), LibBoard::Transform::scale(), LibBoard::Shape::tikzProperties(), LibBoard::Point::x, and LibBoard::Point::y.

Referenced by LibBoard::Circle::flushTikZ().

1278 {
1279  // FIXME: unimplemented
1280  stream << "% FIXME: Ellipse::flushTikZ unimplemented" << std::endl;
1281  stream << "\\path[" << tikzProperties(transform) << "] ("
1282  << transform.mapX( _center.x ) << ','
1283  << transform.mapY( _center.y ) << ')'
1284  << " circle [x radius=" << transform.scale( _xRadius ) << ','
1285  << "y radius=" << transform.scale( _yRadius ) << ','
1286  << "rotate=" << -(_angle*180/M_PI)
1287  << "];"
1288  << std::endl;
1289 }
std::string tikzProperties(const TransformTikZ &transform) const
Definition: Shapes.cpp:178
double x
Definition: Point.h:29
double y
Definition: Point.h:30
const std::string & LibBoard::Ellipse::name ( ) const
virtual

Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)

Returns
object name

Reimplemented from LibBoard::Shape.

Reimplemented in LibBoard::Arc, and LibBoard::Circle.

Definition at line 1021 of file Shapes.cpp.

References _name.

1022 {
1023  return _name;
1024 }
static const std::string _name
Ellipse & LibBoard::Ellipse::rotate ( double  angle,
const Point center 
)
virtual

Rotate the shape around a given center of rotation.

Parameters
angleThe rotation angle in radian.
centerThe center of rotation.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle.

Definition at line 1032 of file Shapes.cpp.

References _angle, _center, _xRadius, LibBoard::Point::rotated(), LibBoard::Point::x, and LibBoard::Point::y.

Referenced by rotate(), and LibBoard::Circle::rotate().

1033 {
1034  Point c( _center );
1035  Point e = (c + Point( _xRadius, 0 )).rotate( _angle, c );
1036  Point rc = c.rotated( angle, rotCenter );
1037  Point re = e.rotated( angle, rotCenter );
1038  Point axis = re - rc;
1039  _angle = atan( axis.y / axis.x );
1040  _center = rc;
1041  return *this;
1042 }
Ellipse & rotate(double angle, const Point &center)
Definition: Shapes.cpp:1032
Ellipse rotated(double angle, const Point &center) const
Definition: Shapes.cpp:1045
Ellipse & LibBoard::Ellipse::rotate ( double  angle)
virtual

Rotate the shape around its center.

Parameters
angleThe rotation angle in radian.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle.

Definition at line 1051 of file Shapes.cpp.

References center(), and rotate().

1052 {
1053  return Ellipse::rotate( angle, center() );
1054 }
Ellipse & rotate(double angle, const Point &center)
Definition: Shapes.cpp:1032
Point center() const
Definition: Shapes.cpp:1027
Ellipse LibBoard::Ellipse::rotated ( double  angle,
const Point center 
) const
Parameters
angleangle
centercenter
Returns
an ellipse

Definition at line 1045 of file Shapes.cpp.

References Ellipse().

1046 {
1047  return Ellipse(*this).rotate( angle, rotCenter );
1048 }
Ellipse(double x, double y, double xRadius, double yRadius, DGtal::Color pen, DGtal::Color fill, double lineWidth, const LineStyle lineStyle=SolidStyle, int depthValue=-1)
Ellipse LibBoard::Ellipse::rotated ( double  angle) const
Parameters
angleangle
Returns
an ellipse

Definition at line 1057 of file Shapes.cpp.

References center(), and Ellipse().

1058 {
1059  return Ellipse(*this).rotate( angle, center() );
1060 }
Ellipse(double x, double y, double xRadius, double yRadius, DGtal::Color pen, DGtal::Color fill, double lineWidth, const LineStyle lineStyle=SolidStyle, int depthValue=-1)
Point center() const
Definition: Shapes.cpp:1027
Shape & LibBoard::Ellipse::scale ( double  sx,
double  sy 
)
virtual

Scale the shape along the x an y axis.

Parameters
sxThe scale factor along the x axis.
syThe scale factor along the y axis.
Returns
The shape itself.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle.

Definition at line 1076 of file Shapes.cpp.

References _angle, _xRadius, and _yRadius.

Referenced by scale(), and LibBoard::Circle::scale().

1077 {
1078  // Thanks to Freddie Exall for pointing an error with the first version
1079  // of this function, and for pointing to a fix as well!
1080  if ( _angle != 0 ) {
1081  double co = cos( _angle );
1082  double si = sin( _angle );
1083 
1084  // current transformation matrix
1085  double m00 = ( 1 / _xRadius ) * co;
1086  double m01 = ( 1 / _xRadius ) * si;
1087  double m10 = - ( 1 / _yRadius ) * si;
1088  double m11 = ( 1 / _yRadius ) * co;
1089 
1090  // Implicit function of ellipse at current
1091  // ax^2 + bxy + cy^2 = 1
1092  double a = ( m00 * m00 ) + ( m10 * m10 );
1093  double b = 2 * ( ( m00 * m01 ) + ( m10 * m11 ) );
1094  double c = ( m01 * m01 ) + ( m11 * m11 );
1095 
1096  // Scale coefficients ( x_new = sx * x, y_new = sy * y )
1097  a = a / ( sx * sx );
1098  b = b / ( sx * sy );
1099  c = c / ( sy * sy );
1100 
1101  if ( b == 0 ) {
1102  _angle = 0;
1103  } else if ( a == c ) {
1104  _angle = M_PI / 4;
1105  a += ( b / 2 );
1106  c -= ( b / 2 );
1107  } else {
1108  _angle = 0.5 * atan( b / ( a - c ) );
1109  double k = 1 + ( ( b * b ) / ( ( a - c ) * ( a - c ) ) );
1110  k = sqrt( k );
1111  k *= ( a - c );
1112  c += a;
1113  a = 0.5 * ( c + k );
1114  c = 0.5 * ( c - k );
1115  }
1116  _xRadius = 1 / sqrt( a );
1117  _yRadius = 1 / sqrt( c );
1118  } else {
1119  _xRadius = _xRadius * sx;
1120  _yRadius = _yRadius * sy;
1121  }
1122  return *this;
1123 }
Shape & LibBoard::Ellipse::scale ( double  s)
virtual

Scale the shape along both axis.

Parameters
sThe scale factor along both axis.
Returns
The shape itself.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle.

Definition at line 1126 of file Shapes.cpp.

References scale().

1127 {
1128  return Ellipse::scale( s, s );
1129 }
Shape & scale(double sx, double sy)
Definition: Shapes.cpp:1076
void LibBoard::Ellipse::scaleAll ( double  s)
virtual

Scales all the values (positions, dimensions, etc.) associated with the shape.

Parameters
sThe scaling factor.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle.

Definition at line 1144 of file Shapes.cpp.

References _center, _xRadius, and _yRadius.

1145 {
1146  _xRadius *= s;
1147  _yRadius *= s;
1148  _center *= s;
1149 }
Ellipse LibBoard::Ellipse::scaled ( double  sx,
double  sy 
) const
Parameters
sxscale factor
syscale factor
Returns
scaled ellipse

Definition at line 1132 of file Shapes.cpp.

References Ellipse().

1133 {
1134  return static_cast<Ellipse &>( Ellipse(*this).scale( sx, sy ) );
1135 }
Ellipse(double x, double y, double xRadius, double yRadius, DGtal::Color pen, DGtal::Color fill, double lineWidth, const LineStyle lineStyle=SolidStyle, int depthValue=-1)
Ellipse LibBoard::Ellipse::scaled ( double  s) const

Definition at line 1138 of file Shapes.cpp.

References Ellipse().

1139 {
1140  return static_cast<Ellipse &>( Ellipse(*this).scale( s, s ) );
1141 }
Ellipse(double x, double y, double xRadius, double yRadius, DGtal::Color pen, DGtal::Color fill, double lineWidth, const LineStyle lineStyle=SolidStyle, int depthValue=-1)
Ellipse & LibBoard::Ellipse::translate ( double  dx,
double  dy 
)
virtual

Translate the shape by a given offset.

Parameters
dxThe x offset.
dyThe y offset.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Circle.

Definition at line 1063 of file Shapes.cpp.

References _center.

1064 {
1065  _center += Point( dx, dy );
1066  return *this;
1067 }
Ellipse LibBoard::Ellipse::translated ( double  dx,
double  dy 
) const
Parameters
dxtranslation along x-axis
dytranslation along the y-axis
Returns
translated ellipse.

Definition at line 1070 of file Shapes.cpp.

References Ellipse().

1071 {
1072  return Ellipse(*this).translate( dx, dy );
1073 }
Ellipse(double x, double y, double xRadius, double yRadius, DGtal::Color pen, DGtal::Color fill, double lineWidth, const LineStyle lineStyle=SolidStyle, int depthValue=-1)

Field Documentation

double LibBoard::Ellipse::_angle
protected
Point LibBoard::Ellipse::_center
protected
bool LibBoard::Ellipse::_circle
protected
const std::string LibBoard::Ellipse::_name
staticprivate

The generic name of the shape.

Definition at line 1446 of file Board/Shapes.h.

Referenced by name().

double LibBoard::Ellipse::_xRadius
protected
double LibBoard::Ellipse::_yRadius
protected

The documentation for this struct was generated from the following files: