Salome HOME
initial ver.
[modules/hydro.git] / src / HYDROData / HYDROData_Lambert93.cxx
index 504eab764b89d5bf1a41452834b9b648d01186ee..8a5d64fe1d5c14e5e71a977de3d6301262f8b5b2 100755 (executable)
@@ -1,4 +1,20 @@
-
+// Copyright (C) 2014-2015  EDF-R&D
+// This library 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 2.1 of the License, or (at your option) any later version.
+//
+// This library 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 library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
 
 #include <HYDROData_Lambert93.h>
 
@@ -332,3 +348,53 @@ void HYDROData_Lambert93::toGeo( double theX, double theY,
 
 }
 
+void HYDROData_Lambert93::DMSToDeg( int theDeg,
+                                    int theMin,
+                                    double theSec,
+                                    double& theDegOut )
+{
+  double aCoef = theDeg > 0 ? 1.0 : -1.0;
+
+  theDegOut = (double)theDeg;
+  theDegOut += aCoef * ( (double)theMin ) / 60.0;
+  theDegOut += aCoef * theSec / 3600.0;
+}
+
+void HYDROData_Lambert93::DMSToSec( int theDeg,
+                                    int theMin,
+                                    double theSec,
+                                    double& theSecOut )
+{
+  double aCoef = theDeg > 0 ? 1.0 : -1.0;
+
+  theSecOut = theDeg * 3600.0;
+  theSecOut += aCoef * theMin * 60.0;
+  theSecOut += aCoef * theSec;
+}
+
+void HYDROData_Lambert93::degToDMS( double theDegIn,
+                                    int& theDeg,
+                                    int& theMin,
+                                    double& theSec )
+{
+  theDeg = int( theDegIn );
+
+  double aRemainder = fabs( theDegIn - theDeg ) * 60.0;
+  theMin = int( aRemainder );
+
+  aRemainder = ( aRemainder - theMin ) * 60.0;
+  theSec = aRemainder;
+}
+
+void HYDROData_Lambert93::secToDMS( double theSecIn,
+                                    int& theDeg,
+                                    int& theMin,
+                                    double& theSec )
+{
+  theDeg = int( theSecIn / 3600.0 );
+
+  double aRemainder = fabs( theSecIn - theDeg * 3600.0 );
+  theMin = int( aRemainder / 60.0 );
+
+  theSec = fabs( aRemainder - theMin * 60.0 );
+}