/* * LayoutVertical.hh * * Created on: Sep, 2, 2014 * Author: AKKA */ #ifndef LAYOUTVERTICAL_HH_ #define LAYOUTVERTICAL_HH_ #include #include #include #include #include "Layout.hh" namespace plot { class PanelInfo { public: PanelInfo (PanelConstraint constraint, double preferedWidth, double preferedHeight, double width, double height, bool isHeightFixed) : _constraint(constraint), _preferedWidth(preferedWidth), _preferedHeight(preferedHeight), _width(width), _height(height), _isHeightFixed(isHeightFixed) { } PanelConstraint _constraint; double _preferedWidth; double _preferedHeight; double _width; double _height; bool _isHeightFixed; }; /** * LayoutVertical */ class LayoutVertical : public Layout { public: LayoutVertical(double panelHeight, double panelSpacing, double firstPanelHeightFactor = 1.0, bool autoExpand = true, double xyRatio = 1.0, bool onlyLowerTimeAxesLegend = false) : Layout (panelHeight, panelSpacing, firstPanelHeightFactor, autoExpand, xyRatio, onlyLowerTimeAxesLegend), _curPanel(0), _curYPosition(0), _maxWidthConstraintFound(false), _computedPanelBounds(), _panelYSpacing(0), _firstPanelHeightDelta(0) { } virtual ~LayoutVertical() { for (auto panelInfo : _panelsInfo) { delete panelInfo; } _panelsInfo.clear(); } void computePanelsPosition (std::vector> _plots, std::map *parameterValues = NULL); private: void computeLayoutSize (double &layoutWidth, double &layoutHeight, double &fixedHeight); void expand (double ratio); int _curPanel; double _curYPosition; bool _maxWidthConstraintFound; Bounds _computedPanelBounds; double _panelYSpacing; double _firstPanelHeightDelta; std::vector _panelsInfo; void addPanel (PanelConstraint panelConstraint, double preferedWidth=-1, double preferedHeight=-1, bool isHeightFixed = false, double fixedHeight =0); void reset (void); Bounds & getNextBounds (PanelConstraint panelConstraint); }; } /* namespace plot */ #endif /* LAYOUTVERTICAL_HH_ */