Wiki

Clone wiki

VW DLibrary / 2016 / api / object_base

MODULE dlibrary.object_base

Used for all base stuff concerning objects, which are also resources, class definitions, etc....

CLASSES

builtins.object
........AbstractKeyedObject(builtins.object)
........ObjectRepository(builtins.object)
........ObjectTypeEnum(builtins.object)


class AbstractKeyedObject(builtins.object)

Base class for all objects, which will hold the identifiers for a VW object: handle and/or name.

__init__(self, handle_or_name)

:type handle_or_name: vs.Handle | str

handle GET :rtype: vs.Handle

name GET :rtype: str


class ObjectRepository(builtins.object)

Singleton to get our objects (wrappers) based on the handle or name, which are identifiers for VW. To work more easily with all objects in VW, we have specialized classes as kind of wrappers for the vs calls that can be done about the object. For easy retrieval, we have this factory, as we don't always know the type.

__init__(self)

get(self, handle_or_name)

Get a wrapper object, based on the handle or name, which identifies the object in VW.
If no constructor for the type is present, or the type can't be retrieved, None is returned.

:type handle_or_name: vs.Handle | str
:rtype: T <= AbstractKeyedObject

register(self, object_type: int, constructor)

Register an object constructor method, so it can be created and returned in the get method.
This is done in the __init__ file of dlibrary, so all types are registered when loaded by VW.

:type constructor: (vs.Handle | str) -> T <= AbstractKeyedObject


class ObjectTypeEnum(builtins.object)

Holds all object type constants in human readable/understandable names.

  • CLASS_DEFINITION = 94
  • GRADIENT_FILL_DEFINITION = 120
  • GROUP = 11
  • HATCH_FILL_DEFINITION = 66
  • IMAGE_FILL_DEFINITION = 119
  • LINE_STYLE_DEFINITION = 96
  • LOCUS = 17
  • NONE = 0
  • RECTANGLE = 3
  • SYMBOL = 15
  • SYMBOL_DEFINITION = 16
  • TILE_FILL_DEFINITION = 108

get(handle_or_name) -> int

Gets the object type based on the handle or name.
In VW, both are keys, but name isn't always provided. Also, some vs calls work with handles, others with names.

:type handle_or_name: vs.Handle | str
:returns: None if the handle or name doesn't references an actual object.

FILE

d:\development\vw libraries\dlibrary\dlibrary\object_base.py

Updated