00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef KIG_OBJECTS_LINE_IMP_H
00019 #define KIG_OBJECTS_LINE_IMP_H
00020
00021 #include "curve_imp.h"
00022
00023 #include "../misc/common.h"
00024
00025 class LineData;
00026
00031 class AbstractLineImp
00032 : public CurveImp
00033 {
00034 protected:
00035 LineData mdata;
00036 AbstractLineImp( const LineData& d );
00037 AbstractLineImp( const Coordinate& a, const Coordinate& b );
00038
00039 public:
00040 typedef CurveImp Parent;
00045 static const ObjectImpType* stype();
00046
00047 ~AbstractLineImp();
00048
00049 bool inRect( const Rect& r, int width, const KigWidget& ) const;
00050
00051 const uint numberOfProperties() const;
00052 const QCStringList properties() const;
00053 const QCStringList propertiesInternalNames() const;
00054 ObjectImp* property( uint which, const KigDocument& d ) const;
00055 const char* iconForProperty( uint which ) const;
00056 const ObjectImpType* impRequirementForProperty( uint which ) const;
00057 bool isPropertyDefinedOnOrThroughThisImp( uint which ) const;
00058
00064 double slope() const;
00069 const TQString equationString() const;
00073 LineData data() const;
00074
00075 bool equals( const ObjectImp& rhs ) const;
00076 };
00077
00081 class SegmentImp
00082 : public AbstractLineImp
00083 {
00084 public:
00085 typedef AbstractLineImp Parent;
00090 static const ObjectImpType* stype();
00091
00095 SegmentImp( const Coordinate& a, const Coordinate& b );
00099 SegmentImp( const LineData& d );
00100
00101 void draw( KigPainter& p ) const;
00102 bool contains( const Coordinate& p, int width, const KigWidget& si ) const;
00103 Rect surroundingRect() const;
00104
00105 ObjectImp* transform( const Transformation& ) const;
00106
00107 const Coordinate getPoint( double param, const KigDocument& ) const;
00108 double getParam( const Coordinate&, const KigDocument& ) const;
00109
00110 const uint numberOfProperties() const;
00111 const QCStringList properties() const;
00112 const QCStringList propertiesInternalNames() const;
00113 ObjectImp* property( uint which, const KigDocument& d ) const;
00114 const char* iconForProperty( uint which ) const;
00115 const ObjectImpType* impRequirementForProperty( uint which ) const;
00116
00117 SegmentImp* copy() const;
00118
00122 double length() const;
00123
00124 const ObjectImpType* type() const;
00125 void visit( ObjectImpVisitor* vtor ) const;
00126
00127 bool containsPoint( const Coordinate& p, const KigDocument& doc ) const;
00128 bool internalContainsPoint( const Coordinate& p, double threshold ) const;
00129 };
00130
00136 class RayImp
00137 : public AbstractLineImp
00138 {
00139 public:
00140 typedef AbstractLineImp Parent;
00145 static const ObjectImpType* stype();
00146
00150 RayImp( const Coordinate& a, const Coordinate& b );
00154 RayImp( const LineData& d );
00155
00156 void draw( KigPainter& p ) const;
00157 bool contains( const Coordinate& p, int width, const KigWidget& si ) const;
00158 Rect surroundingRect() const;
00159
00160 ObjectImp* transform( const Transformation& ) const;
00161
00162 const Coordinate getPoint( double param, const KigDocument& ) const;
00163 double getParam( const Coordinate&, const KigDocument& ) const;
00164
00165 RayImp* copy() const;
00166
00167 const ObjectImpType* type() const;
00168 void visit( ObjectImpVisitor* vtor ) const;
00169
00170 bool containsPoint( const Coordinate& p, const KigDocument& doc ) const;
00171 bool internalContainsPoint( const Coordinate& p, double threshold ) const;
00172 };
00173
00177 class LineImp
00178 : public AbstractLineImp
00179 {
00180 public:
00181 typedef AbstractLineImp Parent;
00182
00187 static const ObjectImpType* stype();
00188
00192 LineImp( const Coordinate& a, const Coordinate& b );
00196 LineImp( const LineData& d );
00197 void draw( KigPainter& p ) const;
00198 bool contains( const Coordinate& p, int width, const KigWidget& si ) const;
00199 Rect surroundingRect() const;
00200
00201 ObjectImp* transform( const Transformation& ) const;
00202
00203 const Coordinate getPoint( double param, const KigDocument& ) const;
00204 double getParam( const Coordinate&, const KigDocument& ) const;
00205
00206 LineImp* copy() const;
00207
00208 const ObjectImpType* type() const;
00209 void visit( ObjectImpVisitor* vtor ) const;
00210
00211 bool containsPoint( const Coordinate& p, const KigDocument& doc ) const;
00212 bool internalContainsPoint( const Coordinate& p, double threshold ) const;
00213 };
00214
00215 #endif