primitiveHandlers

PrimitiveHandler

class ORSServiceClass.primitiveHandlers.primitivehandler.PrimitiveHandler(instance)

Bases: ORSMouseHandlerAbstract

_createPrimitive(aLayoutName, display)

Instantiates the annotation.

This method (unless overloaded) calls on the plugin implementation method createPrimitive.

Parameters:
  • aLayoutName (str) – a layout genealogical name

  • display (ORSModel.ors.View) – the view in which the annotation is created

Return:

the created annotation

Rtype:

ORSModel.ors.Annotation

addControlPoint(timestep, position, orientedPlane=None)

Adds a control point of the annotation manipulated by the handler.

This method (unless overloaded) calls on the plugin implementation method addControlPoint.

Parameters:
  • timestep (int) – time index

  • position (ORSModel.ors.Vector3) – position vector of the control point

  • orientedPlane

createPrimitive(display: View)

Creates the annotation manipulated by the handler.

The actual instantiation of the annotation is made by the call to _createPrimitive.

Parameters:

display (ORSModel.ors.View) – the view in which the annotation is created

Return:

None

getAssociatedPrimitive()

Gets the class of the annotation manipulated by the handler

Return:

an Annotation subclass

Rtype:

ORSModel.ors.Annotation class

getIsInPrimitiveCreateHandler()

Gets if the current application state is a creation state of the annotation for the handler

Return:

True if the current state is one of those declared as a creation state; False otherwise.

Rtype:

bool

getIsRepresentableAtCreation()

Gets if the annotation should be set as representable after being instantiated

Return:

True if it should be set as representable; False otherwise.

Rtype:

bool

getIsRepresentableAtReset()

Gets if the annotation should be set as representable before the call to publish

Return:

True if it should be set as representable; False otherwise.

Rtype:

bool

getMinimumControlPointCount()

Gets the minimal count of control points for the annotation manipulated by the handler to be valid

Return:

minimal count of control points

Rtype:

int

getPrimitive() Annotation

Gets the annotation manipulated by the handler

Return:

the annotation of the handler, or None if the annotation is not yet created

Rtype:

ORSModel.ors.Annotation

getPrimitiveCreateHandler()

Gets all the states in which the annotation is created by the handler

Return:

list of states

Rtype:

list of str

getPrimitiveEditHandler()

Gets the edition state of the annotation manipulated by the handler

Return:

name of the state in which the edition occurs

Rtype:

str

getSelectedOrHighlightedAnnotationUnderCursor(view, eventData)

Gets the selected annotations and/or highlighted annotation under the cursor in the specified view

Parameters:
Return:

list of selected annotations

Rtype:

list of ORSModel.ors.Annotation

getViewAtActivation() View

Gets the view under cursor when the activation is started

Return:

view under cursor at activation

Rtype:

ORSModel.ors.View

insertControlPoint(index, timestep, position, orientedPlane=None)

Inserts a control point in the annotation manipulated by the handler.

This method (unless overloaded) calls on the plugin implementation method insertControlPoint.

Parameters:
  • index (int) – index of the control point to insert in the annotation

  • timestep (int) – time index of the annotation

  • position (ORSModel.ors.Vector3) – position vector of the control point

  • orientedPlane

isPrepared()

Method called at the beginning of ORSServiceClass.ORSControllerAndHandler.ORSHandlerAbstract.ORSHandlerAbstract.process() to know if the method ORSServiceClass.ORSControllerAndHandler.ORSHandlerAbstract.ORSHandlerAbstract.prepare() should be called.

Overloading the subclass requires to call first the super class method, as:

if not super().isPrepared():
    return False
Return:

True if the preparation has been done with success; False otherwise.

needReset()

Gets if the method reset should be called at the exitAction stage.

Return:

True if the method reset should be called; False otherwise.

Rtype:

bool

prepare(eventData)

Method called when the handler should gather the initial information required for his processing (for example, at mouse button press).

Overloading the subclass requires to call first the super class method, as:

if not super().prepare(eventData):
    return False
Parameters:

eventData (OrsEvent.eventdata.InputEventData) – event data

Return:

True if the preparation is complete and the handler is ready to process.

process(eventData)

Gets to know if the current state is set to edit the annotation.

In the overload of this method, the annotation should be instantiated if it was not done yet. A call to the method processMouseMove could be done when editing the annotation.

Parameters:

eventData (OrsEvent.eventdata.InputEventData) – event data

Return:

True if the task has been completed with success; False otherwise.

Rtype:

bool

processMouseMove(eventData, constraintVectorForControlPoint=None, constraintVectorForPrimitive=None)

Moves the selected annotation or some of his control points

Parameters:
Return:

True if the task has been completed with success; False otherwise.

Rtype:

bool

processMouseMove2D(eventData, constraintVectorForControlPoint=None, constraintVectorForPrimitive=None)

Moves the selected annotation or some of his control points

Parameters:
Return:

True if the task has been completed with success; False otherwise.

Rtype:

bool

processMouseMove3D(eventData, constraintVectorForControlPoint=None, constraintVectorForPrimitive=None)

Moves the selected annotation or some of his control points

Parameters:
Return:

True if the task has been completed with success; False otherwise.

Rtype:

bool

publish()

Publishes the annotation manipulated by the handler

reset(logging=True)

Ends the manipulation of the annotation manipulated by the handler and cleans the handler data.

If the annotation object is valid (the count of control points is sufficient):

  • calls on setControlPointPositionInImplementation;

  • sets the annotation representable value obtained from getIsRepresentableAtReset;

  • calls on the handler publish;

  • raises the data dirty flag of the annotation;

If the annotation object is not valid, the annotation object is deleted.

setControlPointPositionInImplementation(primitiveGuid, index, position)

Sets a control point position of an annotation.

This method (unless overloaded) calls on the plugin implementation method setControlPointPosition.

Parameters:
  • primitiveGuid (str) – GUID of the annotation

  • index (int) – index of the control point of the annotation

  • position (ORSModel.ors.Vector3) – position vector of the control point

setPositionOfFloatingCaptionForView(aView, anAnnotation, position)

Sets the position of of the floating caption This method (unless overloaded) calls on the plugin implementation method setPositionOfFloatingCaptionForView.

Parameters:
Returns:

success (bool) – True if successful, False otherwise

setPrimitive(primitive)

Sets the annotation manipulated by the handler

Parameters:

primitive (ORSModel.ors.Annotation) – the annotation of the handler, or None.

AngleHandler

class ORSServiceClass.primitiveHandlers.angleHandler.AngleHandler(instance)

Bases: PrimitiveHandler

getAssociatedPrimitive()

Gets the class of the annotation manipulated by the handler

Return:

an Annotation subclass

Rtype:

ORSModel.ors.Annotation class

getMinimumControlPointCount()

Gets the minimal count of control points for the annotation manipulated by the handler to be valid

Return:

minimal count of control points

Rtype:

int

getPrimitiveCreateHandler()

Gets all the states in which the annotation is created by the handler

Return:

list of states

Rtype:

list of str

getPrimitiveEditHandler()

Gets the edition state of the annotation manipulated by the handler

Return:

name of the state in which the edition occurs

Rtype:

str

needReset()

Gets if the method reset should be called at the exitAction stage.

Return:

True if the method reset should be called; False otherwise.

Rtype:

bool

process(eventData)

Gets to know if the current state is set to edit the annotation.

In the overload of this method, the annotation should be instantiated if it was not done yet. A call to the method processMouseMove could be done when editing the annotation.

Parameters:

eventData (OrsEvent.eventdata.InputEventData) – event data

Return:

True if the task has been completed with success; False otherwise.

Rtype:

bool

reset()

Ends the manipulation of the annotation manipulated by the handler and cleans the handler data.

If the annotation object is valid (the count of control points is sufficient):

  • calls on setControlPointPositionInImplementation;

  • sets the annotation representable value obtained from getIsRepresentableAtReset;

  • calls on the handler publish;

  • raises the data dirty flag of the annotation;

If the annotation object is not valid, the annotation object is deleted.

CircleHandler

class ORSServiceClass.primitiveHandlers.circleHandler.CircleHandler(instance)

Bases: RectangleHandler

getMinimumControlPointCount()

Gets the minimal count of control points for the annotation manipulated by the handler to be valid

Return:

minimal count of control points

Rtype:

int

getPrimitiveCreateHandler()

Gets all the states in which the annotation is created by the handler

Return:

list of states

Rtype:

list of str

getPrimitiveEditHandler()

Gets the edition state of the annotation manipulated by the handler

Return:

name of the state in which the edition occurs

Rtype:

str

EllipseHandler

class ORSServiceClass.primitiveHandlers.ellipseHandler.EllipseHandler(instance)

Bases: RectangleHandler

getMinimumControlPointCount()

Gets the minimal count of control points for the annotation manipulated by the handler to be valid

Return:

minimal count of control points

Rtype:

int

getPrimitiveCreateHandler()

Gets all the states in which the annotation is created by the handler

Return:

list of states

Rtype:

list of str

getPrimitiveEditHandler()

Gets the edition state of the annotation manipulated by the handler

Return:

name of the state in which the edition occurs

Rtype:

str

FreeHandHandler

class ORSServiceClass.primitiveHandlers.freeHandHandler.FreeHandHandler(instance)

Bases: RegionHandler

getAssociatedPrimitive()

Gets the class of the annotation manipulated by the handler

Return:

an Annotation subclass

Rtype:

ORSModel.ors.Annotation class

getMinimumControlPointCount()

Gets the minimal count of control points for the annotation manipulated by the handler to be valid

Return:

minimal count of control points

Rtype:

int

getPrimitiveCreateHandler()

Gets all the states in which the annotation is created by the handler

Return:

list of states

Rtype:

list of str

getPrimitiveEditHandler()

Gets the edition state of the annotation manipulated by the handler

Return:

name of the state in which the edition occurs

Rtype:

str

process(eventData)

Gets to know if the current state is set to edit the annotation.

In the overload of this method, the annotation should be instantiated if it was not done yet. A call to the method processMouseMove could be done when editing the annotation.

Parameters:

eventData (OrsEvent.eventdata.InputEventData) – event data

Return:

True if the task has been completed with success; False otherwise.

Rtype:

bool

PathHandler

class ORSServiceClass.primitiveHandlers.pathHandler.PathHandler(instance)

Bases: PrimitiveHandler

getAssociatedPrimitive()

Gets the class of the annotation manipulated by the handler

Return:

an Annotation subclass

Rtype:

ORSModel.ors.Annotation class

getMinimumControlPointCount()

Gets the minimal count of control points for the annotation manipulated by the handler to be valid

Return:

minimal count of control points

Rtype:

int

getPrimitiveCreateHandler()

Gets all the states in which the annotation is created by the handler

Return:

list of states

Rtype:

list of str

getPrimitiveEditHandler()

Gets the edition state of the annotation manipulated by the handler

Return:

name of the state in which the edition occurs

Rtype:

str

process(eventData)

Gets to know if the current state is set to edit the annotation.

In the overload of this method, the annotation should be instantiated if it was not done yet. A call to the method processMouseMove could be done when editing the annotation.

Parameters:

eventData (OrsEvent.eventdata.InputEventData) – event data

Return:

True if the task has been completed with success; False otherwise.

Rtype:

bool

processMouseMove(eventData, constraintVectorForControlPoint=None, constraintVectorForPrimitive=None)

Moves the selected annotation or some of his control points

Parameters:
Return:

True if the task has been completed with success; False otherwise.

Rtype:

bool

publish()

The “publish” method is overloaded to add extra logging commands.

PointHandler

class ORSServiceClass.primitiveHandlers.pointHandler.PointHandler(instance)

Bases: PrimitiveHandler

getAssociatedPrimitive()

Gets the class of the annotation manipulated by the handler

Return:

an Annotation subclass

Rtype:

ORSModel.ors.Annotation class

getIsRepresentableAtCreation()

Gets if the annotation should be set as representable after being instantiated

Return:

True if it should be set as representable; False otherwise.

Rtype:

bool

getMinimumControlPointCount()

Gets the minimal count of control points for the annotation manipulated by the handler to be valid

Return:

minimal count of control points

Rtype:

int

getPrimitiveCreateHandler()

Gets all the states in which the annotation is created by the handler

Return:

list of states

Rtype:

list of str

getPrimitiveEditHandler()

Gets the edition state of the annotation manipulated by the handler

Return:

name of the state in which the edition occurs

Rtype:

str

needReset()

Gets if the method reset should be called at the exitAction stage.

Return:

True if the method reset should be called; False otherwise.

Rtype:

bool

process(eventData)

Gets to know if the current state is set to edit the annotation.

In the overload of this method, the annotation should be instantiated if it was not done yet. A call to the method processMouseMove could be done when editing the annotation.

Parameters:

eventData (OrsEvent.eventdata.InputEventData) – event data

Return:

True if the task has been completed with success; False otherwise.

Rtype:

bool

reset()

Ends the manipulation of the annotation manipulated by the handler and cleans the handler data.

If the annotation object is valid (the count of control points is sufficient):

  • calls on setControlPointPositionInImplementation;

  • sets the annotation representable value obtained from getIsRepresentableAtReset;

  • calls on the handler publish;

  • raises the data dirty flag of the annotation;

If the annotation object is not valid, the annotation object is deleted.

PolyHandler

class ORSServiceClass.primitiveHandlers.polyHandler.PolyHandler(instance)

Bases: RegionHandler

getAssociatedPrimitive()

Gets the class of the annotation manipulated by the handler

Return:

an Annotation subclass

Rtype:

ORSModel.ors.Annotation class

getIsRepresentableAtCreation()

Gets if the annotation should be set as representable after being instantiated

Return:

True if it should be set as representable; False otherwise.

Rtype:

bool

getMinimumControlPointCount()

Gets the minimal count of control points for the annotation manipulated by the handler to be valid

Return:

minimal count of control points

Rtype:

int

getPrimitiveCreateHandler()

Gets all the states in which the annotation is created by the handler

Return:

list of states

Rtype:

list of str

getPrimitiveEditHandler()

Gets the edition state of the annotation manipulated by the handler

Return:

name of the state in which the edition occurs

Rtype:

str

needReset()

Gets if the method reset should be called at the exitAction stage.

Return:

True if the method reset should be called; False otherwise.

Rtype:

bool

process(eventData)

Gets to know if the current state is set to edit the annotation.

In the overload of this method, the annotation should be instantiated if it was not done yet. A call to the method processMouseMove could be done when editing the annotation.

Parameters:

eventData (OrsEvent.eventdata.InputEventData) – event data

Return:

True if the task has been completed with success; False otherwise.

Rtype:

bool

RectangleHandler

class ORSServiceClass.primitiveHandlers.rectangularHandler.RectangleHandler(instance)

Bases: RegionHandler

getAssociatedPrimitive()

Gets the class of the annotation manipulated by the handler

Return:

an Annotation subclass

Rtype:

ORSModel.ors.Annotation class

getMinimumControlPointCount()

Gets the minimal count of control points for the annotation manipulated by the handler to be valid

Return:

minimal count of control points

Rtype:

int

getPrimitiveCreateHandler()

Gets all the states in which the annotation is created by the handler

Return:

list of states

Rtype:

list of str

getPrimitiveEditHandler()

Gets the edition state of the annotation manipulated by the handler

Return:

name of the state in which the edition occurs

Rtype:

str

process(eventData)

Gets to know if the current state is set to edit the annotation.

In the overload of this method, the annotation should be instantiated if it was not done yet. A call to the method processMouseMove could be done when editing the annotation.

Parameters:

eventData (OrsEvent.eventdata.InputEventData) – event data

Return:

True if the task has been completed with success; False otherwise.

Rtype:

bool

processMouseMove(eventData)

Moves the selected annotation or some of his control points

Parameters:
Return:

True if the task has been completed with success; False otherwise.

Rtype:

bool

RulerConstraintHandler

class ORSServiceClass.primitiveHandlers.rulerConstraintHandler.RulerConstraintHandler(instance)

Bases: RulerHandler

processMouseMove(eventData, constraintVectorForControlPoint=None, constraintVectorForPrimitive=None)

Moves the selected annotation or some of his control points

Parameters:
Return:

True if the task has been completed with success; False otherwise.

Rtype:

bool

RulerHandler

class ORSServiceClass.primitiveHandlers.rulerhandler.RulerHandler(instance)

Bases: PrimitiveHandler

getAssociatedPrimitive()

Gets the class of the annotation manipulated by the handler

Return:

an Annotation subclass

Rtype:

ORSModel.ors.Annotation class

getMinimumControlPointCount()

Gets the minimal count of control points for the annotation manipulated by the handler to be valid

Return:

minimal count of control points

Rtype:

int

getPrimitiveCreateHandler()

Gets all the states in which the annotation is created by the handler

Return:

list of states

Rtype:

list of str

getPrimitiveEditHandler()

Gets the edition state of the annotation manipulated by the handler

Return:

name of the state in which the edition occurs

Rtype:

str

process(eventData)

Gets to know if the current state is set to edit the annotation.

In the overload of this method, the annotation should be instantiated if it was not done yet. A call to the method processMouseMove could be done when editing the annotation.

Parameters:

eventData (OrsEvent.eventdata.InputEventData) – event data

Return:

True if the task has been completed with success; False otherwise.

Rtype:

bool

RulerHorizontalHandler

class ORSServiceClass.primitiveHandlers.rulerHorizontalHandler.RulerHorizontalHandler(instance)

Bases: RulerConstraintHandler

getPrimitiveCreateHandler()

Gets all the states in which the annotation is created by the handler

Return:

list of states

Rtype:

list of str

getPrimitiveEditHandler()

Gets the edition state of the annotation manipulated by the handler

Return:

name of the state in which the edition occurs

Rtype:

str

RulerVerticalHandler

class ORSServiceClass.primitiveHandlers.rulerVerticalHandler.RulerVerticalHandler(instance)

Bases: RulerConstraintHandler

getPrimitiveCreateHandler()

Gets all the states in which the annotation is created by the handler

Return:

list of states

Rtype:

list of str

getPrimitiveEditHandler()

Gets the edition state of the annotation manipulated by the handler

Return:

name of the state in which the edition occurs

Rtype:

str

SplitAngleHandler

class ORSServiceClass.primitiveHandlers.splitAngleHandler.SplitAngleHandler(instance)

Bases: AngleHandler

getPrimitiveCreateHandler()

Gets all the states in which the annotation is created by the handler

Return:

list of states

Rtype:

list of str

getPrimitiveEditHandler()

Gets the edition state of the annotation manipulated by the handler

Return:

name of the state in which the edition occurs

Rtype:

str

SquareHandler

class ORSServiceClass.primitiveHandlers.squareHandler.SquareHandler(instance)

Bases: RectangleHandler

getPrimitiveCreateHandler()

Gets all the states in which the annotation is created by the handler

Return:

list of states

Rtype:

list of str

getPrimitiveEditHandler()

Gets the edition state of the annotation manipulated by the handler

Return:

name of the state in which the edition occurs

Rtype:

str