DiagramItem

open class DiagramItem : NSObject

Represents an item in the diagram.

  • Initializes a new instance of the DiagramItem class with default values to all properties.

    Declaration

    Swift

    public override init()
  • Draws this DiagramItem at the specified canvas with the specified render options.

    Declaration

    Swift

    open func draw(_ canvas: Canvas, options: RenderOptions)

    Parameters

    canvas

    The canvas onto which the item is drawn.

    options

    The RenderOptions for drawing the diagram item.

  • Draws the shadow of this DiagramItem at the specified canvas with the specified render options.

    Declaration

    Swift

    open func drawShadow(_ canvas: Canvas, options: RenderOptions)

    Parameters

    canvas

    The canvas onto which the item is drawn.

    options

    The RenderOptions for drawing the diagram item.

  • Draws the handles of this DiagramItem at the specified canvas with the specified render options.

    Declaration

    Swift

    open func drawHandles(_ canvas: Canvas)

    Parameters

    canvas

    The canvas onto which the item is drawn.

    options

    The RenderOptions for drawing the diagram item.

  • Draws the Manipulators of this DiagramItem at the specified canvas with the specified render options.

    Declaration

    Swift

    open func drawManipulators(_ canvas: Canvas)

    Parameters

    canvas

    The canvas onto which the item is drawn.

    options

    The RenderOptions for drawing the diagram item.

  • Tests if the specified point is within any of the Manipulators of this DiagramItem.

    Declaration

    Swift

    open func hitTestManipulators(_ point: Point) -> Manipulator?

    Parameters

    point

    The Point to test.

    Return Value

    The Manipulator which contains the tested point or nil if none is found.

  • Create state storage for the diagram item.

    Declaration

    Swift

    open func createState() -> DiagramItemState
  • Saves the state of the diagram item.

    Declaration

    Swift

    open func saveState() -> DiagramItemState
  • Restores the state of the diagram item.

    Declaration

    Swift

    open func restoreState(_ state: DiagramItemState)
  • Loads this diagram item from the specified XML context and element.

    Declaration

    Swift

    open func loadFromXml(_ element: XmlElement, context: XmlContext)

    Parameters

    element

    The XmlElement, which contains this diagram item.

    context

    The XmlContext, which contains this diagram item.

  • Saves this diagram item into the specified XML context and element.

    Declaration

    Swift

    open func saveToXml(_ element: XmlElement, context: XmlContext)

    Parameters

    element

    The XmlElement, where the diagram item will be saved.

    context

    The XmlContext, where the diagram item will be saved.

  • Finds the Style that defines an appearance property’s value.

    Declaration

    Swift

    open func resolveEffectiveStyle(_ check: StyleCheck) -> Style?

    Parameters

    check

    A StyleCheck predicate that verifies if property is set.

    Return Value

    The Style if resolved, or nil otherwise.

  • Looks for a Style that defines an appearance property’s value in specified Theme.

    Declaration

    Swift

    open func resolveInheritedStyle(_ check: StyleCheck, theme: Theme?) -> Style?

    Parameters

    check

    A StyleCheck predicate that verifies if property is set.

    Return Value

    The Style if resolved, or nil otherwise.

  • Checks if this diagram item contains the specified point.

    Declaration

    Swift

    open func containsPoint(_ point: Point) -> Bool

    Parameters

    point

    The Point to check.

    Return Value

    true if the Point is within this diagram item; otherwise false.

  • Checks if this diagram item contains the specified point within the specified offset.

    Declaration

    Swift

    open func containsPoint(_ point: Point, threshold: Double) -> Bool

    Parameters

    point

    The Point to check.

    threshold

    The offset, within which a Point outside the diagram item would still be
    considered within the item’s bounds.

    Return Value

    true if the Point is within this diagram item; otherwise false.

  • Tests if the specified Point is within this diagram item that is checked by the specified lambda expression.

    Declaration

    Swift

    open func hitTest(_ point: Point, filter: (DiagramItem) -> Bool) -> DiagramItem?

    Parameters

    point

    The Point to check.

    filter

    A lambda expression that checks the diagram item.

    Return Value

    The diagram item that contains the point or nil.

  • Checks if the specified point is within any of the adjusment handles for the diagram item.

    Declaration

    Swift

    open func hitTestHandle(_ point: Point) -> AdjustmentHandle?

    Parameters

    point

    The Point to check.

    Return Value

    The AdjustmentHandle that contains the specified point or nil if none is found.

  • Checks if the specified point is within the bounds of this diagram item and answers the specified criteria.

    Declaration

    Swift

    open func hitTest (_ point: Point, threshold: Double, onlyNodes: Bool, onlyInteractive: Bool)
        -> DiagramItem?

    Parameters

    point

    The Point to check.

    threshold

    The offset, within which a Point outside the diagram item would still be considered within the item’s bounds.

    onlyNodes

    true if only nodes are checked.

    onlyInteractive

    true if only items with which the user can interact are checked.

    Return Value

    The DiagramItem, which contains the specified point or nil if none is found.

  • Gets the id for the class.

    Declaration

    Swift

    open func getClassId() -> String
  • Gets the Brush with which this item is drawn.

    Declaration

    Swift

    open func getEffectiveBrush() -> Brush?

    Return Value

    the Brush or nil if no brush is used.

  • Gets the stroke with which this item is drawn.

    Declaration

    Swift

    open func getEffectiveStroke() -> Color

    Return Value

    the color used for stroking this item.

  • Gets the thickness of the stroke.

    Declaration

    Swift

    open func getEffectiveStrokeThickness() -> Double

    Return Value

    A double value that represents the thickness.

  • Gets the color of the text in this diagram item.

    Declaration

    Swift

    open func getEffectiveTextColor() -> Color

    Return Value

    The color.

  • Gets the name of the font used for drawing the text in this diagram item.

    Declaration

    Swift

    open func getEffectiveFontName() -> String

    Return Value

    A string that represents the name of the font.

  • Gets the size of the font used for drawing the text in this diagram item.

    Declaration

    Swift

    open func getEffectiveFontSize() -> Double

    Return Value

    A double that represents the size of the font.

  • Gets the unit of measure for the font used for drawing the text in this diagram item.

    Declaration

    Swift

    open func getEffectiveFontUnit() -> MeasureUnit

    Return Value

    A MeasureUnit that represents the size of the font.

  • Gets the vertical alignment for the text drawn in this diagram item.

    Declaration

    Swift

    open func getEffectiveVerticalTextAlignment() -> VerticalAlignment

    Return Value

    One of the VerticalAlignment enumeration values.

  • Gets the horizontal alignment for the text drawn in this diagram item.

    Declaration

    Swift

    open func getEffectiveHorizontalTextAlignment() -> HorizontalAlignment

    Return Value

    One of the HorizontalAlignment enumeration values.

  • Gets the Z-index for this diagram item.

    Declaration

    Swift

    open var zIndex: Int { get set }
  • Gets the index of the layer where this diagram item is located.

    Declaration

    Swift

    open var layerIndex: Int { get set }

    Return Value

    The index of the layer.

  • Gets the bounds of this diagram item.

    Declaration

    Swift

    open func getBounds() -> Rect

    Return Value

    A rectangle that represents the bounds.

  • Called when the item is loaded.

    Declaration

    Swift

    open func onLoad()
  • Gets the text of this diagram item.

    Declaration

    Swift

    open var text: String { get set }
  • Gets the color of the text of this diagram item.

    Declaration

    Swift

    open var textColor: Color { get set }
  • Gets the name of the font of the text drawn in this diagram item.

    Declaration

    Swift

    open var fontName: String { get set }
  • Gets the size of the font of the text drawn in this diagram item.

    Declaration

    Swift

    open var fontSize: Double { get set }
  • Gets the MeasureUnit of the font for text drawn in this diagram item.

    Declaration

    Swift

    open var fontUnit: MeasureUnit? { get set }
  • Gets the vertical alignment of the text drawn in this diagram item.

    Declaration

    Swift

    open var verticalTextAlignment: VerticalAlignment { get set }
  • Gets the horizontal alignment of the text drawn in this diagram item.

    Declaration

    Swift

    open var horizontalTextAlignment: HorizontalAlignment { get set }
  • Specifies if this item is visible.

    Declaration

    Swift

    open var visible: Bool { get set }
  • Specifies if this item is selected.

    Declaration

    Swift

    open var selected: Bool { get set }
  • The style of the handles for this item. One of the HandlesStyle enumeration values.

    Declaration

    Swift

    open var handlesStyle: HandlesStyle { get set }
  • Specifies if this item is stand alone.

    Declaration

    Swift

    open var standalone: Bool
  • Specifies if this item is locked.

    Declaration

    Swift

    open var locked: Bool
  • Checks if this is a top level item.

    Declaration

    Swift

    open func isTopLevel() -> Bool

    Return Value

    true if this is a top level item; otherwise false.

  • Specifies the color of this item.

    Declaration

    Swift

    open var stroke: Color { get set }
  • Undocumented

    Declaration

    Swift

    open var strokeDashStyle: DashStyle { get set }
  • Specifies the thickness of the stroke of this item.

    Declaration

    Swift

    open var strokeThickness: Double { get set }
  • Specifies the Brush for this item.

    Declaration

    Swift

    open var brush: Brush? { get set }
  • Undocumented

    Declaration

    Swift

    public func repaint()
  • Specifies the Style of this item or nil if there is none.

    Declaration

    Swift

    open var style: Style? { get set }
  • tag

    Specifies the tag of this diagram item.

    Declaration

    Swift

    open var tag: String
  • Specifies the diagram this item belongs to or nil if none is present.

    Declaration

    Swift

    open weak var diagram: Diagram?
  • Gets a collection of the DiagramNode-s attached to this diagram item.

    Declaration

    Swift

    open var attachedNodes: [DiagramNode]
  • Specifies if this node should be ignored during layout.

    Declaration

    Swift

    open var ignoreLayout: Bool