Example #1
0
        Quadrangle GetViewCone(float distance)
        {
            const float viewConeWidthCoef = 1.2f;
            float       humanWidth        = (UpperLeftCorner - UpperRightCorner).Length();
            float       coneExpansion     = ((distance * viewConeWidthCoef) - humanWidth) * 0.5f;
            Vector2     ul = UpperLeftCorner.Go(distance, azimuth).Go(coneExpansion, azimuth - MathHelper.PiOver2);
            Vector2     ur = UpperLeftCorner.Go(distance, azimuth).Go(coneExpansion, azimuth + MathHelper.PiOver2);

            return(new Quadrangle(ul, ur, UpperLeftCorner, UpperRightCorner));
        }
Example #2
0
        public static void scheduler_CustomDrawWeekViewTopLeftCorner(object sender, DevExpress.XtraScheduler.CustomDrawObjectEventArgs e)
        {
            e.DrawDefault();
            UpperLeftCorner objectToDraw = e.ObjectInfo as UpperLeftCorner;
            string          text         = "Employee";
            // Draw the text rotated 45 degrees counterclockwise.
            Font  myFont   = objectToDraw.CaptionAppearance.Font;
            SizeF textSize = e.Graphics.MeasureString(text, myFont);

            e.Graphics.TranslateTransform(e.Bounds.Width / 2, e.Bounds.Height / 2);
            e.Graphics.RotateTransform(-45f);
            e.Graphics.DrawString(text, myFont, Brushes.Blue, -(textSize.Width / 2.0f), -(textSize.Height / 2.0f));
            e.Graphics.RotateTransform(45f);
            e.Graphics.TranslateTransform(-e.Bounds.Width / 2, -e.Bounds.Height / 2);
            e.Handled = true;
        }
Example #3
0
        /// <summary>
        /// Creates a new flat object.
        /// </summary>
        /// <param name="position">Position of the object</param>
        /// <param name="azimuth">Azimuth</param>
        /// <param name="size">Size (width, lenght)</param>
        /// <param name="texture">Used texture</param>
        public FlatObject(PositionInTown position, double azimuth, Vector2 size, Texture2D texture)
            : base(position, azimuth, size)
        {
            this.texture = texture;
            vertices     = new VertexPositionNormalTexture[4];
            indexes      = new short[6];

            Vector2 textureUpperLeft  = new Vector2(0.0f, 0.0f);
            Vector2 textureUpperRight = new Vector2(1.0f, 0.0f);
            Vector2 textureLowerLeft  = new Vector2(0.0f, 1.0f);
            Vector2 textureLowerRight = new Vector2(1.0f, 1.0f);

            for (int i = 0; i < vertices.Length; i++)
            {
                vertices[i].Normal = Vector3.Up;
            }

            vertices[0].Position          = LowerLeftCorner.ToVector3(verticalPosition);
            vertices[0].TextureCoordinate = textureLowerLeft;
            vertices[1].Position          = UpperLeftCorner.ToVector3(verticalPosition);
            vertices[1].TextureCoordinate = textureUpperLeft;
            vertices[2].Position          = LowerRightCorner.ToVector3(verticalPosition);
            vertices[2].TextureCoordinate = textureLowerRight;
            vertices[3].Position          = UpperRightCorner.ToVector3(verticalPosition);
            vertices[3].TextureCoordinate = textureUpperRight;

            indexes[0] = 0;
            indexes[1] = 1;
            indexes[2] = 2;
            indexes[3] = 2;
            indexes[4] = 1;
            indexes[5] = 3;

            quadEffect = new BasicEffect(texture.GraphicsDevice);
            quadEffect.EnableDefaultLighting();
            quadEffect.TextureEnabled = true;
            quadEffect.Texture        = texture;
        }