Ejemplo n.º 1
0
        private static EModelType _ChooseModel()
        {
            ConsoleKeyInfo op;
            EModelType     type = EModelType.Unknow;

            System.Console.WriteLine("Escolha o tipo de extração");
            System.Console.WriteLine("1- KMeans");
            System.Console.WriteLine("2- SURF");
            op = System.Console.ReadKey();

            switch (op.KeyChar)
            {
            case '1':
                type = EModelType.KMeans;
                break;

            case '2':
                type = EModelType.SURF;
                break;

            default:
                break;
            }

            return(type);
        }
Ejemplo n.º 2
0
 public void RemoveListener(EModelType e, MobaMessageFunc msgFunc)
 {
     if (this.mDicModel.ContainsKey(e))
     {
         this.mDicModel[e].RemoveModelListner(msgFunc);
     }
 }
Ejemplo n.º 3
0
        //=====公开方法
        /// <summary>
        /// 增加一个模型图例
        /// </summary>
        /// <param name="mtype">模型类型</param>
        /// <returns>返回新增的模型图例描述对象</returns>
        public LegendUnit addNewModelLegend(EModelType mtype)
        {
            LegendUnit l = new LegendUnit(mtype, this);

            ListModelLegend.Add(l);
            return(l);
        }
Ejemplo n.º 4
0
        private static MusicalizationArgs _ReadArguments()
        {
            MusicalizationArgs args = new MusicalizationArgs();

            EModelType modelType = _ChooseModel();

            System.Console.Clear();

            switch (modelType)
            {
            case EModelType.KMeans:
                args = _ReadKMeansArguments();
                break;

            case EModelType.SURF:
                args = _ReadSURFArguments();
                break;

            default:
                break;
            }

            args.TargetType = modelType;

            return(args);
        }
Ejemplo n.º 5
0
 public void SetDataInvalid(EModelType e)
 {
     if (this.mDicModel.ContainsKey(e))
     {
         this.mDicModel[e].Valid = false;
     }
 }
Ejemplo n.º 6
0
 private void AddModel(EModelType e)
 {
     if (!this.mDicModel.ContainsKey(e))
     {
         IModel model = this.CreateModel(e);
         this.AddModel(model);
     }
 }
Ejemplo n.º 7
0
 private void RemoveModel(EModelType e)
 {
     if (this.mDicModel.ContainsKey(e))
     {
         this.mDicModel[e].UnRegisterMsgHandler();
         this.mDicModel.Remove(e);
     }
 }
 internal CommonModelNotifyParam(IModel model)
 {
     this.errorCode    = model.LastError;
     this.data         = model.Data;
     this.modelType    = model.ModelType;
     this.debugMessage = model.DebugMessage;
     this.typeID       = model.LastMsgType;
     this.msgID        = model.LastMsgID;
 }
Ejemplo n.º 9
0
        public T GetData <T>(EModelType e)
        {
            T result = default(T);

            if (this.mDicModel.ContainsKey(e))
            {
                result = (T)((object)this.mDicModel[e].Data);
            }
            return(result);
        }
Ejemplo n.º 10
0
        private IModel CreateModel(EModelType e)
        {
            IModel result = null;
            Type   type   = Type.GetType("Assets.Scripts.Model." + e.ToString());

            if (type != null)
            {
                object obj = Activator.CreateInstance(type);
                result = (obj as IModel);
            }
            return(result);
        }
Ejemplo n.º 11
0
 /// <summary>
 /// 是否相同
 /// </summary>
 /// <param name="type"></param>
 /// <param name="typeStr"></param>
 /// <returns></returns>
 public static bool Equals(EModelType type, string typeStr)
 {
     if (String.IsNullOrEmpty(typeStr))
     {
         return(false);
     }
     if (GetEnum(typeStr) == type)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 12
0
        /// <summary>
        /// 根据枚举类型获取信息
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static string GetValue(EModelType type)
        {
            switch (type)
            {
            case EModelType.Content:
                return("Content");

            case EModelType.Good:
                return("Good");

            default:
                return("Content");
            }
        }
Ejemplo n.º 13
0
 public void OnAwake()
 {
     ModelManager.mInstance = this;
     this.mDicModel         = new Dictionary <EModelType, IModel>(default(EnumEqualityComparer <EModelType>));
     EModelType[] array  = (EModelType[])Enum.GetValues(typeof(EModelType));
     EModelType[] array2 = array;
     for (int i = 0; i < array2.Length; i++)
     {
         EModelType eModelType = array2[i];
         if (eModelType > EModelType.Model_null && eModelType < EModelType.Model_max)
         {
             this.AddModel(eModelType);
         }
     }
 }
Ejemplo n.º 14
0
        private static EModelType _ConvertToTargetType(string typeDescription)
        {
            EModelType type = EModelType.Unknow;

            foreach (EModelType t in Enum.GetValues(typeof(EModelType)))
            {
                if (t != EModelType.Unknow && t.GetDescription().ToLower().Equals(typeDescription.ToLower()))
                {
                    type = t;
                    break;
                }
            }

            return(type);
        }
Ejemplo n.º 15
0
        public StatesBuilder(List <IResult> results, EModelType type, Log log = null)
        {
            if (results.IsNullOrEmpty())
            {
                throw new ArgumentException(nameof(results));
            }

            if (type == EModelType.Unknow)
            {
                throw new ArgumentException(nameof(type));
            }

            Results   = results;
            ModelType = type;
            Log       = log;
        }
Ejemplo n.º 16
0
        //-------------------Tool Methods-------------------------------------

        public DataItemUpdate makeDataItemUpdate(ModelUpdate modelUpdate)
        {
            EModelType modelType = (EModelType)modelUpdate.modelType;

            switch (modelType)
            {
            case EModelType.modelAssignemt:
                ModelAssignment assignment = JsonConvert.DeserializeObject <ModelAssignment>(modelUpdate.modelItemAsJson);
                return(new DataItemUpdate(modelUpdate.dataKey, assignment));

            case EModelType.modelClassRoom:
                ModelClassRoom classRoom = JsonConvert.DeserializeObject <ModelClassRoom>(modelUpdate.modelItemAsJson);
                return(new DataItemUpdate(modelUpdate.dataKey, classRoom));

            case EModelType.modelUser:
                ModelUser user = JsonConvert.DeserializeObject <ModelUser>(modelUpdate.modelItemAsJson);
                return(new DataItemUpdate(modelUpdate.dataKey, user));
            }
            return(null);
        }
Ejemplo n.º 17
0
        public void InvokeModelMem(EModelType e, string methodName, object[] param)
        {
            if (string.IsNullOrEmpty(methodName) || !this.mDicModel.ContainsKey(e))
            {
                return;
            }
            Type type = this.mDicModel[e].GetType();

            if (type == null)
            {
                return;
            }
            MethodInfo method = type.GetMethod(methodName);

            if (method == null)
            {
                return;
            }
            method.Invoke(this.mDicModel[e], param);
        }
Ejemplo n.º 18
0
        private void _ValidateLog(EModelType type)
        {
            string model = type.ToString();

            if (this.ModelLog == string.Empty || this.ModelLog == null)
            {
                this.ModelLog = string.Format("{0}.log", model);
            }

            if (this.StateLog == string.Empty || this.StateLog == null)
            {
                this.StateLog = string.Format("{0}State.log", model);
            }

            if (this.SequenceLog == string.Empty || this.SequenceLog == null)
            {
                this.SequenceLog = string.Format("{0}Sequence.log", model);
            }

            if (this.ProbabilityCalculation == string.Empty || this.ProbabilityCalculation == null)
            {
                this.ProbabilityCalculation = string.Format("{0}Probability.log", model);
            }
        }
Ejemplo n.º 19
0
 /// <summary>
 /// 根据枚举类型获取展示信息
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static string GetText(EModelType type)
 {
     return(L(GetValue(type)));
 }
Ejemplo n.º 20
0
 public LegendUnit(EModelType mtype, Legend3DData Owner)
 {
     modelType = mtype;
     owner     = Owner;
 }
Ejemplo n.º 21
0
 public ModelUpdate(string modelItemAsJson, EModelType modelType, string dataKey)
 {
     this.modelItemAsJson = modelItemAsJson;
     this.modelType       = (int)modelType;
     this.dataKey         = dataKey;
 }
Ejemplo n.º 22
0
 protected void Init(EModelType mt)
 {
     this.modelType = mt;
 }
Ejemplo n.º 23
0
 /// <summary>
 /// 是否相同
 /// </summary>
 /// <param name="type"></param>
 /// <param name="typeStr"></param>
 /// <returns></returns>
 public static bool Equals(string typeStr, EModelType type)
 {
     return(Equals(type, typeStr));
 }
Ejemplo n.º 24
0
 public bool ValidData(EModelType e)
 {
     return(this.mDicModel.ContainsKey(e) && this.mDicModel[e].Valid);
 }