)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Skip Navigation LinksHome » Code Library » FeatureClass

Public general use code classes and xml files that we've compiled and used over the years:

FeatureClass Support class for TentPlay Trek business model

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