radius attribute for dials [message #648540] |
Thu, 13 January 2011 07:58  |
Eclipse User |
|
|
|
Originally posted by: anders.hessellund.gmail.com
Hi,
I've spent a lot of time trying to perfect a BIRT dial for a RCP
application, i.e., using the Java API. One thing that puzzles me is what
the unit of some of the API methods are. Specifically, what is the unit
for the dial radius? Is it points? Or is it some sort of percentage of
the size of the dial?
The API docs are here:
/**
* Returns the value of the '<em><b>Radius</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* Specifies the radius of the dial.
* <!-- end-model-doc -->
* @return the value of the '<em>Radius</em>' attribute.
* @see #isSetRadius()
* @see #unsetRadius()
* @see #setRadius(double)
* @see
org.eclipse.birt.chart.model.component.ComponentPackage#getD ial_Radius()
* @model unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.Double"
* extendedMetaData="kind='element' name='Radius'"
* @generated
*/
double getRadius( );
Cheers,
Anders
|
|
|
Re: radius attribute for dials [message #648637 is a reply to message #648540] |
Thu, 13 January 2011 12:58  |
Eclipse User |
|
|
|
Anders,
It is in bounds points but its used in a complex equation. From the
DialRenderer class
if ( dRadius > 0
&& ( dRadius + dExtraSpacing + dSafeSpacing * 2 ) < dFullRadius )
{
dFullRadius = dRadius + dExtraSpacing + dSafeSpacing * 2;
}
final ArcRenderEvent are = ( (EventObjectCache) idr ).getEventObject(
StructureSource.createUnknown( dialComponent ),
ArcRenderEvent.class );
// Dial full outline
Bounds fullBounds = goFactory.createBounds( boCA.getLeft( )
+ ( boCA.getWidth( ) - 2 * dFullRadius )
/ 2, ( boCA.getTop( ) + ( boCA.getHeight( ) - ( bFullDisc ? 2
: 1 )
* dFullRadius ) / 2 ), 2 * dFullRadius, 2 * dFullRadius );
if ( !bDialSuperimposed || bFirstSeries )
{
final Fill dialFill = dialComponent.getFill( );
double safeAngle = Math.toDegrees( Math.abs( Math.asin( dSafeSpacing
/ dFullRadius ) ) );
are.setBounds( fullBounds );
are.setStartAngle( bFullDisc ? 0 : -safeAngle );
are.setAngleExtent( bFullDisc ? 360 : ( 180 + 2 * safeAngle ) );
are.setOutline( dialComponent.getLineAttributes( ) );
are.setBackground( dialFill );
are.setStyle( ArcRenderEvent.CLOSED );
idr.fillArc( are );
idr.drawArc( are );
}
The dRadius value is the one set by you. This value is used to
calculate the full radius of the draw arc and fill arc drawing commands.
Jason
On 1/13/2011 7:58 AM, Anders Hessellund wrote:
> Hi,
>
> I've spent a lot of time trying to perfect a BIRT dial for a RCP
> application, i.e., using the Java API. One thing that puzzles me is what
> the unit of some of the API methods are. Specifically, what is the unit
> for the dial radius? Is it points? Or is it some sort of percentage of
> the size of the dial?
>
> The API docs are here:
>
> /**
> * Returns the value of the '<em><b>Radius</b></em>' attribute.
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * <!-- begin-model-doc -->
> * Specifies the radius of the dial.
> * <!-- end-model-doc -->
> * @return the value of the '<em>Radius</em>' attribute.
> * @see #isSetRadius()
> * @see #unsetRadius()
> * @see #setRadius(double)
> * @see
> org.eclipse.birt.chart.model.component.ComponentPackage#getD ial_Radius()
> * @model unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.Double"
> * extendedMetaData="kind='element' name='Radius'"
> * @generated
> */
> double getRadius( );
>
> Cheers,
>
> Anders
|
|
|
Powered by
FUDForum. Page generated in 0.04727 seconds