Skip to content

memo_viewpoints_definitions_layout

SysML API

Public namespace memo::viewpoints::definitions
Declared package memo_viewpoints_definitions_layout
Source src/viewpoints/definitions/memo_view_layout.sysml

Namespace hierarchy

memo → memo::viewpoints → memo::viewpoints::definitions

Packages

Package
memo_viewpoints_definitions_layout

Imports

Visibility Target
private ScalarValues::*

Declarations

Name SysML kind Description Specializes
MemoLayoutSide enum def Controlled values for memo layout side: top, bottom, left, right. —
MemoLayoutLineStyle enum def Controlled values for memo layout line style: solid, dashed, dotted. —
MemoLayoutAlign enum def Controlled values for memo layout align: left, center, right. —
MemoLayoutVerticalAlign enum def Controlled values for memo layout vertical align: top, middle, bottom. —
MemoLayout metadata def Memo layout definition. —
MemoLayoutNode metadata def Memo layout node definition. —
MemoLayoutPort metadata def Memo layout port definition. —
MemoLayoutPortWall metadata def Memo layout port wall definition. —
MemoLayoutEdge metadata def Memo layout edge definition. —
MemoLayoutNote metadata def Memo layout note definition. —

MemoLayoutSide

enum def MemoLayoutSide
Property Value
Description Controlled values for memo layout side: top, bottom, left, right.
Kind enum def
Abstract No
Specializes —
Owning package memo_viewpoints_definitions_layout

MemoLayoutLineStyle

enum def MemoLayoutLineStyle
Property Value
Description Controlled values for memo layout line style: solid, dashed, dotted.
Kind enum def
Abstract No
Specializes —
Owning package memo_viewpoints_definitions_layout

MemoLayoutAlign

enum def MemoLayoutAlign
Property Value
Description Controlled values for memo layout align: left, center, right.
Kind enum def
Abstract No
Specializes —
Owning package memo_viewpoints_definitions_layout

MemoLayoutVerticalAlign

enum def MemoLayoutVerticalAlign
Property Value
Description Controlled values for memo layout vertical align: top, middle, bottom.
Kind enum def
Abstract No
Specializes —
Owning package memo_viewpoints_definitions_layout

MemoLayout

metadata def MemoLayout
Property Value
Description Memo layout definition.
Kind metadata def
Abstract No
Specializes —
Owning package memo_viewpoints_definitions_layout

MemoLayoutNode

metadata def MemoLayoutNode
Property Value
Description Memo layout node definition.
Kind metadata def
Abstract No
Specializes —
Owning package memo_viewpoints_definitions_layout

MemoLayoutPort

metadata def MemoLayoutPort
Property Value
Description Memo layout port definition.
Kind metadata def
Abstract No
Specializes —
Owning package memo_viewpoints_definitions_layout

MemoLayoutPortWall

metadata def MemoLayoutPortWall
Property Value
Description Memo layout port wall definition.
Kind metadata def
Abstract No
Specializes —
Owning package memo_viewpoints_definitions_layout

MemoLayoutEdge

metadata def MemoLayoutEdge
Property Value
Description Memo layout edge definition.
Kind metadata def
Abstract No
Specializes —
Owning package memo_viewpoints_definitions_layout

MemoLayoutNote

metadata def MemoLayoutNote
Property Value
Description Memo layout note definition.
Kind metadata def
Abstract No
Specializes —
Owning package memo_viewpoints_definitions_layout

Source

viewpoints/definitions/memo_view_layout.sysml
// Where a view's boxes sit. A drawing's layout is presentation, and it is
// written in the view that owns it: `@MemoLayout` and its `@MemoLayout*`
// siblings annotate a `view` usage (their `annotatedElement` is never anything
// else), inside the view's own body. It used to live in a `.viewlayout`
// companion beside the file, which the compiler, review and the pinned build
// could not see.
//
// Flat on purpose. Each box, port, connector route and note is one metadata
// usage with primitive values, because a metadata body can redefine an
// attribute with a literal (MetadataBodyUsage, SysML-textual-bnf.kebnf:1694)
// but cannot construct a nested record, and a repeated record needs one usage
// per instance. Elements are named by their qualified id as a STRING, not a
// reference: a layout is not a model fact, so it must not become a
// relationship, and a reference to a renamed element would break the compile
// where a stale string only returns that box to automatic placement.
//
// The camera (zoom and pan) is not stored. It is one person's window onto the
// drawing, not the drawing, and recording it would put a diff in the model
// every time someone scrolled.
package memo_viewpoints_definitions_layout {
    private import ScalarValues::*;

    enum def MemoLayoutSide {
        enum top;
        enum bottom;
        enum left;
        enum right;
    }

    enum def MemoLayoutLineStyle {
        enum solid;
        enum dashed;
        enum dotted;
    }

    enum def MemoLayoutAlign {
        enum left;
        enum center;
        enum right;
    }

    enum def MemoLayoutVerticalAlign {
        enum top;
        enum middle;
        enum bottom;
    }

    /** The view-wide choices. One per view, absent when the view keeps every default. */
    metadata def MemoLayout {
        :> annotatedElement : SysML::ViewUsage;
        /** False once a person has placed a box by hand. */
        attribute autoLayout : Boolean[0..1];
        attribute grid : Real[0..1];
        attribute snap : Boolean[0..1];
        /**
         * The positions were written in a coordinate frame that differs from the
         * current one; `context-child-v1` says a nested box's position is
         * relative to its parent, as the canvas stores it now.
         */
        attribute coordinateSpace : String[0..1];
        /** The automatic-layout provider the person chose for this view, and the version of it that placed the boxes. */
        attribute layoutProvider : String[0..1];
        attribute layoutProviderVersion : String[0..1];
        attribute layoutContractVersion : String[0..1];
        attribute layoutPreset : String[0..1];
        attribute layoutSeed : Real[0..1];
    }

    /**
     * One box. `x` and `y` are in the frame of `parentElement` (the box it is
     * nested in), or on the board when there is none; the frame is recorded
     * because a box that changes nesting would otherwise be read in the wrong
     * one and jump.
     */
    metadata def MemoLayoutNode {
        :> annotatedElement : SysML::ViewUsage;
        attribute element : String;
        attribute parentElement : String[0..1];
        attribute x : Real;
        attribute y : Real;
        attribute width : Real[0..1];
        attribute height : Real[0..1];
        attribute fillColor : String[0..1];
        attribute borderColor : String[0..1];
        attribute textColor : String[0..1];
        attribute fontSize : Real[0..1];
        attribute fontWeight : Real[0..1];
        attribute textAlign : MemoLayoutAlign[0..1];
        attribute verticalAlign : MemoLayoutVerticalAlign[0..1];
        attribute opacity : Real[0..1];
    }

    /** Where a boundary port sits on its owner's box, relative to that box. */
    metadata def MemoLayoutPort {
        :> annotatedElement : SysML::ViewUsage;
        attribute element : String;
        attribute portName : String;
        attribute x : Real;
        attribute y : Real;
        attribute side : MemoLayoutSide[0..1];
        attribute size : Real[0..1];
    }

    /**
     * Which wall a boundary port straddles. A constraint rather than a
     * position: automatic layout still places the port, on that wall.
     */
    metadata def MemoLayoutPortWall {
        :> annotatedElement : SysML::ViewUsage;
        attribute portId : String;
        attribute wall : MemoLayoutSide;
    }

    /**
     * A connector's presentation. `route` is the hand-drawn bend points as
     * x, y, x, y, … in board coordinates; the landings say where each end meets
     * its box, as a wall and a fraction along it, and survive the box moving.
     */
    metadata def MemoLayoutEdge {
        :> annotatedElement : SysML::ViewUsage;
        attribute edge : String;
        attribute color : String[0..1];
        attribute strokeWidth : Real[0..1];
        attribute labelVisible : Boolean[0..1];
        attribute lineStyle : MemoLayoutLineStyle[0..1];
        attribute route : Real[0..*] ordered;
        attribute sourceElement : String[0..1];
        attribute targetElement : String[0..1];
        attribute sourcePortId : String[0..1];
        attribute targetPortId : String[0..1];
        attribute manualLanding : Boolean[0..1];
        attribute sourceSide : MemoLayoutSide[0..1];
        attribute sourceT : Real[0..1];
        attribute targetSide : MemoLayoutSide[0..1];
        attribute targetT : Real[0..1];
    }

    /** A note, text label or constraint box that belongs to the drawing and not to the model. */
    metadata def MemoLayoutNote {
        :> annotatedElement : SysML::ViewUsage;
        attribute noteId : String;
        attribute noteKind : String;
        attribute x : Real;
        attribute y : Real;
        attribute width : Real[0..1];
        attribute height : Real[0..1];
        attribute text : String;
        attribute fillColor : String[0..1];
    }
}