

Public Member Functions | |
| CenteredTextDrawerGL () | |
| void | setFilledBoxSize (double boxWidth, double boxHeight) |
| Vector3D[] | placeBoundingBox (Vector3D[] bbox, Vector3D textCenter, double rotationAngle) |
| TextGrid | placeTextGrid (TextGrid stringPositions, Vector3D textCenterPix, double rotationAngle) |
Private Attributes | |
| double | halfCenteredBoxWidth |
| double | halfCenteredBoxHeight |
Definition at line 25 of file CenteredTextDrawerGL.java.
| org::scilab::modules::renderer::textDrawing::CenteredTextDrawerGL::CenteredTextDrawerGL | ( | ) | [inline] |
Default constructor
Definition at line 33 of file CenteredTextDrawerGL.java.
References halfCenteredBoxHeight, and halfCenteredBoxWidth.
00033 { 00034 super(); 00035 halfCenteredBoxWidth = 0.0; 00036 halfCenteredBoxHeight = 0.0; 00037 }
| void org::scilab::modules::renderer::textDrawing::CenteredTextDrawerGL::setFilledBoxSize | ( | double | boxWidth, | |
| double | boxHeight | |||
| ) | [inline] |
Set the size of the box which the text will fill.
| boxWidth | width of the box. | |
| boxHeight | height of the box. |
Definition at line 44 of file CenteredTextDrawerGL.java.
References halfCenteredBoxHeight, and halfCenteredBoxWidth.
00044 { 00045 halfCenteredBoxWidth = (boxWidth / 2.0); 00046 halfCenteredBoxHeight = (boxHeight / 2.0); 00047 }
| Vector3D [] org::scilab::modules::renderer::textDrawing::CenteredTextDrawerGL::placeBoundingBox | ( | Vector3D[] | bbox, | |
| Vector3D | textCenter, | |||
| double | rotationAngle | |||
| ) | [inline, virtual] |
Move the bounding box to the right position.
| bbox | intial bounding box centered at the origin. | |
| textCenter | text center | |
| rotationAngle | rotation angle around the text center |
Implements org::scilab::modules::renderer::textDrawing::TextContentDrawerGL.
Definition at line 56 of file CenteredTextDrawerGL.java.
References org::scilab::modules::renderer::utils::geom3D::Vector3D::add(), org::scilab::modules::renderer::utils::geom3D::Vector3D::getX(), org::scilab::modules::renderer::utils::geom3D::Vector3D::getY(), halfCenteredBoxHeight, halfCenteredBoxWidth, i, and org::scilab::modules::renderer::utils::geom3D::Vector3D::rotate().
00056 { 00057 // text center refer here to the bottom left corner. 00058 // So we need to add half of the box size. 00059 double halfBoxWidth = (bbox[2].getX() - bbox[1].getX()) / 2.0; 00060 double halfBoxHeight = (bbox[0].getY() - bbox[1].getY()) / 2.0; 00061 00062 Vector3D rotationAxis = new Vector3D(0.0, 0.0, 1.0); 00063 for (int i = 0; i < bbox.length; i++) { 00064 00065 // translate to textCenter 00066 bbox[i] = bbox[i].add(textCenter); 00067 bbox[i] = bbox[i].add(new Vector3D(halfCenteredBoxWidth - halfBoxWidth, halfCenteredBoxHeight - halfBoxHeight, 0.0)); 00068 00069 // rotate around textCenter 00070 bbox[i] = bbox[i].rotate(textCenter, rotationAxis, rotationAngle); 00071 } 00072 return bbox; 00073 }

| TextGrid org::scilab::modules::renderer::textDrawing::CenteredTextDrawerGL::placeTextGrid | ( | TextGrid | stringPositions, | |
| Vector3D | textCenterPix, | |||
| double | rotationAngle | |||
| ) | [inline, virtual] |
Put the text grid at the right position
| stringPositions | Initial position of strings, centered on (0,0). | |
| textCenterPix | position of the center in pixel coordinates | |
| rotationAngle | angle in radian. |
Implements org::scilab::modules::renderer::textDrawing::TextContentDrawerGL.
Definition at line 82 of file CenteredTextDrawerGL.java.
References org::scilab::modules::renderer::textDrawing::TextGrid::getExtremBounds(), org::scilab::modules::renderer::ObjectGL::getGL(), org::scilab::modules::renderer::utils::geom3D::Vector3D::getX(), org::scilab::modules::renderer::utils::geom3D::Vector3D::getY(), org::scilab::modules::renderer::utils::geom3D::Vector3D::getZ(), halfCenteredBoxHeight, and halfCenteredBoxWidth.
00082 { 00083 // text center refer here to the bottom left corner. 00084 // So we need to add half of the box size. 00085 Vector3D[] bbox = stringPositions.getExtremBounds(); 00086 double halfBoxWidth = (bbox[2].getX() - bbox[1].getX()) / 2.0; 00087 double halfBoxHeight = (bbox[0].getY() - bbox[1].getY()) / 2.0; 00088 00089 GL gl = getGL(); 00090 gl.glTranslated(textCenterPix.getX(), textCenterPix.getY(), textCenterPix.getZ()); 00091 gl.glRotated(Math.toDegrees(rotationAngle), 0.0, 0.0, 1.0); 00092 gl.glTranslated(halfCenteredBoxWidth - halfBoxWidth, halfCenteredBoxHeight - halfBoxHeight, 0.0); 00093 return stringPositions; 00094 }

double org::scilab::modules::renderer::textDrawing::CenteredTextDrawerGL::halfCenteredBoxWidth [private] |
Definition at line 27 of file CenteredTextDrawerGL.java.
Referenced by CenteredTextDrawerGL(), placeBoundingBox(), placeTextGrid(), and setFilledBoxSize().
double org::scilab::modules::renderer::textDrawing::CenteredTextDrawerGL::halfCenteredBoxHeight [private] |
Definition at line 28 of file CenteredTextDrawerGL.java.
Referenced by CenteredTextDrawerGL(), placeBoundingBox(), placeTextGrid(), and setFilledBoxSize().
1.5.5