1: using System.Data;
2:
3: namespace Ia.TentPlay.Cl.Model.Business.Trek
4: {
5: ////////////////////////////////////////////////////////////////////////////
6:
7: /// <summary publish="true">
8: /// Feature class for TentPlay Trek business model
9: /// </summary>
10: ///
11: /// <remarks>
12: /// Copyright © 2012-2016 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
13: ///
14: /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
15: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
16: ///
17: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
18: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19: ///
20: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
21: ///
22: /// Copyright notice: This notice may not be removed or altered from any source distribution.
23: /// </remarks>
24: public partial class Feature
25: {
26: /// <summary/>
27: public Feature() { }
28:
29: ///<summary/>
30: public int Ufi { get; set; }
31:
32: ///<summary/>
33: public int Rk { get; set; }
34:
35: ///<summary/>
36: public decimal LatDd { get; set; }
37:
38: ///<summary/>
39: public decimal LongDd { get; set; }
40:
41: ///<summary/>
42: public string DMS_LAT { get; set; }
43:
44: ///<summary/>
45: public string DMS_LONG { get; set; }
46:
47: ///<summary/>
48: public string MGRS { get; set; }
49:
50: ///<summary/>
51: public string JOG { get; set; }
52:
53: ///<summary/>
54: public string Fc { get; set; }
55:
56: ///<summary/>
57: public string DesigCd { get; set; }
58:
59: ///<summary/>
60: public int PC { get; set; }
61:
62: ///<summary/>
63: public string CcFt { get; set; }
64:
65: ///<summary/>
66: public string Adm1 { get; set; }
67:
68: ///<summary/>
69: public string NOTE { get; set; }
70:
71: ///<summary/>
72: public string MODIFY_DATE { get; set; }
73:
74: ///<summary/>
75: public string DISPLAY { get; set; }
76:
77: ///<summary/>
78: public string F_EFCTV_DT { get; set; }
79:
80: ///<summary/>
81: public string F_TERM_DT { get; set; }
82:
83: /// <summary/>
84: public virtual ICollection<FeatureName> FeatureNames { get; set; }
85:
86: ///<summary/>
87: public string UsFeatureName { get; set; }
88:
89: ///<summary/>
90: public string UsFeatureNoDiacriticLowerCaseName { get; set; }
91:
92: ///<summary/>
93: public string UsFeatureNativeName { get; set; }
94:
95: /// <summary/>
96: public FeatureName ProperNameFeature
97: {
98: get
99: {
100: FeatureName featureName;
101:
102: featureName = (from fn in this.FeatureNames where fn.Ufi == this.Ufi && (fn.Nt == "N" || fn.Nt == "C") select fn).FirstOrDefault();
103:
104: return featureName;
105: }
106: }
107:
108: /// <summary/>
109: public FeatureName ProperNativeNameFeature
110: {
111: get
112: {
113: FeatureName featureName;
114:
115: featureName = (from fn in this.FeatureNames where fn.Ufi == this.Ufi && (fn.Nt == "NS") select fn).FirstOrDefault();
116:
117: // below: remove all non-latin characters, subject references then remove double spaces
118: //s = Ia.Cl.Model.Language.RemoveNonLatinCharacters(FULL_NAME_ND_RO);
119: //s = Ia.Cl.Model.Language.RemoveLatinTransliterationsOfSubjectReferencesOfNativeWordTransliterationAccordingToLanguagee(iso6393, s);
120:
121: /*
122: if (!result.HasError)
123: {
124: // below: first loop: collect fix, defined translations
125: foreach (DataRow r in dataTable.Rows)
126: {
127: id = r["id"].ToString();
128: UFI = int.Parse(r["ufi"].ToString());
129:
130: iso6393 = r["language"].ToString();
131: iso3 = r["country"].ToString();
132:
133: if (ufiToNsHashtable.ContainsKey(UFI))
134: {
135: // we have a native translation and we will assign it to native_name
136: u = ufiToNsHashtable[UFI].ToString();
137: u = u.Trim();
138:
139: s = Ia.Cl.Model.Language.ConvertSingleLatinDigitsToNativeWordEquivalentAccordingToLanguage(iso6393, u);
140:
141: s = Ia.Cl.Model.Language.RemoveNonNativeAndNonNativeExtendedLettersAndDigitsAccordingToLanguage(iso6393, s);
142: s = s.Trim();
143:
144: // below: store this as a good translation
145: //ParseTransliterationsAndArabicAndStoreThemIntoHashtable(ufiToName[UFI].ToString().Trim(), s.Trim(), ref latinTransliterationToArabic);
146:
147: //r["transliterated_name"] = u;
148: r["native_name"] = s;
149: }
150: else
151: {
152: result.AddWarning("ufiToNs does not contain UFI: " + UFI + ". ");
153: }
154: }
155:
156: dataTable.AcceptChanges();
157:
158: // below: second loop: user built hashtable of fixed and defined translations here
159: foreach (DataRow r in dataTable.Rows)
160: {
161: id = r["id"].ToString();
162: UFI = int.Parse(r["ufi"].ToString());
163:
164: iso6393 = r["language"].ToString();
165: iso3 = r["country"].ToString();
166:
167: if (ufiToNsHashtable.ContainsKey(UFI))
168: {
169: // nothing, just skipping
170: }
171: else if (ufiToNameHashtable.ContainsKey(UFI))
172: {
173: // below: we will check if a proper translation had been used before. If there was no native translation given,
174: // we will attempt to produce a native equivelate of the latin transliteration
175:
176: v = "";
177: s = ufiToNameHashtable[UFI].ToString();
178:
179: /*
180: if (latinTransliterationToArabic.ContainsKey(s))
181: {
182: t = latinTransliterationToArabic[s].ToString();
183: }
184: else
185: {
186: * /
187: // below: we will parse the tranliteration and attempt to construct a translation
188:
189: string[] sp;
190:
191: anApproximateConversion = false;
192: anExactMultiwordConversion = false;
193:
194: // below: exact explicit conversion for multiple words
195: t = ProduceExactNativeTextOfMultipleLatinTransliterationsOfNativeWordsAccordingToCountry(iso3, s);
196:
197: if (t != s) anExactMultiwordConversion = true;
198:
199: if (anExactMultiwordConversion)
200: {
201: // below: store this as a good translation. DISABLED: not a good idea because of reverse in sentence word order.
202: // ParseTransliterationsAndArabicAndStoreThemIntoHashtable(s.Trim(), t.Trim(), ref latinTransliterationToArabic);
203: }
204: else
205: {
206: sp = s.Split(' ');
207: t = v = "";
208:
209: for (int j = 0; j < sp.Length; j++)
210: {
211: s = sp[j].ToString();
212:
213: // below: exact explicit conversion
214: u = Ia.Cl.Model.Language.ProduceExactNativeTextOfSingleLatinTransliterationsOfNativeWordsAccordingToLanguage(iso6393, s);
215:
216: // below: approximate conversion
217: w = Ia.Cl.Model.Language.ProduceApproximateNativeTextOfLatinTransliterationsOfNativeWordsAccrodingToLanguage(iso6393, u);
218:
219: if (w != u && !anApproximateConversion) anApproximateConversion = true;
220:
221: w = w.Trim();
222:
223: w = Ia.Cl.Model.Language.ConvertSingleLatinDigitsToNativeWordEquivalentAccordingToLanguage(iso6393, w);
224:
225: w = Ia.Cl.Model.Language.RemoveNonNativeAndNonNativeExtendedLettersAndDigitsAccordingToLanguage(iso6393, w);
226:
227: v += " " + s;
228: t += " " + w;
229:
230: // below: store this as a good translation
231: //ParseTransliterationsAndArabicAndStoreThemIntoHashtable(s.Trim(), w.Trim(), ref latinTransliterationToArabic);
232: //}
233: }
234:
235: // below: if there was an approximate conversion, we will construct
236: if (anApproximateConversion) v = "--------- [" + v.Trim() + "] ---------";
237: }
238: //}
239:
240: v = v.Trim();
241: t = t.Trim();
242:
243: r["transliterated_name"] = v;
244: r["native_name"] = "";// Ia.Cl.Model.Language.RemoveWrongSpaceBetweenNativeDefinitArticleAndItsWord(iso6393, t);
245: }
246: }
247: */
248:
249:
250: return featureName;
251: }
252: }
253:
254: ////////////////////////////////////////////////////////////////////////////
255: ////////////////////////////////////////////////////////////////////////////
256: }
257:
258: ////////////////////////////////////////////////////////////////////////////
259: ////////////////////////////////////////////////////////////////////////////
260: }