Example #1
0
        public override void OnMouseUp(ICoordinate worldPosition, MouseEventArgs e)
        {
            if (!IsActive)
            {
                return;
            }

            PropertySpec ps;
            var          bag = new PropertyTable();

            bag.Properties.Add(new PropertySpec("X", typeof(double), "Position"));
            bag.Properties.Add(new PropertySpec("Y", typeof(double), "Position"));
            bag["X"] = worldPosition.X;
            bag["Y"] = worldPosition.X;

            ICoordinate coordinate = new Coordinate(worldPosition.X, worldPosition.Y);

            foreach (var layer in Map.Layers)
            {
                if (layer is ICoverageLayer && layer.Envelope.Contains(coordinate))
                {
                    var value = ((ICoverageLayer)layer).Coverage.Evaluate(coordinate);

                    if (value == null)
                    {
                        bag.Properties.Add(new PropertySpec(layer.Name, typeof(string), "Values"));
                        bag[layer.Name] = "<empty>";
                    }
                    else
                    {
                        bag.Properties.Add(new PropertySpec(layer.Name, value.GetType(), "Values"));
                        bag[layer.Name] = value;
                    }
                }
            }

            if (ResultChanged != null)
            {
                var args = new QueryResultEventArgs();
                args.Result = bag;
                ResultChanged(this, args);
            }

            base.OnMouseDown(worldPosition, e);
        }
Example #2
0
        public override void OnMouseUp(ICoordinate worldPosition, MouseEventArgs e)
        {
            if (!IsActive)
                return;

            PropertySpec ps;
            var bag = new PropertyTable();

            bag.Properties.Add(new PropertySpec("X", typeof(double), "Position"));
            bag.Properties.Add(new PropertySpec("Y", typeof(double), "Position"));
            bag["X"] = worldPosition.X;
            bag["Y"] = worldPosition.X;

            ICoordinate coordinate = new Coordinate(worldPosition.X, worldPosition.Y);
            foreach (var layer in Map.Layers)
            {
                if (layer is ICoverageLayer && layer.Envelope.Contains(coordinate))
                {

                    var value = ((ICoverageLayer) layer).Coverage.Evaluate(coordinate);

                    if(value == null)
                    {
                        bag.Properties.Add(new PropertySpec(layer.Name, typeof(string), "Values"));
                        bag[layer.Name] = "<empty>";
                    }
                    else
                    {
                        bag.Properties.Add(new PropertySpec(layer.Name, value.GetType(), "Values"));
                        bag[layer.Name] = value;
                    }
                }
            }

            if (ResultChanged != null)
            {
                var args = new QueryResultEventArgs();
                args.Result = bag;
                ResultChanged(this, args);
            }

            base.OnMouseDown(worldPosition, e);
        }