Browse Source

修改了“BaseCfg.php”、“Batch.php”

master
yuanjiajia 3 years ago
parent
commit
491f73090a
  1. 49
      src/scene/BaseCfg.php
  2. 3
      src/scene/Batch.php

49
src/scene/BaseCfg.php

@ -51,8 +51,9 @@ class BaseCfg extends Base
$name = implode(".", array_map('strtolower', StringHelper::camelStrToArray($name))); $name = implode(".", array_map('strtolower', StringHelper::camelStrToArray($name)));
$value = $item->getValue($this); $value = $item->getValue($this);
if (is_string($value))
switch(gettype($value))
{ {
case 'string':
if( count(explode(" ", $value)) != 3 || in_array(false,array_map('is_numeric',explode(" ", $value))) ) if( count(explode(" ", $value)) != 3 || in_array(false,array_map('is_numeric',explode(" ", $value))) )
{ {
$ret .= "{$className}.{$name} = \"{$value}\"\n"; $ret .= "{$className}.{$name} = \"{$value}\"\n";
@ -61,31 +62,29 @@ class BaseCfg extends Base
{ {
$ret .= "{$className}.{$name} = {$value}\n"; $ret .= "{$className}.{$name} = {$value}\n";
} }
}
else if (is_integer($value))
{
break;
case 'integer':
$ret .= "{$className}.{$name} = {$value}\n"; $ret .= "{$className}.{$name} = {$value}\n";
}
else if (is_bool($value))
{
break;
case 'boolean':
$value = $value ? 1 : 0; $value = $value ? 1 : 0;
$ret .= "{$className}.{$name} = {$value}\n"; $ret .= "{$className}.{$name} = {$value}\n";
}
else if (is_object($value) && $value instanceof BaseCfg)
{
break;
case 'object':
$ret .= $value->toString($className); $ret .= $value->toString($className);
}
else if(is_null($value))
{
//$ret .= "{$className}.{$name} = \"null\"\n";
$ret = $ret;
}
else if(is_float($value))
{
break;
case 'NULL':
break;
case 'double':
$ret .= "{$className}.{$name} = {$value}\n"; $ret .= "{$className}.{$name} = {$value}\n";
}
else if(is_array($value))
{
break;
case 'array':
foreach(StringHelper::arrayToString($value) as $value) foreach(StringHelper::arrayToString($value) as $value)
{ {
if( $name == 'imagepipelines' && $className == 'film' ) if( $name == 'imagepipelines' && $className == 'film' )
@ -98,11 +97,13 @@ class BaseCfg extends Base
$ret .= "{$className}.{$name}.{$value}\n"; $ret .= "{$className}.{$name}.{$value}\n";
} }
} }
}
else
{
break;
default:
$ret .= "{$className}.{$name} = \"unknow type\"\n"; $ret .= "{$className}.{$name} = \"unknow type\"\n";
} }
} }
return $ret; return $ret;
} }

3
src/scene/Batch.php

@ -19,7 +19,7 @@ class Batch extends BaseCfg
/** /**
* @var float 噪波阈值,(取值:浮点型色值) * @var float 噪波阈值,(取值:浮点型色值)
*/ */
public $haltthreshold = 0.02;
public $haltthreshold;
/** /**
* @var object 存储一个 haltThresHold类 对象 * @var object 存储一个 haltThresHold类 对象
@ -29,6 +29,7 @@ class Batch extends BaseCfg
public function useNoiseThreshold($config= []) public function useNoiseThreshold($config= [])
{ {
$this->haltthresholdcfg = new HaltThresHold($config); $this->haltthresholdcfg = new HaltThresHold($config);
$this->haltthreshold = 0.02;
} }
} }

Loading…
Cancel
Save