remove CORS default header from PIHTTPServer fix several docs fix PIMathVector::dot return type add units directory with PIUnits facility
75 lines
1.9 KiB
C++
75 lines
1.9 KiB
C++
/*
|
|
PIP - Platform Independent Primitives
|
|
Angle units
|
|
Ivan Pelipenko peri4ko@yandex.ru
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Lesser General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "piunits_class_angle.h"
|
|
|
|
#include "pimathbase.h"
|
|
|
|
|
|
PIString PIUnits::Class::Angle::name(int type) const {
|
|
switch (type) {
|
|
case Degree: return "degree"_tr("PIUnitsAngle");
|
|
case Radian: return "radian"_tr("PIUnitsAngle");
|
|
}
|
|
return Class::Internal::unknown;
|
|
}
|
|
|
|
|
|
PIString PIUnits::Class::Angle::unit(int type) const {
|
|
switch (type) {
|
|
case Degree: return "°"_tr("PIUnitsAngle");
|
|
case Radian: return "rad"_tr("PIUnitsAngle");
|
|
}
|
|
return Class::Internal::unknown;
|
|
}
|
|
|
|
|
|
double PIUnits::Class::Angle::convert(double v, int from, int to) const {
|
|
switch (to) {
|
|
case Degree: return toDeg(v);
|
|
case Radian: return toRad(v);
|
|
}
|
|
return v;
|
|
}
|
|
|
|
|
|
PIString PIUnits::Class::Angle::valueToString(double v, char format, int prec) const {
|
|
return PIString::fromNumber(v, format, prec);
|
|
}
|
|
|
|
|
|
bool PIUnits::Class::Angle::supportPrefixes(int type) const {
|
|
return false;
|
|
}
|
|
|
|
|
|
bool PIUnits::Class::Angle::supportPrefixesNon3(int type) const {
|
|
return false;
|
|
}
|
|
|
|
|
|
bool PIUnits::Class::Angle::supportPrefixesGreater(int type) const {
|
|
return ClassBase::supportPrefixesGreater(type);
|
|
}
|
|
|
|
|
|
bool PIUnits::Class::Angle::supportPrefixesSmaller(int type) const {
|
|
return ClassBase::supportPrefixesSmaller(type);
|
|
}
|