Пример #1
0
        public void AddSentence(string sentence)
        {
            var newParticle = new Particle(this._sentenceDrawer, GetNodeCenter(), sentence);

            foreach (var particle in this._particles.Values)
            {
                var edge = this.SetEdge(newParticle, particle, ConnectionType.None);
                this._engine.AddEntity(edge);
            }

            this.AddParticle(sentence, newParticle);
        }
Пример #2
0
        public void AddTerm(string term)
        {
            var newParticle = new Particle(this._termDrawer, GetNodeCenter(), term);

            foreach (var particle in this._particles.Values)
            {
                var edge = this.SetEdge(particle, newParticle, ConnectionType.None);
                this._engine.AddEntity(edge);
            }

            this.AddParticle(term, newParticle);
        }
Пример #3
0
        private void Tick(object sender, EventArgs e)
        {
            this.Engine2D?.Update(this.UpdateInterval.TotalSeconds);
            this._hoveredElement = this.Engine2D?.GetHit(this.GetWorldPosition(this._lastMouseLocation)).FirstOrDefault() as Particle;
            var particle = (this._hit as IParticle);
            if (particle != null)
            {
                var worldPosition = this.GetWorldPosition(this._lastMouseLocation);
                particle.AddForce((worldPosition - particle.Center));

            }
            this.InvalidateVisual();
        }
Пример #4
0
        private void AddParticle(string label, Particle newParticle)
        {
            var constraint = new Spring(this._center, newParticle, 0, 0.01);

            this._particles.Add(label, newParticle);
            this._engine.Add(constraint);
            this._engine.AddEntity(newParticle);
        }