Exemplo n.º 1
0
        private Map CreateMap()
        {
            var map = new Map(ClientSize);

            //var p1 = new MatrixRelationProvider(_matrix) { ScaleFactor = 0.1d, ScaleMethod = ScaleMethod.Linear };
            //map.Layers.Add(new VectorLayer(p1.ProviderName, p1)
            //{
            //    Style =
            //        new VectorStyle { Outline = new Pen(Brushes.Black, 1), Fill = new SolidBrush(Color.DarkSalmon), EnableOutline = true }
            //});

            var p2 = new MatrixRelationProvider(_matrix)
            {
                ScaleFactor = 0.1d, ScaleMethod = ScaleMethod.Linear, RestrictId = 1
            };

            map.Layers.Add(new VectorLayer(p2.ProviderName, p2)
            {
                Style =
                    new VectorStyle {
                    Outline = new Pen(Brushes.Black, 1), Fill = new SolidBrush(Color.BlueViolet), EnableOutline = true
                }
            });

            var p3 = new MatrixODSumProvider(_matrix, ODMatrixVector.Both)
            {
                ScaleFactor = 0.1d, ScaleMethod = ScaleMethod.Linear
            };

            map.Layers.Add(new VectorLayer(p3.ProviderName, p3)
            {
                Style =
                    new VectorStyle {
                    Outline = new Pen(Brushes.Black, 1), Fill = new SolidBrush(Color.DarkSeaGreen), EnableOutline = true
                }
            });

            var ll = new LabelLayer(string.Format("Label {0}", p3.ProviderName));

            ll.DataSource                = p3;
            ll.LabelStringDelegate       = d => string.Format("Oid:{0}\nVal:{1:n}", d[0], d[1]);
            ll.Style.Halo                = Pens.AliceBlue;
            ll.Style.HorizontalAlignment = LabelStyle.HorizontalAlignmentEnum.Center;
            ll.PriorityColumn            = "Value";
            ll.Style.CollisionBuffer     = new SizeF(2, 2);
            ll.Style.CollisionDetection  = true;
            map.Layers.Add(ll);

            //var extent = map.GetExtents();
            var center = _matrix[1];

            var box = center.EnvelopeInternal;

            box.ExpandBy(25);
            map.ZoomToBox(box);
            return(map);
        }
Exemplo n.º 2
0
        private Map CreateMap()
        {
            var map = new Map(ClientSize);

            //var p1 = new MatrixRelationProvider(_matrix) { ScaleFactor = 0.1d, ScaleMethod = ScaleMethod.Linear };
            //map.Layers.Add(new VectorLayer(p1.ProviderName, p1)
            //{
            //    Style =
            //        new VectorStyle { Outline = new Pen(Brushes.Black, 1), Fill = new SolidBrush(Color.DarkSalmon), EnableOutline = true }
            //});

            var p2 = new MatrixRelationProvider(_matrix) { ScaleFactor = 0.1d, ScaleMethod = ScaleMethod.Linear, RestrictId = 1 };
            map.Layers.Add(new VectorLayer(p2.ProviderName, p2)
            {
                Style =
                    new VectorStyle { Outline = new Pen(Brushes.Black, 1), Fill = new SolidBrush(Color.BlueViolet), EnableOutline = true }
            });

            var p3 = new MatrixODSumProvider(_matrix, ODMatrixVector.Both) { ScaleFactor = 0.1d, ScaleMethod = ScaleMethod.Linear };
            map.Layers.Add(new VectorLayer(p3.ProviderName, p3)
                               {
                                   Style =
                                       new VectorStyle { Outline = new Pen(Brushes.Black, 1), Fill = new SolidBrush(Color.DarkSeaGreen), EnableOutline = true }
                               });

            var ll = new LabelLayer(string.Format("Label {0}", p3.ProviderName));
            ll.DataSource = p3;
            ll.LabelStringDelegate = d => string.Format("Oid:{0}\nVal:{1:n}", d[0], d[1]);
            ll.Style.Halo = Pens.AliceBlue;
            ll.Style.HorizontalAlignment = LabelStyle.HorizontalAlignmentEnum.Center;
            ll.PriorityColumn = "Value";
            ll.Style.CollisionBuffer = new SizeF(2, 2);
            ll.Style.CollisionDetection = true;
            map.Layers.Add(ll);

            //var extent = map.GetExtents();
            var center = _matrix[1];

            var box = center.EnvelopeInternal;
            box.ExpandBy(25);
            map.ZoomToBox(box);
            return map;
        }