Shape (クラス)
public abstract Shape {inherits ShapeContainerBase, EventForwarder}
パッケージ: CURL.GUI.SHAPES
直接継承しているサブクラス: RoundedRectangleShape, TextShape, GraphicShape, ImageShape, EllipseShape, ShapeGroup, PathShape, RectangleShape, Chart, PieSet, AxisLineShape, PiePlotArea, ChartLayer, TickShape, LayeredPlotArea

任意の形状を表す抽象基本クラス。通常、ShapeCanvas 内に含まれます。

説明

このクラスをサブクラス化して、独自の形状を実装できます。組み込みの実装のリストとその使用例については、CURL.GUI.SHAPES を参照してください。

コンストラクタ
default:この型の新しいオブジェクトを作成します。
コンストラクタ public {Shape.default ...}

プロパティ
as-Shape:Shape オブジェクトとして self を返すか、Shape でない場合は null を返します。
アクセサ public final Shape.as-Shape:#Shape
border-color:この (または子の) 形状に含まれる境界線またはアウトラインの色。
非ローカル オプション public Shape.border-color:FillPattern
color:この形状とその子の色。
非ローカル オプション public Shape.color:FillPattern
draw-operation:この Shape およびその子のすべてを描画する DrawOperation
ローカル オプション public Shape.draw-operation:DrawOperation =DrawOperation.blend
option-parent:オブジェクトのオプションの親を返します。
アクセサ public Shape.option-parent:#OptionListInterface
selection-context:この ShapeContainerBase とその Shape 子孫に関連付けられた SelectionContext です。
非ローカル オプション public Shape.selection-context:#SelectionContext
shape-parent:この Shape の直属の親です。Shape が親を持たない場合、このフィールドは null になります。
フィールド public-get private-set Shape.shape-parent:#ShapeContainerBase
shape-selectable:この ShapeDiscreteGraphicSelectionContext 内で選択可能にする場合は、このオプションを ShapeSelectable に設定する必要があります。
ローカル オプション public Shape.shape-selectable:#ShapeSelectable =null
stroke-thickness:Shape オブジェクト内の線の太さです。
非ローカル オプション public Shape.stroke-thickness:any
transformation:この Shape の座標系からその親の座標系へのマッピングを行う Transformation2d
フィールド public constant Shape.transformation:Transformation2d
visible?:このオプションが false に設定されている場合、この Shape は描画されず、ポインタ イベントも受信しません。ShapeContainerBase.get-child-at-point および同様のメソッドは、visible? が false の場合は形状を返しません。
ローカル オプション public Shape.visible?:bool =true
プロパティ 継承 ShapeContainerBase: as-ShapeRoot, shape-children
プロパティ 継承 Visual: _style-element, clonable-class?, completely-clonable-children?, cursor, data-source, display-context, dragee, font-size, input-method-enabled?, input-method-keyboard-mode, name, options, options-present-here, style-class, style-element, style-manager, style-options, test-description, test-name, test-parent?, test-type-name, test-visible?, tooltip, user-data
プロパティ 継承 DataBindingTarget: data-binding-context, data-bindings
プロパティ 継承 EventTarget: event-handlers
プロパティ 継承 OptionListInterface: option-register-proc, registered-option-keys

メソッド
apply-rotation:回転を適用してこのオブジェクトの transformation を変更します。
public final {Shape.apply-rotation angle:Angle}:void
apply-scale:スケールを適用してこのオブジェクトの transformation を変更します。
public final {Shape.apply-scale scale-x:double, scale-y:double}:void
apply-transformation:このオブジェクトの transformation を別の Transformation2d で構成して変更します。
public final {Shape.apply-transformation
transformation:Transformation2d
}:void
apply-translation:平行移動を適用してこのオブジェクトの transformation を変更します。
public final {Shape.apply-translation
offset-x:Distance,
offset-y:Distance
}:void
apply-translation-in-parent:平行移動を適用してこのオブジェクトの transformation を変更します。
public final {Shape.apply-translation-in-parent
offset-x:Distance,
offset-y:Distance
}:void
constrain-own-layout-bounds:境界制約 (ローカル座標系) をこの Shape に適用します。
public {Shape.constrain-own-layout-bounds
lc:LayoutContext,
bounds:GRect
}:void
constrain-shape-layout-bounds:境界制約 (ローカル座標系) をこの Shape とその子すべてに適用します。
public {Shape.constrain-shape-layout-bounds
lc:LayoutContext,
bounds:GRect
}:void
contains-point?:この形状またはそのいずれかの子にポイントが含まれているかどうかを判定します。
public {Shape.contains-point? x:Distance, y:Distance}:bool
detach:この形状を親から切り離します。
public {Shape.detach}:void
draw:このオブジェクトの可視表現を描画します。
public abstract {Shape.draw renderer2d:Renderer2d}:void
find-graphical-ancestor:与えられた述語に適合する最も近いグラフィックの祖先を返します。
public final {Shape.find-graphical-ancestor
p:{proc-type {Graphic}:bool}
}:#Graphic
fire-crossing-event:他のイベントから PointerCrossing を初期化して、子 Visual をターゲットとして、そのイベントを発生させます。
public {Shape.fire-crossing-event}:void
fire-in-child:イベントの座標を修正して、子 Visual をターゲットとしてそのイベントを発生させ、その後、座標を復元します。
public {Shape.fire-in-child e:PointerEnvelopeEvent}:void
get-display-context:このオブジェクトの現在の DisplayContext を返します。
public {Shape.get-display-context}:DisplayContext
get-down-orientation-in-shape-parent:このオブジェクトの座標系をその親の座標系に変換した場合の、「下」向きベクトルの方向を計算します。
public final {Shape.get-down-orientation-in-shape-parent}:Double2d
get-graphical-root:Visual のグラフィック階層のルートで、オブジェクトを取得します。
public final {Shape.get-graphical-root}:#Graphic
get-local-device-pixel-size:ピクセルのサイズをローカル座標単位で取得します。
public final {Shape.get-local-device-pixel-size}:Distance
get-origin-in-graphical-ancestor:グラフィック階層内における指定された祖先に対する Visual の相対的位置を見つけます。
public final {Shape.get-origin-in-graphical-ancestor
ancestor:Graphic
}:(x:Distance, y:Distance, found?:bool)
get-origin-in-root:グラフィック階層のルートにあるオブジェクトを基準とし、Visual の位置を取得します。
public final {Shape.get-origin-in-root
}:(x:Distance, y:Distance, root:Graphic)
get-origin-in-shape-parent:親の座標系におけるこの Shape の起点を計算します。
public final {Shape.get-origin-in-shape-parent
}:(x:Distance, y:Distance)
get-origin-in-shape-root:形状ルートである祖先の座標系における、このオブジェクトの起点を取得します。
public final {Shape.get-origin-in-shape-root}:(x:Distance, y:Distance)
get-own-bounds:ローカル座標系におけるこの Shape の四角形のレンダリング境界を計算します。
public abstract {Shape.get-own-bounds dest:GRect = {GRect.empty}}:GRect
get-own-bounds-in-shape-root:形状ルートである祖先の座標系における、この形状の四角形のレンダリング境界を計算します。
public {Shape.get-own-bounds-in-shape-root
dest:GRect = {GRect.empty}
}:GRect
get-own-layout-bounds:ローカル座標系におけるこの Shape の四角形のレイアウト境界を計算します。
public {Shape.get-own-layout-bounds
lc:LayoutContext,
width-first?:bool = true,
dest:GRect = {GRect.empty}
}:GRect
get-right-orientation-in-shape-parent:このオブジェクトの座標系をその親の座標系に変換した場合の、「右」向きベクトルの方向を計算します。
public final {Shape.get-right-orientation-in-shape-parent}:Double2d
get-shape-bounds:このオブジェクトのローカル座標系における、このオブジェクトとその子の四角形のレンダリング境界を計算します。
public {Shape.get-shape-bounds dest:GRect = {GRect.empty}}:GRect
get-shape-bounds-in-shape-root:形状ルートである祖先の座標系における、このオブジェクトと子の四角形のレンダリング境界を取得します。
public {Shape.get-shape-bounds-in-shape-root
dest:GRect = {GRect.empty}
}:GRect
get-shape-layout-bounds:このオブジェクトのローカル座標系における、このオブジェクトとその子の四角形のレイアウト境界を計算します。
public {Shape.get-shape-layout-bounds
lc:LayoutContext,
width-first?:bool = true,
dest:GRect = {GRect.empty}
}:GRect
get-top-left-in-ancestor:グラフィック階層に含まれる指定上位オブジェクトの座標フレームでこのオブジェクトの左上隅のロケーションを見つけます。
public final {Shape.get-top-left-in-ancestor
ancestor:Graphic
}:(x:Distance, y:Distance, found?:bool)
get-transformation-to-shape-root:このオブジェクトの座標系から形状ルートである祖先の座標系への累積変換を返します。
public final {Shape.get-transformation-to-shape-root}:Transformation2d
keyword-init-arg: InitRestArgParser.process-rest-args でキーワード引数が検出されると呼び出されます。
protected {Shape.keyword-init-arg key:String, value:any}:void
option-change-notify:このオブジェクトで値が変更されたオプションについて、オプションの変更ハンドラを呼び出します。
protected {Shape.option-change-notify
item:OptionItem,
removed?:bool
}:void
overdraw-for-selection:このオブジェクトの上に選択アフォーダンスを描画します。
public {Shape.overdraw-for-selection}:void
quantize-line-thickness:線の太さの値を数量化するユーティリティ プロシージャです。
public final {Shape.quantize-line-thickness
thickness:any,
display-context:DisplayContext = {self.get-display-context},
quantum-size:Distance = {self.get-local-device-pixel-size}
}:(result:Distance, single-device-pixel?:bool)
request-draw:描画する Visual に属するピクセルを確認します。
public {Shape.request-draw
layout-context:LayoutContext = {self.get-layout-context}
}:void
request-draw-self:再描画する Shape に属するピクセルを要求します。
public {Shape.request-draw-self
layout-context:LayoutContext = {self.get-layout-context}
}:void
reset-transformation:このオブジェクトの transformation を恒等変換にリセットします。
public final {Shape.reset-transformation}:void
self-contains-point?:ポイントがこの Shape 内にあるかどうかを判定します。
public abstract {Shape.self-contains-point?}:bool
self-intersects-polygon?:ポリゴンがこの Shape と交差するかどうかを判定します。
public abstract {Shape.self-intersects-polygon?}:bool
set-rotation:回転を設定してこのオブジェクトの transformation を変更します。
public final {Shape.set-rotation angle:Angle}:void
set-scale:スケールを設定してこのオブジェクトの transformation を変更します。
public final {Shape.set-scale scale-x:double, scale-y:double}:void
set-transformation:このオブジェクトの transformation を別の Transformation2d に置き換えて変更します。
public final {Shape.set-transformation
transformation:Transformation2d
}:void
set-translation-in-parent:親を基準にした平行移動を設定してこのオブジェクトの transformation を変更します。
public final {Shape.set-translation-in-parent}:void
to-Graphic:このオブジェクトに値する Graphic を返します。
public {Shape.to-Graphic}:Graphic
transform-from-display-coordinates:このオブジェクトの Display の座標系からこのオブジェクトの座標系に座標を変換します。
public final {Shape.transform-from-display-coordinates}:(new-x:Distance, new-y:Distance)
transform-from-graphical-root-coordinates:このオブジェクトのグラフィック階層のルートにあるオブジェクトの座標系からこのオブジェクトの座標系に座標を変換します。
public final {Shape.transform-from-graphical-root-coordinates}:(new-x:Distance, new-y:Distance, root:Graphic)
transform-point-from-shape-root:このオブジェクトの形状ルートである祖先の座標系からこのオブジェクトのローカル座標系に変換された point を返します。
public final {Shape.transform-point-from-shape-root
point:Distance2d
}:Distance2d
transform-point-to-shape-root:このオブジェクトのローカル座標系から形状ルートである祖先の座標系に変換された point を返します。
public final {Shape.transform-point-to-shape-root
point:Distance2d
}:Distance2d
transform-to-display-coordinates:このオブジェクトの座標系から Display の座標系に座標を変換します。
public final {Shape.transform-to-display-coordinates}:(new-x:Distance, new-y:Distance)
transform-to-graphical-root-coordinates:このオブジェクトの座標系からこのオブジェクトのグラフィック階層のルートにあるオブジェクトの座標系に座標を変換します。
public final {Shape.transform-to-graphical-root-coordinates}:(new-x:Distance, new-y:Distance, root:Graphic)
transform-vector-from-shape-root:このオブジェクトの形状ルートである祖先の座標系からこのオブジェクトのローカル座標系に変換された vector を返します。
public final {Shape.transform-vector-from-shape-root
vector:Distance2d
}:Distance2d
transform-vector-to-shape-root:このオブジェクトのローカル座標系から形状ルートである祖先の座標系に変換された vector を返します。
public final {Shape.transform-vector-to-shape-root
vector:Distance2d
}:Distance2d
transformation-changed:Shape.transformation が変更されたことの通知。
public {Shape.transformation-changed}:void
transformation-changing:Shape.transformation が変更されることの通知。
public {Shape.transformation-changing}:void
メソッド 継承 ShapeContainerBase: add, clear, draw-shape-child, draw-shape-children, get-all-children-at-point, get-child-at-point, get-leaf-at-point, get-shape-root, note-attached, note-detaching, notify-option-children, on-drag-enter, on-pointer-enter, on-pointer-envelope-event, register-options, remove, set-shape-index, set-shape-index-after, set-shape-index-before, shape-container-fire-inferior-crossing-event, shape-container-handle-crossing, shape-container-pick-child, shape-container-pointer-enter-occurred, shape-container-pointer-leave-occurred
メソッド 継承 Visual: add-from-init-args, add-option, add-style-option, animate, change-cursor, clonable-appearance?, clone-appearance, clone-appearance-helper, find-test-children, get-focus-manager, get-layout-context, get-test-parent, get-test-property, get-text, get-view, maybe-fire-attach-event, maybe-fire-detach-event, non-keyword-init-arg, note-caret-position, on-drag-leave, on-pointer-leave, pop-cursor, prepare-test-object, prepare-test-parent, push-cursor, quantize-width, release-key-focus, remove-option, remove-style-option, request-key-focus, scroll-to-include, test-record, test-run, xy-offset-to
メソッド 継承 GraphicOptions: any-to-Distance
メソッド 継承 GuiEventTarget: handle-event, on-action, on-cancel-mode, on-command-changed, on-commit, on-composition-change-event, on-composition-result-event, on-context-menu-event, on-current-record-change-request, on-current-record-changed, on-destroy-notify, on-destroy-requested, on-drag-over, on-drag-pointer, on-drag-started, on-drop, on-end-composition-event, on-focus-event, on-focus-in, on-focus-out, on-grab-release, on-gui-event, on-input-method-event, on-inspection, on-key-event, on-key-press, on-pointer-button, on-pointer-crossing, on-pointer-event, on-pointer-motion, on-pointer-press, on-pointer-release, on-pointer-scroll, on-raw-key-event, on-raw-key-press, on-raw-key-release, on-reset, on-selectable-added, on-selectable-removed, on-selection-changed, on-selection-context-activated, on-selection-context-deactivated, on-selection-event, on-start-composition-event, on-start-event, on-stop-event, on-view-activate, on-view-deactivate, on-window-close, remove-event-handlers-for-event-class
メソッド 継承 DataBindingTarget: add-data-binding, get-data-binding, refresh-data-binding, remove-data-binding, unset-property, update-data-binding, validate-data-binding
メソッド 継承 EventTarget: accepts-event-class?, add-event-handler, event-handler-present?, remove-event-handler, verify-event
メソッド 継承 OptionListInterface: change-option-parent-notify, clone-options, get-option, get-option-by-name, local-add-notify, local-remove-notify, name-to-option-key, new-option-item, option-changed, option-lookup, option-lookup-here, option-propagate-notify, option-set?, propagate-option-change, remove-styles, set-option-by-name, set-style-option-by-name, unset-option-by-name, unset-style-option-by-name
メソッド 継承 BasicEventTarget: enqueue-event
メソッド 継承 InitRestArgParser: process-rest-args
メソッド 継承 Object: object-describe, object-describe-for-debugging, object-serialize



コンストラクタ詳細
default (コンストラクタ)
public {Shape.default ...}

この型の新しいオブジェクトを作成します。

...:
渡される非キーワード引数は、このオブジェクトの子として追加される Shape であると解釈されます。すべての Visual クラスと同様に、オプション (color など) を初期化するために残余引数が使用される場合もあります。
さらに、次の特別なキーワード引数が渡される場合があり、渡された順に処理されます。
これらの引数のすべては Shape.apply-rotationShape.apply-scaleShape.apply-translation と同じ方法で現在の Shape.transformation に反映されます。これらの引数は累積され、何度でも指定できます。引数が表示される順序は、変換が適用される順序です。



プロパティ詳細
as-Shape (アクセサ)
アクセサ public final Shape.as-Shape:#Shape

Shape オブジェクトとして self を返すか、Shape でない場合は null を返します。

注意事項

Canvas は、Shape ではない ShapeContainerBase の例です。


border-color (非ローカル オプション)
public Shape.border-color:FillPattern

この (または子の) 形状に含まれる境界線またはアウトラインの色。

注意事項

すべての形状オブジェクトにこのオプションがあり、継承されるか、またはオブジェクトに直接設定されます。
形状オブジェクトによっては、このプロパティを直接使用しないものがあります。たとえば、ShapeGroup はこのプロパティを使用しません。しかし、ShapeGroup オブジェクトにこのようなプロパティを設定すると、形状オブジェクトのすべての子が既定でプロパティを継承するので便利です。


color (非ローカル オプション)
public Shape.color:FillPattern

この形状とその子の色。

説明

形状を塗りつぶさない場合は、このオプションを FillPattern.transparent に設定できます。通常、この設定は、Shape.self-contains-point? の結果または形状に渡されるマウス イベントには影響を与えません。

注意事項

すべての形状オブジェクトにこのオプションがあり、継承されるか、またはオブジェクトに直接設定されます。
形状オブジェクトによっては、このプロパティを直接使用しないものがあります。たとえば、ShapeGroup はこのプロパティを使用しません。しかし、ShapeGroup オブジェクトにこのようなプロパティを設定すると、形状オブジェクトのすべての子が既定でプロパティを継承するので便利です。


draw-operation (ローカル オプション)
public Shape.draw-operation:DrawOperation =DrawOperation.blend

この Shape およびその子のすべてを描画する DrawOperation

説明

このオプションが未設定の場合、現在の DrawOperation は変更されません。これは、子 Shape が、既定で、親と同じ DrawOperation で描画することを意味します。したがって、オプションの既定値 (DrawOperation.mask) は重要ではなく、単に Renderer2d の既定の初期 DrawOperation を反映します。
このオプションはさまざまな透過性効果を有効にするために使用できます。適したレンダラを使用する必要があることに注意してください。DrawOperation.mask および DrawOperation.source だけがすべてのレンダラでサポートされています。Shape の描画に使用するレンダラのタイプは変えることができます。
Canvas を使用する場合、その Canvas.use-host-rendering? および Canvas.support-advanced-draw-operations? プロパティを設定することができます。または、AntialiasedFrame の同じプロパティを使用することもできます。
「ホストでない」レンダラが必要な場合、および support-advanced-draw-operations? が必要な場合に関する詳細は、DrawOperation を参照してください。

この例では、さまざまな描画操作の効果を示すため、動いて重なり合う RectangleShape を使用しています。選択した操作は、四角形のすべての形状の親に設定されます。また、このコードがその Canvasuse-host-rendering? プロパティおよび support-advanced-draw-operations? プロパティを、選択した操作に適した値に変更することに注意してください。

例: Shape.draw-operation の使用
{import * from CURL.GUI.SHAPES}
{import * from CURL.LANGUAGE.MATH-CONSTANT}

{let constant random:Random = {Random}}
{let constant frequency:Frequency = 30fps}
{let constant period:Time = 1 / frequency}
{let constant acceleration:Acceleration2d =
    {Acceleration2d 0(m/s^2), 0.1(m/s^2)}
}
{let constant group:ShapeGroup =
    {ShapeGroup
        draw-operation = DrawOperation.source
    }
}

{let constant canvas:Canvas =
    {Canvas
        width = 6cm,
        height = 6cm,
        background = "black",
        group
    }
}

{let constant host-rendering-display:CheckButton =
    {CheckButton
        label = "use-host-rendering?",
        enabled? = false,
        value = canvas.use-host-rendering?
    }
}

{let constant advanced-operations-display:CheckButton =
    {CheckButton
        label = "support-advanced-draw-operations?",
        enabled? = false,
        value = canvas.support-advanced-draw-operations?
    }
}

{for i = 0 below 5 do
    let constant opacity:float = {random.next-float} * 0.5f + 0.25f
    {group.add
        {RectangleShape
            {GRect 7mm, 7mm, 8mm, 8mm},
            color =
                {Color.from-rgb
                    (4 - i) / 4,
                    0.1,
                    i / 4,
                    opacity = opacity
                },
            user-data = 1 / ({random.next-float} * 1s + 3s),
            translation = {Distance2d 0m, i * 5cm / 4 + .5cm},
            {TextShape
                {format "%0.1f", opacity},
                color = "white"
            }
        }
    }
}

{let time:Time = 0s}

{let timer-button:CommandButton =
    {CommandButton
        label = "Start animation!",
        {on Action at cb:CommandButton do
            {if timer.enabled? then
                set timer.enabled? = false
                set cb.label = "Start animation!"
             else
                set timer.repeat = 600
                set timer.enabled? = true
                set cb.label = "Stop animation!"
            }
        }
    }
}

{let timer:Timer =
    {Timer
        enabled? = false,
        frequency = frequency,
        {on TimerEvent at t:Timer do
            {if t.repeat == 0 then
                set timer-button.label = "Start animation!"
                set timer.enabled? = false
            }
            {inc time, period}
            let constant shapes:{Array-of Shape} =
                group.shape-children
            {for shape in group.shape-children do
                let constant f:Frequency =
                    shape.user-data asa Frequency
                let constant (x:Distance, y:Distance) =
                    {shape.get-origin-in-shape-parent}
                {shape.set-translation-in-parent
                    ((0.5 + 0.5 *
                      {cos time * 2rad * pi * f + pi * 1rad}) *
                     canvas.actual-width),
                    y
                }
            }
        }
    }
}

{value canvas}
{VBox
    host-rendering-display,
    advanced-operations-display
}

{value timer-button}

{RadioFrame
    {VBox
        spacing = 4pt,
        {RadioButton radio-value = DrawOperation.source, value = true},
        {RadioButton radio-value = DrawOperation.accumulate},
        {RadioButton radio-value = DrawOperation.add},
        {RadioButton radio-value = DrawOperation.blend},
        {RadioButton radio-value = DrawOperation.blend-premultiply},
        {RadioButton radio-value = DrawOperation.invert-destination},
        {RadioButton radio-value = DrawOperation.invert-source},
        {RadioButton radio-value = DrawOperation.mask}
    },
    {on ValueFinished at rf:RadioFrame do
        let constant op:DrawOperation = rf.value asa DrawOperation
        set group.draw-operation = op
        {if op == DrawOperation.source or
            op == DrawOperation.mask
         then
            set canvas.use-host-rendering? = true
            set canvas.support-advanced-draw-operations? = false
         else
            set canvas.use-host-rendering? = false
            set canvas.support-advanced-draw-operations? =
                not (op == DrawOperation.source or
                     op == DrawOperation.mask or
                     op == DrawOperation.blend)
        }
        set host-rendering-display.value =
            canvas.use-host-rendering?
        set advanced-operations-display.value =
            canvas.support-advanced-draw-operations?
    }
}


option-parent (アクセサ)
アクセサ public Shape.option-parent:#OptionListInterface

オブジェクトのオプションの親を返します。

戻り値

このオブジェクトのオプションの親である OptionListInterface。ただし、このオブジェクトがオプションの親を持たない場合は、null になります。

オーバーライド

既定の実装 OptionListInterface.option-parent は常に null を返します。サブクラスでは、通常は super.option-parent は呼び出さずに、適切な値を返すコードでこのメソッドをオーバーライドします。


selection-context (非ローカル オプション)
public Shape.selection-context:#SelectionContext

この ShapeContainerBase とその Shape 子孫に関連付けられた SelectionContext です。

注意事項

null 以外の場合、通常は DiscreteGraphicSelectionContext になります。


shape-parent (フィールド)
public-get private-set Shape.shape-parent:#ShapeContainerBase

この Shape の直属の親です。Shape が親を持たない場合、このフィールドは null になります。



shape-selectable (ローカル オプション)
public Shape.shape-selectable:#ShapeSelectable =null

この ShapeDiscreteGraphicSelectionContext 内で選択可能にする場合は、このオプションを ShapeSelectable に設定する必要があります。

説明

詳細は ShapeSelectable を参照してください。


stroke-thickness (非ローカル オプション)
public Shape.stroke-thickness:any

Shape オブジェクト内の線の太さです。

説明

stroke-thickness を参照してください。


transformation (フィールド)
public constant Shape.transformation:Transformation2d

この Shape の座標系からその親の座標系へのマッピングを行う Transformation2d

説明

この Transformation2d は直接変更できません。直接変更すると、内部構造の同期がとれなくなります。代わりに、次のいずれかのメソッドを使用して変換を変更します。


visible? (ローカル オプション)
public Shape.visible?:bool =true

このオプションが false に設定されている場合、この Shape は描画されず、ポインタ イベントも受信しません。ShapeContainerBase.get-child-at-point および同様のメソッドは、visible? が false の場合は形状を返しません。






メソッド詳細
apply-rotation (メソッド)
public final {Shape.apply-rotation angle:Angle}:void

回転を適用してこのオブジェクトの transformation を変更します。


{import * from CURL.GUI.SHAPES}

{let shape:Shape =
    {RectangleShape
        translation = {Distance2d .5in, .5in},
        {GRect .25in, .25in, .25in, .25in}
    }
}
{Canvas width = 1in, height = 1in, border-width = 1px, shape}

{CommandButton
    label = "\{apply-rotation 15deg\}",
    {on Action do {shape.apply-rotation 15deg}}
}


apply-scale (メソッド)
public final {Shape.apply-scale scale-x:double, scale-y:double}:void

スケールを適用してこのオブジェクトの transformation を変更します。


{import * from CURL.GUI.SHAPES}

{let shape:Shape =
    {RectangleShape
        translation = {Distance2d .5in, .5in},
        {GRect .25in, .25in, .25in, .25in}
    }
}
{Canvas width = 1in, height = 1in, border-width = 1px, shape}

{CommandButton
    label = "\{apply-scale 1.2, 1.1\}",
    {on Action do {shape.apply-scale 1.2, 1.1}}
}


apply-transformation (メソッド)
public final {Shape.apply-transformation
transformation:Transformation2d
}:void

このオブジェクトの transformation を別の Transformation2d で構成して変更します。

注意事項

引数に transformation を指定して self.transformation.compose-clone を呼び出したときと同じ結果を返します。
ただし、これを直接呼び出すことはできません。内部のデータ構造の同期がとれなくなる可能性があるからです。Shape.transformation を変更するには、このようなメソッドを呼び出す必要があります。


{import * from CURL.GUI.SHAPES}

{let shape:Shape =
    {RectangleShape
        translation = {Distance2d .5in, .5in},
        {GRect .25in, .25in, .25in, .25in}
    }
}

{Canvas width = 1in, height = 1in, border-width = 1px, shape}

{let transformation:Transformation2d = {Transformation2d}}
{transformation.local-rotate 15deg}
{transformation.local-translate 1mm, 0mm}

{CommandButton
    label = "\{apply-transformation transformation\}",
    {on Action do {shape.apply-transformation transformation}}
}


apply-translation (メソッド)
public final {Shape.apply-translation
offset-x:Distance,
offset-y:Distance
}:void

平行移動を適用してこのオブジェクトの transformation を変更します。


{import * from CURL.GUI.SHAPES}

{let shape:Shape =
    {RectangleShape
        translation = {Distance2d .5in, .5in},
        {GRect .25in, .25in, .25in, .25in}
    }
}
{Canvas width = 1in, height = 1in, border-width = 1px, shape}

{CommandButton
    label = "\{apply-translation 2mm, 1mm\}",
    {on Action do {shape.apply-translation 2mm, 1mm}}
}


apply-translation-in-parent (メソッド)
public final {Shape.apply-translation-in-parent
offset-x:Distance,
offset-y:Distance
}:void

平行移動を適用してこのオブジェクトの transformation を変更します。

注意事項

Shape.apply-translation とは異なり、offset-xoffset-y はこの形状の親の座標系を基準にして解釈されます。これによって違いが生じるのは、このオブジェクトの transformation に回転またはスケーリングが含まれる場合だけです。


{import * from CURL.GUI.SHAPES}

{let shape:Shape =
    {RectangleShape
        translation = {Distance2d .5in, .5in},
        rotation = 45deg,
        {GRect .25in, .25in, .25in, .25in}
    }
}

{Canvas width = 1in, height = 1in, border-width = 1px, shape}

{CommandButton
    label = "\{apply-translation 2mm, 0mm\}",
    {on Action do {shape.apply-translation 2mm, 0mm}}
}
{CommandButton
    label = "\{apply-translation-in-parent 2mm, 0mm\}",
    {on Action do {shape.apply-translation-in-parent 2mm, 0mm}}
}


constrain-own-layout-bounds (メソッド)
public {Shape.constrain-own-layout-bounds
lc:LayoutContext,
bounds:GRect
}:void

境界制約 (ローカル座標系) をこの Shape に適用します。

lc: このレイアウト ネゴシエーションに対して有効な LayoutContext
bounds: 適用する制約です。

説明

Shape は制約に従う必要はありません。ただし、制約に従わない場合、Shape の全体を表示することができません。
既定の実装では、制約を無視します。

注意事項

Shape が境界を変更することで制約に対応する場合は、ShapeRoot.invalidate-shape-layout を呼び出す必要があります。無限ループを回避するため、制約とレイアウト境界のサイズの差が1 ピクセル未満の場合は、無視する必要があります。


constrain-shape-layout-bounds (メソッド)
public {Shape.constrain-shape-layout-bounds
lc:LayoutContext,
bounds:GRect
}:void

境界制約 (ローカル座標系) をこの Shape とその子すべてに適用します。

lc: このレイアウト ネゴシエーションで有効な LayoutContext
bounds: 適用する制約です。

説明

このメソッドによって、Shape.constrain-own-layout-bounds の一連の呼び出しが行われます。


contains-point? (メソッド)
public {Shape.contains-point? x:Distance, y:Distance}:bool

この形状またはそのいずれかの子にポイントが含まれているかどうかを判定します。

説明

このメソッドは、このオブジェクトとその子に対して Shape.self-contains-point? を呼び出すために実装されます。

オーバーライド

通常は、Shape の実装でこのメソッドをオーバーライドする必要はありません。代わりに Shape.self-contains-point? をオーバーライドしてください。Shape.self-intersects-polygon? も参照してください。


detach (メソッド)
public {Shape.detach}:void

この形状を親から切り離します。

説明

これは、意味的にはこの形状の親に対して ShapeContainerBase.remove を呼び出すのと同じです。
親を持たない形状に対して detach を呼び出しても効果はありません。


draw (メソッド)
public abstract {Shape.draw renderer2d: