SciFigs/CircleViewer.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of SciFigs.
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 : 2003-10-16
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (ULg, Liège, Belgium)
00025 **    Marc Wathelet (LGIT, Grenoble, France)
00026 **
00027 ***************************************************************************/
00028 
00029 #ifndef CIRCLEVIEWER_H
00030 #define CIRCLEVIEWER_H
00031 
00032 #include "GraphContentLayer.h"
00033 
00034 namespace SciFigs {
00035 
00036   class SCIFIGS_EXPORT CircleViewer :  public GraphContentLayer
00037   {
00038     Q_OBJECT
00039     Q_PROPERTY(double lineWeight READ lineWeight WRITE setLineWeight SCRIPTABLE true)
00040   public:
00041     CircleViewer(AxisWindow * parent=0);
00042 
00043     virtual const QString& xml_tagName() const {return xmlCircleViewerTag;}
00044     static const QString xmlCircleViewerTag;
00045 
00046     void resize(int n);
00047     int count() const {return _items.count();}
00048     void clear();
00049 
00050     double lineWeight() const {return _lineWeight;}
00051     void setLineWeight (double lw);
00052 
00053     virtual void paintData(const LayerPainterRequest& lp, QPainter& p, double dotpercm) const;
00054     virtual Rect boundingRect() const;
00055   public slots:
00056     void set(int index, double x, double y, double a, double b, double phi, QColor col);
00057     void add(double x, double y, double a, double b, double phi, QColor col);
00058     bool add(const QString& line);
00059     void insert(int index, double x, double y, double a, double b, double phi, QColor col);
00060     void remove(int index);
00061   protected:
00062     class SCIFIGS_EXPORT Item
00063     {
00064     public:
00065       Item() {}
00066       Item(const Item& o) {
00067         _ellipse=o._ellipse;
00068         _color=o._color;
00069       }
00070 
00071       Ellipse _ellipse;
00072       QColor _color;
00073     };
00074     QVector<Item> _items;
00075     double _lineWeight; // Line weight in cm
00076 
00077     class SCIFIGS_EXPORT Limits
00078     {
00079     public:
00080       Limits(const GraphContentOptions& gc);
00081 
00082       bool polarLimits(const Ellipse& ell, double& startphi, double& stopphi) const;
00083     private:
00084       // The four corners of the visible area
00085       Point2D _a,_b,_c,_d;
00086       // The four segments of the visible area
00087       Segment2D _ab,_bc,_cd,_da;
00088       // The rect
00089       Rect _visLimits;
00090     };
00091   protected:
00092     void xml_writeProperties(XML_WRITEPROPERTIES_ARGS) const;
00093     XMLMember xml_member(XML_MEMBER_ARGS);
00094     bool xml_setProperty(XML_SETPROPERTY_ARGS);
00095   };
00096 
00097 } // namespace SciFigs
00098 
00099 #endif // CIRCLEVIEWER_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines