Esempio n. 1
0
        private void Initialize()
        {
            /* Input Parameters. */
            // Common.
            Currencies = new ObservableCollection <string>();
            Currencies.Add("SAT");
            Currencies.Add("USD");
            Currency = "USD";

            /* Configuration */

            /* Market. */
            _market = new Market();
            _market.Start();
            _market.SpotTick       += (o, e) => HandleSpotTick();
            _market.VolatilityTick += (o, e) => HandleVolatilityTick();
            _market.FuturesTick    += (o, e) => HandleFuturesTick();

            /* Position Reader */
            _positionReader = new PositionReader(_market);

            /* Spread Thresholds */
            EuphoriaMin      = 25.0;
            LargeContangoMin = 15.0;
            ContangoMin      = 10.0;
            SmallContangoMin = 0.0;
            BackwardationMin = -2.0;

            /* Populate Historical Data */
            _positionReader.RefreshCSV("/home/user/github/mailbox-calculator/data/FuturesCSV.csv"
                                       , _currency, _euphoriaMin, _largeContangoMin, _contangoMin, _smallContangoMin, _backwardationMin);
            HistoricalDataCurve = _positionReader.HistoricalDataCurve;
        }
Esempio n. 2
0
        private void LoadKNBA(BinaryReader r)
        {
            var animCount          = r.ReadUInt16();
            var totalFrames        = r.ReadUInt16();
            var animOffset         = r.ReadUInt32();
            var frameBaseOffset    = r.ReadUInt32();
            var positionBaseOffset = r.ReadUInt32();

            animations = new List <Animation>(animCount);

            var positionReader = new PositionReader(new SubStream(r.BaseStream, positionBaseOffset));

            using (var animationReader = new BinaryReader(new SubStream(r.BaseStream, animOffset))) {
                for (var animIndex = 0; animIndex < animCount; ++animIndex)
                {
                    var anim            = new Animation();
                    var animationFrames = animationReader.ReadUInt16();
                    anim.LoopStart = animationReader.ReadUInt16();
                    var positionType = (FramePosition.PositionType)animationReader.ReadUInt32();
                    anim.PlaybackMode = (AnimationPlaybackMode)animationReader.ReadUInt32();
                    var frameOffset = animationReader.ReadUInt32();

                    using (var frameReader = new BinaryReader(new SubStream(r.BaseStream, frameBaseOffset + frameOffset))) {
                        anim.Frames = ReadFrames(animationFrames, positionType, frameReader, positionReader);
                    }

                    animations.Add(anim);
                }
            }
        }
Esempio n. 3
0
 private void Awake()
 {
     touchsensor      = gameObject.GetComponent <TouchSensor>();
     button           = gameObject.GetComponent <ButtonSensor>();
     rfidsensor       = gameObject.GetComponent <RFIDReader>();
     objectposition   = gameObject.GetComponent <PositionReader>();
     lightcontroller  = gameObject.GetComponent <LightController>();
     soundemitter     = gameObject.GetComponent <SoundEmitterController>();
     motorcontroller  = gameObject.GetComponent <MotorController>();
     videoemitter     = gameObject.GetComponent <VideoEmitterController>();
     effectcontroller = gameObject.GetComponent <EffectController>();
 }
Esempio n. 4
0
        public void TestLoggedPositionData()
        {
            Stream         fileStream = new FileStream(@"C:\Temp\temp.location", FileMode.Open);
            PositionReader reader     = new PositionReader(fileStream);

            using (Stream outputStream = new FileStream(@"C:\Temp\export.xyz", FileMode.Create))
                using (StreamWriter writer = new StreamWriter(outputStream))
                {
                    for (int i = 0; i < reader.Count; i++)
                    {
                        Tuple <PositionData, long> data = reader.ReadPositionAt(i);
                        writer.WriteLine(String.Format("{0},{1},{2}", data.Item1.X, data.Item1.Y, data.Item1.Z));
                    }
                }
        }
        public SpatialReference(KinectReader kinectReader, PositionReader positionReader)
        {
            this.kinectReader   = kinectReader;
            this.positionReader = positionReader;

            string wkt = "GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.0174532925199433]]";

            this.wgs84 = (ICoordinateSystem)ProjNet.Converters.WellKnownText.CoordinateSystemWktReader.Parse(wkt);

            //hardcoded UTM 55S - should parameterize
            string toWKT = "PROJCS[\"WGS 72BE / UTM zone 55S\",GEOGCS[\"WGS 72BE\",DATUM[\"WGS_1972_Transit_Broadcast_Ephemeris\",SPHEROID[\"WGS 72\",6378135,298.26,AUTHORITY[\"EPSG\",\"7043\"]],TOWGS84[0,0,1.9,0,0,0.814,-0.38],AUTHORITY[\"EPSG\",\"6324\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4324\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",147],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",10000000],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AUTHORITY[\"EPSG\",\"32555\"]]";

            this.toCs = (ICoordinateSystem)ProjNet.Converters.WellKnownText.CoordinateSystemWktReader.Parse(toWKT);

            CoordinateTransformationFactory ctfac = new CoordinateTransformationFactory();

            this.toGridtrans = ctfac.CreateFromCoordinateSystems(wgs84, toCs);
        }
Esempio n. 6
0
        public void TestRealWorld()
        {
            Stream       fileStream   = new FileStream(@"C:\Temp\2011_1_22_20_39.kinect", FileMode.Open);
            KinectReader kinectReader = new KinectReader(fileStream, 640, 480);

            Stream         positionFileStream = new FileStream(@"C:\Temp\2011_1_22_20_39.location", FileMode.Open);
            PositionReader positionReader     = new PositionReader(positionFileStream);

            SpatialReference reference = new SpatialReference(kinectReader, positionReader);

            KinectExporter exporter = new KinectExporter(null);

            using (Stream outputStream = new FileStream(@"C:\Temp\export.ply", FileMode.Create))
            {
                var points = reference.GetRealWorldPointCloudAt(33);

                for (int i = 34; i < 50; i++)
                {
                    points.AddRange(reference.GetRealWorldPointCloudAt(i));
                }
                exporter.ExportPointsToPLY(points, outputStream);
            }
        }
Esempio n. 7
0
        private List <AnimationFrame> ReadFrames(ushort totalFrames, FramePosition.PositionType positionType, BinaryReader frameReader, PositionReader positionReader)
        {
            List <AnimationFrame> Frames = new List <AnimationFrame>();

            for (int frameIndex = 0; frameIndex < totalFrames; ++frameIndex)
            {
                var frame          = new AnimationFrame();
                int positionOffset = frameReader.ReadInt32();
                frame.FrameTime = frameReader.ReadUInt16();
                frameReader.Skip(2);
                frame.Position = positionReader.ReadPosition(positionOffset, positionType);

                Frames.Add(frame);
            }
            return(Frames);
        }