Skip to content

Commit

Permalink
Add translete functions
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgGrebenyuk committed Aug 11, 2022
1 parent bced722 commit 6ff60aa
Showing 1 changed file with 78 additions and 1 deletion.
79 changes: 78 additions & 1 deletion src/exporter/tools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "pch.h"
#include "sstream"
#include <cassert>
#pragma warning( disable : 4996)

static double getLevelElevation(Renga::IModelObjectPtr pModelObject)
{
Expand All @@ -17,7 +18,7 @@ static bool compareLevelElevations(Renga::IModelObjectPtr pLeftModelObject, Reng
{
return getLevelElevation(pLeftModelObject) < getLevelElevation(pRightModelObject);
}
const char* get_type_as_str(GUID obj_type)
static const char* get_type_as_str(GUID obj_type)
{
const char* out_type;
if (obj_type == Renga::ObjectTypes::Undefined) out_type = "Unknown";
Expand Down Expand Up @@ -93,4 +94,80 @@ static std::vector <double> get_transformed_coords(double x, double y, double z,
double new_y = current_params.at(1) + x * sin(current_params.at(3)) + y * cos(current_params.at(3));
double new_z = current_params.at(2) + z;
return { new_x,new_y,new_z };
}
static void Transliterate(char* str, char* newStr)
{
for (; *str != 0; str++)
{
switch (str[0])
{
case 'à': strcat(&newStr[0], "a"); break;
case 'á': strcat(&newStr[0], "b"); break;
case 'â': strcat(&newStr[0], "v"); break;
case 'ã': strcat(&newStr[0], "g"); break;
case 'ä': strcat(&newStr[0], "d"); break;
case 'å': strcat(&newStr[0], "e"); break;
case '¸': strcat(&newStr[0], "ye"); break;
case 'æ': strcat(&newStr[0], "zh"); break;
case 'ç': strcat(&newStr[0], "z"); break;
case 'è': strcat(&newStr[0], "i"); break;
case 'é': strcat(&newStr[0], "y"); break;
case 'ê': strcat(&newStr[0], "k"); break;
case 'ë': strcat(&newStr[0], "l"); break;
case 'ì': strcat(&newStr[0], "m"); break;
case 'í': strcat(&newStr[0], "n"); break;
case 'î': strcat(&newStr[0], "o"); break;
case 'ï': strcat(&newStr[0], "p"); break;
case 'ð': strcat(&newStr[0], "r"); break;
case 'ñ': strcat(&newStr[0], "s"); break;
case 'ò': strcat(&newStr[0], "t"); break;
case 'ó': strcat(&newStr[0], "u"); break;
case 'ô': strcat(&newStr[0], "f"); break;
case 'õ': strcat(&newStr[0], "ch"); break;
case 'ö': strcat(&newStr[0], "z"); break;
case '÷': strcat(&newStr[0], "ch"); break;
case 'ø': strcat(&newStr[0], "sh"); break;
case 'ù': strcat(&newStr[0], "ch"); break;
case 'ú': strcat(&newStr[0], "''"); break;
case 'û': strcat(&newStr[0], "y"); break;
case 'ü': strcat(&newStr[0], "''"); break;
case 'ý': strcat(&newStr[0], "e"); break;
case 'þ': strcat(&newStr[0], "yu"); break;
case 'ÿ': strcat(&newStr[0], "ya"); break;
case 'À': strcat(&newStr[0], "A"); break;
case 'Á': strcat(&newStr[0], "B"); break;
case 'Â': strcat(&newStr[0], "V"); break;
case 'Ã': strcat(&newStr[0], "G"); break;
case 'Ä': strcat(&newStr[0], "D"); break;
case 'Å': strcat(&newStr[0], "E"); break;
case '¨': strcat(&newStr[0], "Ye"); break;
case 'Æ': strcat(&newStr[0], "Zh"); break;
case 'Ç': strcat(&newStr[0], "Z"); break;
case 'È': strcat(&newStr[0], "I"); break;
case 'É': strcat(&newStr[0], "Y"); break;
case 'Ê': strcat(&newStr[0], "K"); break;
case 'Ë': strcat(&newStr[0], "L"); break;
case 'Ì': strcat(&newStr[0], "M"); break;
case 'Í': strcat(&newStr[0], "N"); break;
case 'Î': strcat(&newStr[0], "O"); break;
case 'Ï': strcat(&newStr[0], "P"); break;
case 'Ð': strcat(&newStr[0], "R"); break;
case 'Ñ': strcat(&newStr[0], "S"); break;
case 'Ò': strcat(&newStr[0], "T"); break;
case 'Ó': strcat(&newStr[0], "U"); break;
case 'Ô': strcat(&newStr[0], "F"); break;
case 'Õ': strcat(&newStr[0], "Ch"); break;
case 'Ö': strcat(&newStr[0], "Z"); break;
case '×': strcat(&newStr[0], "Ch"); break;
case 'Ø': strcat(&newStr[0], "Sh"); break;
case 'Ù': strcat(&newStr[0], "Ch"); break;
case 'Ú': strcat(&newStr[0], "''"); break;
case 'Û': strcat(&newStr[0], "Y"); break;
case 'Ü': strcat(&newStr[0], "''"); break;
case 'Ý': strcat(&newStr[0], "E"); break;
case 'Þ': strcat(&newStr[0], "Yu"); break;
case 'ß': strcat(&newStr[0], "Ya"); break;
default: { char Temp[2] = { str[0], 0 }; strcat(&newStr[0], &Temp[0]); }
}
}
}

0 comments on commit 6ff60aa

Please sign in to comment.