ThinkGeo.com    |     Documentation    |     Premium Support

Buttons inside a feature belonging to an InMemoryFeatureLayer or SqlFeatureLayer or ShpFeatureLayer

Hi,

I read the Post “Feature Icon and Tooltip”. You specify that it is not possible to customize or add buttons on an editoverlay.

However, is it possible to add one or two buttons inside a feature that belongs to a layer of type InMemoryFeatureLayer or SqlFeatureLayer or shpFeatureLayer (ie. screen shot)

So the user clicks on the scissors to activate the clipping action, or he clicks on the + to display a tooltip specifying additional information on the polygon (surface, crop, etc …)

If possible, does this evolution have an impact on display performance?

Thanks a lot.

Regards

Steph.

Sample2ButtonsInFeature

Hi Steph,

You can implement that in by set different image style to your point shape. I think an inmemoryfeaturelayer is enough for that.

And you can popup marker(simulator tooltip) or other behavior in the click event.

I don’t think there is performance issue here.

The only possible problem is if you want to use our EditOverlay for some special operation for example clipping action, maybe your custom layer(The buttons) cannot cover above EditOverlay.

Regards,

Ethan

Hi Ethan,

Thank you for your reply.

But inside the feature or polygon, there are no pointshape, so I do not see how implement your solution …

Thanks.
Regards.
Steph.

Ethan,

I have an another question about popup.
Is it possible to use a Wpf popup that is positioned above the overflown feature?
Or is it better to use the popupoverlay?

Thanks .

Regards.
Steph.

Hi Steph,

You can calculate your control points, for example you can get the center point of the bouding box, then place the control point there. Or you can place the points beside one vetex. Just follow your requirement.

In WPF the popup is just a control, you can even build a custom control, and make it looks like popup when you need it, and hide it when you don’t need it, I think you can implement that via mouse events or our existing overlay for simper.

Regards,

Ethan

Hi Ethan,

Thanks for your response.
I still have some questions.
By doing some research on the Wpf forum, I found this post (Guidelines to customize the popup tooltip window)
I tested it, and for my problem, it works well. When hovering over the button, the tooltip appears well. And since the tooltip is of type object, I can create a popup with images, etc …
The disadvantage is that the button is visible all the time for all zoom levels ;-(
There is also the concept of markeroverlay in Thikgeo Wpf
I tried to use FeatureMarkerOVerlay but, the png aqua.png does not appear (we use version 10.5.6) (see file code below MainWindow.xaml.cs)
What element have I forgotten to be able to view the markeroverlay?
The advantage of the featureoverlay is that you can control the visibility of these markers according to the zoom level.
The disadvantage is that the tooltip is of type string ;-(

You also propose another type of markeroverlay, SimpleMarkerOverlay
What is the difference between two types of MarkerOverlay? Under what conditions is it better to use a simpleMarkerOverlay vs featureMarkerOverlay?

Another example is the dynamicoverlay (https://github.com/ThinkGeo/DynamicMarkerOverlaySample-ForWpf/blob/master/DynamicMarkerOverlay.sln).
I have not tested yet but the purpose of this example is to be able to view a popup over the marker, is that it?

To conclude, my goal is to be able to visualize a tooltip on the flyover of a feature or on a click of a feature :
Option 1 : add button in a feature and customized popup a button’s toolip

  1. Advantage: we can put any content in the tooltip like an image, text, etc. (see screen shot TooltipSample.jpg)
  2. Inconvenience: The button is all the time visible at all zoom levels of the map, while the layer is only visible at zoom level 9 ;-(

Option 2: Use FeatureMarkerOVerlay :

  1. Advantage: Allows to visualize the marker at a certain level of zoom
  2. Inconvenience
    a) I could not see the marker ;-( (ie. screen shot MainWindow.xaml.cs)
    b) The tooltip is of type string, so we can not put rich info in the tooltip

Option 3 : Utiliser dynamicoverlay

  1. can we visualize a rich tooltip (image, txt, etc …) and combine the visibility of markers at a certain level of zooms …?

Which of these options best fits my problem ?
And above all, which option offers the best performance?
Because currently, in the map, we have 4 overlays and soon 5 if we add the concept of popupoverlay.
This has the consequence of having some slowness when navigating on the map ;-(

Thank you very much for your help.
And if a point is not clear, do not hesitate to tell me.

Thanks a lot.

Regards.

MainWindow.xaml.cs (2.6 KB)

Hi Steph,

SimpleMarkerOverlay is easy to be used, but you can implement more custom logic for FeatureSourceMarkerOverlay.

For the sample DynamicOverlay it shows display data as markers with different styles based on its attributes.

About your option 1:
It looks your code for the button is not in MainWindow.xaml.cs, so I don’t know how you implement it, but I think if you put the button in a layer, you can put this layer into a custom overlay, then set visibility for different level to make it show or hide.

About your option 2:
In fact you don’t need marker I think, you use the CustomizedPopup now, and a marker should be implemented just like a point, you can use an InmemoryFeatureLayer, then draw the point by image, when you click on layer, find nearest point, and popup the CustomizedPopup about it.

If you implement that, you can put this layer into the same overlay which contains your control point layer, and then they can be set hidden status at the same time.

About the performance, if you found its slow, you can do some optmize about it for example: open cache for base overlay, only refresh necessary layers etc. I don’t think this layer will cause this problem. And we can discuss about that after you implement the functions.

Regards,

Ethan