1:
2: namespace Ia.TentPlay.Cl.Model.Business.Trek
3: {
4: ////////////////////////////////////////////////////////////////////////////
5:
6: /// <summary publish="true">
7: /// FeatureClass Support class for TentPlay Trek business model
8: /// </summary>
9: ///
10: /// <remarks>
11: /// Copyright © 2012-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
12: ///
13: /// 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
14: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
15: ///
16: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
17: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18: ///
19: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
20: ///
21: /// Copyright notice: This notice may not be removed or altered from any source distribution.
22: /// </remarks>
23: public partial class FeatureClass
24: {
25: /*
26: public enum FeatureClassName
27: {
28: Administrative, Populated, Vegetation, Locality, Undersea, Street, Hypsographic, Hydrographic, Spot
29: }
30: */
31:
32: /// <summary/>
33: public FeatureClass() { }
34: /*
35: /// <summary/>
36: public FeatureClass(string id)
37: {
38: this.Id = id;
39: }
40: */
41: /// <summary/>
42: public FeatureClass(string id, string name, string caption)
43: {
44: this.Id = id;
45: this.Name = name;
46: this.Caption = caption;
47: }
48: /*
49: /// <summary/>
50: public FeatureClass(string id, string name, string caption, int count)
51: {
52: this.Id = id;
53: this.Name = name;
54: this.Caption = caption;
55: this.Count = count;
56: }
57: */
58: ///<summary/>
59: public string Id { get; set; }
60: ///<summary/>
61: public string Name { get; set; }
62: ///<summary ///<summary/>
63: public string Caption { get; set; }
64:
65: public string Description { get; set; }
66: ///<summary/>
67: public int Count { get; set; }
68:
69: ///<summary/>
70: public ICollection<Ia.TentPlay.Cl.Model.Business.Trek.FeatureDesignation> FeatureDesignations
71: {
72: get
73: {
74: return null;
75: }
76: }
77:
78: ////////////////////////////////////////////////////////////////////////////
79:
80: /// <summary>
81: ///
82: /// </summary>
83: public static string ConvertBinaryToBooleanAndOrStringOfClassFeatures(string b)
84: {
85: int i;
86: string s;
87:
88: s = string.Empty;
89:
90: i = Convert.ToInt32(b, 2);
91:
92: if ((i & 256) == 256) s += @"ncw.Class == ""A"" || ";
93: if ((i & 128) == 128) s += @"ncw.Class == ""P"" || ";
94: if ((i & 64) == 64) s += @"ncw.Class == ""V"" || ";
95: if ((i & 32) == 32) s += @"ncw.Class == ""L"" || ";
96: if ((i & 16) == 16) s += @"ncw.Class == ""U"" || ";
97: if ((i & 8) == 8) s += @"ncw.Class == ""R"" || ";
98: if ((i & 4) == 4) s += @"ncw.Class == ""T"" || ";
99: if ((i & 2) == 2) s += @"ncw.Class == ""H"" || ";
100: if ((i & 1) == 1) s += @"ncw.Class == ""S"" || ";
101:
102: if (!string.IsNullOrEmpty(s))
103: {
104: s = s.Remove(s.Length - 4, 4);
105: }
106: else s = @"ncw.Class == ""Z""";
107:
108: return s;
109: }
110:
111: ////////////////////////////////////////////////////////////////////////////
112:
113: /// <summary>
114: ///
115: /// </summary>
116: public static string ConvertIntegerToBooleanAndOrStringOfClassFeatures(int i)
117: {
118: return ConvertBinaryToBooleanAndOrStringOfClassFeatures(ConvertIntegerToBinary(i));
119: }
120:
121: ////////////////////////////////////////////////////////////////////////////
122:
123: /// <summary>
124: ///
125: /// </summary>
126: public static string ConvertIntegerToBinary(int i)
127: {
128: string s;
129:
130: s = Ia.Cl.Model.Default.IntegerToBinaryString(i);
131:
132: return s;
133: }
134:
135: ////////////////////////////////////////////////////////////////////////////
136:
137: /// <summary>
138: ///
139: /// </summary>
140: public static int ConvertBinaryToInteger(bool administrative, bool populated, bool vegetation, bool locality, bool undersea, bool street, bool hypsographic, bool hydrographic, bool spot)
141: {
142: int i;
143: string s;
144:
145: s = string.Empty;
146:
147: s += administrative ? "1" : "0";
148: s += populated ? "1" : "0";
149: s += vegetation ? "1" : "0";
150: s += locality ? "1" : "0";
151: s += undersea ? "1" : "0";
152: s += street ? "1" : "0";
153: s += hypsographic ? "1" : "0";
154: s += hydrographic ? "1" : "0";
155: s += spot ? "1" : "0";
156:
157: i = Convert.ToInt32(s, 2);
158:
159: return i;
160: }
161:
162: ////////////////////////////////////////////////////////////////////////////
163: ////////////////////////////////////////////////////////////////////////////
164: }
165:
166: ////////////////////////////////////////////////////////////////////////////
167: ////////////////////////////////////////////////////////////////////////////
168: }