⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jpgraph_iconplot.php

📁 极限网络智能办公系统 - Office Automation 2008 官方100% 源码
💻 PHP
字号:
<?php
 

class IconPlot
{

	public $iX = 0;
	public $iY = 0;
	public $iScale = 1;
	public $iMix = 100;
	private $iHorAnchor = "left";
	private $iVertAnchor = "top";
	private $iFile = "";
	private $iAnchors = array
	(
		0 => "left",
		1 => "right",
		2 => "top",
		3 => "bottom",
		4 => "center"
	);
	private $iCountryFlag = "";
	private $iCountryStdSize = 3;
	private $iScalePosY = null;
	private $iScalePosX = null;
	private $iImgString = "";

	public function IconPlot( $aFile = "", $aX = 0, $aY = 0, $aScale = 1, $aMix = 100 )
	{
		$this->iFile = $aFile;
		$this->iX = $aX;
		$this->iY = $aY;
		$this->iScale = $aScale;
		if ( $aMix < 0 || 100 < $aMix )
		{
			JpGraphError::raisel( 8001 );
		}
		$this->iMix = $aMix;
	}

	public function SetCountryFlag( $aFlag, $aX = 0, $aY = 0, $aScale = 1, $aMix = 100, $aStdSize = 3 )
	{
		$this->iCountryFlag = $aFlag;
		$this->iX = $aX;
		$this->iY = $aY;
		$this->iScale = $aScale;
		if ( $aMix < 0 || 100 < $aMix )
		{
			JpGraphError::raisel( 8001 );
		}
		$this->iMix = $aMix;
		$this->iCountryStdSize = $aStdSize;
	}

	public function SetPos( $aX, $aY )
	{
		$this->iX = $aX;
		$this->iY = $aY;
	}

	public function CreateFromString( $aStr )
	{
		$this->iImgString = $aStr;
	}

	public function SetScalePos( $aX, $aY )
	{
		$this->iScalePosX = $aX;
		$this->iScalePosY = $aY;
	}

	public function SetScale( $aScale )
	{
		$this->iScale = $aScale;
	}

	public function SetMix( $aMix )
	{
		if ( $aMix < 0 || 100 < $aMix )
		{
			JpGraphError::raisel( 8001 );
		}
		$this->iMix = $aMix;
	}

	public function SetAnchor( $aXAnchor = "left", $aYAnchor = "center" )
	{
		if ( in_array( $aXAnchor, $this->iAnchors ) )
		{
		}
		if ( !in_array( $aYAnchor, $this->iAnchors ) )
		{
			JpGraphError::raisel( 8002 );
		}
		$this->iHorAnchor = $aXAnchor;
		$this->iVertAnchor = $aYAnchor;
	}

	public function PreStrokeAdjust( $aGraph )
	{
	}

	public function DoLegend( $aGraph )
	{
	}

	public function Max( )
	{
		return array(
			false,
			false
		);
	}

	public function GetMaxDate( )
	{
		return false;
	}

	public function GetMinDate( )
	{
		return false;
	}

	public function GetLineNbr( )
	{
		return 0;
	}

	public function GetAbsHeight( )
	{
		return 0;
	}

	public function Min( )
	{
		return array(
			false,
			false
		);
	}

	public function StrokeMargin( &$aImg )
	{
		return true;
	}

	public function Stroke( $aImg, $axscale, $ayscale )
	{
		$this->StrokeWithScale( $aImg, $axscale, $ayscale );
	}

	public function StrokeWithScale( $aImg, $axscale, $ayscale )
	{
		if ( $this->iScalePosX === null || $this->iScalePosY === null )
		{
			$this->_Stroke( $aImg );
		}
		else
		{
			$this->_Stroke( $aImg, round( $axscale->Translate( $this->iScalePosX ) ), round( $ayscale->Translate( $this->iScalePosY ) ) );
		}
	}

	public function GetWidthHeight( )
	{
		$dummy = 0;
		return $this->_Stroke( $dummy, null, null, true );
	}

	public function _Stroke( $aImg, $x = null, $y = null, $aReturnWidthHeight = false )
	{
		if ( $this->iFile != "" && $this->iCountryFlag != "" )
		{
			JpGraphError::raisel( 8003 );
		}
		if ( $this->iFile != "" )
		{
			$gdimg = Graph::loadbkgimage( "", $this->iFile );
		}
		else
		{
			if ( $this->iImgString != "" )
			{
				$gdimg = Image::createfromstring( $this->iImgString );
			}
			else
			{
				if ( !class_exists( "FlagImages", false ) )
				{
					JpGraphError::raisel( 8004 );
				}
				$fobj = new FlagImages( $this->iCountryStdSize );
				$dummy = "";
				$gdimg = $fobj->GetImgByName( $this->iCountryFlag, $dummy );
			}
		}
		$iconw = imagesx( $gdimg );
		$iconh = imagesy( $gdimg );
		if ( $aReturnWidthHeight )
		{
			return array(
				round( $iconw * $this->iScale ),
				round( $iconh * $this->iScale )
			);
		}
		if ( $x !== null && $y !== null )
		{
			$this->iX = $x;
			$this->iY = $y;
		}
		if ( 0 <= $this->iX && $this->iX <= 1 )
		{
			$w = imagesx( $aImg->img );
			$this->iX = round( $w * $this->iX );
		}
		if ( 0 <= $this->iY && $this->iY <= 1 )
		{
			$h = imagesy( $aImg->img );
			$this->iY = round( $h * $this->iY );
		}
		if ( $this->iHorAnchor == "center" )
		{
			$this->iX -= round( $iconw * $this->iScale / 2 );
		}
		if ( $this->iHorAnchor == "right" )
		{
			$this->iX -= round( $iconw * $this->iScale );
		}
		if ( $this->iVertAnchor == "center" )
		{
			$this->iY -= round( $iconh * $this->iScale / 2 );
		}
		if ( $this->iVertAnchor == "bottom" )
		{
			$this->iY -= round( $iconh * $this->iScale );
		}
		$aImg->CopyMerge( $gdimg, $this->iX, $this->iY, 0, 0, round( $iconw * $this->iScale ), round( $iconh * $this->iScale ), $iconw, $iconh, $this->iMix );
	}

}

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -