Exemple #1
0
  public Mass(Model model, XmlReader xml) : base(model,xml) {//throws Exception {
    //super(model, xml);
      //foreach(XmlAttribute attribute in xml.Attributes)
      //{
          //string key = attribute.Name;
      if (xml.MoveToAttribute("VX".ToLower()))
      {
        velocityX = double.Parse(xml.ReadContentAsString());
      }
      if (xml.MoveToAttribute("VY".ToLower()))
      {
          velocityY = double.Parse(xml.ReadContentAsString());
      }



      //}
    //Enumeration enum = xml.enumerateAttributeNames();
    //while (enum.hasMoreElements()) {
    //  String key = enum.nextElement().toString();
    //  if (key.equals("VX")) {
    //    velocityX = xml.getDoubleAttribute(key);
    //  }
    //  if (key.equals("VY")) {
    //    velocityY = xml.getDoubleAttribute(key);
    //  }
    //}
  }
Exemple #2
0
 public Spring(Node a, Node b, double restLength,
               double amplitude, double phase, Model model) : base(a,b, model){
   //super(a, b, model);
   this.restLength = restLength;
   this.amplitude = amplitude;
   this.phase = phase;
 }
Exemple #3
0
  public Node(double x, double y, Model model) {

      //Debug.WriteLine("Model created ({0}, {1})", x, y);
      this.model = model;
    this.positionX = x;
    this.positionY = y;
    this.velocityX = 0;
    this.velocityY = 0;
  }
Exemple #4
0
  public Spring(Model model, XmlReader xml) :base(model,xml) {//throws Exception {
    //super(model, xml);
      //foreach(XmlAttribute attribute in xml.Attributes)
      //{
      //    string key = attribute.Name;
      if (xml.MoveToAttribute("RESTLENGTH".ToLower()))
      {
               restLength = double.Parse(xml.ReadContentAsString());// xml.getDoubleAttribute(key);
      }
      if (xml.MoveToAttribute("AMPLITUDE".ToLower()))
      {
          amplitude = double.Parse(xml.ReadContentAsString());
        Model.checkRange(amplitude, 0.0, 1.0, "Spring amplitude");
      }
      if (xml.MoveToAttribute("PHASE".ToLower()))
      {
          phase = double.Parse(xml.ReadContentAsString());
        Model.checkRange(phase, 0.0, 1.0, "Spring phase");
      }

      //}

    //Enumeration enum = xml.enumerateAttributeNames();
    //while (enum.hasMoreElements()) {
    //  String key = enum.nextElement().toString();
    //  if (key.equals("RESTLENGTH")) {
    //    restLength = xml.getDoubleAttribute(key);
    //  }
    //  if (key.equals("AMPLITUDE")) {
    //    amplitude = xml.getDoubleAttribute(key);
    //    Model.checkRange(amplitude, 0.0, 1.0, "Spring amplitude");
    //  }
    //  if (key.equals("PHASE")) {
    //    phase = xml.getDoubleAttribute(key);
    //    Model.checkRange(phase, 0.0, 1.0, "Spring phase");
    //  }
    //}
  }
Exemple #5
0
  public Link(Model model, XmlReader xml) {//throws Exception {
    this.model = model;
     
      //foreach(XmlAttribute attribute in xml.Attributes)
      //{
      //     //string key = enum.nextElement().toString();
      //    string key = attribute.Name;
    if (xml.MoveToAttribute("A".ToLower()))
          {
              a = model.getNode(xml.ReadContentAsString());// xml.GetAttribute(key));
      }
    if (xml.MoveToAttribute("B".ToLower()))
          {
              b = model.getNode(xml.ReadContentAsString());//xml.GetAttribute(key));
      }


      //}
    //Enumeration enum = xml.enumerateAttributeNames();
    //while (enum.hasMoreElements()) {
     
    //}
  }
Exemple #6
0
 public Mass(double x, double y, double vx, double vy, Model model) :base(x,y,model) {
   //super(x, y, model);
   this.velocityX = vx;
   this.velocityY = vy;
 }
Exemple #7
0
        public void merge(Model model)
        {
            List<Link> mergeList = model.Links;
            mergeList.ForEach(link => this.addLink(link));

            width = model.width;
            height = model.height;

            //Iterator iter = model.getLinks().iterator();
            //while (iter.hasNext()) {
            //  Link link = (Link) iter.next();
            //  this.addLink(link);
            //}
            //width = model.width;
            //height = model.height;
        }
Exemple #8
0
  public Node(Model model, XmlReader xml){// throws Exception {
      this.model = model;



      if (xml.MoveToAttribute("ID".ToLower()))
      {
          id = (xml.ReadContentAsString());
      }
      if (xml.MoveToAttribute("X".ToLower()))
       {
           positionX = double.Parse(xml.ReadContentAsString());
          
       }
      if (xml.MoveToAttribute("Y".ToLower()))
       {
           positionY = double.Parse(xml.ReadContentAsString());
         
       }
      //Debug.WriteLine("ReadPos ({0},{1}): ", positionX, positionY);

      //foreach (XmlAttribute attribute in xml.Attributes)
      //{
      //    //string key = enum.nextElement().toString();
      //    string key = attribute.Name;
      //    if (key.Equals("ID"))
      //    {
      //        id = (xml.Attributes[key].Value);
      //    }
      //    if (key.Equals("X"))
      //    {
      //        positionX = double.Parse(xml.Attributes[key].Value);
      //    }
      //    if (key.Equals("Y"))
      //    {
      //        positionY = double.Parse(xml.Attributes[key].Value);
      //    }
      //}



  }
Exemple #9
0
 public Node(Model model) {
   this.model = model;
 }
Exemple #10
0
 public Link(Node a, Node b, Model model) {
   this.a = a;
   this.b = b;
   this.model = model;
 }