Esempio n. 1
0
        public ShapeDynamic(ShapeTypeDataWriter dataWriter, Shape shape, Rect constraint, int speed, InteroperatibilityProvider provider)
        {
            _dataWriter = dataWriter;
            _shape      = shape;
            _constraint = constraint;
            _speed      = speed;
            _provider   = provider;

            _angle       = Math.PI / 6;
            _alpha       = Math.PI / 6;
            _shapeBounds = new Rect(0, 0, _shape.Size, _shape.Size);
            _timer       = new Timer(Simulate, null, 0, 25);
            _random      = new Random();

            switch (_provider)
            {
            case InteroperatibilityProvider.Rti:
                _factorX = RTI_FACTOR_X;
                _factorY = RTI_FACTOR_Y;
                break;

            default:
                _factorX = OPENDDS_FACTOR_X;
                _factorY = OPENDDS_FACTOR_Y;
                break;
            }
        }
Esempio n. 2
0
        public void Dispose()
        {
            if (!_disposed)
            {
                _timer.Dispose();
                _timer = null;

                _dataWriter = null;

                _disposed = true;
            }
        }
Esempio n. 3
0
        private ShapeTypeDataWriter CreateTriangleWriter()
        {
            DataWriterQos qos    = GetDataWriterQos();
            DataWriter    writer = _publisher.CreateDataWriter(_triangleTopic, qos);

            if (writer == null)
            {
                throw new Exception("Could not create triangle data writer");
            }

            ShapeTypeDataWriter triangleDataWriter = new ShapeTypeDataWriter(writer);

            return(triangleDataWriter);
        }
Esempio n. 4
0
        private ShapeTypeDataWriter CreateSquareWriter()
        {
            DataWriterQos qos    = GetDataWriterQos();
            DataWriter    writer = _publisher.CreateDataWriter(_squareTopic);

            if (writer == null)
            {
                throw new Exception("Could not create square data writer");
            }

            ShapeTypeDataWriter squareDataWriter = new ShapeTypeDataWriter(writer);

            return(squareDataWriter);
        }