EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IVisualization3D.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file IVisualization3D.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 
13 
14 #include <array>
15 #include <fstream>
16 #include <string>
17 #include <vector>
18 
19 namespace Acts {
20 
25  public:
26  using FaceType = std::vector<size_t>;
27 
32  virtual void vertex(const Vector3D& vtx,
33  ColorRGB color = {120, 120, 120}) = 0;
34 
41  virtual void face(const std::vector<Vector3D>& vtxs,
42  ColorRGB color = {120, 120, 120}) = 0;
43 
52  virtual void faces(const std::vector<Vector3D>& vtxs,
53  const std::vector<FaceType>& faces,
54  ColorRGB color = {120, 120, 120}) = 0;
55 
61  virtual void line(const Vector3D& a, const Vector3D& b,
62  ColorRGB color = {120, 120, 120}) = 0;
63 
66  virtual void write(std::ostream& os) const = 0;
67 
71  virtual void write(const std::string& path) const = 0;
72 
75  virtual void clear() = 0;
76 
81 
84  void vertex(const Vector3F& vtx, ColorRGB color = {120, 120, 120});
85 
88  void face(const std::vector<Vector3F>& vtxs,
89  ColorRGB color = {120, 120, 120});
90 
94  void line(const Vector3F& a, const Vector3F& b,
95  ColorRGB color = {120, 120, 120});
96 
97  protected:
103  bool hasExtension(const std::string& path) const;
104 
111  void replaceExtension(std::string& path, const std::string& suffix) const;
112 };
113 
117 inline std::ostream& operator<<(std::ostream& os, const IVisualization3D& hlp) {
118  hlp.write(os);
119  return os;
120 }
121 } // namespace Acts