primitiveHandlers

PrimitiveHandler

class ORSServiceClass.primitiveHandlers.primitivehandler.PrimitiveHandler(instance)

Bases: ORSServiceClass.ORSControllerAndHandler.ORSMouseHandlerAbstract.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: ORSModel.ors.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
deletePrimitive()
getAssociatedPrimitive()

Gets the class of the annotation manipulated by the handler

Return:an Annotation subclass
Rtype:ORSModel.ors.Annotation class
getControlPointAtActivation(index)
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() → ORSModel.ors.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() → ORSModel.ors.View

Gets the view under cursor when the activation is started

Return:view under cursor at activation
Rtype:ORSModel.ors.View
handleNames = []
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
isCompleted()
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()

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
setCreationOrientedPlane(primitive, aView)
setPrimitive(primitive)

Sets the annotation manipulated by the handler

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

AngleHandler

class ORSServiceClass.primitiveHandlers.angleHandler.AngleHandler(instance)

Bases: ORSServiceClass.primitiveHandlers.primitivehandler.PrimitiveHandler

createMode(eventData)
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
handleNames = ['OrsStateAngle', 'OrsStateAngleEdit']
incrementPointSet()
isCompleted()
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
otherPoint(eventData)
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: ORSServiceClass.primitiveHandlers.rectangularHandler.RectangleHandler

dotFromConstraint(dir0, dir1, direction)
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
getRegionShape()
handleNames = ['OrsStateCircle', 'OrsStateCircleEdit']

EllipseHandler

class ORSServiceClass.primitiveHandlers.ellipseHandler.EllipseHandler(instance)

Bases: ORSServiceClass.primitiveHandlers.rectangularHandler.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
getRegionShape()
handleNames = ['OrsStateRegionEllipse', 'OrsStateRegionEllipseEdit']

FreeHandHandler

class ORSServiceClass.primitiveHandlers.freeHandHandler.FreeHandHandler(instance)

Bases: ORSServiceClass.primitiveHandlers.regionhandler.RegionHandler

createMode(eventData)
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
getRegionShape()
handleNames = ['OrsStateRegionFreehand', 'OrsStateRegionFreehandEdit']
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
secondPointMove(eventData)

PathHandler

class ORSServiceClass.primitiveHandlers.pathHandler.PathHandler(instance)

Bases: ORSServiceClass.primitiveHandlers.primitivehandler.PrimitiveHandler

createMode(eventData)
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
getPrimitiveEditAddHandler()
getPrimitiveEditHandler()

Gets the edition state of the annotation manipulated by the handler

Return:name of the state in which the edition occurs
Rtype:str
handleNames = ['OrsStatePath', 'OrsStatePathEdit', 'OrsStatePathEditAdd']
nthPoint(eventData)
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.

secondPointMove(eventData)

PointHandler

class ORSServiceClass.primitiveHandlers.pointHandler.PointHandler(instance)

Bases: ORSServiceClass.primitiveHandlers.primitivehandler.PrimitiveHandler

createMode(eventData)
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
handleNames = ['OrsStatePointsEdit', 'OrsStatePoints']
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
otherPoint(eventData)
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: ORSServiceClass.primitiveHandlers.regionhandler.RegionHandler

addOtherPoint(eventData)
createMode(eventData)
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
getRegionShape()
handleNames = ['OrsStateRegionPolygonal', 'OrsStateRegionPolygonalEdit']
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: ORSServiceClass.primitiveHandlers.regionhandler.RegionHandler

createMode(eventData)
dotFromConstraint(dir0, dir1, direction)
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
getRegionShape()
handleNames = ['OrsStateRegionRectangle', 'OrsStateRegionRectangleEdit']
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

secondPointMove(eventData)
shouldBePublish(primitive)

RulerConstraintHandler

class ORSServiceClass.primitiveHandlers.rulerConstraintHandler.RulerConstraintHandler(instance)

Bases: ORSServiceClass.primitiveHandlers.rulerhandler.RulerHandler

handleNames = []
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

secondPointMove(eventData)

RulerHandler

class ORSServiceClass.primitiveHandlers.rulerhandler.RulerHandler(instance)

Bases: ORSServiceClass.primitiveHandlers.primitivehandler.PrimitiveHandler

createMode(eventData)
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
handleNames = ['OrsStateRulerEdit', 'OrsStateRuler']
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
secondPointMove(eventData)
shouldBePublish(primitive)

RulerHorizontalHandler

class ORSServiceClass.primitiveHandlers.rulerHorizontalHandler.RulerHorizontalHandler(instance)

Bases: ORSServiceClass.primitiveHandlers.rulerConstraintHandler.RulerConstraintHandler

getConstraintFromDisplay(display)
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
handleNames = ['OrsStateRulerHorizontalEdit', 'OrsStateRulerHorizontal']

RulerVerticalHandler

class ORSServiceClass.primitiveHandlers.rulerVerticalHandler.RulerVerticalHandler(instance)

Bases: ORSServiceClass.primitiveHandlers.rulerConstraintHandler.RulerConstraintHandler

getConstraintFromDisplay(display)
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
handleNames = ['OrsStateRulerVerticalEdit', 'OrsStateRulerVertical']

SplitAngleHandler

class ORSServiceClass.primitiveHandlers.splitAngleHandler.SplitAngleHandler(instance)

Bases: ORSServiceClass.primitiveHandlers.angleHandler.AngleHandler

createMode(eventData)
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
handleNames = ['OrsStateAngleSplit', 'OrsStateAngleSplitEdit']
otherPoint(eventData)

SquareHandler

class ORSServiceClass.primitiveHandlers.squareHandler.SquareHandler(instance)

Bases: ORSServiceClass.primitiveHandlers.rectangularHandler.RectangleHandler

dotFromConstraint(dir0, dir1, direction)
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
handleNames = ['OrsStateSquare', 'OrsStateSquareEdit']