Пример #1
0
 public static void readCameraSettings(XElement x3d_or_xenv_element)
 {
     CustomXMLDocumentOperations X = new CustomXMLDocumentOperations();
     Scientrace.Vector cameraviewpoint = Scientrace.TraceJournal.Instance.cameraviewpoint;
     Scientrace.Vector camrotationvec = Scientrace.TraceJournal.Instance.camrotationvector;
     Scientrace.TraceJournal.Instance.labelaxes = X.getXBool(x3d_or_xenv_element, "DrawAxes", Scientrace.TraceJournal.Instance.labelaxes);
     double camrotationangle = Scientrace.TraceJournal.Instance.camrotationangle;
     XElement camfrom = (x3d_or_xenv_element == null? null:x3d_or_xenv_element.Element("CameraFrom"));
     XElement camrot = (x3d_or_xenv_element == null? null:x3d_or_xenv_element.Element("CameraRotation"));
     if (camfrom !=null) {
     cameraviewpoint = X.getXNzVector(camfrom);
     Scientrace.Vector camdirvec = cameraviewpoint.negative();
     Scientrace.NonzeroVector defvec = new Scientrace.NonzeroVector(0,0,-1);
     camrotationangle = defvec.angleWith(camdirvec);
     camrotationvec = defvec.crossProduct(camdirvec);
     }
     if (camrot != null) {
     camrotationvec = X.getXVectorByName(camrot, "Vector");
     camrotationangle = X.getXAngleByName(camrot, "Angle");
     }
     Scientrace.TraceJournal.Instance.cameraviewpoint = X.getXVectorByName(x3d_or_xenv_element, "CameraViewpoint", cameraviewpoint);
     Scientrace.TraceJournal.Instance.camrotationangle = camrotationangle;
     if (camrotationvec != null)
     Scientrace.TraceJournal.Instance.camrotationvector = camrotationvec;
 }
Пример #2
0
        public static void readCameraSettings(XElement x3d_or_xenv_element)
        {
            CustomXMLDocumentOperations X = new CustomXMLDocumentOperations();

            Scientrace.Vector cameraviewpoint = Scientrace.TraceJournal.Instance.cameraviewpoint;
            Scientrace.Vector camrotationvec  = Scientrace.TraceJournal.Instance.camrotationvector;
            Scientrace.TraceJournal.Instance.labelaxes = X.getXBool(x3d_or_xenv_element, "DrawAxes", Scientrace.TraceJournal.Instance.labelaxes);
            double   camrotationangle = Scientrace.TraceJournal.Instance.camrotationangle;
            XElement camfrom          = (x3d_or_xenv_element == null? null:x3d_or_xenv_element.Element("CameraFrom"));
            XElement camrot           = (x3d_or_xenv_element == null? null:x3d_or_xenv_element.Element("CameraRotation"));

            if (camfrom != null)
            {
                cameraviewpoint = X.getXNzVector(camfrom);
                Scientrace.Vector        camdirvec = cameraviewpoint.negative();
                Scientrace.NonzeroVector defvec    = new Scientrace.NonzeroVector(0, 0, -1);
                camrotationangle = defvec.angleWith(camdirvec);
                camrotationvec   = defvec.crossProduct(camdirvec);
            }
            if (camrot != null)
            {
                camrotationvec   = X.getXVectorByName(camrot, "Vector");
                camrotationangle = X.getXAngleByName(camrot, "Angle");
            }
            Scientrace.TraceJournal.Instance.cameraviewpoint  = X.getXVectorByName(x3d_or_xenv_element, "CameraViewpoint", cameraviewpoint);
            Scientrace.TraceJournal.Instance.camrotationangle = camrotationangle;
            if (camrotationvec != null)
            {
                Scientrace.TraceJournal.Instance.camrotationvector = camrotationvec;
            }
        }
 public ScientraceEnvironmentSetup(string configfilename)
 {
     this.configfilename = configfilename;
     this.X = new CustomXMLDocumentOperations();
     Scientrace.TraceJournal.reset();
     this.parseConfiguration();
 }
Пример #4
0
 public ScientraceEnvironmentSetup(string configfilename)
 {
     this.configfilename = configfilename;
     this.X = new CustomXMLDocumentOperations();
     Scientrace.TraceJournal.reset();
     this.parseConfiguration();
 }
Пример #5
0
        public ScientraceXMLParser(XDocument xd)
        {
            //TODO: read from XML and put in appropriate method
            Scientrace.VectorTransform.CACHE_TRANSFORMS = true;

            this.xd = xd;
            this.X = new CustomXMLDocumentOperations();
            this.xsctconf = this.xd.Element("ScientraceConfig");
            this.setTraceJournalProperties(xsctconf);
            if (this.xsctconf == null) { throw new NotSupportedException("No <ScientraceConfig> root-node in XML");}
        }
Пример #6
0
        public ScientraceXMLParser(XDocument xd)
        {
            //TODO: read from XML and put in appropriate method
            Scientrace.VectorTransform.CACHE_TRANSFORMS = true;

            this.xd       = xd;
            this.X        = new CustomXMLDocumentOperations();
            this.xsctconf = this.xd.Element("ScientraceConfig");
            this.setTraceJournalProperties(xsctconf);
            if (this.xsctconf == null)
            {
                throw new NotSupportedException("No <ScientraceConfig> root-node in XML");
            }
        }
Пример #7
0
        public KeyExplodeArray(XElement xe)
        {
            CustomXMLDocumentOperations X = new CustomXMLDocumentOperations();
            this.name = xe.Attribute("Key").Value;
            try {
            this.valuefrom = X.getXDouble(xe, "From");
            } catch(Exception e) { Console.WriteLine("Parser error for key "+this.name+": ");
                throw(e);
            }
            //this.valuefrom = Convert.ToDouble(xe.Attribute("From").Value);
            this.reset();

            try {
            this.valueto = X.getXDouble(xe, "To");
            } catch(Exception e) { Console.WriteLine("Parser error for key "+this.name+": ");
                throw(e);
            }

            //this.valueto = Convert.ToDouble(xe.Attribute("To").Value);
            try {
            this.valuestepsize = X.getXDouble(xe, "Step");
            } catch(Exception e) { Console.WriteLine("Parser error for key "+this.name+": ");
                throw(e);
            }
            //this.valuestepsize = Convert.ToDouble(xe.Attribute("Step").Value);

            if (xe.Attribute("AddToFilenameValue") != null) {
            this.filenameValueAdd = X.getXDouble(xe, "AddToFilenameValue");
            }

            if (xe.Attribute("Decimals") != null) {
            int decimals = Convert.ToInt32(xe.Attribute("Decimals").Value);
            if (xe.Attribute("PreDecimals") != null) {
                int predecimals = Convert.ToInt32(xe.Attribute("PreDecimals").Value);
                this.mask = "{0:"+"0".Multiply(predecimals)+"."+"0".Multiply(decimals)+"}";
                } else {
                this.mask = "{0:0."+"0".Multiply(decimals)+"}";
                }
            }
        }
 //protected XElement xel;
 public ScientraceXMLAbstractParser()
 {
     //public ScientraceXMLAbstractParser(XElement xel, CustomXMLDocumentOperations X) {
     //this.xel = xel;
     this.X = new CustomXMLDocumentOperations();
 }
        //protected XElement xel;

        public ScientraceXMLAbstractParser()
        {
            //public ScientraceXMLAbstractParser(XElement xel, CustomXMLDocumentOperations X) {
            //this.xel = xel;
            this.X = new CustomXMLDocumentOperations();
        }