ATLAS Offline Software
Loading...
Searching...
No Matches
VP1String.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7// //
8// Implementation of class VP1String //
9// //
10// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11// Initial version: March 2008 //
12// //
14
15#include "VP1Base/VP1String.h"
17#include "VP1Base/VP1Interval.h"
18#include <QColor>
19#include <Inventor/SbVec2d.h>
20#include <Inventor/SbVec2f.h>
21#include <Inventor/SbVec2s.h>
22#include <Inventor/SbVec3d.h>
23#include <Inventor/SbVec3f.h>
24#include <Inventor/SbVec3s.h>
25#include <Inventor/SbVec4d.h>
26#include <Inventor/SbVec4f.h>
27#include <sstream>
28
29//____________________________________________________________________
30QString VP1String::str( const QColor& c )
31{
32 return c.isValid() ? c.name() : "Invalid";
33}
34
35//____________________________________________________________________
36QString VP1String::str( const SbColor& c )
37{
39}
40
41//____________________________________________________________________
42QString VP1String::str( const VP1Interval& i )
43{
44 return i.toString();
45}
46
47//____________________________________________________________________
48QString VP1String::str(const void * p)
49{
50 if (p) {
51 std::ostringstream s;
52 s << p;
53 // Explicitly naming QString here avoids a cppcheck warning.
54 return QString (s.str().c_str());
55 } else {
56 return "NULL";
57 }
58}
59
60//____________________________________________________________________
61QString VP1String::str( const SbVec2d& v ) { double x,y; v.getValue(x,y); return "("+str(x)+", "+str(y)+")"; }
62QString VP1String::str( const SbVec2f& v ) { float x,y; v.getValue(x,y); return "("+str(x)+", "+str(y)+")"; }
63QString VP1String::str( const SbVec2s& v ) { short x,y; v.getValue(x,y); return "("+str(x)+", "+str(y)+")"; }
64QString VP1String::str( const SbVec3d& v ) { double x,y,z; v.getValue(x,y,z); return "("+str(x)+", "+str(y)+", "+str(z)+")"; }
65QString VP1String::str( const SbVec3f& v ) { float x,y,z; v.getValue(x,y,z); return "("+str(x)+", "+str(y)+", "+str(z)+")"; }
66QString VP1String::str( const SbVec3s& v ) { short x,y,z; v.getValue(x,y,z); return "("+str(x)+", "+str(y)+", "+str(z)+")"; }
67QString VP1String::str( const SbVec4d& v ) { double x,y,z,t; v.getValue(x,y,z,t); return "("+str(x)+", "+str(y)+", "+str(z)+", "+str(t)+")"; }
68QString VP1String::str( const SbVec4f& v ) { float x,y,z,t; v.getValue(x,y,z,t); return "("+str(x)+", "+str(y)+", "+str(z)+", "+str(t)+")"; }
#define y
#define x
#define z
static QColor sbcol2qcol(const SbColor &)
static QString str(const QString &s)
Definition VP1String.h:49