示例#1
0
 /// <summary>
 /// Draws layout entities.
 /// </summary>
 /// <param name="State">Current drawing state.</param>
 /// <param name="PathState">Current path state.</param>
 /// <param name="Path">Path being generated.</param>
 public override void Draw(DrawingState State, PathState PathState, SKPath Path)
 {
     if (this.defined)
     {
         Path.MoveTo(PathState.Add0(this.xCoordinate, this.yCoordinate));
     }
 }
示例#2
0
        /// <summary>
        /// Get image expand/collapse state.
        /// </summary>
        /// <returns></returns>
        public Image GetImageFromCurrentState(DrawingState state)
        {
            if (State == EState.Collapsed)
            {
                switch (state)
                {
                case DrawingState.Normal:
                    return(Appearance.NormalImageCollapsed);

                case DrawingState.Over:
                    return(Appearance.OverImageCollapsed);

                default:
                    return(Appearance.NormalImageCollapsed);
                }
            }
            else
            {
                switch (state)
                {
                case DrawingState.Normal:
                    return(Appearance.NormalImageExpanded);

                case DrawingState.Over:
                    return(Appearance.OverImageExpanded);

                default:
                    return(Appearance.NormalImageExpanded);
                }
            }
        }
示例#3
0
 /// <summary>
 /// Measures layout entities and defines unassigned properties.
 /// </summary>
 /// <param name="State">Current drawing state.</param>
 /// <param name="PathState">Current path state.</param>
 public virtual void Measure(DrawingState State, PathState PathState)
 {
     if (this.defined)
     {
         PathState.CloseLoop();
     }
 }
示例#4
0
 /// <summary>
 /// Draws layout entities.
 /// </summary>
 /// <param name="State">Current drawing state.</param>
 /// <param name="PathState">Current path state.</param>
 /// <param name="Path">Path being generated.</param>
 public virtual void Draw(DrawingState State, PathState PathState, SKPath Path)
 {
     if (this.defined)
     {
         PathState.CloseLoop();
     }
 }
示例#5
0
        public List <int> GetPath(List <int> listNumber, DateTime initialDate, DateTime finalDate, DrawType type)
        {
            var filterbyDate = new DrawingResultFilterByDate(_repository, initialDate, finalDate);

            DrawingState state         = (DrawingState)Enum.Parse(typeof(DrawingState), type.ToString());
            var          filterByeType = new DrawingResultFilterByType(filterbyDate, state);

            var drawingList = filterByeType.Filter().OrderBy(d => d.Date).ToList();

            List <int> list = new List <int>();

            int      days    = 0;
            DateTime iniDate = initialDate;

            foreach (var drawing in drawingList)
            {
                if (IsMemberDrawing(drawing, listNumber))
                {
                    days = (int)drawing.Date.Subtract(iniDate).TotalDays;
                    list.Add(days);
                    days    = 0;
                    iniDate = drawing.Date;
                }
            }
            days = -1 * (int)drawingList.Last().Date.Subtract(iniDate).TotalDays;
            list.Add(days);

            return(list);
        }
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var          valueString = (string)value;
            DrawingState parammeter  = (DrawingState)Enum.Parse(typeof(DrawingState), valueString);

            return(parammeter);
        }
示例#7
0
 /// <summary>
 /// Draws layout entities.
 /// </summary>
 /// <param name="State">Current drawing state.</param>
 /// <param name="PathState">Current path state.</param>
 /// <param name="Path">Path being generated.</param>
 public virtual void Draw(DrawingState State, PathState PathState, SKPath Path)
 {
     if (this.defined)
     {
         this.splineCurve = PathState.SetSplineVertex(this.xCoordinate, this.yCoordinate);
     }
 }
示例#8
0
        /// <summary>
        /// Measures layout entities and defines unassigned properties, related to dimensions.
        /// </summary>
        /// <param name="State">Current drawing state.</param>
        /// <returns>If layout contains relative sizes and dimensions should be recalculated.</returns>
        public override bool DoMeasureDimensions(DrawingState State)
        {
            bool Relative = base.DoMeasureDimensions(State);

            this.cellLayout = this.GetCellLayout(State);

            if (this.HasChildren)
            {
                foreach (ILayoutElement Child in this.Children)
                {
                    if (!Child.IsVisible)
                    {
                        continue;
                    }

                    if (Child is IDynamicChildren DynamicChildren)
                    {
                        foreach (ILayoutElement Child2 in DynamicChildren.DynamicChildren)
                        {
                            this.cellLayout.Add(Child2);
                        }
                    }
                    else
                    {
                        this.cellLayout.Add(Child);
                    }
                }

                this.cellLayout.Flush();
            }

            return(Relative);
        }
示例#9
0
 /// <summary>
 /// Measures layout entities and defines unassigned properties.
 /// </summary>
 /// <param name="State">Current drawing state.</param>
 /// <param name="PathState">Current path state.</param>
 public void Measure(DrawingState State, PathState PathState)
 {
     if (this.defined)
     {
         PathState.TurnTowardsRel(this.xCoordinate, this.yCoordinate);
     }
 }
示例#10
0
 /// <summary>
 /// Measures layout entities and defines unassigned properties.
 /// </summary>
 /// <param name="State">Current drawing state.</param>
 /// <param name="PathState">Current path state.</param>
 public override void Measure(DrawingState State, PathState PathState)
 {
     if (this.defined)
     {
         PathState.AddSplineVertex(this.xCoordinate, this.yCoordinate);
     }
 }
示例#11
0
 /// <summary>
 /// Draws layout entities.
 /// </summary>
 /// <param name="State">Current drawing state.</param>
 public override void Draw(DrawingState State)
 {
     if (this.activeCase?.IsVisible ?? false)
     {
         this.activeCase.Draw(State);
     }
 }
示例#12
0
 /// <summary>
 /// Measures layout entities and defines unassigned properties.
 /// </summary>
 /// <param name="State">Current drawing state.</param>
 /// <param name="PathState">Current path state.</param>
 public void Measure(DrawingState State, PathState PathState)
 {
     if (this.defined)
     {
         PathState.Forward(this.dist);
     }
 }
示例#13
0
 /// <summary>
 /// Draws layout entities.
 /// </summary>
 /// <param name="State">Current drawing state.</param>
 /// <param name="PathState">Current path state.</param>
 /// <param name="Path">Path being generated.</param>
 public void Draw(DrawingState State, PathState PathState, SKPath Path)
 {
     if (this.defined)
     {
         PathState.TurnRight(this.angle);
     }
 }
示例#14
0
        /// <summary>
        /// Measures layout entities and defines unassigned properties, related to dimensions.
        /// </summary>
        /// <param name="State">Current drawing state.</param>
        /// <returns>If layout contains relative sizes and dimensions should be recalculated.</returns>
        public override bool DoMeasureDimensions(DrawingState State)
        {
            bool Relative = base.DoMeasureDimensions(State);

            if (!this.evaluated)
            {
                foreach (Case Case in this.cases)
                {
                    object Result = Case.ConditionAttribute?.Evaluate(State.Session);
                    if (Result is bool b && b)
                    {
                        this.activeCase = Case;
                        break;
                    }
                }

                if (this.activeCase is null)
                {
                    this.activeCase = this.otherwise;
                }

                this.evaluated = true;
            }

            if (this.activeCase?.MeasureDimensions(State) ?? false)
            {
                Relative = true;
            }

            return(Relative);
        }
示例#15
0
 /// <summary>
 /// Measures layout entities and defines unassigned properties.
 /// </summary>
 /// <param name="State">Current drawing state.</param>
 /// <param name="PathState">Current path state.</param>
 public void Measure(DrawingState State, PathState PathState)
 {
     if (this.defined)
     {
         PathState.TurnRight(this.angle);
     }
 }
示例#16
0
 /// <summary>
 /// Draws layout entities.
 /// </summary>
 /// <param name="State">Current drawing state.</param>
 /// <param name="PathState">Current path state.</param>
 /// <param name="Path">Path being generated.</param>
 public override void Draw(DrawingState State, PathState PathState, SKPath Path)
 {
     if (this.defined)
     {
         this.splineCurve = PathState.AddSplineVertex(this.xCoordinate, this.yCoordinate);
     }
 }
示例#17
0
 /// <summary>
 /// Measures layout entities and defines unassigned properties.
 /// </summary>
 /// <param name="State">Current drawing state.</param>
 /// <param name="PathState">Current path state.</param>
 public virtual void Measure(DrawingState State, PathState PathState)
 {
     if (this.defined)
     {
         PathState.Set(this.xCoordinate, this.yCoordinate);
     }
 }
示例#18
0
        }//eom

        protected override void Initialize()
        {
            graphics.PreferredBackBufferWidth  = WindowWidth;
            graphics.PreferredBackBufferHeight = WindowHeight;
            graphics.ApplyChanges();

            //Setup Camera
            camTarget        = new Vector3(0f, 0f, 0f);
            camPosition      = new Vector3(0f, 0f, -600f);
            projectionMatrix = Matrix.CreatePerspectiveFieldOfView(
                MathHelper.ToRadians(45f),
                GraphicsDevice.DisplayMode.AspectRatio, 1f, 1000f);
            viewMatrix  = Matrix.CreateLookAt(camPosition, camTarget, Vector3.Up);// Y up
            worldMatrix = Matrix.CreateWorld(camTarget, Vector3.Forward, Vector3.Up);

            //BasicEffect
            basicEffect = new BasicEffect(GraphicsDevice)
            {
                Alpha = 1.0f,
                VertexColorEnabled = true,
                LightingEnabled    = false
            };

            //Geometry - Face
            face         = new VertexPositionColor[36];
            face         = MakeCube();
            vertexBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), 36, BufferUsage.WriteOnly);
            vertexBuffer.SetData(face);

            // initialize the ball
            ball         = new Ball(SetRandomLocation(), SetRandomVelocity());
            drawingState = DrawingState.Initialize;
            base.Initialize();
        }//eom
示例#19
0
 /// <summary>
 /// Draws layout entities.
 /// </summary>
 /// <param name="State">Current drawing state.</param>
 /// <param name="PathState">Current path state.</param>
 /// <param name="Path">Path being generated.</param>
 public void Draw(DrawingState State, PathState PathState, SKPath Path)
 {
     if (this.defined)
     {
         PathState.TurnTowardsRel(this.xCoordinate, this.yCoordinate);
     }
 }
示例#20
0
        }//eom

        #endregion

        #region Game Methods
        protected override void Initialize()
        {
            graphics.PreferredBackBufferWidth  = WindowWidth;
            graphics.PreferredBackBufferHeight = WindowHeight;
            graphics.ApplyChanges();
            gameBoundingBox = new Rectangle(0, 0, WindowWidth, WindowHeight);
            drawingState    = DrawingState.Initialize;

            // for parabolic motion
            velocity        = Vector3.Zero;
            pointPosition   = new Vector3(launchPoint.X, WindowHeight - launchPoint.Y, launchPoint.Z);
            firingAngle     = 45.0f;
            firingMagnitude = 100.0f;

            twoDObject = new TwoDObject(new Vector2(pointPosition.X, pointPosition.Y), 1.0f);

            basicEffect = new BasicEffect(graphics.GraphicsDevice);
            basicEffect.VertexColorEnabled = true;
            basicEffect.Projection         = Matrix.CreateOrthographicOffCenter
                                                 (0, graphics.GraphicsDevice.Viewport.Width, // left, right
                                                 graphics.GraphicsDevice.Viewport.Height, 0, // bottom, top
                                                 0, 1);                                      // near, far plane
            SetVertices();
            pathVertices = new List <VertexPositionColor>();
            base.Initialize();
        }//eom
示例#21
0
 /// <summary>
 /// Draws layout entities.
 /// </summary>
 /// <param name="State">Current drawing state.</param>
 /// <param name="PathState">Current path state.</param>
 /// <param name="Path">Path being generated.</param>
 public virtual void Draw(DrawingState State, PathState PathState, SKPath Path)
 {
     if (this.defined)
     {
         this.P1             = Path.LastPoint;
         Path.LineTo(this.P2 = PathState.Forward(this.dist));
     }
 }
示例#22
0
 public override void ChangeState(DrawingState drawingState)
 {
     base.ChangeState(drawingState);
     foreach (DrawingObject obj in this.listDrawingObjects)
     {
         obj.ChangeState(drawingState);
     }
 }
示例#23
0
 public override void ChangeState(DrawingState state)
 {
     foreach (DrawingObject obj in memberGroup)
     {
         obj.ChangeState(state);
     }
     this.state = state;
 }
示例#24
0
 /// <summary>
 /// Draws layout entities.
 /// </summary>
 /// <param name="State">Current drawing state.</param>
 /// <param name="PathState">Current path state.</param>
 /// <param name="Path">Path being generated.</param>
 public virtual void Draw(DrawingState State, PathState PathState, SKPath Path)
 {
     if (this.defined)
     {
         PathState.Set0(this.xCoordinate, this.yCoordinate);
         Path.MoveTo(this.xCoordinate, this.yCoordinate);
     }
 }
示例#25
0
 public static DrawingState getInstance()
 {
     if (instance == null)
     {
         instance = new EditState();
     }
     return(instance);
 }
示例#26
0
 public static DrawingState GetInstance()
 {
     if (instance == null)
     {
         instance = new IntersectState();
     }
     return(instance);
 }
示例#27
0
 public static DrawingState GetInstance()
 {
     if (instance == null)
     {
         instance = new FreeHandDrawingState();
     }
     return(instance);
 }
示例#28
0
文件: Shape.cs 项目: iamr8/IoTGateway
 /// <summary>
 /// Draws shape as a head
 /// </summary>
 /// <param name="State">Current drawing state.</param>
 /// <param name="DirectedElement">Directed element.</param>
 /// <param name="DefaultPen">Default pen, if any, null otherwise</param>
 /// <param name="DefaultFill">Default fill, if any, null otherwise.</param>
 public void DrawHead(DrawingState State, IDirectedElement DirectedElement,
                      SKPaint DefaultPen, SKPaint DefaultFill)
 {
     if (DirectedElement.TryGetEnd(out float X, out float Y, out float Direction))
     {
         this.Draw(State, DefaultPen, DefaultFill, X, Y, Direction);
     }
 }
示例#29
0
        /// <summary>
        /// Measures layout entities and defines unassigned properties, related to positions.
        /// </summary>
        /// <param name="State">Current drawing state.</param>
        public override void MeasurePositions(DrawingState State)
        {
            base.MeasurePositions(State);

            this.cellLayout?.MeasurePositions(State);
            this.cellLayout?.Distribute(true);
            this.measured = this.cellLayout?.Align();
        }
示例#30
0
 public static DrawingState GetInstance()
 {
     if (instance == null)
     {
         instance = new PreviewState();
     }
     return(instance);
 }
	public Drawing Play() {
		if (!Prefab) {
			Debug.LogError("Got a bad prefab from " + Path);
			return null;
		}

		State = DrawingState.Playing;
		var instance = Object.Instantiate(Prefab);
		m_Drawing = instance.GetOrAddComponent<Drawing>();
		m_Drawing.Play(this);
		return m_Drawing;
	}
示例#32
0
        public DrawingManager(DeviceManager deviceManager)
        {
            _device = deviceManager.Device;
            _context = deviceManager.Context;
            _vertexLayouts = deviceManager.VertexLayouts;

            var effect = deviceManager.Effect;

            _standardSmooth = effect.GetTechniqueByName("Standard|Smooth");
            _standardFlat = effect.GetTechniqueByName("Standard|Flat");
            _standardWireframe = effect.GetTechniqueByName("Standard|Wireframe");
            _prelitSmooth = effect.GetTechniqueByName("Prelit|Smooth");
            _prelitFlat = effect.GetTechniqueByName("Prelit|Flat");
            _prelitWireframe = effect.GetTechniqueByName("Prelit|Wireframe");

            _worldMatrix = effect.GetVariableByName("g_WorldMatrix").AsMatrix();
            _postWorldMatrix = effect.GetVariableByName("g_PostWorldMatrix").AsMatrix();
            _viewMatrix = effect.GetVariableByName("g_ViewMatrix").AsMatrix();
            _projectionMatrix = effect.GetVariableByName("g_ProjectionMatrix").AsMatrix();
            _color = effect.GetVariableByName("g_Color").AsVector();
            _opacity = effect.GetVariableByName("g_Opacity").AsScalar();
            _ambient = effect.GetVariableByName("g_Ambient").AsScalar();
            _diffuse = effect.GetVariableByName("g_Diffuse").AsScalar();
            _texture = effect.GetVariableByName("g_Texture").AsShaderResource();
            _mask = effect.GetVariableByName("g_Mask").AsShaderResource();
            _textureSampler = effect.GetVariableByName("g_TextureSampler").AsSampler();
            _hasTexture = effect.GetVariableByName("g_HasTexture").AsScalar();
            _hasMask = effect.GetVariableByName("g_HasMask").AsScalar();
            _isInstanced = effect.GetVariableByName("g_IsInstanced").AsScalar();
            _isColorTinted = effect.GetVariableByName("g_IsColorTinted").AsScalar();
            _globalLight = effect.GetVariableByName("g_GlobalLight");
            _lightViewProjectionMatrix = effect.GetVariableByName("g_LightViewProjectionMatrix").AsMatrix();

            //Set the states to Unknown initially.
            _currentDrawingState = DrawingState.Unknown;
            _currentTopologyState = PrimitiveTopologyState.Unknown;

            //Set the default of the g_PostWorldMatrix to Identity, so it isn't required to be set.
            _postWorldMatrix.SetMatrix(Matrix.Identity);

            //Setup shadow map technique.
            var shadowEffect = deviceManager.ShadowEffect;
            _shadowMapStandard = shadowEffect.GetTechniqueByName("ShadowMapTechnique|Standard");
            _shadowMapPrelit = shadowEffect.GetTechniqueByName("ShadowMapTechnique|Prelit");

            _isShadowInstanced = shadowEffect.GetVariableByName("g_IsInstanced").AsScalar();
            _shadowWorldMatrix = shadowEffect.GetVariableByName("g_WorldMatrix").AsMatrix();
            _shadowHasMask = shadowEffect.GetVariableByName("g_HasMask").AsScalar();
            _shadowMask = shadowEffect.GetVariableByName("g_Mask").AsShaderResource();
            _shadowLightViewProjectionMatrix = shadowEffect.GetVariableByName("g_LightViewProjectionMatrix").AsMatrix();
        }
示例#33
0
        private void UpdateShadowState(bool isPrelit)
        {
            _currentDrawingState = DrawingState.Unknown;
            _currentTopologyState = PrimitiveTopologyState.Unknown;

            _context.InputAssembler.InputLayout = isPrelit ? _vertexLayouts.PrelitLayout : _vertexLayouts.StandardLayout;
            _currentTechnique = isPrelit ? _shadowMapPrelit : _shadowMapStandard;
            _context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
        }
示例#34
0
        private void UpdateState(DrawingState drawingState, PrimitiveTopologyState topologyState)
        {
            if (drawingState != _currentDrawingState)
            {
                _currentDrawingState = drawingState;
                switch (_currentDrawingState)
                {
                    case DrawingState.Standard:
                        _context.InputAssembler.InputLayout = _vertexLayouts.StandardLayout;
                        _currentTechnique = _standardSmooth;
                        break;

                    case DrawingState.StandardFlat:
                        _context.InputAssembler.InputLayout = _vertexLayouts.StandardLayout;
                        _currentTechnique = _standardFlat;
                        break;

                    case DrawingState.StandardWirefame:
                        _context.InputAssembler.InputLayout = _vertexLayouts.StandardLayout;
                        _currentTechnique = _standardWireframe;
                        break;

                    case DrawingState.Prelit:
                        _context.InputAssembler.InputLayout = _vertexLayouts.PrelitLayout;
                        _currentTechnique = _prelitSmooth;
                        break;

                    case DrawingState.PrelitFlat:
                        _context.InputAssembler.InputLayout = _vertexLayouts.PrelitLayout;
                        _currentTechnique = _prelitFlat;
                        break;

                    case DrawingState.PrelitWireframe:
                        _context.InputAssembler.InputLayout = _vertexLayouts.PrelitLayout;
                        _currentTechnique = _prelitWireframe;
                        break;

                    default:
                        throw new NotSupportedException();
                }
            }

            if(topologyState != _currentTopologyState)
            {
                _currentTopologyState = topologyState;
                switch (_currentTopologyState)
                {
                    case PrimitiveTopologyState.TriangleList:
                        _context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
                        break;
                    case PrimitiveTopologyState.LineList:
                        _context.InputAssembler.PrimitiveTopology = PrimitiveTopology.LineList;
                        break;
                }
            }
        }
示例#35
0
 public DrawingStyleTool(IDrawingFeatures drawingFeatures, DrawingState drawingState)
 {
     _drawingFeatures = drawingFeatures;
     _drawingState = drawingState;
 }
示例#36
0
	public DrawingEventArgs (DrawingState state) {
		this.DrawingState = state;
	}