예제 #1
0
 protected void CargaValores()
 {
     float[] color=new float[4];
     XmlDocument partReader=new XmlDocument();
     reader.Load(Application.StartupPath+"\\RsaConfig.xml");
     XmlNode node = reader.SelectSingleNode("./Descriptor");
     //particulaXml
     node=node.FirstChild;
     config["particulaXml"]=node.InnerText;
     //particulaInicial
     node=node.NextSibling;
     config["particulaInicial"]=node.InnerText;
     //ladoCubo
     node=node.NextSibling;
     config["ladoCubo"]=ParseDouble(node.InnerText);
     //fraccionVolumetrica
     node=node.NextSibling;
     config["fraccionVolumetrica"]=ParseDouble(node.InnerText);
     //parametroVariable
     node=node.NextSibling;
     config["parametroVariable"]=node.InnerText;
     XmlParticulaReader part=new XmlParticulaReader((string)config["particulaXml"]);
     ParametroInfo pinfo=part.GetInfoParametros((string)config["particulaInicial"]);
     if(node.InnerText=="cantidadParticulas")
     {
         node=node.NextSibling;
         config["cantidadParticulas"]=int.Parse(node.InnerText);
         node=node.NextSibling;
         XmlNodeList xmlnod=node.SelectNodes("parametro");
         int count=xmlnod.Count;
         object[] aux=new object[count];
         for(int i=0;i<count;i++)
         {
             aux[i]=0;
         }
         config["parametros"]=aux;
     }
     else
     {
         node=node.NextSibling;
         config["cantidadParticulas"]=0;
         node=node.NextSibling;
         XmlNodeList xmlnod=node.SelectNodes("parametro");
         int count=0;
         object[] aux=new object[xmlnod.Count];
         foreach(XmlNode nod in xmlnod)
         {
             aux[count]=Parse(nod.InnerText,pinfo.ListaDatosDeParametros[count].tipo);
             count++;
         }
         config["parametros"]=aux;
     }
     //spheresInBox
     node=node.NextSibling;
     config["spheresInBox"]=bool.Parse(node.InnerText);;
     //colorCubo
     node=node.NextSibling;
     color[0]=ParseFloat(node.SelectSingleNode("rojo").InnerText);
     color[1]=ParseFloat(node.SelectSingleNode("verde").InnerText);
     color[2]=ParseFloat(node.SelectSingleNode("azul").InnerText);
     color[3]=ParseFloat(node.SelectSingleNode("transparencia").InnerText);
     config["colorCubo"]=color;
     //colorParticulaAleatorio
     node=node.NextSibling;
     config["colorParticulaAleatorio"]=bool.Parse(node.InnerText);;
     color=new float[4];
     node=node.NextSibling;
     color[0]=ParseFloat(node.SelectSingleNode("rojo").InnerText);
     color[1]=ParseFloat(node.SelectSingleNode("verde").InnerText);
     color[2]=ParseFloat(node.SelectSingleNode("azul").InnerText);
     color[3]=ParseFloat(node.SelectSingleNode("transparencia").InnerText);
     config["colorParticulas"]=color;
     //mostrarNumeros
     node=node.NextSibling;
     config["mostrarNumeros"]=bool.Parse(node.InnerText);
     //rsaClase
     node=node.NextSibling;
     config["rsaClase"]=node.InnerText;
 }
예제 #2
0
        public WinForms()
        {
            modified=false;
            scene = new Scene();
            scene.redraw += new EventHandler(scene_redraw);
            InitializeComponent();
            if(Screen.PrimaryScreen.Bounds.Width==800 &&Screen.PrimaryScreen.Bounds.Height==600)
            {
                this.WindowState=FormWindowState.Maximized;
            }
            this.uiStatusBar1.Panels[0].Width=this.uiTab1.Location.X+uiTab1.Width;

            simpleOpenGlControl1.InitializeContexts();
            scene.Initialize();
            scene.Reshape(simpleOpenGlControl1.Width, simpleOpenGlControl1.Height);
            config=new RSAConfiguration();
            reader=new XmlParticulaReader((string)config.Valores["particulaXml"]);
            ParametroInfo pInfo=reader.GetInfoParametros((string)config.Valores["particulaInicial"]);
            //			varPar=(object[])config.Valores["parametros"];
            //			for(int i=0;i<pInfo.Cantidad;i++)
            //			{
            //				varPar[i]=0;
            //			}
            scene.element=new RSADibujable(config, reader.GetInfoParticulas((string)config.Valores["particulaInicial"]),this);
            textBox1.Text=((RSADibujable)scene.element).AnsysObj.Ruta;
            textBox2.Text=((RSADibujable)scene.element).AnsysObj.NombreArchivo;
            Init();
            //			this.progressBar1.Location=this.uiStatusBar1.Location;
            //			this.progressBar1.Left=this.uiTab1.Location.X+uiTab1.Width;
            //			this.progressBar1.Top-=this.progressBar1.Height;
        }