コード例 #1
0
        public static Brush ToMapsui(this System.Windows.Media.SolidColorBrush brush)
        {
            var c = brush.Color.ToMapsui();
            var b = new Brush(c);

            return(b);
        }
コード例 #2
0
 public StackedLabelProvider(IProvider provider, LabelStyle labelStyle, Pen rectangleLine = null,
     Brush rectangleFill = null)
 {
     _provider = provider;
     _labelStyle = labelStyle;
     _rectangleLine = rectangleLine ?? new Pen(Color.Gray);
     _rectangleFill = rectangleFill;
 }
コード例 #3
0
ファイル: LabelStyle.cs プロジェクト: pauldendulk/Mapsui
 public LabelStyle()
 {
     Font = new Font { FontFamily = "Verdana", Size = 12 };
     Offset = new Offset { X = 0, Y = 0 };
     CollisionDetection = false;
     ForeColor = Color.Black;
     BackColor = new Brush { Color = Color.White };
     HorizontalAlignment = HorizontalAlignmentEnum.Center;
     VerticalAlignment = VerticalAlignmentEnum.Center;
 }
コード例 #4
0
ファイル: LabelStyle.cs プロジェクト: jdeksup/Mapsui.Net4
 public LabelStyle(LabelStyle labelStyle)
 {
     Font = new Font(labelStyle.Font);
     Offset = new Offset(labelStyle.Offset);
     CollisionDetection = false;
     CollisionBuffer = new Size(labelStyle.CollisionBuffer);
     ForeColor = new Color(labelStyle.ForeColor);
     BackColor = new Brush(labelStyle.BackColor);
     HorizontalAlignment = HorizontalAlignmentEnum.Center;
     VerticalAlignment = VerticalAlignmentEnum.Center;
 }
コード例 #5
0
 public static Brush Copy(this Brush brush)
 {
     if (brush == null)
     {
         return(null);
     }
     return(new Brush {
         Color = brush.Color.Copy(),
         Background = brush.Background.Copy(),
         BitmapId = brush.BitmapId,
         FillStyle = brush.FillStyle
     });
 }
コード例 #6
0
ファイル: LabelStyle.cs プロジェクト: pauldendulk/Mapsui
 public LabelStyle(LabelStyle labelStyle)
 {
     Font = new Font(labelStyle.Font);
     Offset = new Offset(labelStyle.Offset);
     CollisionDetection = false;
     ForeColor = new Color(labelStyle.ForeColor);
     BackColor = new Brush(labelStyle.BackColor);
     HorizontalAlignment = HorizontalAlignmentEnum.Center;
     VerticalAlignment = VerticalAlignmentEnum.Center;
     Text = labelStyle.Text;
     LabelColumn = labelStyle.LabelColumn;
     LabelMethod = labelStyle.LabelMethod;
 }
コード例 #7
0
ファイル: Brush.cs プロジェクト: HackatonArGP/Guardianes
        public bool Equals(Brush brush)
        {
            if ((Color == null) ^ (brush.Color == null))
            {
                return false;
            }

            if (Color != brush.Color)
            {
                return false;
            }
            return true;
        }
コード例 #8
0
 public static Media.Brush ToXaml(this Brush brush, BrushCache brushCache = null)
 {
     return(StyleConverter.MapsuiBrushToXaml(brush, brushCache));
 }
コード例 #9
0
        private VectorStyle GetVectorStyle(LandStatus status, bool isOwnLand, bool demandAuthorities, bool ischecked, bool isGreenpeaceUser, bool islockedOnly, bool denouncedByMe)
        {
            Brush fill = null;
            Pen outline = null;

            switch (status)
            {
                case LandStatus.NotChecked:  //STATUS 2 SIN CHEQUEAR
                    fill = new Brush { Color = Color.FromArgb(255, 255, 255, 255) };
                    outline = new Pen { Color = Color.Black, Width = 1 };
                    break;
                case LandStatus.Ok: //STATUS 3 SIN DESMONTES
                    fill = new Brush { Color = Color.FromArgb(143, 121, 136, 35) };
                    outline = new Pen { Color = Color.FromArgb(255, 169, 183, 41), Width = 4 };
                    break;
                case LandStatus.Alert:  //STATUS 4 CON DESMONTES
                     fill = new Brush { Color = Color.FromArgb(143, 255, 236, 0) };
                outline = new Pen { Color = Color.FromArgb(255, 255, 242, 0), Width = 4 };
                    
                    break;
                default: //DEFAULT, IDEM SIN CHEQUEAR
                    fill = new Brush { Color = Color.FromArgb(255, 255, 255, 255) };
                    outline = new Pen { Color = Color.Black, Width = 1 };
                    break;
            }

            if (ischecked && (status == LandStatus.Alert || status == LandStatus.Ok)) //VERIFICADA POR MI DESMONTADA O SIN DESMONTE
            {
                outline = new Pen { Color = Color.FromArgb(0, 0, 0, 0), Width = 1 };
            }

            if (isOwnLand && (status != LandStatus.Alert && status != LandStatus.Ok))  //MI PROPIA LAND
            {
                outline = new Pen { Color = Color.White, Width = 4 };
            }

            if (demandAuthorities)  //LISTA PARA DEMANDAR
            {
                 fill = new Brush { Color = Color.FromArgb(143, 167, 11, 10) };
                 outline = new Pen { Color = Color.FromArgb(255, 217, 7, 7), Width = 4 };

                if (denouncedByMe)
                {
                    outline = new Pen { Color = Color.FromArgb(0, 0, 0, 0), Width = 1 };

                }
            }

            if (!demandAuthorities && islockedOnly)
            {
                outline = new Pen { Color = Color.FromArgb(0, 0, 0, 0), Width = 1 };
            }

            var vStyle = new VectorStyle
            {
                Fill = fill,
                Outline = outline,
            };

            if (opacity == 0)
            {
                vStyle.SetOpacity(0);
            }
            else
            {
                if (Current.Instance.MapControl.Viewport.Resolution > 2.4 || Current.Instance.MapControl.Viewport.Resolution == 0)
                {
                        vStyle.SetOpacity(opacity);
                }
                else
                {
                    vStyle.SetOpacity(0);
                }
            } 

            return vStyle;
        }
コード例 #10
0
        private VectorStyle GetVectorStyle(LandStatus status, bool isOwnLand)
        {
            Brush fill;
            Pen outline;

            switch (status)
            {
                case LandStatus.NotChecked:
                    fill = new Brush { Color = Color.White };
                    outline = new Pen { Color = Color.Black, Width = 2 };
                    break;
                case LandStatus.Ok:
                    fill = new Brush { Color = Color.Green };
                    outline = new Pen { Color = Color.Black, Width = 2 };
                    break;
                case LandStatus.Alert:
                    fill = new Brush { Color = Color.Red };
                    outline = new Pen { Color = Color.Black, Width = 2 };
                    break;
                default:
                    fill = new Brush { Color = Color.Orange };
                    outline = new Pen { Color = Color.Black, Width = 2 };
                    break;
            }

            if (isOwnLand)
            {
                outline = new Pen { Color = Color.Orange, Width = 4 };
            }

            var vStyle = new VectorStyle
            {
                Fill = fill,
                Outline = outline,
            };
            vStyle.SetOpacity(opacity);
            return vStyle;
        }
コード例 #11
0
 public static Media.Brush ToXaml(this Brush brush, SymbolCache symbolCache = null, float rotate = 0)
 {
     return(StyleConverter.MapsuiBrushToXaml(brush, symbolCache, rotate));
 }
コード例 #12
0
        private static List<Feature> GetFeaturesInView(double resolution, LabelStyle labelStyle,
            IEnumerable<IFeature> features, Pen line, Brush fill)
        {
            var margin = resolution*50;
            var clusters = new List<Cluster>();
            // todo: repeat until there are no more merges
            ClusterFeatures(clusters, features, margin, labelStyle, resolution);

            const int textHeight = 18;

            var results = new List<Feature>();

            foreach (var cluster in clusters)
            {
                if (cluster.Features.Count > 1) results.Add(CreateBoxFeature(resolution, cluster, line, fill));

                var offsetY = double.NaN;

                var orderedFeatures = cluster.Features.OrderBy(f => f.Geometry.GetBoundingBox().GetCentroid().Y);

                foreach (var pointFeature in orderedFeatures)
                {
                    var position = CalculatePosition(cluster);

                    offsetY = CalculateOffsetY(offsetY, textHeight);

                    var labelText = labelStyle.GetLabelText(pointFeature);
                    var labelFeature = CreateLabelFeature(position, labelStyle, offsetY, labelText);

                    results.Add(labelFeature);
                }
            }
            return results;
        }
コード例 #13
0
 private static Feature CreateBoxFeature(double resolution, Cluster cluster, Pen line, 
     Brush fill)
 {
     return new Feature
     {
         Geometry = ToPolygon(GrowBox(cluster.Box, resolution)),
         Styles = new[]
         {
             new VectorStyle
             {
                 Outline = line,
                 Fill = fill
             }
         }
     };
 }
コード例 #14
0
        private static GradientTheme CreateCountryLabelTheme()
        {
            //Lets scale the labels so that big countries have larger texts as well
            var backColor = new Brush { Color = new Color { A = 128, R = 255, G = 255, B = 255 } };

            var lblMin = new LabelStyle
            {
                ForeColor = Color.Black,
                BackColor = backColor,
                Font = new Font { FontFamily = "GenericSerif", Size = 6 }
            };

            var lblMax = new LabelStyle
            {
                ForeColor = Color.Blue,
                BackColor = backColor,
                Font = new Font { FontFamily = "GenericSerif", Size = 9 }
            };

            return new GradientTheme("PopDens", 0, 400, lblMin, lblMax);
        }