v_sim.Surface

g GObject.GInterface GObject.GInterface v_sim.Boxed v_sim.Boxed GObject.GInterface->v_sim.Boxed GObject.Object GObject.Object v_sim.Surface v_sim.Surface GObject.Object->v_sim.Surface v_sim.Boxed->v_sim.Surface

Subclasses:

None

Methods

Inherited:

GObject.Object (37), v_sim.Boxed (2)

Structs:

GObject.ObjectClass (5)

class

createFromPotentialFile (surf_file_to_write, pot_file_to_read, nsurfs_to_build, surf_value, surf_name)

class

exportXMLFile (filename, values, res, n)

class

getErrorQuark ()

class

loadFile (file)

class

new (label, points, polys)

class

new_defaultFromScalarField (field)

class

new_fromDefinition (label, definition)

class

new_fromScalarField (field, isoValue, name)

class

parseXMLFile (filename, surfaces, field)

addPropertyFloat (name)

checkConsistency ()

getPropertyFloat (name)

getPropertyValueFloat (name, value)

getResource ()

iter_poly_new ()

setMask (mask)

setResource (res)

Virtual Methods

Inherited:

GObject.Object (7), v_sim.Boxed (1)

Properties

Inherited:

v_sim.Boxed (2)

Name

Type

Flags

Short Description

resource

v_sim.SurfaceResource

r/w

resource

Signals

Inherited:

GObject.Object (1), v_sim.Boxed (1)

Name

Short Description

masked

Gets emitted when a surface is shown or hidden by a plane.

Fields

Inherited:

GObject.Object (1), v_sim.Boxed (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class v_sim.Surface(**kwargs)
Bases:

GObject.Object, v_sim.Boxed

Abstract:

No

Structure:

v_sim.SurfaceClass

All fields are private, use the access routines.

classmethod createFromPotentialFile(surf_file_to_write, pot_file_to_read, nsurfs_to_build, surf_value, surf_name)
Parameters:
  • surf_file_to_write (str) – target surf file

  • pot_file_to_read (str) – source pot file

  • nsurfs_to_build (int) – number of surfaces to build

  • surf_value (float) – an array with iso-values

  • surf_name (str) – an array with iso-surface names.

Returns:

0 in case of success, n!=0 otherwise.

Return type:

int

Read the given pot file and produce an associated surf file. WARNING, it may be removed later.

Deprecated since version 3.7.

classmethod exportXMLFile(filename, values, res, n)
Parameters:
Raises:

GLib.Error

Returns:

False if a error occured.

Return type:

bool

Export the surface resources into an XML file.

classmethod getErrorQuark()
Returns:

the #GQuark associated to errors related to surface files.

Return type:

int

Internal routine for error handling.

classmethod loadFile(file)
Parameters:

file (str) – target file to load ;

Raises:

GLib.Error

Returns:

True in case of success, False otherwise. Even in case of success error may have been set.

surf:

a set of surfaces (location) ;

Return type:

(bool, surf: [v_sim.Surface])

This loads a surface file and set default material properties for it. See surf file specifications.

classmethod new(label, points, polys)
Parameters:
Returns:

a newly allocated v_sim.Surface structure.

Return type:

v_sim.Surface

Create a new v_sim.Surface object as defined by points and polys.

classmethod new_defaultFromScalarField(field)
Parameters:

field (v_sim.ScalarField) – a v_sim.ScalarField object.

Returns:

neg:

a v_sim.Surface location.

pos:

a v_sim.Surface location.

Return type:

(neg: v_sim.Surface, pos: v_sim.Surface)

Creates one or two surface from field. If field is mostly positive, one surface is generated at the mean value. If field has equivalent negative and positive values, two surfaces are generated, one for th mean negative value and one for the mean positive value.

New in version 3.8.

classmethod new_fromDefinition(label, definition)
Parameters:
Returns:

a newly allocated v_sim.Surface structure.

Return type:

v_sim.Surface

Same as v_sim.Surface.new(), mainly for language bindings.

New in version 3.8.

classmethod new_fromScalarField(field, isoValue, name)
Parameters:
  • field (v_sim.ScalarField) – the scalar field to create the surface from ;

  • isoValue (float) – the value of the isosurface ;

  • name (str or None) – the name of the surface to use (can be None).

Returns:

the newly created surface, if any.

Return type:

v_sim.Surface

Create on the fly a surface from the scalar field field. If name is given, the surface is created with it, if not, “Isosurface id + 1” is used. surf can already contains several surfaces, in that case, the new surface is added. If surf is None, then a new v_sim.Surface object is created and returned.

classmethod parseXMLFile(filename, surfaces, field)
Parameters:
Raises:

GLib.Error

Returns:

False if a error occured.

surfaces:

a location on a v_sim.Surface pointer.

Return type:

(bool, surfaces: [v_sim.Surface])

Parse the given XML file, looking for the <surfaces> tag and create the given surfaces.

addPropertyFloat(name)
Parameters:

name (str) – the name of the property to add.

Returns:

a newly allocated array that can be populated.

Return type:

float

Some properties can be associated to the surfaces stored in self. This method is add a new property.

checkConsistency()

Check if all arrays in the structures are consistent (without overflow).

getPropertyFloat(name)
Parameters:

name (str) – the name of the property to look for.

Returns:

a table with the values if the property is found, None otherwise.

Return type:

float

Some properties can be associated to the surfaces stored in self. This method is used to retrieve floating point values properties.

getPropertyValueFloat(name, value)
Parameters:
  • name (str) – the name of the property to get the value from ;

  • value (float) – a location to store the value.

Returns:

True if a value is indeed found.

Return type:

bool

This method retrieves a float value stored as a property called name for the surface defined by its number idSurf.

getResource()
Returns:

the resource of the surface or None, if i is invalid.

Return type:

v_sim.SurfaceResource

This returns the resource of the self.

New in version 3.7.

iter_poly_new()
Returns:

a v_sim.SurfaceIterPoly structure.

Return type:

iter: v_sim.SurfaceIterPoly

Setup a new iter to iterate on drawn polygons of self.

New in version 3.8.

setMask(mask)
Parameters:

mask (v_sim.PlaneSet or None) – a v_sim.PlaneSet object.

Returns:

True if mask is changed.

Return type:

bool

Use mask to hide portion of self (when maskable, depending on their resources). Set mask to None to remove the mask.

New in version 3.8.

setResource(res)
Parameters:

res (v_sim.SurfaceResource) – the new resource.

Returns:

True if the resource is changed.

Return type:

bool

This method is used to change the resource of a surface.

Signal Details

v_sim.Surface.signals.masked(surface)
Signal Name:

masked

Flags:

RUN_LAST, NO_RECURSE, NO_HOOKS

Parameters:

surface (v_sim.Surface) – The object which received the signal

Gets emitted when a surface is shown or hidden by a plane.

New in version 3.7.

Property Details

v_sim.Surface.props.resource
Name:

resource

Type:

v_sim.SurfaceResource

Default Value:

None

Flags:

READABLE, WRITABLE

resource