private void _printPackage(int level, HttpRequest req, Package package, VirtualHuman human) { if (package == null) return; req.response.write("<div class=\"node\">"); req.response.write("<img src = em_package.png>"); req.response.write(" "); req.response.write(package.name); level++; req.response.write("<ul>"); foreach (KeyValuePair<string, Class> cl in package.Classes) { req.response.write("<P><img src =EndL.png>"); req.response.write("<img src =em_class.png>"); req.response.write(" <a href=\"Class?alias="); req.response.write(cl.Value.name); if (human != null) { req.response.write("&agent="); req.response.write(human.name); } req.response.write("\" target = \"Body\">"); req.response.write(cl.Value.name); req.response.write("</a>"); req.response.write("</P>"); } foreach (KeyValuePair<string, Package> pkg in package.Packages) _printPackage(level, req, pkg.Value, human); req.response.write("</ul>"); req.response.write("</div>"); }
public EasyDM(EasyDialogueFile planToExe, InstanceSpecification host, Dictionary<String, ValueSpecification> p) : base(planToExe, host, p) { vh = host as VirtualHuman; plan = planToExe; isFinished = false; isPlanStarted = false; x = 1; }
public override void manageRequest(HttpRequest req) { req.response.write("<html>"); req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); req.response.write("<body>"); req.response.write("<link href=\"doxygen.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<link href=\"tabs.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<div class=\"tabs\">"); req.response.write("<ul>"); req.response.write("<li><a href=\"Model\"><span>Model</span></a></li>"); req.response.write("<li class=\"current\"><a href=\"Instances\"><span>Entites</span></a></li>"); req.response.write("<li><a href=\"Agents\"><span>Humains Virtuels</span></a></li>"); req.response.write("<li><a href=\"Organisations\"><span>Organisations</span></a></li>"); req.response.write("<li><a href=\"Scenario\"><span>Scenario</span></a></li>"); req.response.write("<li><a href=\"Application\"><span>Application</span></a></li>"); req.response.write("<li><a href=\"FIPASL\"><span>FIPA SL</span></a></li>"); req.response.write("<li><a href=\"XOCL\"><span>XOCL</span></a></li>"); req.response.write("<li><a href=\"messages\"><span>Mes messages</span></a></li>"); req.response.write("</ul>"); req.response.write("</div>"); req.response.write("<HR>"); req.response.write("<HR>"); req.response.write("<H2>Humains Virtuels</H2>"); Environment env = MascaretApplication.Instance.getEnvironment(); req.response.write("<ul>"); foreach (KeyValuePair <string, InstanceSpecification> instance in env.InstanceSpecifications) { VirtualHuman human = null; try { human = (VirtualHuman)(instance.Value); } catch (InvalidCastException e) { } if (human != null) { req.response.write("<li><a href=\"Agent?alias="); req.response.write(instance.Key); req.response.write("\" target = \"Body\">"); req.response.write(instance.Key); req.response.write("</a></li>"); } } req.response.write("</ul>"); req.response.write("</body>"); req.response.write("</html>"); }
public override void manageRequest(HttpRequest req) { string id = req.parameters["alias"]; Environment env = MascaretApplication.Instance.getEnvironment(); if (!env.InstanceSpecifications.ContainsKey(id)) { req.response.write("<html>"); req.response.write("<body>"); req.response.write("Can't find entity: " + id); req.response.write("</body>"); req.response.write("</html>"); return; } InstanceSpecification entity = env.InstanceSpecifications[id]; VirtualHuman human = null; try { human = (VirtualHuman)(entity); } catch (InvalidCastException e) { req.response.write("<html>"); req.response.write("<body>"); req.response.write("Entity: " + id + " is not an agent"); req.response.write("</body>"); req.response.write("</html>"); return; } string texte = req.parameters["text"]; texte = texte.Replace("+", " "); texte = texte.Replace("%2C", ","); texte = texte.Replace("%3F", "?"); texte = texte.Replace("%C3%A7", "ç"); // human.speak(texte); req.response.write("<html>"); req.response.write("<body>"); req.response.write("Entity: " + id + " is speaking : " + texte); req.response.write("</body>"); req.response.write("</html>"); return; }
private void _printPackage(int level, HttpRequest req, Package package, VirtualHuman human) { if (package == null) { return; } req.response.write("<div class=\"node\">"); req.response.write("<img src = em_package.png>"); req.response.write(" "); req.response.write(package.name); level++; req.response.write("<ul>"); foreach (KeyValuePair <string, Class> cl in package.Classes) { req.response.write("<P><img src =EndL.png>"); req.response.write("<img src =em_class.png>"); req.response.write(" <a href=\"Class?alias="); req.response.write(cl.Value.name); if (human != null) { req.response.write("&agent="); req.response.write(human.name); } req.response.write("\" target = \"Body\">"); req.response.write(cl.Value.name); req.response.write("</a>"); req.response.write("</P>"); } foreach (KeyValuePair <string, Package> pkg in package.Packages) { _printPackage(level, req, pkg.Value, human); } req.response.write("</ul>"); req.response.write("</div>"); }
public UtteranceInterpreter(VirtualHuman host, UtteranceMessage utterance) { this.utterance = utterance; hostAgent = host; }
public UtteranceInterpreter(VirtualHuman host) { hostAgent = host; }
protected VirtualHuman _createHuman(XElement node) { VirtualHuman h = null; Class classe = null; string className = ""; XAttribute attr = (XAttribute)node.Attribute("class"); if (attr != null) className = attr.Value; if (className == "") className = "undef"; classe = _findClass(className); string nodeName = ""; attr = (XAttribute)node.Attribute("name"); if (attr != null) nodeName = attr.Value; if (classe == null) { return h; } VirtualHumanClass vhClasse = (VirtualHumanClass)classe; if (vhClasse == null) { return h; } h = new VirtualHuman(agentPlateform, nodeName, vhClasse); agentPlateform.addAgent(h); h.ControlledByHuman = false; //default attr = (XAttribute)node.Attribute("controlled"); if (attr != null && attr.Value == "yes") { h.ControlledByHuman = true; } if (toRun) { foreach (Behavior currentBehaviour in classe.OwnedBehavior.Values) { BehaviorScheduler.Instance.executeBehavior(currentBehaviour, h, new Dictionary<string, ValueSpecification>(), false); } } environment.addInstance(h); _readGeometryEntity(node, h.Body); foreach (XElement child in node.Elements()) { if (child.Name.LocalName == "Face") { string indiceFile = ""; string fdpFile = ""; indiceFile = ((XAttribute)child.Attribute("indiceFile")).Value; fdpFile = ((XAttribute)child.Attribute("fdpFile")).Value; //h.Body.Face.FdpDataFile = fdpFile; //h.Body.Face.IndiceFile = indiceFile; //file.WriteLine(h.Body.Face.FdpDataFile + " / " + h.Body.Face.IndiceFile); //h.Body.Face.loadData(); } else if (child.Name.LocalName == "Behavior") { string beNodeName = ""; bool added = false; bool start = true; attr = (XAttribute)child.Attribute("start"); if (attr != null) start = Boolean.Parse(attr.Value); XAttribute attr2 = (XAttribute)child.Attribute("name"); if (attr2 != null) beNodeName = attr2.Value; attr = (XAttribute)child.Attribute("interval"); if (attr != null) { /* double interval = double.Parse(attr.Value); */ double interval = 0.2; if (interval != 0.0f) { added = true; h.addBehavior(beNodeName, interval, start); } } if (!added) h.addBehavior(beNodeName, 0, start); } /* Est-ce utilisé quelque part? Voir en détail le fonctionnement avec le pointeur sur fonction symbol*/ else if (child.Name == "KnowledgeBase") { string name = ""; attr = (XAttribute)child.Attribute("name"); if(attr!=null) name = attr.Value; KnowledgeBase kb = h.KnowledgeBase; kb.name = name; XElement envNode = child.Element("Environment"); if (envNode != null) { string url = ((XAttribute)envNode.Attribute("url")).Value; Environment env = parseEnvironment(url); kb.Environment = env; } else { MascaretApplication.Instance.VRComponentFactory.Log( " Agent has global knowledge on environment" ); kb.Environment = MascaretApplication.Instance.getEnvironment(); } } else if (child.Name.LocalName == "Attribute") { attr = (XAttribute)child.Attribute("name"); if (attr != null && h.Slots.ContainsKey(attr.Value)) { XAttribute attr2 = (XAttribute)child.Attribute("value"); if (attr2 != null) { ValueSpecification val = h.Slots[attr.Value].DefiningProperty.createValueFromString(attr2.Value); h.Slots[attr.Value].addValue(val); } } else { } } else if (child.Name.LocalName == "ExecuteOperation") { Operation operation = null; attr = (XAttribute)child.Attribute("name"); if (attr != null) operation = h.Classifier.Operations[attr.Value]; //Parameters param; List<ValueSpecification> param = new List<ValueSpecification>(); foreach (Parameter currentParam in operation.Parameters) { bool found = false; string strVal = ""; foreach (XElement parameterNode in child.Elements()) { if (parameterNode.Name.LocalName == "Parameter") { attr = (XAttribute)parameterNode.Attribute("name"); if (attr != null && currentParam.name == attr.Value) { attr = (XAttribute)parameterNode.Attribute("name"); if (attr != null) strVal = attr.Value; found = true; break; } } } if (!found) { continue; } strVal.Replace("+", " "); try { param.Add(currentParam.Type.createValueFromString(strVal)); } catch (ArgumentOutOfRangeException) { } } attr = (XAttribute)child.Attribute("name"); if (attr != null) h.executeOperation(attr.Value, param); //Debug.Log( " Launch oper : " + operation.getName() + " on entity : " + h.getName() ); //BehaviorScheduler::getInstance().executeBehavior(operation.getMethod(),h,param); } else if (child.Name.LocalName == "Entity") { Entity instance = _createEntity(child, h.Body); } } return h; }
public override void manageRequest(HttpRequest req) { string id = ""; if (req.parameters.ContainsKey("agent")) { id = req.parameters["agent"]; } Environment env = MascaretApplication.Instance.getEnvironment(); InstanceSpecification entity = null; if (env.InstanceSpecifications.ContainsKey(id)) { entity = env.InstanceSpecifications[id]; } VirtualHuman human = null; if (entity != null) { human = (VirtualHuman)(entity); } if (human != null) { env = human.KnowledgeBase.Environment; } id = req.parameters["alias"]; if (!env.InstanceSpecifications.ContainsKey(id)) { req.response.write("<html>"); req.response.write("<body>"); req.response.write("Can't find entity: " + id); req.response.write("</body>"); req.response.write("</html>"); return; } entity = env.InstanceSpecifications[id]; req.response.write("<html>"); req.response.write("<body>"); req.response.write("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"30\">"); req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); req.response.write("<link href=\"doxygen.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<link href=\"tabs.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<H2>Description</H2>"); req.response.write("<ul>"); req.response.write("<li>"); req.response.write(entity.name); req.response.write("</li>"); req.response.write("<li>"); req.response.write(entity.getFullName()); req.response.write("</li>"); req.response.write("<li>"); req.response.write(entity.Description); req.response.write("</li>"); req.response.write("<li>"); req.response.write(" <a href=\"Class?alias="); req.response.write(entity.Classifier.name); req.response.write("\" target = \"Body\">"); req.response.write("</a>"); req.response.write("</li>"); req.response.write("</ul>"); //req.response.flushBuffer(); Vector3 position = new Vector3(0, 0, 0); Vector3 orientation = new Vector3(0, 0, 0); Entity entity2 = (Entity)(entity); if (entity2 != null) { //position = entity2.getLocalPosition(); //orientation = entity2.getLocalOrientation(); req.response.write("<HR>"); req.response.write("<H2>Geometrie</H2>"); req.response.write("<FORM METHOD=GET action=\"changeGeometry\">"); req.response.write("<input type=\"hidden\" name=\"alias\" value=\""); req.response.write(id); req.response.write("\" />"); req.response.write("<TABLE BORDER=1>"); req.response.write("<TR>"); req.response.write("<TD>Position locale</TD>"); req.response.write("<TD>"); req.response.write("" + position.x); req.response.write("</TD>"); req.response.write("<TD>"); req.response.write("" + position.y); req.response.write("</TD>"); req.response.write("<TD>"); req.response.write("" + position.z); req.response.write("</TD>"); req.response.write("</TR>"); req.response.write("<TR>"); req.response.write("<TD>Orientation locale</TD>"); req.response.write("<TD>"); req.response.write("" + orientation.x); req.response.write("</TD>"); req.response.write("<TD>"); req.response.write("" + orientation.y); req.response.write("</TD>"); req.response.write("<TD>"); req.response.write("" + orientation.z); req.response.write("</TD>"); req.response.write("</TR>"); req.response.write("</TABLE>"); req.response.write("<INPUT TYPE=\"submit\" VALUE=\"Modifier\">"); req.response.write("</FORM>"); //req.response.flushBuffer(); } req.response.write("<HR>"); req.response.write("<H2>Attributs</H2>"); req.response.write("<FORM METHOD=GET action=\"changeAttributes\">"); req.response.write("<input type=\"hidden\" name=\"alias\" value=\""); req.response.write(id); req.response.write("\" />"); req.response.write("<ul>"); Dictionary <string, Slot> attributes = entity.Slots; foreach (KeyValuePair <string, Slot> attr in attributes) { req.response.write("<li>"); req.response.write(attr.Key); req.response.write(" = "); //string value = it->second->getValue().getStringFromValue(); string value = ""; foreach (KeyValuePair <string, ValueSpecification> val in attr.Value.Values) { value += "'" + val.Value.getStringFromValue() + "' "; } req.response.write(value); req.response.write("</li>"); } req.response.write("</ul>"); req.response.write("<INPUT TYPE=\"submit\" VALUE=\"Modifier\">"); req.response.write("</FORM>"); //req.response.flushBuffer(); req.response.write("<HR>"); req.response.write("<H2>Operations</H2>"); req.response.write("<ul>"); Class classifier = entity.Classifier; Dictionary <string, Operation> operations = classifier.Operations; foreach (KeyValuePair <string, Operation> operation in operations) { req.response.write("<li>"); req.response.write(" <a href=\"Operation?alias="); req.response.write(entity.name); req.response.write("&oper="); req.response.write(operation.Key); req.response.write("\" target = \"Body\">"); req.response.write(operation.Key); req.response.write("</a>"); req.response.write("</li>"); } req.response.write("</ul>"); //req.response.flushBuffer(); req.response.write("<HR>"); req.response.write("<H2>Signaux</H2>"); req.response.write("<ul>"); Dictionary <string, Behavior> behaviors = classifier.OwnedBehavior; foreach (KeyValuePair <string, Behavior> behavior in behaviors) { StateMachine stateMachine = (StateMachine)(behavior.Value); Region region = stateMachine.Region[0]; if (region != null) { List <Transition> transitions = region.Transitions; for (int iTrans = 0; iTrans < transitions.Count; iTrans++) { List <Trigger> triggers = transitions[iTrans].Trigger; for (int iTrig = 0; iTrig < triggers.Count; iTrig++) { MascaretEvent evt = triggers[iTrig].MEvent; if (evt != null) { if (evt.Type == "SignalEvent") { SignalEvent signalEvent = (SignalEvent)(evt); req.response.write("<li>"); req.response.write(" <a href=\"Signal?alias="); req.response.write(entity.name); req.response.write("&signal="); req.response.write(((SignalEvent)(evt)).SignalClass.name); req.response.write("\" target = \"Body\">"); req.response.write(((SignalEvent)(evt)).SignalClass.name); req.response.write("</a>"); req.response.write("</li>"); } } } } } } req.response.write("</ul>"); //req.response.flushBuffer(); req.response.write("<HR>"); req.response.write("<H2>Machines d'états</H2>"); req.response.write("<ul>"); List <StateMachineBehaviorExecution> stmbes = entity.SmBehaviorExecutions; for (int i = 0; i < stmbes.Count; i++) { Vertex state = stmbes[i].CurrentState; string name = stmbes[i].getStateMachine().name; string state_name = ""; if (state == null) { state_name = "inconnu"; } else { state_name = state.name; } string tmp = "<li>" + name + " - État actif: " + state_name + "</li>"; req.response.write(tmp); } req.response.write("</ul>"); req.response.write("<HR>"); req.response.write("<a href=\"CenterView?alias=" + entity.name + "\">Centrer la vue sur cette entité</a><br/>"); req.response.write("<a href=\"SetRed?alias=" + entity.name + "\">Mettre en rouge</a>"); req.response.write("</body>"); req.response.write("</html>"); //req.response.flushBuffer(); }
public DialogueActInterpreter(VirtualHuman host) { hostAgent = host; }
public override void manageRequest(HttpRequest req) { Class classe = null; string id = ""; if (req.parameters.ContainsKey("agent")) { id = req.parameters["agent"]; } Environment env = MascaretApplication.Instance.getEnvironment(); InstanceSpecification entity = null; if (env.InstanceSpecifications.ContainsKey(id)) { entity = env.InstanceSpecifications[id]; } VirtualHuman human = null; if (entity != null) { human = (VirtualHuman)(entity); } if (human != null) { env = human.KnowledgeBase.Environment; if (env != null) { classe = _findClasse(env.Model.Package, req.parameters["alias"]); } } else { classe = _findClasse(MascaretApplication.Instance.Model.Package, req.parameters["alias"]); } req.response.write("<html>"); req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); req.response.write("<body>"); req.response.write("<link href=\"doxygen.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<link href=\"tabs.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<H2>Description</H2>"); req.response.write("<ul>"); req.response.write("<li>"); req.response.write(classe.name); req.response.write("</li>"); req.response.write("<li>"); req.response.write(classe.getFullName()); req.response.write("</li>"); req.response.write("<li>"); req.response.write(classe.Summary); req.response.write("</li>"); req.response.write("<li>"); req.response.write(classe.Description); req.response.write("</li>"); req.response.write("</ul>"); req.response.write("<HR>"); req.response.write("<H2>Hierarchie</H2>"); req.response.write("<H3>Parent</H3>"); req.response.write("<ul>"); List <Classifier> parents = classe.Parents; for (int iC = 0; iC < parents.Count; iC++) { Classifier parent = classe.Parents[iC]; req.response.write("<li><a href=\"Class?alias="); req.response.write(parent.name); req.response.write("\" target = \"Body\">"); req.response.write(parent.name); req.response.write("</a></li>"); } req.response.write("</ul>"); //req.response.write("</ul>"); req.response.write("<HR>"); req.response.write("<H2>Attributs</H2>"); req.response.write("<ul>"); Dictionary <string, Property> attributes = classe.Attributes; foreach (KeyValuePair <string, Property> attr in attributes) { req.response.write("<li>"); req.response.write(attr.Key); req.response.write(" : "); req.response.write(attr.Value.Type.name); req.response.write("</li>"); } req.response.write("</ul>"); req.response.write("<HR>"); req.response.write("<H2>Operations</H2>"); Dictionary <string, Operation> operations = classe.Operations; foreach (KeyValuePair <string, Operation> oper in operations) { req.response.write("<li>"); req.response.write(oper.Key); req.response.write("( "); List <Parameter> parameters = oper.Value.Parameters; for (int iP = 0; iP < parameters.Count; iP++) { Parameter attr = parameters[iP]; req.response.write(attr.name); req.response.write(" : <a href=\"Class?alias="); req.response.write(attr.Type.name); req.response.write("\" target = \"Body\">"); req.response.write(attr.Type.name); req.response.write("</a>"); if (iP != parameters.Count - 1) { req.response.write(", "); } } req.response.write(" )"); req.response.write(" : "); if (oper.Value.Type != null) { req.response.write(oper.Value.Type.name); } else { req.response.write("undefined"); } req.response.write("</li>"); } req.response.write("<HR>"); req.response.write("<H2>Instances</H2>"); Dictionary <string, InstanceSpecification> instances = classe.Instances; foreach (KeyValuePair <string, InstanceSpecification> instance in instances) { req.response.write("<li>"); req.response.write("<a href=\"Entity?alias="); req.response.write(instance.Key); req.response.write("\" target = \"Body\">"); req.response.write(instance.Key); req.response.write("</a>"); } req.response.write("</body>"); req.response.write("</html>"); }
public override void manageRequest(HttpRequest req) { string id = ""; if (req.parameters.ContainsKey("agent")) { id = req.parameters["agent"]; } Environment env = MascaretApplication.Instance.getEnvironment(); InstanceSpecification entity = null; if (env.InstanceSpecifications.ContainsKey(id)) { entity = env.InstanceSpecifications[id]; } VirtualHuman human = null; if (entity != null) { human = (VirtualHuman)(entity); } if (human != null) { env = human.KnowledgeBase.Environment; } req.response.write("<html>"); req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); req.response.write("<body>"); req.response.write("<link href=\"doxygen.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<link href=\"tabs.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<div class=\"tabs\">"); req.response.write("<ul>"); if (human == null) { req.response.write("<li class=\"current\"><a href=\"Model\"><span>Model</span></a></li>"); } else { req.response.write("<li><a href=\"Model?agent="); req.response.write(human.name); req.response.write("\"><span>Model</span></a></li>"); } if (human == null) { req.response.write("<li class=\"current\"><a href=\"Instances\"><span>Entites</span></a></li>"); } else { req.response.write("<li class=\"current\"><a href=\"Instances?agent="); req.response.write(human.name); req.response.write("\"><span>Entites</span></a></li>"); } req.response.write("<li><a href=\"Agents\"><span>Humains Virtuels</span></a></li>"); req.response.write("<li><a href=\"Organisations\"><span>Organisations</span></a></li>"); req.response.write("<li><a href=\"Scenario\"><span>Scenario</span></a></li>"); req.response.write("<li><a href=\"Application\"><span>Application</span></a></li>"); req.response.write("<li><a href=\"FIPASL\"><span>FIPA SL</span></a></li>"); req.response.write("<li><a href=\"XOCL\"><span>XOCL</span></a></li>"); req.response.write("<li><a href=\"messages\"><span>Mes messages</span></a></li>"); req.response.write("</ul>"); req.response.write("</div>"); req.response.write("<HR>"); req.response.write("<HR>"); req.response.write("<H2>Entites</H2>"); if (env != null) { req.response.write("<ul>"); // for (unsigned int iEnt = 0; iEnt<ents.size(); iEnt++) foreach (KeyValuePair <string, InstanceSpecification> instance in env.InstanceSpecifications) { req.response.write("<li><a href=\"Entity?alias="); req.response.write(instance.Key); if (human != null) { req.response.write("&agent="); req.response.write(human.name); } req.response.write("\" target = \"Body\">"); req.response.write(instance.Key); req.response.write("</a></li>"); } req.response.write("</ul>"); } req.response.write("</body>"); req.response.write("</html>"); }
public override void manageRequest(HttpRequest req) { string id = ""; if (req.parameters.ContainsKey("agent")) { id = req.parameters["agent"]; } Environment env = MascaretApplication.Instance.getEnvironment(); InstanceSpecification entity = null; if (env.InstanceSpecifications.ContainsKey(id)) { entity = env.InstanceSpecifications[id]; } VirtualHuman human = null; if (entity != null) { human = (VirtualHuman)(entity); } req.response.write("<html>"); req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); req.response.write("<body>"); req.response.write("<link href=\"doxygen.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<link href=\"styles.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<link href=\"tabs.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<div class=\"tabs\">"); req.response.write("<ul>"); if (human == null) { req.response.write("<li class=\"current\"><a href=\"Model\"><span>Model</span></a></li>"); } else { req.response.write("<li><a href=\"Model?agent="); req.response.write(human.name); req.response.write("\"><span>Model</span></a></li>"); } if (human == null) { req.response.write("<li><a href=\"Instances\"><span>Entites</span></a></li>"); } else { req.response.write("<li><a href=\"Instances?agent="); req.response.write(human.name); req.response.write("\"><span>Entites</span></a></li>"); } req.response.write("<li><a href=\"Agents\"><span>Humains Virtuels</span></a></li>"); req.response.write("<li><a href=\"Organisations\"><span>Organisations</span></a></li>"); req.response.write("<li><a href=\"Scenario\"><span>Scenario</span></a></li>"); req.response.write("<li><a href=\"Application\"><span>Application</span></a></li>"); req.response.write("<li><a href=\"FIPASL\"><span>FIPA SL</span></a></li>"); req.response.write("<li><a href=\"XOCL\"><span>XOCL</span></a></li>"); req.response.write("<li><a href=\"messages\"><span>Mes messages</span></a></li>"); req.response.write("</ul>"); req.response.write("</div>"); req.response.write("<HR>"); req.response.write("<ul>"); Model model; if (human != null) { KnowledgeBase kb = human.KnowledgeBase; Environment envKB = kb.Environment; if (envKB != null) { _printPackage(0, req, env.Model.Package, human); } } else { _printPackage(0, req, MascaretApplication.Instance.Model.Package, null); } req.response.write("</ul>"); req.response.write("</body>"); req.response.write("</html>"); }
public override void manageRequest(HttpRequest req) { string id = req.parameters["alias"]; Environment env = MascaretApplication.Instance.getEnvironment(); if (!env.InstanceSpecifications.ContainsKey(id)) { req.response.write("<html>"); req.response.write("<body>"); req.response.write("Can't find entity: " + id); req.response.write("</body>"); req.response.write("</html>"); return; } InstanceSpecification entity = env.InstanceSpecifications[id]; VirtualHuman human = null; try { human = (VirtualHuman)(entity); } catch (InvalidCastException e) { req.response.write("<html>"); req.response.write("<body>"); req.response.write("Entity: " + id + " is not an agent"); req.response.write("</body>"); req.response.write("</html>"); return; } req.response.write("<html>"); req.response.write("<body>"); req.response.write("<META HTTP-EQUIV=\"Refresh\" CONTENT=\"30\">"); req.response.write("<META HTTP-EQUIV=\"Content-Type\" content=\"text/html; charset=UTF-8\">"); req.response.write("<link href=\"doxygen.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<link href=\"tabs.css\" rel=\"stylesheet\" type=\"text/css\">"); req.response.write("<H2>Description</H2>"); req.response.write("<ul>"); req.response.write("<li>"); req.response.write(human.name); req.response.write("</li>"); req.response.write("<li>"); req.response.write(human.getFullName()); req.response.write("</li>"); req.response.write("<li>"); req.response.write(human.Description); req.response.write("</li>"); req.response.write("<li>"); req.response.write(" <a href=\"Class?alias="); req.response.write(human.Classifier.name); req.response.write("\" target = \"Body\">"); req.response.write("</a>"); req.response.write("</li>"); req.response.write("</ul>"); string setControlled = req.parameters["setControlled"]; if (setControlled == "true") { human.ControlledByHuman = true; } else if (setControlled == "false") { human.ControlledByHuman = false; } req.response.write("<HR>"); req.response.write("<H2>Toggle controlled by human</H2>"); req.response.write("<FORM METHOD=POST action=\"Agent?alias=" + id + "\">"); req.response.write("<input type=\"hidden\" name=\"alias\" value=\"" + id + "\" />"); if (human.ControlledByHuman) { req.response.write("<font color=\"darkred\">This agent is currently controlled. (will not follow procedure automatically)</font><br />"); req.response.write("<input type=\"hidden\" name=\"setControlled\" value=\"false\" />"); req.response.write("<input type=\"submit\" name=\"control\" value=\"Release control of this agent\" />"); } else { req.response.write("<font color=\"darkgreen\">This agent is currently automatic. (will automatically follow procedures)</font><br />"); req.response.write("<input type=\"hidden\" name=\"setControlled\" value=\"true\" />"); req.response.write("<input type=\"submit\" name=\"control\" value=\"Take control of this agent\" />"); } req.response.write("</FORM>"); req.response.write("<HR>"); req.response.write("<H2>Knowledge base</H2>"); KnowledgeBase kb = human.KnowledgeBase; if (kb != null) { req.response.write(" <a href=\"KnowledgeBase?alias="); req.response.write(human.name); req.response.write("\" target = \"_blank\">"); req.response.write(kb.name); req.response.write("</a>"); } req.response.write("<HR>"); req.response.write("<H2>Parler</H2>"); req.response.write("<FORM METHOD=GET action=\"speak\">"); req.response.write("<input type=\"hidden\" name=\"alias\" value=\""); req.response.write(id); req.response.write("\" />"); req.response.write("Texte : \t <INPUT name=\"text\">"); req.response.write("<INPUT TYPE=\"submit\" VALUE=\"Dire\">"); req.response.write("</FORM>"); req.response.write("<HR>"); req.response.write("<H2>Attributs</H2>"); req.response.write("<FORM METHOD=GET action=\"changeAttributes\">"); req.response.write("<input type=\"hidden\" name=\"alias\" value=\""); req.response.write(id); req.response.write("\" />"); req.response.write("<ul>"); Dictionary <string, Slot> attributes = human.Slots; foreach (KeyValuePair <string, Slot> attr in attributes) { req.response.write("<li>"); req.response.write(attr.Key); req.response.write(" = "); //string value = it->second->getValue().getStringFromValue(); string value = ""; foreach (KeyValuePair <string, ValueSpecification> val in attr.Value.Values) { value += "'" + val.Value.getStringFromValue() + "' "; } req.response.write(value); req.response.write("</li>"); } req.response.write("</ul>"); req.response.write("<INPUT TYPE=\"submit\" VALUE=\"Modifier\">"); req.response.write("</FORM>"); //req.response.flushBuffer(); req.response.write("<HR>"); req.response.write("<H2>Operations</H2>"); req.response.write("<ul>"); Class classifier = human.Classifier; Dictionary <string, Operation> operations = classifier.Operations; foreach (KeyValuePair <string, Operation> operation in operations) { req.response.write("<li>"); req.response.write(" <a href=\"Operation?alias="); req.response.write(human.name); req.response.write("&oper="); req.response.write(operation.Key); req.response.write("\" target = \"Body\">"); req.response.write(operation.Key); req.response.write("</a>"); req.response.write("</li>"); } req.response.write("</ul>"); //req.response.flushBuffer(); req.response.write("<HR>"); req.response.write("<H2>Signaux</H2>"); req.response.write("<ul>"); Dictionary <string, Behavior> behaviors = classifier.OwnedBehavior; foreach (KeyValuePair <string, Behavior> behavior in behaviors) { StateMachine stateMachine = (StateMachine)(behavior.Value); Region region = stateMachine.Region[0]; if (region != null) { List <Transition> transitions = region.Transitions; for (int iTrans = 0; iTrans < transitions.Count; iTrans++) { List <Trigger> triggers = transitions[iTrans].Trigger; for (int iTrig = 0; iTrig < triggers.Count; iTrig++) { MascaretEvent evt = triggers[iTrig].MEvent; if (evt != null) { if (evt.Type == "SignalEvent") { SignalEvent signalEvent = (SignalEvent)(evt); req.response.write("<li>"); req.response.write(" <a href=\"Signal?alias="); req.response.write(human.name); req.response.write("&signal="); req.response.write(((SignalEvent)(evt)).SignalClass.name); req.response.write("\" target = \"Body\">"); req.response.write(((SignalEvent)(evt)).SignalClass.name); req.response.write("</a>"); req.response.write("</li>"); } } } } } } req.response.write("</ul>"); req.response.write("</ul>"); req.response.write("<HR>"); req.response.write("<H2>Messages</H2>"); req.response.write(" AID : "); req.response.write(human.Aid.toString()); req.response.write("<H3>"); req.response.write(" <a href=\"createMessage?alias="); req.response.write(human.name); req.response.write("\" target = \"Body\">"); req.response.write("Envoyer un message"); req.response.write("</a>"); req.response.write("</H3>"); req.response.write("<H3>Non lus</H3>"); List <ACLMessage> nl = human.Mailbox.MessagesQueue; req.response.write("<TABLE BORDER=1>"); req.response.write("<TR>"); req.response.write("<TD>De </TD>"); req.response.write("<TD>Performative </TD>"); req.response.write("<TD>Contenu </TD>"); req.response.write("</TR>"); for (int inl = 0; inl < nl.Count; inl++) { ACLMessage msg = nl[inl]; //nl.erase(nl.begin()); req.response.write("<TR>"); req.response.write("<TD>"); req.response.write(msg.Sender.toString()); req.response.write("</TD>"); req.response.write("<TD>"); req.response.write(msg.getPerformativeText()); req.response.write("</TD>"); req.response.write("<TD>"); req.response.write(msg.Content); req.response.write("</TD>"); req.response.write("</TR>"); } req.response.write("</TABLE>"); req.response.write("<H3>Lus</H3>"); List <ACLMessage> l = human.Mailbox.MessagesChecked; req.response.write("<TABLE BORDER=1>"); req.response.write("<TR>"); req.response.write("<TD>De </TD>"); req.response.write("<TD>Performative </TD>"); req.response.write("<TD>Contenu </TD>"); req.response.write("</TR>"); for (int il = 0; il < l.Count; il++) { ACLMessage msg = l[il]; req.response.write("<TR>"); req.response.write("<TD>"); req.response.write(msg.Sender.toString()); req.response.write("</TD>"); req.response.write("<TD>"); req.response.write(msg.getPerformativeText()); req.response.write("</TD>"); req.response.write("<TD>"); req.response.write(msg.Content); req.response.write("</TD>"); req.response.write("</TR>"); } req.response.write("</TABLE>"); req.response.write("<H3>Envoyes</H3>"); List <ACLMessage> me = human.Mailbox.MessagesSent; req.response.write("<TABLE BORDER=1>"); req.response.write("<TR>"); req.response.write("<TD>A </TD>"); req.response.write("<TD>Performative </TD>"); req.response.write("<TD>Contenu </TD>"); req.response.write("</TR>"); for (int ie = 0; ie < me.Count; ie++) { ACLMessage msg = me[ie]; req.response.write("<TR>"); req.response.write("<TD>"); List <AID> receivers = msg.Receivers; for (int ir = 0; ir < receivers.Count; ir++) { req.response.write(receivers[ir].toString()); } req.response.write("</TD>"); req.response.write("<TD>"); req.response.write(msg.getPerformativeText()); req.response.write("</TD>"); req.response.write("<TD>"); req.response.write(msg.Content); req.response.write("</TD>"); req.response.write("</TR>"); } }