mbsimcontrol  4.0.0
MBSim Control Module
signal_observer.h
1 /* Copyright (C) 2004-2020 MBSim Development Team
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * Contact: martin.o.foerg@gmail.com
18  */
19 
20 #ifndef _SIGNAL_OBSERVER_H__
21 #define _SIGNAL_OBSERVER_H__
22 
23 #include "mbsim/observers/observer.h"
24 
25 #include <mbsim/utils/boost_parameters.h>
26 #include <mbsim/utils/openmbv_utils.h>
27 
28 namespace MBSimControl {
29 
30  class Signal;
31 
33  private:
34  Signal *signal{nullptr};
35  Signal *position{nullptr};
38  std::string saved_signal;
39  std::string saved_position;
40 
41  public:
42  SignalObserver(const std::string &name="") : MBSim::Observer(name) { }
43 
44  void setSignal(Signal *signal_) { signal = signal_; }
45  void setPosition(Signal *position_) { position = position_; }
46 
47  void init(InitStage stage, const MBSim::InitConfigSet &config) override;
48  void initializeUsingXML(xercesc::DOMElement *element) override;
49  void plot() override;
50 
51  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBV, MBSim::tag, (optional (scaleLength,(double),1)(scaleSize,(double),1)(referencePoint,(MBSim::OpenMBVArrow::ReferencePoint),MBSim::OpenMBVArrow::fromPoint)(colorRepresentation,(MBSim::OpenMBVArrow::ColorRepresentation),MBSim::OpenMBVArrow::none)(minimalColorValue,(double),0)(maximalColorValue,(double),1)(diffuseColor,(const fmatvec::Vec3&),"[-1;1;1]")(transparency,(double),0)(pointSize,(double),0)(lineWidth,(double),0))) {
52  ombvArrow = std::shared_ptr<MBSim::OpenMBVArrow>(new MBSim::OpenMBVArrow(scaleLength,scaleSize,MBSim::OpenMBVArrow::toHead,referencePoint,colorRepresentation,minimalColorValue,maximalColorValue,diffuseColor,transparency,pointSize,lineWidth));
53  }
54  };
55 
56 }
57 
58 #endif
Signal.
Definition: signal_.h:38
std::string name
Definition: signal_observer.h:32