How to show a callout on the map dynamically? - mapbox

I am following this example:
https://docs.mapbox.com/android/maps/examples/symbol-layer-info-window/
Also here:
https://github.com/mapbox/mapbox-android-demo/blob/master/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/dds/InfoWindowSymbolLayerActivity.java
It is loading a number of points with descriptions from a file.
On line 271:
String geoJson = loadGeoJsonFromAsset(activity, "us_west_coast.geojson");
What I need is to do the same dynamically. I have the information already as features in the map. I can get Title and Description from there. What I need is to use GenerateViewIconTask and setUpInfoWindowLayer when this event is triggered: onMapClick.
So basically a user taps on the map, I get the coordinates and search in the map's features, get the lat/lng, title and description and show up a callout on the map.
I can handle tapping, getting the map's feature, extracting title and description. What I need to do to finish with showing a nice callout on this location with title and description.

Sorry for the late response. You can either show a label by setting the textfield property or (according to the docs) create an info window by setting the iconImage property to a string, like iconImage("{title}").
Sadly I've rarely used the latter as it never worked for me.

Related

Leaflet list marker options

I would need some information on list markers:
how can I change the opacity of the list and also the background color
how can I set the overflow so that if the markers in the list increase, they scroll through the
scrollbar?
Thanks
This is clearly not a leaflet element, to change the transparency of the object that you specified, you most likely need to change these properties in the css, try using DeveloperTools in the browser to find where this object takes the properties (transparency) from and you will know how to change it correctly.
Example
If I understand your question correctly, here is an approximate way to do what you ask in the first part of the question. Show your code what it looks like now.
.className {
background: white;
}
let marker = L.circle([50.0], [40.0]], {opacity: 1}).addTo(map),
marker.className = "className";
no I don't mean the transparency of the single marker but of the list, I send a photo in which the list is circled.
I don't know in which part of the library to act to give properties to this list element.

How to access callout view on clicking on map annotation using swift in xctest

I want to access callout views and do some UIAutomation on those views. I'm able to click on map markers/annotations but not able to access the callout view.
The following code used to tap on the marker:
let marker = app.otherElements.matching(identifier: "mapMarker").element(boundby: 0)
marker.tap();
After this, I'm getting the callout view of the respected marker/annotation.
I need to access that callout.
Please suggest me on this.
You should create a breakpoint after the callout is snown,
then type po print(app.debugDescription) (or simply po app in XCode 11) in lldb in order to view the whole hierarchy of UI elements.
Locate the needed element and access it further in code.
Also, consider rewriting your marker code in a shorter way:
let marker = app.otherElements["mapMarker"].firstMatch
Please notice firstMatch aborts search of elements after it found the first one.
Drop firstMatch, if you want to check that the element is unique
let marker = app.otherElements["mapMarker"]
Same as Smart Monkey said, but to add more code based off the comment from ablarg:
Ex: "mapMarker" being the accessibility ID for the element
let mapMarker = app.maps.otherElements["mapMarker"].firstMatch
let mapMarkerExists = mapMarker.waitForExistence(timeout: 3)
if mapMarkerExists {
mapMarker.tap()
}
waitForExistence(timeout:) returns a bool, so if the element appears before the timeout expires (it finds the element) take action (tap) on the element.
Make sure the element is enabled for accessibility and has the accessibility ID set.

Set backend title for Mask-Elements in Typo3

I have a Typo3 server. On that I created some different content elements with mask.
In this elements there are often repeating content, like texts or other stuff.
So the editors make a new element in the backend, there they can add a headline and as much text parts as they want.
Often it looks like this:
Thats good, the editor can see a "preview" of the textparts. In this example "Karriere,Partner...". This naming happens automatically.
My Problem is, some times there arent any titles. Its always "No title". As an editor its quite hard to find the right dropdown to edit some stuff, you mostly have to open all dropdowns and search for the right one.
Its look then like this:
In both elements there are some string inputs that are very good for the title.
So my question is, how is mask gonna choose the title? Its not the first string input.
And secondly, can I tell Mask that they have to choose input field XYZ as title?
Heyo
Yes, you can tell Mask which field to use as a title for inline elements (like repeating contents). When you're setting up a new Mask element, right below the "Label" field of the repeated inline element, there is a field "Field that should be used as label for inline element (starting with tx_mask_)". This will be used as the title that is displayed in the backend. In the placeholder of that field, it explicitly says that "If empty, first field is used".
So, if your inline element has a field "my_awesome_header" which you would like to use as the title in the backend, set the above to "tx_mask_my_awesome_header".
I am not certain as to why it does not display anything in your second example. It might be that either the first input field is not a string, or the first input field is a string but it is empty.
I hope this helps. Let me know if you need further clarification.
Edit: Since that question came up, it should be possible to set a static default title to the containing Mask element using mod.wizards.newContentElement.wizardItems.mask.elements.[name of the mask element].tt_content_defValues.header = My awesome static title. As I said in the comments, though: I always give my Mask elements a header field and let editors fill that in.

Bokeh - How to use box tool without default selections?

I have built a bokeh app that allows users to select windows in data and run python code to find and label (with markers) extreme values within these limits. For ease of interaction, I use the box select tool for the range selection. My problem arises when repeating this process for subsequent cases. After markers are placed for the results, they are rendered invisible by setting alpha to zero and another case needs to be chosen. When the new select box includes previous markers, they become visible based on the selection. How do I override this default behavior? Can markers be made unselectable? or can I add code to the customJS to hide them after they are selected?
Thanks in advance for any help!
There are a few possible approaches. If you just want non-selected glyphs to "disappear" visually, you can set a policy to do that as described here:
http://docs.bokeh.org/en/latest/docs/user_guide/styling.html#selected-and-unselected-glyphs
Basically, for bokeh.plotting, pass
nonselection_fill_alpha=0.0,
nonselection_line_alpha=0.0,
as arguments to your plot.circle call or whatever. Or if you are using the low level bokeh.models interface, something like:
renderer.nonselection_glyph = Circle(fill_alpha=0.0, line_alpha=0.0)
But be aware (I think you already are) that the invisible markers are still there, and still selectable if the user happens to draw a box over them with the selection tool.
If you truly want only a subset of the data to be visible and selectable after a selection, I'd say you want to replace the data in the column data source wholesale with the subset in your selection callback.

Click-through markers and polylines in Leaflet

In Leaflet, is it possible to define a marker or polyline with {clickable:false}, so that a click is passed through to whatever lies beneath - be it the map or a clickable geometry object?
At the moment I solve this problem by making the marker/polyline clickable and passing the event onwards myself. But this leads to the mouse cursor always showing as the hand symbol. Ideally, the mouse cursor should look like the normal pointer or the hand, depending on whether what is beneath the marker/polyline is clickable.
This may not be the answer you are looking for, but you can use featureGroups to have all of your clickable polylines come to the front so that the actions are surfaced.
var lg_noclick = new L.FeatureGroup().addTo(map);
var lg_click = new L.FeatureGroup().addTo(map);
// Add lines
lg_click.bringToFront();
updated fiddle
Also if you can afford to know your lines before hand, correct ordering of when you add the lines it will work as well.
I know this is not ideal but it suited my situation just fine, so it might be good for you as well.
This hides the icon and brings it back after a second using mouseenter and mouseleave events:
$('.leaflet-marker-icon').mouseenter(function() {
$(this).hide();
});
$('.leaflet-marker-icon').mouseleave(function() {
$(this).delay(1000).show(0);
});