KHTML
SVGAngle.h
Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 00003 2004, 2005, 2006 Rob Buis <buis@kde.org> 00004 00005 This file is part of the KDE project 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef SVGAngle_h 00024 #define SVGAngle_h 00025 00026 #if ENABLE(SVG) 00027 //#include "PlatformString.h" 00028 #include "wtf/RefCounted.h" 00029 #include "SVGNames.h" 00030 00031 namespace WebCore { 00032 00033 class SVGStyledElement; 00034 00035 class SVGAngle : public RefCounted<SVGAngle> { 00036 public: 00037 SVGAngle(); 00038 virtual ~SVGAngle(); 00039 00040 enum SVGAngleType { 00041 SVG_ANGLETYPE_UNKNOWN = 0, 00042 SVG_ANGLETYPE_UNSPECIFIED = 1, 00043 SVG_ANGLETYPE_DEG = 2, 00044 SVG_ANGLETYPE_RAD = 3, 00045 SVG_ANGLETYPE_GRAD = 4 00046 }; 00047 00048 SVGAngleType unitType() const; 00049 00050 void setValue(float); 00051 float value() const; 00052 00053 void setValueInSpecifiedUnits(float valueInSpecifiedUnits); 00054 float valueInSpecifiedUnits() const; 00055 00056 void setValueAsString(const String&); 00057 String valueAsString() const; 00058 00059 void newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits); 00060 void convertToSpecifiedUnits(unsigned short unitType); 00061 00062 // Helpers 00063 static double todeg(double rad); 00064 static double torad(double deg); 00065 00066 // Returns the angle that divides the shortest arc between the two angles. 00067 static double shortestArcBisector(double angle1, double angle2); 00068 00069 // Throughout SVG 1.1 'SVGAngle' is only used for 'SVGMarkerElement' (orient-angle) 00070 const QualifiedName& associatedAttributeName() const { return SVGNames::orientAttr; } 00071 00072 private: 00073 SVGAngleType m_unitType; 00074 float m_value; 00075 float m_valueInSpecifiedUnits; 00076 mutable String m_valueAsString; 00077 00078 void calculate(); 00079 }; 00080 00081 } // namespace WebCore 00082 00083 #endif // ENABLE(SVG) 00084 #endif // SVGAngle_h
KDE 4.6 API Reference