AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
WebPlot.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or
9having been advised so by Algoryx Simulation AB for a time limited evaluation,
10or having purchased a valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agx/config/AGX_USE_WEBPLOT.h>
20
21#if AGX_USE_WEBPLOT()
22
23#include <agxPlot/Output.h>
24#include <agxNet/WebSocket.h>
25
26namespace agxPlot
27{
29
33 class AGXPHYSICS_EXPORT WebPlot : public agxPlot::Output
34 {
35 public:
36
41 WebPlot(bool openBrowser = false, bool useDefaultPort = true);
42
43 agx::UInt16 getPort() const;
44
45 virtual void handlePacket(DataPacket *packet) override;
46 virtual void handlePacket(DescriptionPacket *packet) override;
47 virtual void handlePacket(TimePacket *packet) override;
48 virtual bool isReady() override;
49 virtual void closeOutput() override;
50
51 void removeCurve(CurveID curveID);
52
53 protected:
54 virtual ~WebPlot();
55
56 private:
57 void clientConnected(agxNet::WebSocket* client);
58 void clientDisconnected(agxNet::WebSocket* client);
59
60 agxNet::StructuredMessage *createMessage(DataPacket *packet);
61 agxNet::StructuredMessage *createMessage(DescriptionPacket *packet);
62 agxNet::StructuredMessage *createMessage(TimePacket *packet);
63 private:
64 agxNet::WebSocketServerRef m_socketServer;
65 DescriptionPacketRef m_currentDescription;
66 agx::Vector<DataPacketRef> m_dataHistory;
67 };
68}
69
70
71// End AGX_USE_WEBPLOT()
72#endif
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXPHYSICS_EXPORT
THis class wraps the description of data that should be plotted.
Definition Output.h:35
Templated vector class.
Definition agx/Vector.h:53
Namespace contains functionality related to plotting.
agx::ref_ptr< DescriptionPacket > DescriptionPacketRef
uint16_t UInt16
Definition Integer.h:31