00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef KIG_OBJECTS_OTHER_IMP_H
00019 #define KIG_OBJECTS_OTHER_IMP_H
00020
00021 #include "curve_imp.h"
00022 #include "../misc/common.h"
00023 #include "../misc/coordinate.h"
00024
00028 class AngleImp
00029 : public ObjectImp
00030 {
00031 const Coordinate mpoint;
00032 const double mstartangle;
00033 const double mangle;
00034 public:
00035 typedef ObjectImp Parent;
00039 static const ObjectImpType* stype();
00040
00045 AngleImp( const Coordinate& pt, double start_angle_in_radials,
00046 double angle_in_radials );
00047 ~AngleImp();
00048
00049 ObjectImp* transform( const Transformation& ) const;
00050
00051 void draw( KigPainter& p ) const;
00052 bool contains( const Coordinate& p, int width, const KigWidget& ) const;
00053 bool inRect( const Rect& r, int width, const KigWidget& ) const;
00054 Rect surroundingRect() const;
00055
00056 Coordinate attachPoint() const;
00057 const uint numberOfProperties() const;
00058 const QCStringList properties() const;
00059 const QCStringList propertiesInternalNames() const;
00060 ObjectImp* property( uint which, const KigDocument& w ) const;
00061 const char* iconForProperty( uint which ) const;
00062 const ObjectImpType* impRequirementForProperty( uint which ) const;
00063 bool isPropertyDefinedOnOrThroughThisImp( uint which ) const;
00064
00065 ObjectImp* copy() const;
00066
00070 const double size() const;
00071 const ObjectImpType* type() const;
00072 void visit( ObjectImpVisitor* vtor ) const;
00073
00077 const Coordinate point() const { return mpoint; }
00081 const double startAngle() const { return mstartangle; }
00085 const double angle() const { return mangle; }
00086
00087 bool equals( const ObjectImp& rhs ) const;
00088 };
00089
00093 class VectorImp
00094 : public CurveImp
00095 {
00096 LineData mdata;
00097 public:
00098 typedef CurveImp Parent;
00102 static const ObjectImpType* stype();
00103
00107 VectorImp( const Coordinate& a, const Coordinate& b );
00108 ~VectorImp();
00109
00110 ObjectImp* transform( const Transformation& ) const;
00111
00112 const Coordinate getPoint( double param, const KigDocument& ) const;
00113 double getParam( const Coordinate&, const KigDocument& ) const;
00114
00115 void draw( KigPainter& p ) const;
00116 bool contains( const Coordinate& p, int width, const KigWidget& ) const;
00117 bool inRect( const Rect& r, int width, const KigWidget& ) const;
00118 Rect surroundingRect() const;
00119
00120 const uint numberOfProperties() const;
00121 const QCStringList properties() const;
00122 const QCStringList propertiesInternalNames() const;
00123 ObjectImp* property( uint which, const KigDocument& w ) const;
00124 const char* iconForProperty( uint which ) const;
00125 const ObjectImpType* impRequirementForProperty( uint which ) const;
00126 bool isPropertyDefinedOnOrThroughThisImp( uint which ) const;
00127
00128 VectorImp* copy() const;
00129
00133 const Coordinate dir() const;
00137 const Coordinate a() const;
00141 const Coordinate b() const;
00145 const double length() const;
00149 LineData data() const;
00150
00151 const ObjectImpType* type() const;
00152 void visit( ObjectImpVisitor* vtor ) const;
00153
00154 bool equals( const ObjectImp& rhs ) const;
00155
00156 bool containsPoint( const Coordinate& p, const KigDocument& doc ) const;
00157 bool internalContainsPoint( const Coordinate& p, double threshold ) const;
00158 };
00159
00163 class ArcImp
00164 : public CurveImp
00165 {
00166 Coordinate mcenter;
00167 double mradius;
00168 double msa;
00169 double ma;
00170 public:
00171 typedef CurveImp Parent;
00175 static const ObjectImpType* stype();
00176
00181 ArcImp( const Coordinate& center, const double radius,
00182 const double startangle, const double angle );
00183 ~ArcImp();
00184 ArcImp* copy() const;
00185
00186 ObjectImp* transform( const Transformation& t ) const;
00187
00188 void draw( KigPainter& p ) const;
00189 bool contains( const Coordinate& p, int width, const KigWidget& w ) const;
00190 bool inRect( const Rect& r, int width, const KigWidget& si ) const;
00191 Rect surroundingRect() const;
00192 bool valid() const;
00193
00194 const uint numberOfProperties() const;
00195 const QCStringList properties() const;
00196 const QCStringList propertiesInternalNames() const;
00197 ObjectImp* property( uint which, const KigDocument& d ) const;
00198 const char* iconForProperty( uint which ) const;
00199 const ObjectImpType* impRequirementForProperty( uint which ) const;
00200 bool isPropertyDefinedOnOrThroughThisImp( uint which ) const;
00201
00202 const ObjectImpType* type() const;
00203 void visit( ObjectImpVisitor* vtor ) const;
00204
00205 double getParam( const Coordinate& c, const KigDocument& d ) const;
00206 const Coordinate getPoint( double p, const KigDocument& d ) const;
00207
00211 const Coordinate center() const;
00215 double radius() const;
00219 double startAngle() const;
00223 double angle() const;
00227 Coordinate firstEndPoint() const;
00231 Coordinate secondEndPoint() const;
00235 const double sectorSurface() const;
00236
00237 bool equals( const ObjectImp& rhs ) const;
00238
00239 bool containsPoint( const Coordinate& p, const KigDocument& doc ) const;
00240 bool internalContainsPoint( const Coordinate& p, double threshold ) const;
00241 };
00242
00243 #endif