GeopsyGui/TimeWindowList.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of GeopsyGui.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created: 2011-01-28
00022 **  Authors:
00023 **    Marc Wathelet (ISTerre, Grenoble, France)
00024 **
00025 ***************************************************************************/
00026 
00027 #ifndef TIMEWINDOWLIST_H
00028 #define TIMEWINDOWLIST_H
00029 
00030 #include <GeopsyCore.h>
00031 
00032 #include "GeopsyGuiDLLExport.h"
00033 #include "TimeWindow.h"
00034 
00035 namespace GeopsyGui {
00036 
00037   class GEOPSYGUI_EXPORT TimeWindowList: public TimeRangeList, public XMLClass
00038   {
00039   public:
00040     TimeWindowList()
00041       : TimeRangeList(), XMLClass(), _defaultColor(QColor(200, 255, 193)) {}
00042     TimeWindowList(const TimeWindowList& o, int firstIndex)
00043       : TimeRangeList(o, firstIndex), XMLClass(), _defaultColor(QColor(200, 255, 193)) {}
00044     ~TimeWindowList();
00045 
00046     virtual const QString& xml_tagName() const {return xmlTimeWindowListTag;}
00047     static const QString xmlTimeWindowListTag;
00048 
00049     void setDefaultColor(const QColor& c) {_defaultColor=c;}
00050     const QColor& defaultColor() const {return _defaultColor;}
00051     void resetColors();
00052 
00053     TimeWindow& addOne(const TimeRange& r) {return static_cast<TimeWindow&>(TimeRangeList::addOne(r));}
00054     TimeWindow& addOne() {return static_cast<TimeWindow&>(TimeRangeList::addOne());}
00055 
00056     const TimeWindow& at(int index) const {return static_cast<const TimeWindow&>(TimeRangeList::at(index));}
00057     TimeWindow& at(int index) {return static_cast<TimeWindow&>(TimeRangeList::at(index));}
00058   protected:
00059     virtual TimeRange * newTimeRange(double start, double end) {return new TimeWindow(start, end, _defaultColor);}
00060     virtual TimeRange * cloneTimeRange(TimeRange * r) {return new TimeWindow(*static_cast<TimeWindow *>(r));}
00061     virtual void deleteTimeRange(TimeRange * r) {delete static_cast<TimeWindow *>(r);}
00062 
00063     virtual void xml_writeProperties(XML_WRITEPROPERTIES_ARGS) const;
00064     virtual XMLMember xml_member(XML_MEMBER_ARGS);
00065     virtual bool xml_setProperty(XML_SETPROPERTY_ARGS);
00066   private:
00067     QColor _defaultColor;
00068   };
00069 
00070 } // namespace GeopsyGui
00071 
00072 #endif // TIMEWINDOWLIST_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines