/usr/include/openturns/swig/Graph.i is in libopenturns-dev 1.9-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | // SWIG file Graph.i
%{
#include "openturns/Graph.hxx"
namespace OT {
template <>
struct traitsPythonType<OT::Graph>
{
typedef _PySequence_ Type;
};
template <>
inline
OT::Graph
convert<_PySequence_,OT::Graph>(PyObject * pyObj)
{
String title;
String xTitle;
String yTitle;
Bool showAxes;
String legendPosition;
Scalar legendFontSize = ResourceMap::GetAsScalar("Graph-DefaultLegendFontSize");
check<_PySequence_>( pyObj );
ScopedPyObjectPointer newPyObj(PySequence_Fast( pyObj, "" ));
switch (PySequence_Fast_GET_SIZE( newPyObj.get() )) {
case 6: { PyObject * item_5 = PySequence_Fast_GET_ITEM( newPyObj.get(), 5 );
check<_PyFloat_>( item_5 );
legendFontSize = convert<_PyFloat_,Scalar>( item_5 ); }
case 5: { PyObject * item_4 = PySequence_Fast_GET_ITEM( newPyObj.get(), 4 );
check<_PyString_>( item_4 );
legendPosition = convert<_PyString_,String>( item_4 ); }
case 4: { PyObject * item_0 = PySequence_Fast_GET_ITEM( newPyObj.get(), 0 );
check<_PyString_>( item_0 );
title = convert<_PyString_,String>( item_0 );
PyObject * item_1 = PySequence_Fast_GET_ITEM( newPyObj.get(), 1 );
check<_PyString_>( item_1 );
xTitle = convert<_PyString_,String>( item_1 );
PyObject * item_2 = PySequence_Fast_GET_ITEM( newPyObj.get(), 2 );
check<_PyString_>( item_2 );
yTitle = convert<_PyString_,String>( item_2 );
PyObject * item_3 = PySequence_Fast_GET_ITEM( newPyObj.get(), 3 );
check<_PyBool_>( item_3 );
showAxes = convert<_PyBool_,Bool>( item_3 ); }
break;
default:
throw InvalidArgumentException(HERE) << "Sequence passed as argument is not convertible to a Graph. Expected sequence (String, String, String, Bool, String, Scalar)";
}
return OT::Graph( title, xTitle, yTitle, showAxes, legendPosition, legendFontSize);
}
} /* namespace OT */
%}
%include Graph_doc.i
OTTypedInterfaceObjectHelper(Graph)
%template(GraphCollection) OT::Collection<OT::Graph>;
%include openturns/Graph.hxx
%pythoncode %{
def Graph__repr_svg_(self):
"""Get the SVG representation."""
from .viewer import ToSVGString
return ToSVGString(self)
Graph._repr_svg_ = Graph__repr_svg_
def Graph__repr_html_(self):
"""Get the HTML representation."""
raise NotImplementedError
Graph._repr_html_ = Graph__repr_html_
%}
namespace OT{
%extend Graph {
Graph(const Graph & other) { return new OT::Graph(*other.getImplementation()); }
Graph(PyObject * pyObj)
{
return new OT::Graph( OT::convert<OT::_PySequence_,OT::Graph>(pyObj) );
}
}
}
|