import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
-
-import jp.sourceforge.gokigen.memoma.drawers.MeMoMaCanvasDrawer;
import jp.sourceforge.gokigen.memoma.holders.MeMoMaObjectHolder;
+import jp.sourceforge.gokigen.memoma.holders.PositionObject;
/**
* めもまのオブジェクト・ライン・ラベルを描画するメソッド群
static public float drawObjectDrum(Canvas canvas, RectF objectShape, Paint paint, Paint.Style paintStyle)
{
- float margin = MeMoMaCanvasDrawer.OBJECTLABEL_MARGIN * 1.0f;
+ float margin = MeMoMaCanvasDrawer.OBJECTLABEL_MARGIN;
// 円柱の描画
Path path = new Path();
path.moveTo(objectShape.left, objectShape.top);
return (MeMoMaCanvasDrawer.OBJECTLABEL_MARGIN / 2.0f);
}
- static public float drawObjectNoRegion(Canvas canvas, RectF objectShape, Paint paint)
+ static public void drawObjectNoRegion(Canvas canvas, RectF objectShape, Paint paint)
{
// 何も表示しないとわからないので、ラベルが無いときには枠を表示する
paint.setColor(Color.DKGRAY);
canvas.drawRect(objectShape, paint);
paint.setColor(Color.WHITE);
- return (0.0f);
}
static public float drawObjectLoopStart(Canvas canvas, RectF objectShape, Paint paint)
{
}
+
/**
* 矢印を描画する処理 (ツリー表示時)
- *
- * @param canvas
- * @param paint
- * @param x1
- * @param y1
- * @param checkValue
- * @param isXaxis
+ *
*/
static public void drawArrowTree(Canvas canvas, Paint paint, float x1, float y1, float checkValue, boolean isXaxis)
{
float margin = 8.0f;
- float direction = 1.0f;
- if (isXaxis == true)
+ float direction;
+ if (isXaxis)
{
direction = (checkValue < x1) ? -1.0f : 1.0f;
canvas.drawLine(x1, y1, (x1 + direction * margin), (y1 - margin), paint);
}
/**
* 矢印を描画する処理
- *
- * @param canvas
- * @param paint
- * @param x1
- * @param y1
- * @param x2
- * @param y2
+ *
*/
static public void drawArrow(Canvas canvas, Paint paint, float x1, float y1, float x2, float y2)
{
/**
* オブジェクトのラベルを表示する
- *
- * @param canvas
- * @param paint
- * @param pos
+ *
*/
- public static void drawTextLabel(Canvas canvas, Paint paint, MeMoMaObjectHolder.PositionObject pos, RectF region, int displayObjectInformation, float offsetX, float offsetY)
+ public static void drawTextLabel(Canvas canvas, Paint paint, PositionObject pos, RectF region, int displayObjectInformation, float offsetX, float offsetY)
{
// タイトルの先頭部分を表示する場合...
- String labelToShow = pos.label;
+ String labelToShow = pos.getLabel();
if (displayObjectInformation == 0)
{
float width = region.width() - MeMoMaCanvasDrawer.OBJECTLABEL_MARGIN_WIDTH;
- int textLen = paint.breakText(pos.label, true, width, null); // 省略文字を追加するから、そのぶん減らす
+ int textLen = paint.breakText(pos.getLabel(), true, width, null); // 省略文字を追加するから、そのぶん減らす
labelToShow = labelToShow.substring(0, textLen);
- if (labelToShow != pos.label)
+ if (!labelToShow.equals(pos.getLabel()))
{
// truncate した場合には、省略文字を出す。
labelToShow = labelToShow + "...";
}
}
- if (Paint.Style.valueOf(pos.paintStyle) != Paint.Style.STROKE)
+ if (Paint.Style.valueOf(pos.getPaintStyle()) != Paint.Style.STROKE)
{
// オブジェクトを塗りつぶすのときは、文字の色を設定する
- paint.setColor(pos.labelColor);
+ paint.setColor(pos.getLabelColor());
}
// 文字をちょっと影付きにする
paint.setStyle(Paint.Style.FILL_AND_STROKE);
- paint.setShadowLayer(0.5f, 0.5f, 0.5f, Color.DKGRAY);
+ paint.setShadowLayer(0.7f, 0.7f, 0.7f, Color.DKGRAY);
// ユーザチェックの描画
- if (pos.userChecked == true)
+ if (pos.getUserChecked())
{
canvas.drawText("*", region.centerX(), region.top + (MeMoMaCanvasDrawer.OBJECTLABEL_MARGIN * 2.0f), paint);
}
// 強調表示
- if (pos.strokeWidth != 0.0f)
+ if (pos.getstrokeWidth() != 0.0f)
{
// そのまま表示すると、読めないので、太さを調整し、アンダーラインを引くことにする
paint.setStrokeWidth(0.0f);
float width = region.right - region.left - 12.0f; // 幅
int startChar = 0;
- int endChar = pos.label.length();
+ int endChar = pos.getLabel().length();
do
{
- int textLen = paint.breakText(pos.label, startChar, endChar, true, width, null);
+ int textLen = paint.breakText(pos.getLabel(), startChar, endChar, true, width, null);
canvas.drawText(labelToShow, startChar, (startChar +textLen), posX, posY, paint);
posY = posY - tall;