GS1
August 14, 2012, 5:20pm
1
Hello ThinkGeo,
Using Inmemoryfeaturelayer, I have a single-point shape plotted. So, I tried initially with the mouse down with EditInteractiveOverlay class with
editlayer.MapMouseDown += new EventHandler(_MapMouseDown) and this works great
So my requirement: I want to do either on mouseenter or mouseover on a point a shape ..I want to display custompopup with queryfeature option(), and this helps when I have plotted more poinshapes.
I'm here with attaching code,please let us know why the popup is not appearing when user's mouse over a point?? Appreciate early reply on this.
SimplePointShape.txt (6.31 KB)
Edgar
August 15, 2012, 1:16am
2
Hi GS,
Pointshape Cannot contain a pointshape so we suggest you to use other method, e.g.
PointShape ptShape = Map.ToWorldCoordinate(e.GetPosition(Map)); double width = 5 * Map.CurrentExtent.Width / Map.WidthInPixels; RectangleShape boundingBox = new RectangleShape(ptShape.X - width, ptShape.Y + width, ptShape.X + width, ptShape.Y - width); testlayer.Open(); Collection<Feature> selectedpoint = testlayer.QueryTools.GetFeaturesInsideBoundingBox(boundingBox, ReturningColumnsType.AllColumns);
Hope it helps,
Edgar
GS1
August 15, 2012, 2:32pm
3
Edgar,
Thanks for quick response.
On WPF application...I dont see MAP.WidthInPixels property.So I changed it as follows...
PointShape ptShape = Map.ToWorldCoordinate(e.GetPosition(Map)); double width = 5 * Map.CurrentExtent.Width / Map.ActualWidth; RectangleShape boundingBox = new RectangleShape(ptShape.X - width, ptShape.Y + width, ptShape.X + width, ptShape.Y - width); testlayer.Open(); Collection<feature> selectedpoint = testlayer.QueryTools.GetFeaturesInsideBoundingBox(boundingBox, ReturningColumnsType.AllColumns);</feature>
Is this correct ?? and after changing ...still ..I dont see popup appearing on mouseenter??
Edgar
August 16, 2012, 1:52am
4
GS,
I used the MouseMove event and it works, you can use the following code:
void Map1_MouseMove(object sender, System.Windows.Input.MouseEventArgs e) { PointShape ptShape = Map1.ToWorldCoordinate(e.GetPosition(Map1)); double width = 5 * Map1.CurrentExtent.Width / Map1.ActualWidth; RectangleShape boundingBox = new RectangleShape(ptShape.X - width, ptShape.Y + width, ptShape.X + width, ptShape.Y - width); layer.Open(); Collection<Feature> selectedpoint = layer.QueryTools.GetFeaturesInsideBoundingBox(boundingBox, ReturningColumnsType.AllColumns); if (selectedpoint.Count > 0) { Popup pop = new Popup(selectedpoint[0].GetShape().GetCenterPoint()) { Content = selectedpoint[0].ColumnValues["AreaName"]}; popOverlay.Popups.Add(pop); Map1.Refresh(); } }
Hope it helps,
Edgar