Wt
4.12.0
|
A marker rendered with a widget. More...
#include <WLeafletMap.h>
Public Member Functions | |
WidgetMarker (const Coordinate &pos, std::unique_ptr< WWidget > widget) | |
Create a new WidgetMarker at the given position with the given widget. | |
WWidget * | widget () |
Get the widget. | |
const WWidget * | widget () const |
Get the widget (const) | |
void | setAnchorPoint (double x, double y) |
Set the anchor point of the marker. More... | |
![]() | |
void | addPopup (std::unique_ptr< Popup > popup) |
Add the popup to the Marker. More... | |
std::unique_ptr< Popup > | removePopup () |
Removes the popup from the Marker. More... | |
Popup * | popup () |
Return the popup added to the Marker. More... | |
void | addTooltip (std::unique_ptr< Tooltip > tooltip) |
Add the tooltip to the Marker. More... | |
std::unique_ptr< Tooltip > | removeTooltip () |
Removes the tooltip from the Marker. More... | |
Tooltip * | tooltip () |
Return the tooltip added to the Marker. More... | |
![]() | |
void | move (const Coordinate &pos) |
Move the map item. More... | |
Coordinate | position () const |
Get the current position. More... | |
Signal & | clicked () |
Signal emitted when the user clicks on the map item. More... | |
Signal & | doubleClicked () |
Signal emitted when the user double-clicks on the map item. More... | |
Signal & | mouseWentDown () |
Signal emitted when the user holds the mouse click on the map item. More... | |
Signal & | mouseWentUp () |
Signal emitted when the user releases the mouse click on the map item. More... | |
Signal & | mouseWentOver () |
Signal emitted when the user's mouse enters the map item. More... | |
Signal & | mouseWentOut () |
Signal emitted when the user's mouse leaves the map item. More... | |
![]() | |
void | addChild (std::unique_ptr< WObject > child) |
Add a child WObject whose lifetime is determined by this WObject. | |
template<typename Child > | |
Child * | addChild (std::unique_ptr< Child > child) |
Add a child WObject, returning a raw pointer. More... | |
std::unique_ptr< WObject > | removeChild (WObject *child) |
Remove a child WObject, so its lifetime is no longer determined by this WObject. | |
template<typename Child > | |
std::unique_ptr< Child > | removeChild (Child *child) |
Remove a child WObject, so its lifetime is no longer determined by this WObject. More... | |
virtual const std::string | id () const |
Returns the (unique) identifier for this object. More... | |
virtual void | setObjectName (const std::string &name) |
Sets an object name. More... | |
virtual std::string | objectName () const |
Returns the object name. More... | |
void | resetLearnedSlots () |
Resets learned stateless slot implementations. More... | |
template<class T > | |
void | resetLearnedSlot (void(T::*method)()) |
Resets a learned stateless slot implementation. More... | |
template<class T > | |
WStatelessSlot * | implementStateless (void(T::*method)()) |
Declares a slot to be stateless and learn client-side behaviour on first invocation. More... | |
template<class T > | |
WStatelessSlot * | implementStateless (void(T::*method)(), void(T::*undoMethod)()) |
Declares a slot to be stateless and learn client-side behaviour in advance. More... | |
void | isNotStateless () |
Marks the current function as not stateless. More... | |
template<class T > | |
WStatelessSlot * | implementJavaScript (void(T::*method)(), const std::string &jsCode) |
Provides a JavaScript implementation for a method. More... | |
![]() | |
observable () noexcept | |
Default constructor. | |
virtual | ~observable () |
Destructor. More... | |
template<typename... Args, typename C > | |
auto | bindSafe (void(C::*method)(Args...)) noexcept |
Protects a method call against object destruction. More... | |
template<typename... Args, typename C > | |
auto | bindSafe (void(C::*method)(Args...) const) const noexcept |
Protects a const method call against object destruction. More... | |
template<typename Function > | |
auto | bindSafe (const Function &function) noexcept |
Protects a function against object destruction. More... | |
Protected Member Functions | |
virtual void | setMap (WLeafletMap *map) override |
Set the map this item belongs to. More... | |
virtual void | createItemJS (WStringStream &ss, WStringStream &postJS, long long id) override |
Writes the JS code to create this item to the stream. More... | |
virtual void | unrender () override |
Unrender the item. More... | |
virtual bool | needsUpdate () const override |
Return whether this item needs to be updated. More... | |
virtual void | update (WStringStream &js) override |
Writes the JS to update this item to the stream. More... | |
![]() | |
AbstractMapItem (const Coordinate &pos) | |
Constructor. More... | |
WLeafletMap * | map () |
Returns the map this item belongs to. | |
const WLeafletMap * | map () const |
Returns the map this item belongs to. | |
![]() | |
virtual WStatelessSlot * | getStateless (Method method) |
On-demand stateless slot implementation. More... | |
Additional Inherited Members | |
![]() | |
typedef void(WObject::* | Method) () |
Typedef for a WObject method without arguments. | |
A marker rendered with a widget.
This can be used to place arbitrary widgets on the map.
The widgets will stay the same size regardless of the zoom level of the map.
|
overrideprotectedvirtual |
Writes the JS code to create this item to the stream.
This method should write in ss
the JS code that creates the item. The postJS
stream can be used to write JS code that should be executed after the item has been created.
Implements Wt::WLeafletMap::AbstractMapItem.
|
overrideprotectedvirtual |
Return whether this item needs to be updated.
This is called when the map is rendered. If this returns true, update() will be used to update the item.
Reimplemented from Wt::WLeafletMap::AbstractMapItem.
void Wt::WLeafletMap::WidgetMarker::setAnchorPoint | ( | double | x, |
double | y | ||
) |
Set the anchor point of the marker.
This determines the "tip" of the marker (relative to its top left corner). The marker will be aligned so that this point is at the marker's geographical location.
If x is negative, the anchor point is in the horizontal center of the widget. If y is negative, the anchor point is in the vertical center of the widget.
By default the anchor point is in the middle (horizontal and vertical center).
|
overrideprotectedvirtual |
Set the map this item belongs to.
This is called to set the map the item belongs to. You can override this function if you need to do something when the item is added to a map.
You should not call this function directly.
Reimplemented from Wt::WLeafletMap::Marker.
|
overrideprotectedvirtual |
Unrender the item.
This is called when the map needs to be recreated. You can override this function in case you need to do some cleanup before the map is recreated.
By default, this does nothing.
Reimplemented from Wt::WLeafletMap::AbstractMapItem.
|
overrideprotectedvirtual |
Writes the JS to update this item to the stream.
This is called when the map is rendered if needsUpdate() returns true.
Reimplemented from Wt::WLeafletMap::AbstractMapItem.