Wt  4.12.0
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
Wt::WLeafletMap::AbstractMapItem Class Referenceabstract

An abstract map item. More...

#include <WLeafletMap.h>

Inheritance diagram for Wt::WLeafletMap::AbstractMapItem:
[legend]

Public Member Functions

void move (const Coordinate &pos)
 Move the map item. More...
 
Coordinate position () const
 Get the current position. More...
 
Signalclicked ()
 Signal emitted when the user clicks on the map item. More...
 
SignaldoubleClicked ()
 Signal emitted when the user double-clicks on the map item. More...
 
SignalmouseWentDown ()
 Signal emitted when the user holds the mouse click on the map item. More...
 
SignalmouseWentUp ()
 Signal emitted when the user releases the mouse click on the map item. More...
 
SignalmouseWentOver ()
 Signal emitted when the user's mouse enters the map item. More...
 
SignalmouseWentOut ()
 Signal emitted when the user's mouse leaves the map item. More...
 
- Public Member Functions inherited from Wt::WObject
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< WObjectremoveChild (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...
 
- Public Member Functions inherited from Wt::Core::observable
 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

 AbstractMapItem (const Coordinate &pos)
 Constructor. More...
 
virtual void createItemJS (WStringStream &ss, WStringStream &postJS, long long id)=0
 Writes the JS code to create this item to the stream. More...
 
virtual void unrender ()
 Unrender the item. More...
 
virtual bool needsUpdate () const
 Return whether this item needs to be updated. More...
 
WLeafletMapmap ()
 Returns the map this item belongs to.
 
const WLeafletMapmap () const
 Returns the map this item belongs to.
 
virtual void update (WStringStream &js)
 Writes the JS to update this item to the stream. More...
 
virtual void setMap (WLeafletMap *map)
 Set the map this item belongs to. More...
 
- Protected Member Functions inherited from Wt::WObject
virtual WStatelessSlot * getStateless (Method method)
 On-demand stateless slot implementation. More...
 

Private Member Functions

virtual void applyChangeJS (WStringStream &ss, long long id)
 
virtual std::string addFunctionJs () const
 The name of the JS function that adds the item to the map.
 

Additional Inherited Members

- Public Types inherited from Wt::WObject
typedef void(WObject::* Method) ()
 Typedef for a WObject method without arguments.
 

Detailed Description

An abstract map item.

This is the base class for all items that can be added to a WLeafletMap. As this is an abstract class, it should not be added directly to a map as is. Instead, you should use one of the subclasses.

Constructor & Destructor Documentation

◆ AbstractMapItem()

Wt::WLeafletMap::AbstractMapItem::AbstractMapItem ( const Coordinate pos)
explicitprotected

Constructor.

Since this is an abstract class, it should not be used directly.

Member Function Documentation

◆ applyChangeJS()

void Wt::WLeafletMap::AbstractMapItem::applyChangeJS ( WStringStream ss,
long long  id 
)
privatevirtual

This method should write the JS code needed to update the item. The JS code written can use o.wtObj to refer to the WLeafletMap JS object.

Reimplemented in Wt::WLeafletMap::AbstractOverlayItem.

◆ clicked()

Signal& Wt::WLeafletMap::AbstractMapItem::clicked ( )

Signal emitted when the user clicks on the map item.

Note
For AbstractOverlayItem, this signal is only triggered if their interactive option is set to true (by default, it is set to false).
See also
setOptions()

◆ createItemJS()

virtual void Wt::WLeafletMap::AbstractMapItem::createItemJS ( WStringStream ss,
WStringStream postJS,
long long  id 
)
protectedpure virtual

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.

Implemented in Wt::WLeafletMap::LeafletMarker, Wt::WLeafletMap::WidgetMarker, Wt::WLeafletMap::Tooltip, and Wt::WLeafletMap::Popup.

◆ doubleClicked()

Signal& Wt::WLeafletMap::AbstractMapItem::doubleClicked ( )

Signal emitted when the user double-clicks on the map item.

Note
Double-clicking on a marker may trigger the doubleClickZoom from leaflet as well, which does zoom on the map, centered on where the click occurred.
For AbstractOverlayItem, this signal is only triggered if their interactive option is set to true (by default, it is set to false).
See also
setOptions()

◆ mouseWentDown()

Signal& Wt::WLeafletMap::AbstractMapItem::mouseWentDown ( )

Signal emitted when the user holds the mouse click on the map item.

Note
For AbstractOverlayItem, this signal is only triggered if their interactive option is set to true (by default, it is set to false).
See also
setOptions()

◆ mouseWentOut()

Signal& Wt::WLeafletMap::AbstractMapItem::mouseWentOut ( )

Signal emitted when the user's mouse leaves the map item.

Note
For AbstractOverlayItem, this signal is only triggered if their interactive option is set to true (by default, it is set to false).
See also
setOptions()

◆ mouseWentOver()

Signal& Wt::WLeafletMap::AbstractMapItem::mouseWentOver ( )

Signal emitted when the user's mouse enters the map item.

Note
For AbstractOverlayItem, this signal is only triggered if their interactive option is set to true (by default, it is set to false).
See also
setOptions()

◆ mouseWentUp()

Signal& Wt::WLeafletMap::AbstractMapItem::mouseWentUp ( )

Signal emitted when the user releases the mouse click on the map item.

Note
For AbstractOverlayItem, this signal is only triggered if their interactive option is set to true (by default, it is set to false).
See also
setOptions()

◆ move()

void Wt::WLeafletMap::AbstractMapItem::move ( const Coordinate pos)

Move the map item.

If this map item belongs to a map, this will trigger an update of the WLeafletMap to move the map item. If it doesn't belong to a map, the position is merely updated.

◆ needsUpdate()

bool Wt::WLeafletMap::AbstractMapItem::needsUpdate ( ) const
protectedvirtual

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 in Wt::WLeafletMap::WidgetMarker.

◆ position()

Coordinate Wt::WLeafletMap::AbstractMapItem::position ( ) const

Get the current position.

See also
move

◆ setMap()

void Wt::WLeafletMap::AbstractMapItem::setMap ( WLeafletMap map)
protectedvirtual

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.

See also
map()

Reimplemented in Wt::WLeafletMap::WidgetMarker, Wt::WLeafletMap::Marker, and Wt::WLeafletMap::AbstractOverlayItem.

◆ unrender()

void Wt::WLeafletMap::AbstractMapItem::unrender ( )
protectedvirtual

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.

See also
WLeafletMap::setOptions()

Reimplemented in Wt::WLeafletMap::WidgetMarker.

◆ update()

void Wt::WLeafletMap::AbstractMapItem::update ( WStringStream js)
protectedvirtual

Writes the JS to update this item to the stream.

This is called when the map is rendered if needsUpdate() returns true.

Reimplemented in Wt::WLeafletMap::WidgetMarker.