Skip to content

DTL.Shape.Border (形状クラス)

sitRyo edited this page Jan 15, 2020 · 6 revisions

バージョン 0.1.0以降

namespace DTL.Shape {
    public class Border
}

概要

Borderとは "Matrixの描画範囲の周囲1マスに描画値を設置する" 機能を持つクラスである。

描画範囲の全てを必ず塗りつぶすとは限らない (Matrixの初期化が必要)

継承

DTL.Base.RectBaseWithValue<TDerived>DTL.Shape.AscendingOrder

インターフェース

IDrawer<int>

コンストラクタ

Constructors Descriptions Version
Border() Matrixの内容をそのまま出力するBorderのインスタンスを生成します。 v0.1.0
Border(int drawValue) 初期描画値を指定したBorderのインスタンスを生成します。 v0.1.0
Border(int drawValue, DTL.Base.Coordinate2DimensionalAndLength2DimensionalmatrixRange matrixRange 初期描画値と描画範囲を指定したBorderのインスタンスを生成します。 v0.1.0
Border(int drawValue, uint startX, uint startY, uint width, uint height) 初期描画値と描画範囲を指定したBorderのインスタンスを生成します。 v0.1.0

プロパティ

Name Accessibility Descriptions Version
int DrawValue public get, protected set Matrixに描画する値 v0.1.0
uint startX public get, protected set 描画の開始点X v0.1.0
uint startY public get, protected set 描画の開始点Y v0.1.0
uint width public get, protected set 描画横幅W v0.1.0
uint height public get, protected set 描画縦幅H v0.1.0

メソッド

描画範囲取得/描画値取得

Name Descriptions Version
GetPointX 描画始点座標Xを取得 v0.1.0
GtPointY 描画始点座標Yを取得 v0.1.0
GetWidth 描画横幅Wを取得 v0.1.0
GetHeight 描画縦幅Hを取得 v0.1.0
GetValue 描画値を取得 v0.1.0

描画範囲指定/描画値指定

Name Descriptions Version
SetPointX 描画始点座標Xを指定 v0.1.0
SetPointY 描画始点座標Yを指定 v0.1.0
SetWidth 描画横幅Wを指定 v0.1.0
SetHeight 描画縦幅Hを指定 v0.1.0
SetPoint 描画始点座標(X,Y)を指定 v0.1.0
SetRange 描画範囲(X,Y,W,H)を指定 v0.1.0
SetValue 描画値を指定 v0.1.0

描画範囲消去/描画値消去

名前 説明 対応バージョン
ClearPointX 描画始点座標Xを消去 v0.1.0
ClearPointY 描画始点座標Yを消去 v0.1.0
ClearWidth 描画横幅Wを消去 v0.1.0
ClearHeight 描画縦幅Hを消去 v0.1.0
ClearPoint 描画始点座標(X,Y)を消去 v0.1.0
ClearRange 描画範囲(X,Y,W,H)を消去 v0.1.0
ClearValue 描画値を消去 v0.1.0
Clear 描画範囲と描画値を消去 v0.1.0

インターフェースの実装

Name Descriptions Version
Draw(int[,]) Matrixに描画する v0.1.0
Create(int[,]) Matrixに描画してMatrixを返す v0.1.0

Examples (C#)

using DTL.Console;
using UnityEngine;
using DTL.Shape;

public class GenerateBorder : MonoBehaviour {

    public int height = 10;
    public int width = 15;
    public int drawValue = 5;

	void Start () {
        Border border = new Border(drawValue);
        var matrix = new int[height, width];
        border.Draw(matrix);
        new OutputConsole().Draw(matrix);
    }
}

Output

5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 
5 0 0 0 0 0 0 0 0 0 0 0 0 0 5 
5 0 0 0 0 0 0 0 0 0 0 0 0 0 5 
5 0 0 0 0 0 0 0 0 0 0 0 0 0 5 
5 0 0 0 0 0 0 0 0 0 0 0 0 0 5 
5 0 0 0 0 0 0 0 0 0 0 0 0 0 5 
5 0 0 0 0 0 0 0 0 0 0 0 0 0 5 
5 0 0 0 0 0 0 0 0 0 0 0 0 0 5 
5 0 0 0 0 0 0 0 0 0 0 0 0 0 5 
5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
ApiBorder1
Clone this wiki locally