~ubuntu-branches/ubuntu/saucy/python-demgengeo/saucy

« back to all changes in this revision

Viewing changes to Python/PolygonWithLines2DPy.cc

  • Committer: Package Import Robot
  • Author(s): Anton Gladky
  • Date: 2011-11-18 21:47:18 UTC
  • Revision ID: package-import@ubuntu.com-20111118214718-4ysqm3dhpqwdd7gd
Tags: upstream-0.99~bzr106
ImportĀ upstreamĀ versionĀ 0.99~bzr106

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/////////////////////////////////////////////////////////////
 
2
//                                                         //
 
3
// Copyright (c) 2007-2011 by The University of Queensland //
 
4
// Earth Systems Science Computational Centre (ESSCC)      //
 
5
// http://www.uq.edu.au/esscc                              //
 
6
//                                                         //
 
7
// Primary Business: Brisbane, Queensland, Australia       //
 
8
// Licensed under the Open Software License version 3.0    //
 
9
// http://www.opensource.org/licenses/osl-3.0.php          //
 
10
//                                                         //
 
11
/////////////////////////////////////////////////////////////
 
12
 
 
13
#include <boost/version.hpp>
 
14
#include "PolygonWithLines2DPy.h"
 
15
#include "PolygonWithLines2D.h"
 
16
 
 
17
using namespace boost::python;
 
18
 
 
19
    void exportPolygonWithLines2D()
 
20
    {
 
21
      // Check that Boost 1.34.0 or higher is being used.
 
22
      // If so, disable auto-generation of C++ signatures for Epydoc
 
23
      // (which stumbles over indentation in the auto-generated strings).
 
24
      #if ((BOOST_VERSION / 100000 >= 1) \
 
25
          && (BOOST_VERSION / 100 % 1000 >= 34)) \
 
26
          || (BOOST_VERSION / 100000 >= 2)
 
27
        boost::python::docstring_options no_autogen(true,false);
 
28
      #endif
 
29
 
 
30
      class_<PolygonWithLines2D, bases<AVolume2D> >(
 
31
        "PolygonWithLines2D",
 
32
        "A class defining a polygonal volume in 2D bounded by lines.",
 
33
        init<>()
 
34
      )
 
35
      .def(init<const PolygonWithLines2D &>())
 
36
      .def(
 
37
           init<boost::python::list>(
 
38
          ( arg("corners") ),
 
39
          "Constructs a polygon from either a list of vertices or a specified centre, radius and number of sides.\n"
 
40
          "@type corners: boost::python::list\n"
 
41
          "@kwarg corners: list of vertices.  Do not specify C{centre}, C{radius}, C{nsides} or C{smooth_edges} when using this parameter.\n"
 
42
          )
 
43
      )
 
44
      .def(
 
45
        init<Vector3,double,int,bool>(
 
46
          ( arg("centre"), arg("radius"), arg("nsides"), arg("smooth_edges") ),
 
47
          "@type centre: L{Vector3}\n"
 
48
          "@kwarg centre: Coordinates of the centre of the polygon.  Do not specify C{corners} when using this parameter.\n"
 
49
          "@type radius: double\n"
 
50
          "@kwarg radius: Radius of circle enclosing the polygon.  Do not specify C{corners} when using this parameter.\n"
 
51
          "@type nsides: int\n"
 
52
          "@kwarg nsides: Number of sides for the polygon (maximum of 50).  Do not specify C{corners} when using this parameter.\n"
 
53
          "@type smooth_edges: bool\n"
 
54
          "@kwarg smooth_edges: Adds bounding lines to edges to achieve smooth edges.  Do not specify C{corners} when using this parameter.\n"
 
55
        )
 
56
      )
 
57
      .def(
 
58
        "addLine",
 
59
        &PolygonWithLines2D::addLine,
 
60
        ( arg("line") ),
 
61
        "Adds a line to the polygon for fitting particles.\n"
 
62
        "@type line: L{Line2D}\n"
 
63
        "@kwarg line: the line to add to the polygon\n"
 
64
        "@rtype: void\n"
 
65
      )
 
66
      .def(self_ns::str(self))
 
67
      ;
 
68
//      boost::python::implicitly_convertible<PolygonWithLines2D, AVolume2D>();
 
69
    }
 
70
 
 
71
 
 
72