Hi,
I'm trying to handle the user hovering over a PointShape (with the goal of highlighting the PointShape, or a similar effect). I haven't had any luck achieving this via the MouseMove Event on a WpfMap, using the following code. I'm using an evaluation version of Map Suite Desktop WPF Desktop Edition 3.0.
private void Mouse_Moved(object pSender, MouseEventArgs pE)                 
{
  // Get mouse position in screen coords
  Point mousePosition = pE.GetPosition(pSender as IInputElement);
  // Convert mouse screen coords to world coords
  mousePosition = ActualMap.ToWorldCoordinate(mousePosition); 
  // Get the feature layer
  InMemoryFeatureLayer featureLayer = 
   (InMemoryFeatureLayer) ActualMap.FindFeatureLayer("SomeLayerName");
  // Get a list of all the features within the layer  
  featureLayer.Open();
    Collection<Feature> features  =
      featureLayer.QueryTools.GetAllFeatures(ReturningColumnsType.NoColumns);
  featureLayer.Close();
  // Loop through every feature and see if the mouse is within
  foreach (Feature feature in features)
  {
    BaseShape currentShape = feature.GetShape();
    // See if the mouse lies within the shape
    if (currentShape.Contains(mousePosition)
    {
      Console.WriteLine("yay"); // Of course, a breakpoint here :)
    }
  } // foreach
} // event handler
The above does not work, the currentShape.Contains() always returns false. I've also tried all other options, such as :
    - Using another geometry-related function, such as currentShape.Crosses, Intersects, IsWithin, Overlaps, Touches
    - Also switched caller and callee e.g. mousePosition.Contains(currentShape), with the above functions
I've logged some output from the code (I did not include it above for clarity) :
Mouse   6032915,3281 1577624,0693
Shape 0 6123046,9403 1482548,3798
Shape 1 6033625,8535 1581123,6545
Shape 2 6033123,2443 1577457,7021
The first line is mousePosition X and Y, the following lines are my PointShapes' X and Y. I think I was aiming to hover over Shape 2. Doesn't work with either shapes.
Other info would be that the shapes are being drawn using a stripped-down version of the SizedPointStyle class from your sample library. The features are not of concern here, they are drawn as they should, the PostgreSQL Plugin gets them out of a Geo DB just fine, the map is drawn alright, using a Meters as a MapUnit and a good projectiion. I believe all prerequisites are met.
The same exact code worked for (simple) Polyline shapes, that is why I'm at a loss for the time being.
My guess for the failure is that on a finer level the Points are a mere 1px big. My first guess was scaling, but I don't think that will get me anywere further.
Please tell me if I should provide any other details (a sample app wouldn't work because of the DB Layer and all).
Thank you in advance !
P.S. : The code snippet is within the attachment as well.
code.txt (1.17 KB)