Beispiel #1
0
        //OK
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            switch (rule.geometrysymbolizer.sign)
            {
            case SymbolizerType.POINT:
                pointsymbolizer pointsymbolizer = (pointsymbolizer)rule.geometrysymbolizer;
                pointsymbolizer.size  = Convert.ToInt32(textBox.Text);
                pointsymbolizer.color = ((SolidColorBrush)solidColor.Fill).Color;
                break;

            case SymbolizerType.LINE:
                linesymbolizer linesymbolizer = (linesymbolizer)rule.geometrysymbolizer;
                linesymbolizer.width = Convert.ToInt32(textBox.Text);
                linesymbolizer.color = ((SolidColorBrush)solidColor.Fill).Color;
                break;

            case SymbolizerType.POLYGON:
                polygonsymbolizer polygonsymbolizer = (polygonsymbolizer)rule.geometrysymbolizer;
                polygonsymbolizer.strokewidth = Convert.ToInt32(textBox.Text);
                polygonsymbolizer.strokecolor = ((SolidColorBrush)outlineColor.Fill).Color;
                polygonsymbolizer.fillcolor   = ((SolidColorBrush)solidColor.Fill).Color;
                break;
            }
            brush        = (SolidColorBrush)solidColor.Fill;
            DialogResult = true;
        }
Beispiel #2
0
        //OK
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            polygonsymbolizer polygonsymbolizer = (polygonsymbolizer)rule.geometrysymbolizer;

            polygonsymbolizer.strokewidth = Convert.ToInt32(textBox.Text);
            polygonsymbolizer.strokecolor = ((SolidColorBrush)outlineColor.Fill).Color;
            polygonsymbolizer.fillcolor   = ((SolidColorBrush)solidColor.Fill).Color;
            switch (comboBox.SelectedIndex)
            {
            case 0:
                polygonsymbolizer.polygonstyle = PolygonStyle.SOLID;
                break;

            case 1:
                polygonsymbolizer.polygonstyle = PolygonStyle.LINE;
                break;

            case 2:
                polygonsymbolizer.polygonstyle = PolygonStyle.GRID;
                break;

            default:
                polygonsymbolizer.polygonstyle = PolygonStyle.SOLID;
                break;
            }
            brush        = (SolidColorBrush)solidColor.Fill;
            DialogResult = true;
        }
Beispiel #3
0
        public PolygonSymbolSelector(RenderRule rule)
        {
            InitializeComponent();
            this.rule            = rule;
            comboBox.ItemsSource = list;
            polygonsymbolizer polygonsymbolizer = (polygonsymbolizer)rule.geometrysymbolizer;

            textBox.Text      = polygonsymbolizer.strokewidth.ToString();
            outlineColor.Fill = new SolidColorBrush((Color)polygonsymbolizer.strokecolor);
            solidColor.Fill   = new SolidColorBrush((Color)polygonsymbolizer.fillcolor);

            comboBox.SelectedIndex = (int)polygonsymbolizer.polygonstyle - 1;
        }
Beispiel #4
0
        public SymbolSelector(RenderRule rule)
        {
            InitializeComponent();
            this.rule = rule;
            switch (rule.geometrysymbolizer.sign)
            {
            case SymbolizerType.POINT:
                pointsymbolizer pointsymbolizer = (pointsymbolizer)rule.geometrysymbolizer;
                textBox.Text            = pointsymbolizer.size.ToString();
                outlineColor.Visibility = Visibility.Collapsed;
                outlineLabel.Visibility = Visibility.Collapsed;
                solidColor.Fill         = new SolidColorBrush((Color)pointsymbolizer.color);
                break;

            case SymbolizerType.LINE:
                linesymbolizer linesymbolizer = (linesymbolizer)rule.geometrysymbolizer;
                textBox.Text            = linesymbolizer.width.ToString();
                outlineColor.Visibility = Visibility.Collapsed;
                outlineLabel.Visibility = Visibility.Collapsed;
                solidColor.Fill         = new SolidColorBrush((Color)linesymbolizer.color);
                break;

            case SymbolizerType.POLYGON:
                polygonsymbolizer polygonsymbolizer = (polygonsymbolizer)rule.geometrysymbolizer;
                textBox.Text      = polygonsymbolizer.strokewidth.ToString();
                outlineColor.Fill = new SolidColorBrush((Color)polygonsymbolizer.strokecolor);
                solidColor.Fill   = new SolidColorBrush((Color)polygonsymbolizer.fillcolor);
                break;

            case SymbolizerType.TEXT:
                break;
            }

            //if (symbol.brush == null)
            //{
            //    outlineColor.Visibility = Visibility.Collapsed;
            //    outlineLabel.Visibility = Visibility.Collapsed;
            //    solidColor.Fill = symbol.pen.Brush;
            //    return;
            //}
            //outlineColor.Fill = symbol.pen.Brush;
            //solidColor.Fill = symbol.brush;
        }
Beispiel #5
0
        private void paintRule(WriteableBitmap bmp, RenderRule rule, double cur_y)
        {
            Symbolizer geosym = rule.geometrysymbolizer;

            switch (geosym.sign)
            {
            case SymbolizerType.POINT:
                pointsymbolizer pointsymbolizer = (pointsymbolizer)geosym;
                int             size            = (int)pointsymbolizer.size;
                Color           color           = (Color)pointsymbolizer.color;
                Point           screenPointF    = new Point(position.X, cur_y);
                switch (pointsymbolizer.pointstyle)
                {
                case PointStyle.CIRCLE_FILL:
                    PaintFillCircle(bmp, screenPointF, size, color);
                    break;

                case PointStyle.CIRCLE_HOLLOW:
                    PaintHollowCircle(bmp, screenPointF, size, color);
                    break;

                case PointStyle.CIRCLE_POINT:
                    PaintCircle_Point(bmp, screenPointF, size, color);
                    break;

                case PointStyle.CIRCLE_RECT:
                    PaintCircle_Rect(bmp, screenPointF, size, color);
                    break;

                case PointStyle.RECT_FILL:
                    PaintFillRect(bmp, screenPointF, size, color);
                    break;

                case PointStyle.RECT_HOLLOW:
                    PaintHollowRect(bmp, screenPointF, size, color);
                    break;

                case PointStyle.TRIANGLE:
                    PaintFillTriangle(bmp, screenPointF, size, color);
                    break;
                }
                if (rule.filter != null)
                {
                    bmp.DrawString((int)position.X + 2 * (int)pointsymbolizer.size * 2 + 10, (int)cur_y, textcolor, Colors.White, font, rule.filter.GetDescription());
                    //g.DrawString(rule.filter.GetDescription(), SystemFonts.DefaultFont, Brushes.Black, new PointF(position.X + 2 * pointsymbolizer.size * 2 + 10, cur_y));
                }
                cur_y += (2 * pointsymbolizer.size + 5);
                break;

            case SymbolizerType.LINE:
                linesymbolizer lsymbolizer = (linesymbolizer)geosym;
                //Pen lpen = new Pen(lsymbolizer.color, lsymbolizer.width);
                //lpen.DashStyle = lsymbolizer.linestyle;
                //g.DrawLine(lpen, position.X, cur_y, position.X + 30, cur_y);
                bmp.DrawLineAa((int)position.X, (int)cur_y, (int)position.X + 30, (int)cur_y, lsymbolizer.color, (int)lsymbolizer.width);
                if (rule.filter != null)
                {
                    bmp.DrawString((int)position.X + 35, (int)cur_y, textcolor, Colors.White, font, rule.filter.GetDescription());
                    //g.DrawString(rule.filter.GetDescription(), SystemFonts.DefaultFont, Brushes.Black, new PointF(position.X + 35, cur_y));
                }
                cur_y += (20);
                break;

            case SymbolizerType.POLYGON:
                polygonsymbolizer symbolizer = (polygonsymbolizer)geosym;
                //Pen ppen = new Pen(symbolizer.strokecolor, symbolizer.strokewidth);
                //Brush pbrush = new SolidBrush(symbolizer.fillcolor);
                int[] list = { (int)position.X, (int)cur_y, (int)position.X + 30, (int)cur_y, (int)position.X + 30, (int)cur_y + 15, (int)position.X, (int)cur_y + 15, (int)position.X, (int)cur_y };
                //g.DrawRectangle(ppen, position.X, cur_y, 30, 15);
                //g.FillRectangle(pbrush, position.X, cur_y, 30, 15);
                bmp.DrawPolygon(list, symbolizer.strokecolor, (int)symbolizer.strokewidth);
                bmp.FillPolygon(list, symbolizer.fillcolor);
                if (rule.filter != null)
                {
                    bmp.DrawString((int)position.X + 35, (int)cur_y, textcolor, Colors.White, font, rule.filter.GetDescription());
                    //g.DrawString(rule.filter.GetDescription(), SystemFonts.DefaultFont, Brushes.Black, new Point(position.X + 35, cur_y));
                }
                cur_y += (20);
                break;
            }
        }