Ignore:
Timestamp:
2007/07/20 15:58:59 (17 years ago)
Author:
nanasess
Message:

r15064 から svn cp
とりあえず暫定コミット.

  • UTF-8 に変更
  • slib.php, glib.php のクラス化
  • LC_Page の抽象化(一部)
Location:
branches/feature-module-update
Files:
1 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update

    • Property svn:ignore set to
      .cache

      .settings

      .projectOptions
  • branches/feature-module-update/html/admin/total/class/SC_GraphBase.php

    r12157 r15078  
    1313require_once(realpath(dirname( __FILE__)) . "/lib.php");     
    1414 
    15 // SC_Graph¶¦ÄÌ¥¯¥é¥¹ 
     15// SC_Graph共通クラス 
    1616class SC_GraphBase { 
    1717    var $arrRGB; 
     
    3434    var $arrLegend; 
    3535     
    36     // ¥³¥ó¥¹¥È¥é¥¯¥¿ 
     36    // コンストラクタ 
    3737    function SC_GraphBase($bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left, $top) { 
    3838        global $ARR_GRAPH_RGB; 
     
    4646        global $ARR_GRID_COLOR; 
    4747         
    48         // ²èÁüºîÀ® 
     48        // 画像作成 
    4949        $this->bgw = $bgw; 
    5050        $this->bgh = $bgh;   
    5151        $this->image = imagecreatetruecolor($bgw, $bgh); 
    52         // ¥¢¥ó¥Á¥¨¥¤¥ê¥¢¥¹Í­¸ú 
     52        // アンチエイリアス有効 
    5353        if (function_exists("imageantialias")) imageantialias($this->image, true); 
    54         // ÇØ·Ê¿§¤ò¥»¥Ã¥È 
     54        // 背景色をセット 
    5555        imagefill($this->image, 0, 0, lfGetImageColor($this->image, $ARR_BG_COLOR)); 
    5656         
    57         // »ÈÍÑ¿§¤ÎÀ¸À® 
     57        // 使用色の生成 
    5858        $this->setColorList($ARR_GRAPH_RGB); 
    59         // ¥°¥é¥ÕÉÁ²è°ÌÃÖ¤ÎÀßÄê 
     59        // グラフ描画位置の設定 
    6060        $this->left = $left; 
    6161        $this->top = $top; 
     
    6868        $this->grid_color = lfGetImageColor($this->image, $ARR_GRID_COLOR); 
    6969             
    70         // ±Æ¤¢¤ê 
     70        // 影あり 
    7171        $this->shade_on = true; 
    7272    } 
    7373     
    74     // ¥ê¥µ¥ó¥×¥ë(²èÁü¤ò³ê¤é¤«¤Ë½Ì¾®¤¹¤ë) 
     74    // リサンプル(画像を滑らかに縮小する) 
    7575    function resampled() { 
    7676        $new_width = $this->bgw * 0.8; 
     
    8383     
    8484     
    85     // ¥ª¥Ö¥¸¥§¥¯¥È¥«¥é¡¼¤ÎÀßÄê 
     85    // オブジェクトカラーの設定 
    8686    function setColorList($arrRGB) { 
    8787        $this->arrRGB = $arrRGB; 
    8888        $count = count($this->arrRGB); 
    89         // Ä̾￧¤ÎÀßÄê 
     89        // 通常色の設定 
    9090        for($i = 0; $i < $count; $i++) { 
    9191            $this->arrColor[$i] = lfGetImageColor($this->image, $this->arrRGB[$i]); 
    9292        } 
    93         // °Å¿§¤ÎÀßÄê 
     93        // 暗色の設定 
    9494        for($i = 0; $i < $count; $i++) { 
    9595            $this->arrDarkColor[$i] = lfGetImageDarkColor($this->image, $this->arrRGB[$i]); 
     
    9797    } 
    9898     
    99     // ±Æ¤Î¤¢¤ê¤Ê¤· 
     99    // 影のありなし 
    100100    function setShadeOn($shade_on) { 
    101101        $this->shade_on = $shade_on; 
    102102    } 
    103103     
    104     // ²èÁü¤ò½ÐÎϤ¹¤ë 
     104    // 画像を出力する 
    105105    function outputGraph($header = true, $filename = "") { 
    106106        if($header) { 
     
    117117    } 
    118118 
    119     // ÉÁ²è»þ¤Î¥Æ¥­¥¹¥ÈÉý¤òµá¤á¤ë 
     119    // 描画時のテキスト幅を求める 
    120120    function getTextWidth($text, $font_size) { 
    121121        $text_len = strlen($text); 
    122122        $ret = $font_size * $text_len * TEXT_RATE;   
    123123        /* 
    124             ¢¨Àµ³Î¤ÊÃͤ¬¼èÆÀ¤Ç¤­¤Ê¤«¤Ã¤¿¤Î¤ÇÇѻߠ
    125             // ¥Æ¥­¥¹¥ÈÉý¤Î¼èÆÀ 
     124            ※正確な値が取得できなかったので廃止 
     125            // テキスト幅の取得 
    126126            $arrPos = imagettfbbox($font_size, 0, FONT_PATH, $text); 
    127127            $ret = $arrPos[2] - $arrPos[0]; 
     
    130130    } 
    131131     
    132     // ¥Æ¥­¥¹¥È¤ò½ÐÎϤ¹¤ë 
     132    // テキストを出力する 
    133133    function setText($font_size, $left, $top, $text, $color = NULL, $angle = 0, $labelbg = false) { 
    134         // »þ·×²ó¤ê¤Ë³ÑÅÙ¤òÊѹ¹ 
     134        // 時計回りに角度を変更 
    135135        $angle = -$angle;        
    136         // ¥é¥Ù¥ëÇØ·Ê 
     136        // ラベル背景 
    137137        if($labelbg) { 
    138138            $text_width = $this->getTextWidth($text, $font_size); 
     
    148148    } 
    149149     
    150     // ¥¿¥¤¥È¥ë¤ò½ÐÎϤ¹¤ë 
     150    // タイトルを出力する 
    151151    function drawTitle($text, $font_size = TITLE_FONT_SIZE) { 
    152         // ½ÐÎÏ°ÌÃ֤λ»½Ð 
     152        // 出力位置の算出 
    153153        $text_width = $this->getTextWidth($text, $font_size); 
    154154        $left = ($this->bgw - $text_width) / 2; 
     
    157157    } 
    158158     
    159     // ¥í¥°¤ò½ÐÎϤ¹¤ë 
     159    // ログを出力する 
    160160    function debugPrint($text) { 
    161161        $text = mb_convert_encoding($text, "UTF-8", CHAR_CODE); 
     
    163163            $this->text_top = FONT_SIZE + LINE_PAD; 
    164164        }        
    165         // ¥Æ¥­¥¹¥ÈÉÁ²è 
     165        // テキスト描画 
    166166        ImageTTFText($this->image, FONT_SIZE, 0, LINE_PAD, $this->text_top, $this->text_color, FONT_PATH, $text); 
    167167        $this->text_top += FONT_SIZE + LINE_PAD; 
    168168    } 
    169169         
    170     // ¥«¥é¡¼¥é¥Ù¥ë¤òÉÁ²è 
     170    // カラーラベルを描画 
    171171    function drawLegend($legend_max = "", $clabelbg = true) { 
    172         // ËÞÎ㤬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤Ê¤±¤ì¤ÐÃæ»ß 
     172        // 凡例が登録されていなければ中止 
    173173        if(count($this->arrLegend) <= 0) { 
    174174            return; 
     
    185185        $width_max = 0; 
    186186         
    187         // °ìÈÖʸ»ú¿ô¤¬Â¿¤¤¤â¤Î¤ò¼èÆÀ 
     187        // 一番文字数が多いものを取得 
    188188        for($i = 0; $i < $label_max; $i++) { 
    189189            $text_len = strlen($this->arrLegend[$i]); 
     
    195195        $width_max = FONT_SIZE * $text_max * TEXT_RATE;      
    196196 
    197         //  ¥«¥é¡¼¥¢¥¤¥³¥ó¤Èʸ»ú´Ö¤ò´Þ¤á¤¿Éý 
     197        //  カラーアイコンと文字間を含めた幅 
    198198        $width_max += FONT_SIZE + (LINE_PAD * 2);    
    199199        $left = $this->bgw - $width_max - LEGEND_RIGHT; 
    200200        $top = LEGEND_TOP; 
    201         // ¥«¥é¡¼¥é¥Ù¥ëÇطʤÎÉÁ²è 
     201        // カラーラベル背景の描画 
    202202        if($clabelbg) { 
    203203            $this->drawClabelBG($left - LINE_PAD, $top, $left + $width_max, $top + $height_max + LINE_PAD); 
     
    205205        $top += LINE_PAD; 
    206206                 
    207         // ¿§¿ô¤Î¼èÆÀ 
     207        // 色数の取得 
    208208        $c_max = count($this->arrColor); 
    209209        for($i = 0; $i < $label_max; $i++) {             
    210             // ¥«¥é¡¼¥¢¥¤¥³¥ó¤Îɽ¼¨ 
     210            // カラーアイコンの表示 
    211211            imagerectangle($this->image, $left, $top, $left + FONT_SIZE, $top + FONT_SIZE, $this->flame_color); 
    212212            imagefilledrectangle($this->image, $left + 1, $top + 1, $left + FONT_SIZE - 1, $top + FONT_SIZE - 1, $this->arrColor[($i % $c_max)]); 
    213             // ¥é¥Ù¥ë¤Îɽ¼¨ 
     213            // ラベルの表示 
    214214            $this->setText(FONT_SIZE, $left + FONT_SIZE + LINE_PAD, $top, $this->arrLegend[$i]); 
    215215            $top += FONT_SIZE + LINE_PAD; 
     
    217217    } 
    218218     
    219     // ¥«¥é¡¼¥é¥Ù¥ëÇطʤÎÉÁ²è 
     219    // カラーラベル背景の描画 
    220220    function drawClabelBG($left, $top, $right, $bottom) { 
    221         // ±Æ¤ÎÉÁ²è 
     221        // 影の描画 
    222222        if($this->shade_on) { 
    223223            imagefilledrectangle($this->image, $left + 2, $top + 2, $right + 2, $bottom + 2, $this->shade_color); 
    224224        } 
    225         // ¥«¥é¡¼¥é¥Ù¥ëÇطʤÎÉÁ²è 
     225        // カラーラベル背景の描画 
    226226        imagefilledrectangle($this->image, $left, $top, $right, $bottom, $this->clabelbg_color); 
    227227        imagerectangle($this->image, $left, $top, $right, $bottom, $this->flame_color); 
    228228    } 
    229229     
    230     // ËÞÎã¤ò¥»¥Ã¥È¤¹¤ë 
     230    // 凡例をセットする 
    231231    function setLegend($arrLegend) { 
    232232        $this->arrLegend = array_values((array)$arrLegend); 
Note: See TracChangeset for help on using the changeset viewer.