OSDN Git Service

オブジェクトの最初の大きさを調整する。
authorMRSa <mrsa@myad.jp>
Wed, 3 May 2023 15:00:45 +0000 (00:00 +0900)
committerMRSa <mrsa@myad.jp>
Wed, 3 May 2023 15:00:45 +0000 (00:00 +0900)
app/src/main/java/jp/sourceforge/gokigen/memoma/drawers/MeMoMaCanvasDrawer.java
app/src/main/java/jp/sourceforge/gokigen/memoma/drawers/ObjectShapeDrawer.java
app/src/main/java/jp/sourceforge/gokigen/memoma/holders/MeMoMaObjectHolder.java

index fe7e4f0..1352ae4 100644 (file)
@@ -232,7 +232,7 @@ public class MeMoMaCanvasDrawer implements ICanvasDrawer,  GestureDetector.OnGes
                  screenWidth = width;
                  screenHeight = height;
 
-          Log.v(TAG, "changedScreenProperty() " + "x:" + width + " , " + "y:" + height);
+          Log.v(TAG, "changedScreenProperty() " + "x:" + screenWidth + " , " + "y:" + screenHeight);
          }
 
 
index 15703d9..3007778 100644 (file)
@@ -19,7 +19,6 @@ import jp.sourceforge.gokigen.memoma.holders.PositionObject;
 public class ObjectShapeDrawer
 {
 
-
     static public float drawObjectOval(Canvas canvas, RectF objectShape, Paint paint)
     {
         // 楕円形の描画
@@ -240,11 +239,6 @@ public class ObjectShapeDrawer
         return (MeMoMaCanvasDrawer.OBJECTLABEL_MARGIN / 2.0f);
     }
 
-    static public void drawLineStraight(Canvas canvas)
-    {
-       
-    }
-
          /**
           *    矢印を描画する処理 (ツリー表示時)
           *
@@ -305,68 +299,68 @@ public class ObjectShapeDrawer
             *    オブジェクトのラベルを表示する
             *
             */
-           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);
+      }
 }
index 3818df0..9dd6767 100644 (file)
@@ -9,7 +9,6 @@ import android.graphics.RectF;
 import android.util.Log;
 import android.widget.Toast;
 
-import jp.sourceforge.gokigen.memoma.Main;
 import jp.sourceforge.gokigen.memoma.R;
 
 /**
@@ -50,27 +49,27 @@ public class MeMoMaObjectHolder
     
     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)
@@ -83,8 +82,6 @@ public class MeMoMaObjectHolder
 
     /**
      *    データの有無を見る (true の場合、データはない。)
-     * 
-     *
      */
     public boolean isEmpty()
     {
@@ -179,6 +176,7 @@ public class MeMoMaObjectHolder
        return (serialNumber);
     }
 
+/*
     public void dumpPositionObject(PositionObject position)
     {
        if (position == null)
@@ -188,13 +186,10 @@ public class MeMoMaObjectHolder
        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)
     {
@@ -241,19 +236,19 @@ public class MeMoMaObjectHolder
                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);
-    }
+       }
 
     /**
      *   オブジェクトのサイズを拡大する
@@ -285,8 +280,6 @@ public class MeMoMaObjectHolder
 
     /**
      *   オブジェクトのサイズを縮小する
-     * 
-     *
      */
     public void shrinkObjectSize(Integer key)
     {
@@ -312,11 +305,12 @@ public class MeMoMaObjectHolder
         position.setRectBottom(posRect.bottom - OBJECTSIZE_STEP_Y);
     }
 
+/*
     public MeMoMaConnectLineHolder getLineHolder()
        {
                return (connectLineHolder);
        }
-       
+*/
        static public int getObjectDrawStyleIcon(int drawStyle)
        {
                int icon = 0;