kig
conic_imp.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef KIG_OBJECTS_CONIC_IMP_H
00019 #define KIG_OBJECTS_CONIC_IMP_H
00020
00021 #include "curve_imp.h"
00022
00023 #include "../misc/conic-common.h"
00024 #include "../misc/equation.h"
00025
00039 class ConicImp
00040 : public CurveImp
00041 {
00042 protected:
00043 ConicImp();
00044 ~ConicImp();
00045 public:
00046 typedef CurveImp Parent;
00050 static const ObjectImpType* stype();
00051
00052 ObjectImp* transform( const Transformation& ) const;
00053
00054 void draw( KigPainter& p ) const;
00055 bool contains( const Coordinate& p, int width, const KigWidget& ) const;
00056 bool inRect( const Rect& r, int width, const KigWidget& ) const;
00057 bool valid() const;
00058 Rect surroundingRect() const;
00059
00060 int numberOfProperties() const;
00061 const ObjectImpType* impRequirementForProperty( int which ) const;
00062 bool isPropertyDefinedOnOrThroughThisImp( int which ) const;
00063 const QByteArrayList properties() const;
00064 const QByteArrayList propertiesInternalNames() const;
00065 const char* iconForProperty( int which ) const;
00066 ObjectImp* property( int which, const KigDocument& w ) const;
00067
00068 double getParam( const Coordinate& point, const KigDocument& ) const;
00069 const Coordinate getPoint( double param, const KigDocument& ) const;
00070
00071
00072
00073 double getParam( const Coordinate& point ) const;
00074 const Coordinate getPoint( double param ) const;
00075
00076
00077
00078
00079
00087 virtual int conicType() const;
00091 virtual QString conicTypeString() const;
00096 virtual QString cartesianEquationString( const KigDocument& w ) const;
00102 virtual QString polarEquationString( const KigDocument& w ) const;
00106 virtual const ConicCartesianData cartesianData() const;
00110 virtual const ConicPolarData polarData() const = 0;
00114 virtual Coordinate coniccenter() const;
00118 virtual Coordinate focus1() const;
00122 virtual Coordinate focus2() const;
00123
00124 const ObjectImpType* type() const;
00125 void visit( ObjectImpVisitor* vtor ) const;
00126
00127 bool equals( const ObjectImp& rhs ) const;
00128
00129 bool containsPoint( const Coordinate& p, const KigDocument& doc ) const;
00130 bool internalContainsPoint( const Coordinate& p, double threshold ) const;
00131 bool isVerticalParabola( ConicCartesianData& data ) const;
00132 };
00133
00138 class ConicImpCart
00139 : public ConicImp
00140 {
00141 protected:
00142 ConicCartesianData mcartdata;
00143 ConicPolarData mpolardata;
00144 public:
00145 ConicImpCart( const ConicCartesianData& data );
00146 ~ConicImpCart();
00147 ConicImpCart* copy() const;
00148
00149 const ConicCartesianData cartesianData() const;
00150 const ConicPolarData polarData() const;
00151 };
00152
00157 class ConicImpPolar
00158 : public ConicImp
00159 {
00160 ConicPolarData mdata;
00161 public:
00162 ConicImpPolar( const ConicPolarData& data );
00163 ~ConicImpPolar();
00164 ConicImpPolar* copy() const;
00165
00166 const ConicPolarData polarData() const;
00167 };
00168
00172 class ConicArcImp
00173 : public ConicImpCart
00174 {
00175 double msa;
00176 double ma;
00177 public:
00178 typedef CurveImp Parent;
00182 static const ObjectImpType* stype();
00187 ConicArcImp( const ConicCartesianData& data,
00188 const double startangle, const double angle );
00189 ~ConicArcImp();
00190
00191 ConicArcImp* copy() const;
00192
00193 ObjectImp* transform( const Transformation& t ) const;
00194 bool contains( const Coordinate& p, int width, const KigWidget& ) const;
00195 bool containsPoint( const Coordinate& p, const KigDocument& doc ) const;
00196 bool internalContainsPoint( const Coordinate& p, double threshold,
00197 const KigDocument& doc ) const;
00198
00199 int numberOfProperties() const;
00200 const QByteArrayList properties() const;
00201 const QByteArrayList propertiesInternalNames() const;
00202 ObjectImp* property( int which, const KigDocument& w ) const;
00203 const char* iconForProperty( int which ) const;
00204 bool isPropertyDefinedOnOrThroughThisImp( int which ) const;
00205
00206 double getParam( const Coordinate& point, const KigDocument& ) const;
00207 const Coordinate getPoint( double param, const KigDocument& ) const;
00208
00209 double getParam( const Coordinate& point ) const;
00210 const Coordinate getPoint( double param ) const;
00211
00215 void setStartAngle( double sa ) { msa = sa; }
00219 void setAngle( double a ) { ma = a; }
00223 Coordinate firstEndPoint() const;
00227 Coordinate secondEndPoint() const;
00228
00229 const ObjectImpType* type() const;
00230 };
00231
00232 #endif