ThinkGeo.com    |     Documentation    |     Premium Support

WPF/C-Sharp- CustomPopupOverly on mouse right click hovering over a feature

 Hello ThinkGeo,


 I have a custom popupoverlay and in the main map...Using InmemoryFeatureOverlay....I have a three EllipseShape(with radius set to 1.25) features  plotted on  a map . For  displaying popup, I'm using  EditInteractiveOverlay.




Question: How can I prevent displaying popup, if users click outside of a  feature ???For Example: Irrespective of zoom levels and/or radius ....... I want to display popup when the user right clicks on EllipseShape feature only... based on certain tolerance ratio. Is this possible??


 Here is the code that I'm currently using to find nearest features and but i couldn't be able to find exact pattern  to figure it out that fits my requirement.


 


EditInteractiveOverlay test;


 test.MapMouseDown += new EventHandler<mapmousedowninteractiveoverlayeventargs>(_MapMouseDown);</mapmousedowninteractiveoverlayeventargs>


 


  private void _MapMouseDown(object sender,


 MapMouseDownInteractiveOverlayEventArgs e)


        {


            InteractionArguments InteractionArgs = e.InteractionArguments;


            PointShape ptShape = new PointShape(InteractionArgs.WorldX, InteractionArgs.WorldY);


 


          Collection<feature> selectedWorkArea = null;</feature>


            customRegInMemFeatureLayer.Open();


            lock ( customRegInMemFeatureLayer )


            {


 


                selectedFeature =  customRegInMemFeatureLayer .QueryTools.GetFeaturesNearestTo(ptShape,


                     GeographyUnit.DecimalDegree, 1, ReturningColumnsType.AllColumns);


 


                double disStop = Double.MaxValue;


                if ( selectedFeature  .Count >= 1)


                {


                     selectedFeature   =  customRegInMemFeatureLayer .QueryTools.GetFeaturesNearestTo(ptShape,


                         GeographyUnit.DecimalDegree, 1, ReturningColumnsType.AllColumns);


 


                    if ( selectedFeature  .Count == 1)


                    {


                        BaseShape baseShape =  selectedFeature  [0].GetShape();


                        PointShape ptStopShape = baseShape as PointShape;


                        if (null != ptStopShape)


                        {


                            disStop = ptShape.GetDistanceTo(ptStopShape, GeographyUnit.DecimalDegree, DistanceUnit.Meter);


 


                        }


                    }


                }


 


                if (InteractionArgs.MouseButton == MapMouseButton.Right) // && Keyboard.IsKeyDown(Key.LeftAlt))


                {


 


                          //Display custom popup information


                        }


 


else


{


//Hide the popup


}


 


}


 


Appreciate early reply!


 


 



  Hello ThinkGeo ,


 


Any update on this please??



 Hi GS,


 
Sorry for the long time waiting, for your requirement, you can try the code below:
 

Collection<Feature> features = customRegInMemFeatureLayer .QueryTools.GetFeaturesContaining(ptShape, ReturningColumnsType.AllColumns)

 
Hope it helps,
 
Edgar