geomerative index
Name RGroup
Examples
None available
Description RGroup is a holder for a group of geometric element that can be drawn and transformed, such as Shapes, Polygons or Meshes.
Constructors
RGroup();
RGroup(grp);
RGeomElem();
Fields
elements   Array of RGeomElem objects holding the elements of the group. When accessing theses elements we must cast them to their class in order to get all the functionalities of each representation. e.g. RShape s = group.elements[i].toShape() If the element cannot be converted to the target class it will throw a RuntimeException, to ignore these, use try-catch syntax.

Methods
addElement ( )   Use this method to add a new element.

addGroup ( )   Use this method to add a new element.

countElements ( )   Use this method to count the number of elements in the group.

draw ( )   Use this method to draw the group. This will draw each element at a time, without worrying about intersections or holes. This is the main difference between having a shape with multiple subshapes and having a group with multiple shapes.

getArea ( )   Use this method to get the area of an element.

getBounds ( )   Use this method to get the bounding box of the element.

getCenter ( )   Use this method to get the center point of the element.

getCenteringTransf ( )   Use this method to get the transformation matrix in order to fit and center the element on the canvas. Scaling and translation damping parameters are available, in order to create animations.

getCentroid ( )   Use this method to get the centroid of the element.

getPoints ( )   Use this to return the points of the group. It returns the points in the way of an array of RPoint.

getType ( )   Use this method to get the type of element this is.

removeElement ( )   Use this method to remove an element.

setAdaptor ( )   Use this to set the adaptor type. RGroup.BYPOINT adaptor adapts the group to a particular shape by adapting each of the groups points. This can cause deformations of the individual elements in the group. RGroup.BYELEMENT adaptor adapts the group to a particular shape by adapting each of the groups elements. This mantains the proportions of the shapes.

setAdaptorLengthOffset ( )   Use this to set the adaptor length offset. This specifies where to start adapting the group to the shape.

setAdaptorScale ( )   Use this to set the adaptor scaling. This scales the transformation of the adaptor.

toMeshGroup ( )   Use this method to get a new group whose elements are the corresponding Meshes of the elemnts in the current group. This can be used for increasing performance in exchange of losing abstraction.

toPolygonGroup ( )   Use this method to get a new group whose elements are the corresponding Polygons of the elemnts in the current group. At this moment there is no implementation for transforming aMesh to a Polygon so applying this method to groups holding Mesh elements will generate an exception.

toShapeGroup ( )   Use this method to get a new group whose elements are all the corresponding Shapes of the elemnts in the current group. At this moment there is no implementation for transforming a Mesh or a Polygon to a Shape so applying this method to groups holding Mesh or Polygon elements will generate an exception.

transform ( )   Use this method to transform the group.

Usage geometry
Related