ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IVisualization.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file IVisualization.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
12 
13 #include <array>
14 #include <fstream>
15 #include <string>
16 #include <vector>
17 
18 namespace Acts {
19 
26  public:
30  using ColorType = std::array<int, 3>;
31 
33  using FaceType = std::vector<size_t>;
34 
39  virtual void vertex(const Vector3D& vtx,
40  ColorType color = {120, 120, 120}) = 0;
41 
48  virtual void face(const std::vector<Vector3D>& vtxs,
49  ColorType color = {120, 120, 120}) = 0;
50 
59  virtual void faces(const std::vector<Vector3D>& vtxs,
60  const std::vector<FaceType>& faces,
61  ColorType color = {120, 120, 120}) = 0;
62 
68  virtual void line(const Vector3D& a, const Vector3D& b,
69  ColorType color = {120, 120, 120}) = 0;
70 
73  virtual void write(std::ostream& os) const = 0;
74 
78  virtual void write(const std::string& path) const = 0;
79 
82  virtual void clear() = 0;
83 
88 
91  void vertex(const Vector3F& vtx, ColorType color = {120, 120, 120});
92 
95  void face(const std::vector<Vector3F>& vtxs,
96  ColorType color = {120, 120, 120});
97 
101  void line(const Vector3F& a, const Vector3F& b,
102  ColorType color = {120, 120, 120});
103 
104  protected:
110  bool hasExtension(const std::string& path) const;
111 
118  void replaceExtension(std::string& path, const std::string& suffix) const;
119 };
120 
124 inline std::ostream& operator<<(std::ostream& os, const IVisualization& hlp) {
125  hlp.write(os);
126  return os;
127 }
128 } // namespace Acts