void _spModel_StepDoneEvent() { int i = 0; foreach (NounFrame NF in this._TMR.Nounframes) { NounFrameEntity nfe = this._dicNounFrame[NF]; nfe.Position = new PointF((float)_nodes[i].Xposition, (float)_nodes[i].Yposition); i++; } foreach (VerbFrame VF in this._TMR.VerbFrames) { VerbFrameEntity vfe = this._dicVerbFrame[VF]; vfe.Position = new PointF((float)_nodes[i].Xposition, (float)_nodes[i].Yposition); //if (VF.Aspect.Duration.ActionTime != null) //{ // i++; // MM_RectangleWithText timeEntity = _dicVerbFrameTimeEntity[VF]; // timeEntity.Position = new PointF((float)_nodes[i].Xposition, (float)_nodes[i].Yposition); //} i++; } foreach (MM_RectangleWithText Entity in otherEntities) { Entity.Position = new PointF((float)_nodes[i].Xposition, (float)_nodes[i].Yposition); i++; } this.Control.Invalidate(); }
public void AddNounFrameEntity(NounFrame nounFrame, Point point) { NounFrameEntity nfe = new NounFrameEntity(point.X, point.Y, nounFrame, _TMR, GImSearch, SizeMode, _conceptCombination); this.Add(nfe); _dicNounFrame.Add(nounFrame, nfe); Control.Invalidate(); }
public void BuildAutomaticLayoutedGraph(bool initOnly) { ClearData(); int index = 0; foreach (NounFrame NF in _TMR.Nounframes) { NounFrameEntity nfe = new NounFrameEntity(0, 0, NF, _TMR, GImSearch, SizeMode, _conceptCombination); this.Add(nfe); _dicNounFrame.Add(NF, nfe); _nodes.Add(new Node(0, 0, index)); index++; } foreach (NounFrame NF in _TMR.Nounframes) { foreach (CaseRole cr in NF.Ownerof.Keys) { foreach (NounFrame NF2 in NF.Ownerof[cr]) { if (_dicNounFrame.ContainsKey(NF2) == true) { NounFrameEntity nfe2; nfe2 = _dicNounFrame[NF2]; if (ShowEdgeText) { Add(new MM_LineWithText(_dicNounFrame[NF], nfe2, cr.ToString())); } else { Add(new MM_LineWithText(_dicNounFrame[NF], nfe2, "")); } _edges.Add(new GraphTest.Edge(_nodes[this._TMR.Nounframes.IndexOf(NF)], _nodes[this._TMR.Nounframes.IndexOf(NF2)])); _nodes[this._TMR.Nounframes.IndexOf(NF)].Neighbours.Add(_nodes[this._TMR.Nounframes.IndexOf(NF2)]); _nodes[this._TMR.Nounframes.IndexOf(NF2)].Neighbours.Add(_nodes[this._TMR.Nounframes.IndexOf(NF)]); } } } } foreach (VerbFrame VF in _TMR.VerbFrames) { VerbFrameEntity VF_entity = new VerbFrameEntity(0, 0, VF, _TMR, GImSearch, SizeMode); Add(VF_entity); _dicVerbFrame.Add(VF, VF_entity); _nodes.Add(new Node(0, 0, index)); //if (VF.Aspect.Duration.ActionTime != null) //{ // index++; // _nodes.Add(new Node(0, 0, index)); //} foreach (CaseRole cr in VF.CaseRoles.Keys) { List <NounFrame> nfs = VF.CaseRoles[cr]; foreach (NounFrame NF in nfs) { if (_dicNounFrame.ContainsKey(NF) == true) { NounFrameEntity nfe = _dicNounFrame[NF]; if (cr == CaseRole.Agent) { if (ShowEdgeText) { Add(new MM_LineWithText(nfe, VF_entity, cr.ToString())); } else { Add(new MM_LineWithText(nfe, VF_entity, "")); } } else { if (ShowEdgeText) { Add(new MM_LineWithText(VF_entity, nfe, cr.ToString())); } else { Add(new MM_LineWithText(VF_entity, nfe, "")); } } //Add(new MM_Line(VF_entity, nfe)); _edges.Add(new GraphTest.Edge(_nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count], _nodes[this._TMR.Nounframes.IndexOf(NF)])); _nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count].Neighbours.Add(_nodes[this._TMR.Nounframes.IndexOf(NF)]); _nodes[this._TMR.Nounframes.IndexOf(NF)].Neighbours.Add(_nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count]); } } } index++; } foreach (VerbFrame VF in _TMR.VerbFrames) { VerbFrameEntity VF_entity = _dicVerbFrame[VF]; foreach (DomainRelationType drt in VF.DomainRelations.Keys) { List <VerbFrame> vfl = VF.DomainRelations[drt]; foreach (VerbFrame vf in vfl) { if (_dicVerbFrame.ContainsKey(vf) == true) { VerbFrameEntity vfe = _dicVerbFrame[vf]; if (ShowEdgeText) { Add(new MM_LineWithText(VF_entity, vfe, drt.ToString())); } else { Add(new MM_LineWithText(VF_entity, vfe, "")); } //Add(new MM_Line(VF_entity, vfe)); _edges.Add(new GraphTest.Edge(_nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count], _nodes[this._TMR.VerbFrames.IndexOf(vf) + this._TMR.Nounframes.Count])); _nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count].Neighbours.Add(_nodes[this._TMR.VerbFrames.IndexOf(vf) + this._TMR.Nounframes.Count]); _nodes[this._TMR.VerbFrames.IndexOf(vf) + this._TMR.Nounframes.Count].Neighbours.Add(_nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count]); } } } foreach (DomainRelationType drt in VF.DomainRelations_n.Keys) { List <NounFrame> nfl = VF.DomainRelations_n[drt]; foreach (NounFrame nf in nfl) { if (_dicNounFrame.ContainsKey(nf) == true) { NounFrameEntity nfe = _dicNounFrame[nf]; if (ShowEdgeText) { Add(new MM_LineWithText(VF_entity, nfe, drt.ToString())); } else { Add(new MM_LineWithText(VF_entity, nfe, "")); } //Add(new MM_Line(VF_entity, nfe)); _edges.Add(new GraphTest.Edge(_nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count], _nodes[this._TMR.Nounframes.IndexOf(nf)])); _nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count].Neighbours.Add(_nodes[this._TMR.Nounframes.IndexOf(nf)]); _nodes[this._TMR.Nounframes.IndexOf(nf)].Neighbours.Add(_nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count]); } } } foreach (TemporalRelationType trt in VF.TemporalRelations.Keys) { List <VerbFrame> vfl = VF.TemporalRelations[trt]; foreach (VerbFrame vf in vfl) { if (_dicVerbFrame.ContainsKey(vf) == true) { VerbFrameEntity vfe = _dicVerbFrame[vf]; if (ShowEdgeText) { Add(new MM_LineWithText(VF_entity, vfe, trt.ToString())); } else { Add(new MM_LineWithText(VF_entity, vfe, "")); } //Add(new MM_Line(VF_entity, vfe)); _edges.Add(new GraphTest.Edge(_nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count], _nodes[this._TMR.VerbFrames.IndexOf(vf) + this._TMR.Nounframes.Count])); _nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count].Neighbours.Add(_nodes[this._TMR.VerbFrames.IndexOf(vf) + this._TMR.Nounframes.Count]); _nodes[this._TMR.VerbFrames.IndexOf(vf) + this._TMR.Nounframes.Count].Neighbours.Add(_nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count]); } } } foreach (TemporalRelationType trt in VF.TemporalRelations_n.Keys) { List <NounFrame> nfl = VF.TemporalRelations_n[trt]; foreach (NounFrame nf in nfl) { if (_dicNounFrame.ContainsKey(nf) == true) { NounFrameEntity nfe = _dicNounFrame[nf]; if (ShowEdgeText) { Add(new MM_LineWithText(VF_entity, nfe, trt.ToString())); } else { Add(new MM_LineWithText(VF_entity, nfe, "")); } //Add(new MM_Line(VF_entity, nfe)); _edges.Add(new GraphTest.Edge(_nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count], _nodes[this._TMR.Nounframes.IndexOf(nf)])); _nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count].Neighbours.Add(_nodes[this._TMR.Nounframes.IndexOf(nf)]); _nodes[this._TMR.Nounframes.IndexOf(nf)].Neighbours.Add(_nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count]); } } } //aspects if (VF.Aspect.Duration.ActionTime != null) { string time = VF.Aspect.Duration.ActionTime; VerbFrameEntity vfe = _dicVerbFrame[VF]; MM_RectangleWithText timeEntity = new MM_RectangleWithText(0, 0, 30, 25, time, ""); Add(timeEntity); otherEntities.Add(timeEntity); _nodes.Add(new Node(0, 0, _nodes.Count)); if (ShowEdgeText) { Add(new MM_LineWithText(VF_entity, timeEntity, "Time")); } else { Add(new MM_LineWithText(VF_entity, timeEntity, "")); } //Add(new MM_Line(VF_entity, timeEntity)); _edges.Add(new GraphTest.Edge(_nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count], _nodes[_nodes.Count - 1])); _nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count].Neighbours.Add(_nodes[_nodes.Count - 1]); _nodes[_nodes.Count - 1].Neighbours.Add(_nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count]); } //adverbs //if (VF.AdverbsInfo != null) //{ // foreach (MyWordInfo mwi in VF.AdverbsInfo) // { // MM_RectangleWithText entity = new MM_RectangleWithText(0, 0, 30, 25, mwi.Word, ""); // Add(entity); // otherEntities.Add(entity); // _nodes.Add(new Node(0, 0, _nodes.Count)); // Add(new MM_LineWithText(VF_entity, entity, "Adverb")); // _edges.Add(new GraphTest.Edge(_nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count], _nodes[_nodes.Count - 1])); // _nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count].Neighbours.Add(_nodes[_nodes.Count - 1]); // _nodes[_nodes.Count - 1].Neighbours.Add(_nodes[this._TMR.VerbFrames.IndexOf(VF) + this._TMR.Nounframes.Count]); // } //} //adjectives //foreach (NounFrame nounframe in _TMR.Nounframes) //{ // if (nounframe.AdjectivesInfo != null) // { // foreach (MyWordInfo mwi in nounframe.AdjectivesInfo) // { // MM_RectangleWithText entity = new MM_RectangleWithText(0, 0, 30, 25, mwi.Word, ""); // Add(entity); // otherEntities.Add(entity); // _nodes.Add(new Node(0, 0, _nodes.Count)); // Add(new MM_LineWithText(VF_entity, entity, "Adjective")); // _edges.Add(new GraphTest.Edge(_nodes[this._TMR.Nounframes.IndexOf(nounframe)], _nodes[_nodes.Count - 1])); // _nodes[this._TMR.Nounframes.IndexOf(nounframe)].Neighbours.Add(_nodes[_nodes.Count - 1]); // _nodes[_nodes.Count - 1].Neighbours.Add(_nodes[this._TMR.Nounframes.IndexOf(nounframe)]); // } // } //} } _spModel = new SpringModel(_nodes, _edges, 800, 200, Mode.CIRCULAR); //this._spModel._getOriginDistance = new GetOriginDistance(getOriginDistance); this._spModel.StepDoneEvent += new SingleStepUpdateEventHandler(_spModel_StepDoneEvent); if (LayoutiingThread != null) { if (LayoutiingThread.ThreadState != ThreadState.Stopped) { LayoutiingThread.Abort(); } } if (initOnly) { _spModel.InitializeSpringModel(); _spModel.AdjustNodes(new Rectangle(0, 0, 800, 600)); _spModel_StepDoneEvent(); } else { LayoutiingThread = new System.Threading.Thread(new System.Threading.ThreadStart(_spModel.Run)); LayoutiingThread.Start(); } }
private void AddLinks() { foreach (VerbFrame VF in _TMR.VerbFrames) { VerbFrameEntity VF_entity = _dicVerbFrame[VF]; foreach (CaseRole cr in VF.CaseRoles.Keys) { List <NounFrame> nfs = VF.CaseRoles[cr]; foreach (NounFrame NF in nfs) { NounFrameEntity nfe = _dicNounFrame[NF]; Add(new MM_LineWithText(VF_entity, nfe, cr.ToString())); //Add(new MM_Line(VF_entity, nfe)); } } } foreach (VerbFrame VF in _TMR.VerbFrames) { VerbFrameEntity VF_entity = _dicVerbFrame[VF]; foreach (DomainRelationType drt in VF.DomainRelations.Keys) { List <VerbFrame> vfl = VF.DomainRelations[drt]; foreach (VerbFrame vf in vfl) { VerbFrameEntity vfe = _dicVerbFrame[vf]; Add(new MM_LineWithText(VF_entity, vfe, drt.ToString())); //Add(new MM_Line(VF_entity, vfe)); } } foreach (DomainRelationType drt in VF.DomainRelations_n.Keys) { List <NounFrame> nfl = VF.DomainRelations_n[drt]; foreach (NounFrame nf in nfl) { NounFrameEntity nfe = _dicNounFrame[nf]; Add(new MM_LineWithText(VF_entity, nfe, drt.ToString())); //Add(new MM_Line(VF_entity, nfe)); } } foreach (TemporalRelationType trt in VF.TemporalRelations.Keys) { List <VerbFrame> vfl = VF.TemporalRelations[trt]; foreach (VerbFrame vf in vfl) { VerbFrameEntity vfe = _dicVerbFrame[vf]; Add(new MM_LineWithText(VF_entity, vfe, trt.ToString())); //Add(new MM_Line(VF_entity, vfe)); } } foreach (TemporalRelationType trt in VF.TemporalRelations_n.Keys) { List <NounFrame> nfl = VF.TemporalRelations_n[trt]; foreach (NounFrame nf in nfl) { NounFrameEntity nfe = _dicNounFrame[nf]; Add(new MM_LineWithText(VF_entity, nfe, trt.ToString())); //Add(new MM_Line(VF_entity, nfe)); } } //aspects if (VF.Aspect.Duration.ActionTime != null) { string time = VF.Aspect.Duration.ActionTime; VerbFrameEntity vfe = _dicVerbFrame[VF]; MM_RectangleWithText timeEntity = new MM_RectangleWithText(0, 0, 30, 25, time, ""); Add(timeEntity); Add(new MM_LineWithText(VF_entity, timeEntity, "time")); //Add(new MM_Line(VF_entity, timeEntity)); } } }
void AddEntities() { foreach (NounFrame NF in _TMR.Nounframes) { NounFrameEntity nfe = new NounFrameEntity(0, 0, NF); this.Add(nfe); _dicNounFrame.Add(NF, nfe); } //foreach (NounFrame NF in _TMR.Nounframes) //{ // NounFrameEntity NF_entity = _dicNounFrame[NF]; // if (NF.Adjective!=null) // { // for (int i=0;i<NF.Adjective.Count;i++) // { // ParseNode adj = NF.Adjective[i]; // MM_RectangleWithText AdjEntity = new MM_RectangleWithText(0, 0, 30, 25, adj.Text,""); // Add(AdjEntity); // //Add(new MM_LineWithText(VF_entity, timeEntity, "time")); // Add(new MM_LineWithText(NF_entity, AdjEntity, NF.Adjective_fillerType[i])); // } // } //} foreach (VerbFrame VF in _TMR.VerbFrames) { VerbFrameEntity VF_entity = new VerbFrameEntity(0, 0, VF); Add(VF_entity); _dicVerbFrame.Add(VF, VF_entity); foreach (CaseRole cr in VF.CaseRoles.Keys) { List <NounFrame> nfs = VF.CaseRoles[cr]; foreach (NounFrame NF in nfs) { NounFrameEntity nfe = _dicNounFrame[NF]; //Add(new MM_LineWithText(VF_entity, nfe, cr.ToString())); Add(new MM_Line(VF_entity, nfe)); } } } foreach (VerbFrame VF in _TMR.VerbFrames) { VerbFrameEntity VF_entity = _dicVerbFrame[VF]; foreach (DomainRelationType drt in VF.DomainRelations.Keys) { List <VerbFrame> vfl = VF.DomainRelations[drt]; foreach (VerbFrame vf in vfl) { VerbFrameEntity vfe = _dicVerbFrame[vf]; //Add(new MM_LineWithText(VF_entity, vfe, drt.ToString())); Add(new MM_Line(VF_entity, vfe)); } } foreach (DomainRelationType drt in VF.DomainRelations_n.Keys) { List <NounFrame> nfl = VF.DomainRelations_n[drt]; foreach (NounFrame nf in nfl) { NounFrameEntity nfe = _dicNounFrame[nf]; //Add(new MM_LineWithText(VF_entity, nfe, drt.ToString())); Add(new MM_Line(VF_entity, nfe)); } } foreach (TemporalRelationType trt in VF.TemporalRelations.Keys) { List <VerbFrame> vfl = VF.TemporalRelations[trt]; foreach (VerbFrame vf in vfl) { VerbFrameEntity vfe = _dicVerbFrame[vf]; //Add(new MM_LineWithText(VF_entity, vfe, trt.ToString())); Add(new MM_Line(VF_entity, vfe)); } } foreach (TemporalRelationType trt in VF.TemporalRelations_n.Keys) { List <NounFrame> nfl = VF.TemporalRelations_n[trt]; foreach (NounFrame nf in nfl) { NounFrameEntity nfe = _dicNounFrame[nf]; //Add(new MM_LineWithText(VF_entity, nfe, trt.ToString())); Add(new MM_Line(VF_entity, nfe)); } } //aspects if (VF.Aspect.Duration.ActionTime != null) { string time = VF.Aspect.Duration.ActionTime; VerbFrameEntity vfe = _dicVerbFrame[VF]; MM_RectangleWithText timeEntity = new MM_RectangleWithText(0, 0, 30, 25, time, ""); Add(timeEntity); //Add(new MM_LineWithText(VF_entity, timeEntity, "time")); Add(new MM_Line(VF_entity, timeEntity)); } } }