Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

KDChart::PolarCoordinatePlane Class Reference

#include <KDChartPolarCoordinatePlane.h>

Inheritance diagram for KDChart::PolarCoordinatePlane:

[legend]
Collaboration diagram for KDChart::PolarCoordinatePlane:
[legend]
List of all members.

Public Types

enum  AxesCalcMode {
  Linear,
  Logarithmic
}
typedef QList< CoordinateTransformation > CoordinateTransformationList

Public Member Functions

void addDiagram (AbstractDiagram *diagram)
 Adds a diagram to this coordinate plane.

void alignToReferencePoint (const RelativePosition &position)
qreal angleUnit () const
BackgroundAttributes backgroundAttributes () const
virtual int bottomOverlap (bool doNotRecalculate=false) const
 This is called at layout time by KDChart:AutoSpacerLayoutItem::sizeHint().

bool compare (const AbstractAreaBase *other) const
 Returns true if both areas have the same settings.

AbstractDiagramdiagram ()
ConstAbstractDiagramList diagrams () const
AbstractDiagramList diagrams ()
virtual Qt::Orientations expandingDirections () const
 pure virtual in QLayoutItem

FrameAttributes frameAttributes () const
virtual QRect geometry () const
 pure virtual in QLayoutItem

void getFrameLeadings (int &left, int &top, int &right, int &bottom) const
GridAttributes globalGridAttributes () const
const GridAttributes gridAttributes (bool circular) const
DataDimensionsList gridDimensionsList ()
 Returns the dimensions used for drawing the grid lines.

bool hasOwnGridAttributes (bool circular) const
virtual bool isEmpty () const
 pure virtual in QLayoutItem

const bool isVisiblePoint (const QPointF &point) const
 Tests, if a point is visible on the coordinate plane.

void layoutPlanes ()
 Calling layoutPlanes() on the plane triggers the global KDChart::Chart::slotLayoutPlanes().

virtual int leftOverlap (bool doNotRecalculate=false) const
 This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().

virtual QSize maximumSize () const
 pure virtual in QLayoutItem

virtual QSize minimumSize () const
 pure virtual in QLayoutItem

virtual QSize minimumSizeHint () const
 [reimplemented]

void mousePressEvent (QMouseEvent *event)
 reimp

void needLayoutPlanes ()
 Emitted when plane needs to trigger the Chart's layouting of the coord.

void needRelayout ()
 Emitted when plane needs to trigger the Chart's layouting.

void needUpdate ()
 Emitted when plane needs to update its drawings.

virtual void paint (QPainter *)
 reimpl

virtual void paintAll (QPainter &painter)
 Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked automatically.

virtual void paintBackground (QPainter &painter, const QRect &rectangle)
virtual void paintCtx (PaintContext *context)
 Default impl: Paint the complete item using its layouted position and size.

virtual void paintFrame (QPainter &painter, const QRect &rectangle)
virtual void paintIntoRect (QPainter &painter, const QRect &rect)
 Draws the background and frame, then calls paint().

const Chartparent () const
Chartparent ()
QLayout * parentLayout ()
 PolarCoordinatePlane (Chart *parent=0)
void propertiesChanged ()
 Emitted upon change of a property of the Coordinate Plane or any of its components.

qreal radiusUnit () const
AbstractCoordinatePlanereferenceCoordinatePlane () const
 There are two ways, in which planes can be caused to interact, in where they are put layouting wise: The first is the reference plane.

void relayout ()
 Calling relayout() on the plane triggers the global KDChart::Chart::slotRelayout().

void removeFromParentLayout ()
virtual void replaceDiagram (AbstractDiagram *diagram, AbstractDiagram *oldDiagram=0)
 Replaces the old diagram, or appends the diagram, it there is none yet.

void resetGridAttributes (bool circular)
 Reset the attributes to be used for grid lines drawn in circular direction (or in sagittal direction, resp.).

virtual int rightOverlap (bool doNotRecalculate=false) const
 This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().

void setBackgroundAttributes (const BackgroundAttributes &a)
void setFrameAttributes (const FrameAttributes &a)
virtual void setGeometry (const QRect &r)
 pure virtual in QLayoutItem

void setGlobalGridAttributes (const GridAttributes &)
 Set the grid attributes to be used by this coordinate plane.

void setGridAttributes (bool circular, const GridAttributes &)
 Set the attributes to be used for grid lines drawn in circular direction (or in sagittal direction, resp.).

void setGridNeedsRecalculate ()
 Used by the chart to clear the cached grid data.

void setParent (Chart *parent)
 Called internally by KDChart::Chart.

void setParentLayout (QLayout *lay)
virtual void setParentWidget (QWidget *widget)
 Inform the item about its widget: This enables the item, to trigger that widget's update, whenever the size of the item's contents has changed.

void setReferenceCoordinatePlane (AbstractCoordinatePlane *plane)
 Set another coordinate plane to be used as the reference plane for this one.

void setStartPosition (qreal degrees)
 Specify the rotation of the coordinate plane.

virtual void setZoomCenter (QPointF center)
 Set the point (in value coordinates) to be used as the center point in zoom operations.

virtual void setZoomFactorX (double factor)
 Sets the zoom factor in horizontal direction, that is applied to all coordinate transformations.

virtual void setZoomFactorY (double factor)
 Sets the zoom factor in vertical direction, that is applied to all coordinate transformations.

virtual QSize sizeHint () const
 pure virtual in QLayoutItem

virtual void sizeHintChanged () const
 Report changed size hint: ask the parent widget to recalculate the layout.

virtual QSizePolicy sizePolicy () const
 [reimplemented]

qreal startPosition () const
 Retrieve the rotation of the coordinate plane.

virtual void takeDiagram (AbstractDiagram *diagram)
 Removes the diagram from the plane, without deleting it.

virtual int topOverlap (bool doNotRecalculate=false) const
 This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().

const QPointF translate (const QPointF &diagramPoint) const
 Translate the given point in value space coordinates to a position in pixel space.

const QPointF translatePolar (const QPointF &diagramPoint) const
virtual QPointF zoomCenter () const
virtual double zoomFactorX () const
virtual double zoomFactorY () const
 ~PolarCoordinatePlane ()

Static Public Member Functions

void paintBackgroundAttributes (QPainter &painter, const QRect &rectangle, const KDChart::BackgroundAttributes &attributes)
void paintFrameAttributes (QPainter &painter, const QRect &rectangle, const KDChart::FrameAttributes &attributes)

Public Attributes

Q_SIGNALS __pad0__: void destroyedCoordinatePlane( AbstractCoordinatePlane* )

Protected Member Functions

virtual QRect areaGeometry () const
virtual DataDimensionsList getDataDimensionsList () const
QRect innerRect () const
void layoutDiagrams ()
 Distribute the available space among the diagrams and axes.

void paintEvent (QPaintEvent *)
virtual void positionHasChanged ()
void resizeEvent (QResizeEvent *)

Protected Attributes

QWidgetmParent
QLayout * mParentLayout
protected Q_SLOTS: void slotLayoutChanged( AbstractDiagram* diagram )

Member Typedef Documentation

typedef QList<CoordinateTransformation> KDChart::PolarCoordinatePlane::CoordinateTransformationList
 

Definition at line 45 of file KDChartPolarCoordinatePlane.h.


Member Enumeration Documentation

enum KDChart::AbstractCoordinatePlane::AxesCalcMode [inherited]
 

Enumeration values:
Linear 
Logarithmic 

Definition at line 55 of file KDChartAbstractCoordinatePlane.h.

00055 { Linear, Logarithmic };


Constructor & Destructor Documentation

PolarCoordinatePlane::PolarCoordinatePlane Chart parent = 0  )  [explicit]
 

Definition at line 114 of file KDChartPolarCoordinatePlane.cpp.

00115     : AbstractCoordinatePlane ( new Private(), parent )
00116 {
00117     // this bloc left empty intentionally
00118 }

PolarCoordinatePlane::~PolarCoordinatePlane  ) 
 

Definition at line 120 of file KDChartPolarCoordinatePlane.cpp.

00121 {
00122     // this bloc left empty intentionally
00123 }


Member Function Documentation

void PolarCoordinatePlane::addDiagram AbstractDiagram diagram  )  [virtual]
 

Adds a diagram to this coordinate plane.

Parameters:
diagram The diagram to add.
See also:
replaceDiagram, takeDiagram

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 130 of file KDChartPolarCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::addDiagram().

00131 {
00132     Q_ASSERT_X ( dynamic_cast<AbstractPolarDiagram*> ( diagram ),
00133                  "PolarCoordinatePlane::addDiagram", "Only polar"
00134                  "diagrams can be added to a polar coordinate plane!" );
00135     AbstractCoordinatePlane::addDiagram ( diagram );
00136     connect ( diagram,  SIGNAL ( layoutChanged ( AbstractDiagram* ) ),
00137               SLOT ( slotLayoutChanged ( AbstractDiagram* ) ) );
00138 
00139 }

void AbstractAreaBase::alignToReferencePoint const RelativePosition position  )  [inherited]
 

Definition at line 90 of file KDChartAbstractAreaBase.cpp.

00091 {
00092     Q_UNUSED( position );
00093     // PENDING(kalle) FIXME
00094     qWarning( "Sorry, not implemented: void AbstractAreaBase::alignToReferencePoint( const RelativePosition& position )" );
00095 }

qreal PolarCoordinatePlane::angleUnit  )  const
 

Definition at line 294 of file KDChartPolarCoordinatePlane.cpp.

References d.

Referenced by layoutDiagrams().

00295 {
00296     Q_ASSERT_X ( d->currentTransformation != 0, "PolarCoordinatePlane::angleUnit",
00297                  "Only call angleUnit() from within paint()." );
00298     return  d->currentTransformation->angleUnit;
00299 }

QRect AbstractArea::areaGeometry  )  const [protected, virtual, inherited]
 

Implements KDChart::AbstractAreaBase.

Definition at line 150 of file KDChartAbstractArea.cpp.

Referenced by KDChart::CartesianCoordinatePlane::drawingArea(), layoutDiagrams(), KDChart::CartesianAxis::paint(), KDChart::AbstractArea::paintAll(), and KDChart::CartesianAxis::paintCtx().

00151 {
00152     return geometry();
00153 }

BackgroundAttributes AbstractAreaBase::backgroundAttributes  )  const [inherited]
 

Definition at line 112 of file KDChartAbstractAreaBase.cpp.

References d.

Referenced by updateCommonBrush().

00113 {
00114     return d->backgroundAttributes;
00115 }

int AbstractArea::bottomOverlap bool  doNotRecalculate = false  )  const [virtual, inherited]
 

This is called at layout time by KDChart:AutoSpacerLayoutItem::sizeHint().

The method triggers AbstractArea::sizeHint() to find out the amount of overlap at the bottom edge of the area.

Note:
The default implementation is not using any caching, it might make sense to implement a more sophisticated solution for derived classes that have complex work to do in sizeHint(). All we have here is a primitive flag to be set by the caller if it is sure that no sizeHint() needs to be called.

Definition at line 101 of file KDChartAbstractArea.cpp.

References d.

Referenced by KDChart::AutoSpacerLayoutItem::sizeHint().

00102 {
00103     // Re-calculate the sizes,
00104     // so we also get the amountOf..Overlap members set newly:
00105     if( ! doNotRecalculate )
00106         sizeHint();
00107     return d->amountOfBottomOverlap;
00108 }

bool AbstractAreaBase::compare const AbstractAreaBase other  )  const [inherited]
 

Returns true if both areas have the same settings.

Definition at line 75 of file KDChartAbstractAreaBase.cpp.

00076 {
00077     if( other == this ) return true;
00078     if( ! other ){
00079         //qDebug() << "CartesianAxis::compare() cannot compare to Null pointer";
00080         return false;
00081     }
00082     /*
00083     qDebug() << "AbstractAreaBase:" << (frameAttributes() == other->frameAttributes())
00084         << (backgroundAttributes() == other->backgroundAttributes()) << "\n";
00085     */
00086     return  (frameAttributes()      == other->frameAttributes()) &&
00087             (backgroundAttributes() == other->backgroundAttributes());
00088 }

AbstractDiagram * AbstractCoordinatePlane::diagram  )  [inherited]
 

Returns:
The first diagram associated with this coordinate plane.

Definition at line 113 of file KDChartAbstractCoordinatePlane.cpp.

References d.

Referenced by KDChart::Widget::diagram(), KDChart::Chart::mousePressEvent(), and setStartPosition().

00114 {
00115     if ( d->diagrams.isEmpty() )
00116     {
00117         return 0;
00118     } else {
00119         return d->diagrams.first();
00120     }
00121 }

ConstAbstractDiagramList AbstractCoordinatePlane::diagrams  )  const [inherited]
 

Returns:
The list of diagrams associated with this coordinate plane.

Definition at line 128 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::ConstAbstractDiagramList, and d.

00129 {
00130     ConstAbstractDiagramList list;
00131 #ifndef QT_NO_STL
00132     qCopy( d->diagrams.begin(), d->diagrams.end(), std::back_inserter( list ) );
00133 #else
00134     Q_FOREACH( AbstractDiagram * a, d->diagrams )
00135         list.push_back( a );
00136 #endif
00137     return list;
00138 }

AbstractDiagramList AbstractCoordinatePlane::diagrams  )  [inherited]
 

Returns:
The list of diagrams associated with this coordinate plane.

Definition at line 123 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::AbstractDiagramList, and d.

Referenced by KDChart::CartesianCoordinatePlane::getDataDimensionsList(), KDChart::CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams(), layoutDiagrams(), KDChart::CartesianCoordinatePlane::layoutDiagrams(), KDChart::Chart::mousePressEvent(), paint(), and KDChart::CartesianCoordinatePlane::paint().

00124 {
00125     return d->diagrams;
00126 }

Qt::Orientations KDChart::AbstractCoordinatePlane::expandingDirections  )  const [virtual, inherited]
 

pure virtual in QLayoutItem

Definition at line 208 of file KDChartAbstractCoordinatePlane.cpp.

00209 {
00210     return Qt::Vertical | Qt::Horizontal;
00211 }

FrameAttributes AbstractAreaBase::frameAttributes  )  const [inherited]
 

Definition at line 102 of file KDChartAbstractAreaBase.cpp.

References d.

Referenced by KDChart::Legend::clone(), and updateCommonBrush().

00103 {
00104     return d->frameAttributes;
00105 }

QRect KDChart::AbstractCoordinatePlane::geometry  )  const [virtual, inherited]
 

pure virtual in QLayoutItem

Definition at line 242 of file KDChartAbstractCoordinatePlane.cpp.

References d.

Referenced by KDChart::Chart::mousePressEvent(), and paint().

00243 {
00244     return d->geometry;
00245 }

DataDimensionsList PolarCoordinatePlane::getDataDimensionsList  )  const [protected, virtual]
 

Implements KDChart::AbstractCoordinatePlane.

Definition at line 358 of file KDChartPolarCoordinatePlane.cpp.

References KDChart::DataDimensionsList.

00359 {
00360     DataDimensionsList l;
00361 
00362     //FIXME(khz): do the real calculation
00363 
00364     return l;
00365 }

void AbstractAreaBase::getFrameLeadings int &  left,
int &  top,
int &  right,
int &  bottom
const [inherited]
 

Definition at line 204 of file KDChartAbstractAreaBase.cpp.

References d.

Referenced by KDChart::AbstractAreaBase::innerRect(), and KDChart::AbstractAreaWidget::paintAll().

00205 {
00206     if( d && d->frameAttributes.isVisible() ){
00207         const int padding = qMax( d->frameAttributes.padding(), 0 );
00208         left   = padding;
00209         top    = padding;
00210         right  = padding;
00211         bottom = padding;
00212     }else{
00213         left   = 0;
00214         top    = 0;
00215         right  = 0;
00216         bottom = 0;
00217     }
00218 }

GridAttributes KDChart::AbstractCoordinatePlane::globalGridAttributes  )  const [inherited]
 

Returns:
The grid attributes used by this coordinate plane.
See also:
setGlobalGridAttributes

CartesianCoordinatePlane::gridAttributes

Definition at line 157 of file KDChartAbstractCoordinatePlane.cpp.

References d.

Referenced by gridAttributes(), and KDChart::CartesianCoordinatePlane::gridAttributes().

00158 {
00159     return d->gridAttributes;
00160 }

const GridAttributes KDChart::PolarCoordinatePlane::gridAttributes bool  circular  )  const
 

Returns:
The attributes used for grid lines drawn in circular direction (or in sagittal direction, resp.).
Note:
This function always returns a valid set of grid attributes: If no special grid attributes were set for this direction the global attributes are returned, as returned by AbstractCoordinatePlane::globalGridAttributes.
See also:
setGridAttributes

resetGridAttributes

AbstractCoordinatePlane::globalGridAttributes

hasOwnGridAttributes

Definition at line 387 of file KDChartPolarCoordinatePlane.cpp.

References d, KDChart::AbstractCoordinatePlane::globalGridAttributes(), and hasOwnGridAttributes().

00389 {
00390     if( hasOwnGridAttributes( circular ) ){
00391         if( circular )
00392             return d->gridAttributesCircular;
00393         else
00394             return d->gridAttributesSagittal;
00395     }else{
00396         return globalGridAttributes();
00397     }
00398 }

KDChart::DataDimensionsList KDChart::AbstractCoordinatePlane::gridDimensionsList  )  [inherited]
 

Returns the dimensions used for drawing the grid lines.

Returned data is the result of (cached) grid calculations, so - if you need that information for your own tasks - make sure to call again this function after every data modification that has changed the data range, since grid calculation is based upon the data range, thus the grid start/end might have changed if the data was changed.

Note:
Returned list will contain different numbers of DataDimension, depending on the kind of coordinate plane used. For CartesianCoordinatePlane two DataDimension are returned: the first representing grid lines in X direction (matching the Abscissa axes) and the second indicating vertical grid lines (or Ordinate axes, resp.).
Returns:
The dimensions used for drawing the grid lines.
See also:
DataDimension

Definition at line 162 of file KDChartAbstractCoordinatePlane.cpp.

References d, and KDChart::DataDimensionsList.

Referenced by KDChart::CartesianCoordinatePlane::layoutDiagrams(), KDChart::CartesianAxis::maximumSize(), and KDChart::CartesianAxis::paintCtx().

00163 {
00164     //KDChart::DataDimensionsList l( d->grid->updateData( this ) );
00165     //qDebug() << "AbstractCoordinatePlane::gridDimensionsList() Y-range:" << l.last().end - l.last().start << "   step width:" << l.last().stepWidth;
00166     //qDebug() << "AbstractCoordinatePlane::gridDimensionsList() X-range:" << l.first().end - l.first().start << "   step width:" << l.first().stepWidth;
00167     return d->grid->updateData( this );
00168 }

bool KDChart::PolarCoordinatePlane::hasOwnGridAttributes bool  circular  )  const
 

Returns:
Returns whether the grid attributes have been set for the respective direction via setGridAttributes( bool circular ).
If false, the grid will use the global attributes set by AbstractCoordinatePlane::globalGridAttributes (or the default attributes, resp.)

See also:
setGridAttributes

resetGridAttributes

AbstractCoordinatePlane::globalGridAttributes

Definition at line 410 of file KDChartPolarCoordinatePlane.cpp.

References d.

Referenced by gridAttributes().

00412 {
00413     return
00414         ( circular )
00415         ? d->hasOwnGridAttributesCircular
00416         : d->hasOwnGridAttributesSagittal;
00417 }

QRect AbstractAreaBase::innerRect  )  const [protected, inherited]
 

Definition at line 220 of file KDChartAbstractAreaBase.cpp.

References KDChart::AbstractAreaBase::areaGeometry(), and KDChart::AbstractAreaBase::getFrameLeadings().

Referenced by KDChart::TextArea::paintAll(), and KDChart::AbstractArea::paintAll().

00221 {
00222     int left;
00223     int top;
00224     int right;
00225     int bottom;
00226     getFrameLeadings( left, top, right, bottom );
00227     return
00228         QRect( QPoint(0,0), areaGeometry().size() )
00229             .adjusted( left, top, -right, -bottom );
00230 }

bool KDChart::AbstractCoordinatePlane::isEmpty  )  const [virtual, inherited]
 

pure virtual in QLayoutItem

Definition at line 201 of file KDChartAbstractCoordinatePlane.cpp.

00202 {
00203     return false; // never empty!
00204     // coordinate planes with no associated diagrams
00205     // are showing a default grid of ()1..10, 1..10) stepWidth 1
00206 }

const bool KDChart::AbstractCoordinatePlane::isVisiblePoint const QPointF &  point  )  const [inherited]
 

Tests, if a point is visible on the coordinate plane.

Note:
Before calling this function the point must have been translated into coordinate plane space.

Definition at line 275 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00276 {
00277     return d->isVisiblePoint( this, point );
00278 }

void PolarCoordinatePlane::layoutDiagrams  )  [protected, virtual]
 

Distribute the available space among the diagrams and axes.

Implements KDChart::AbstractCoordinatePlane.

Definition at line 238 of file KDChartPolarCoordinatePlane.cpp.

References angleUnit(), KDChart::AbstractArea::areaGeometry(), d, KDChart::AbstractDiagram::dataBoundaries(), KDChart::AbstractCoordinatePlane::diagrams(), radiusUnit(), startPosition(), and KDChart::AbstractPolarDiagram::valueTotals().

Referenced by resizeEvent().

00239 {
00240     // the rectangle the diagrams cover in the *plane*:
00241     // (Why -3? We save 1px on each side for the antialiased drawing, and
00242     // respect the way QPainter calculates the width of a painted rect (the
00243     // size is the rectangle size plus the pen width). This way, most clipping
00244     // for regular pens should be avoided. When pens with a penWidth or larger
00245     // than 1 are used, this may not b sufficient.
00246     const QRect rect( areaGeometry() );
00247     d->contentRect = QRectF ( 1, 1, rect.width() - 3, rect.height() - 3 );
00248 
00249     // FIXME distribute space according to options:
00250     const qreal oldStartPosition = startPosition();
00251     d->coordinateTransformations.clear();
00252     Q_FOREACH( AbstractDiagram* diagram, diagrams() )
00253         {
00254             AbstractPolarDiagram *polarDiagram = dynamic_cast<AbstractPolarDiagram*>( diagram );
00255             Q_ASSERT( polarDiagram );
00256             QPair<QPointF, QPointF> dataBoundariesPair = polarDiagram->dataBoundaries();
00257 
00258             const double angleUnit = 360 / polarDiagram->valueTotals();
00259 //qDebug() << "--------------------------------------------------------";
00260             const double radius = dataBoundariesPair.second.y();
00261 //qDebug() << radius <<"="<<dataBoundariesPair.second.y();
00262             const double diagramWidth = radius * 2; // == height
00263             const double planeWidth = d->contentRect.width();
00264             const double planeHeight = d->contentRect.height();
00265             const double radiusUnit = qMin( planeWidth, planeHeight ) / diagramWidth;
00266 //qDebug() << radiusUnit <<"=" << "qMin( "<<planeWidth<<","<< planeHeight <<") / "<<diagramWidth;
00267             QPointF coordinateOrigin = QPointF ( planeWidth / 2, planeHeight / 2 );
00268             coordinateOrigin += d->contentRect.topLeft();
00269 
00270             CoordinateTransformation diagramTransposition;
00271             diagramTransposition.originTranslation = coordinateOrigin;
00272             diagramTransposition.radiusUnit = radiusUnit;
00273             diagramTransposition.angleUnit = angleUnit;
00274             diagramTransposition.startPosition = oldStartPosition;
00275             diagramTransposition.zoom = ZoomParameters();
00276             d->coordinateTransformations.append( diagramTransposition );
00277         }
00278 }

void KDChart::AbstractCoordinatePlane::layoutPlanes  )  [inherited]
 

Calling layoutPlanes() on the plane triggers the global KDChart::Chart::slotLayoutPlanes().

Definition at line 259 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::needLayoutPlanes().

Referenced by KDChart::AbstractCoordinatePlane::addDiagram(), KDChart::CartesianAxis::layoutPlanes(), KDChart::AbstractCartesianDiagram::layoutPlanes(), and KDChart::AbstractCoordinatePlane::replaceDiagram().

00260 {
00261     //qDebug("KDChart::AbstractCoordinatePlane::relayout() called");
00262     emit needLayoutPlanes();
00263 }

int AbstractArea::leftOverlap bool  doNotRecalculate = false  )  const [virtual, inherited]
 

This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().

The method triggers AbstractArea::sizeHint() to find out the amount of overlap at the left edge of the area.

Note:
The default implementation is not using any caching, it might make sense to implement a more sophisticated solution for derived classes that have complex work to do in sizeHint(). All we have here is a primitive flag to be set by the caller if it is sure that no sizeHint() needs to be called.

Definition at line 77 of file KDChartAbstractArea.cpp.

References d.

Referenced by KDChart::AutoSpacerLayoutItem::sizeHint().

00078 {
00079     // Re-calculate the sizes,
00080     // so we also get the amountOf..Overlap members set newly:
00081     if( ! doNotRecalculate )
00082         sizeHint();
00083     return d->amountOfLeftOverlap;
00084 }

QSize KDChart::AbstractCoordinatePlane::maximumSize  )  const [virtual, inherited]
 

pure virtual in QLayoutItem

Definition at line 213 of file KDChartAbstractCoordinatePlane.cpp.

Referenced by KDChart::AbstractCoordinatePlane::sizeHint().

00214 {
00215     // No maximum size set. Especially not parent()->size(), we are not layouting
00216     // to the parent widget's size when using Chart::paint()!
00217     return QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX);
00218 }

QSize KDChart::AbstractCoordinatePlane::minimumSize  )  const [virtual, inherited]
 

pure virtual in QLayoutItem

Definition at line 220 of file KDChartAbstractCoordinatePlane.cpp.

00221 {
00222     return QSize(60, 60); // this default can be overwritten by derived classes
00223 }

QSize KDChart::AbstractCoordinatePlane::minimumSizeHint  )  const [virtual, inherited]
 

[reimplemented]

Definition at line 140 of file KDChartAbstractCoordinatePlane.cpp.

00141 {
00142     return QSize( 200, 200 );
00143 }

void KDChart::AbstractCoordinatePlane::mousePressEvent QMouseEvent *  event  )  [inherited]
 

reimp

Definition at line 266 of file KDChartAbstractCoordinatePlane.cpp.

References d.

Referenced by KDChart::Chart::mousePressEvent().

00267 {
00268     KDAB_FOREACH( AbstractDiagram * a, d->diagrams )
00269     {
00270         a->mousePressEvent( event );
00271     }
00272 }

void KDChart::AbstractCoordinatePlane::needLayoutPlanes  )  [inherited]
 

Emitted when plane needs to trigger the Chart's layouting of the coord.

planes.

Referenced by KDChart::AbstractCoordinatePlane::layoutPlanes().

void KDChart::AbstractCoordinatePlane::needRelayout  )  [inherited]
 

Emitted when plane needs to trigger the Chart's layouting.

Referenced by KDChart::AbstractCoordinatePlane::relayout().

void KDChart::AbstractCoordinatePlane::needUpdate  )  [inherited]
 

Emitted when plane needs to update its drawings.

void PolarCoordinatePlane::paint QPainter *   )  [virtual]
 

reimpl

Implements KDChart::AbstractLayoutItem.

Definition at line 141 of file KDChartPolarCoordinatePlane.cpp.

References KDChart::AbstractDiagramList, d, KDChart::AbstractCoordinatePlane::diagrams(), KDChart::AbstractCoordinatePlane::geometry(), KDChart::PaintContext::setCoordinatePlane(), KDChart::PaintContext::setPainter(), and KDChart::PaintContext::setRectangle().

00142 {
00143     AbstractDiagramList diags = diagrams();
00144     if ( d->coordinateTransformations.size() == diags.size() )
00145     {
00146         PaintContext ctx;
00147         ctx.setPainter ( painter );
00148         ctx.setCoordinatePlane ( this );
00149         ctx.setRectangle ( geometry() /*d->contentRect*/ );
00150 
00151         // paint the coordinate system rulers:
00152         d->currentTransformation = & ( d->coordinateTransformations[0] );
00153         d->grid->drawGrid( &ctx );
00154 
00155         // paint the diagrams:
00156         for ( int i = 0; i < diags.size(); i++ )
00157         {
00158             d->currentTransformation = & ( d->coordinateTransformations[i] );
00159             PainterSaver painterSaver( painter );
00160             diags[i]->paint ( &ctx );
00161         }
00162         d->currentTransformation = 0;
00163     } // else: diagrams have not been set up yet
00164 }

void AbstractArea::paintAll QPainter &  painter  )  [virtual, inherited]
 

Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked automatically.

Reimplemented from KDChart::AbstractLayoutItem.

Definition at line 123 of file KDChartAbstractArea.cpp.

References KDChart::AbstractArea::areaGeometry(), d, KDChart::AbstractAreaBase::innerRect(), KDChart::AbstractLayoutItem::paint(), KDChart::AbstractAreaBase::paintBackground(), and KDChart::AbstractAreaBase::paintFrame().

Referenced by KDChart::AbstractArea::paintIntoRect().

00124 {
00125     // Paint the background and frame
00126     const QRect overlappingArea( geometry().adjusted(
00127             -d->amountOfLeftOverlap,
00128             -d->amountOfTopOverlap,
00129             d->amountOfRightOverlap,
00130             d->amountOfBottomOverlap ) );
00131     paintBackground( painter, overlappingArea );
00132     paintFrame(      painter, overlappingArea );
00133 
00134     // temporarily adjust the widget size, to be sure all content gets calculated
00135     // to fit into the inner rectangle
00136     const QRect oldGeometry( areaGeometry()  );
00137     QRect inner( innerRect() );
00138     inner.moveTo(
00139         oldGeometry.left() + inner.left(),
00140         oldGeometry.top()  + inner.top() );
00141     const bool needAdjustGeometry = oldGeometry != inner;
00142     if( needAdjustGeometry )
00143         setGeometry( inner );
00144     paint( &painter );
00145     if( needAdjustGeometry )
00146         setGeometry( oldGeometry );
00147     //qDebug() << "AbstractAreaWidget::paintAll() done.";
00148 }

void AbstractAreaBase::paintBackground QPainter &  painter,
const QRect &  rectangle
[virtual, inherited]
 

Definition at line 188 of file KDChartAbstractAreaBase.cpp.

References d, and KDChart::AbstractAreaBase::paintBackgroundAttributes().

Referenced by KDChart::TextArea::paintAll(), KDChart::AbstractAreaWidget::paintAll(), and KDChart::AbstractArea::paintAll().

00189 {
00190     Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintBackground()",
00191                 "Private class was not initialized!" );
00192     paintBackgroundAttributes( painter, rect, d->backgroundAttributes );
00193 }

void AbstractAreaBase::paintBackgroundAttributes QPainter &  painter,
const QRect &  rectangle,
const KDChart::BackgroundAttributes attributes
[static, inherited]
 

Definition at line 119 of file KDChartAbstractAreaBase.cpp.

References KDChart::BackgroundAttributes::brush(), KDChart::BackgroundAttributes::isVisible(), KDChart::BackgroundAttributes::pixmap(), and KDChart::BackgroundAttributes::pixmapMode().

Referenced by KDChart::AbstractAreaBase::paintBackground().

00121 {
00122     if( !attributes.isVisible() ) return;
00123 
00124     /* first draw the brush (may contain a pixmap)*/
00125     if( Qt::NoBrush != attributes.brush().style() ) {
00126         KDChart::PainterSaver painterSaver( &painter );
00127         painter.setPen( Qt::NoPen );
00128         const QPointF newTopLeft( painter.deviceMatrix().map( rect.topLeft() ) );
00129         painter.setBrushOrigin( newTopLeft );
00130         painter.setBrush( attributes.brush() );
00131         painter.drawRect( rect.adjusted( 0, 0, -1, -1 ) );
00132     }
00133     /* next draw the backPixmap over the brush */
00134     if( !attributes.pixmap().isNull() &&
00135         attributes.pixmapMode() != BackgroundAttributes::BackgroundPixmapModeNone ) {
00136         QPointF ol = rect.topLeft();
00137         if( BackgroundAttributes::BackgroundPixmapModeCentered == attributes.pixmapMode() )
00138         {
00139             ol.setX( rect.center().x() - attributes.pixmap().width() / 2 );
00140             ol.setY( rect.center().y() - attributes.pixmap().height()/ 2 );
00141             painter.drawPixmap( ol, attributes.pixmap() );
00142         } else {
00143             QMatrix m;
00144             double zW = (double)rect.width()  / (double)attributes.pixmap().width();
00145             double zH = (double)rect.height() / (double)attributes.pixmap().height();
00146             switch( attributes.pixmapMode() ) {
00147             case BackgroundAttributes::BackgroundPixmapModeScaled:
00148             {
00149                 double z;
00150                 z = qMin( zW, zH );
00151                 m.scale( z, z );
00152             }
00153             break;
00154             case BackgroundAttributes::BackgroundPixmapModeStretched:
00155                 m.scale( zW, zH );
00156                 break;
00157             default:
00158                 ; // Cannot happen, previously checked
00159             }
00160             QPixmap pm = attributes.pixmap().transformed( m );
00161             ol.setX( rect.center().x() - pm.width() / 2 );
00162             ol.setY( rect.center().y() - pm.height()/ 2 );
00163             painter.drawPixmap( ol, pm );
00164         }
00165     }
00166 }

void KDChart::AbstractLayoutItem::paintCtx PaintContext context  )  [virtual, inherited]
 

Default impl: Paint the complete item using its layouted position and size.

Reimplemented in KDChart::CartesianAxis.

Definition at line 77 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::paint(), and KDChart::PaintContext::painter().

00078 {
00079     if( context )
00080         paint( context->painter() );
00081 }

void KDChart::PolarCoordinatePlane::paintEvent QPaintEvent *   )  [protected]
 

void AbstractAreaBase::paintFrame QPainter &  painter,
const QRect &  rectangle
[virtual, inherited]
 

Definition at line 196 of file KDChartAbstractAreaBase.cpp.

References d, and KDChart::AbstractAreaBase::paintFrameAttributes().

Referenced by KDChart::TextArea::paintAll(), KDChart::AbstractAreaWidget::paintAll(), and KDChart::AbstractArea::paintAll().

00197 {
00198     Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintFrame()",
00199                 "Private class was not initialized!" );
00200     paintFrameAttributes( painter, rect, d->frameAttributes );
00201 }

void AbstractAreaBase::paintFrameAttributes QPainter &  painter,
const QRect &  rectangle,
const KDChart::FrameAttributes attributes
[static, inherited]
 

Definition at line 169 of file KDChartAbstractAreaBase.cpp.

References KDChart::FrameAttributes::isVisible(), and KDChart::FrameAttributes::pen().

Referenced by KDChart::AbstractAreaBase::paintFrame().

00171 {
00172 
00173     if( !attributes.isVisible() ) return;
00174 
00175     // Note: We set the brush to NoBrush explicitely here.
00176     //       Otherwise we might get a filled rectangle, so any
00177     //       previously drawn background would be overwritten by that area.
00178 
00179     const QPen   oldPen(   painter.pen() );
00180     const QBrush oldBrush( painter.brush() );
00181     painter.setPen(   attributes.pen() );
00182     painter.setBrush( Qt::NoBrush );
00183     painter.drawRect( rect.adjusted( 0, 0, -1, -1 ) );
00184     painter.setBrush( oldBrush );
00185     painter.setPen(   oldPen );
00186 }

void AbstractArea::paintIntoRect QPainter &  painter,
const QRect &  rect
[virtual, inherited]
 

Draws the background and frame, then calls paint().

In most cases there is no need to overwrite this method in a derived class, but you would overwrite AbstractLayoutItem::paint() instead.

Definition at line 111 of file KDChartAbstractArea.cpp.

References KDChart::AbstractArea::paintAll().

00112 {
00113     const QRect oldGeometry( geometry() );
00114     if( oldGeometry != rect )
00115         setGeometry( rect );
00116     painter.translate( rect.left(), rect.top() );
00117     paintAll( painter );
00118     painter.translate( -rect.left(), -rect.top() );
00119     if( oldGeometry != rect )
00120         setGeometry( oldGeometry );
00121 }

const KDChart::Chart * KDChart::AbstractCoordinatePlane::parent  )  const [inherited]
 

Definition at line 190 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00191 {
00192     return d->parent;
00193 }

KDChart::Chart * KDChart::AbstractCoordinatePlane::parent  )  [inherited]
 

Definition at line 195 of file KDChartAbstractCoordinatePlane.cpp.

References d.

Referenced by KDChart::CartesianAxis::maximumSize(), and KDChart::CartesianAxis::paintCtx().

00196 {
00197     return d->parent;
00198 }

QLayout* KDChart::AbstractLayoutItem::parentLayout  )  [inherited]
 

Definition at line 74 of file KDChartLayoutItems.h.

00075         {
00076             return mParentLayout;
00077         }

void AbstractArea::positionHasChanged  )  [protected, virtual, inherited]
 

Reimplemented from KDChart::AbstractAreaBase.

Definition at line 155 of file KDChartAbstractArea.cpp.

00156 {
00157     emit positionChanged( this );
00158 }

void KDChart::AbstractCoordinatePlane::propertiesChanged  )  [inherited]
 

Emitted upon change of a property of the Coordinate Plane or any of its components.

Referenced by KDChart::CartesianCoordinatePlane::addDiagram(), KDChart::CartesianCoordinatePlane::adjustHorizontalRangeToData(), KDChart::CartesianCoordinatePlane::adjustVerticalRangeToData(), KDChart::CartesianCoordinatePlane::setAutoAdjustGridToZoom(), KDChart::CartesianCoordinatePlane::setAutoAdjustHorizontalRangeToData(), KDChart::CartesianCoordinatePlane::setAutoAdjustVerticalRangeToData(), KDChart::CartesianCoordinatePlane::setAxesCalcModes(), KDChart::CartesianCoordinatePlane::setAxesCalcModeX(), KDChart::CartesianCoordinatePlane::setAxesCalcModeY(), setGridAttributes(), KDChart::CartesianCoordinatePlane::setGridAttributes(), KDChart::CartesianCoordinatePlane::setHorizontalRange(), KDChart::CartesianCoordinatePlane::setIsometricScaling(), KDChart::CartesianCoordinatePlane::setVerticalRange(), KDChart::CartesianCoordinatePlane::setZoomCenter(), KDChart::CartesianCoordinatePlane::setZoomFactorX(), and KDChart::CartesianCoordinatePlane::setZoomFactorY().

qreal PolarCoordinatePlane::radiusUnit  )  const
 

Definition at line 301 of file KDChartPolarCoordinatePlane.cpp.

References d.

Referenced by layoutDiagrams().

00302 {
00303     Q_ASSERT_X ( d->currentTransformation != 0, "PolarCoordinatePlane::radiusUnit",
00304                  "Only call radiusUnit() from within paint()." );
00305     return  d->currentTransformation->radiusUnit;
00306 }

AbstractCoordinatePlane * KDChart::AbstractCoordinatePlane::referenceCoordinatePlane  )  const [inherited]
 

There are two ways, in which planes can be caused to interact, in where they are put layouting wise: The first is the reference plane.

If such a reference plane is set, on a plane, it will use the same cell in the layout as that one. In addition to this, planes can share an axis. In that case they will be layed out in relation to each other as suggested by the position of the axis. If, for example Plane1 and Plane2 share an axis at position Left, that will result in the layout: Axis Plane1 Plane 2, vertically. If Plane1 also happens to be Plane2's reference plane, both planes are drawn over each other. The reference plane concept allows two planes to share the same space even if neither has any axis, and in case there are shared axis, it is used to decided, whether the planes should be painted on top of each other or layed out vertically or horizontally next to each other.

Returns:
The reference coordinate plane associated with this one.

Definition at line 180 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00181 {
00182     return d->referenceCoordinatePlane;
00183 }

void KDChart::AbstractCoordinatePlane::relayout  )  [inherited]
 

Calling relayout() on the plane triggers the global KDChart::Chart::slotRelayout().

Definition at line 253 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::needRelayout().

00254 {
00255     //qDebug("KDChart::AbstractCoordinatePlane::relayout() called");
00256     emit needRelayout();
00257 }

void KDChart::AbstractLayoutItem::removeFromParentLayout  )  [inherited]
 

Definition at line 78 of file KDChartLayoutItems.h.

Referenced by KDChart::Chart::takeCoordinatePlane().

00079         {
00080             if( mParentLayout ){
00081                 if( widget() )
00082                     mParentLayout->removeWidget( widget() );
00083                 else
00084                     mParentLayout->removeItem( this );
00085             }
00086         }

void AbstractCoordinatePlane::replaceDiagram AbstractDiagram diagram,
AbstractDiagram oldDiagram = 0
[virtual, inherited]
 

Replaces the old diagram, or appends the diagram, it there is none yet.

Parameters:
diagram The diagram to be used instead of the old diagram. This parameter must not be zero, or the method will do nothing.
oldDiagram The diagram to be removed by the new diagram. This diagram will be deleted automatically. If the parameter is omitted, the very first diagram will be replaced. In case, there was no diagram yet, the new diagram will just be added.
Note:
If you want to re-use the old diagram, call takeDiagram and addDiagram, instead of using replaceDiagram.
See also:
addDiagram, takeDiagram

Definition at line 82 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::addDiagram(), d, KDChart::AbstractCoordinatePlane::layoutDiagrams(), KDChart::AbstractCoordinatePlane::layoutPlanes(), and KDChart::AbstractCoordinatePlane::takeDiagram().

00083 {
00084     if( diagram && oldDiagram_ != diagram ){
00085         AbstractDiagram* oldDiagram = oldDiagram_;
00086         if( d->diagrams.count() ){
00087             if( ! oldDiagram )
00088                 oldDiagram = d->diagrams.first();
00089             takeDiagram( oldDiagram );
00090         }
00091         delete oldDiagram;
00092         addDiagram( diagram );
00093         layoutDiagrams();
00094         layoutPlanes(); // there might be new axes, etc
00095         update();
00096     }
00097 }

void KDChart::PolarCoordinatePlane::resetGridAttributes bool  circular  ) 
 

Reset the attributes to be used for grid lines drawn in circular direction (or in sagittal direction, resp.).

By calling this method you specify that the global attributes set by AbstractCoordinatePlane::setGlobalGridAttributes be used.

See also:
setGridAttributes, gridAttributes

AbstractCoordinatePlane::globalGridAttributes

hasOwnGridAttributes

Definition at line 380 of file KDChartPolarCoordinatePlane.cpp.

00382 {
00383     setHasOwnGridAttributes( circular, false );
00384     update();
00385 }

void PolarCoordinatePlane::resizeEvent QResizeEvent *   )  [protected]
 

Definition at line 232 of file KDChartPolarCoordinatePlane.cpp.

References d, and layoutDiagrams().

00233 {
00234     d->initialResizeEventReceived = true;
00235     layoutDiagrams();
00236 }

int AbstractArea::rightOverlap bool  doNotRecalculate = false  )  const [virtual, inherited]
 

This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().

The method triggers AbstractArea::sizeHint() to find out the amount of overlap at the right edge of the area.

Note:
The default implementation is not using any caching, it might make sense to implement a more sophisticated solution for derived classes that have complex work to do in sizeHint(). All we have here is a primitive flag to be set by the caller if it is sure that no sizeHint() needs to be called.

Definition at line 85 of file KDChartAbstractArea.cpp.

References d.

Referenced by KDChart::AutoSpacerLayoutItem::sizeHint().

00086 {
00087     // Re-calculate the sizes,
00088     // so we also get the amountOf..Overlap members set newly:
00089     if( ! doNotRecalculate )
00090         sizeHint();
00091     return d->amountOfRightOverlap;
00092 }

void AbstractAreaBase::setBackgroundAttributes const BackgroundAttributes a  )  [inherited]
 

Definition at line 107 of file KDChartAbstractAreaBase.cpp.

References d.

00108 {
00109     d->backgroundAttributes = a;
00110 }

void AbstractAreaBase::setFrameAttributes const FrameAttributes a  )  [inherited]
 

Definition at line 97 of file KDChartAbstractAreaBase.cpp.

References d.

Referenced by KDChart::Legend::clone().

00098 {
00099     d->frameAttributes = a;
00100 }

void KDChart::AbstractCoordinatePlane::setGeometry const QRect &  r  )  [virtual, inherited]
 

pure virtual in QLayoutItem

Note:
Do not call this function directly, unless you know exactly what you are doing. Geometry management is done by KD Chart's internal layouting measures.

Definition at line 232 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00233 {
00234 //    qDebug() << "KDChart::AbstractCoordinatePlane::setGeometry(" << r << ") called";
00235     if( d->geometry != r ){
00236         d->geometry = r;
00237         // Note: We do *not* call update() here
00238         //       because it would invoke KDChart::update() recursively.
00239     }
00240 }

void KDChart::AbstractCoordinatePlane::setGlobalGridAttributes const GridAttributes  )  [inherited]
 

Set the grid attributes to be used by this coordinate plane.

To disable grid painting, for example, your code should like this:

GridAttributes ga = plane->globalGridAttributes(); ga.setGlobalGridVisible( false ); plane->setGlobalGridAttributes( ga );
See also:
globalGridAttributes

CartesianCoordinatePlane::setGridAttributes

Definition at line 151 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00152 {
00153     d->gridAttributes = a;
00154     update();
00155 }

void KDChart::PolarCoordinatePlane::setGridAttributes bool  circular,
const GridAttributes
 

Set the attributes to be used for grid lines drawn in circular direction (or in sagittal direction, resp.).

To disable circular grid painting, for example, your code should like this:

GridAttributes ga = plane->gridAttributes( bool ); ga.setGridVisible( false ); plane-setGridAttributes( bool, ga );

Note:
setGridAttributes overwrites the global attributes that were set by AbstractCoordinatePlane::setGlobalGridAttributes. To re-activate these global attributes you can call resetGridAttributes.
See also:
resetGridAttributes, gridAttributes

AbstractCoordinatePlane::setGlobalGridAttributes

hasOwnGridAttributes

Definition at line 367 of file KDChartPolarCoordinatePlane.cpp.

References d, and KDChart::AbstractCoordinatePlane::propertiesChanged().

00370 {
00371     if( circular )
00372         d->gridAttributesCircular = a;
00373     else
00374         d->gridAttributesSagittal = a;
00375     setHasOwnGridAttributes( circular, true );
00376     update();
00377     emit propertiesChanged();
00378 }

void KDChart::AbstractCoordinatePlane::setGridNeedsRecalculate  )  [inherited]
 

Used by the chart to clear the cached grid data.

Definition at line 170 of file KDChartAbstractCoordinatePlane.cpp.

References d.

Referenced by KDChart::Chart::resizeEvent().

00171 {
00172     d->grid->setNeedRecalculate();
00173 }

void KDChart::AbstractCoordinatePlane::setParent Chart parent  )  [inherited]
 

Called internally by KDChart::Chart.

Definition at line 185 of file KDChartAbstractCoordinatePlane.cpp.

References d.

Referenced by KDChart::Chart::addCoordinatePlane(), and KDChart::Chart::takeCoordinatePlane().

00186 {
00187     d->parent = parent;
00188 }

void KDChart::AbstractLayoutItem::setParentLayout QLayout *  lay  )  [inherited]
 

Definition at line 70 of file KDChartLayoutItems.h.

00071         {
00072             mParentLayout = lay;
00073         }

void KDChart::AbstractLayoutItem::setParentWidget QWidget widget  )  [virtual, inherited]
 

Inform the item about its widget: This enables the item, to trigger that widget's update, whenever the size of the item's contents has changed.

Thus, you need to call setParentWidget on every item, that has a non-fixed size.

Definition at line 64 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::mParent.

Referenced by KDChart::Legend::buildLegend(), and KDChart::AbstractCartesianDiagram::takeAxis().

00065 {
00066     mParent = widget;
00067 }

void KDChart::AbstractCoordinatePlane::setReferenceCoordinatePlane AbstractCoordinatePlane plane  )  [inherited]
 

Set another coordinate plane to be used as the reference plane for this one.

Parameters:
plane The coordinate plane to be used the reference plane for this one.
See also:
referenceCoordinatePlane

Definition at line 175 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00176 {
00177     d->referenceCoordinatePlane = plane;
00178 }

void PolarCoordinatePlane::setStartPosition qreal  degrees  ) 
 

Specify the rotation of the coordinate plane.

In a Pie diagram this indicates the position where the first pie starts, in a Polar diagram it specifies the Zero position of the circular axis.

See also:
startPosition

Definition at line 313 of file KDChartPolarCoordinatePlane.cpp.

References d, and KDChart::AbstractCoordinatePlane::diagram().

00314 {
00315     Q_ASSERT_X ( diagram(), "PolarCoordinatePlane::setStartPosition",
00316                  "setStartPosition() needs a diagram to be associated to the plane." );
00317     d->coordinateTransformations[0].startPosition = degrees;
00318 }

void PolarCoordinatePlane::setZoomCenter QPointF  center  )  [virtual]
 

Set the point (in value coordinates) to be used as the center point in zoom operations.

Parameters:
center The point to use.

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 352 of file KDChartPolarCoordinatePlane.cpp.

References d.

00353 {
00354     d->coordinateTransformations[0].zoom.xCenter = center.x();
00355     d->coordinateTransformations[0].zoom.yCenter = center.y();
00356 }

void PolarCoordinatePlane::setZoomFactorX double  factor  )  [virtual]
 

Sets the zoom factor in horizontal direction, that is applied to all coordinate transformations.

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 337 of file KDChartPolarCoordinatePlane.cpp.

References d.

00338 {
00339     d->coordinateTransformations[0].zoom.xFactor = factor;
00340 }

void PolarCoordinatePlane::setZoomFactorY double  factor  )  [virtual]
 

Sets the zoom factor in vertical direction, that is applied to all coordinate transformations.

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 342 of file KDChartPolarCoordinatePlane.cpp.

References d.

00343 {
00344     d->coordinateTransformations[0].zoom.yFactor = factor;
00345 }

QSize KDChart::AbstractCoordinatePlane::sizeHint  )  const [virtual, inherited]
 

pure virtual in QLayoutItem

Definition at line 225 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::maximumSize().

00226 {
00227     // we return our maxiumu (which is the full size of the Chart)
00228     // even if we know the plane will be smaller
00229     return maximumSize();
00230 }

void KDChart::AbstractLayoutItem::sizeHintChanged  )  const [virtual, inherited]
 

Report changed size hint: ask the parent widget to recalculate the layout.

Definition at line 86 of file KDChartLayoutItems.cpp.

Referenced by KDChart::TextLayoutItem::sizeHint().

00087 {
00088     // This is exactly like what QWidget::updateGeometry does.
00089 //  qDebug("KDChart::AbstractLayoutItem::sizeHintChanged() called");
00090     if( mParent ) {
00091         if ( mParent->layout() )
00092             mParent->layout()->invalidate();
00093         else
00094             QApplication::postEvent( mParent, new QEvent( QEvent::LayoutRequest ) );
00095     }
00096 }

QSizePolicy KDChart::AbstractCoordinatePlane::sizePolicy  )  const [virtual, inherited]
 

[reimplemented]

Definition at line 146 of file KDChartAbstractCoordinatePlane.cpp.

00147 {
00148     return QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
00149 }

qreal PolarCoordinatePlane::startPosition  )  const
 

Retrieve the rotation of the coordinate plane.

See also:
setStartPosition

Definition at line 320 of file KDChartPolarCoordinatePlane.cpp.

References d.

Referenced by layoutDiagrams(), and KDChart::PieDiagram::paint().

00321 {
00322     return d->coordinateTransformations.size()
00323         ?  d->coordinateTransformations[0].startPosition
00324         :  0.0;
00325 }

void AbstractCoordinatePlane::takeDiagram AbstractDiagram diagram  )  [virtual, inherited]
 

Removes the diagram from the plane, without deleting it.

The plane no longer owns the diagram, so it is the caller's responsibility to delete the diagram.

See also:
addDiagram, replaceDiagram

Definition at line 100 of file KDChartAbstractCoordinatePlane.cpp.

References d, KDChart::AbstractCoordinatePlane::layoutDiagrams(), and KDChart::AbstractDiagram::setCoordinatePlane().

Referenced by KDChart::AbstractCoordinatePlane::replaceDiagram().

00101 {
00102     const int idx = d->diagrams.indexOf( diagram );
00103     if( idx != -1 ){
00104         d->diagrams.removeAt( idx );
00105         diagram->setParent( 0 );
00106         diagram->setCoordinatePlane( 0 );
00107         layoutDiagrams();
00108         update();
00109     }
00110 }

int AbstractArea::topOverlap bool  doNotRecalculate = false  )  const [virtual, inherited]
 

This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().

The method triggers AbstractArea::sizeHint() to find out the amount of overlap at the top edge of the area.

Note:
The default implementation is not using any caching, it might make sense to implement a more sophisticated solution for derived classes that have complex work to do in sizeHint(). All we have here is a primitive flag to be set by the caller if it is sure that no sizeHint() needs to be called.

Definition at line 93 of file KDChartAbstractArea.cpp.

References d.

Referenced by KDChart::AutoSpacerLayoutItem::sizeHint().

00094 {
00095     // Re-calculate the sizes,
00096     // so we also get the amountOf..Overlap members set newly:
00097     if( ! doNotRecalculate )
00098         sizeHint();
00099     return d->amountOfTopOverlap;
00100 }

const QPointF PolarCoordinatePlane::translate const QPointF &  diagramPoint  )  const [virtual]
 

Translate the given point in value space coordinates to a position in pixel space.

Parameters:
diagramPoint The point in value coordinates.
Returns:
The translated point.

Implements KDChart::AbstractCoordinatePlane.

Definition at line 280 of file KDChartPolarCoordinatePlane.cpp.

References d.

Referenced by buildReferenceRect().

00281 {
00282     Q_ASSERT_X ( d->currentTransformation != 0, "PolarCoordinatePlane::translate",
00283                  "Only call translate() from within paint()." );
00284     return  d->currentTransformation->translate ( diagramPoint );
00285 }

const QPointF PolarCoordinatePlane::translatePolar const QPointF &  diagramPoint  )  const
 

Definition at line 287 of file KDChartPolarCoordinatePlane.cpp.

References d.

00288 {
00289     Q_ASSERT_X ( d->currentTransformation != 0, "PolarCoordinatePlane::translate",
00290                  "Only call translate() from within paint()." );
00291     return  d->currentTransformation->translatePolar ( diagramPoint );
00292 }

QPointF PolarCoordinatePlane::zoomCenter  )  const [virtual]
 

Returns:
The center point (in value coordinates) of the coordinate plane, that is used for zoom operations.

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 347 of file KDChartPolarCoordinatePlane.cpp.

References d.

00348 {
00349     return QPointF( d->coordinateTransformations[0].zoom.xCenter, d->coordinateTransformations[0].zoom.yCenter );
00350 }

double PolarCoordinatePlane::zoomFactorX  )  const [virtual]
 

Returns:
The zoom factor in horizontal direction, that is applied to all coordinate transformations.

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 327 of file KDChartPolarCoordinatePlane.cpp.

References d.

00328 {
00329     return d->coordinateTransformations[0].zoom.xFactor;
00330 }

double PolarCoordinatePlane::zoomFactorY  )  const [virtual]
 

Returns:
The zoom factor in vertical direction, that is applied to all coordinate transformations.

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 332 of file KDChartPolarCoordinatePlane.cpp.

References d.

00333 {
00334     return d->coordinateTransformations[0].zoom.yFactor;
00335 }


Member Data Documentation

Q_SIGNALS KDChart::AbstractCoordinatePlane::__pad0__ [inherited]
 

Reimplemented from KDChart::AbstractArea.

Definition at line 297 of file KDChartAbstractCoordinatePlane.h.

QWidget* KDChart::AbstractLayoutItem::mParent [protected, inherited]
 

Definition at line 88 of file KDChartLayoutItems.h.

Referenced by KDChart::AbstractLayoutItem::setParentWidget().

QLayout* KDChart::AbstractLayoutItem::mParentLayout [protected, inherited]
 

Definition at line 89 of file KDChartLayoutItems.h.

protected KDChart::PolarCoordinatePlane::Q_SLOTS [protected]
 

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 154 of file KDChartPolarCoordinatePlane.h.


The documentation for this class was generated from the following files:
Generated on Thu May 10 11:06:34 2007 for KD Chart 2 by doxygen 1.3.6