SaltyPaws / calculator_pi

This is a light weight yet powerful calculator plugin for OpenCPN. Would you like to know your hull speed?
4 stars 7 forks source link

Units for additional Angle conversions (DD, DDM, DMS, Radians) #24

Open rgleason opened 6 years ago

rgleason commented 6 years ago

this->mUnit.Add(("Degree (\u00b0)")); this->m_Unitcategory.Add(("Angle")); this->mConversion.Add(("1")); this->mDisplay.Add(("TRUE"));

versis this one which I guess is not used (false)

this->mUnit.Add(("Degree")); this->m_Unitcategory.Add(("Angle")); this->mConversion.Add(("1")); this->mDisplay.Add(("FALSE"));

I assume this definition was wrong and caused the 0 I am trying to understand how it works.. What is the \u00b0 for? --- Unicode for the degree sign

rgleason commented 6 years ago

Note: units_conversion is autogenerated by functions2cpp.pl Which is a perl script that uses the spreadsheet to add functions and units. Has anyone other than SaltyPaws done this?

It looks like we add new units and definitions to the spreadsheet and then it must run the perl script somehow. I don't have perl on this win10 machine. Probably built into linx though.

README In order to install the perl dependancies use (linux): sudo cpan Spreadsheet::WriteExcel Digest::Perl:MD5 Unicode::Map IO::Scalar Crypt::RC4

rgleason commented 6 years ago

The spreadsheet name & path is src/Functions/Functions.xls and it has a Functions Tab and a Units Tab. It appears this spreadsheet is the place all modifications and new functions and units are entered.

NOTE that Functions.cpp is AutoGenerated by running a Perl script and injesting the spreadsheet. I believe additions and changes are made in the spreadsheet. So any changes made in functions.cpp should be added to the spreadsheet, or they will be lost the next time the file is generated.

rgleason commented 6 years ago

In Unicode
Degrees (/u00b0) Minutes (/u0027) Seconds (/u2033) Degrees(/u00b0) Decimal Minutes (/0027)

In the spreadsheet Units Tab we need to add two new Unit Class = "Angle" Enter in the columns

Unit --> Degrees (/u00b0) Minutes (/u0027) Seconds (/u2033) Unit Class --> Angle Category --> need formula Part of Pulldown --> True

Unit --> Degrees(/u00b0) Decimal Minutes (/0027) Unit Class --> Angle Category --> need formula Part of Pulldown --> TRUE

I think we need to add some functions similar to https://github.com/jachappell/decimal-degrees-and-degrees-minutes-and-seconds I think the formula would be like this C++ functions to convert between decimal degrees and degrees, minutes, and seconds

Which the formulas will use.

Then the perl script needs to be run with the spreadsheet to generate functions.cpp and units_conversion.cpp

SaltyPaws commented 6 years ago

The reason why I did this is that when I add a degree sign in wxformwidgets, it will show the character. this does not compile in Windows, and that is why I run the script degree_fix.sh. This script replaces the degree symbol with the /u00b0 which compiles in windows.

rgleason commented 6 years ago

I think windows is a picky pain at times, but it is what a lot of us have. Thanks for explaining the script and why.

Is it possible to have these choices? Decimal Degrees Degrees Decimal Minutes Degrees Minutes Seconds?

SaltyPaws commented 6 years ago

Yes, I will update this.

rgleason commented 6 years ago

Great, maybe Radians ( I think you have that already)