Ejemplo n.º 1
0
            public static void ApplyColor(ref Path path, Pyramid3dLayer pyramid3dFaceType, Brush color, Boolean lightingEnabled, Boolean isTopOfPyramid)
            {   
                path.StrokeLineJoin = PenLineJoin.Round;
                Color lightingColor;
                Color whiteColor = Colors.White;
                SolidColorBrush solidColorBrush = color as SolidColorBrush;

                switch (pyramid3dFaceType)
                {   
                    case Pyramid3dLayer.LightingLayerFront:

                        if (solidColorBrush != null && lightingEnabled)
                        {   
                            lightingColor = Graphics.GetLighterColor(solidColorBrush.Color, 1);
                            if(isTopOfPyramid)
                                path.StrokeThickness = 2;
                            else
                                path.StrokeThickness = 3.5;

                            path.Stroke = Graphics.GetBevelSideBrush(180, solidColorBrush);

                            path.StrokeStartLineCap = PenLineCap.Flat;
                            path.StrokeEndLineCap = PenLineCap.Flat;
                        }
                        
                        break;

                    case Pyramid3dLayer.LightingLayerLeft:
                        if (solidColorBrush != null && lightingEnabled)
                        {
                            path.StrokeThickness = 2;

                            lightingColor = Graphics.GetLighterColor(solidColorBrush.Color, .88);

                            path.Stroke = new SolidColorBrush(lightingColor);
                                                       

                            path.StrokeStartLineCap = PenLineCap.Round;
                            path.StrokeEndLineCap = PenLineCap.Round;
                            //path.Opacity = 0.5;
                        }
                        break;

                    case Pyramid3dLayer.LightingLayerRight:
                        if (solidColorBrush != null && lightingEnabled)
                        {
                            path.StrokeThickness = 2;

                            lightingColor = solidColorBrush.Color;

                            lightingColor.A = (byte) 127;
                            path.Stroke = Graphics.CreateLinearGradientBrush(0, new Point(0, 1), new Point(1, .2),
                               new List<Color>() { lightingColor, Graphics.GetDarkerColor(solidColorBrush.Color, 0.6) },
                               new List<double>() { 0, .6 });

                            path.StrokeStartLineCap = PenLineCap.Round;
                            path.StrokeEndLineCap = PenLineCap.Round;

                        }
                        break;

                    case Pyramid3dLayer.BackLayerLeft:
                        if (lightingEnabled)
                            path.Fill = Graphics.GetDarkerBrush(color, .4);
                        else
                            path.Fill = color;

                        break;

                    case Pyramid3dLayer.BackLayerRight:
                        if (lightingEnabled)
                            path.Fill = Graphics.GetDarkerBrush(color, .4);
                        else
                            path.Fill = color;
                        break;

                    case Pyramid3dLayer.TopLayer:

                        if(solidColorBrush == null || !lightingEnabled)
                            path.Fill = color;
                        else
                        {
                            //EndPoint="" StartPoint=""

                            path.Fill = Graphics.CreateLinearGradientBrush(-35, new Point(0,0), new Point(1,1),
                              new List<Color>() { Graphics.GetLighterColor(solidColorBrush.Color, 0.99), Graphics.GetDarkerColor(solidColorBrush.Color, 0.6) },
                              new List<double>() { 0, 0.7 });
                        }
                        
                        break;

                    case Pyramid3dLayer.BottomLayer:
                        if (lightingEnabled)
                            path.Fill = Graphics.GetDarkerBrush(color, 0.4);
                        else
                            path.Fill = color;
                        break;

                    case Pyramid3dLayer.FrontLayerLeft:
                        if (lightingEnabled)
                            path.Fill = Graphics.CreateLinearGradientBrush(-35, new Point(0, 1), new Point(1, 0),
                             new List<Color>() { Graphics.GetLighterColor(solidColorBrush.Color, 0.8678), Graphics.GetLighterColor(solidColorBrush.Color, 0.99), solidColorBrush.Color },
                             new List<double>() { 0, 0.7, 1 });
                        else
                            path.Fill = color;

                        break;

                    case Pyramid3dLayer.FrontLayerRight:
                        if (lightingEnabled)
                            path.Fill = Graphics.GetDarkerBrush(color, 0.6);
                        else
                            path.Fill = color;
                        break;
                }

                path.StrokeLineJoin = PenLineJoin.Round;

                //
            }
Ejemplo n.º 2
0
 public Path GetFace(Pyramid3dLayer pyramid3dFaceType, DataPoint dataPoint, Boolean attachTagInfo)
 {
     PointCollection points = Get3DLayerPoints(pyramid3dFaceType);
     Path path = GetPath(points);
     path.Opacity = _opacity;
     ApplyColor(ref path, pyramid3dFaceType, _color, _lightingEnabled, _isTopOfPyramid);
     SetZIndexOf3DLayers(ref path, pyramid3dFaceType);
     if(attachTagInfo)
         path.Tag =  new ElementData(){Element = dataPoint, VisualElementName = pyramid3dFaceType.ToString()};
     
     //path.Opacity = 0.8;
     return path;
 }
Ejemplo n.º 3
0
            private void SetZIndexOf3DLayers(ref Path path, Pyramid3dLayer pyramid3dFaceType)
            {
                switch (pyramid3dFaceType)
                {   
                    case Pyramid3dLayer.BackLayerLeft:
                        path.SetValue(Canvas.ZIndexProperty, -1);
                        break;

                    case Pyramid3dLayer.BackLayerRight:
                        path.SetValue(Canvas.ZIndexProperty, -1);
                        break;

                    case Pyramid3dLayer.BottomLayer:
                        path.SetValue(Canvas.ZIndexProperty, -2);
                        break;

                    case Pyramid3dLayer.FrontLayerLeft:
                        path.SetValue(Canvas.ZIndexProperty, 1);
                        break;

                    case Pyramid3dLayer.FrontLayerRight:
                        path.SetValue(Canvas.ZIndexProperty, 1);
                        break;

                    case Pyramid3dLayer.TopLayer:
                        path.SetValue(Canvas.ZIndexProperty, 2);
                        break;

                    case Pyramid3dLayer.LightingLayerFront:
                        path.SetValue(Canvas.ZIndexProperty, 2);

                        break;

                    case Pyramid3dLayer.LightingLayerLeft:
                        path.SetValue(Canvas.ZIndexProperty, 2);
                        break;

                    case Pyramid3dLayer.LightingLayerRight:
                        path.SetValue(Canvas.ZIndexProperty, 2);
                        break;
                }
            }
Ejemplo n.º 4
0
            private PointCollection Get3DLayerPoints(Pyramid3dLayer pyramid3dFaceType)
            {   
                PointCollection retVal = new PointCollection();

                switch (pyramid3dFaceType)
                {
                    case Pyramid3dLayer.LightingLayerFront:
                        if(_isTopOfPyramid)
                            retVal.Add(CalculatePoint(_top3DLayer.CB, 2));
                        else
                            retVal.Add(CalculatePoint(_top3DLayer.CB, 1));
                        retVal.Add(CalculatePoint(_bottom3DLayer.CB, -3));
                        break;

                    case Pyramid3dLayer.LightingLayerLeft:
                        retVal.Add(CalculatePoint(_top3DLayer.CB, 0));
                        retVal.Add(CalculatePoint(_top3DLayer.L, 2,0));
                        break;

                    case Pyramid3dLayer.LightingLayerRight:
                        retVal.Add(CalculatePoint(_top3DLayer.CB, 0));
                        retVal.Add(CalculatePoint(_top3DLayer.R, -2,1));
                        break;

                    case Pyramid3dLayer.BackLayerLeft:
                        retVal.Add(_top3DLayer.L);
                        retVal.Add(_top3DLayer.CT);
                        retVal.Add(_bottom3DLayer.CT);
                        retVal.Add(_bottom3DLayer.L);
                        break;

                    case Pyramid3dLayer.BackLayerRight:
                        retVal.Add(_top3DLayer.CT);
                        retVal.Add(_top3DLayer.R);
                        retVal.Add(_bottom3DLayer.R);
                        retVal.Add(_bottom3DLayer.CT);
                        break;

                    case Pyramid3dLayer.TopLayer:
                        retVal = _top3DLayer.GetAllPoints();
                        break;

                    case Pyramid3dLayer.BottomLayer:
                        retVal = _bottom3DLayer.GetAllPoints();
                        break;

                    case Pyramid3dLayer.FrontLayerLeft:
                        retVal.Add(_top3DLayer.L);
                        retVal.Add(_top3DLayer.CB);
                        retVal.Add(_bottom3DLayer.CB);
                        retVal.Add(_bottom3DLayer.L);
                        break;

                    case Pyramid3dLayer.FrontLayerRight:
                        retVal.Add(_top3DLayer.CB);
                        retVal.Add(_top3DLayer.R);
                        retVal.Add(_bottom3DLayer.R);
                        retVal.Add(_bottom3DLayer.CB);
                        break;
                }

                return retVal;
            }