Beispiel #1
0
        public FootPrint Execute(ISecurity source)
        {
            var count = source.Bars.Count;

            m_fp = new FootPrint(source, CombineSteps, AddTick);
            Func <int, IReadOnlyList <ITrade> > getTradesFunc;

            if (Context != null)
            {
                var tradesCache = Context.GetTradesCache(source);
                getTradesFunc = tradesCache.GetTrades;
            }
            else
            {
                getTradesFunc = source.GetTrades;
            }

            for (int i = 0; i < count; i++)
            {
                var bar    = m_fp[i];
                var trades = getTradesFunc(i);
                ProcessTrades(bar, trades);
            }
            for (int i = 0; i < count; i++)
            {
                var bar = m_fp[i];
                UpdateColor(bar);
            }
            return(m_fp);
        }
Beispiel #2
0
            void doc_PrintPage(object sender, PrintPageEventArgs e)
            {
                Graphics     g       = e.Graphics;
                PageSettings PageSet = new PageSettings();

                g.PageUnit = GraphicsUnit.Millimeter;

                {
                    // box
                    FootPrint pf = new FootPrint();
                    pf.offset        = new SizeF(0, 0);
                    pf.footprintSize = new SizeF(115, 90);
                    pf.pin1Position  = new PointF(20.0F, 20.0F);
                    pf.width         = 0.5f;

                    DrawFootPrint(g, pf);
                }

                {
                    // ESP32
                    FootPrint pf = new FootPrint();
                    pf.offset        = new SizeF(2.02f, 2.14f);
                    pf.footprintSize = new SizeF(55, 28);
                    pf.pin1Position  = new PointF(38.0F, 28.5F);
                    pf.width         = 0.5f;

                    PointF[] dd = new PointF[] { new PointF(0, 0), new PointF(50.96f, 0.0F), new PointF(0F, 23.71f), new PointF(50.96f, 23.71f) };

                    pf.DrillHoles.AddRange(dd);
                    DrawFootPrint(g, pf);
                }

                {
                    // Voltage Buck Converter
                    FootPrint pf = new FootPrint();
                    pf.offset        = new SizeF(2.52f, 2.4f);
                    pf.footprintSize = new SizeF(66, 36);
                    pf.pin1Position  = new PointF(40.0F, 65.0F);
                    pf.width         = 0.5f;

                    PointF[] dd = new PointF[] { new PointF(0, 0), new PointF(MmFromInch(2.4f), 0F), new PointF(0F, 31.2f), new PointF(MmFromInch(2.4f), 31.2f) };

                    pf.DrillHoles.AddRange(dd);
                    DrawFootPrint(g, pf);
                }

                {
                    // calibration
                    FootPrint pf = new FootPrint();
                    pf.offset        = new SizeF(0, 0);
                    pf.footprintSize = new SizeF(170, 170);
                    pf.pin1Position  = new PointF(10.0F, 10.0F);
                    pf.width         = 0.125f;

                    PointF[] dd = new PointF[] { new PointF(0, 0), new PointF(0, 170F), new PointF(170f, 170f), new PointF(170f, 0f) };

                    pf.DrillHoles.AddRange(dd);
                    DrawFootPrint(g, pf);
                }
            }
Beispiel #3
0
    void _write()
    {
        Dictionary <string, string> dict = new Dictionary <string, string>();

        foreach (Transform t in item.transform.parent)
        {
            DetailItem di = t.gameObject.GetComponent <DetailItem>();
            dict[di.Name.text] = di.Value.text;
        }

        FootPrint info = _mark.data;

        info.name     = dict["name"];
        info.arrived  = Utils.TimeStringToInt(dict["arrived"]);
        info.stay     = Utils.TimeStringToInt(dict["stay"]);
        info.distance = int.Parse(dict["distance"]);
        info.fare     = int.Parse(dict["fare"]);
        info.weather  = int.Parse(dict["weather"]);
        bool finish = bool.Parse(dict["finish"]);

        _mark.Finish = finish;
        info.finish  = finish;
        info.desc    = desc.text;

        _mark.intro.text = info.intro;
    }
Beispiel #4
0
    public static List <FootPrint> load(string path)
    {
        StreamReader sr;

        try{
            sr = new StreamReader(path);
        }catch {
            Debug.Log("path error");
            return(null);
        }
        string jsonString = sr.ReadToEnd();
        //Debug.Log("read: "+jsonString);

        object           obj  = Json.Deserialize(jsonString);
        var              list = obj as List <object>;
        List <FootPrint> foot = new List <FootPrint>();

        if (null != list)
        {
            Main.Instance.mapFile = (string)list[0];
            Main.Instance.scale   = float.Parse((string)list[1]);
            Main.Instance.speed   = float.Parse((string)list[2]);
            list.RemoveRange(0, 3);

            foreach (object str in list)
            {
                FootPrint f = new FootPrint();
                f.fromJson((string)str);
                foot.Add(f);
            }
        }
        return(foot);
    }
Beispiel #5
0
    private void Start()
    {
        state = gameState.Start;

        stageCreater = Instantiate(stageCreater);
        stageCreater.transform.parent = transform;

        player = Instantiate(player);
        player.transform.parent = transform;

        footPrinter = Instantiate(footPrinter);
        footPrinter.transform.parent = transform;

        effectSpawner = Instantiate(effectSpawner);
        effectSpawner.transform.parent = transform;

        effectSpawner2 = Instantiate(effectSpawner2);
        effectSpawner2.transform.parent = transform;

        stageCreater.footPrinter    = footPrinter;
        stageCreater.effectSpawner  = effectSpawner;
        stageCreater.effectSpawner2 = effectSpawner2;

        player.haveMapDateObject = stageCreater;
    }
Beispiel #6
0
        public ActionResult SetFootPrint()
        {
            var files = Request.Form.Files;
            //返回的文件地址
            List <string> filenames = new List <string>();
            //文件存储路径
            var file          = files[0];
            var originalImage = System.Drawing.Image.FromStream(file.OpenReadStream());
            var thumbImage    = originalImage.GetThumbnailImage(128, 128, null, IntPtr.Zero);
            var filename      = DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + file.FileName;
            var fileStream    = new FileStream(DataCenter.imagefilefolder + filename, FileMode.Create);

            thumbImage.Save(fileStream, ImageFormat.Jpeg);
            fileStream.Close();
            var x = new FootPrint()
            {
                UserImage   = filename,
                Title       = Request.Form["Title"][0],
                Address     = Request.Form["Address"][0],
                Description = Request.Form["Description"][0],
                Datetime    = Request.Form["Datetime"][0],
            };

            DataCenter.FootPrints.Add(x);
            return(new JsonResult("{'result':'OK'}"));
        }
Beispiel #7
0
        public async Task Put(string id, [FromBody] string value)
        {
            FootPrint footPrint = await this._dbContext.FootPrints.FirstOrDefaultAsync(o => o.Id == id).ConfigureAwait(false);

            footPrint.Name = value;

            await this._dbContext.SaveChangesAsync().ConfigureAwait(false);
        }
Beispiel #8
0
 protected override void SetConfigSettings()
 {
     FootPrint.Initialize
     (
         MainConfig.OptPathfinderFootprintLifespan.GetValue(),
         MainConfig.OptPathfinderAnonymousFootprints.GetValue(),
         footsteps
     );
 }
Beispiel #9
0
        public async Task <IActionResult> RecordFootPrintAsync([FromBody] FootPrint footPrint)
        {
            footPrint.TimeStamp = DateTime.UtcNow;
            _dbContext.FootPrints.Add(footPrint);

            await _dbContext.SaveChangesAsync();

            return(Ok());
        }
Beispiel #10
0
		// Empty Class constructor
		public Component(int h, int w, String str_name)
		{
			head_height = h;     
			head_width = w;
			head_heightOrig = h;     
			head_widthOrig = w;
			name = str_name;
			FP = new FootPrint();
        	created_guid = System.Guid.NewGuid();
			changed_guid = created_guid;
		}   
Beispiel #11
0
    /// <summary>
    /// 현재 Patrol지점까지 Patrol하는 함수
    /// </summary>
    /// <param name="patrolSpeed"></param>
    /// <param name="patrolWaitingT"></param>
    public void Patrol(float patrolSpeed, ref float patrolWaitingT, ref float footPrintT, FootPrint footPrintPrefab)
    {
        Vector3 direction = patrolPoint[patrolIdx].transform.position - transform.position;

        direction = new Vector3(direction.x, 0, direction.z);
        if (animator.GetCurrentAnimatorStateInfo(0).IsName("Turn"))
        {
            if ((transform.forward - direction.normalized).sqrMagnitude < 0.01f)
            {
                animator.SetBool("Turn", false);
                animator.SetBool("Walk", true);
            }
            else
            {
                transform.forward = Vector3.Lerp(transform.forward, direction.normalized, Time.deltaTime * 3.0f);
            }
        }
        else
        {
            // Patrol지점까지 도달하면 일정 시간 대기하다가 다음 Patrol지점을 구한다.
            if (direction.sqrMagnitude < 0.1f)
            {
                patrolWaitingT += Time.deltaTime;
                animator.SetBool("Walk", false);
                if (patrolWaitingT > 2.0f)
                {
                    animator.SetBool("Turn", true);
                    patrolWaitingT = 0.0f;
                    patrolIdx++;
                    patrolIdx %= patrolPoint.Length;
                }
            }
            else
            {
                transform.position += direction.normalized * Time.deltaTime * patrolSpeed;
                // 일정 시간마다 발자국 생성
                footPrintT += Time.deltaTime;
                if (footPrintT > 10.0f)
                {
                    FootPrint footPrint = Instantiate(footPrintPrefab);
                    footPrint.transform.position = new Vector3(this.gameObject.transform.position.x, -5.8f, this.gameObject.transform.position.z);
                    footPrint.transform.rotation = this.transform.rotation;
                    footPrint.transform.Rotate(new Vector3(1, 0, 0), 90);
                    footPrintT = 0.0f;
                }
            }
        }
    }
Beispiel #12
0
            void DrawFootPrint(Graphics g, FootPrint fp)
            {
                SizeF sp = new SizeF(fp.pin1Position);

                foreach (var p in fp.DrillHoles)
                {
                    DrawLineDot(g, p + sp);
                }

                SizeF s1 = sp - fp.offset;

                DrawLine(g, fp.width, new PointF(0, 0) + s1, new PointF(0, fp.footprintSize.Height) + s1);
                DrawLine(g, fp.width, new PointF(0, fp.footprintSize.Height) + s1, new PointF(fp.footprintSize.Width, fp.footprintSize.Height) + s1);
                DrawLine(g, fp.width, new PointF(fp.footprintSize.Width, fp.footprintSize.Height) + s1, new PointF(fp.footprintSize.Width, 0) + s1);
                DrawLine(g, fp.width, new PointF(fp.footprintSize.Width, 0) + s1, new PointF(0, 0) + s1);
            }
Beispiel #13
0
    public bool IsGoodSyntax(FootPrint footprint)
    {
        /*
         *      foreach (var good_footprint in good_footprints)
         *      {
         *          if (footprint.Match(good_footprint))
         *          {
         *              return true;
         *          }
         *      }
         *
         *      return false;
         */

        return(footprint.Match(trie));;
    }
    private void Start()
    {
        //state = gameState.Game;
        state = gameState.Ready;
        //player.Reset();
        //blackScreen.color = new Color(0, 0, 0, 0.0f);
        blackScreen.color = new Color(0, 0, 0, 0.8f);

        stageCreater = Instantiate(stageCreater);
        stageCreater.transform.parent = transform;

        player = Instantiate(player);
        player.transform.parent = transform;

        footPrinter = Instantiate(footPrinter);
        footPrinter.transform.parent = transform;
    }
Beispiel #15
0
        public async Task Post([FromBody] string name)
        {
            var footPrint = new FootPrint()
            {
                Name  = name,
                Daily = new DailyFootPrint()
                {
                    Name = "기매수"
                },
                CoffeeTimes = new List <CoffeeTime>()
                {
                    new CoffeeTime()
                    {
                        When = DateTime.Now, With = "지성책임/혜수책임/etc.."
                    }
                }
            };

            this._dbContext.FootPrints.Add(footPrint);

            await this._dbContext.SaveChangesAsync().ConfigureAwait(false);
        }
Beispiel #16
0
    public void initDetail(Mark mark)
    {
        _mark = mark;
        DetailItem di   = item.GetComponent <DetailItem>();
        FootPrint  info = mark.data;

        di.name       = di.Name.text = "name";
        di.Value.text = info.name;
        _read("arrived", Utils.TimeIntToString(info.arrived));
        _read("stay", Utils.TimeIntToString(info.stay));
        _read("distance", info.distance);
        _read("fare", info.fare);
        _read("weather", info.weather);
        _read("finish", info.finish);
        if (info.desc != null)
        {
            desc.text = info.desc;
        }
        foreach (KeyValuePair <string, string> kv in info.interest)
        {
            _read(kv.Key, kv.Value);
        }
    }
Beispiel #17
0
		//Deserialization constructor.
		public Component(SerializationInfo info, StreamingContext ctxt)
		{
			//Get the values from info and assign them to the appropriate properties
			incoming_serialization_version = (int)info.GetValue("_serialization_version", typeof(int));
			FP = (FootPrint)info.GetValue("_FP", typeof(FootPrint));
			text_str = (String)info.GetValue("_text_str", typeof(string));
			name = (String)info.GetValue("_name", typeof(string));
			proximity = (int)info.GetValue("_proximity", typeof(int));
			//running = (bool)info.GetValue("_running", typeof(bool));
			running = false;
			//scale = (float)info.GetValue("_scale", typeof(float));
			head_height = (int)info.GetValue("_head_height", typeof(int));
			head_width = (int)info.GetValue("_head_width", typeof(int));
			head_heightOrig = (int)info.GetValue("_head_heightOrig", typeof(int));
			head_widthOrig = (int)info.GetValue("_head_widthOrig", typeof(int));
			connector_length = (int)info.GetValue("_connector_length", typeof(int));
			x_location = (int)info.GetValue("_x_location", typeof(int));
			y_location = (int)info.GetValue("_y_location", typeof(int));
			height_of_text = (int)info.GetValue("_height_of_text", typeof(int));
			char_length = (int)info.GetValue("_char_length", typeof(int));
			Successor = (Component)info.GetValue("_Successor", typeof(Component));
			parent = (Component)info.GetValue("_parent", typeof(Component));
			is_child = (bool)info.GetValue("_is_child", typeof(bool));
			is_beforeChild = (bool)info.GetValue("_is_beforeChild", typeof(bool));
			is_afterChild = (bool)info.GetValue("_is_afterChild", typeof(bool));
			//my_selected = (bool)info.GetValue("_my_selected", typeof(bool));
			my_selected = false;
			full_text = (bool)info.GetValue("_full_text", typeof(bool));
			rect = (System.Drawing.Rectangle)info.GetValue("_rect", typeof(System.Drawing.Rectangle));
			// here's a sample of how to extend into a later version
			// we need to:
			// 1) update current_serialization_version
			// 2) update writing below (or in whatever component)
			// 3) update reading below (or in whatever version) -- might
			//    add an else to provide a default initial value as needed.
			if (incoming_serialization_version>=3)
			{
				this.My_Comment = (CommentBox)info.GetValue("_comment", typeof(CommentBox));
				if (this.My_Comment!=null)
				{
					this.My_Comment.parent=this;
				}
			}
			if (incoming_serialization_version>=12)
			{
				created_guid = (System.Guid)info.GetValue("_created_guid", typeof(System.Guid));
				changed_guid = (System.Guid)info.GetValue("_changed_guid", typeof(System.Guid));
			}
			else
			{
				created_guid = System.Guid.NewGuid();
				changed_guid = created_guid;
			}
			if (incoming_serialization_version>current_serialization_version &&
				!warned_about_newer_version)
			{
				warned_about_newer_version = true;
				MessageBox.Show("File created with newer version.\n"
					+"Not all features of this flowchart may work.\n"
					+"Suggest downloading latest version.", "Warning",
					MessageBoxButtons.OK, MessageBoxIcon.Warning);

			}
		}
    static void ProcessSentence2(string phrase, SolarixGrammarEngineNET.GrammarEngine2 gren, int max_len)
    {
        nb_processed += 1;

        if (nb_skip != 0 && nb_processed < nb_skip)
        {
            return;
        }

        if (phrase.Length > 2)
        {
            bool   used       = false;
            string terminator = "";

            if (IsSentenceTerminator(phrase.Last()))
            {
                terminator = new string(phrase.Last(), 1);

                // Удалим финальные символы типа . или !
                int finalizers = 1;
                for (int i = phrase.Length - 2; i > 0; --i)
                {
                    if (IsSentenceTerminator(phrase[i]))
                    {
                        finalizers++;
                    }
                }

                phrase = phrase.Substring(0, phrase.Length - finalizers);
            }

            if (!processed_phrases.Contains(phrase))
            {
                processed_phrases.Add(phrase);

                string phrase2 = Preprocess(phrase, gren);

                // Выполним оценку синтаксического качества предложения, чтобы отсеять мусор.
                int id_language = SolarixGrammarEngineNET.GrammarEngineAPI.RUSSIAN_LANGUAGE;
                SolarixGrammarEngineNET.GrammarEngine.MorphologyFlags morph_flags  = SolarixGrammarEngineNET.GrammarEngine.MorphologyFlags.SOL_GREN_COMPLETE_ONLY | SolarixGrammarEngineNET.GrammarEngine.MorphologyFlags.SOL_GREN_MODEL;
                SolarixGrammarEngineNET.GrammarEngine.SyntaxFlags     syntax_flags = SolarixGrammarEngineNET.GrammarEngine.SyntaxFlags.DEFAULT;
                int MaxAlt      = 40;
                int constraints = 600000 | (MaxAlt << 22);

                using (SolarixGrammarEngineNET.AnalysisResults linkages = gren.AnalyzeSyntax(phrase2, id_language, morph_flags, syntax_flags, constraints))
                {
                    if (linkages.Count == 3)
                    {
                        SolarixGrammarEngineNET.SyntaxTreeNode        root  = linkages[1];
                        List <SolarixGrammarEngineNET.SyntaxTreeNode> terms = GetTerms(root).OrderBy(z => z.GetWordPosition()).ToList();

                        int score = linkages.Score;

                        bool good = false;
                        if (score >= -4)
                        {
                            good = true;

                            if (!syntax_checker.IsEmpty())
                            {
                                FootPrint footprint = new FootPrint(gren, terms);

                                // Проверим синтаксическую структуру фразы, чтобы отсеять разговорную некондицию.
                                good = syntax_checker.IsGoodSyntax(footprint);
                            }
                        }

                        if (good)
                        {
                            used = true;
                            WriteSample(phrase + terminator);
                            wrt_samples.Flush();
                        }
                        else
                        {
                            SkippedSample(phrase);
                        }
                    }
                }
            }
        }

        Console.Write("{0} processed, {1} stored\r", nb_processed, nb_stored);

        return;
    }