public class ObjectShapeDrawer
{
-
static public float drawObjectOval(Canvas canvas, RectF objectShape, Paint paint)
{
// 楕円形の描画
return (MeMoMaCanvasDrawer.OBJECTLABEL_MARGIN / 2.0f);
}
- static public void drawLineStraight(Canvas canvas)
- {
-
- }
-
/**
* 矢印を描画する処理 (ツリー表示時)
*
* オブジェクトのラベルを表示する
*
*/
- public static void drawTextLabel(Canvas canvas, Paint paint, PositionObject pos, RectF region, int displayObjectInformation, float offsetX, float offsetY)
- {
- // タイトルの先頭部分を表示する場合...
- String labelToShow = pos.getLabel();
- if (displayObjectInformation == 0)
- {
- float width = region.width() - MeMoMaCanvasDrawer.OBJECTLABEL_MARGIN_WIDTH;
- int textLen = paint.breakText(pos.getLabel(), true, width, null); // 省略文字を追加するから、そのぶん減らす
- labelToShow = labelToShow.substring(0, textLen);
- if (!labelToShow.equals(pos.getLabel()))
- {
- // truncate した場合には、省略文字を出す。
- labelToShow = labelToShow + "...";
- }
- }
-
- if (Paint.Style.valueOf(pos.getPaintStyle()) != Paint.Style.STROKE)
- {
- // オブジェクトを塗りつぶすのときは、文字の色を設定する
- paint.setColor(pos.getLabelColor());
- }
-
- // 文字をちょっと影付きにする
- paint.setStyle(Paint.Style.FILL_AND_STROKE);
- paint.setShadowLayer(0.7f, 0.7f, 0.7f, Color.DKGRAY);
-
- // ユーザチェックの描画
- if (pos.getUserChecked())
- {
- canvas.drawText("*", region.centerX(), region.top + (MeMoMaCanvasDrawer.OBJECTLABEL_MARGIN * 2.0f), paint);
- }
-
- // 強調表示
- if (pos.getstrokeWidth() != 0.0f)
- {
- // そのまま表示すると、読めないので、太さを調整し、アンダーラインを引くことにする
- paint.setStrokeWidth(0.0f);
- paint.setSubpixelText(true);
- paint.setUnderlineText (true);
- }
-
- if (displayObjectInformation == 0)
- {
- // 1行分しか表示しない場合...そのまま表示して終了する
- canvas.drawText(labelToShow, (region.left + offsetX), (region.centerY() + offsetY), paint);
- return;
- }
-
- float tall = paint.getFontMetrics().top + 1.0f;
- float posX = (region.left + offsetX);
- float posY = (region.centerY() + offsetY);
- float width = region.right - region.left - 12.0f; // 幅
-
- int startChar = 0;
- int endChar = pos.getLabel().length();
- do
- {
- int textLen = paint.breakText(pos.getLabel(), startChar, endChar, true, width, null);
- canvas.drawText(labelToShow, startChar, (startChar +textLen), posX, posY, paint);
-
- posY = posY - tall;
- startChar = startChar + textLen;
- } while (startChar < endChar);
- }
+ public static void drawTextLabel(Canvas canvas, Paint paint, PositionObject pos, RectF region, int displayObjectInformation, float offsetX, float offsetY)
+ {
+ // タイトルの先頭部分を表示する場合...
+ String labelToShow = pos.getLabel();
+ if (displayObjectInformation == 0)
+ {
+ float width = region.width() - MeMoMaCanvasDrawer.OBJECTLABEL_MARGIN_WIDTH;
+ int textLen = paint.breakText(pos.getLabel(), true, width, null); // 省略文字を追加するから、そのぶん減らす
+ labelToShow = labelToShow.substring(0, textLen);
+ if (!labelToShow.equals(pos.getLabel()))
+ {
+ // truncate した場合には、省略文字を出す。
+ labelToShow = labelToShow + "...";
+ }
+ }
+
+ if (Paint.Style.valueOf(pos.getPaintStyle()) != Paint.Style.STROKE)
+ {
+ // オブジェクトを塗りつぶすのときは、文字の色を設定する
+ paint.setColor(pos.getLabelColor());
+ }
+
+ // 文字をちょっと影付きにする
+ paint.setStyle(Paint.Style.FILL_AND_STROKE);
+ paint.setShadowLayer(0.7f, 0.7f, 0.7f, Color.DKGRAY);
+
+ // ユーザチェックの描画
+ if (pos.getUserChecked())
+ {
+ canvas.drawText("*", region.centerX(), region.top + (MeMoMaCanvasDrawer.OBJECTLABEL_MARGIN * 2.0f), paint);
+ }
+
+ // 強調表示
+ if (pos.getstrokeWidth() != 0.0f)
+ {
+ // そのまま表示すると、読めないので、太さを調整し、アンダーラインを引くことにする
+ paint.setStrokeWidth(0.0f);
+ paint.setSubpixelText(true);
+ paint.setUnderlineText (true);
+ }
+
+ if (displayObjectInformation == 0)
+ {
+ // 1行分しか表示しない場合...そのまま表示して終了する
+ canvas.drawText(labelToShow, (region.left + offsetX), (region.centerY() + offsetY), paint);
+ return;
+ }
+
+ float tall = paint.getFontMetrics().top + 1.0f;
+ float posX = (region.left + offsetX);
+ float posY = (region.centerY() + offsetY);
+ float width = region.right - region.left - 12.0f; // 幅
+
+ int startChar = 0;
+ int endChar = pos.getLabel().length();
+ do
+ {
+ int textLen = paint.breakText(pos.getLabel(), startChar, endChar, true, width, null);
+ canvas.drawText(labelToShow, startChar, (startChar +textLen), posX, posY, paint);
+
+ posY = posY - tall;
+ startChar = startChar + textLen;
+ } while (startChar < endChar);
+ }
}
import android.util.Log;
import android.widget.Toast;
-import jp.sourceforge.gokigen.memoma.Main;
import jp.sourceforge.gokigen.memoma.R;
/**
public static final float DUPLICATEPOSITION_MARGIN = 15.0f;
- public static final float OBJECTSIZE_DEFAULT_X = 144.0f;
- public static final float OBJECTSIZE_DEFAULT_Y = (OBJECTSIZE_DEFAULT_X / 16.0f * 9.0f);
+ public static final float OBJECTSIZE_DEFAULT_X = 256.0f;
+ public static final float OBJECTSIZE_DEFAULT_Y = (OBJECTSIZE_DEFAULT_X / 16.0f * 10.0f);
- public static final float OBJECTSIZE_MINIMUM_X = 48.0f;
- public static final float OBJECTSIZE_MINIMUM_Y = (OBJECTSIZE_MINIMUM_X / 16.0f * 9.0f);
+ public static final float OBJECTSIZE_MINIMUM_X = 90.0f;
+ public static final float OBJECTSIZE_MINIMUM_Y = (OBJECTSIZE_MINIMUM_X / 16.0f * 10.0f);
- public static final float OBJECTSIZE_MAXIMUM_X = 14400.0f;
- public static final float OBJECTSIZE_MAXIMUM_Y = (OBJECTSIZE_MAXIMUM_X / 16.0f * 9.0f);
+ public static final float OBJECTSIZE_MAXIMUM_X = 25600.0f;
+ public static final float OBJECTSIZE_MAXIMUM_Y = (OBJECTSIZE_MAXIMUM_X / 16.0f * 10.0f);
- public static final float OBJECTSIZE_STEP_X = OBJECTSIZE_MINIMUM_X * 1.0f;
- public static final float OBJECTSIZE_STEP_Y = OBJECTSIZE_MINIMUM_Y * 1.0f;
+ public static final float OBJECTSIZE_STEP_X = OBJECTSIZE_MINIMUM_X;
+ public static final float OBJECTSIZE_STEP_Y = OBJECTSIZE_MINIMUM_Y;
- public static final float FONTSIZE_DEFAULT = 12.0f;
+ public static final float FONTSIZE_DEFAULT = 20.0f;
private final MeMoMaConnectLineHolder connectLineHolder;
- private Hashtable<Integer, PositionObject> objectPoints;
+ private final Hashtable<Integer, PositionObject> objectPoints;
private Integer serialNumber = 1;
private String dataTitle = "";
private String background = "";
- private Context parent;
+ private final Context parent;
private final IOperationHistoryHolder historyHolder;
public MeMoMaObjectHolder(Context context)
/**
* データの有無を見る (true の場合、データはない。)
- *
- *
*/
public boolean isEmpty()
{
return (serialNumber);
}
+/*
public void dumpPositionObject(PositionObject position)
{
if (position == null)
RectF posRect = position.getRect();
Log.v(TAG, "[" + posRect.left + "," + posRect.top + "][" + posRect.right + "," + posRect.bottom + "] " + "label : " + position.getLabel() + " detail : " + position.getDetail());
}
-
-
+*/
+
/**
* オブジェクトを複製する。
- *
- *
- *
*/
public PositionObject duplicatePosition(int key)
{
objectPoints.put(id, position);
return (position);
}
-
- public PositionObject createPosition(float x, float y, int drawStyle)
- {
- PositionObject position = createPosition(serialNumber);
- RectF posRect = position.getRect();
- position.setRectLeft(posRect.left + x);
- position.setRectRight(posRect.right + x);
- position.setRectTop(posRect.top + y);
- position.setRectBottom(posRect.bottom + y);
- position.setDrawStyle(drawStyle);
+
+ public PositionObject createPosition(float x, float y, int drawStyle)
+ {
+ PositionObject position = createPosition(serialNumber);
+ RectF posRect = position.getRect();
+ position.setRectLeft(posRect.left + x);
+ position.setRectRight(posRect.right + x);
+ position.setRectTop(posRect.top + y);
+ position.setRectBottom(posRect.bottom + y);
+ position.setDrawStyle(drawStyle);
serialNumber++;
return (position);
- }
+ }
/**
* オブジェクトのサイズを拡大する
/**
* オブジェクトのサイズを縮小する
- *
- *
*/
public void shrinkObjectSize(Integer key)
{
position.setRectBottom(posRect.bottom - OBJECTSIZE_STEP_Y);
}
+/*
public MeMoMaConnectLineHolder getLineHolder()
{
return (connectLineHolder);
}
-
+*/
static public int getObjectDrawStyleIcon(int drawStyle)
{
int icon = 0;