Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:38

0001 /*************************************************************************
0002  * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers.               *
0003  * All rights reserved.                                                  *
0004  *                                                                       *
0005  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0006  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0007  *************************************************************************/
0008 
0009 #ifndef ROOT7_RDisplayItem
0010 #define ROOT7_RDisplayItem
0011 
0012 #include <string>
0013 
0014 namespace ROOT {
0015 namespace Experimental {
0016 
0017 class RDrawable;
0018 class RStyle;
0019 class RAttrMap;
0020 
0021 /** \class RDisplayItem
0022 \ingroup GpadROOT7
0023 \brief Base class for painting data for JS.
0024 \author Sergey Linev <s.linev@gsi.de>
0025 \date 2017-05-31
0026 \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
0027 */
0028 
0029 class RDisplayItem {
0030 protected:
0031    std::string fObjectID;   ///< unique object identifier
0032    RStyle *fStyle{nullptr}; ///< style object
0033    unsigned fIndex{0};      ///<! index inside current pad, used to produce fully-qualified id, not send to client
0034    bool fDummy{false};      ///< if true, just placeholder for drawable which does not changed
0035 
0036 public:
0037    RDisplayItem() = default;
0038    RDisplayItem(bool dummy) : RDisplayItem() { fDummy = dummy; }
0039    virtual ~RDisplayItem() {}
0040 
0041    void SetObjectID(const std::string &id) { fObjectID = id; }
0042    std::string GetObjectID() const { return fObjectID; }
0043 
0044    void SetObjectIDAsPtr(const void *ptr);
0045 
0046    void SetStyle(RStyle *style) { fStyle = style; }
0047 
0048    void SetIndex(unsigned indx) { fIndex = indx; }
0049    unsigned GetIndex() const { return fIndex; }
0050 
0051    virtual void BuildFullId(const std::string &prefix);
0052 
0053    static std::string ObjectIDFromPtr(const void *ptr);
0054 };
0055 
0056 
0057 /** \class RDrawableDisplayItem
0058 \ingroup GpadROOT7
0059 \brief Generic display item for RDrawable, just reference drawable itself
0060 \author Sergey Linev <s.linev@gsi.de>
0061 \date 2017-05-31
0062 \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
0063 */
0064 
0065 class RDrawableDisplayItem : public RDisplayItem {
0066 protected:
0067 
0068    const RDrawable *fDrawable{nullptr};        ///< drawable
0069 
0070 public:
0071 
0072    template <class DRAWABLE>
0073    RDrawableDisplayItem(const DRAWABLE &dr)
0074    {
0075       fDrawable = &dr;
0076    }
0077 
0078    const RDrawable *GetDrawable() const { return fDrawable; }
0079 
0080    ~RDrawableDisplayItem() override;
0081 
0082 };
0083 
0084 
0085 /** \class RIndirectDisplayItem
0086 \ingroup GpadROOT7
0087 \brief Extract (reference) only basic attributes from drawable, but not drawable itself
0088 \author Sergey Linev <s.linev@gsi.de>
0089 \date 2020-04-02
0090 \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
0091 */
0092 
0093 class RIndirectDisplayItem : public RDisplayItem {
0094 protected:
0095 
0096    const RAttrMap *fAttr{nullptr};        ///< pointer on drawable attributes
0097    const std::string *fCssClass{nullptr}; ///< pointer on drawable class
0098    const std::string *fId{nullptr};       ///< pointer on drawable id
0099 
0100 public:
0101 
0102    RIndirectDisplayItem() = default;
0103 
0104    RIndirectDisplayItem(const RDrawable &dr);
0105 };
0106 
0107 } // namespace Experimental
0108 } // namespace ROOT
0109 
0110 #endif