00001 /****************************************************************************** 00002 * Copyright (C) 2015 by Ralf Kaestner * 00003 * ralf.kaestner@gmail.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the Lesser GNU General Public License as published by* 00007 * the Free Software Foundation; either version 3 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * Lesser GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the Lesser GNU General Public License * 00016 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 00017 ******************************************************************************/ 00018 00019 #ifndef RQT_MULTIPLOT_BOUNDING_RECTANGLE_H 00020 #define RQT_MULTIPLOT_BOUNDING_RECTANGLE_H 00021 00022 #include <QPair> 00023 #include <QPointF> 00024 #include <QRectF> 00025 00026 namespace rqt_multiplot { 00027 class BoundingRectangle { 00028 public: 00029 BoundingRectangle(const QPointF& minimum = QPointF(0.0, 0.0), 00030 const QPointF& maximum = QPointF(-1.0, -1.0)); 00031 BoundingRectangle(const QRectF& rectangle); 00032 BoundingRectangle(const BoundingRectangle& src); 00033 ~BoundingRectangle(); 00034 00035 void setMinimum(const QPointF& minimum); 00036 QPointF& getMinimum(); 00037 const QPointF& getMinimum() const; 00038 void setMaximum(const QPointF& maximum); 00039 QPointF& getMaximum(); 00040 const QPointF& getMaximum() const; 00041 QRectF getRectangle() const; 00042 bool isValid() const; 00043 bool isEmpty() const; 00044 bool contains(const QPointF& point) const; 00045 00046 void initialize(const QPointF& point); 00047 void clear(); 00048 00049 bool operator==(const BoundingRectangle& rectangle) const; 00050 bool operator!=(const BoundingRectangle& rectangle) const; 00051 00052 BoundingRectangle& operator+=(const QPointF& point); 00053 BoundingRectangle& operator+=(const BoundingRectangle& rectangle); 00054 00055 private: 00056 QPointF minimum_; 00057 QPointF maximum_; 00058 }; 00059 }; 00060 00061 #endif